@zeniai/web-app-ui 5.3.63-dev → 5.3.64-dev-beta0KB
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-BRZHYOUR.js → AccountMappingScreen-C_GVFaoh.js} +2 -2
- package/dist/assets/ActualMatchingMatchDetailScreen-Br9CFUye.js +1 -0
- package/dist/assets/AddressRoutes-Bw_nh--O.js +1 -0
- package/dist/assets/AddressScreen-CvhZrOl1.js +9 -0
- package/dist/assets/AiCfoScreen-enlKpZc4.js +22 -0
- package/dist/assets/{AppDrawer-DZIMVdFc.js → AppDrawer-BvDyxQG-.js} +1 -1
- package/dist/assets/BillPayApprovalRoutes-D18TxHMc.js +1 -0
- package/dist/assets/{BillPayRoutes-CUUjBefv.js → BillPayRoutes-CloKoO0m.js} +6 -6
- package/dist/assets/{BusinessVerificationPageScreen-DFamYzxa.js → BusinessVerificationPageScreen-wzhfqwbN.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-Cx5KkOYw.js → CardsAiCfoScreen-CsPjsbB8.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-DzIBuJeY.js → ChargeCardRoutes-CeG2_2Iv.js} +9 -9
- package/dist/assets/CompanyPassportScreen-CTdU0eT4.js +1 -0
- package/dist/assets/ConnectionAuthScreen-tQkR0Qdq.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-Cfna6QXU.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CjmJGGJm.js → CustomerOnboardingRoutes-C2PIK8CC.js} +3 -3
- package/dist/assets/{DashboardRoutes-ByHBLKcB.js → DashboardRoutes-B6PQcDII.js} +4 -4
- package/dist/assets/DefaultTenantHome-R8lvjrth.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-BOXpXEFg.js +18 -0
- package/dist/assets/{DrawerScreen-B5BqRZEJ.js → DrawerScreen-kd-vUIOU.js} +1 -1
- package/dist/assets/EntityDetailRoutes-CKVztcFF.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-CZBhc5OO.js +38 -0
- package/dist/assets/FeaturePreviewScreen-DlYWStt_.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-BiVfvVOh.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-x0fdv66l.js → InboxNotificationsProvider-jZPrqdDf.js} +1 -1
- package/dist/assets/InvoicingRoutes-CTeBd6HD.js +2 -0
- package/dist/assets/{MagicLinkRoutes-C5BKMtwW.js → MagicLinkRoutes-DBawNNk_.js} +20 -20
- package/dist/assets/MagicLinkSignInScreen-CKyZ86AC.js +12 -0
- package/dist/assets/MobileAppDrawer-thURFqdR.js +1 -0
- package/dist/assets/NotFoundScreen-CjcmfT5h.js +1 -0
- package/dist/assets/{NotificationRoutes-DICT3yoM.js → NotificationRoutes-B5kGRr3c.js} +1 -1
- package/dist/assets/OAuthConsentScreen-DKPtywIw.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DuKFzXpp.js +1 -0
- package/dist/assets/{PaymentLinkScreen-Cz1wlNqO.js → PaymentLinkScreen-DgjfMeF_.js} +9 -9
- package/dist/assets/PeopleRoutes-BFFXxsrW.js +22 -0
- package/dist/assets/PerformanceRoutes-DlDpAJN4.js +1 -0
- package/dist/assets/{Preview-Dz6yJNce.js → Preview-CFep9b6s.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-D8eeXRWb.js → QBOConnectionScreen-zn7s2M2b.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-h6pN24Dd.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-La5bMk76.js +1 -0
- package/dist/assets/ReimbursementRoutes-DpjqJ1j9.js +68 -0
- package/dist/assets/{ReportsRoutes-CqUKv9Uh.js → ReportsRoutes-Tu97hQPr.js} +1 -1
- package/dist/assets/RewardsRoutes-C7-L_VuA.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CLEogplJ.js → ScheduleDetailsPrepaidExpensesScreen-BNVCc0tE.js} +5 -5
- package/dist/assets/ScreenRoutes-DUiJb0LC.js +2 -0
- package/dist/assets/{SettingsRoutes-QcMcR-j3.js → SettingsRoutes-BVrPYY3-.js} +6 -6
- package/dist/assets/{SetupPagesScreen-fuvb0IYd.js → SetupPagesScreen-Cx3OOUGr.js} +4 -4
- package/dist/assets/SignInScreen-BXBlASFY.js +1 -0
- package/dist/assets/SignOutScreen-BN1O2qGb.js +9 -0
- package/dist/assets/{TaskListScreen-C2urPjKT.js → TaskListScreen-DrflApgr.js} +2 -2
- package/dist/assets/{TaskRoutes-BuzkCbPW.js → TaskRoutes-BxW92Ol2.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-CUdtnWL8.js +1 -0
- package/dist/assets/{TransactionDetailScreen-CQr1YyP0.js → TransactionDetailScreen-C2qhnA5b.js} +2 -2
- package/dist/assets/TransactionListRoutes-Bt_C_073.js +1 -0
- package/dist/assets/{TreasuryRoutes-CbD79DO8.js → TreasuryRoutes-DJK_7z5t.js} +5 -5
- package/dist/assets/{VendorsRoutes-CCYu89Uf.js → VendorsRoutes-dr-KQ_Nk.js} +13 -13
- package/dist/assets/WiseConfirmationScreen-BjSMumPA.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-CoRmS3Mc.js → ZeniAccountRoutes-mpb2ppPH.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-C6P6WNnP.js +9 -0
- package/dist/assets/{accountMappingHelper-tmyjt9rr.js → accountMappingHelper-D5I8xPpR.js} +1 -1
- package/dist/assets/analytics-CVpLIXYS.js +68 -0
- package/dist/assets/{analyticsHelper-BEL0ra9X.js → analyticsHelper-DIAaX2E9.js} +1 -1
- package/dist/assets/{core-CHD8T-IM.js → core-BmXpopk3.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-p_nrn8Pg.js → decodeURIComponentSafe-CmNiiSLm.js} +1 -1
- package/dist/assets/{dnd-Dwi6R-ey.js → dnd-CFbFq_On.js} +1 -1
- package/dist/assets/{empty-CeRjDJvl.js → empty-0E71-pkh.js} +1 -1
- package/dist/assets/{empty-CZC5CrVC.js → empty-IUpx8pFE.js} +1 -1
- package/dist/assets/{emptyVideoElement-BQ5qxpg6.js → emptyVideoElement-DvAsJwe7.js} +1 -1
- package/dist/assets/epic-Dp0UOOW0.js +2 -0
- package/dist/assets/expenseAutomationHelper-wsi-w_Qs.js +1 -0
- package/dist/assets/{getLocaleForTenant-D-or0iZO.js → getLocaleForTenant-CLcFXXBi.js} +1 -1
- package/dist/assets/{index-DKH4PK2B.js → index-BH7Z90Ry.js} +16554 -16011
- package/dist/assets/{index-BMy5YH8G.js → index-BwG9RDJd.js} +1 -1
- package/dist/assets/{index-yiW1aZfy.js → index-DaYn0dIv.js} +2 -2
- package/dist/assets/{index-CKiMoeFX.js → index-Diiw4rJ6.js} +1 -1
- package/dist/assets/{index-BVHBHjSe.js → index-_EB0AYfG.js} +1 -1
- package/dist/assets/{index-XRUedCJ0.js → index-n9iskFtR.js} +1 -1
- package/dist/assets/{index-C1KaIuMT.js → index-nMXCGK26.js} +1 -1
- package/dist/assets/{index-w09kaOHP.js → index-xAn5v5dB.js} +1 -1
- package/dist/assets/{lexical-CMNdypK6.js → lexical-CUqOWG_f.js} +1 -1
- package/dist/assets/{liveblocks-e6rGc1UF.js → liveblocks-2F3ER8H4.js} +1 -1
- package/dist/assets/{lottie-B778bt56.js → lottie-Do5BYuHO.js} +1 -1
- package/dist/assets/{mui-NTaF3UaY.js → mui-DpZKsKJ-.js} +1 -1
- package/dist/assets/{pathToGoBack-3T3qt1CN.js → pathToGoBack-IYhrTF3T.js} +1 -1
- package/dist/assets/{pdf-Bx92ZlM_.js → pdf-CaVqV5T4.js} +3 -3
- package/dist/assets/{pdf-lib-CSbJ_JNk.js → pdf-lib-DgpGz3__.js} +1 -1
- package/dist/assets/{plaid-DdTo7m1-.js → plaid-B0sfsJHV.js} +1 -1
- package/dist/assets/{pusher-TnSBrmnt.js → pusher-BZ4RRfso.js} +1 -1
- package/dist/assets/{react-BRi8TcMI.js → react-B40uyjvd.js} +1 -1
- package/dist/assets/{react-COkaiBQo.js → react-BlQV6oEC.js} +1 -1
- package/dist/assets/{react-Ba46BK4D.js → react-CM6JlJfX.js} +1 -1
- package/dist/assets/{react-Ci1ltUcy.js → react-CVdpmzlC.js} +1 -1
- package/dist/assets/{react-DJOUavGZ.js → react-Cx2vmGsH.js} +1 -1
- package/dist/assets/{react-B75Gnqob.js → react-cC2pOmRW.js} +1 -1
- package/dist/assets/{recharts-C6xUtcdL.js → recharts-lgPPofcu.js} +1 -1
- package/dist/assets/routePaths-DuFLBwyX.js +1 -0
- package/dist/assets/{sentry-DsyKtMW2.js → sentry-Dwi3Xpu2.js} +1 -1
- package/dist/assets/{stripSplatSuffix-CKrdD9MQ.js → stripSplatSuffix-Cm_Bj9mb.js} +1 -1
- package/dist/assets/{url-Zl9uXQ4e.js → url-B3IdPeRD.js} +1 -1
- package/dist/assets/{url-ClJewK9Y.js → url-CuCw2GYz.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-CTL9QRWv.js +1 -0
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B1hI9_5p.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-B82QOIYm.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-BWi4_PP5.js → useChargeCardPusherEvents-CNgbxhoK.js} +1 -1
- package/dist/assets/{useDeviceId-VsdzmSZI.js → useDeviceId-Dklpg4lb.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-BfOhSDOo.js +1 -0
- package/dist/assets/useEnsureVendorListLoaded-BtOYIHPo.js +1 -0
- package/dist/assets/{useInitialThreadRequest-DDr_z_RH.js → useInitialThreadRequest-DagpMHc1.js} +1 -1
- package/dist/assets/useTaskManagerAccess-DvrYqbN3.js +1 -0
- package/dist/assets/{useTaskManagerPusherEvents-DCIopLVZ.js → useTaskManagerPusherEvents-Be2DL4pK.js} +1 -1
- package/dist/assets/{utils-CCA3F0sZ.js → utils-DAgs23EZ.js} +1 -1
- package/dist/assets/withTransactionSidePanel-Dn8x-lme.js +25 -0
- package/dist/assets/{zeni-epic-state-BO3zdDfL.js → zeni-epic-state-DtY6MD5C.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/ActualMatchingMatchDetailScreen-CT_TfQgQ.js +0 -1
- package/dist/assets/AddressRoutes-CisWqyoC.js +0 -1
- package/dist/assets/AddressScreen-CrINuapd.js +0 -9
- package/dist/assets/AiCfoScreen-BXw0LDjo.js +0 -22
- package/dist/assets/BillPayApprovalRoutes-Dp_PkbIk.js +0 -1
- package/dist/assets/CompanyPassportScreen-CENbDnLW.js +0 -1
- package/dist/assets/ConnectionAuthScreen-DTyZxcME.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-zLmHJyqv.js +0 -1
- package/dist/assets/DefaultTenantHome-Dm9FOXup.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-086WQWRB.js +0 -18
- package/dist/assets/EntityDetailRoutes-BuN3sXNp.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-Ce3IicTe.js +0 -38
- package/dist/assets/FeaturePreviewScreen-D54Nwanb.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-BRUwb2B6.js +0 -1
- package/dist/assets/InvoicingRoutes-IQsFojD0.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-9LYlxmop.js +0 -12
- package/dist/assets/MobileAppDrawer-DX2JnkbM.js +0 -1
- package/dist/assets/NotFoundScreen-CtgFRYZy.js +0 -1
- package/dist/assets/OAuthConsentScreen-BmiLDdxn.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DAq9XRB1.js +0 -1
- package/dist/assets/PeopleRoutes-DgYtveDU.js +0 -22
- package/dist/assets/PerformanceRoutes-B6iTINLg.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-CE6y6IwA.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-BT_O_PEv.js +0 -1
- package/dist/assets/ReimbursementRoutes-BmOT-3C-.js +0 -68
- package/dist/assets/RewardsRoutes-D5CR9NnI.js +0 -1
- package/dist/assets/ScreenRoutes-xDjhbdP1.js +0 -2
- package/dist/assets/SignInScreen-ekGlkjLH.js +0 -1
- package/dist/assets/SignOutScreen-9NJIr2hr.js +0 -9
- package/dist/assets/TransactionDetailRoutes-D99Yv6kv.js +0 -1
- package/dist/assets/TransactionListRoutes-BTidVr9Z.js +0 -1
- package/dist/assets/WiseConfirmationScreen-B0HeU8Sh.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-BnpFJ5jB.js +0 -9
- package/dist/assets/analytics-C3e3An3a.js +0 -68
- package/dist/assets/epic-BW8jUHg5.js +0 -2
- package/dist/assets/expenseAutomationHelper-kGR6VZFG.js +0 -1
- package/dist/assets/routePaths-CGyE-cU7.js +0 -1
- package/dist/assets/useActualMatchingMatchDetail-Cc17Q5Tv.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CHbHmZzx.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BcCbRGDK.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-ClXdZp-6.js +0 -1
- package/dist/assets/useTaskManagerAccess-CUv6a62x.js +0 -1
- package/dist/assets/withTransactionSidePanel-B_xgLNm6.js +0 -25
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-e6rGc1UF.js";import{a as r}from"./sentry-DsyKtMW2.js";import{u as A,h as P,i as F,j as k,t as Z,l as O,s as H,g as W,N as B,n as oe,o as j}from"./core-CHD8T-IM.js";import{a9 as tt,k as v,ar as R,U as u,cd as it,ce as ot,cf as at,cg as st,ch as ct,ci as rt,cj as lt,ck as dt,cl as ut,cm as gt,cn as mt,co as vt,p as X,cp as pt,cq as St,z as G,af as ce,cr as ft,cs as ht,ct as It,cu as Ct,cv as kt,cw as Et,cx as yt,cy as xt,cz as bt,cA as jt,W as Dt,aj as un,cB as At,cC as Pt,cD as Lt,cE as $t,cF as wt,cG as _t,cH as Ft,cI as Rt,cJ as Tt,cK as Ot,cL as Mt,t as qe,l as $e,cM as Nt,cN as Ut,cO as Bt,cP as Vt,cQ as Ht,cR as qt,cS as zt}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import{A as Q}from"./AddressScreen-CrINuapd.js";import M from"./NotFoundScreen-CtgFRYZy.js";import{ZQ as Qt,ZR as Kt,vp as ze,ZS as K,vS as re,ZT as we,ZU as le,wt as be,wA as Gt,wF as gn,ZV as _e,wx as mn,y7 as Qe,vR as Ke,ZW as Zt,ZX as vn,wQ as je,ZY as de,wU as Wt,ZZ as Xt,Z_ as pn,wX as Sn,z2 as Jt,Z$ as Se,_0 as Ge,_1 as fn,vP as Yt,_2 as ei,vJ as ni,_3 as ti,yk as ii,_4 as hn,yt as Ze,_5 as oi,yq as ai,_6 as Fe,gh as Re,_7 as te,_8 as ie,xa as si,vX as We,w0 as In,v_ as ci,vU as ri,x3 as li,w2 as di,xc as ui,_9 as De,xl as Cn,xj as J,xh as ue,xg as gi,_a as kn,yz as Xe,_b as mi,vQ as En,_c as Te,fF as fe,wb as Ae,w8 as Pe,wl as yn,wk as Oe,w5 as vi,we as xn,wn as ae,VC as bn,vT as Me,wi as pi,wj as Si,wh as fi,_d as hi,wV as Ii,wR as jn,_e as Dn,vD as Je,_f as Ci,vz as ki,_g as Ei,yF as yi,yJ as q,yE as xi,xN as he,_h as bi,_i as An,yS as Ye,_j as ji,yP as Di,_k as Pn,xQ as Ai,xR as V,xU as Pi,_l as Ln,y2 as Ee,_m as Li,xb as $n,U8 as wn,_n as $i,yc as wi,_o as _n,_p as _i,_q as Fi,_r as Ri,zH as Ti,_s as Oi,_t as Fn,yZ as Rn,_u as Tn,zF as ye,_v as Mi,zC as Ni,_w as Ui,_x as Bi,_y as Vi,_z as Hi,_A as qi,_B as en,_C as zi,eg as Qi,zL as Ki,_D as Ne,xv as Gi,xq as Zi,_E as ge,xG as On,xy as me,xx as Wi,xB as Mn,_F as Xi,xw as Ji,_G as Nn,z3 as Un,zu as nn,zp as Yi,_H as eo,z4 as no,_I as to,zv as io,zz as oo,_J as Ue,wv as Bn,zg as ao,ww as so,_K as co,_L as Vn,c8 as ro,ms as lo,mt as uo,_M as tn,wu as ve,gl as go,mz as mo,zm as Hn,zX as vo,zj as qn,uX as po,zU as on,uL as So,zR as an,hS as fo,UB as sn,UC as ho,Gh as zn,hK as Io,_N as Co,Vr as ko,_O as Eo,A0 as xe,A1 as yo,_P as xo,_Q as Qn,z_ as bo,_R as jo,_S as Do,yg as Ao,_T as Po}from"./zeni-epic-state-BO3zdDfL.js";import{M as Lo}from"./MobileAppDrawer-DX2JnkbM.js";import{q as pe}from"./QBOConnectionScreen-D8eeXRWb.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.js";import"./empty-CeRjDJvl.js";import"./pdf-lib-CSbJ_JNk.js";import"./index-BVHBHjSe.js";import"./url-ClJewK9Y.js";import"./index-CKiMoeFX.js";import"./decodeURIComponentSafe-p_nrn8Pg.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]="1299e822-ef52-448e-8335-8786314f704f",t._sentryDebugIdIdentifier="sentry-dbid-1299e822-ef52-448e-8335-8786314f704f")}catch{}})();const $=({event:t,isReady:e=!0})=>e?a.jsx(tt,{analytics:v,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function $o(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:I}=k(Qt),y=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${n??""}/invoicing`,C=r.useCallback(((L,U)=>{const T=Kt(b,L,U,E);T!=null&&(v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{entity:L,entityId:U,fromScreen:"audit_log"}),e(T))}),[E,e,b]);r.useEffect((()=>{const L=setTimeout((()=>d(o)),300);return()=>clearTimeout(L)}),[o]),r.useEffect((()=>{i&&t(ze({filters:y,keepExistingListItems:!1,sort:g}))}),[i,y,g,t]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,x=m==="In-Progress"&&f.length>0,w=m==="Completed";return N(m)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingAuditLogPage,isReady:w}),a.jsx(it,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:I,entries:f,hasMore:S,isLoading:D,isLoadingMore:x,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{S&&h!=null&&t(ze({cursor:h,filters:y,keepExistingListItems:!0,sort:g}))},onSearchChange:s,onSortChange:p})]})}function Ie(t,e=!1){const n=A(),i=k((c=>K(c).productNextCursor!=null)),o=k((c=>K(c).productNextCursor)),s=k((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&s!=="Not-Started"||n(re({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&s!=="In-Progress"&&i&&o!=null&&n(re({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,s,i,o])}function Y(t,e,n,i){const[o,s]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const p=l.current==="In-Progress";l.current=t,t==="Completed"&&p&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),s((p=>p+1)))}),[c,e]),o}const wo=new Set(["plan"]),_o=O((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!==""?o=>{i!==""&&t(mn({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&t(_e({id:i,localData:o}))},onSaveEdit:()=>{v.trackInvoicingActionClick(u.Event.invoicingCatalogItemEdited,{itemId:i}),t(gn({id:i}))},onSubFamilyLifecycleAction:(o,s)=>{i!==""&&t(Gt({action:s,id:o,parentItemId:i}))}}}))(ot);function Fo(){const t=A(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[o]=Z(),{areTenantIdsInSync:s}=R(),c=(d=o.get("kind"))!=null&&wo.has(d)?d:"plan";var d;const l=k((y=>we(y,n))),{pageFetchState:p}=l,g=p.fetchState;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[t,n]),r.useEffect((()=>{s&&t(be({id:n,kind:c}))}),[s,n,c,t]);const m=r.useCallback((y=>t(be({cacheOverride:!0,id:y,kind:c}))),[t,c]),S=Y(l.fetchState,l.isFormLoading,n,m),f=g==="Completed"&&!l.isFormLoading;Ie(s,!0);const[h,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const I=h!==n&&(g==="Not-Started"||g==="In-Progress"||l.isFormLoading);return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCatalogItemDetailPage,isReady:f}),a.jsx(_o,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:I,view:l},S)]})}const Ro=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=we(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,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:o}=e,s=o!=null?`${n}/catalog/${encodeURIComponent(o)}`:`${n}/catalog`;return{onBack:()=>e.navigate(s),onCancel:()=>{v.trackInvoicingActionClick(u.Event.invoicingCatalogItemFormCancelled),t(le({id:o})),e.navigate(`${n}/catalog`)},onChange:c=>{t(_e({id:o,localData:c}))},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingCatalogItemSaved,{mode:i}),t(gn({id:o}))}}}))(at);function Mo(){const t=A(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[o]=Z(),{areTenantIdsInSync:s}=R(),c=n!=null,d=o.get("type"),l=d!=null&&Ro.has(d)?d:void 0,p=(g=o.get("kind"))!=null&&To.has(g)?g:"plan";var g;const m=k((S=>we(S,n)));return Ie(s,!0),r.useEffect((()=>{s&&t(be({id:n,kind:p}))}),[s,n,p,t]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||t(_e({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(le({id:n}))}}),[m.fetchState,m.savedItemId,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCatalogItemFormPage}),a.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",o=e.activeTab==="all",s=i?n.plans:o?[...n.plans,...n.products]:n.products,c=i||o&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:o&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&s.length===0,isLoadingMore:c==="In-Progress"&&s.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",s=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:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=No[e.activeTab];v.trackInvoicingActionClick(u.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{v.trackInvoicingActionClick(u.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{v.trackInvoicingActionClick(u.Event.invoicingCatalogItemLifecycleAction,{action:d,fromScreen:"catalog_list",itemId:c}),t(mn({action:Zt(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&t(Ke({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(re({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));s!=null&&t(i?Ke({cursor:s,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):re({cursor:s,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(st);function Bo(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState("plans"),[l,p]=r.useState(""),[g,m]=r.useState(null),S=r.useMemo((()=>g!=null?{dir:g.direction,field:g.columnKey}:void 0),[g]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),I=k((L=>K(L))),y=I.planFilters.search,b=I.planSort,C=I.planNextCursor,D=I.productNextCursor,x=I.fetchState==="Completed",w=I.runningActionId??null;return r.useEffect((()=>{const L=setTimeout((()=>p(o)),300);return()=>clearTimeout(L)}),[o]),r.useEffect((()=>{i&&t(Qe({cacheOverride:!1,planFilters:h,productFilters:E,planSort:S,productSort:S}))}),[i,t,h,E,S]),r.useEffect((()=>{i&&(f!==y||S?.field!==b?.field||S?.dir!==b?.dir)&&t(Qe({cacheOverride:!0,planFilters:h,productFilters:E,planSort:S,productSort:S}))}),[y,b,i,t,h,E,f,S]),N(I.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCatalogPage,isReady:x}),a.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:o,sortState:g,planFilters:h,productFilters:E,sort:S,planNextCursor:C,productNextCursor:D,runningCatalogItemActionId:w,onSearchChange:s,onTabChange:d,onSortChange:m})]})}const Vo=O((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,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",s=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(s),onCancel:()=>{v.trackInvoicingActionClick(u.Event.invoicingCouponFormCancelled),t(de({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(Xt({id:i,localData:c}))},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingCouponSaved,{mode:o}),t(Wt({id:i}))}}}))(ct);function Ho(){const t=A(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCouponId:c}=k((d=>vn(d,n)));return r.useEffect((()=>{o&&t(je({id:n}))}),[o,n,t]),r.useEffect((()=>{if(s==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(de({id:n}))}}),[s,c,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCouponFormPage}),a.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((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:()=>{v.trackInvoicingActionClick(u.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:o=>{e(fn(o))},onSubmit:()=>{const o=ei(t.localData);v.trackInvoicingActionClick(u.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(ni(o))}}}))(lt);function zo(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),[i]=Z(),{areTenantIdsInSync:o}=R(),s=i.get("customerId"),c=k((C=>pn(C))),d=c.fetchState,l=c.localData,p=c.savedInvoiceId,g=k(Sn),m=k((C=>Jt(C))),S=k(Se),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&g==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,E=f||h,I=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||s==null||s===""||l.customerId!==""||(y.current=!0,t(fn({...l,customerId:s})))}),[s,l,t]),r.useEffect((()=>{o&&t(Yt({cacheOverride:!1}))}),[o,t]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const D=p!=null?`/${n}/invoicing/invoices/${encodeURIComponent(p)}`:`/${n}/invoicing/invoices`;e(D)}}),[d,p,e,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCreateInvoicePage,isReady:I}),E?a.jsx(rt,{}):a.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(dt);function Ko(){const t=A(),e=P(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),s=k((d=>ti(d,n??""))),c=s.fetchState==="Completed";return r.useEffect((()=>{o&&n!=null&&t(ii({id:n}))}),[o,n,t]),N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCreditDetailPage,isReady:c}),a.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:s})]})}const Go=O((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",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:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(ai({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(ut);function Zo(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,creditNoteListFetchState:I}=k((b=>{const C=hn(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(Ze({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCreditsListPage,isReady:y}),a.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,onSearchChange:s,onStatusChange:b=>t(oi(b)),onSortChange:p})]})}const Kn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((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:o=>{t(De({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(J(ue)),t(gi({id:i}))},onOpenAddress:()=>{const o=Kn(e.tenantEmailDomain??"",ue,i),s=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:o=>{v.trackInvoicingActionClick(u.Event.invoicingCustomerEdited,{customerId:i}),t(De({id:i,localData:o})),t(Cn({id:i}))},onFetchPaymentLinkEmailPreview:o=>t(ui({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,s,c)=>t(di({body:c,customerId:i,email:o,subject:s})),onSubscriptionClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)}}}))(vt);function Xo(){const t=A(),e=P(),n=W(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:s}=R(),c=k((T=>Fe(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[p,g]=r.useState(!1),[m,S]=r.useState(!1),[f,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const E=f===i,{plaidTokenFetchState:I,promotionalCreditSubmitState:y}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:D}=c.record,x=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const T=c.record.sendLinkState.fetchState;x.current!=="Error"&&T==="Error"&&t(Re({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),x.current=T}),[t,c.record.sendLinkState.fetchState]);const w=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":I.fetchState==="Error"?I.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(te()),t(ie()),()=>{t(te()),t(ie())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{s&&i!=null&&t(si({id:i}))}),[s,i,t]),r.useEffect((()=>{s&&i!=null&&D&&t(We({customerId:i}))}),[s,i,t,D]);const L=r.useCallback((T=>t(In({id:T}))),[t]),U=Y(c.fetchState,c.isFormLoading,i,L);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCustomerDetailPage,isReady:l}),a.jsx(Wo,{customerId:i??"",editView:c,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{t(te()),i!=null&&D&&t(We({customerId:i})),g(!0)},onCreatePromotionalCredits:()=>{t(ie()),S(!0)}},U),a.jsx(gt,{errorMessage:w,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:p,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:D,onChooseCard:()=>{i!=null&&t(ri({customerId:i}))},onClose:()=>{g(!1),t(te())},onSavePaymentMethod:T=>{i!=null&&t(ci({customerId:i,data:T}))}}),a.jsx(mt,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:m,submitSucceeded:y.fetchState==="Completed",onClose:()=>{S(!1),t(ie())},onSubmit:({amount:T,description:ne})=>{i!=null&&t(li({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ne}))}})]})}const Jo=O((function(t,e){const n=Fe(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}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",s=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(s),onCancel:()=>{v.trackInvoicingActionClick(u.Event.invoicingCustomerFormCancelled),t(kn({id:i})),t(J(ue)),e.navigate(`${n}/customers`)},onChange:c=>{t(De({id:i,localData:c}))},onOpenAddress:()=>{const c=Kn(e.tenantEmailDomain??"",ue,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingCustomerSaved,{mode:o}),t(Cn({id:i}))}}}))(pt);function Yo(){const t=A(),e=P(),n=W(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:s}=R(),{fetchState:c,savedCustomerId:d}=k((l=>Fe(l,i)));return r.useEffect((()=>{s&&i!=null&&t(In({id:i}))}),[s,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,p=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(p),t(kn({id:i}))}}),[c,d,i,t,e,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCustomerFormPage}),a.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:o})]})}const ea=O((function(t){const e=Se(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:()=>{v.trackInvoicingActionClick(u.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":v.trackInvoicingActionClick(u.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":v.trackInvoicingActionClick(u.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":v.trackInvoicingActionClick(u.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(En({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(St);function na(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,customerListFetchState:I}=k((b=>{const C=Se(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingCustomersListPage,isReady:y}),a.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,onSearchChange:s,onStatusChange:b=>t(mi(b)),onSortChange:p})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:o,sessionId:s,view:c}=e,d=s==null?void 0:c.diagnosticsBySession[s],l=d?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:d?.items??[],errorMessage:l==="Error"?d?.fetch.error?.message:void 0,expired:d?.expired??!1,filters:o,hasMore:d?.nextCursor!=null,isLoading:l==="Not-Started"||l==="In-Progress",isLoadingMore:l==="In-Progress"&&(d?.items.length??0)>0,session:Le(c,s)}}),(function(t,e){const{filters:n,navigate:i,sessionId:o,tenantEmailDomain:s,view:c}=e,d=o==null?void 0:c.diagnosticsBySession[o],l=Le(c,o),p=c.actionStateByKind.retry?.fetchState==="In-Progress",g=c.actionStateByKind.rollback?.fetchState==="In-Progress",m=l?.status==="done"&&l.rollback_available_until!=null&&new Date(l.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>i(`/${s}/invoicing/data_import`),onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&d?.nextCursor!=null&&t(Pe({...n,cursor:d.nextCursor,sessionId:o}))},onRetry:l?.status!=="failed"||p?void 0:()=>{o!=null&&t(Oe(o))},onRollback:m?()=>{o!=null&&t(yn(o))}:void 0}}))(ft);function ia(){const t=A(),e=P(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),[s,c]=r.useState({}),d=k(Te),l=k(fe),p=r.useMemo((()=>{const E=G.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:l.tenantId}}),[l.tenantId]),g=Le(d,n),m=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{o&&n!=null&&t(Ae(n))}),[o,t,n]),r.useEffect((()=>{if(!o||n==null)return;const E=setTimeout((()=>{t(Pe({...s,sessionId:n}))}),300);return()=>clearTimeout(E)}),[o,t,s,n]);const S=g?.status==="scanning"||g?.status==="importing";r.useEffect((()=>{if(!o||n==null||!S)return;const E=setInterval((()=>{t(Ae(n)),t(Pe({...s,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[o,t,s,S,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;s.moduleId!=null&&E.set("module_id",s.moduleId),s.level!=null&&E.set("level",s.level),s.outcome!=null&&E.set("outcome",s.outcome),s.search!=null&&s.search.trim()!==""&&E.set("search",s.search.trim());const I=E.toString();return`${ce?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${I===""?"":`?${I}`}`}),[s,n]),h=m?.fetch.fetchState??"Not-Started";return N(h)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDataImportHubPage,isReady:g!=null&&h!=="Not-Started"}),a.jsx(ta,{authParams:p,csvDownloadUrl:f,filters:s,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Gn=t=>`invoicing_active_migration:${t}`,se=(t,e)=>{if(t!=null&&t!=="")try{const n=Gn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:o,statusRows:s}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||s.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:s}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,o=s=>{const c=s??null;t(ae(c)),se(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:s=>{v.trackInvoicingActionClick(u.Event.invoicingImportSessionAction,{action:"continue",sessionId:s}),o(s)},onNewImport:()=>{v.trackInvoicingActionClick(u.Event.invoicingNewImportClicked),o()},onRetrySession:s=>{v.trackInvoicingActionClick(u.Event.invoicingImportSessionAction,{action:"retry",sessionId:s}),t(Oe(s)),o(s)},onRollbackSession:s=>{v.trackInvoicingActionClick(u.Event.invoicingImportSessionAction,{action:"rollback",sessionId:s}),t(yn(s))},onViewSession:s=>{v.trackInvoicingActionClick(u.Event.invoicingImportSessionAction,{action:"view_details",sessionId:s}),n(`/${i}/invoicing/data_import/${encodeURIComponent(s)}`)}}}))(ht);function aa(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),o=k(Te);r.useEffect((()=>{i&&(t(vi()),t(xn()))}),[i,t]);const s=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDataImportHubPage,isReady:s}),a.jsx(oa,{navigate:e,tenantEmailDomain:n,view:o})]})}const sa=O((function(t,e){const{activeId:n,authParams:i,integrationsView:o,settings:s,templatesDownloadUrl:c,view:d}=e,{actionStateByKind:l,sessionDetail:p,sessions:g}=d,m=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),S=n!=null?p[n]:void 0;return{authParams:i,templatesDownloadUrl:c,chargebeeConnected:s?.chargebee_connected===!0||(m?.isValid??!1),chargebeeConnectorAvailable:m!=null,chargebeeSite:s?.chargebee_site,connectError:l.connect?.error?.message,connecting:l.connect?.fetchState==="In-Progress",retrying:l.retry?.fetchState==="In-Progress",session:S??g.find((f=>f.id===n)),starting:l.start?.fetchState==="In-Progress",uploading:l.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{v.trackInvoicingActionClick(u.Event.invoicingChargebeeConnectClicked),t(fi())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{n!=null&&t(Oe(n))},onSaveLater:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportStarted),n!=null&&t(Si(n))},onUpload:s=>{v.trackInvoicingActionClick(u.Event.invoicingImportFileUploaded),t(pi({files:s}))},onViewDetails:n==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(It);function ca(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),o=k(Sn),s=k(fe),c=r.useMemo((()=>{const I=G.getSignedInUser();return{userId:I?.userId??"",sessionId:I?.zeniSessionId??"",tenantId:s.tenantId}}),[s.tenantId]),d=`${ce?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,l=s.companyId??G.getSignedInUserTenant(n??"")?.companyId,p=k((I=>bn(I,l))),g=k(Te),{activeMigrationSessionId:m}=g,S=m??void 0,f=S!=null?g.sessionDetail[S]??g.sessions.find((I=>I.id===S)):void 0;r.useEffect((()=>{i&&(t(Me()),t(xn()))}),[i,t]),r.useEffect((()=>{if(m!=null)return;const I=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Gn(y))}catch{return null}})(n);I!=null&&t(ae(I))}),[m,t,n]),r.useEffect((()=>{se(n,m)}),[m,n]);const h=f?.status,E=h==="scanning"||h==="importing";return r.useEffect((()=>{if(!i||S==null||!E)return;const I=setInterval((()=>{t(Ae(S))}),3e3);return()=>clearInterval(I)}),[i,S,E,t]),r.useEffect((()=>{h==="done"&&(t(ae(null)),se(n,null))}),[t,h,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDataImportMigratePage}),a.jsx(sa,{activeId:S,authParams:c,integrationsView:p,navigate:e,settings:o,templatesDownloadUrl:d,tenantEmailDomain:n,view:g,onBack:()=>{t(ae(null)),se(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ra=O((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:o=>{t(jn({action:o,id:i}))},onSaveEdit:o=>{v.trackInvoicingActionClick(u.Event.invoicingCouponEdited,{couponId:i}),t(Ii({data:o,id:i}))}}}))(Ct);function la(){const t=A(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),s=k((h=>hi(h,n))),c=s.actionState.fetchState==="In-Progress",d=s.pageFetchState.fetchState,l=d==="Completed",[p,g]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&g(n)}),[n,l]);const m=p===n;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[n,t]),r.useEffect((()=>{o&&t(je({id:n}))}),[o,n,t]);const S=r.useCallback((h=>t(je({cacheOverride:!0,id:h}))),[t]),f=Y(s.fetchState,s.isFormLoading,n,S);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDiscountDetailPage,isReady:l}),a.jsx(ra,{hasLoadedRecord:m,couponId:n??"",discountLifecycleActionOptions:s.discountLifecycleActionOptions,editView:s,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=Dn(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=>{v.trackInvoicingActionClick(u.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{v.trackInvoicingActionClick(u.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,o)=>{v.trackInvoicingActionClick(u.Event.invoicingCouponLifecycleAction,{action:o,couponId:i,fromScreen:"discounts_list"}),t(jn({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(ki({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(kt);function ua(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,couponListFetchState:I,runningDiscountActionId:y}=k((C=>{const D=Dn(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),H),b=I==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDiscountsListPage,isReady:b}),a.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,runningDiscountActionId:y,onSearchChange:s,onStatusChange:C=>t(Ci(C)),onSortChange:p})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:s=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onCancel:o?()=>t(q({action:"cancel",id:i})):void 0,onResolve:o?()=>{v.trackInvoicingActionClick(u.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:o?()=>{v.trackInvoicingActionClick(u.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:o?()=>{v.trackInvoicingActionClick(u.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(yt);function ma(){const t=A(),e=P(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),s=k((x=>Ei(x,n??""))),c=s.fetchState==="Completed",d=s.dunningCase?.invoiceID,[l,p]=r.useState("idle"),[g,m]=r.useState(!1),[S,f]=r.useState(),[h,E]=r.useState(!1),I=r.useCallback((()=>{p("idle"),m(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(yi({id:n})),p("idle"),m(!1);const x=s.emailPreview.preview;f(x==null?void 0:{body:x.body,cc:x.cc,subject:x.subject,to:x.to}),E(!0)}),[n,t,s.emailPreview.preview]),b=r.useCallback((x=>{n!=null&&l!=="pending"&&(m(!1),p("pending"),v.trackInvoicingActionClick(u.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:x,id:n})))}),[n,t,l]),C=r.useMemo((()=>s.emailPreview.preview==null?void 0:{bodyToken:s.emailPreview.preview.bodyToken,renderedHtmlTemplate:s.emailPreview.preview.renderedHtmlTemplate,subjectToken:s.emailPreview.preview.subjectToken}),[s.emailPreview.preview]);r.useEffect((()=>{o&&n!=null&&t(xi({id:n}))}),[o,n,t]),r.useEffect((()=>{o&&d!=null&&t(he({invoiceId:d}))}),[o,d,t]),r.useEffect((()=>{p("idle"),m(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{o||(p("idle"),m(!1),f(void 0),E(!1))}),[o]),r.useEffect((()=>{h&&S==null&&s.emailPreview.preview!=null&&f({body:s.emailPreview.preview.body,cc:s.emailPreview.preview.cc,subject:s.emailPreview.preview.subject,to:s.emailPreview.preview.to})}),[s.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(s.actionState.fetchState!=="In-Progress"?g&&s.actionState.fetchState==="Completed"?(n!=null&&t(bi({id:n})),I()):g&&s.actionState.fetchState==="Error"&&p("failed"):m(!0))}),[n,I,t,l,g,s.actionState.fetchState]);const D=d!=null&&s.linkedInvoice?.id===d?s.linkedInvoice.dunningAttempts:void 0;return N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDunningDetailPage,isReady:c}),a.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:s,dunningAttempts:D,onSendEmail:y}),a.jsx(Et,{initialDraft:S,isPreviewLoading:s.emailPreview.fetchState==="Not-Started"||s.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:I,onSend:b,open:h,preview:C,previewErrorMessage:s.emailPreview.fetchState==="Error"?s.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?s.actionState.error?.message:void 0})]})}const va=O((function(t){const e=An(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(v.trackInvoicingActionClick(u.Event.invoicingDunningAction,{action:o,caseId:i,fromScreen:"dunning_list"}),t(q({action:o,id:i})))},onLoadMore:()=>{e.nextCursor!=null&&t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(xt);function pa(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,dunningCaseListFetchState:I}=k((b=>{const C=An(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(Ye({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingDunningListPage,isReady:y}),a.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,onSearchChange:s,onStatusChange:b=>t(ji(b)),onSortChange:p})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!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;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{v.trackInvoicingActionClick(u.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{v.trackInvoicingActionClick(u.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Pi({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
|
|
2
|
-
`).map((s=>s.trim())).filter((s=>s!=="")).map((s=>({note:s}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))}}}))(bt);function fa(){const t=A(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),s=k((f=>Pn(f,n??""))),c=s.pageFetchState.fetchState,d=c==="Completed",[l,p]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&p(n)}),[n,d]);const g=l===n;r.useEffect((()=>{o&&n!=null&&t(Ai({invoiceId:n}))}),[o,n,t]);const m=r.useCallback((f=>t(he({invoiceId:f}))),[t]),S=Y(s.actionState.fetchState,s.fetchState==="In-Progress",n,m);return N(c)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:g,navigate:e,tenantEmailDomain:i,view:s},S)]})}const ha=O((function(t){const e=Ln(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{v.trackInvoicingActionClick(u.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":v.trackInvoicingActionClick(u.Event.invoicingRecordPaymentClicked,{fromScreen:"invoices_list",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":v.trackInvoicingActionClick(u.Event.invoicingCreditNoteIssued,{fromScreen:"invoices_list",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":v.trackInvoicingActionClick(u.Event.invoicingInvoiceReminderSent,{fromScreen:"invoices_list",invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":v.trackInvoicingActionClick(u.Event.invoicingInvoiceRegenerated,{fromScreen:"invoices_list",invoiceId:i}),t(V({action:"regenerate",invoiceId:i}));break;case"void":v.trackInvoicingActionClick(u.Event.invoicingInvoiceVoided,{fromScreen:"invoices_list",invoiceId:i}),t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{v.trackInvoicingActionClick(u.Event.invoicingInvoiceVoided,{fromScreen:"invoices_list",invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&t($n({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(jt);function Ia(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,invoiceListFetchState:I,voidingInvoiceId:y}=k((C=>{const D=Ln(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),H),b=I==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(Ee({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingInvoicesListPage,isReady:b}),a.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,voidingInvoiceId:y,onSearchChange:s,onStatusChange:C=>{t(Li(C)),t(Ee({cacheOverride:!1,filters:m,sort:g}))},onSortChange:p})]})}function cn(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),i=Dt(),o=un(),[s,c]=r.useState(!1),{acceptTermsState:d,status:l}=k(wn),p=$i(i?.loggedInUserRoleMap),g=`/${n}/invoicing`,m=S=>{c(S)};return l==="completed"?a.jsx(B,{to:`${g}/overview`,replace:!0}):l==="settings"&&p?a.jsx(B,{to:`${g}/settings`,replace:!0}):a.jsxs(a.Fragment,{children:[a.jsx(Lo,{isAppContentDrawerOpen:s,handleDrawerToggle:m}),a.jsx(At,{analytics:v,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!p,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{t(wi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Ca=O((function(t,e){const n=_n(t,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:s,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:s,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:o=>{t(Oi({localData:o}))},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ti())}}}))(Pt);function ka(){const t=A(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:p}=k((f=>_n(f,n??""))),g=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(_i()),m.current=null}),[t,n]),r.useEffect((()=>{o&&n!=null&&t(he({invoiceId:n}))}),[o,t,n]),r.useEffect((()=>{c!=null&&n!=null&&s==="Completed"&&m.current!==n&&(m.current=n,t(Fi({localData:Ri(c)})))}),[t,s,c,n]);const S=r.useRef(p.fetchState);return r.useEffect((()=>{const f=S.current;S.current=p.fetchState,f!=="Completed"&&p.fetchState==="Completed"&&l!=null&&e(`${g}/credits/${encodeURIComponent(l)}`)}),[l,e,p.fetchState,g]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Ea=O((function(t){return{invoicingOverview:Fn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Rn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{v.trackInvoicingActionClick(u.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{v.trackInvoicingActionClick(u.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Lt);function ya(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),s=k((c=>Fn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Rn(o))}),[i,t,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingOverviewPage,isReady:s}),a.jsx(Ea,{navigate:e,selectedPeriod:o,tenantEmailDomain:n})]})}const xa=O((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:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{v.trackInvoicingActionClick(u.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))($t);function ba(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:E,transactionListFetchState:I,transactions:y}=k((w=>{const L=Tn(w);return{activeType:L.activeTab,appliedSearch:L.filters.search,appliedSort:L.sort,nextCursor:L.nextCursor,transactionListFetchState:L.fetchState,transactions:L.transactions}}),H),b=I==="Completed",C=`/${n}/invoicing`,D=r.useCallback((w=>{const L=y.find((T=>T.id===w)),U=L?.linkedInvoices?.[0]?.invoiceID??L?.invoiceID;U!=null&&(v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(U)}`))}),[e,C,y]),x=r.useCallback((w=>{const L=y.find((U=>U.id===w))?.customerID;L!=null&&(v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{customerId:L,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(L)}`))}),[e,C,y]);return r.useEffect((()=>{const w=setTimeout((()=>d(o)),300);return()=>clearTimeout(w)}),[o]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(ye({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingPaymentsListPage,isReady:b}),a.jsx(xa,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,onSearchChange:s,onTypeChange:w=>{t(Mi(w)),t(ye({cacheOverride:!1,filters:m,sort:g}))},onSortChange:p,onViewTransactionCustomer:x,onViewTransactionInvoice:D})]})}const ja=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=A(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=R(),s=n!=null&&n!=="",c=k(Se),d=k((x=>Ui(x))),l=k(Bi),p=k((x=>Pn(x,n??""))),g=p.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Vi()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{o&&t(s&&n!=null?he({invoiceId:n}):En({filters:{},keepExistingListItems:!1}))}),[o,t,n,s]),r.useEffect((()=>{s&&g!=null&&n!=null&&p.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Hi({contextInvoiceId:n,localData:qi(g)})))}),[t,g,n,p.fetchState,s]),r.useEffect((()=>{if(s)return;const x=d.localData.customerId;x!==""&&x!==f.current&&(f.current=x,t($n({filters:{customerId:x},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(en({localData:{...d.localData,customerId:x,invoiceToLink:""}})))}),[t,d.localData,s]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const x=h.current;if(h.current=l.fetchState,x!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const E=r.useMemo((()=>c.customers.map((x=>({id:x.id,name:ja(x)})))),[c.customers]),I=k((x=>zi(x,d.localData.customerId))),y=r.useMemo((()=>I.map((x=>{return{amountDue:(w=x.amountDue,L=Qi.currencySymbol,Ft("0,0.00",w,L)),amountDueValue:x.amountDue,id:x.id,label:x.invoiceNumber};var w,L}))),[I]),b=r.useMemo((()=>{if(!s||g==null)return;const x=g.currencyCode??"USD",w=g.amountDue?.amount??0;return{amountDue:wt("0,0.00",g.amountDue),amountDueValue:w,currencyCode:x,customerName:g.customerName??g.customerID,invoiceId:g.id,invoiceNumber:g.invoiceNumber??g.id}}),[g,s]),C=s?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,D=!s||p.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingRecordPaymentPage,isReady:D}),a.jsx(_t,{customers:E,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:y,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:s?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{v.trackInvoicingActionClick(u.Event.invoicingRecordPaymentCancelled),e(C)},onChange:x=>{t(en({localData:x}))},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:s?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Ki(s?n??void 0:void 0))}})]})}const Zn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Da=O((function(t,e){const{editView:n}=e,i=n.subscription,o=i?.status,s=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:s,charges:n.charges,coupons:n.coupons,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,o=i!=="",s=(c,d)=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Mn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ge({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&s("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(J(me)),t(Wi({id:i}))},onOpenAddress:()=>{const c=Zn(e.tenantEmailDomain??"",me,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ge({id:i,localData:c})),t(On({id:i}))},onCancelSubscription:o?c=>{s("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?s(c):s(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Rt);function Aa(){const t=A(),e=P(),n=W(),{subscription_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:s}=R(),c=k((y=>Ne(y,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:p}=c,g=c.pageFetchState.fetchState,m=g==="Completed"&&!c.isFormLoading,[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const h=S===i;Ie(s),r.useEffect((()=>{s&&i!=null&&t(Gi({id:i}))}),[s,i,t]);const E=r.useCallback((y=>t(Zi({id:y}))),[t]),I=Y(c.fetchState,c.isFormLoading,i,E);return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSubscriptionDetailPage,isReady:m}),a.jsx(Da,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:p,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},I)]})}const Pa=O((function(t,e){const n=Ne(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,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,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionFormCancelled),t(Nn({id:i})),t(J(me)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:s=>{t(ge({id:i,localData:s}))},onOpenAddress:()=>{const s=Zn(e.tenantEmailDomain??"",me,i),c=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionSaved,{mode:o}),t(On({id:i}))}}}))(Tt);function La(){const t=A(),e=P(),n=W(),{subscription_id:i,tenantEmailDomain:o}=F(),[s]=Z(),{areTenantIdsInSync:c}=R(),d=s.get("customerId"),{fetchState:l,savedSubscriptionId:p}=k((S=>Xi(S,i))),g=k((S=>Ne(S,i).localData));Ie(c),r.useEffect((()=>{c&&t(Ji({subscriptionId:i}))}),[c,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||g.customerId!==""||(m.current=!0,t(ge({id:i,localData:{...g,customerId:d}})))}),[d,i,g,t]),r.useEffect((()=>{if(l==="Completed"){const S=p??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),t(Nn({id:i}))}}),[l,p,i,t,e,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSubscriptionFormPage}),a.jsx(Pa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const $a=O((function(t){const e=Un(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(o,s,c)=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionLifecycleAction,{action:s,subscriptionId:o}),t(Mn({action:s,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{v.trackInvoicingActionClick(u.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{v.trackInvoicingActionClick(u.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(o,s)=>{const c=s?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,s,c)=>{s!=="pause"?i(o,s):i(o,s,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,s)=>{i(o,"cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(no({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ot);function wa(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,p]=r.useState(null),g=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:E,subscriptionListFetchState:I,runningActionSubscriptionId:y}=k((D=>{const x=Un(D);return{activeStatus:x.activeTab,appliedSearch:x.filters.search,appliedSort:x.sort,nextCursor:x.nextCursor,subscriptionListFetchState:x.fetchState,runningActionSubscriptionId:x.runningActionId??null}}),H),b=I==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(o)),300);return()=>clearTimeout(D)}),[o]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||g?.field!==h?.field||g?.dir!==h?.dir)&&t(nn({cacheOverride:!0,filters:m,sort:g}))}),[i,t,m,g,f,h]);const C=r.useRef(y);return r.useEffect((()=>{const D=C.current!=null&&y==null;C.current=y,D&&i&&t(Yi())}),[y,i,t]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSubscriptionsListPage,isReady:b}),a.jsx($a,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:g,nextCursor:E,runningActionSubscriptionId:y,onSearchChange:s,onStatusChange:D=>t(eo(D)),onSortChange:p})]})}const _a=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{v.trackInvoicingActionClick(u.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{v.trackInvoicingActionClick(u.Event.invoicingTransactionCaptured,{transactionId:i}),t(oo({action:"capture",id:i}))}:void 0}}))(Mt);function Fa(){const t=A(),e=P(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:o}=R(),s=k((d=>to(d,i??""))),c=s.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&t(io({id:i}))}),[o,i,t]),N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingTransactionDetailPage,isReady:c}),a.jsx(_a,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:s})]})}function Wn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=t,s=A(),{areTenantIdsInSync:c}=R(),d=k(Ue),l=d.connection?.connected===!0,p=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&p!=="Not-Started"||s(Bn()),n&&s(ao()))}),[c,s,e,n,o]),r.useEffect((()=>{e&&c&&l&&i&&s(so())}),[c,s,e,l,i]),{isQboConnected:l,qboView:d}}const Ra={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ee(t){const e=A(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=F(),{fetchState:o,fieldHelp:s,logoFile:c,saveState:d,settings:l,stripeConnectState:p}=k(co),{configError:g,configFetchState:m,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:E}=k(Vn),I=k(Ue);Wn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(fe),b=t==="dunning"||t==="quickbooks",C=y.companyId??G.getSignedInUserTenant(i??"")?.companyId,D=k((_=>bn(_,C))),x=ro(y.userRole??[]),w=y.tenantId??"",L=G.getSignedInUser(),U={userId:L?.userId??"",sessionId:L?.zeniSessionId??"",tenantId:w},T=c?.fileId,ne=k((_=>T!=null&&T!==""?lo(_,T):void 0)),Be=k((_=>T!=null&&T!==""?uo(_,T):void 0)),Xn=T!=null&&T!==""&&ne!=null?{[T]:ne}:{},Jn=T!=null&&T!==""&&Be!=null?{[T]:Be}:{};r.useEffect((()=>(e(tn()),()=>{e(tn())})),[e]),r.useEffect((()=>{n&&(o!=="Not-Started"&&o!=="Error"||e(Me()))}),[n,e,o]),r.useEffect((()=>{n&&b&&m==="Not-Started"&&e(ve())}),[n,e,m,b]),r.useEffect((()=>{if(!n)return;const _=L?.userId;_!=null&&_!==""&&w!==""&&qe.shouldFetchActiveTenant(w)&&(qe.markActiveTenantFetchStarted(w),e(go(_,w,L?.zeniSessionId)))}),[n,e,L?.userId,L?.zeniSessionId,w]);const Yn=S.length>0||f.length>0,et=o==="Not-Started"||o==="In-Progress"&&l==null||b&&!Yn&&(m==="Not-Started"||m==="In-Progress"),nt=o==="Completed"&&(!b||m==="Completed"),Ve=D.externalConnections?.revenue?.find((_=>_.connectionName==="chargebee"))?.connectionId,Ce=ce?.invoicingMicroServiceBaseUrl,He=Ce!=null&&Ce.length>0?`${Ce}/1.0/webhooks/stripe`:"",ke={deleteConnectionError:D.externalConnections?.deleteConnectionError?.message,deleteConnectionState:D.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:D,isAdmin:x,isStripeBusy:p.fetchState==="In-Progress",onConnectStripe:_=>e(an(_)),onDisconnect:(_,z)=>{w!==""&&e(Io(w,_,sn(z)))},onDisconnectStripe:()=>e(on()),onReconnectQBO:()=>{const _=y.tenantEmailDomain??i??"";pe.init("/connection/auth",_),pe.handleClick()},onRefreshQBO:()=>{D.integrations.refreshQBO.fetchState!=="In-Progress"&&e(zn())},onSaveChargeBeeCredentials:(_,z)=>{Ve!=null&&w!==""&&e(fo(w,Ve,sn("revenue"),ho("chargebee"),{api_key:_,site:z}))},saveChargeBeeError:D.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:D.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He};return{authParams:U,deleteFileStatusById:Xn,fieldHelp:s,dunningScheduleActionOptions:S,filesEndPoint:ce?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ke,isInvoicingPageReady:nt,isLoading:et,isSaving:d.fetchState==="In-Progress",isStripeBusy:p.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:E,qboView:I,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":b&&m==="Error"?g?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He,updateFileStatusById:Jn,onConnectStripe:_=>e(an(_)),onDeleteFile:_=>e(So(_,w)),onDisconnectStripe:()=>e(on()),onEditFileName:(_,z)=>e(po(_,z.split(".")[0],w)),onReconnectQBO:ke.onReconnectQBO,onRefreshQBO:ke.onRefreshQBO,onRetryQboSyncTask:_=>e(qn(_)),onSave:_=>{v.trackInvoicingActionClick(u.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(vo({settings:_,snackbarSection:Ra[t??""]}))},onStartQboBackfill:_=>e(Hn(_)),updateFilesEntity:_=>{v.trackInvoicingActionClick(u.Event.invoicingLogoUploaded),e(mo({files:_}))}}}function ln({appContent:t}){const e=P(),n=W(),i=A(),{tenantEmailDomain:o}=F(),s=ee("branding"),c=k((p=>Co(p))),d=k((p=>ko(xe,p)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Eo()),i(J(xe)))}),[c.saveState.fetchState,i]);const l=$e(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage,isReady:s.isInvoicingPageReady}),a.jsx(Nt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:s.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:s.deleteFileStatusById,filesEndPoint:s.filesEndPoint,isLoading:s.isLoading,isSaving:s.isSaving,localData:c.localData,logoFile:s.logoFile,saveErrorMessage:s.saveErrorMessage,settings:s.settings,updateFileStatusById:s.updateFileStatusById,onBackClick:()=>e(".."),onChange:p=>{i(xo({localData:p}))},onDeleteFile:s.onDeleteFile,onEditFileName:s.onEditFileName,onOpenAddress:()=>{const p=`/${o}/invoicing/settings/branding/${xe}/`,g=X(n.state?.pathnameStackToGoBack,n.pathname);e(p,{state:{pathnameStackToGoBack:g}})},onSubmit:()=>i(yo()),updateFilesEntity:s.updateFilesEntity})]})}function Ta(){const t=P(),e=ee("dunning");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Ut,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=P(),e=ee("integrations");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Bt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=P(),e=ee("payment-destination");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Vt,{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 Na=O((function(t){const e=Qn(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(Do({localData:e}))},onReset:()=>{t(jo())},onRetryTask:e=>{t(qn(e))},onSave:()=>{v.trackInvoicingActionClick(u.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(bo())},onStartBackfill:e=>{t(Hn(e))}}}))(Ht);function Ua(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),i=k(fe),{configFetchState:o,saveState:s,settingsFetchState:c}=k(Qn),d=$e(s.fetchState);return r.useEffect((()=>{d==="In-Progress"&&s.fetchState==="Completed"&&e("..")}),[e,d,s.fetchState]),r.useEffect((()=>{c!=="Not-Started"&&c!=="Error"||t(Me())}),[t,c]),r.useEffect((()=>{o==="Not-Started"&&t(ve())}),[o,t]),Wn({fetchSyncHealth:!0,loadAccountingPickers:!0}),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage}),a.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{pe.init("/connection/auth",i.tenantEmailDomain??n??""),pe.handleClick()},onRefresh:()=>t(zn())})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=un(),e=A(),n=P(),[i,o]=Z(),s=ee(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:p,isStripeConnected:g}=k(Vn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=Ba[m];o({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[m,n,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:u.Event.invoicingSettingsPage,isReady:s.isInvoicingPageReady}),a.jsx(qt,{analytics:v,integrationsSectionProps:{...s.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:s.isLoading,meetingUrl:t("invoicing_settings"),settings:s.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:p,isStripePaymentsReady:g,onEnableInvoicingClick:l?void 0:()=>{e(Ao())}})]})}function dn(){return a.jsxs(oe,{children:[a.jsx(j,{index:!0,element:a.jsx(Va,{})}),a.jsx(j,{path:"payment-destination",element:a.jsx(Ma,{})}),a.jsx(j,{path:"branding",element:a.jsx(ln,{})}),a.jsx(j,{path:"branding/:addressType",element:a.jsx(ln,{appContent:a.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),a.jsx(j,{path:"integrations",element:a.jsx(Oa,{})}),a.jsx(j,{path:"dunning",element:a.jsx(Ta,{})}),a.jsx(j,{path:"quickbooks",element:a.jsx(Ua,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:"..",replace:!0})})]})}function Ss(){const t=A(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),{enableState:o,fetchState:s,status:c}=k(wn),d=$e(o.fetchState),l=`/${n}/invoicing`,p=r.useRef(!1),g=k((m=>Ue(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(s!=="Not-Started"?s!=="Error"||p.current||(p.current=!0,t(ve({cacheOverride:!1}))):t(ve({cacheOverride:!1})))}),[i,t,s]),r.useEffect((()=>{i&&g==="Not-Started"&&t(Bn())}),[i,t,g]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),t(Po()))}),[d,o.fetchState,l,t,e]),c==null&&s!=="Error"?a.jsx(zt,{fetchState:"In-Progress"}):c==="not_started"?a.jsxs(oe,{children:[a.jsx(j,{path:"promo",element:a.jsx(cn,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?a.jsxs(oe,{children:[a.jsx(j,{path:"promo",element:a.jsx(cn,{})}),a.jsx(j,{path:"settings/*",element:a.jsx(dn,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:`${l}/settings`,replace:!0})})]}):a.jsxs(oe,{children:[a.jsx(j,{path:"/",element:a.jsx(B,{to:"overview",replace:!0})}),a.jsx(j,{path:"overview",element:a.jsx(ya,{})}),a.jsx(j,{path:"promo",element:a.jsx(B,{to:`${l}/overview`,replace:!0})}),a.jsx(j,{path:"customers",element:a.jsx(na,{})}),a.jsx(j,{path:"customers/new",element:a.jsx(Yo,{})}),a.jsx(j,{path:"customers/new/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"customers/:customer_id",element:a.jsx(Xo,{})}),a.jsx(j,{path:"customers/:customer_id/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"subscriptions",element:a.jsx(wa,{})}),a.jsx(j,{path:"subscriptions/new",element:a.jsx(La,{})}),a.jsx(j,{path:"subscriptions/new/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"subscriptions/:subscription_id",element:a.jsx(Aa,{})}),a.jsx(j,{path:"subscriptions/:subscription_id/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"invoices",element:a.jsx(Ia,{})}),a.jsx(j,{path:"invoices/create",element:a.jsx(zo,{})}),a.jsx(j,{path:"invoices/:invoice_id",element:a.jsx(fa,{})}),a.jsx(j,{path:"invoices/:invoice_id/record-payment",element:a.jsx(rn,{})}),a.jsx(j,{path:"invoices/:invoice_id/issue-credit-note",element:a.jsx(ka,{})}),a.jsx(j,{path:"payments",element:a.jsx(ba,{})}),a.jsx(j,{path:"payments/record",element:a.jsx(rn,{})}),a.jsx(j,{path:"payments/:transaction_id",element:a.jsx(Fa,{})}),a.jsx(j,{path:"credits",element:a.jsx(Zo,{})}),a.jsx(j,{path:"credits/:credit_note_id",element:a.jsx(Ko,{})}),a.jsx(j,{path:"discounts",element:a.jsx(ua,{})}),a.jsx(j,{path:"discounts/new",element:a.jsx(Ho,{})}),a.jsx(j,{path:"discounts/:coupon_id",element:a.jsx(la,{})}),a.jsx(j,{path:"dunning",element:a.jsx(pa,{})}),a.jsx(j,{path:"dunning/:case_id",element:a.jsx(ma,{})}),a.jsx(j,{path:"catalog",element:a.jsx(Bo,{})}),a.jsx(j,{path:"catalog/new",element:a.jsx(Mo,{})}),a.jsx(j,{path:"catalog/:item_id",element:a.jsx(Fo,{})}),a.jsx(j,{path:"settings/*",element:a.jsx(dn,{})}),a.jsx(j,{path:"audit_log",element:a.jsx($o,{})}),a.jsx(j,{path:"data_import",element:a.jsx(aa,{})}),a.jsx(j,{path:"data_import/migrate",element:a.jsx(ca,{})}),a.jsx(j,{path:"data_import/:sessionId",element:a.jsx(ia,{})}),a.jsx(j,{path:"*",element:a.jsx(M,{})})]})}export{Ss as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-e6rGc1UF.js";import{a as g}from"./sentry-DsyKtMW2.js";import{u as O,g as _,h as w,t as M,j as l,N as L}from"./core-CHD8T-IM.js";import{z as r,E as P,G as V,T as A,k as N,U as $,$ as q,a0 as G,Y as R}from"./index-DKH4PK2B.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-BO3zdDfL.js";import{n as ne}from"./mui-NTaF3UaY.js";import{u as se}from"./useDeviceId-VsdzmSZI.js";import{f as ae}from"./analyticsHelper-BEL0ra9X.js";import{t as ie}from"./getLocaleForTenant-D-or0iZO.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="0ab82f79-c1f2-4b52-97be-58b8803cd4d3",t._sentryDebugIdIdentifier="sentry-dbid-0ab82f79-c1f2-4b52-97be-58b8803cd4d3")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[k]=M(),n=k.get("token"),p=k.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),b=l((e=>Y(e))),D=r.getSignedInUser(),v=P().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(b.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,y,s,o,b,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Te as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as _}from"./liveblocks-e6rGc1UF.js";import{a as m}from"./sentry-DsyKtMW2.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-CHD8T-IM.js";import{fF as ne,T_ as Ue,T$ as se,g9 as Ne,fE as xe,U8 as Pe,U1 as Re,U2 as Ve,p$ as Le,gm as Oe,U5 as h,Ua as je,Ub as J,gn as Ze,Uc as ze,Eb as He,h1 as qe,cV as Ye,Ud as Ke,g8 as Qe,go as We}from"./zeni-epic-state-BO3zdDfL.js";import{w as Je,i as Xe,F as ea,N as aa,c as ta,e as na,u as sa,f as c,g as oa,Q as ia,z as ra,d as da,n as ca,o as la,s as ua,q as ma,r as X,L as fa,D as ba,H as ha,p as S,k as ee,y as pa,K as ae,B as ga,C as Sa}from"./index-DKH4PK2B.js";import{D as Ea}from"./mui-NTaF3UaY.js";import{u as ka}from"./InboxNotificationsProvider-x0fdv66l.js";import{u as Ca}from"./useTaskManagerAccess-CUv6a62x.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]="abe252d7-08e3-4a24-93c8-2bd04d638f9b",l._sentryDebugIdIdentifier="sentry-dbid-abe252d7-08e3-4a24-93c8-2bd04d638f9b")}catch{}})();const Ta=Je((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>xe(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,U=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,N),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),x=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&v.fetchState==="Not-Started"&&r(Le(!0))}),[C,T,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Oe(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)),L=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),m.useEffect((()=>{C&&k&&!f&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,k,f,L.fetchState,B.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(J({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(J({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:ke},H=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>H?.tenantId!=null?Ze(e,H.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 Y=t((e=>ze(e,b).fetchState)),K=t((e=>He(e).fetchState)),ye=A&&(Y==="Completed"||Y==="Error")||U&&(K==="Completed"||K==="Error")||!A&&!U?void 0:"disabled",we=m.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=Ye(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&x.fetchState==="Completed"&&Ke(x.notificationSettings,p.userEmail,N,o,k),Q=da(),Fe=Q&&ca(a);return _.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:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:Q,onNotificationIconClick:()=>{i(!1);let e=R===0&&V>0?"notifications/comments":"notifications/tasks";X(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),W=e.type,_e=ae(W)&&W!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&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 Be=ga(e.type);Sa(e.type)?(G!=null&&r(We()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{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:A,updateCurrentChatSessionId:e=>{r(Qe({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Xe(n)&&Ue(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-e6rGc1UF.js";import{h as r,l as n}from"./core-CHD8T-IM.js";import{an as i}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import"./sentry-DsyKtMW2.js";import"./zeni-epic-state-BO3zdDfL.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.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]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-e6rGc1UF.js";import{a as r}from"./sentry-DsyKtMW2.js";import{u as j,g as A,j as o,N as C}from"./core-CHD8T-IM.js";import{UE as P,fF as x,gm as z,UF as D,UG as M,UH as R,UI as F,pS as k,Tj as L}from"./zeni-epic-state-BO3zdDfL.js";import{z as h,ai as I}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.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]="e3455a42-91d2-4bba-97a0-8d29f99e4003",n._sentryDebugIdIdentifier="sentry-dbid-e3455a42-91d2-4bba-97a0-8d29f99e4003")}catch{}})();function ee(){const n=j(),a=A(),{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]),p=h.isSignedIn(),s=h.getSignedInUser(),m=o((e=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),b=o(M),u=o(R),[S,U]=r.useState(null),[v,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(F())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=S??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:U,approveError:v??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{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(C,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./liveblocks-e6rGc1UF.js";import{h as Y,u as G,g as z,i as Z,j as d,l as H,n as J,o as S}from"./core-CHD8T-IM.js";import{fF as v,Ac as R,v5 as K,Vw as w,v0 as C,bq as Q,b$ as X,v1 as ee,Vx as ae,Ve as y,ei as te,E0 as se,Vy as oe,Eo as re,d_ as ne,dZ as ce}from"./zeni-epic-state-BO3zdDfL.js";import{aj as ie,z as le,ar as de,at as me,W as fe,a9 as pe,k as M,aE as ue,p as he,N as Fe,f as ge}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import Ie from"./NotFoundScreen-CtgFRYZy.js";import{F as be}from"./FeaturePreviewScreen-D54Nwanb.js";import{a as F}from"./sentry-DsyKtMW2.js";import{u as Se}from"./useAskAiCfoHostNavButtonProps-BcCbRGDK.js";import{u as ye}from"./useInitialThreadRequest-DDr_z_RH.js";import{t as Ce}from"./routePaths-CGyE-cU7.js";import{M as Te}from"./MobileAppDrawer-DX2JnkbM.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.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]="169971b6-c4e3-4c7e-9097-347b2a2891e2",s._sentryDebugIdIdentifier="sentry-dbid-169971b6-c4e3-4c7e-9097-347b2a2891e2")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=H((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(C(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(re(a))},onForecastVsActualsCompareToggle:a=>{s(oe(a)),s(y({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=Ce(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=he(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(y({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(y({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(ue);function U(){const s=ie(),e=Y(),a=G(),o=z(),{forecastId:r,tenantEmailDomain:c}=Z(),[p,u]=F.useState(!1),[m,x]=F.useState(!1),g=le.getSignedInUser(),A=d((t=>v(t))),_=A.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),D=d((t=>t.profitAndLossState)),j=d((t=>t.reportUIOptionsState.selectedForecast)),k=t=>D.pandLByForecastID[t]!=null&&ee(t,D).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:I}=de();me({isDataReady:l});const{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=Se({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&I)u(!0),l||a(K());else if(l&&!m){x(!0);const t=((f,P,O)=>P!=null?f.forecasts.findIndex((b=>b.id===P)):O!=null?f.forecasts.findIndex((b=>b.id===O)):f.forecasts.length>0?0:-1)(i,r,j?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=j?.index?(a(w(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!k(i.forecasts[t].id)&&I&&a(C(i.forecasts[t].id))}}),[p,u,a,l,i,m,x,R,C,I]);const E=fe(),B=E?.loggedInUserRole!=null&&Q(E.loggedInUserRole),$=ye(A?.companyId,{clearParams:l&&m}),[q,W]=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=>{W(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(pe,{analytics:M,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Te,{isAppContentDrawerOpen:q,handleDrawerToggle:L}),n.jsx(xe,{firstMonthOfFY:_,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:k,meetingUrl:X(h.toString()),hasTransactionAccess:B,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,initialOpenThreadRequest:$,onClickMenuIcon:()=>{L(!0)}})]})}function Ze(){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(J,{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{Ze as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-e6rGc1UF.js";import{Vs as re,fF as N,l$ as G,d_ as Y,dZ as le,Sj as J,UR as de,CX as Pe,Vt as q,CM as je,D5 as Le,C$ as ce,CQ as pe,D3 as ve,D0 as Te,Vu as ue,sq as Ve,g6 as Ae,gD as Fe,Vv as _,CU as me,CT as ge,D8 as Re,c8 as Oe}from"./zeni-epic-state-BO3zdDfL.js";import{a2 as fe,N as Q,f as H,z as W,g as Ce,X as he,ag as ye,aA as be,aB as Ue,ac as Se,J as R,ah as De,G as K,aC as Ze,ar as Be,at as $e,a9 as ze,k as we,U as _e,p as He,aD as Ge,W as We}from"./index-DKH4PK2B.js";import{D as xe,n as M,S as Ie}from"./mui-NTaF3UaY.js";import ae from"./NotFoundScreen-CtgFRYZy.js";import{a as d}from"./sentry-DsyKtMW2.js";import{u as ee,i as Ke,j as g,h as Me,g as Xe,l as qe,n as se,o as z}from"./core-CHD8T-IM.js";import{u as Ne}from"./useAskAiCfoHostNavButtonProps-BcCbRGDK.js";import{M as Ye}from"./MobileAppDrawer-DX2JnkbM.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.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]="478a7d7d-443d-42a5-a23e-46d071ebc950",e._sentryDebugIdIdentifier="sentry-dbid-478a7d7d-443d-42a5-a23e-46d071ebc950")}catch{}})();const Je={overlayWidth:new Se(100,100,48)},te=K.getLocalizedStrings().peoplePage.invitePage,ne=K.getLocalizedStrings().common,Qe=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),{userId:D}=Ke(),r=g((l=>re(l))),p=g((l=>N(l))),E=g((l=>G(l))),{useFeatureGate:x}=Q(),{isFeatureEnabled:I}=x(H.isDebitCardFeatureEnabled),P=Y(I,p),v=le(p),T=J(p),Z=de(p),B=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,w=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(W.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(q()),b()},V=()=>{O===!0?S(!0):h()},$=c.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=x(H.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:A}=he(p?.tenantId),y=!L||A,F=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,isAccountingClassesEnabled:E,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isLiteRoleDisabled:Z===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:v,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(ce({peopleLocalData:l})),U(!0)},onSaveClick:()=>{m(f==="zeni_only"?je(e):Le(T))},onCloseClick:V,isLoading:w||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return d.useEffect((()=>{w===!1&&D!=null&&m(Pe(D))}),[w,D]),d.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:Je.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:V,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Ee,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Ue,{...s})]})})},ea=M(Ie)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,ke=M(De.H6Regular)`
|
|
6
|
-
margin-top: ${R.sp7};
|
|
7
|
-
padding-left: ${R.sp8};
|
|
8
|
-
padding-right: ${R.sp8};
|
|
9
|
-
color: ${e=>e.theme.colors.primary};
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
`,Ee=M(De.LargeRegularSp)`
|
|
12
|
-
color: ${e=>e.theme.colors.hero};
|
|
13
|
-
padding-left: ${R.sp8};
|
|
14
|
-
padding-right: ${R.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${R.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=K.getLocalizedStrings().peoplePage.invitePage,ie=K.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),D=g((o=>re(o))),r=g((o=>N(o))),p=g((o=>G(o))),{useFeatureGate:E}=Q(),{isFeatureEnabled:x}=E(H.isDebitCardFeatureEnabled),I=Y(x,r),P=le(r),v=J(r),T=de(r),Z=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,B=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(W.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const w=()=>{b(),m(q())},h=()=>{O===!0?S(!0):w()},V={onOkClick:()=>{S(!1),w()},onCancelClick:()=>{S(!1)}},$=c.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(H.isChargeCardFeatureEnabled),L=Ce(r,j,x),{isCardsHidden:A}=he(r?.tenantId),y=!L||A,F=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,onPeopleLocalDataUpdated:o=>{m(ce({peopleLocalData:o})),U(!0)},onResetClick:w,onSaveClick:()=>{m(f==="zeni_only"?ve(e):Te())},onCloseClick:h,peopleDetails:D,isAccountingClassesEnabled:p,isReimbursementDisabled:Z===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:B};return d.useEffect((()=>{D.invitePersonState.fetchState==="Completed"&&(b(),m(q()))}),[D.invitePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:oe.discardTitle}),descriptionComponent:a.jsx(Ee,{children:oe.discardDescription}),primaryButtonText:ie.yes,secondaryButtonText:ie.no,action:V}):null,a.jsx(Ze,{...s})]})})},ta=M(Ie)`
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 100%;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
`,na=qe((function(e,t){const c=ue(e),n=W.getSignedInUser();return{data:c,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(e),analytics:we}}),(function(e,t){const{navigate:c,companyId:n,shouldFetchClasses:f}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Re(i))},onReloadPeople:()=>{e(me()),e(ge(n,f))},onBackClick:()=>{c("../../")},onModeChange:i=>{e(_({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(_({searchText:i}))}}}}))(Ge);function X({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=Me(),n=ee(),f=Xe(),{areTenantIdsInSync:i}=Be(),b=W.getSignedInUser(),C=g((s=>N(s))),{useFeatureGate:m}=Q(),{isFeatureEnabled:O}=m(H.isDebitCardFeatureEnabled),U=g((s=>G(s))),k=!Y(O,C)&&U,S=J(C),D=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=d.useState(!1),[x,I]=d.useState(!1),[P,v]=d.useState(!1),[T,Z]=d.useState("off"),[B,w]=d.useState(!1),h=s=>{w(s)},{isAiCfoAccessEnabled:V,onAskAiCfoClick:$}=Ne({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ve(s.classState,s.classListState))),L=g((s=>Ae(s.userState,s.userRoleState,s.userListViewState,"manager"))),A=g((s=>Fe(s))),y=C?.companyId;d.useEffect((()=>{p&&T===u.uiState.mode||!i||(n(_({searchText:"",sortKey:"name",sortOrder:"ascending"})),Z(u.uiState.mode),E(!0),n(me()))}),[p,b,D,n,u.uiState.mode,i]),d.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),d.useEffect((()=>{I(e!=null&&e===!0),v(t!=null&&t===!0&&t)}),[e,t]),d.useEffect((()=>{n(_({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const F=()=>{I(!1),v(!1),c("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:we,onLoad:s=>s.trackPageLoaded(_e.Event.members)}):null,x===!0?a.jsx(sa,{closeDrawerHandler:F,isInvitePeopleDrawerOpen:x,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,P===!0?a.jsx(Qe,{closeDrawerHandler:F,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ye,{isAppContentDrawerOpen:B,handleDrawerToggle:h}),a.jsx(na,{navigate:c,signedInUser:b,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{c("./new")},onColumnSortConfigChanged:(s,o)=>{n(_({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=He(f.state?.pathnameStackToGoBack,f.pathname);c(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:V,onAskAiCfoClick:$})]})}function ka(){const e=We();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(X,{})}),a.jsx(z,{path:"new",element:a.jsx(X,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(X,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-e6rGc1UF.js";import E from"./NotFoundScreen-CtgFRYZy.js";import{a as r}from"./sentry-DsyKtMW2.js";import{h as _,g as v,j as p,i as M,u as U,N as F,l as O,n as P,o as h}from"./core-CHD8T-IM.js";import{fF as z,a13 as b,bo as B,bn as N,iL as V,gh as L}from"./zeni-epic-state-BO3zdDfL.js";import{F as $,z as I,at as q,dO as G}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-BcCbRGDK.js";import{M as J}from"./MobileAppDrawer-DX2JnkbM.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.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]="aa4ffff6-daf5-4e24-934a-87cc938f85fb",e._sentryDebugIdIdentifier="sentry-dbid-aa4ffff6-daf5-4e24-934a-87cc938f85fb")}catch{}})();const K=O((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),c=$(),o=p((a=>z(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:m}=M(),u=U(),d=I.getSignedInUser();if(d==null)throw new Error("Can't access this page without signing in...");const l=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(d),y=C||k||x,f=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&l.current&&(u(L({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),l.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||f(a,i,!0),l.current=!0}),[n?.fetchState,f]),j=r.useCallback(((a,i)=>{f(a,i,!1)}),[f]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return q({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:c,currentTenant:o,signedInUser:d,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(F,{to:`/${m}/dashboard`,replace:!0})};function he(){return s.jsxs(P,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-e6rGc1UF.js";import Z from"./NotFoundScreen-CtgFRYZy.js";import{a as p}from"./sentry-DsyKtMW2.js";import{h as C,g as D,u as N,j as u,N as V,l as k,n as z,o as g}from"./core-CHD8T-IM.js";import{fF as E,Z9 as h,Zq as w,NK as U,NG as L,NJ as f,Nz as B,ZP as $,ND as K,NM as q}from"./zeni-epic-state-BO3zdDfL.js";import{z as T,w as O,cb as F,r as W,bU as G,cc as J}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import{u as M,R as x}from"./ReimbursementApprovalRuleDetailScreen-BT_O_PEv.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b88c8676-d308-4b56-a795-a3ebeba46cb3",e._sentryDebugIdIdentifier="sentry-dbid-b88c8676-d308-4b56-a795-a3ebeba46cb3")}catch{}})();const j="reimbursement-approval-rule-update",P=k((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:w(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(j)&&e($(!1))},onBackClick:()=>{W(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))(O(F)),H=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),b=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),S=u((o=>w(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&a(U())}),[S]),p.useEffect((()=>{t||b!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!1)))}),[t,b,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(R(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${j}`]:[],eventCallback:(o,y,I)=>{o.endsWith(j)&&I.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(P,{currentTenant:c,location:n,navigate:s,...m})},A="reimbursement-approval-rule-update",Q=k((function(e){const s=h(e),n=w(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e($(!1))},onBackClick:()=>{W(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(q(t,!0))}}}))(O(J)),X=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=G(e?.tenantId);return s?r.jsx(Y,{isLoading:n}):r.jsx(H,{isLoading:n})},Y=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),[b,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),S=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));M();const y=u((i=>w(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(U())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||S!=="Not-Started"||e||(R(!0),a(K(!1,!0)))}),[v,S,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(b||(c(!0),a(f())),s("./new"))}),[b,o,a]);const I={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${A}`]:[],eventCallback:(i,ee,_)=>{i.endsWith(A)&&_.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(Q,{currentTenant:m,location:n,navigate:s,isLoading:e,...I})};function le(){return r.jsxs(z,{children:[r.jsx(g,{path:"/",element:r.jsx(X,{})}),r.jsx(g,{path:"/new",element:r.jsx(x,{})}),r.jsx(g,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(g,{path:"*",element:r.jsx(Z,{})})]})}export{le as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as h}from"./liveblocks-e6rGc1UF.js";import{a as f}from"./sentry-DsyKtMW2.js";import{u as U,j as g,h as _,g as O,i as V,l as N}from"./core-CHD8T-IM.js";import{mr as Z,Zq as w,Z9 as C,NC as k,NP as B,NK as A,NL as E,Zr as j,fF as K,NJ as z}from"./zeni-epic-state-BO3zdDfL.js";import{z as F,E as P,a8 as q,c2 as J,r as L,bU as W,c3 as G}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="f37d9c8e-168f-4b2c-9df9-801a6f38d2f1",e._sentryDebugIdIdentifier="sentry-dbid-f37d9c8e-168f-4b2c-9df9-801a6f38d2f1")}catch{}})();function H(){const e=U(),s=f.useRef(!1),t=g((o=>o.vendorListState.fetchStateBillsTab.fetchState??"Not-Started")),p=g((o=>o.vendorListState.allVendorIdsBillsTab.length>0));f.useEffect((()=>{s.current||p||t==="Completed"||t==="In-Progress"||(s.current=!0,e(Z({})))}),[p,t,e])}const M=N((function(e,s){const t=w(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",o=p==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return s.approvalRuleId&&(i=t.allApprovalRules.findIndex((r=>r.approvalRuleId===s.approvalRuleId))===0),{localData:t,hideUpperBoundField:o,isLowerBoundDisabled:i,approvalUpdateActionType:p}}),(function(e,s){const{navigate:t,approvalUpdateDataView:p,approverViewData:o,approvalRuleId:i}=s,r=p.remiSetupApproverViewUpdateData?.type,l=L(s.location);return{onApprovalRuleDataUpdated:a=>{const u=v=>{const S=[];return v.forEach((d=>{const R=d.actors.selectedUsers.map((m=>({type:"user",subType:void 0,userId:m.userId,idType:"user",isImplicitActor:!1}))),b=d.actors.selectedNonUsers.map((m=>{const y=(I=m.value,j(I)==null);var I;return{type:y?"attribute":"role",subType:m.value,userId:void 0,idType:void 0,isImplicitActor:!y}})),c=R.concat(b);S.push({action:d.stepType.selectedOption,actors:c,operator:c.length>1?d.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},n={amount:{type:"amount",comparator:"range",min:{amount:a.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:a.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const v={criteria:n,steps:u(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}else{const v={approvalRuleId:i,criteria:n,steps:u(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(J);function Q(){const e=_(),s=U(),t=O(),{approvalRuleId:p}=V(),o=F.getSignedInUser(),i=P(),r=g((n=>w(n))),l=g((n=>C(n))),[a,u]=f.useState(!1);if(f.useEffect((()=>{a||(u(!0),s(k(!0)))})),f.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),o==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?h.jsx(q,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):h.jsx(M,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t})}function pe(e){return j(e)==null}const X=N((function(e,s){const t=w(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",o=[],i={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o.push(r.id),i[r.id]=r.name);return{localData:t,approvalUpdateActionType:p,allVendorIds:o,vendorNamesById:i,editingRuleId:p==="approval_update"?s.approvalRuleId:void 0,allApprovalRulesWithUser:C(e).allApprovalRules}}),(function(e,s){const{navigate:t,approvalUpdateDataView:p,approverViewData:o,approvalRuleId:i}=s,r=p.remiSetupApproverViewUpdateData?.type,l=L(s.location);return{onApprovalRuleDataUpdated:a=>{const u=c=>{const m=[];return c.forEach((y=>{const I=y.actorKind?.selectedOption,$=y.selectedRole?.selectedNonUsers??[];let D=[];I==="role"?D=$.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):I==="specific_person"&&(D=(y.persons?.selectedUsers??[]).map((T=>({type:"user",subType:void 0,userId:T.userId,idType:"user",isImplicitActor:!1}))));const x=y.action??"require_approval";m.push({action:x,actors:D,operator:D.length>1?x==="require_approval"?"or":"and":"is"})})),m},n=a.amountCriteria,v=a.vendorCriteria,S=a.departmentCriteria,d={};if(n!=null&&n.comparator.selectedOption!=null){const c=n.comparator.selectedOption;d.amount={type:"amount",comparator:c,min:c==="less_than"?void 0:n.min,max:c==="greater_than"?void 0:n.max}}const R=v?.selection.selectedOptions??[];R.length>0&&(d.vendor={type:"vendor",operator:v?.operator.selectedOption??"is",vendorIds:R});const b=S?.selection.selectedOptions??[];if(b.length>0&&(d.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:b}),r==="approval_create"){const c={name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:d,steps:u(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}else{const c={approvalRuleId:i,name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:d,steps:u(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:a=>{e(z(a)),t(r==="approval_update"?`../../${a}/edit`:`../${a}/edit`)}}}))(G);function ne(){const e=g((t=>K(t))),{isApprovalRulesV3Enabled:s}=W(e?.tenantId);return s?h.jsx(Y,{}):h.jsx(Q,{})}function Y(){const e=_(),s=U(),t=O(),{approvalRuleId:p}=V(),o=F.getSignedInUser(),i=P(),r=g((n=>w(n))),l=g((n=>C(n))),[a,u]=f.useState(!1);if(H(),f.useEffect((()=>{a||(u(!0),s(k(!1)))})),f.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),o==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?h.jsx(q,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):h.jsx(X,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t},p??"new")}export{ne as R,pe as i,H as u};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-e6rGc1UF.js";import{u as ne,j as k,h as X,g as K,i as se,N as P,l as Q,q as lt,n as mt,o as E}from"./core-CHD8T-IM.js";import{fF as V,NG as ct,_U as be,c8 as ge,MM as Ue,ma as dt,M$ as me,M_ as ce,_V as ut,bn as he,gV as $e,_W as pt,WT as bt,l$ as Fe,WU as Ae,WV as gt,kN as ht,YX as ft,l0 as St,MA as It,Cd as yt,kU as Rt,Nl as Le,_X as Me,_Y as ke,_Z as vt,__ as At,_$ as kt,N5 as Ce,l6 as Ct,Z4 as wt,MZ as Et,MK as xt,$0 as Bt,MJ as Tt,$1 as Dt,MR as we,N9 as jt,N8 as Ut,N4 as $t,$2 as _e,Sj as Ft,bo as Lt,MU as Mt,ND as _t,$3 as Pt,$4 as Nt,Nh as Ot,Ne as Ee,Yr as Zt,MH as Gt,$5 as Pe,O4 as xe,Oc as zt,$6 as Vt,$7 as Y,$8 as Wt,$9 as Ne,$a as Ht,$b as Oe,$c as Ze,Nt as de,bu as qt,bK as fe,cM as Se,d_ as Ge,dZ as ze,$d as Yt,gh as Jt,YE as Kt,$e as Xt,$f as Ve,YI as Qt,Zq as en,$g as tn,ZP as nn,O9 as Be,O8 as an,$h as sn,$i as on,$j as rn,$k as ln,$l as mn,Za as cn,N$ as dn,O3 as un,bq as pn,bJ as bn,cG as gn,cu as hn,bt as fn,Ui as Sn,da as In,dd as yn,dc as Rn,cF as vn}from"./zeni-epic-state-BO3zdDfL.js";import{bU as An,F as We,a2 as He,N as ie,f as j,z as F,cT as qe,a9 as oe,k as C,aT as Te,J as D,af as ae,ag as kn,G as Ye,cU as Cn,p as J,at as Je,cV as wn,W as re,cW as En,ar as xn,ac as Bn,a8 as Ie,U as Ke,w as Tn,bC as Dn,aw as jn,aj as Un,E as Xe,cX as $n,g as Fn}from"./index-DKH4PK2B.js";import{n as N,S as Ln}from"./mui-NTaF3UaY.js";import ue from"./NotFoundScreen-CtgFRYZy.js";import{S as De}from"./SetupPagesScreen-fuvb0IYd.js";import{F as Qe}from"./FeaturePreviewScreen-D54Nwanb.js";import{a as f}from"./sentry-DsyKtMW2.js";import{u as ye}from"./useAskAiCfoHostNavButtonProps-BcCbRGDK.js";import{u as et}from"./useInitialThreadRequest-DDr_z_RH.js";import{D as Mn}from"./DrawerScreen-B5BqRZEJ.js";import{M as tt}from"./MobileAppDrawer-DX2JnkbM.js";import{F as _n}from"./ScreenRoutes-xDjhbdP1.js";import{R as Pn}from"./ReimbursementApprovalRoutes-CE6y6IwA.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.js";import"./BusinessVerificationPageScreen-DFamYzxa.js";import"./routePaths-CGyE-cU7.js";import"./analyticsHelper-BEL0ra9X.js";import"./InboxNotificationsProvider-x0fdv66l.js";import"./useTaskManagerAccess-CUv6a62x.js";import"./getLocaleForTenant-D-or0iZO.js";import"./ReimbursementApprovalRuleDetailScreen-BT_O_PEv.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]="ef2dc073-3297-4707-98b1-5bf46a89cf84",e._sentryDebugIdIdentifier="sentry-dbid-ef2dc073-3297-4707-98b1-5bf46a89cf84")}catch{}})();const nt=e=>`/${e}/reimbursements`,Nn=e=>f.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},f.createElement("path",{d:"M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),f.createElement("path",{d:"M12.5 12.5L3.5 3.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),{common:q,spendManagement:{reimbursement:{reimbursementDetail:te}}}=Ye.getLocalizedStrings(),On=Q((function(e,t){const n=t.currentTenant?.companyId,r=ut(e.plaidAccountViewState,"user_reimbursement_account"),c=F.getSignedInUser(),d=he(c),m=r.plaidConnectionDetails,o=$e(e.companyState,n),a=e.tenantState.currentTenantId,i={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:a??""},l=be(e,t.reimbursementId),b=pt(e,c?.userId??"");let y=`${c?.firstName} ${c?.lastName}`,u=!0;t.reimbursementId!=null&&(y=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`,u=c?.userId===l.createdBy?.userId);const x=e.entityAutoCompleteState?.autoCompleteText?.common,I=bt(e,"common");return{remiDetails:l,uploadInvoiceEndPoint:`${ae.communicationAgentMicroServiceBaseUrl}`,reimbursementId:t.reimbursementId,customerSearchAutoCompleteData:{autoCompleteText:x,entityAutoCompleteView:I},authParams:i,defaultCurrency:{currencySymbol:o?.company.companyLocaleInfo.currencySymbol??"$",currencyCode:o?.company.companyLocaleInfo.currencyCode??"USD"},companyMileageConfigInfo:o?.company.configInfo.mileageRateConfig,createdBy:y,isUserAdmin:ge(t.currentTenant?.userRole??[]),isZeniUser:d,plaidConnectionDetails:m,bankNameByRouting:l.bankNameByRouting,bankAccountCreationState:b.bankAccountCreationState,bankAccounts:b.bankAccounts,analytics:C,bankAccountToCreate:l.bankAccountToCreate,fetchBankNameByRoutingStatus:l.fetchBankNameByRoutingStatus,isSignedInUserReimbursementCreator:u,disableInternalOverlay:t.disableInternalOverlay,showSkipAutoFill:t.showSkipAutoFill,setShowSkipAutoFill:t.setShowSkipAutoFill,isAccountingClassesEnabled:Fe(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:c,navigate:d,themeState:m}=t,{tenantEmailDomain:o}=r,a=F.getSignedInUser();return{onReceiptsUpload:(i,l,b)=>{i!=null&&e(ce(i,l,b,n,a?.userId))},onExistingMerchantChange:(i,l)=>{e(we(!1,l,n,i,void 0))},fetchDuplicateReimbursement:()=>{a?.userId!=null&&e($t(a.userId,!0,n))},clearDuplicateReimbursementDetail:()=>{e(Ut())},clearRemiSaveStatus:()=>{e(jt("Not-Started",n))},onDuplicateLineClick:(i,l)=>window.open(`/${o}/reimbursement/${i}#L${l}`),onNewMerchantChange:(i,l)=>{e(we(!1,l,n,void 0,i))},removeFileFromLine:i=>{e(Dt({lineId:i,reimbursementId:n}))},onAmountChanged:(i,l)=>{e(Tt(l,i,n))},updateReimbursementType:(i,l,b)=>{e(Bt({reimbursementId:b,lineId:l,reimbursementType:i}))},onHomeCurrencyConversionUpdate:(i,l,b)=>{e(xt({reimbursementId:b,lineId:l,amountPayload:{amount:i.amount,currency_code:i.currencyCode,currency_symbol:i.currencySymbol}}))},onReimbursementDetailsChanged:i=>{e(Et({remiDetailLocalData:i,reimbursementId:n}))},saveRemiDetails:i=>{e(Ce(i,!1,n))},onUserBankDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(wt({data:l}))},onFetchBankName:i=>{e(Ct(i))},submitRemiDetails:()=>{e(Ce("pending_approval",!0,n))},discardReimbursementDetailsFromLocalStore:i=>{e(ke({reimbursementId:i}))},updateInvoiceUploadFetchState:i=>{e(me({reimbursementId:n,fetchState:i}))},clearTentativeNameForLine:i=>{e(kt({reimbursementId:n,lineId:i}))},removeDuplicateReimbursementForLine:i=>{e(At({lineId:i}))},onZeniLogoClick:()=>{m.toggle()},clearAddRemiAutoFields:i=>{e(vt({reimbursementId:n,lineId:i}))},redirectToReimbursementListScreen:()=>{e(Me()),e(ke({}));const i=nt(o),l=J(c.state?.pathnameStackToGoBack,c.pathname);d(i,{state:{pathnameStackToGoBack:l}})},redirectToReimbursementDetailScreen:()=>{t.navigate("../")},deleteReimbursement:()=>{n!=null&&(C.trackReimbursementDeleteReimbursement(n),e(Le(n)))},onSaveBankAccount:()=>{a?.userId&&e(Rt(a?.userId,n))},onFetchLinkTokenClick:i=>{e(yt("user_reimbursement_account",i))},onEstablishConnectionClick:i=>{e(It(i,r.companyId,"user_reimbursement_account",void 0,"link_account_no_microdeposit"))},deleteBankAccount:i=>{e(St(i,a?.userId??""))},onBackClickFromBankAccountPage:()=>{e(ht({fetchState:"Not-Started"})),e(ft())},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,l)=>{i.trim().length>=2?e(gt({searchString:i,entityType:l,searchOrigin:"common"})):e(Ae("common"))},onCancelAutoComplete:()=>{e(Ae("common"))}}}}))(Cn);function je(){const e=X(),t=ne(),n=K(),{reimbursementId:r}=se(),c=We(),d=He(),[m,o]=f.useState(r==null),[a,i]=f.useState(1),{useFeatureGate:l}=ie(),{isFeatureEnabled:b}=l(j.isLimitedCategoryForReimbursement),{isFeatureEnabled:y}=l(j.isShowDeletedReimbursementsFeatureEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:x}=ye({mobileExploreReferrer:"Reimbursement Details"}),I=K().pathname,B=I.includes("edit"),T=I.includes("reimbursement/new"),[R,w]=f.useState(!1),h=F.getSignedInUser(),v=k((p=>V(p))),g=k((p=>be(p,r))),L=et(v?.companyId,{clearParams:g.fetchState==="Completed"}),U=ge(v?.userRole??[]);(function(){const p=ne(),M=k((_=>V(_))),O=M?.tenantId,{isApprovalRulesV3Enabled:W,isLoading:Z}=An(O),H=k((_=>_.remiSetupApproverViewState.fetchState));f.useEffect((()=>{O==null||Z||H==="Not-Started"&&p(ct(!0,!1,!1,W))}),[O,Z,W,H,p])})(),f.useEffect((()=>{(T&&!R||B&&!R&&g.fetchState!="Completed"&&g.fetchState!="In-Progress")&&(w(!0),t(Ue(!1,b,y,r)))}));const $=k((p=>dt(p.accountState,p.accountListState,"reimbursementAccountList")));if(h==null)throw Error("Can't access address page without signing in...");const A={pathname:`../${r}`,search:n.search};return g.isDeleted===!0||g.billStage=="paid"||g.billStage=="scheduled"||g.fetchState=="Not-Started"||U&&g.billStatus==="rejected"||U===!1&&g.billStage==="pending_approval"&&g.billStatus!=="rejected"?s.jsx(P,{to:A}):g.deleteStatus.fetchState==="In-Progress"||g.fetchState!=="Completed"?s.jsx(qe,{isNewReimbursement:r==null}):s.jsxs(Zn,{windowSize:d,children:[s.jsx(oe,{analytics:C,onLoad:p=>(M=>{r!=null&&g.deleteStatus.fetchState!=="Completed"&&M.trackReimbursementEditReimbursement(r)})(p)}),m&&d!=="small"?s.jsx(Gn,{}):null,m&&d!=="small"?s.jsx(zn,{children:s.jsx(Te,{showAutofill:m,uploadInvoiceEndPoint:`${ae.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:v?.tenantId??""},onSkipAutofill:()=>o(!1),onInvoiceUpload:p=>{p!=null&&t(ce(p,a,!0,r,h?.userId))},updateInvoiceUploadFetchState:p=>{t(me({reimbursementId:r,fetchState:p}))},allowMultiFiles:m,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:"78px",paddingRight:D.sp3,paddingBottom:"15px",paddingLeft:D.sp5},dropFilePlaceholder:{upload:q.upload,single:te.dropReceipt.single,or:q.texts.or,multiple:te.dropReceipt.multiple,receipts:q.texts.receipts2}})}):null,m&&d==="small"?s.jsxs(Vn,{children:[s.jsx(Wn,{onClick:()=>o(!1),children:s.jsx(Nn,{})}),s.jsx(Te,{showAutofill:m,uploadInvoiceEndPoint:`${ae.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:v?.tenantId??""},onSkipAutofill:()=>o(!1),onInvoiceUpload:p=>{p!=null&&t(ce(p,a,!0,r,h?.userId))},updateInvoiceUploadFetchState:p=>{t(me({reimbursementId:r,fetchState:p}))},allowMultiFiles:m,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:D.sp5,paddingRight:D.sp3,paddingBottom:D.sp5,paddingLeft:D.sp3},dropFilePlaceholder:{upload:q.upload,single:te.dropReceipt.single,or:q.texts.or,multiple:te.dropReceipt.multiple,receipts:q.texts.receipts2}})]}):null,s.jsx(Hn,{windowSize:d,children:s.jsx(On,{initialOpenThreadRequest:L??void 0,location:n,navigate:e,currentTenant:v,reimbursementId:r,themeState:c,uncategorizedAccounts:$,disableInternalOverlay:!0,showSkipAutoFill:m,setShowSkipAutoFill:o,onCurrentLineIdForUploadChange:i,isAiCfoAccessEnabled:u,onAskAiCfoClick:x})})]})}const Zn=N.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
position: relative;
|
|
4
|
-
height: 100vh;
|
|
5
|
-
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
6
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
7
|
-
`,Gn=N.div`
|
|
8
|
-
position: fixed;
|
|
9
|
-
top: 0;
|
|
10
|
-
left: 0;
|
|
11
|
-
right: 0;
|
|
12
|
-
bottom: 0;
|
|
13
|
-
background-color: ${kn.overlayBackgroundBlack};
|
|
14
|
-
z-index: 5;
|
|
15
|
-
`,zn=N.div`
|
|
16
|
-
position: absolute;
|
|
17
|
-
top: 0;
|
|
18
|
-
left: 0;
|
|
19
|
-
width: 42%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
z-index: 6;
|
|
22
|
-
display: flex;
|
|
23
|
-
background-color: transparent;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
`,Vn=N.div`
|
|
26
|
-
position: fixed;
|
|
27
|
-
top: 0;
|
|
28
|
-
left: 0;
|
|
29
|
-
right: 0;
|
|
30
|
-
bottom: 0;
|
|
31
|
-
z-index: 11;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
overflow-y: auto;
|
|
35
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
36
|
-
`,Wn=N.button`
|
|
37
|
-
align-self: flex-end;
|
|
38
|
-
background: none;
|
|
39
|
-
border: none;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
padding: ${D.sp2} ${D.sp3};
|
|
42
|
-
line-height: 1;
|
|
43
|
-
color: ${e=>e.theme.colors.hero};
|
|
44
|
-
&:hover {
|
|
45
|
-
color: ${e=>e.theme.colors.primary};
|
|
46
|
-
}
|
|
47
|
-
svg {
|
|
48
|
-
width: ${D.sp4};
|
|
49
|
-
height: ${D.sp4};
|
|
50
|
-
}
|
|
51
|
-
`,Hn=N.div`
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-direction: column;
|
|
54
|
-
width: 100%;
|
|
55
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
56
|
-
`,qn=Q((function(e,t){const n=_e(e,t.reimbursementId),r=F.getSignedInUser(),c=he(r),d=e.tenantState.currentTenantId,m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:d??""},o=`${n.createdBy?.firstName??"Zeni"} ${n.createdBy?.lastName??""}`;let a=!1;n?.remiActivities.length>0&&(a=Pt(n.remiActivities,Nt(t.currentTenant),r));const i=ge(t.currentTenant?.userRole??[]),l=r?.userId===n.createdBy?.userId;return{remiDetails:n,uploadInvoiceEndPoint:`${ae.communicationAgentMicroServiceBaseUrl}`,authParams:m,signedInUser:r,createdBy:o,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,isAdmin:i,showApproveRejectBtns:a,isZeniUser:c,isSignedInUserReimbursementCreator:l,isAccountingClassesEnabled:Fe(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:c,navigate:d,themeState:m}=t,{tenantEmailDomain:o}=r;return{onDuplicateLineClick:(a,i)=>window.open(`/${o}/reimbursement/${a}#L${i}`),redirectToReimbursementListScreen:()=>{e(Me());const a=nt(o),i=J(c.state?.pathnameStackToGoBack,c.pathname);d(a,{state:{pathnameStackToGoBack:i}})},onSaveRealTimeApprovals:a=>{e(Gt(n,"reimbursement",a))},updateEditRealTimeApproverClicked:a=>{e(Zt({isEdit:a,entityId:n,entityType:"reimbursement"}))},approveOrRejectRemi:a=>{a.type==="approved"?e(Ee(n,a.type,"")):e(Ee(n,a.type,a.description??""))},redirectToEditableReimbursementScreen:()=>{const a=J(c.state?.pathnameStackToGoBack,c.pathname);d("./edit",{state:{pathnameStackToGoBack:a}})},deleteReimbursement:()=>{C.trackReimbursementDeleteReimbursement(n),e(Le(n))},cancelAndDeleteReport:a=>{a===!0?C.trackReimbursementCancelAndDeleteReimbursement(n):C.trackReimbursementCancelReimbursement(n),e(Ot(n,a))},handleZeniLogoClick:()=>{m.toggle()}}}))(wn);function Yn(){const e=X(),t=ne(),n=K(),r=n.hash.substring(1),c=We(),{reimbursementId:d}=se(),m=F.getSignedInUser(),o=k((A=>V(A))),a=k((A=>_e(A,d??""))),i=a.remiDetails?.reimbursementInfo.stage.code==="draft",l=et(o?.companyId,{clearParams:a.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:b,onAskAiCfoClick:y}=ye({mobileExploreReferrer:"Reimbursement Details"});Je({isDataReady:a.fetchState==="Completed"});const{useFeatureGate:u}=ie(),{isFeatureEnabled:x}=u(j.isLimitedCategoryForReimbursement),[I,B]=f.useState(!1),[T,R]=f.useState(!1),[w,h]=f.useState(!1),{isFeatureEnabled:v}=u(j.isShowDeletedReimbursementsFeatureEnabled),g=k((A=>be(A,d??""))),L=Ft(o),U=Lt(o.userRole),$=a.fetchState;if(f.useEffect((()=>{I||d==null?I==1&&$==="Error"&&e("page-not-found",{replace:!0}):(B(!0),t(Mt(d,!1,v)))}),[I,d,t,$]),f.useEffect((()=>{v&&a.remiDetails?.isDeleted===!0||o.isZeni===!0&&m?.userEmailDomain==="zeni.ai"&&L===!1?h(!1):h(a.remiActivities[0]?.isRealTimeApprovalEnabled&&(U||a.allApprovers.find((A=>A.user.userId===m?.userId))!=null||a.remiDetails?.lastUpdatedBy===m?.userId))}),[a.remiActivities[0]?.isRealTimeApprovalEnabled,a.allApprovers,a.remiDetails?.lastUpdatedBy,U,o.isZeni,L,m]),f.useEffect((()=>{T||a.fetchState!="Completed"||a.remiDetails?.reimbursementInfo.stage.code=="paid"||a.remiDetails?.reimbursementInfo.stage.code=="scheduled"||g.fetchState=="Completed"||g.fetchState=="In-Progress"||(R(!0),t(Ue(!1,x,v,d)),a.remiActivities[0]?.isRealTimeApprovalEnabled===!0&&t(_t(!1,!0,!0,a.lastUpdatedByUserId)))}),[T,a,d,t]),m==null)throw Error("Can't access address page without signing in...");return a.remiDetails?.reimbursementInfo.stage.code=="draft"&&g.fetchState=="Completed"&&a.remiDetails.isDeleted===!1?s.jsx(P,{to:`./edit${n.search}`}):a.deleteStatus.fetchState==="In-Progress"||a.cancelAndDeleteStatus.fetchState==="In-Progress"||a.remiDetails?.reimbursementInfo.stage.code=="draft"&&g.fetchState!="Completed"||a.fetchState!="Completed"?s.jsx(qe,{}):s.jsxs(s.Fragment,{children:[s.jsx(oe,{analytics:C,onLoad:A=>(p=>{d!=null&&p.trackReimbursementReimbursementDetails(d)})(A)}),s.jsx(qn,{initialOpenThreadRequest:l??void 0,scrollId:r,isShowDeletedReimbursementEnabled:v,location:n,navigate:e,isRealTimeApprovalEnabled:w,currentTenant:o,reimbursementId:d??"",themeState:c,isAiCfoAccessEnabled:b,onAskAiCfoClick:y})]})}const Jn=Q((function(e,t){return{remisReviewView:Pe(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/reimbursements`),e(Y())},onCloseReviewItem:n=>{e(Vt(n))},onProceedForBulkActionClick:(n,r)=>{switch(n){case"send_for_approval":e(zt());break;case"approve":e(xe("approved",r??""));break;case"reject":e(xe("rejected",r??""))}}}}))(En);function Kn({tenantEmailDomain:e}){const t=X(),n=k((m=>m.remisBulkActionViewState.bulkSubmissionFetchState.fetchState)),{remisForReview:r}=k((m=>Pe(m))),c=re(),d=c?.loggedInUserRole?.includes("admin")===!0;return f.useEffect((()=>{n!=="Completed"&&r.length!==0||t(`/${e}/reimbursements`)}),[n,r.length,e]),s.jsx(Jn,{navigate:t,analytics:C,isAdmin:d,tenantEmailDomain:e})}const z=Qt(),at="bulk-operation-update",pe="reimbursement-approval-rule-update",{spendManagement:Xn,common:le}=Ye.getLocalizedStrings(),Qn=Xn.reimbursement.bulkActions,ea=N.div`
|
|
57
|
-
display: flex;
|
|
58
|
-
min-height: 100%;
|
|
59
|
-
width: 100%;
|
|
60
|
-
flex: 1 1 auto;
|
|
61
|
-
flex-direction: column;
|
|
62
|
-
align-items: center;
|
|
63
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
64
|
-
`,ta=Q((function(e,t){const n=Ze(e,z,t.isBulkActionEnabled);let r=n.allSubTabs;const c=F.getSignedInUser(),d=he(c),m=e.tenantState.currentTenantId,o=V(e),a=o?.companyName??"",i={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:m??""},l=e.remiListState.downloadUIState.downloadState;t.isShowDeletedReimbursementEnabled===!1&&(r=r.filter((u=>u!=="deleted")));const b=n.fetchState,y=en(e);return{transactionList:t.isShowDeletedReimbursementEnabled?n.reimbursements:n.reimbursements.filter((u=>u.isDeleted===!1)),isAdmin:t.isAdmin,isZeniUser:d,allSubTabs:r,isEmployee:t.isEmployee,currentTab:n.currentTab,currentSubTab:n.currentSubTab,approvalCount:n.approvalCount,fetchState:b,botEmail:n.reimbursementBotEmail,analytics:C,uiState:n.uiState,searchText:n.searchText,filters:n.filters,downloadParams:{authParams:i,companyName:a,timePeriod:z,spendManagementEndPoint:`${jn}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:l,isBulkActionAllowed:n.remiListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:n.remiListBulkActionInfo?.remisSelectedForBulkAction,allowedBulkActions:n.remiListBulkActionInfo?.allowedBulkActions,remiApprovalRulesAffectedEntityIds:y.affectedEntityIds}}),(function(e,t){const{navigate:n,currentTenant:r,location:c,period:d}=t,{tenantEmailDomain:m}=r;return{updateTabToState:o=>{e(Y()),e(Ne(o))},onSubtabChange:o=>{e(Y()),e(Oe(o))},onTransactionClick:(o,a)=>{const i=sa(m,o,a),l=J(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:l}})},onClickSetupIcon:()=>{const o=aa(m),a=J(c.state?.pathnameStackToGoBack,c.pathname);n(o,{state:{pathnameStackToGoBack:a}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;C?.trackReimbursementNewReimbursement();const a=`/${o}/reimbursement/new`,i=J(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(a,{state:{pathnameStackToGoBack:i}})},onColumnSortConfigChanged:(o,a)=>{e(mn({uiState:{sortKey:o,sortOrder:a},period:t.period}))},onSearchTextChanged:o=>{e(ln(o))},onFiltersChange:o=>{e(rn({filters:o})),o.categories.every((a=>a.field!=null&&a.values?.length!==0))&&C.trackSpendManagmentFilterChange("reimbursement",o.categories.map((a=>`${a.field}-${JSON.stringify(a.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&C.trackSpendManagementDownloadClick("reimbursement"),e(on({uiState:{downloadState:o}}))},onReloadTransactions:()=>{e(de(d,!0,t.isShowDeletedReimbursementEnabled,!1,!0))},onBackClick:()=>{n("../",{relative:"path"})},onNavigateToSettings:()=>{n("../reimbursements/setup")},updateBulkActionList:o=>{e(sn(o))},removeAllTransactionsFromBulkActionList:()=>{e(Y())},onProceedForBulkActionClick:(o,a)=>{switch(o){case"delete":case"cancel":e(an(o,a??""));break;case"send_for_approval":e(Be("send_for_approval")),t.navigate("./bulk-review");break;case"review":e(Be("approve")),t.navigate("./bulk-review")}},onReimbursementApprovalRulesEventReceived:o=>{o.endsWith(pe)&&e(nn(!1))},onEventReceived:o=>{o===at&&e(tn())}}}))(Tn(Dn));function na(){const e=X(),t=ne(),n=K(),r=n.state,c=He(),[d,m]=f.useState(null),o=lt("/:tenantEmailDomain/reimbursements/bulk-review")!=null;f.useEffect((()=>{if(r?.tab!=null&&r?.subTab!=null){const S=Wt(r.tab.toString());S!=null?t(Ne(S)):console.log("Warning:Not a valid remiListTab");const G=Ht(r.subTab.toString());G!=null?t(Oe(G)):console.log("Warning:Not a valid remiListSubTab")}return()=>{t(Y())}}),[]);const{useFeatureGate:a}=ie(),{isFeatureEnabled:i}=a(j.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:l}=a(j.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:b}=a(j.isReimbursementBulkActionEnabled),y=F.getSignedInUser(),u=k((S=>V(S))),[x,I]=f.useState(!1),[B,T]=f.useState(!1),R=re(),w=R?.loggedInUserRole?.includes("admin")===!0,h=k((S=>Ze(S,z,b))),{areTenantIdsInSync:v}=xn(),g=h.fetchState,{isAiCfoAccessEnabled:L,onAskAiCfoClick:U}=ye({mobileExploreReferrer:"Reimbursement List"});if(Je({isDataReady:g==="Completed"}),f.useEffect((()=>{!B&&v&&(T(!0),t(de(z,!0,l,!1,!0)))}),[B,z,t,v]),y==null)throw Error("Can't access address page without signing in...");const $=!!u?.userRole&&qt(u),A=fe(R?.loggedInUserRoleMap),p=Se(R?.loggedInUserRoleMap),M=!!u.userReimbursementInfo?.isReimbursementTOSAccepted,O=!!u.companyReimbursementInfo?.info?.isReimbursementEnabled,W=!!u.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,Z=k((S=>$e(S.companyState,u.companyId))),H=Z?.company.featuresActivationInfo.connectedAccountProvider,_=S=>{I(S)},{isFeatureEnabled:st}=a(j.isDebitCardFeatureEnabled),it=Ge(st,u),ot=ze(u),{remisProcessed:ee,remisProcessing:Re}=k((S=>Yt(S)));f.useEffect((()=>{ee===Re&&d!=null&&(t(Jt({messageSection:"reimbursement_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_report_",variableValue:ee>1?le.texts.reports2:Qn.report},{variableName:"_has_",variableValue:ee>1?le.texts.have:le.texts.has},{variableName:"_action_",variableValue:Kt(d)}]})),t(Xt()),setTimeout((()=>{t(de(z,!0,l,!1,!0,!0))}),3e3),m(null))}),[ee,Re]);const rt={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${at}`,`private-encrypted-${u.companyId}.${pe}`]:[],eventCallback:(S,G,ve)=>{S.endsWith(pe)?ve.onReimbursementApprovalRulesEventReceived?.(S):G.entity_type==="reimbursement"&&(m(G.operation_type),ve.onEventReceived(S))}};return n.pathname.endsWith("/reimbursements/")||n.pathname.endsWith("/reimbursements")||n.pathname.endsWith("/reimbursements/bulk-review")?it===!0||ot===!0?s.jsx(Qe,{}):O&&(!$||A)||p&&M?s.jsxs(s.Fragment,{children:[g==="Completed"?s.jsx(oe,{analytics:C,onLoad:S=>(G=>G.trackPageLoaded(Ke.Event.reimbursementHome))(S)}):null,s.jsx(tt,{isAppContentDrawerOpen:x,handleDrawerToggle:_}),s.jsxs(ea,{windowSize:c,children:[s.jsx(Mn,{isOpen:o,drawerLeftMargin:new Bn(0,0,300,600),onClose:()=>{e(`/${u.tenantEmailDomain}/reimbursements`),t(Y())},children:s.jsx(ia,{onClick:S=>S.stopPropagation(),children:s.jsx(Kn,{tenantEmailDomain:u.tenantEmailDomain})})}),s.jsx(ta,{isShowDeletedBillsEnabled:i,isShowDeletedReimbursementEnabled:l,location:n,navigate:e,currentTenant:u,period:z,isAdmin:w,isEmployee:$,entity:"reimbursement",onClickMenuIcon:()=>{_(!0)},createdByUserList:h.createdByUserList,createdByUserListFetchState:h.createdByUserListFetchState,isDownloadEnabled:h.isDownloadEnabled,connectedAccountProvider:H,isBulkActionEnabled:b,bulkSubmissionLimit:h.remiBulkSubmissionLimit,bulkSubmissionFetchState:h.remiListBulkActionInfo.bulkSubmissionFetchState,isAiCfoAccessEnabled:L,onAskAiCfoClick:U,...rt})]})]}):W&&A?s.jsx(P,{to:"../setup"}):R!=null&&Ve(u,R.loggedInUserRoleMap)?s.jsx(P,{to:"../promo"}):s.jsx(Ie,{fetchState:"In-Progress"}):s.jsx(ue,{})}const aa=e=>`/${e}/reimbursements/setup`,sa=(e,t,n)=>{let r=`/${e}/reimbursement/${encodeURIComponent(t)}`;return n=="draft"&&(r+="/edit"),r},ia=N(Ln)`
|
|
65
|
-
display: flex;
|
|
66
|
-
min-height: 100%;
|
|
67
|
-
flex-direction: column;
|
|
68
|
-
`,oa=Q((function(e,t){const{companyId:n}=t;return{reimbursementSetupView:cn(e,n),analytics:C,videoUrl:"https://player.vimeo.com/video/814821498?h=e7fd11e13e&badge=0&autopause=0&player_id=0&app_id=122963"}}),(function(e,t){const{companyId:n,navigate:r}=t;return{onSetupButtonClick:()=>{e(un(n))},onCreateNewRemiButtonClick:()=>{e(dn(t.userRoleId))},onBackClick:()=>{r("../..",{relative:"path"})},onSetupReimbursementSuccess:()=>{t.isEmployee?r("../../reimbursement/new",{relative:"path"}):r("../reimbursements/setup",{relative:"path"})}}}))($n),ra=()=>{const e=Un(),t=X(),n=K(),{tenantEmailDomain:r}=se(),c=Xe(),[d,m]=f.useState(!1),o=k((w=>V(w))),a=F.getSignedInUserTenant(r)?.companyId??o.companyId,i=F.getSignedInUser(),l=o.userRoleId,b=!!o.userRole?.includes("reimbursements_user"),y=re(),u=fe(y?.loggedInUserRoleMap),x=Se(y?.loggedInUserRoleMap),I=!!o.userReimbursementInfo?.isReimbursementTOSAccepted,B=!!o.companyReimbursementInfo?.info?.isReimbursementEnabled,T=!!o.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,R=w=>{m(w)};if(i==null)throw Error("Can't access reimbursement promo page without signing in...");return B&&x&&I?s.jsx(P,{to:"../../../reimbursements"}):T&&u?s.jsx(P,{to:"../../reimbursements/setup"}):o.companyReimbursementInfo&&!T||o.userReimbursementInfo&&x&&I===!1?s.jsxs(s.Fragment,{children:[s.jsx(oe,{analytics:C,onLoad:w=>(h=>h.trackPageLoaded(Ke.Event.reimbursementPromoPage))(w)}),s.jsx(tt,{isAppContentDrawerOpen:d,handleDrawerToggle:R}),s.jsx(oa,{companyId:a,navigate:t,meetingUrl:e("reimbursement_promo"),location:n,userReimbursementInfo:o.userReimbursementInfo,userRoleId:l,isEmployee:b,onClickMenuIcon:()=>{R(!0)}})]}):s.jsx(Ie,{fetchState:"In-Progress",style:{backgroundColor:c.colors.grey5}})};function Pa(){const e=k((_=>V(_))),t=re(),n=!!e.company?.companyReimbursementInfo.isReimbursementEnabled,r=Xe(),c=!!e.company?.companyReimbursementInfo.isReimbursementTOSAccepted,d=!!e.userReimbursementInfo?.isReimbursementTOSAccepted,{useFeatureGate:m}=ie(),{isFeatureEnabled:o}=m(j.isChargeCardFeatureEnabled),{isFeatureEnabled:a}=m(j.isDebitCardFeatureEnabled),i=Ge(a,e),l=ze(e),b=e?.userRole!=null&&pn(e?.userRole),y=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b)&&bn(t?.loggedInUserRoleMap),u=gn(t?.loggedInUserRoleMap),x=e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!b,I=fe(t?.loggedInUserRoleMap),B=x&&I,T=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!b,R=T&&hn(t?.loggedInUserRoleMap),w=Fn(e,o,a)&&!b,h=w&&fn(t?.loggedInUserRoleMap),v=Sn(t?.loggedInUserRoleMap),g=In(t?.loggedInUserRoleMap),L=yn(t?.loggedInUserRoleMap),U=T&&g,$=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!b&&L,A=Rn(t?.loggedInUserRoleMap),p=vn(t?.loggedInUserRoleMap),M=Se(t?.loggedInUserRoleMap),O=w&&A,{tenantEmailDomain:W}=se(),Z=K(),H=n===!0&&(I||M&&d);return s.jsxs(mt,{children:[Z.pathname.includes("/reimbursements")?s.jsxs(s.Fragment,{children:[s.jsx(E,{path:"verification",element:s.jsx(De,{isBillPayAdminLevelAccess:y,isUserHasOnlyBillPayAccess:u,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:R,isChargeCardAdminLevelAccess:h,isUserHasOnlyCardAccess:v,productType:"reimbursement",type:"verification"})}),s.jsx(E,{path:"setup",element:s.jsx(De,{isBillPayAdminLevelAccess:y,isUserHasOnlyBillPayAccess:u,isReimbursementAdminLevelAccess:B,isZeniAccountAdminLevelAccess:R,isChargeCardAdminLevelAccess:h,isUserHasOnlyCardAccess:v,productType:"reimbursement",type:"setup"})}),s.jsx(E,{path:"promo",element:s.jsx(ra,{})}),s.jsx(E,{path:"approval-rules/*",element:B?s.jsx(Pn,{}):s.jsx(_n,{showZeniAccountRoute:U,isUserHasBillPayAccess:p,isUserHasReimbursementAccess:M,showTreasuryRoute:$,isTenantBankingOnly:i,showChargeCardRoute:O,tenantEmailDomain:W??""})}),H&&s.jsx(E,{path:"*",element:s.jsx(na,{})}),(i===!0||l===!0)&&s.jsx(E,{path:"/*",element:s.jsx(Qe,{})}),t!=null&&Ve(e,t?.loggedInUserRoleMap)&&s.jsx(E,{path:"*",element:s.jsx(P,{to:"../promo"})}),c&&I&&s.jsx(E,{path:"*",element:s.jsx(P,{to:"../setup"})})]}):Z.pathname.includes("/reimbursement")?s.jsxs(s.Fragment,{children:[s.jsx(E,{path:"new",element:s.jsx(je,{})}),s.jsx(E,{path:":reimbursementId",element:s.jsx(Yn,{})}),s.jsx(E,{path:":reimbursementId/edit",element:s.jsx(je,{})}),s.jsx(E,{path:"*",element:s.jsx(ue,{})})]}):s.jsx(E,{path:"*",element:s.jsx(Ie,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5,boxShadow:`0px 2px ${D.sp1} ${r.colors.dropShadowNormal}`}})}),s.jsx(E,{path:"*",element:s.jsx(ue,{})})]})}export{Pa as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-e6rGc1UF.js";import{z as w,a9 as v,k as u,U as k,e3 as D,N as E,f as I}from"./index-DKH4PK2B.js";import"./mui-NTaF3UaY.js";import g from"./NotFoundScreen-CtgFRYZy.js";import{a as m}from"./sentry-DsyKtMW2.js";import{u as C,j as h,h as F,g as L,l as U,n as T,o as d,N as y}from"./core-CHD8T-IM.js";import{fF as _,a1$ as j,a20 as p,DS as P,p$ as V,a21 as $,DQ as z}from"./zeni-epic-state-BO3zdDfL.js";import"./recharts-C6xUtcdL.js";import"./analytics-C3e3An3a.js";import"./plaid-DdTo7m1-.js";import"./dnd-Dwi6R-ey.js";import"./stripe-cKAAJElX.js";import"./lottie-B778bt56.js";import"./lexical-CMNdypK6.js";import"./pdf-Bx92ZlM_.js";import"./utils-CCA3F0sZ.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]="ac2589e5-c046-4299-9f97-e5c0dc4daab3",e._sentryDebugIdIdentifier="sentry-dbid-ac2589e5-c046-4299-9f97-e5c0dc4daab3")}catch{}})();const G=U((function(e,t){const n=j(e);return{inviteFormView:n.localData,submitStatus:n.saveStatus,userName:t.userName,rewardsPlan:n.rewardsPlan,companyLegalName:t.companyName}}),(function(e,t){const{navigate:n}=t,i=w.getSignedInUser();return{onDismissClick:()=>{e(p()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((c=>{s.push(c.companyName),r.push(c.emailIds[0])})),u.trackInviteEmailClicked("send",s,r,s.length)}e(z())},onUpdateInviteFormLocalData:s=>{e($({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&u.trackInviteEmailClicked("cancel")}}}))(D),Q=()=>{const e=C(),[t,n]=m.useState(!1),[i,s]=m.useState(!1),r=h((o=>_(o))),c=F(),x=L(),f=w.getSignedInUser();if(f==null)throw Error("Can't access invite referral screen without signing in...");const l=h((o=>j(o))),b=f?.firstName!=null?f.firstName:"User";m.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),m.useEffect((()=>{t||l.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[l.fetchState,e]);const N=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[l.fetchState==="Completed"?a.jsx(v,{analytics:u,onLoad:o=>(S=>S.trackPageLoaded(k.Event.inviteEmailViewed))(o)}):null,a.jsx(G,{navigate:c,location:x,currentTenant:r,companyName:N,userName:b,inviteFormCompayData:l.localData})]})};function ne(){const{useFeatureGate:e}=E(),{isFeatureEnabled:t}=e(I.isReferralFeatureEnabled);return a.jsxs(T,{children:[a.jsx(d,{path:"/",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"refer/*",element:t?a.jsx(Q,{}):a.jsx(g,{})}),a.jsx(d,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
|