@zeniai/web-app-ui 5.4.21-prod → 5.4.22-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-o9UNAAN2.js → AccountMappingScreen-C5mOiJ2U.js} +2 -2
- package/dist/assets/ActualMatchingMatchDetailScreen-wHD8fSWU.js +1 -0
- package/dist/assets/AddressRoutes-CVWN9CJv.js +1 -0
- package/dist/assets/AddressScreen-DgUwrml_.js +9 -0
- package/dist/assets/AiCfoScreen-yDQ2sphg.js +22 -0
- package/dist/assets/{AppDrawer-BycMyj5M.js → AppDrawer-DzYZBC2G.js} +3 -3
- package/dist/assets/{BillPayApprovalRoutes-FZbtoTk1.js → BillPayApprovalRoutes-BcCgse3-.js} +1 -1
- package/dist/assets/BillPayRoutes-HAS0-pNc.js +119 -0
- package/dist/assets/BusinessVerificationPageScreen-DM_jBIuD.js +9 -0
- package/dist/assets/CardsAiCfoScreen-yrI2CL7M.js +14 -0
- package/dist/assets/ChargeCardRoutes-DgtmFgR6.js +71 -0
- package/dist/assets/CompanyPassportScreen-BLtXgkEd.js +1 -0
- package/dist/assets/ConnectionAuthScreen-CuZmfRIp.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-BjmJLllh.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-N9fmUi4M.js → CustomerOnboardingRoutes-C0b805o-.js} +7 -7
- package/dist/assets/CustomersRoutes-DD5Gx1mW.js +8 -0
- package/dist/assets/DashboardRoutes-C8RZkkYj.js +20 -0
- package/dist/assets/DefaultTenantHome-C6Ygdgwt.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-BxClNf2J.js +18 -0
- package/dist/assets/DrawerScreen-BHaectiO.js +1 -0
- package/dist/assets/EntityDetailRoutes-BJzuW7dq.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-BKrWZyYV.js +38 -0
- package/dist/assets/FallBackRoute-DuMHkNqk.js +2 -0
- package/dist/assets/FeaturePreviewScreen-DHt0WFS8.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-Di0pbhHE.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-Dp-eDJC-.js → InboxNotificationsProvider-CiKEEv6Q.js} +1 -1
- package/dist/assets/InvoicingRoutes-Bsq4ym98.js +3 -0
- package/dist/assets/MagicLinkRoutes-DJX5Nm1n.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-CD7Pya_j.js +12 -0
- package/dist/assets/MobileAppDrawer-BWNb5zLN.js +1 -0
- package/dist/assets/NotFoundScreen-DXy-BCit.js +1 -0
- package/dist/assets/NotificationRoutes-B2xHVaqf.js +1 -0
- package/dist/assets/OAuthConsentScreen-BA2eBLib.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-Dm5Vnr71.js +1 -0
- package/dist/assets/PaymentLinkScreen-CndVAq3p.js +21 -0
- package/dist/assets/PeopleRoutes-kralZgbz.js +22 -0
- package/dist/assets/PerformanceRoutes-DJhuo9qY.js +1 -0
- package/dist/assets/{Preview-C5WCMZ5q.js → Preview--c8D4GAG.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BwiFGkNK.js → QBOConnectionScreen-DroXrkno.js} +2 -2
- package/dist/assets/ReimbursementApprovalRoutes-B2ftFL0O.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-CHTcY28V.js +1 -0
- package/dist/assets/{ReimbursementRoutes-IyEE77RL.js → ReimbursementRoutes-CI3m7PHD.js} +9 -9
- package/dist/assets/ReportsRoutes-C7A0Ycu_.js +1 -0
- package/dist/assets/RewardsRoutes-Dkg4zGB8.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-COClCOXU.js → ScheduleDetailsPrepaidExpensesScreen-ZwdXW6K5.js} +5 -5
- package/dist/assets/ScreenRoutes-B_WT7FAm.js +2 -0
- package/dist/assets/{SettingsRoutes-B8qt67Bj.js → SettingsRoutes-_XBnyBgG.js} +6 -6
- package/dist/assets/{SetupPagesScreen-UjK2D0Rv.js → SetupPagesScreen-D6ssIWb0.js} +5 -5
- package/dist/assets/SignInScreen-H_SOl_FQ.js +1 -0
- package/dist/assets/SignOutScreen-OFswrnt8.js +9 -0
- package/dist/assets/{TaskListScreen-2_ij-Yu1.js → TaskListScreen-Bmj5V_dR.js} +2 -2
- package/dist/assets/TaskRoutes-D6cEqDZN.js +9 -0
- package/dist/assets/TransactionDetailRoutes-D-b6zdg4.js +1 -0
- package/dist/assets/TransactionDetailScreen-JBKbtouq.js +5 -0
- package/dist/assets/TransactionListRoutes-THtfycHC.js +1 -0
- package/dist/assets/TreasuryRoutes-CgHwdyKd.js +37 -0
- package/dist/assets/{VendorsRoutes-uW7VJmDE.js → VendorsRoutes-jETcYESc.js} +18 -18
- package/dist/assets/WiseConfirmationScreen-BpRHCykr.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-DPX2T0Kt.js → ZeniAccountRoutes-C8cr5UMy.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-DAs1_LIC.js +9 -0
- package/dist/assets/{accountMappingHelper-FvEDI2O0.js → accountMappingHelper-DSd2V454.js} +1 -1
- package/dist/assets/{analytics-CzizEiux.js → analytics-Vgn85Ur_.js} +4 -4
- package/dist/assets/analyticsHelper-CWMk7_rd.js +1 -0
- package/dist/assets/{core-Bx5kG7oj.js → core-CbdTrw7T.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DMAtWdNT.js → decodeURIComponentSafe-D7APy95S.js} +1 -1
- package/dist/assets/{dnd-BT4GhSLO.js → dnd-DuiAlI7w.js} +1 -1
- package/dist/assets/empty-B1nH_ieU.js +1 -0
- package/dist/assets/{empty-Cn912Jag.js → empty-CjoB5KP4.js} +1 -1
- package/dist/assets/{emptyVideoElement-BTRIh8mw.js → emptyVideoElement-B6iUrc8S.js} +1 -1
- package/dist/assets/epic-CCMzkkv8.js +2 -0
- package/dist/assets/expenseAutomationHelper-CgTsmmCm.js +1 -0
- package/dist/assets/getLocaleForTenant-B8EqveGi.js +1 -0
- package/dist/assets/{index-CfvGavEm.js → index-BFdcFsSo.js} +1 -1
- package/dist/assets/index-BNFAuGus.js +1 -0
- package/dist/assets/{index-DkHntkmh.js → index-CnIO6_IQ.js} +14764 -14764
- package/dist/assets/{index-BphJBpvs.js → index-DjPsG1Xt.js} +1 -1
- package/dist/assets/{index-CtJA2cwC.js → index-LGKtWUy9.js} +1 -1
- package/dist/assets/{index-Did1JRAl.js → index-naWU0Itr.js} +2 -2
- package/dist/assets/{empty-BtyJHOUL.js → index-pWh5QyXZ.js} +1 -1
- package/dist/assets/{index-But38I3J.js → index-wSCaSCb5.js} +1 -1
- package/dist/assets/{lexical-BVHU6OCB.js → lexical-B-vxEaRQ.js} +1 -1
- package/dist/assets/{liveblocks-BD_ga8W6.js → liveblocks-BLpmr1Pv.js} +15 -15
- package/dist/assets/{lottie-EXw6nebq.js → lottie-Lb1ftKY1.js} +1 -1
- package/dist/assets/{mui-BaMyMAqO.js → mui-DNGY4bFU.js} +2 -2
- package/dist/assets/{pathToGoBack-BzRgSVEC.js → pathToGoBack-CJCquoqC.js} +1 -1
- package/dist/assets/{pdf-DnsysvFr.js → pdf-B1uD4Ovv.js} +3 -3
- package/dist/assets/{pdf-lib-DTKmmSz0.js → pdf-lib-BKN88Kre.js} +1 -1
- package/dist/assets/{plaid-BmyHDSR7.js → plaid-DhfTjhua.js} +1 -1
- package/dist/assets/{pusher-BADlF29B.js → pusher-BPtf_EL-.js} +1 -1
- package/dist/assets/{react-B-WPW2lk.js → react-B10NZVQI.js} +1 -1
- package/dist/assets/{react-B4hLpFdk.js → react-BAEKpD-r.js} +1 -1
- package/dist/assets/{react-Dz5IyPy2.js → react-Bhjp4pzB.js} +1 -1
- package/dist/assets/{react-tdpT-_R0.js → react-DEDzyvMl.js} +1 -1
- package/dist/assets/{react-B-SJqSpk.js → react-DGl2P4dK.js} +1 -1
- package/dist/assets/{react-DCWsxx3l.js → react-arX5WESX.js} +1 -1
- package/dist/assets/{recharts-Bcj70bk1.js → recharts-CTh_JhT_.js} +1 -1
- package/dist/assets/{reportTimeframe-CUcsFj60.js → reportTimeframe-DeLnONFM.js} +1 -1
- package/dist/assets/{routePaths-Cxh0_DtI.js → routePaths-CV12X_S-.js} +1 -1
- package/dist/assets/{sentry-DsaQHQmX.js → sentry-DWNq3t8E.js} +2 -2
- package/dist/assets/{stripSplatSuffix-B3Bc_avB.js → stripSplatSuffix-DP9nmQOu.js} +1 -1
- package/dist/assets/{url-DAJdS_e6.js → url-B2x9G6No.js} +4 -4
- package/dist/assets/{url-DjR0oJYL.js → url-BqlXUDAr.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-D-Ym3wTm.js +1 -0
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-Dqg5VVaq.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-DXFswt7R.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-Cq6Y4mMW.js +1 -0
- package/dist/assets/{useDeviceId-BviPVfDF.js → useDeviceId-dj9QS4Ga.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-qgk6N8cm.js +1 -0
- package/dist/assets/useEnsureVendorListLoaded-CIShbpK4.js +1 -0
- package/dist/assets/useInitialThreadRequest-DAUsQlCl.js +1 -0
- package/dist/assets/useIsCustomersTabEnabled-C6mkabn2.js +1 -0
- package/dist/assets/useTaskManagerAccess-Cm5trA3i.js +1 -0
- package/dist/assets/useTaskManagerPusherEvents-C1gzc-aA.js +1 -0
- package/dist/assets/{utils-Rng1Um8N.js → utils-CrhrpmD8.js} +2 -2
- package/dist/assets/{withTransactionSidePanel-DTG3VL6U.js → withTransactionSidePanel-D-hDwbdr.js} +5 -5
- package/dist/assets/{zeni-epic-state-CP_8Me3V.js → zeni-epic-state-C5DO1jkr.js} +7 -7
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/ActualMatchingMatchDetailScreen-Bq4tInFn.js +0 -1
- package/dist/assets/AddressRoutes-CTXOzi6Q.js +0 -1
- package/dist/assets/AddressScreen-CpY6qzLi.js +0 -9
- package/dist/assets/AiCfoScreen-CeSkAjuX.js +0 -22
- package/dist/assets/BillPayRoutes-DR1qovIJ.js +0 -119
- package/dist/assets/BusinessVerificationPageScreen-Byhif9Ma.js +0 -9
- package/dist/assets/CardsAiCfoScreen-DuMDy2QA.js +0 -14
- package/dist/assets/ChargeCardRoutes-CkebfhOF.js +0 -71
- package/dist/assets/CompanyPassportScreen-B9QeqdTn.js +0 -1
- package/dist/assets/ConnectionAuthScreen-BxSdWxSi.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-LYqD1O_j.js +0 -1
- package/dist/assets/CustomersRoutes-BPgppFga.js +0 -8
- package/dist/assets/DashboardRoutes-BsicDORh.js +0 -20
- package/dist/assets/DefaultTenantHome-k44UkE7_.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-C3YIjUYE.js +0 -18
- package/dist/assets/DrawerScreen-C86vnRJz.js +0 -1
- package/dist/assets/EntityDetailRoutes-A4ws8Hyd.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-D5mOe8NQ.js +0 -38
- package/dist/assets/FeaturePreviewScreen-DUY6p3ge.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-DD_LJq4g.js +0 -1
- package/dist/assets/InvoicingRoutes-CN-eG_gg.js +0 -3
- package/dist/assets/MagicLinkRoutes-DugkbFub.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-AD90LU49.js +0 -12
- package/dist/assets/MobileAppDrawer-DDeilglm.js +0 -1
- package/dist/assets/NotFoundScreen-oYE2WlvI.js +0 -1
- package/dist/assets/NotificationRoutes-CebTwOdA.js +0 -1
- package/dist/assets/OAuthConsentScreen-DwCYB8ry.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-C8BIa_6t.js +0 -1
- package/dist/assets/PaymentLinkScreen-Brc4c_uL.js +0 -21
- package/dist/assets/PeopleRoutes-BadtTp85.js +0 -22
- package/dist/assets/PerformanceRoutes-CELeTcmt.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-DfYqyG3t.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-DE6y72u6.js +0 -1
- package/dist/assets/ReportsRoutes-CAjdNb2Z.js +0 -1
- package/dist/assets/RewardsRoutes-B5s3qeYK.js +0 -1
- package/dist/assets/ScreenRoutes-C9LqvM4m.js +0 -2
- package/dist/assets/SignInScreen-DyroBcKr.js +0 -1
- package/dist/assets/SignOutScreen-BvkzQcmU.js +0 -9
- package/dist/assets/TaskRoutes-YSc8SAKu.js +0 -9
- package/dist/assets/TransactionDetailRoutes-Brl4E-L9.js +0 -1
- package/dist/assets/TransactionDetailScreen-DPXvNf-7.js +0 -5
- package/dist/assets/TransactionListRoutes-CL-K7ix6.js +0 -1
- package/dist/assets/TreasuryRoutes-B7-wS8Oy.js +0 -37
- package/dist/assets/WiseConfirmationScreen-BLgEu5jI.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-B-69HKZM.js +0 -9
- package/dist/assets/analyticsHelper-jqkqthAa.js +0 -1
- package/dist/assets/epic-BVSwA_uf.js +0 -2
- package/dist/assets/expenseAutomationHelper-CAr9eXjQ.js +0 -1
- package/dist/assets/getLocaleForTenant-Cvq70l-z.js +0 -1
- package/dist/assets/index-Dc4mB2Op.js +0 -1
- package/dist/assets/index-bKm528DW.js +0 -1
- package/dist/assets/useActualMatchingMatchDetail-iGCUO44-.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-COa1RGwu.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-B0IAA2LU.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-jDlyzqdm.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-df266Q2H.js +0 -1
- package/dist/assets/useEnsureVendorListLoaded-CCsBxqME.js +0 -1
- package/dist/assets/useInitialThreadRequest-Dspu5rPv.js +0 -1
- package/dist/assets/useIsCustomersTabEnabled-BiAWPXPy.js +0 -1
- package/dist/assets/useTaskManagerAccess-CW2xYz9y.js +0 -1
- package/dist/assets/useTaskManagerPusherEvents-UN1wlS1b.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as v}from"./liveblocks-BD_ga8W6.js";import{a as u}from"./sentry-DsaQHQmX.js";import{u as U,j as b,l as y,g as w,N as A}from"./core-Bx5kG7oj.js";import{UT as N,fJ as _,gp as k,UU as L,q9 as R,UV as z}from"./zeni-epic-state-CP_8Me3V.js";import{u as j,z as f,L as T,t as I,G as O,b as $}from"./index-DkHntkmh.js";import"./mui-BaMyMAqO.js";import{t as P}from"./getLocaleForTenant-Cvq70l-z.js";import"./recharts-Bcj70bk1.js";import"./analytics-CzizEiux.js";import"./plaid-BmyHDSR7.js";import"./dnd-BT4GhSLO.js";import"./stripe-cKAAJElX.js";import"./lottie-EXw6nebq.js";import"./lexical-BVHU6OCB.js";import"./pdf-DnsysvFr.js";import"./utils-Rng1Um8N.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f3f4634e-e199-43eb-a10e-99177b3702d4",t._sentryDebugIdIdentifier="sentry-dbid-f3f4634e-e199-43eb-a10e-99177b3702d4")}catch{}})();const q=y((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=w(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(A,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=U(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>N(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(k(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(i))&&t(R(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(q,{})}const G=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],Q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of G)if(t.toLocaleLowerCase().includes(s))return Q[s]}export{oe as default};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{j as l}from"./liveblocks-BD_ga8W6.js";import{h as w,g as C,j as h,l as A,i as V}from"./core-Bx5kG7oj.js";import{_j as k,_q as J,gK as Q,gJ as q,gI as K,kU as W,XT as X,v7 as L,fJ as B,ZS as D,kS as T,_k as S,_t as F,kQ as G,lb as j}from"./zeni-epic-state-CP_8Me3V.js";import{bQ as M,$ as R,p as _,z as N,a2 as p,_ as v,a5 as U,bR as Y,E as Z,bS as ee,j as te}from"./index-DkHntkmh.js";import{u as O,n as z}from"./mui-BaMyMAqO.js";import"./sentry-DsaQHQmX.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]="d2e7b04b-814f-4417-be49-a9e09be64bd5",e._sentryDebugIdIdentifier="sentry-dbid-d2e7b04b-814f-4417-be49-a9e09be64bd5")}catch{}})();const ne=A(null,(function(e,t){return{onSaveVendor:n=>{e(W(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(X("common")),n!=null&&e(L(n))},onGetOtp:n=>{e(K(n,"BillPayVendor"))},onResendOtp:n=>{e(q(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(Q(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(J(n,a,o))}}}))(M);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=z.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`,oe=A((function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{navigate:n,location:a,vendorId:o}=t;return{onFetchBankName:s=>{e(j(s))},onSaveHandler:s=>{e(G(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),d=s.poppedPathname??$();n(d,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(F({data:d}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),d=s.poppedPathname??$(0);t.navigate(d,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}}))(Y);function fe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=R(),{vendorId:s,billId:d}=V(),c=e??s,{useFeatureGate:r}=_(),i=N.getSignedInUser(),b=h((u=>B(u))),g=O(),I=p(a.state?.pathnameStackToGoBack),f=t??(I.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:x}=r(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(v.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(U,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(H,{vendorId:c,billId:d}),l.jsx(oe,{location:a,navigate:n,billId:d,vendorId:c,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:x,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},me=(e,t,n)=>{let a=`/${e}/bill/${encodeURIComponent(t)}`;return n=="draft"&&(a+="/edit"),a},he=e=>`/${e}/bills`,ke=(e,t)=>{let n=`/${e}/bill`;return n=t!=null?n.concat(`/${t}/edit`):n.concat("/new"),n},E=(e,t,n,a)=>{let o=`/${e}/bill`;return o+=n!=null?`/${n}/edit/vendor`:"/new/vendor",o+=a!=null?`/${a}/edit/${t}`:`/create/${t}`,o};function Se(e,t,n){return E(e,"ach",t,n)}function ve(e,t,n){return E(e,"domestic",t,n)}function ge(e,t,n){return E(e,"international",t,n)}const se=(e,t,n)=>{let a=`/${e}/bill/`;return a=n!=null?a.concat(`${encodeURIComponent(n)}/${t}/`):a.concat(`new/${t}/`),a},re=z.div`
|
|
10
|
-
display: flex;
|
|
11
|
-
height: 100vh;
|
|
12
|
-
width: 100%;
|
|
13
|
-
flex: 1 1 auto;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: center;
|
|
16
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
17
|
-
box-shadow: ${e=>`0px 2px ${Z.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
18
|
-
`,de=A((function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:n,navigate:a,location:o,vendorId:s,currentTenant:d}=t,{tenantEmailDomain:c}=d;return{onFetchBankName:r=>{e(j(r))},onSaveHandler:r=>{e(G(t.bankAccountContext,r,"us-domestic",s))},onWireDetailsUpdated:r=>{const{bankAccountSection:i}=r;e(F({data:i}))},onCancel:()=>{(()=>{const r=p(o.state?.pathnameStackToGoBack),i=r.poppedPathname??P();a(i,{state:{pathnameStackToGoBack:r.newStack}})})(),e(S())},onAddressClick:r=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const i=se(c,r,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const r=p(t.location.state?.pathnameStackToGoBack),i=r.poppedPathname??P(0);t.navigate(i,{state:{pathnameStackToGoBack:r.newStack}})}e(S())}}}))(ee);function Ie({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=R(),{vendorId:s,billId:d}=V(),c=e??s,r=N.getSignedInUser(),{useFeatureGate:i}=_(),b=O(),g=h((u=>B(u))),I=p(a.state?.pathnameStackToGoBack),f=t??(I.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:x}=i(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=i(v.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(U,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${Z.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(re,{windowSize:o,children:[l.jsx(H,{vendorId:c,billId:d}),l.jsx(de,{location:a,navigate:n,billId:d,vendorId:c,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:x,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{fe as A,Ie as D,H as V,me as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-BD_ga8W6.js";import{$ as f,a9 as l}from"./index-DkHntkmh.js";import{u as c,D as p}from"./mui-BaMyMAqO.js";import"./sentry-DsaQHQmX.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="0a5deef5-89fb-4f1a-a578-78487c6fdc33",e._sentryDebugIdIdentifier="sentry-dbid-0a5deef5-89fb-4f1a-a578-78487c6fdc33")}catch{}})();const u={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:a,onClose:t}=e,n=f(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),d=c();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:d.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:a})}export{h as D};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BD_ga8W6.js";import{a as l}from"./sentry-DsaQHQmX.js";import{h as X,u as G,g as q,i as F,j as c,N,l as Y,n as O,o as _}from"./core-Bx5kG7oj.js";import{Yn as R,fJ as M,Xd as W,n4 as $,Ta as k,Y4 as z,XS as H,m4 as J,Tb as P,Xi as U,Xj as V,XU as K,XT as L}from"./zeni-epic-state-CP_8Me3V.js";import{bb as Q,h as Z,a2 as tt,j as et}from"./index-DkHntkmh.js";import"./mui-BaMyMAqO.js";import{d as S}from"./decodeURIComponentSafe-DMAtWdNT.js";import{w as at}from"./withTransactionSidePanel-DTG3VL6U.js";import{i as nt,c as it}from"./routePaths-Cxh0_DtI.js";import{u as ot}from"./useIsCustomersTabEnabled-BiAWPXPy.js";import"./recharts-Bcj70bk1.js";import"./analytics-CzizEiux.js";import"./plaid-BmyHDSR7.js";import"./dnd-BT4GhSLO.js";import"./stripe-cKAAJElX.js";import"./lottie-EXw6nebq.js";import"./lexical-BVHU6OCB.js";import"./pdf-DnsysvFr.js";import"./utils-Rng1Um8N.js";import"./useAskAiCfoHostNavButtonProps-B0IAA2LU.js";import"./TransactionDetailScreen-DPXvNf-7.js";import"./useInitialThreadRequest-Dspu5rPv.js";import"./expenseAutomationHelper-CAr9eXjQ.js";import"./stripSplatSuffix-B3Bc_avB.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="235f58b7-47cc-4b03-aa19-de7fe68db959",a._sentryDebugIdIdentifier="sentry-dbid-235f58b7-47cc-4b03-aa19-de7fe68db959")}catch{}})();const rt=Y((function(a,t){const e=t.entity,i=z(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:H(a,"common")},trendWithTransactionsReport:i,analytics:Z,isAccountingClassesEnabled:J(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const i=`${it(e,t.tenantEmailDomain)}`,m=et(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(i,{state:{pathnameStackToGoBack:m}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(K({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const i=nt(e,t.tenantEmailDomain,t.isCustomersTabEnabled===!0);a(U()),a(V()),t.resetTrendIsFetchedStates(),t.navigate(i,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=tt(t.location.state?.pathnameStackToGoBack),i=e.poppedPathname??C();t.navigate(i,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(P(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const i=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(P(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:i}))}}}}))(Q),st=at((function({entityType:a,...t}){const e=ot(),i=X(),m=G(),I=q(),[d,T]=l.useState(!1),[h,b]=l.useState(!1),{tenantEmailDomain:j,entityIdEncoded:x,entityNameEncoded:v}=F(),r=S(x??""),p=S(v??""),u=mt(r,p),w=[r,p].filter((n=>n!=null)),o={name:p,id:r,type:a,zeniId:r,qboId:r},D=c((n=>R(n.customerIncomeState,n.vendorExpenseState,n.trendState,o,"quarter"))),A=c((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),f=c((n=>W(n.trendWithTransactionsState,o,"EntityDetail")));l.useEffect((()=>{d===!1&&u===!0&&(T(!0),m($(o)))}),[d,u,o]);const E=c((n=>n.trendState.fetchState)),g=f?.selectedPeriod?.timePeriod??D,B=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(f?.selectedPeriod?.timePeriod,D);return l.useEffect((()=>{d===!0&&h===!1&&E==="Completed"&&(b(!0),g!=null&&m(k(o,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:g})))}),[d,h,E]),u?s.jsx(rt,{isCustomersTabEnabled:e,firstMonthOfFY:A,tenantEmailDomain:j,location:I,navigate:i,entity:o,defaultTransactionTimePeriod:B,resetTrendIsFetchedStates:()=>{T(!1),b(!1)},...t}):s.jsx(N,{to:C(w.length)})})),mt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,C=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function Xt({entityType:a}){return s.jsx(O,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(st,{entityType:a})})})}export{Xt as EntityDetailRoutes,Xt as default};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{j as k}from"./liveblocks-BD_ga8W6.js";import{u as Ie,h as Me,g as ge,j as M,i as Ae,s as po,t as Xn,l as ho,n as So,o as Ye,N as fo}from"./core-Bx5kG7oj.js";import{fJ as xe,a2v as Hn,qj as Be,Va as Rt,AE as Io,a2w as go,a2x as Co,a2y as ko,a2z as yt,a2A as ct,gl as wt,a2B as bn,eI as bo,g4 as To,a2C as Tn,a2D as it,ra as yo,va as Po,gX as vo,gV as Eo,a2E as Ao,rn as xo,rw as Ro,qu as wo,qI as Wn,gU as me,gW as Do,a2F as Fo,r2 as Kn,rx as _o,qF as Bo,qA as Mo,vg as Oo,gT as Ee,a2G as dt,CO as Zn,Ni as Qn,a2H as ea,XN as Uo,Gd as ta,a2I as Vo,f0 as jo,f2 as $o,tc as Dt,Yo as yn,Yq as zo,m7 as Lo,Yr as Go,me as No,dq as qo,E5 as Ft,XZ as Yo,X$ as Jo,X_ as Xo,Y0 as Ho,fq as _t,t0 as Pn,a2J as Wo,XS as Ko,a2K as Zo,a2L as Qo,mg as es,a2M as ts,R_ as ns,mf as as,m4 as os,qX as na,rC as ut,tP as aa,u9 as ss,V0 as oa,rB as vn,rE as sa,rG as cs,bH as is,nD as ls,nA as rs,rF as lt,rD as ve,a2N as ds,rX as En,a2O as us,a2P as ms,t4 as ps,t5 as hs,XO as Ss,WU as ca,a1Z as fs,a2Q as Is,XU as An,XT as st,a2R as xn,mv as gs,a2S as Cs,a2T as ks,a2U as bs,a2V as Ts,qS as ys,a2W as Ps,a2X as vs,a2Y as Es,rN as As,mi as xs,m9 as Rs,a2Z as ws,mh as Rn,YA as Ds,a2_ as Fs,a2$ as _s,uN as Bs,uo as Ms,un as Pt,a30 as Os,a31 as Us,a32 as Vs,a33 as js,nO as $s,br as ia,nJ as wn,nv as zs,a34 as Ls,h4 as Gs,nG as Ns,te as qs,tg as Ys,sZ as Js,WX as Xs,WY as Hs,FH as Ws,FG as Ks,FX as Zs,a35 as Dn,t3 as Qs,sA as ec,a36 as tc,sg as nc,sl as ac,sw as oc,sj as sc,a37 as cc,sc as ic,sv as lc,t9 as rc,a38 as dc,tm as uc,sT as mc,ts as pc,sY as hc,rY as Sc,a39 as fc,re as Ic,qO as gc,qV as Fn,rI as Cc,a3a as kc,a3b as bc,a3c as Tc,a3d as yc,a3e as Pc,a3f as vc,a3g as Ec,tw as Ac,a3h as xc,a3i as Rc,a3j as _n,uY as wc,uf as Dc,u5 as Bn,u3 as Fc,a3k as _c,tU as Bc,tz as Mc,u6 as Oc,a3l as Uc,a3m as Vc,tF as jc,a3n as $c,tA as zc,tE as Lc,tC as Gc,ub as Nc,a3o as Mn,qn as vt,a3p as qc,Eh as On,cB as Yc,qJ as Jc,a3q as Xc}from"./zeni-epic-state-CP_8Me3V.js";import Ut from"./NotFoundScreen-oYE2WlvI.js";import{a as o,R as la}from"./sentry-DsaQHQmX.js";import{n as Oe,S as Hc}from"./mui-BaMyMAqO.js";import{p as mt,_ as Q,h as te,j as ee,ao as ra,aq as da,dR as Wc,dS as Kc,z as Xe,dT as Bt,dU as Zc,dV as Qc,ac as Je,dW as ei,dX as Un,bd as Vn,dY as ti,dZ as ni,a5 as ua,d_ as ai,g as rt,a as oi,d$ as si,e0 as ci,v as ii,V as li,e1 as ri,e2 as di,e3 as ui,b7 as mi,bv as pi,a9 as hi,b8 as Si,b3 as fi,b9 as Ii,G as ma,w as gi,e4 as Ci,at as Mt,e5 as ki,a2 as bi,e6 as Ti,e7 as yi}from"./index-DkHntkmh.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-B0IAA2LU.js";import{g as jn,u as Pi,c as vi,h as Ei,b as Ai,i as xi,r as Ri,C as wi}from"./TransactionDetailScreen-DPXvNf-7.js";import{a as Di,u as Fi,b as _i}from"./useActualMatchingMatchDetail-iGCUO44-.js";import{d as Bi}from"./decodeURIComponentSafe-DMAtWdNT.js";import{m as jt,a as pa,b as ha,i as Ot}from"./expenseAutomationHelper-CAr9eXjQ.js";import{u as Sa,a as fa,w as Mi}from"./withTransactionSidePanel-DTG3VL6U.js";import{b as Oi,S as Ui,a as Vi,J as ji}from"./ScheduleDetailsPrepaidExpensesScreen-COClCOXU.js";import{s as $n,j as Ia,h as $i,k as zi,v as Li,c as Gi}from"./routePaths-Cxh0_DtI.js";import{a as Et}from"./accountMappingHelper-FvEDI2O0.js";import{D as Ni}from"./DrawerScreen-C86vnRJz.js";import"./recharts-Bcj70bk1.js";import"./analytics-CzizEiux.js";import"./plaid-BmyHDSR7.js";import"./dnd-BT4GhSLO.js";import"./stripe-cKAAJElX.js";import"./lottie-EXw6nebq.js";import"./lexical-BVHU6OCB.js";import"./pdf-DnsysvFr.js";import"./utils-Rng1Um8N.js";import"./useInitialThreadRequest-Dspu5rPv.js";import"./stripSplatSuffix-B3Bc_avB.js";import"./pathToGoBack-BzRgSVEC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="c654dddb-422a-4d72-8ab5-40b1fe033881",t._sentryDebugIdIdentifier="sentry-dbid-c654dddb-422a-4d72-8ab5-40b1fe033881")}catch{}})();const qi=()=>{const t=Ie(),n=Me(),h=ge(),p=M((m=>xe(m))),{useFeatureGate:S}=mt(),{isFeatureEnabled:i}=S(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=S(Q.aiAuditScorePercentage),R=M((m=>m.expenseAutomationViewState.selectedPeriodByTenantId)),l=M((m=>Hn(m,p.tenantId))),{isAiCfoAccessEnabled:b,onAskAiCfoClick:f}=Vt({mobileExploreReferrer:"Month-End Close Overview"}),v=o.useCallback(((m,d,g=!1)=>{t(Be({tenantId:d,period:{month:m.month,year:m.year},refreshViewInBackground:g}))}),[]),E=o.useCallback((m=>{const d=h.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&te.trackMonthCloseAuditPage(m.month,m.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null),t(Rt(p.tenantId,m))}),[p.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),C=R[p.tenantId],O=o.useCallback((()=>{const m=h.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&te.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,m??null),v(C,p.tenantId,!0)}),[v,C,p.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=ee(h.state?.pathnameStackToGoBack,h.pathname),J=o.useCallback((()=>{if(l.monthEndCloseChecks!=null&&C!=null){const m=l.monthEndCloseChecks.monthEndCloseCheckList.find((d=>d.progress<100));if(m!=null)return void n(`./${m.id}/${C.month}-${C.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${C.month}-${C.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,C]),{areTenantIdsInSync:w}=ra();return da({isDataReady:l.fetchState==="Completed"}),o.useEffect((()=>{C!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&w&&v(C,p.tenantId)}),[v,C,l.fetchState,p.tenantId,w]),o.useEffect((()=>{C!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&w&&t(Io(C))}),[C,l.monthClosePerformanceTrendFetchStatus.fetchState,w]),o.useEffect((()=>{const m=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&O()}),3e5);return()=>clearInterval(m)}),[l.fetchState]),o.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const m=h.state?.referrer;te.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,m??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),k.jsx(Yi,{children:k.jsx(Wc,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:i,onMonthEndCheckClick:m=>{n(`./${m}/${C.month}-${C.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:E,handleReviewButtonClick:J,onBackClick:()=>{n("../../dashboard")},onReload:O,isAiCfoAccessEnabled:b,onAskAiCfoClick:f,aiAuditScorePercentageEnabled:r})})},Yi=Oe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
8
|
-
`;function Ji({isFullView:t,matchId:n,onClose:h}){const{match:p,detailFetchState:S,handleOpenBill:i,handleApproveAndReverse:r,handleIgnoreMatchSuggestion:R,handleRefresh:l,handleUndoReversal:b,lastMatchResults:f,lastUndoResults:v,refreshStatus:E,ignoreStatus:C,matchAndReverseStatus:O,undoReversalStatus:F}=Di(n);return k.jsx(Kc,{match:p,detailFetchState:S.fetchState,isRenderedInPanel:!t,isApproveInFlight:O.fetchState==="In-Progress",isIgnoreInFlight:C.fetchState==="In-Progress",isUndoInFlight:F.fetchState==="In-Progress",refreshStatus:E.fetchState,onNavigateBack:h,onOpenBill:i,onApproveAndReverse:r,onIgnoreMatchSuggestion:R,onRefresh:l,onUndoReversal:b,lastMatchResults:f,lastUndoResults:v})}const Xi=/^match\/([^/?]+)$/,Hi=fa({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const n=(function(p=!0){const S=Me(),i=ge(),r=Ae(),R=jt(r),l=Sa({childPathPattern:Xi,enabled:p,listPath:R}),b=l.matchGroups[0]!=null&&l.matchGroups[0]!==""?Bi(l.matchGroups[0]):void 0,f=r.tenantEmailDomain??i.pathname.split("/").find(Boolean)??"",v=o.useRef({isOpen:l.isOpen,matchId:b});v.current={isOpen:l.isOpen,matchId:b};const E=o.useCallback((F=>{!l.isMobile&&p?v.current.isOpen&&v.current.matchId===F?l.closePanel():l.navigateToChild(`match/${encodeURIComponent(F)}`,{replace:v.current.isOpen}):S(`/${f}/expense-automation/actual-matching/${encodeURIComponent(F)}`)}),[S,l.isMobile,l.navigateToChild,l.closePanel,p,f]),C=o.useCallback((()=>{if(b==null)return;const F=ee(i.state?.pathnameStackToGoBack,`${i.pathname}${i.search}`);S(`/${f}/expense-automation/actual-matching/${encodeURIComponent(b)}`,{state:{pathnameStackToGoBack:F}})}),[i.pathname,i.search,i.state,b,S,f]),O=l.isOpen&&b!=null;return{closePanel:l.closePanel,isOpen:O,maximize:C,matchId:p&&O?b:void 0,openPanel:E}})(t),h=o.useMemo((()=>{if(n.isOpen&&n.matchId!=null)return k.jsx(Ji,{isFullView:!1,matchId:n.matchId,onClose:n.closePanel},n.matchId)}),[n.closePanel,n.isOpen,n.matchId]);return{injectedProps:o.useMemo((()=>({closeMatchSidePanel:n.closePanel,isMatchPanelOpen:n.isOpen,matchPanelContent:h,matchPanelMatchId:n.matchId,openMatchPanel:n.openPanel})),[h,n.closePanel,n.isOpen,n.matchId,n.openPanel]),selectedItemId:n.matchId,sidePanel:{closePanel:n.closePanel,maximize:n.maximize}}}}),Wi=la.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:h,onFetchLinkTokenClick:p,onEstablishConnectionClick:S})=>{const i=Ie(),r=Me(),R=ge(),{tenantEmailDomain:l,selectedTab:b,selectedPeriod:f}=Ae(),{useFeatureGate:v}=mt(),{isFeatureEnabled:E}=v(Q.isReconV3Enabled),{isFeatureEnabled:C}=v(Q.isReconciliationCombinedStatementEnabled),{isFeatureEnabled:O}=v(Q.isReconReportEnabled),F=Xe.getSignedInUser(),J=M((A=>xe(A))),w=o.useMemo((()=>({userId:F?.userId??"",sessionId:F?.zeniSessionId??"",tenantId:J?.tenantId??""})),[F?.userId,F?.zeniSessionId,J?.tenantId]),{accountReconciliationsByAccountID:m,excludedAccountIDs:d,monthYearPeriod:g,statementUploadChosen:D}=t,B=m[n],z=o.useMemo((()=>go(m,n)),[m,n]),x=o.useMemo((()=>Co(m)),[m]),I=o.useMemo((()=>ko(m,n)),[m,n]),e=o.useRef(!1),a=o.useCallback((A=>{e.current=A,Un(n,A)}),[n]),s=o.useCallback((A=>{i(yt({accountId:n,selectedPeriod:g,dismissedToBackground:!0,backgroundCompletedSteps:A.completedSteps,startedAtMs:A.startedAtMs,totalDurationSeconds:A.totalDurationSeconds})),A.accountMappings!=null&&i(ct({accountId:n,selectedPeriod:g,localData:{combinedStatementAccountMappings:A.accountMappings}})),B!=null&&requestAnimationFrame((()=>{e.current||i(wt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Bt(B)}]}))}))}),[i,g,B,n]),u=o.useCallback((()=>{i(yt({accountId:n,selectedPeriod:g,dismissedToBackground:!1}))}),[i,n,g]),P=o.useCallback((A=>{i(bn({accountId:n,selectedPeriod:g,backgroundCompletedSteps:A}))}),[i,g,n]),y=o.useCallback((()=>{i(bn({accountId:n,selectedPeriod:g,backgroundCompletedSteps:0})),i(yt({accountId:n,selectedPeriod:g,dismissedToBackground:!1}))}),[i,g,n]);o.useEffect((()=>()=>{Un(null,!1)}),[]);const _=B?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??B?.accountReconEntity.statementMetaData?.statementUploadId,$=B?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,H=M((A=>$!=null&&$!==""?bo(To(A.userState,$)):"")),W=o.useCallback((()=>{i(Tn({accountId:n,selectedPeriod:g}))}),[i,n,g]),ae=o.useCallback((()=>{i(Tn({accountId:n,selectedPeriod:g})),i(it({statementUploadChosen:!0}))}),[i,n,g]),ce=(A,Z)=>{i(Oo(A,Z.split(".")[0]))},T=(A,Z)=>{if(Z===!0){const se=B?.combinedStatementGroupId??B?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??B?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(se!=null&&se!=="")return void i(Bo({accountId:n,selectedPeriod:g,combinedStatementGroupId:se,fileId:A}))}_!=null&&i(Mo({accountId:n,selectedPeriod:g,fileId:A,statementUploadId:_}))},V=()=>{i(it({statementUploadChosen:!1}))},X=A=>{i(_o({accountId:n,selectedPeriod:g,payload:A,statementAccountScope:C===!0?B?.localData?.statementAccountScope??"single_account":"single_account"}))},K=o.useCallback(((A,Z,se)=>{i(yo({accountId:A,selectedPeriod:Z,statementUploadId:se}))}),[i]),Ce=o.useCallback(((A,Z,se,Ve,Re)=>{Re!=null&&Re!==""&&i(Po(Re)),i(Ve==null||Ve===""?Eo({accountId:A,selectedPeriod:Z,statementUploadId:se}):vo({accountId:A,selectedPeriod:Z,statementUploadId:se,combinedStatementGroupId:Ve}))}),[i]),Ue=o.useCallback(((A,Z)=>{Z!==""&&i(Ao({accountId:n,selectedPeriod:g,statementUpdateLocalData:A,statementUploadId:Z}))}),[i,n,g]),pe=o.useCallback((()=>{_!=null&&i(B?.localData?.statementAccountScope!=="multi_account"?Ro({accountId:n,selectedPeriod:g,statementUploadId:_}):xo({accountId:n,selectedPeriod:g,statementUploadId:_}))}),[i,B?.localData?.statementAccountScope,n,g,_]),j=o.useCallback((A=>{_!=null&&i(wo({accountId:n,selectedPeriod:g,statementUploadId:_,accountMappings:A}))}),[i,g,n,_]),ke=o.useCallback((()=>{i(it({statementUploadChosen:!0}))}),[i]),de=A=>{i(ct({accountId:n,selectedPeriod:g,localData:{accountSource:A}}))},pt=A=>{i(ct({accountId:n,selectedPeriod:g,localData:{statementAccountScope:A}}))},be=o.useCallback((()=>{i(Wn({accountId:n}))}),[i,n]),ht=o.useCallback((A=>{i(me(g,A,!0)),h()}),[i,g,h]),He=o.useCallback((A=>{if(l==null||b==null||f==null)return;const Z=ee(R.state?.pathnameStackToGoBack,R.pathname);h();const se=pa({tenantEmailDomain:l,selectedTab:b,accountId:A,period:f});se!=null&&r(se,{state:{pathnameStackToGoBack:Z}})}),[R.pathname,R.state,r,h,f,b,l]),ie=o.useCallback((()=>{i(Do({accountId:n,selectedPeriod:g,statementProcessingFailed:!1})),i(Fo({accountId:n,selectedPeriod:g}))}),[i,n,g]),he=o.useCallback((()=>{i(Kn({accountId:n}))}),[i,n]),oe=d.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(oe!=null)return k.jsx(zn,{children:k.jsx(Ln,{$isV3:E===!0,children:k.jsx(Zc,{excludedAccountReconciliation:oe,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:E,onDismissClick:h,onIncludeIntoReconciliation:he})})});if(B!=null){const A=E===!0?k.jsx(Qc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:B,monthYearPeriod:g,onDismissClick:h,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:p,onEstablishConnectionClick:S,onEditFileName:ce,onDeleteFile:T,onSelectSourceType:de,onSelectStatementAccountScope:pt,isReconciliationCombinedStatementEnabled:C===!0,ledgerAccounts:z,statementOverrideWarningAccountIds:I,unavailableLedgerAccountIds:x,onConfirmStatementMapping:j,filesEndPoint:Je.fileMicroServiceBaseUrl,authParams:w,openFilePicker:D,onStatementUploadSuccess:X,onUploadWindowOpenedOnce:V,onExcludeFromReconciliation:be,onRetryParsing:K,onFetchStatementParseInfo:Ce,onReviewClicked:ht,onViewReportClicked:O===!0?He:void 0,statementProcessingFailed:B.statementProcessingFailed,statementProcessingDismissedToBackground:B.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ie,onContinueInBackground:s,onClearStatementProcessingDismissedToBackground:u,onResetStatementProcessingProgress:y,onStatementProcessingProgressChange:P,onStatementFlowVisibilityChange:a,onReuploadStatement:ke,onStatementFormDataChange:Ue,onStatementConfirmSave:pe,reconciledByName:H,onDismissDateConflict:W,onReuploadAfterDateConflict:ae,isReconV3Enabled:E}):k.jsx(ei,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:B,monthYearPeriod:g,onDismissClick:h,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:p,onEstablishConnectionClick:S,onEditFileName:ce,onDeleteFile:T,onSelectSourceType:de,filesEndPoint:Je.fileMicroServiceBaseUrl,authParams:w,openFilePicker:D,onStatementUploadSuccess:X,onUploadWindowOpenedOnce:V,onExcludeFromReconciliation:be});return k.jsx(zn,{children:k.jsx(Ln,{$isV3:E===!0,children:A})})}return null})),zn=Oe.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
height: 100%;
|
|
12
|
-
`,Ln=Oe.div`
|
|
13
|
-
flex: 1;
|
|
14
|
-
min-height: 0;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
min-width: 0;
|
|
19
|
-
overflow-x: hidden;
|
|
20
|
-
overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
|
|
21
|
-
`;function Ki({panelType:t,scheduleId:n,onClose:h,onCloseAfterDecision:p}){return k.jsx(tl,{children:k.jsx(nl,{children:el(t,n,h,p)})})}function Zi({panelType:t,scheduleId:n}){return t!=="one_time_accrual"?null:k.jsx(Qi,{accrualId:n})}function Qi({accrualId:t}){const n=M((p=>Uo(p,t).accrual),po),h=Fi();return n==null?null:k.jsx(ti,{accrual:n,onOpenJournalEntry:h})}function el(t,n,h,p){switch(t){case"one_time_accrual":return k.jsx(ji,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:h});case"accrued_expenses":return k.jsx(Vi,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:h,onPanelCloseAfterDecision:p});case"fixed_assets":return k.jsx(Ui,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:h,onPanelCloseAfterDecision:p});case"prepaid_expenses":return k.jsx(Oi,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:h,onPanelCloseAfterDecision:p})}}const tl=Oe.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
height: 100%;
|
|
25
|
-
`,nl=Oe.div`
|
|
26
|
-
flex: 1;
|
|
27
|
-
min-height: 0;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
min-width: 0;
|
|
32
|
-
overflow-x: hidden;
|
|
33
|
-
overflow-y: auto;
|
|
34
|
-
`,al=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,ol=fa({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(C=!0){const O=Me(),F=ge(),J=Ie(),w=Ae(),m=Sa({childPathPattern:al,enabled:C}),d=m.matchGroups[0],g=Ia(d)?d:void 0,D=m.matchGroups[1]!=null&&m.matchGroups[1]!==""?m.matchGroups[1]:void 0,B=m.isOpen&&g!=null&&D!=null,z=w.tenantEmailDomain??F.pathname.split("/").find(Boolean)??"",x=o.useRef({isOpen:B,scheduleId:D});x.current={isOpen:B,scheduleId:D};const I=o.useCallback(((a,s,u)=>{u!=null&&(s==="prepaid_expenses"||s==="fixed_assets")&&J(ta({selectedJEScheduleKey:u})),!m.isMobile&&C?x.current.isOpen&&x.current.scheduleId===a?m.closePanel():m.navigateToChild(`schedule/${s}/${a}`,{replace:x.current.isOpen}):O($n(s,a,z),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[J,O,m.isMobile,m.navigateToChild,m.closePanel,C,z]),e=o.useCallback((()=>{if(g==null||D==null)return;const a=ee(F.state?.pathnameStackToGoBack,F.pathname);O($n(g,D,z),{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})}),[O,g,D,z,F.pathname,F.state]);return{closePanel:m.closePanel,isOpen:B,maximize:e,openPanel:I,panelType:B?g:void 0,scheduleId:B?D:void 0}})(t),h=o.useRef(null),[p,S]=o.useState(null),i=o.useMemo((()=>({registerPanelDirtyGuard:C=>{h.current=C}})),[]),r=o.useCallback((C=>{h.current?.isDirty()===!0?S((()=>C)):C()}),[]),R=o.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=o.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),b=o.useCallback(((C,O,F)=>{r((()=>n.openPanel(C,O,F)))}),[r,n.openPanel]),f=o.useMemo((()=>{if(p!=null)return{onCancel:()=>S(null),onDiscard:()=>{h.current=null,S(null),p()}}}),[p]),v=o.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return k.jsx(ni.Provider,{value:i,children:k.jsx(Ki,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:R,onCloseAfterDecision:()=>{h.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,R,i]),E=o.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return k.jsx(Zi,{panelType:n.panelType,scheduleId:n.scheduleId})}),[n.isOpen,n.panelType,n.scheduleId]);return{injectedProps:o.useMemo((()=>({closeSchedulePanel:R,isSchedulePanelOpen:n.isOpen,openSchedulePanel:b,schedulePanelActionBarContent:E,schedulePanelContent:v,schedulePendingDiscardConfirmation:f})),[R,b,E,v,f,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:R,maximize:l}}}});function sl({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:h,resetCustomerRequest:p}){const S=Xe.getSignedInUser();if(S==null)throw Error("Can't access Customer Request page without signing in...");const i=M((r=>Vo(r,t,S)));return o.useEffect((()=>{p()}),[]),k.jsx(k.Fragment,{children:i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?k.jsx(ua,{fetchState:"In-Progress"}):k.jsx(ai,{onCloseClick:n,addCustomerRequest:h,snippets:i.companyMonthEndReportTemplatesData,bulletPoints:i.zeniRequestsData??[]})})}const cl={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},il=()=>{const t=M((f=>Ee(f))),n=ge(),{currentSelectedViewFetchState:h,currentSelectedView:p,selectedPeriod:S}=t,i=rt(p),r=rt(h.fetchState),R=t.jeSchedules.uiState.selectedPageTab??"schedules",l=rt(R),b=o.useCallback((f=>{const v=n.state?.referrer;p==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?te.trackTransactionsReviewPage(S.month,S.year,t.transactionView.totalCountByTab.review,0,f,v??null):te.trackTransactionsAutoCategorisedPage(S.month,S.year,t.transactionView.totalCountByTab.autoCategorized,0,f,v??null)),p==="missing_receipts"&&te.trackMissingReceiptsPage(S.month,S.year,f,t.missingReceipts.transactions.length,v??null),p==="je_schedules"&&te.trackMonthCloseScheduleListPage(S.month,S.year,f,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.failedPostings.length,(E=>{const C={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return E.forEach((O=>{if(jo(O))C.oneTimeAccrualCount+=1;else switch($o(O)){case"prepaid_expenses":C.prepaidCount+=1;break;case"fixed_assets":C.fixedAssetsCount+=1;break;case"accrued_expenses":C.accruedCount+=1}})),C})(t.jeSchedules.pendingReviewSchedules),cl[R],v??null),p==="flux_analysis"&&te.trackFluxAnalysisPage(S.month,S.year,f,ll(t.fluxAnalysis),v??null),p==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&te.trackInsightsEmailPage(S.month,S.year,f,"draft",t.auditSummary.auditScorePercentage,null,v??null)}),[S,t,R]);return o.useEffect((()=>{(r!==h.fetchState||p!==i||p==="je_schedules"&&l!=null&&R!==l)&&h.fetchState==="Completed"&&b(!1)}),[p,h.fetchState,i,R,l]),b},ll=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:rl,comma:Gn,space:dl}},dateFormat:ga}=ma.getLocalizedStrings(),Nn=Nc,ul=ho((function(t,n){const{uncategorizedAccounts:h,vendorSearchAutoCompleteData:p,monthEndInsightsCustomerRequestData:S,monthEndInsightsPreviewMode:i,companyId:r,isMissingReceiptsBulkUploadEnabled:R,isTransactionActivityEnabled:l,newScheduleActiveType:b}=n,f=Xe.getSignedInUser(),v=t.tenantState.currentTenantId,E={userId:f?.userId??"",sessionId:f?.zeniSessionId??"",tenantId:v??""},C=Ee(t),{selectedTransactionCategorizationTab:O}=C,{searchTransactionsResults:F,searchTransactionsFetchState:J}=us(t),w=b==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:m,classListNestedAccountHierarchy:d,allDepreciationAccountListNestedAccountHierarchy:g,newScheduleLocalData:D,saveStatus:B}=ms(t,w);return{expenseAutomationViewSelector:C,accountListNestedAccountHierarchy:m,allDepreciationAccountListNestedAccountHierarchy:g,baseTransactionSearchFetchState:J,baseTransactionSearchResults:F,classListNestedAccountHierarchy:d,newScheduleLocalData:D,initialSelectedBaseTransaction:D.selectedBaseTransactionId!=null?ps(t.transactionState,hs(D.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Ss(t),newScheduleSaveStatus:B,bulkUploadSelector:R===!0?C.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:p,authParams:E,receiptUploadEndpoint:`${Je.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Mt}/transaction_attachments`,bulkUploadEndpoint:R===!0?`${Je.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:O,selectedTransactionGroup:C.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:S,monthEndInsightsPreviewMode:i,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:f,uncategorizedAccounts:h,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:fs(t.tenantState,v),downloadParams:{authParams:E,jeScheduleEndPoint:`${Mt}/jeScheduleReports`,timezone:ca(),companyName:xe(t).companyName}}}),(function(t,n){const{themeState:h,isAccountingClassesEnabled:p,isCOTEnabled:S,isMissingReceiptsBulkUploadEnabled:i,location:r,vendorSearchAutoCompleteData:R,expenseAutomationViewSelector:l,currentTenant:b,newScheduleActiveType:f,uncategorizedAccounts:v,navigate:E,onClickCustomerRequest:C,handleEditClick:O,closeSchedulePanel:F,isSchedulePanelOpen:J,openSchedulePanel:w,setActivityLogTransactionId:m}=n,{selectedPeriod:d,currentSelectedView:g,reconciliation:{selectedAccountId:D}}=l,{accountSettingsView:B}=l.jeSchedules,z=na(d),x=ut(z.start),I=ut(z.end);return{onZeniLogoClick:()=>{h.toggle()},onUploadReceiptAttachment:e=>{te.trackMissingReceiptAttached(d.month,d.year),t(Dc(e))},onUploadTransactionReceipt:(e,a,s,u,P,y)=>{t(_n(e,a,{fetchState:"In-Progress"}));const _=()=>t(_n(e,a,{fetchState:"Error"}));ki(`${Je.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,y,a,s,u,P).then(($=>{$!=null?t(wc(e,$)):_()})).catch(_)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const s=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(Rc(e,a)),b!=null&&t(Be({tenantId:b.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,s,u)=>{t(xc(e,{fetchState:a,error:s})),s!=null&&t(wt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:u!=null?dl+rl+u+Gn:Gn}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,s=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,u=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;s&&n.closeMatchSidePanel?.(),J===!0&&(s||u)&&F?.(),e.createdGroupCollapsed!=null?t(yc()):e.pendingGroupCollapsed!=null?t(Pc()):e.failedGroupCollapsed!=null?t(vc()):e.selectedJETypeFilter!==void 0?t(Ec(e.selectedJETypeFilter)):t(Ac(e))},onUpdateMissingReceiptsUIState:e=>{t(Tc(e))},onFetchMissingReceiptsList:()=>{I!=null&&x!=null&&t(sa({start:x,end:I},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...i===!0?{onBulkUploadFiles:e=>{t(Gc(e))},onBulkUploadProgress:e=>{t(Lc(e))},onBulkUploadSuccess:e=>{t(zc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t($c(e))},onConfirmBulkUploadMatch:(e,a,s,u,P)=>{t(jc(e,a,s,u,P))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Vc())},onSetBulkUploadResultsTab:e=>{t(Uc(e))},onSetBulkUploadCompletedSubTab:e=>{t(Oc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(Bn({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(Mc())},onSearchTransactionsForManualMatch:(e,a)=>{t(Nn(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(Nn(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(Bc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(_c())},onFetchBulkUploadBatches:e=>{t(aa(e))},onFetchMoreBatchDetails:()=>{t(Fc())},onResetBulkUploadSort:()=>{t(Bn({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(bc())},onSearchTextChanged:e=>{const a=l.currentSelectedView,s=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(Pt({selectedTab:s,uiState:{searchString:e}})),I!=null&&x!=null&&t(ve(s,{start:x,end:I},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(kc({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(Cc())},onClose:()=>{g==="reconciliation"&&D!=null&&t(Fn({selectedAccountId:void 0})),E("../")},onBack:()=>{g==="reconciliation"&&D!=null&&t(Fn({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(gc(e))},onSaveReconciliationReview:e=>{t(Ic(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,s=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:s,referrer:l.currentSelectedView}}),t(oa(e))},handleLogOutClick:()=>{const e=ee(r.state?.pathnameStackToGoBack,r.pathname);E("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:s,fixedAssetsAccount:u,accruedExpensesAccount:P}=a,y=Et(B.prepaidExpensesAccountList,s.selectedOptions),_=Et(B.fixedAssetsAccountList,u.selectedOptions),$=Et(B.accruedExpensesAccountList,P.selectedOptions),H={selectedPrepaidExpensesAccountIds:y.map((W=>W.accountId)),selectedFixedAssetsAccountIds:_.map((W=>W.accountId)),selectedAccruedExpensesAccountIds:$.map((W=>W.accountId))};t(fc({data:H}))},onSaveJeAccountSettingsClick:()=>{t(Sc())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:s,accumulatedDepreciationCategory:u,scheduleClass:P,scheduleExpenseCategory:y,vendor:_}=a,{allAccountList:$,allClassList:H,allDepreciationAccountList:W}=l.jeSchedules,ae=R.entityAutoCompleteView.vendor.length>0?R.entityAutoCompleteView.vendor.find((K=>K.id===_?.selectedOption)):void 0,ce={id:ae?.zeniId??_?.selectedOption??"",name:ae?.name??_?.defaultOptions.find((K=>K.value===_?.selectedOption))?.label??"",logo:ae?.logo},T=y?.selectedOption!=null?$.find((K=>K.qboId===y.selectedOption)):void 0,V=P?.selectedOption!=null?H.find((K=>K.classId===P.selectedOption)):void 0,X=u?.selectedOption!=null?W.find((K=>K.qboId===u.selectedOption)):void 0;t(hc({scheduledJournalEntryID:e,localData:{jeScheduleID:s,scheduledJournalEntryID:e,updatedCategoryId:T?.accountId,updatedClassId:V?.classId,updatedAccumulatedDepreciationCategoryID:X?.accountId,updatedVendor:{id:ce.id,name:ce.name}}}))},onRevertJeSchedule(e,a,s,u,P){t(pc(e,a,s,u,P))},ignoreRecommendedJeSchedule(e,a,s,u){t(mc(e,a,s,u))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(An({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(st("common"))},onCancelAutoComplete:()=>{t(st("common"))}},onPostJESchedule(e,a){t(uc({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(dc())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=Gi(e,n.tenantEmailDomain),s=ee(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(rc({query:e,scheduleType:f==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const s=_t(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(Dn({scheduleType:s,localData:a}))},onOpenMatchNewModal(){t(lc())},onIgnoreMatchSuggestion(e,a,s){t(ic(e,a,s))},onCloseMatchNewModal(){t(cc())},onClearMatchNewModal(){t(sc())},onSearchMatchTransactions(e,a){t(oc(e,a))},onSearchMatchAccruals(e,a){t(ac(e,a))},onMatchAndReverse(e){t(nc(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds,!0))},onUpdateActualMatchingUIState(e){t(tc(e))},onUndoReversal(e,a){t(ec(e,a))},onSaveSchedule(e,a){const s=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:u,allDepreciationAccountList:P}=l.jeSchedules,y=a.selectedAccount!=null?u.find(($=>$.qboId===a.selectedAccount)):void 0,_=a.selectedAccumulatedDepreciationCategory!=null?P.find(($=>$.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(Dn({scheduleType:s,localData:{...a,selectedAccount:y?.accountId,selectedAccumulatedDepreciationCategory:_?.accountId}})),t(Qs({scheduleType:s}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Xs()),t(Hs()),t(Ws({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(Ks({scheduleType:a})),t(Zs(a,void 0))},onCreateOneTimeAccrual(e){t(Js(e))},handleJeScheduleClick:(e,a,s)=>{if((function(P,y){return y!=="accrued_expenses"})(0,s)&&t(ta({selectedJEScheduleKey:a})),w!=null&&Ia(s))return void w(e,s,a);const u=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../../vendors/schedules/${s}/details/${e}`,{state:{pathnameStackToGoBack:u,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,s,u)=>{t(a!=="revert"?Ys(e,s,u):qs(e,s,u))},onOneTimeAccrualClick:e=>{if(w!=null)return void w(e,"one_time_accrual");const a=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},onOpenBill(e){if(n.tenantEmailDomain==null)return;const a=_i(e,n.tenantEmailDomain,n.location);n.navigate(a.pathname,{state:a.state})},improveMonthEndInsightsUsingZeniGPTClick:e=>{b!=null&&t(Ns(e,b.companyId,b.tenantId))},onClickCustomerRequest:C,setActivityLogTransactionId:m,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Gs())},onOpenFileAttachmentSnackBar:()=>{t(wt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Ls(e))},onUpdateFileAttachment:e=>{t(zs({files:e}))},previewMonthEndReport:(e,a,s,u,P)=>{b!=null&&t(wn(e,b.companyId,a,!0,s,u,{agentInsightEdits:P,tenantId:b.tenantId}))},saveMonthEndReport:(e,a,s,u,P)=>{b!=null&&t(wn(e,b.companyId,a,!1,s,u,{agentInsightEdits:P,tenantId:b.tenantId}))},onEditMonthEndInsightsClick:O,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:s,auditSummary:u}=l;b!=null&&u?.auditScorePercentage!=null&&(t($s(b.companyId,e,b.tenantId)),te.trackInsightsEmailPage(s.month,s.year,!1,"draft",u.auditScorePercentage,ia().format(ga.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const s=l.transactionView.uiState.searchString??"",u=l.transactionView.transactions,P=u.findIndex(($=>$.id===e)),y=s.length>0?{resultPosition:P>=0?P+1:void 0,resultsCount:u.length,searchTerm:s}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,y);const _=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:_,message:"expenseAutomation",origin:"transaction_categorization",searchContext:y}})},setLocalDataForCategoryAndClass:(e,a,s,u,P,y,_,$,H,W,ae,ce)=>{t(js(e,a,s,u,v,P,y,_,$,H,W,ae,ce))},onCancelAutoComplete:()=>{t(st("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(xn({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),I!=null&&x!=null&&(t(ve(e,{start:x,end:I},!1,!1)),t(Vs(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),I!=null&&x!=null&&(t(Us(e)),t(ve("autoCategorized",{start:x,end:I},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),I!=null&&x!=null&&(t(Os(e)),t(ve(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:x,end:I},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(Pt({selectedTab:e,uiState:a})),I!=null&&x!=null&&t(ve(e,{start:x,end:I},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(Pt({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,s,u,P,y)=>{I!=null&&x!=null&&t(ve(e,{start:x,end:I},!0,s,a,u,P,y))},resetTransactionCategorizationLocalData:(e,a,s,u,P,y,_)=>{t(Ms(e,a,s,u,_??null,P,y,!1)),Ri(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,s,u,P)=>{t(Rn({selectedTab:e,transactionId:a,lineId:s,selectedTransaction:u,uncategorizedAccounts:v,updatedVendor:P,isAccountingClassesEnabled:p}))},onSaveUpdateTransactionCategorization:(e,a,s)=>{const u=r.state?.referrer;e==="autoCategorized"?te.trackTransactionsAutoCategorisedPage(d.month,d.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,u??null):te.trackTransactionsReviewPage(d.month,d.year,l.transactionView.totalCountByTab.review,a.length,!1,u??null),t(Bs(e,a,s)),xi(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(_s({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,s,u,P,y)=>{const{transactionId:_,transaction:$,lineIds:H}=a;y!=null&&t(Ds({transactionId:_,customerUpdates:y})),t(Fs({selectedTab:u,transactionId:_.id,lineId:H[0],selectedTransaction:$,uncategorizedAccounts:v,updatedCustomer:y,selectedEntity:P,isAccountingClassesEnabled:p})),P!=null&&t(Ft({entity:P,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:u,isFetchCOT:S}))},onFetchRecommendationsForEntityCategorization:(e,a,s,u,P,y)=>{const{transactionId:_,transaction:$,lineIds:H}=a;y!=null&&(t(xs({transactionId:_,vendorUpdates:{name:y.name,id:y.id?y.id:void 0}})),t(Rs({vendorId:y.id?y.id:void 0,localData:{vendorName:y.name,vendorId:y.id?y.id:void 0}}))),y?.id?(t(Rn({selectedTab:u,transactionId:_.id,lineId:H[0],selectedTransaction:$,uncategorizedAccounts:v,updatedVendor:y,selectedEntity:P,isAccountingClassesEnabled:p})),P!=null&&t(Ft({entity:P,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:u,isFetchCOT:S}))):t(ws({selectedTab:u,transactionId:_.id,lineId:H[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(lt(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(lt(d,!0,!1,null,!1,!1))},markAsReview:(e,a,s,u)=>{te.trackFluxAnalysisReviewed(s.month,s.year,u??!1,e),t(As(a,e,s,u??!1))},onUpdateFluxAnalysisUIState:e=>{t(Es(e))},updateOperatingExpensesIdsForReview:e=>{t(vs({operatingExpenseIds:e,selectedPeriod:d}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=Li(e.id,e.qboId,n.tenantEmailDomain),s=ee(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(Ps({sectionId:e,selectedPeriod:d}))},onFetchReimbursementView:(e,a,s)=>{t(lt(e,!0,!1,a,!0,s))},onReviewClicked:e=>{t(me(d,e))},onViewReportClicked:e=>{const a=n.tenantEmailDomain,s=g,u=`${d.month}-${d.year}`;if(a==null||s==null)return;const P=ee(r.state?.pathnameStackToGoBack,r.pathname),y=pa({tenantEmailDomain:a,selectedTab:s,accountId:e,period:u});y!=null&&E(y,{state:{pathnameStackToGoBack:P}})},setOpenDrawerClicked:e=>{t(dt({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Zn("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const s=b?.companyId;s!=null&&(t(Qn(e,s,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(ea({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(dt({selectedDrawerAccountId:e})),t(ct({accountId:e,selectedPeriod:d,localData:{accountSource:"bank_statement"}})),t(it({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(me(d,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(ys({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(Ts({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(bs({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{n.closeSidePanel?.(),t(ks({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,s)=>{const u=e.vendor?.id;s&&u!=null&&t(gs(u)),t(Cs({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,Dt("bill"));const a=ee(r.state?.pathnameStackToGoBack,r.pathname);E(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{E(-1)},onReconListPageScroll:e=>{t(xn({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(An({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(st("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Is({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(Wn({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Kn({accountId:e}))}}}),((t,n,h)=>{const{isMissingReceiptsBulkUploadEnabled:p,...S}=h;return(function(i,r,R){return{...i,...r,...R,onUploadTransactionReceipt:(l,b,f,v,E)=>{r.onUploadTransactionReceipt(l,b,f,v,E,i.authParams)}}})(t,n,S)}))(gi(Ci)),At="newScheduleMode",xt="newScheduleType",ml=ol(Mi((function(t){const n=t.displayName??t.name??"Component",h=la.memo(t),p=S=>{const i=Ie(),r=(function(){const w=Ie(),m=M((d=>Ee(d).reconciliation.selectedDrawerAccountId));return{isOpen:m!=null,selectedAccountId:m,openPanel:o.useCallback((d=>{w(dt({selectedDrawerAccountId:d}))}),[w]),closePanel:o.useCallback((()=>{w(dt({selectedDrawerAccountId:void 0}))}),[w])}})(),R=M((w=>Ee(w).reconciliation)),l=M((w=>xe(w))),b=o.useCallback(((w,m)=>{i(Zn("expense_automation_reconcile",w,m))}),[i]),f=o.useCallback(((w,m)=>{const d=l?.companyId;d!=null&&(i(Qn(w,d,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",m)),i(ea({accountId:m,connectionInProgress:!0})))}),[i,l?.companyId]),v=o.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return k.jsx(Wi,{reconciliation:R,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:b,onEstablishConnectionClick:f})}),[r.isOpen,r.selectedAccountId,r.closePanel,R,b,f]),E=o.useMemo((()=>({reconPanelContent:v,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[v,r.isOpen,r.closePanel]),{useFeatureGate:C}=mt(),{isFeatureEnabled:O}=C(Q.isReconV3Enabled),F=o.useContext(Vn),J=o.useMemo((()=>r.isOpen?O===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:F),[r.isOpen,r.closePanel,r.selectedAccountId,F,O]);return k.jsx(Vn.Provider,{value:J,children:k.jsx(h,{...S,...E})})};return p.displayName=`withReconSidePanel(${n})`,p})(Hi((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:h,matchPanelContent:p,isMatchPanelOpen:S,matchPanelMatchId:i,openMatchPanel:r,openTransactionPanel:R,panelContent:l,reconPanelContent:b,reconSidePanelIsOpen:f,isSchedulePanelOpen:v,closeSchedulePanel:E,openSchedulePanel:C,schedulePanelActionBarContent:O,schedulePanelContent:F,schedulePendingDiscardConfirmation:J,sidePanelIsFullView:w,sidePanelIsOpen:m})=>{const{isAiCfoOpen:d,setIsAiCfoOpen:g}=oi(),D=si(),{isOpen:B}=ci(),z=Me(),x=ge(),I=Ie(),{isAiCfoAccessEnabled:e,onAskAiCfoClick:a}=Vt({mobileExploreReferrer:"Transaction categorization"}),s=o.useCallback((()=>{S===!0&&t?.(),m===!0&&w!==!0&&h?.()}),[t,h,S,w,m]),u=M(Yo);o.useEffect((()=>{u!=null&&(i===u&&s(),I(Jo()))}),[u,s,I,i]);const P=M(Xo);o.useEffect((()=>{P!=null&&(i===P&&s(),I(Ho()))}),[P,s,I,i]);const{areTenantIdsInSync:y}=ra(),_=il(),$=ii(),[H,W]=o.useState(!1),[ae,ce]=Xn(),T=o.useCallback((c=>{ce((U=>{const Y=new URLSearchParams(U);return c==null?(Y.delete(At),Y.delete(xt),Y):(Y.set(At,c.scheduleDetailsMode),Y.set(xt,c.scheduleType),Y)}),{replace:!0})}),[ce]),[V,X]=o.useState(void 0),K=o.useCallback(((c,U,Y)=>{const q=_t(c);X(q),T({scheduleDetailsMode:U,scheduleType:c}),I(Pn({scheduleType:q==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:Y}))}),[I,T]),Ce=o.useMemo((()=>{const c=ae.get(At),U=ae.get(xt);return c!=null&&U!=null?{scheduleDetailsMode:c,scheduleType:U}:void 0}),[ae]),Ue=o.useCallback((c=>{T(c),c!=null&&I(Pn({scheduleType:_t(c.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[I,T]),pe=M((c=>yn(c))),j=M((c=>xe(c))),[ke,de]=o.useState(!1),[pt,be]=o.useState(!1),[ht,He]=o.useState([]),[ie,he]=o.useState(null),oe=o.useCallback((()=>{he(null)}),[]),A=ie?.contentType==="activity"?ie.detail.transactionId:void 0,Z=o.useCallback((c=>{c!=null?(d&&g(!1),D(),s(),he({contentType:"activity",detail:{transactionId:c}})):he((U=>U?.contentType==="activity"?null:U))}),[s,d,D,g]),se=o.useCallback((c=>{d&&g(!1),D(),s(),he({contentType:"transfer",detail:c})}),[s,d,D,g]),Ve=o.useCallback((()=>{D(),oe(),s(),a()}),[s,oe,a,D]),Re=o.useRef(d);o.useEffect((()=>{d===!0&&Re.current===!1&&(D(),oe(),s()),Re.current=d}),[s,oe,d,D]);const $t=o.useRef(B);o.useEffect((()=>{B===!0&&$t.current===!1&&(d&&g(!1),oe(),S===!0&&t?.(),m===!0&&w!==!0&&h?.()),$t.current=B}),[oe,t,h,B,d,S,g,w,m]);const We=m===!0&&w!==!0||S===!0,zt=o.useRef(We);o.useEffect((()=>{We&&!zt.current&&(d&&g(!1),D(),oe()),zt.current=We}),[oe,d,We,D,g]);const[Lt,Ca]=o.useState(!1),Gt=o.useRef(!1),{selectedTab:ka}=Ae(),{tenantEmailDomain:je}=Ae(),[St,Nt]=o.useState(x.state?.message==="comingFromTransactionDetail"),qt=x.state?.message==="comingFromOverview",Yt=li(),ft=Xe.getSignedInUser(),{useFeatureGate:ue}=mt(),{isFeatureEnabled:Jt}=ue(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:$e}=ue(Q.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:It}=ue(Q.isTransactionActivityEnabled),{isFeatureEnabled:Te}=ue(Q.isAccrualEnabled),{isFeatureEnabled:Xt}=ue(Q.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:ba}=ue(Q.isCreateTransactionEnabled),Ta=M((c=>Wo(c))),{isFeatureEnabled:ya}=ue(Q.isProjectsTransactionsEnabled),{isFeatureEnabled:Pa}=ue(Q.isReconV3Enabled),{isFeatureEnabled:va}=ue(Q.isReconReportEnabled),Ea=o.useCallback((c=>{const U=Dt(c.transactionType??(c.view==="reconciliation"?"bill":"expense")),Y=ee(x.state?.pathnameStackToGoBack,x.pathname),q=new URLSearchParams({view:"full"});c.threadId!=null&&q.set("thread_id",c.threadId),c.entityType!=null&&q.set("entity_type",c.entityType),z(`/${je}/transaction/${encodeURIComponent(U)}/${c.transactionId??c.entityId}?${q.toString()}`,{state:{pathnameStackToGoBack:Y,message:"expenseAutomation"}})}),[z,je,x.state,x.pathname]),Aa=M((c=>Ko(c,"common"))),N=M((c=>Ee(c))),{categoryOptions:xa,paymentAccountNames:Ra}=M((c=>Zo(c.accountState))),wa=M((c=>Qo(c.classState))),{monthEndCloseChecksView:ne,currentSelectedView:L,selectedPeriod:G,selectedTransactionCategorizationTab:gt,currentSelectedViewBackgroundRefreshFetchState:Da,currentSelectedViewFetchState:Se,jeSchedules:Ct,reconciliation:Ht}=N;Pi(L==="transaction_categorization");const Fa=N.transactionView.saveStatus.fetchState,Ke=N.transactionView.transactions,Wt=o.useRef(Ke);Wt.current=Ke;const Kt=M((c=>c.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Zt=M((c=>c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Qt=o.useRef(Kt);Qt.current=Kt;const en=o.useRef(Zt);en.current=Zt;const Ze=M((c=>{const U=c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return U!=null?c.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[U]?.filters:void 0})),tn=o.useRef("");o.useEffect((()=>{if(L!=="transaction_categorization")return;const c=N.transactionView.uiState.searchString??"";if(Se.fetchState!=="Completed"||c.length===0||c===tn.current)return;tn.current=c;const U=Ze!=null?ri(Ze):0,Y=Ze?.categories.filter((q=>q.values.length>0&&String(q.values[0]??"").trim()!=="")).map((q=>`${q.field}:${q.values.join(",")}`))??[];te.trackAiCloseTransactionSearch({filtersApplied:Y,hasResults:Ke.length>0,isFiltered:U>0,resultsCount:Ke.length,searchTerm:c,searchType:"free_text"})}),[L,Se.fetchState,N.transactionView.uiState.searchString,N.transactionView.transactions,Ze]);const fe=vi(Fa,(()=>{const c=[],U=en.current,Y=Qt.current,q=Y!=null&&U!=null?Y[U]:void 0;if(q?.transactionReviewLocalDataById!=null)for(const De of Object.values(q.transactionReviewLocalDataById)){const le=De?.transactionReviewLocalData?.lineItemById;if(le!=null)for(const kt of Object.values(le)){const qe=kt?.account;qe?.accountId!=null&&c.push(qe.accountId)}}const we=Wt.current;for(const De of we)for(const le of De.lines??[])"account"in le&&le.account?.accountId!=null&&c.push(le.account.accountId);return c}));o.useEffect((()=>{L==="transaction_categorization"&&m!==!0||Z(void 0)}),[L,Z,m]),o.useEffect((()=>{f===!0&&n?.()}),[L,Ht.selectedAccountId]);const _a=N.transactionView.selectedTransactionCategorizationCompletedSubTab,Ba=N.transactionView.selectedTransactionGroup,Qe=`${gt}|${_a}|${Ba}`,et=o.useRef(null),nn=o.useRef(null);o.useEffect((()=>{et.current!==null?et.current!==Qe&&(et.current=Qe,L==="transaction_categorization"&&oe()):et.current=Qe}),[oe,L,Qe]);const Ma=M((c=>A==null?void 0:es(c.transactionState,A))),ye=Ma?.qboId,an=M((c=>ye==null?void 0:ts(c,ye)));o.useEffect((()=>{ye!=null&&I(ns(ye))}),[I,ye]);const{createTransferEntryStatus:on,creditCardTransferAccountsList:sn,transferAccounts:cn}=N.transactionView,ln=o.useCallback((c=>Ei(I,c)),[I]),rn=o.useMemo((()=>L!=="transaction_categorization"||ie==null?null:ie.contentType==="activity"?It===!0?k.jsx(di,{activityLogView:an,qboId:ye,onClose:()=>he(null),selectedTransactionId:ie.detail.transactionId,isQuickViewCardStyle:!0},String(ie.detail.transactionId)):null:ie.contentType==="transfer"?k.jsx(ui,{createTransferEntryStatus:on,creditCardTransferAccountsList:sn,transaction:ie.detail,transferAccounts:cn,onClose:()=>he(null),onCreateTransfer:ln,isQuickViewCardStyle:!0},String(ie.detail.transactionId)):null),[L,ie,It,an,ye,on,sn,cn,ln]),Oa=rn!=null,{selectedAccountId:ze}=Ht,dn=rt(Ct.accountSettingsView.saveState.fetchState),Ua=M((c=>as(c.accountState,c.accountListState,"accountList"))),Va=M((c=>os(c))),Le=ha(ka)??L,ja=M((c=>c.entityAutoCompleteState.autoCompleteText.common));if(da({isDataReady:Se.fetchState==="Completed"}),ft==null)throw Error("Can't access expense automation screen without signing in...");const un=na(G),Ge=ut(un.start),Ne=ut(un.end);if(Ge==null||Ne==null)throw Error(`Invalid start - ${Ge} and end - ${Ne} period from given ${G}`);const $a=o.useCallback((()=>{de(!1)}),[]),za=o.useCallback((()=>{be(!0)}),[]),La=o.useCallback((c=>{He(c),be(!1)}),[]),Ga=o.useCallback((()=>{He([])}),[]),tt=N.missingReceipts.bulkUpload.phase,mn=N.missingReceipts.bulkUpload.currentBatchId;o.useEffect((()=>{$e===!0&&L==="missing_receipts"&&tt==="matching"&&mn!=null&&I(aa({cacheOverride:!0}))}),[$e,L,tt,mn,I]);const pn=ft?.userId,Na=G.month,qa=G.year,hn=j?.tenantId;o.useEffect((()=>{L==="missing_receipts"&&$e!==!1&&tt==="idle"&&pn!=null&&hn!=null&&I(ss())}),[L,$e,tt,pn,hn,Na,qa,I]),o.useEffect((()=>{pe.newVendorState?.vendorDetailLocalData?.vendorName!=null?W(!0):W(!1)}),[pe.newVendorState?.vendorDetailLocalData?.vendorName]),o.useEffect((()=>{Le!=null&&L!==Le&&I(oa(Le))}),[Le]),o.useEffect((()=>{Lt===!1&&Se.fetchState==="Completed"&&y&&(Ca(!0),I(vn(!1,!1,Te===!0)))}),[Lt,Se,y,Te]),o.useEffect((()=>{const c={month:G.month,year:G.year},U=nn.current;nn.current=c,U===null||U.month===c.month&&U.year===c.year||!qt&&y&&(I(vn(!1,!1,Te===!0)),I(me(G,ze,!1,!1)))}),[G.month,G.year,y,Te]);const nt=o.useCallback(((c=!1,U=!1)=>{const Y={start:Ge,end:Ne};switch(L){case"transaction_categorization":I(ve(gt,Y,c,!St,void 0,void 0,U)),Nt(!1);break;case"flux_analysis":I(lt(G,c,U,null));break;case"month_end_insights":if(U===!1){const q=new Date(G.year,G.month,0),we=is(q.toDateString()).format(ga.analytics.YYYYDashMMDashDDFormat);I(ls(!0,j.companyId,j.tenantId,we)),I(rs(j.companyId,j.tenantId))}break;case"je_schedules":I(cs(Y,U,Te===!0));break;case"missing_receipts":I(sa(Y,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,U));break;default:I(me(G,ze,c,U))}}),[L,Ge,Ne,j.companyId,j.tenantId,gt,G,ze,St,Nt,Te]),Ya=o.useCallback((()=>{nt(!0,!0)}),[nt]);o.useEffect((()=>{L===Le&&Se.fetchState==="Not-Started"&&y&&nt(!0)}),[Se,Ge,Ne,j.companyId,j.tenantId,y]),o.useEffect((()=>{qt||St||Gt.current||Da.fetchState==="In-Progress"||Se.fetchState!=="Completed"||(Gt.current=!0,nt(!0,!0))}),[]),o.useEffect((()=>{ne.fetchState!=="In-Progress"&&ne.fetchState!=="Completed"&&ne.fetchState!=="Error"&&j?.tenantId!=null&&I(Be({tenantId:j.tenantId,period:G,refreshViewInBackground:!1}))}),[ne.fetchState,j?.tenantId]),o.useEffect((()=>{ne.fetchState!=="Completed"||!y||(ne.monthEndCloseChecks?.monthEndCloseCheckList.some((c=>c.id==="reconciliation"))??!1)&&N.reconciliation.fetchStatus.fetchState==="Not-Started"&&I(me(G,void 0,!1,!1))}),[ne.fetchState,y,G.month,G.year,N.reconciliation.fetchStatus.fetchState,I]),o.useEffect((()=>{N.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?de(!0):de(!1)}),[N.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),o.useEffect((()=>{N.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&y&&(I(Be({tenantId:j.tenantId,period:G,refreshViewInBackground:!0})),I(ds({companyId:j.companyId})),z("../"))}),[N.monthEndInsights?.sendMonthEndReportStatus?.fetchState,j.tenantId,G,j.companyId,y]),o.useEffect((()=>{const c=setInterval((()=>{ne.fetchState!=="In-Progress"&&ne.fetchState==="Completed"&&I(Be({tenantId:j.tenantId,period:G,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(c)}),[ne.fetchState,j.tenantId,G,I]),o.useEffect((()=>{const c=setInterval((()=>{L==="reconciliation"&&ze==null&&N.reconciliation.fetchStatus.fetchState==="Completed"&&N.reconciliation.refreshStatus.fetchState!=="In-Progress"&&I(me(G,void 0,!0,!0))}),3e5);return()=>clearInterval(c)}),[L,I,N.reconciliation.fetchStatus.fetchState,N.reconciliation.refreshStatus.fetchState,me,ze,G]);const Ja=jn(),{isFeatureEnabled:Xa}=ue(Q.isRecommendationFeedbackEnabled),Sn=mi(),{onRecommendationSelection:fn,popup:Ha}=Ai({isEnabled:Xa}),Wa=o.useMemo((()=>({...Sn,onRecommendationSelection:fn})),[Sn,fn]);o.useEffect((()=>{const c=(ne.monthEndCloseChecks?.monthEndCloseCheckList.find((U=>U.id==="month_end_insights"))?.isDisabled??!1)&&!Jt;L!=="month_end_insights"||!c&&ne.monthEndCloseChecks?.reportEmailSentDate==null||z("../")}),[L,ne.monthEndCloseChecks]);const Ka=f===!0?b:l,Za=f===!0||m===!0,Qa=f===!0?n:h,eo=f!==!0&&w;o.useEffect((()=>{dn==="In-Progress"&&Ct.accountSettingsView.saveState.fetchState==="Completed"&&I(En())}),[dn,Ct.accountSettingsView.saveState.fetchState,En]);const{transactionId:In,onSaveVendor:to,onSaveSuccess:no,onCancel:ao,vendorViewDetails:oo}=(({expenseAutomationViewSelector:c,closeDrawerHandler:U,currentSelectedView:Y})=>{const q=Ie();let we,De,le;const kt=jn(),qe=c.transactionView;let gn=()=>{};const{transactions:so,selectedTransactionId:Fe,selectedTransactionLineId:at,transactionLocalData:co}=qe;if(Y==="transaction_categorization"){const bt=co.find((Pe=>Pe.transactionId===Fe)),re=so.find((Pe=>Pe.id===Fe)),Cn=at!=null?bt?.transactionReviewLocalData?.lineItemById[at]:void 0,kn=Cn?.account;De=Cn?.class?.classId,we=["Uncategorized Income","Uncategorized Expense"].includes(kn?.accountName??"")?void 0:kn?.accountId;const lo=$i(Fe,re?.typeOfTransaction);re!=null&&lo&&(le={id:Fe,type:Dt(re.typeOfTransaction)}),gn=()=>{if(Fe!=null&&at!=null&&re!=null){const Pe=qe.transactionLocalData.find((ot=>ot.transactionId===Fe))?.transactionReviewLocalData;if(Pe!=null&&re.lines!=null&&re.lines.length>0){const ot=Pe.lineItemById[at];let Tt=Pe.selectedEntity;if(qo(re)||(Tt=ot.selectedEntityLine),Tt!=null){const ro=Tt,uo={transactionId:{id:re.id,type:re.type},transaction:re,lineIds:re.lines.map((mo=>mo.id))??[]};q(Ft({entity:ro,amount:ot.amount.amount,transactionDetails:uo,flowType:"categorization",selectedTab:c.selectedTransactionCategorizationTab,isFetchCOT:kt}))}}}}}const io=M((bt=>yn(bt,void 0,we,De)));return{transactionId:le,onSaveVendor:()=>{q(No(le,void 0,!1,!0))},onSaveSuccess:gn,onCancel:()=>{le!=null&&q(zo({transactionId:le})),q(Lo()),q(Go()),U()},vendorViewDetails:io}})({expenseAutomationViewSelector:N,closeDrawerHandler:()=>{W(!1)},currentSelectedView:L});return Yt?.loggedInUserRoleMap==null?ne.fetchState==="Error"?k.jsx(pi,{onGoHome:()=>z("../",{replace:!0}),onReload:()=>window.location.reload()}):k.jsx(ua,{fetchState:"In-Progress"}):k.jsxs(k.Fragment,{children:[k.jsx(Ni,{isOpen:pt,drawerLeftMargin:new hi(0,0,300,650),onClose:()=>{be(!1)},children:k.jsx(pl,{onClick:c=>c.stopPropagation(),children:k.jsx(sl,{companyId:j.companyId,closeCustomerRequestDrawer:()=>be(!1),addCustomerRequest:La,resetCustomerRequest:Ga})})}),In!=null&&H&&k.jsx(wi,{isOpen:H,transactionId:In,onSaveVendor:to,onSaveSuccess:no,onCancel:ao,vendorViewDetails:oo}),k.jsx(Si,{toolkit:Wa,children:k.jsx(ul,{events:[],eventCallback:(c,U,Y)=>{},navigate:z,location:x,themeState:$,categoryOptions:xa,classesForFilters:wa,accountsForFilters:Ra,vendorSearchAutoCompleteData:{autoCompleteText:ja,entityAutoCompleteView:Aa},expenseAutomationViewSelector:N,isMissingReceiptsBulkUploadEnabled:$e,monthEndInsightsPreviewMode:ke,monthEndInsightsCustomerRequestData:ht,isRealtimeInsightsFeatureEnabled:Jt,isCreateTransferEntryFromExpenseEnabled:Xt,isCreateTransactionEnabled:ba===!0&&Yt?.connectionName!=="netsuite",isCreatingTransaction:Ta.fetchState==="In-Progress",onCreateTransactionSelect:c=>{je!=null&&(te.trackCreateTransactionRequested({transactionType:c}),z(zi(je,c),{state:{pathnameStackToGoBack:ee(fi(x.state),`${x.pathname}${x.search}`)}}))},isAccountingClassesEnabled:Va,isProjectsTransactionsEnabled:ya,isCOTEnabled:Ja,currentTenant:j,companyId:j.companyId,signedInUser:ft,isTransactionActivityEnabled:It,isRightPanelOpen:Oa,rightSidePanel:rn,onOpenTransferRightPanel:Xt===!0?se:void 0,uncategorizedAccounts:Ua,newScheduleActiveType:V,isAccrualEnabled:Te,newScheduleSelection:Ce,onNewScheduleSelectionChange:Ue,onScheduleTypeChange:K,onNewScheduleSaved:Ya,onClickCustomerRequest:za,handleEditClick:$a,tenantEmailDomain:je,trackExpenseAutomationTabAnalytics:_,setActivityLogTransactionId:Z,closeMatchSidePanel:t,closeSidePanel:Qa,openTransactionPanel:R,closeSchedulePanel:E,openSchedulePanel:C,openMatchPanel:r,sidePanelIsOpen:Za,sidePanelIsFullView:eo,panelContent:Ka,isAiCfoAccessEnabled:e,onAskAiCfoClick:Ve,isReconReportEnabled:va===!0,isReconV3Enabled:Pa,onExpenseAutomationCommentingThreadClick:Ea,sidePanelListPercent:f===!0?66:void 0,isMatchPanelOpen:S,isSchedulePanelOpen:v,matchPanelContent:p,schedulePanelActionBarContent:O,schedulePanelContent:F,schedulePendingDiscardConfirmation:J})}),Ha,fe.showPopup&&fe.popupType!=null&&k.jsx(Ii,{popupType:fe.popupType,currencySymbol:fe.currencySymbol,accountId:fe.popupAccountId??"",accountName:fe.popupAccountName??"",onSubmit:fe.handleSubmit,onDismiss:fe.handleDismiss})]})}))))),pl=Oe(Hc)`
|
|
35
|
-
display: flex;
|
|
36
|
-
min-height: 100%;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
`;async function hl({authParams:t,endpoint:n,report:h}){const p=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","zeni-user-id":t.userId,"zeni-tenant-id":t.tenantId,"zeni-session-id":t.sessionId},body:JSON.stringify({report:h,locale_id:"en-US",timezone:ca()})});if(!p.ok)throw new Error(`Reconciliation report download failed: ${p.statusText}`);const S=(function(i,r){return i==null?r:/filename="?([^"]+)"?/i.exec(i)?.[1]??r})(p.headers.get("Content-Disposition"),"Reconciliation_Report.pdf");(function(i,r){const R=new Blob([i]),l=URL.createObjectURL(R),b=document.createElement("a");b.href=l,b.download=r,document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(l)})(await p.arrayBuffer(),S)}const Sl=new Set(["reconciled"]),{dateFormat:{analytics:{MMSlashDDSlashYYYYFormat:qn}}}=ma.getLocalizedStrings();function _e(t){return`${t.month}-${t.year}`}function Yn(t){if(!Ot(t))return;const[n,h]=t.split("-"),p=Number(n),S=Number(h);return Number.isNaN(p)||Number.isNaN(S)?void 0:{month:Yc(p),year:S}}function Jn(t){const n=ia().set("year",t.year).set("month",t.month-1).startOf("month"),h=n.endOf("month");return`${n.format(qn)} – ${h.format(qn)}`}function fl(t){const n=t.split("_");if(n.length!==2||n[0]===""||n[1]==="")return;const h=Number(n[0]),p=Number(n[1]);if(Number.isInteger(h)!==!0||Number.isInteger(p)!==!0)return;const S=Xc(h);return S!=null?{month:S,year:p}:void 0}function Il(){const{tenantEmailDomain:t,selectedTab:n}=Ae(),[h,p]=Xn(),S=Me(),i=ge(),r=Ie(),R=Vt({mobileExploreReferrer:"reconciliation_report"}),[l,b]=o.useState("Not-Started"),f=h.get("accountId")??void 0,v=h.get("period")??void 0,E=M((T=>xe(T))),C=M((T=>Ee(T))),O=M((T=>Hn(T,E.tenantId))),F=M((T=>Mn(T))),J=C.reconciliation.fetchStatus.fetchState,w=C.reconciliation.accountReconciliationsByAccountID,m=C.reconciliation.monthYearPeriod,d=o.useMemo((()=>v!=null?Yn(v):void 0),[v]),g=o.useMemo((()=>{const T=(O.monthEndCloseChecks?.historicMonthYear??[]).map((X=>({periodId:_e(X),label:Jn(X)})));if(d==null)return T;const V=_e(d);return T.some((X=>X.periodId===V))?T:[{periodId:V,label:Jn(d)},...T]}),[O.monthEndCloseChecks?.historicMonthYear,d]),D=d!=null&&m.month===d.month&&m.year===d.year,B=M((T=>{if(f==null)return;const V=Ee(T).reconciliation.accountReconciliationsByAccountID[f];return V!=null?Bt(V):(function(X,K,Ce){if(Ce!=null)for(const Ue of Object.keys(Ce)){const pe=fl(Ue);if(pe==null)continue;const j=Ce[vt(pe)];if(j==null||j.reconciliationByAccountID[K]==null&&j.accountIDs.includes(K)===!1)continue;const ke=Jc(X,K,pe);if(ke==null)continue;const de=ke.account.accountName;if(de!=null&&de!=="")return yi(de,ke.account.last4Digits)}})(T,f,Mn(T))})),z=o.useMemo((()=>{const T=Object.values(w).filter((V=>{return X=V.accountReconEntity.reconciliationStatus?.code,X!=null&&Sl.has(X);var X})).map((V=>({accountId:V.accountReconEntity.account.accountId,label:Bt(V)})));return f==null||T.some((V=>V.accountId===f))?T:[{accountId:f,label:B??f},...T]}),[f,w,B]),x=o.useMemo((()=>{if(f!=null&&D===!0)return w[f]?.accountReconEntity.reconciliationId}),[f,w,D]),I=d!=null?vt(d):void 0,e=I!=null&&F[I]!=null&&F[I].accountIDs.length>0,a=d!=null&&(D!==!0||J==="In-Progress"||e!==!0&&J!=="Completed"&&J!=="Error"),s=a!==!0&&D===!0&&x==null&&(f!=null||z.length===0),u=M((T=>x!=null?qc(T,x):void 0)),P=o.useCallback((T=>{const V=new URLSearchParams;T.accountId!=null&&T.accountId!==""&&V.set("accountId",T.accountId),Ot(T.period)&&V.set("period",T.period),p(V,{replace:!0})}),[p]);o.useEffect((()=>{const T=d??m;E.tenantId!=null&&T!=null&&O.fetchState!=="In-Progress"&&O.fetchState!=="Completed"&&O.fetchState!=="Error"&&r(Be({tenantId:E.tenantId,period:T,refreshViewInBackground:!1}))}),[E.tenantId,r,O.fetchState,d,m]),o.useEffect((()=>{d!=null&&D!==!0&&r(Rt(E.tenantId,d))}),[E.tenantId,r,d,D]),o.useEffect((()=>{if(d==null||D!==!0||J==="In-Progress")return;const T=vt(d),V=F[T];!(V!=null&&V.accountIDs.length>0)&&r(me(d,void 0,!0,!1))}),[r,J,F,d,D]),o.useEffect((()=>{d!=null&&D===!0&&z.length!==0&&f==null&&P({accountId:z[0].accountId,period:_e(d)})}),[f,z,d,P,D]),o.useEffect((()=>{x!=null&&r(On(x))}),[r,x]);const y=o.useCallback((()=>{const T=bi(i.state?.pathnameStackToGoBack),V=v??(m!=null?_e(m):void 0),X=jt({tenantEmailDomain:t,selectedTab:n,selectedPeriod:V})??`/${t??""}/month_end_close_checks/review`;S(T.poppedPathname??X,{state:{pathnameStackToGoBack:T.newStack}})}),[i.state,S,v,m,n,t]),_=o.useCallback((()=>{x!=null&&r(On(x,!0))}),[r,x]),$=o.useCallback((()=>{if(u?.report==null||l==="In-Progress")return;const T=Xe.getSignedInUser();b("In-Progress"),hl({endpoint:`${Mt}/reconciliation_report`,report:u.report,authParams:{userId:T?.userId??"",sessionId:T?.zeniSessionId??"",tenantId:E.tenantId}}).then((()=>{b("Completed")})).catch((()=>{b("Error")}))}),[E.tenantId,l,u?.report]),H=o.useCallback((T=>{d!=null&&P({accountId:T,period:_e(d)})}),[d,P]),W=o.useCallback((T=>{const V=Yn(T);V!=null&&(r(Rt(E.tenantId,V)),r(me(V,void 0,!0,!1)),P({accountId:f,period:T}))}),[f,E.tenantId,r,P]);if(v==null||!Ot(v)||d==null)return k.jsx(Ut,{});const ae=f??z[0]?.accountId??u?.report?.account.accountId??"",ce=a?"In-Progress":s===!0?"Completed":u?.fetchState??"Not-Started";return k.jsx(Ti,{accountOptions:z,periodOptions:g,selectedAccountId:ae,selectedPeriodId:_e(d),fetchState:ce,isReportNotFound:s,report:u?.report,downloadState:l,onAccountChange:H,onPeriodChange:W,onBackClick:y,onDownloadClick:$,onRetry:_,onAskAiCfoClick:R.isAiCfoAccessEnabled===!0?R.onAskAiCfoClick:void 0})}function gl(){const t=ge(),{selectedTab:n,tenantEmailDomain:h}=Ae(),p=M((r=>xe(r))),S=M((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[p.tenantId]));if(ha(n)==null)return k.jsx(Ut,{});const i=jt({tenantEmailDomain:h,selectedTab:n,selectedPeriod:S!=null?`${S.month}-${S.year}`:void 0});return i==null?null:k.jsx(fo,{to:i,replace:!0,state:t.state})}function Xl(){return k.jsxs(So,{children:[k.jsx(Ye,{index:!0,element:k.jsx(qi,{})}),k.jsx(Ye,{path:"/:selectedTab/report",element:k.jsx(Il,{})}),k.jsx(Ye,{path:"/:selectedTab/:selectedPeriod/*",element:k.jsx(ml,{})}),k.jsx(Ye,{path:"/:selectedTab",element:k.jsx(gl,{})}),k.jsx(Ye,{path:"*",element:k.jsx(Ut,{})})]})}export{Xl as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BD_ga8W6.js";import{a as r}from"./sentry-DsaQHQmX.js";import{au as d,av as f,F as l,a2 as p}from"./index-DkHntkmh.js";import"./mui-BaMyMAqO.js";import m from"./NotFoundScreen-oYE2WlvI.js";import{h as c,g as u}from"./core-Bx5kG7oj.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="b94315a3-d823-41bf-a675-cab89baa3afb",a._sentryDebugIdIdentifier="sentry-dbid-b94315a3-d823-41bf-a675-cab89baa3afb")}catch{}})();const _=()=>{const a=c(),e=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=p(e.state?.pathnameStackToGoBack),b=n.poppedPathname??k();a(b,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=d(e.pathname);return o!=null?s.jsx(f,{menuItem:l(o),onDemoClick:t,onGoBack:i}):s.jsx(m,{})},k=(a=2)=>{let e="../";for(let t=0;t<a;t++)e=`${e}../`;return e};export{_ as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./sentry-DsaQHQmX.js";import{u as d,h as l,g as m}from"./core-Bx5kG7oj.js";import{i1 as p,Vy as b,Vz as g}from"./zeni-epic-state-CP_8Me3V.js";import{u as _,L as h,z as y}from"./index-DkHntkmh.js";import"./liveblocks-BD_ga8W6.js";import"./recharts-Bcj70bk1.js";import"./mui-BaMyMAqO.js";import"./analytics-CzizEiux.js";import"./plaid-BmyHDSR7.js";import"./dnd-BT4GhSLO.js";import"./stripe-cKAAJElX.js";import"./lottie-EXw6nebq.js";import"./lexical-BVHU6OCB.js";import"./pdf-DnsysvFr.js";import"./utils-Rng1Um8N.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f2142ff6-8b51-439f-ba0c-9fac9b3b4f58",e._sentryDebugIdIdentifier="sentry-dbid-f2142ff6-8b51-439f-ba0c-9fac9b3b4f58")}catch{}})();function V(){const e=d(),n=l(),r=m(),{setLoading:o,clearAllLoading:u}=_(),s=i.useRef(!1);return i.useLayoutEffect((()=>{o(h.CONNECTION_AUTH)}),[o]),i.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(r.search).get("code"),f=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&f!=null){const t=JSON.parse(f);e(p(t.tenant_id,t.connection_id,b("revenue"),g("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{V as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BD_ga8W6.js";import{a as r}from"./sentry-DsaQHQmX.js";import{u as $,h as L,i as R,j as E,t as oe,l as O,s as z,g as ae,N as H,n as ge,o as x}from"./core-Bx5kG7oj.js";import{a6 as st,h as g,ao as _,Q as l,cf as rt,cg as dt,ch as lt,ci as ut,cj as gt,ck as mt,cl as vt,cm as pt,cn as ft,co as St,cp as It,cq as ht,j as ce,cr as Ct,cs as kt,z as te,ac as pe,ct as Et,cu as yt,cv as bt,cw as xt,cx as At,cy as Dt,cz as jt,cA as $t,cB as Lt,cC as Pt,V as wt,ag as pn,cD as Rt,cE as Ft,cF as _t,cG as Tt,cH as Ot,cI as Mt,cJ as Nt,cK as Ut,cL as Bt,cM as Vt,cN as Ht,t as en,g as Ue,cO as qt,cP as Qt,cQ as zt,cR as Kt,cS as Gt,cT as Yt,cU as Jt,bv as Wt}from"./index-DkHntkmh.js";import"./mui-BaMyMAqO.js";import{A as Z}from"./AddressScreen-CpY6qzLi.js";import M from"./NotFoundScreen-oYE2WlvI.js";import{$e as Zt,$f as Xt,vK as nn,v as ei,$g as X,wl as fe,$h as Be,$i as Y,wY as Pe,x3 as ni,dZ as fn,x7 as Sn,$j as Ve,x0 as ti,yI as tn,wk as on,$k as In,$l as J,xi as we,xm as ii,$m as oi,xw as ai,$n as hn,xp as Cn,zg as ci,$o as he,$p as an,$q as kn,wg as si,$r as ri,w8 as di,$s as li,yV as ui,$t as En,z2 as be,$u as gi,y$ as mi,$v as He,gl as qe,$w as le,$x as ue,xE as vi,wq as cn,wv as yn,wt as pi,wn as fi,xx as Si,wx as Ii,xG as hi,d1 as bn,$y as Re,xP as xn,xN as Q,xL as G,xK as Ci,$z as Se,z9 as xe,$A as ki,wi as An,$B as Qe,fJ as Ce,wG as Fe,wD as _e,wQ as Dn,wP as ze,wA as Ei,wJ as jn,wS as me,WB as $n,wm as Ke,wN as yi,wO as bi,wM as xi,$C as Ai,xn as Di,xj as Ln,$D as Pn,v$ as Ae,$E as ji,vU as $i,$F as Li,zf as Pi,zk as K,ze as wi,ym as ke,$G as Ri,$H as wn,zt as De,$I as Fi,zq as _i,$J as Rn,yp as Ti,yq as q,yt as Oi,$K as Fn,yD as je,$L as Mi,xF as _n,V4 as Tn,$M as Ni,yN as Ui,$N as On,$O as sn,$P as Bi,$Q as Vi,Ag as Hi,$R as qi,$S as Mn,zA as Nn,$T as Un,Ae as $e,$U as Qi,Ab as zi,$V as Ki,$W as Gi,$X as Yi,$Y as Ji,$Z as Wi,$_ as rn,$$ as Zi,ej as Xi,Ak as eo,a00 as Ge,xZ as no,xU as to,d3 as Te,a01 as ee,y1 as Bn,y9 as Vn,a02 as Ye,y2 as ie,ye as io,yh as Hn,a03 as oo,a04 as Oe,yd as ao,a05 as qn,A3 as Le,z_ as co,a06 as so,zF as ro,a07 as lo,A4 as uo,A8 as go,a08 as Je,w_ as Qn,zR as mo,w$ as vo,a09 as po,a0a as zn,cb as fo,mx as So,my as Io,a0b as dn,wZ as ne,gp as ho,mE as Co,zX as Kn,Aw as ko,zU as Gn,vg as Eo,v4 as yo,hX as bo,Vy as ln,Vz as xo,GY as Yn,At as Ao,hP as Do,Aq as jo,a0c as $o,a0d as Lo,AC as Po,AB as wo,a0e as Ro,a0f as Jn,Az as Fo,a0g as _o,a0h as To,yR as Oo,a0i as Mo}from"./zeni-epic-state-CP_8Me3V.js";import{M as No}from"./MobileAppDrawer-DDeilglm.js";import{q as Ie}from"./QBOConnectionScreen-BwiFGkNK.js";import"./recharts-Bcj70bk1.js";import"./analytics-CzizEiux.js";import"./plaid-BmyHDSR7.js";import"./dnd-BT4GhSLO.js";import"./stripe-cKAAJElX.js";import"./lottie-EXw6nebq.js";import"./lexical-BVHU6OCB.js";import"./pdf-DnsysvFr.js";import"./utils-Rng1Um8N.js";import"./InboxNotificationsProvider-Dp-eDJC-.js";import"./useTaskManagerAccess-CW2xYz9y.js";import"./useIsCustomersTabEnabled-BiAWPXPy.js";import"./empty-Cn912Jag.js";import"./pdf-lib-DTKmmSz0.js";import"./index-CtJA2cwC.js";import"./url-DAJdS_e6.js";import"./index-bKm528DW.js";import"./decodeURIComponentSafe-DMAtWdNT.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]="cf27e2c2-ecf3-46b5-9bf6-8e96a1d8d7dc",t._sentryDebugIdIdentifier="sentry-dbid-cf27e2c2-ecf3-46b5-9bf6-8e96a1d8d7dc")}catch{}})();const w=({event:t,isReady:e=!0})=>e?c.jsx(st,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function Uo(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:m,hasMore:f,items:S,nextCursor:I,auditLogEntityRouteOptions:C,auditLogListSortFieldOptions:h}=E(Zt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((F,U)=>{const T=Xt(D,F,U,C);T!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:F,entityId:U,fromScreen:"audit_log",toScreen:F}),e(T))}),[C,e,D]);r.useEffect((()=>{const F=setTimeout((()=>u(a)),300);return()=>clearTimeout(F)}),[a]),r.useEffect((()=>{i&&t(nn({filters:y,keepExistingListItems:!1,sort:v}))}),[i,y,v,t]);const A=m==="Not-Started"||m==="In-Progress"&&S.length===0,k=m==="In-Progress"&&S.length>0,j=m==="Completed";return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(rt,{auditLogEntityRouteOptions:C,auditLogListSortFieldOptions:h,entries:S,hasMore:f,isLoading:A,isLoadingMore:k,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{f&&I!=null&&t(nn({cursor:I,filters:y,keepExistingListItems:!0,sort:v}))},onSearchChange:o,onSortChange:p})]})}const Wn=["company","email","firstName","invoiceNotes","lastName","notes","phone","vatNumber"],Me=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(Me):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).map((([e,n])=>[e,Me(n)]))):null;function B(t,e,n=[]){const i=t,a=e,o=[...new Set([...Object.keys(i),...Object.keys(a??{})])].filter((u=>{if(a==null)return(d=i[u])!=null&&d!==""&&(Array.isArray(d)?d.length>0:typeof d!="object"||Object.keys(d).length>0);var d;return!(i[u]==null&&a[u]==null)&&!ei(i[u],a[u])})).sort(),s=Object.fromEntries(o.filter((u=>!n.includes(u))).map((u=>[u,Me(i[u])])));return{fieldsChanged:o,formValues:s}}function Ee(t,e=!1){const n=$(),i=E((s=>X(s).productNextCursor!=null)),a=E((s=>X(s).productNextCursor)),o=E((s=>X(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(fe({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(fe({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function se(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const p=d.current==="In-Progress";d.current=t,t==="Completed"&&p&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((p=>p+1)))}),[s,e]),a}const Bo=new Set(["plan"]),Vo=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!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(ti({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(Ve({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i,mode:"edit",...B(e.view.localData,fn(e.view.plan))}),t(Sn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(ni({action:o,id:a,parentItemId:i}))}}}))(dt);function Ho(){const t=$(),e=L(),{item_id:n,tenantEmailDomain:i}=R(),[a]=oe(),{areTenantIdsInSync:o}=_(),s=(u=a.get("kind"))!=null&&Bo.has(u)?u:"plan";var u;const d=E((y=>Be(y,n))),{pageFetchState:p}=d,v=p.fetchState;r.useEffect((()=>(t(Y({id:n})),()=>{t(Y({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(Pe({id:n,kind:s}))}),[o,n,s,t]);const m=r.useCallback((y=>t(Pe({cacheOverride:!0,id:y,kind:s}))),[t,s]),f=se(d.fetchState,d.isFormLoading,n,m),S=v==="Completed"&&!d.isFormLoading;Ee(o,!0);const[I,C]=r.useState(S?n:void 0);r.useEffect((()=>{n!=null&&S&&C(n)}),[n,S]);const h=I!==n&&(v==="Not-Started"||v==="In-Progress"||d.isFormLoading);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemDetailPage,isReady:S}),c.jsx(Vo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},f)]})}const qo=new Set(["addon","charge","plan"]),Qo=new Set(["plan"]),zo=O((function(t,e){const n=Be(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedItem:n.plan,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e,a=i!=null?`${n}/catalog/${encodeURIComponent(i)}`:`${n}/catalog`;return{onBack:()=>{t(Y({id:i})),e.navigate(a)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(Y({id:i})),e.navigate(`${n}/catalog`)},onChange:o=>{t(Ve({id:i,localData:o}))},onSubmit:()=>{t(Sn({id:i}))}}}),(function({savedItem:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{itemId:i.itemId,mode:e.mode,...B(e.localData,t!=null?fn(t):void 0)}),n.onSubmit()}}}))(lt);function Ko(){const t=$(),e=L(),{item_id:n,tenantEmailDomain:i}=R(),[a]=oe(),{areTenantIdsInSync:o}=_(),s=n!=null,u=a.get("type"),d=u!=null&&qo.has(u)?u:void 0,p=(v=a.get("kind"))!=null&&Qo.has(v)?v:"plan";var v;const m=E((S=>Be(S,n)));Ee(o,!0);const f=r.useRef();return r.useEffect((()=>(clearTimeout(f.current),()=>{f.current=setTimeout((()=>{t(Y({id:n}))}),0)})),[n,t]),r.useEffect((()=>{o&&t(Pe({id:n,kind:p}))}),[o,n,p,t]),r.useEffect((()=>{s||d==null||m.localData.catalogType===d||t(Ve({localData:{...m.localData,catalogType:d}}))}),[s,d,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??n,I=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(I),t(Y({id:n}))}}),[m.fetchState,m.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(zo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const Go={addons:"addon",all:"item",charges:"charge",plans:"plan"},Yo=O((function(t,e){const n=X(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="In-Progress"&&o.length>0,planRows:n.planRows,productRows:n.productRows}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Go[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(on({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(fe({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?on({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):fe({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(ut);function Jo(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,p]=r.useState(""),[v,m]=r.useState(null),f=r.useMemo((()=>v!=null?{dir:v.direction,field:v.columnKey}:void 0),[v]),S=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:S,type:"plan"})),[S]),C=r.useMemo((()=>({search:S,type:"addon|charge"})),[S]),h=E((j=>X(j))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,k=h.fetchState==="Completed";return r.useEffect((()=>{const j=setTimeout((()=>p(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(tn({cacheOverride:!1,planFilters:I,productFilters:C,planSort:f,productSort:f}))}),[i,t,I,C,f]),r.useEffect((()=>{i&&(S!==y||f?.field!==D?.field||f?.dir!==D?.dir)&&t(tn({cacheOverride:!0,planFilters:I,productFilters:C,planSort:f,productSort:f}))}),[y,D,i,t,I,C,S,f]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogPage,isReady:k}),c.jsx(Yo,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:v,planFilters:I,productFilters:C,sort:f,planNextCursor:b,productNextCursor:A,onSearchChange:o,onTabChange:u,onSortChange:m})]})}const Wo=O((function(t,e){const n=In(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCoupon:n.coupon,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>{t(J({id:i})),e.navigate(a)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(J({id:i})),e.navigate(`${n}/discounts`)},onChange:o=>{t(oi({id:i,localData:o}))},onSubmit:()=>{t(ii({id:i}))}}}),(function({savedCoupon:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{couponId:i.couponId,mode:e.mode,...B(e.localData,t!=null?ai(t):void 0)}),n.onSubmit()}}}))(gt);function Zo(){const t=$(),e=L(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),{fetchState:o,savedCouponId:s}=E((d=>In(d,n))),u=r.useRef();return r.useEffect((()=>(clearTimeout(u.current),()=>{u.current=setTimeout((()=>{t(J({id:n}))}),0)})),[n,t]),r.useEffect((()=>{a&&t(we({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=s??n,p=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(p),t(J({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCouponFormPage}),c.jsx(Wo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Xo=O((function(t){const e=hn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(kn(a))},onSubmit:()=>{const a=ri(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length,mode:"create",...B(t.localData,void 0,["memo"])}),e(di(a))}}}))(vt);function ea(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),[i]=oe(),{areTenantIdsInSync:a}=_(),o=i.get("customerId"),s=E((b=>hn(b))),u=s.fetchState,d=s.localData,p=s.savedInvoiceId,v=E(Cn),m=E((b=>ci(b))),f=E(he),S=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&v==null,I=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,C=S||I,h=m.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(t(an()),()=>{t(an())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(kn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(si({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=p!=null?`/${n}/invoicing/invoices/${encodeURIComponent(p)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,p,e,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),C?c.jsx(mt,{}):c.jsx(Xo,{navigate:e,tenantEmailDomain:n})]})}const na=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=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(pt);function ta(){const t=$(),e=L(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=E((u=>li(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(ui({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(na,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const ia=O((function(t){const e=En(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(mi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(ft);function oa(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,creditNoteListFetchState:h}=E((D=>{const b=En(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),z),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(be({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(be({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(ia,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:C,onSearchChange:o,onStatusChange:D=>{t(gi(D)),t(be({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}const Zn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},aa=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:a=>{t(Re({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`)},onDiscardEdit:()=>{t(Q(G)),t(Ci({id:i}))},onOpenAddress:()=>{const a=Zn(e.tenantEmailDomain??"",G,i),o=ce(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i,mode:"edit",...B(a,e.editView.record.invoicingCustomer!=null?bn(e.editView.record.invoicingCustomer):void 0,Wn)}),t(Re({id:i,localData:a})),t(xn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(hi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(Ii({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(ht);function ca(){const t=$(),e=L(),n=ae(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),s=E((T=>He(T,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[p,v]=r.useState(!1),[m,f]=r.useState(!1),[S,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const C=S===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,k=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;k.current!=="Error"&&T==="Error"&&t(qe({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),k.current=T}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(le()),t(ue()),()=>{t(le()),t(ue())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(vi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(cn({customerId:i}))}),[o,i,t,A]);const F=r.useCallback((T=>t(yn({id:T}))),[t]),U=se(s.fetchState,s.isFormLoading,i,F);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(aa,{customerId:i??"",editView:s,hasLoadedRecord:C,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(le()),i!=null&&A&&t(cn({customerId:i})),v(!0)},onCreatePromotionalCredits:()=>{t(ue()),f(!0)}},U),c.jsx(St,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:p,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(fi({customerId:i}))},onClose:()=>{v(!1),t(le())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(pi({customerId:i,data:T})))}}),c.jsx(It,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:m,submitSucceeded:y.fetchState==="Completed",onClose:()=>{f(!1),t(ue())},onSubmit:({amount:T,description:de})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(Si({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:de})))}})]})}const sa=O((function(t,e){const n=He(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCustomer:n.record.invoicingCustomer}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>{t(Se({id:i})),t(Q(G)),e.navigate(a)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(Se({id:i})),t(Q(G)),e.navigate(`${n}/customers`)},onChange:o=>{t(Re({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const o=Zn(e.tenantEmailDomain??"",G,i),s=ce(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.keepDraftOnLeave(),e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{t(xn({id:i}))}}}),(function({savedCustomer:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{customerId:i.customerId,mode:e.mode,...B(e.localData,t!=null?bn(t):void 0,Wn)}),n.onSubmit()}}}))(Ct);function ra(){const t=$(),e=L(),n=ae(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),{fetchState:s,savedCustomerId:u}=E((m=>He(m,i))),d=r.useRef(!1),p=r.useCallback((()=>{d.current=!0}),[]),v=r.useRef();return r.useEffect((()=>(clearTimeout(v.current),d.current=!1,()=>{d.current||(v.current=setTimeout((()=>{t(Se({id:i})),t(Q(G))}),0))})),[i,t]),r.useEffect((()=>{o&&i!=null&&t(yn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const m=u??i,f=m!=null?`/${a}/invoicing/customers/${encodeURIComponent(m)}`:`/${a}/invoicing/customers`;e(f),t(Se({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerFormPage}),c.jsx(sa,{customerId:i,keepDraftOnLeave:p,location:n,navigate:e,tenantEmailDomain:a})]})}const da=O((function(t){const e=he(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(An({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(kt);function la(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,customerListFetchState:h}=E((D=>{const b=he(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),z),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(xe({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:C,onSearchChange:o,onStatusChange:D=>{t(ki(D)),t(xe({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}const Ne=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ua=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:Ne(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=Ne(s,a),p=s.actionStateByKind.retry?.fetchState==="In-Progress",v=s.actionStateByKind.rollback?.fetchState==="In-Progress",m=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!v;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(qe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(_e({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||p?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(ze(a)))},onRollback:m?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(Dn(a)))}:void 0}}))(Et);function ga(){const t=$(),e=L(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),[o,s]=r.useState({}),u=E(Qe),d=E(Ce),p=r.useMemo((()=>{const C=te.getSignedInUser();return{userId:C?.userId??"",sessionId:C?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),v=Ne(u,n),m=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(Fe(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const C=setTimeout((()=>{t(_e({...o,sessionId:n}))}),300);return()=>clearTimeout(C)}),[a,t,o,n]);const f=v?.status==="scanning"||v?.status==="importing";r.useEffect((()=>{if(!a||n==null||!f)return;const C=setInterval((()=>{t(Fe(n)),t(_e({...o,sessionId:n}))}),3e3);return()=>clearInterval(C)}),[a,t,o,f,n]);const S=r.useMemo((()=>{if(n==null)return"";const C=new URLSearchParams;o.moduleId!=null&&C.set("module_id",o.moduleId),o.level!=null&&C.set("level",o.level),o.outcome!=null&&C.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&C.set("search",o.search.trim());const h=C.toString();return`${pe?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=m?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportDetailPage,isReady:v!=null&&I!=="Not-Started"}),c.jsx(ua,{authParams:p,csvDownloadUrl:S,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const Xn=t=>`invoicing_active_migration:${t}`,ve=(t,e)=>{if(t!=null&&t!=="")try{const n=Xn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ma=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const s=o??null;t(me(s)),ve(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(ze(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(Dn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(yt);function va(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),a=E(Qe);r.useEffect((()=>{i&&(t(Ei()),t(jn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ma,{navigate:e,tenantEmailDomain:n,view:a})]})}const pa=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:p,sessions:v}=u,m=a.externalConnections?.revenue?.find((S=>S.connectionName==="chargebee")),f=n!=null?p[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(m?.isValid??!1),chargebeeConnectorAvailable:m!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:f??v.find((S=>S.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(qe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(xi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(ze(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(bi(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(yi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(bt);function fa(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),a=E(Cn),o=E(Ce),s=r.useMemo((()=>{const h=te.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${pe?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??te.getSignedInUserTenant(n??"")?.companyId,p=E((h=>$n(h,d))),v=E(Qe),{activeMigrationSessionId:m}=v,f=m??void 0,S=f!=null?v.sessionDetail[f]??v.sessions.find((h=>h.id===f)):void 0;r.useEffect((()=>{i&&(t(Ke()),t(jn()))}),[i,t]),r.useEffect((()=>{if(m!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Xn(y))}catch{return null}})(n);h!=null&&t(me(h))}),[m,t,n]),r.useEffect((()=>{ve(n,m)}),[m,n]);const I=S?.status,C=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||f==null||!C)return;const h=setInterval((()=>{t(Fe(f))}),3e3);return()=>clearInterval(h)}),[i,f,C,t]),r.useEffect((()=>{I==="done"&&(t(me(null)),ve(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(pa,{activeId:f,authParams:s,integrationsView:p,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:v,onBack:()=>{t(me(null)),ve(n,null),e(`/${n}/invoicing/data_import`)}})]})}const Sa=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:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(Ln({action:a,id:i}))},onSaveEdit:a=>{const{coupon:o}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i,mode:"edit",...B(a,{invoice_name:o?.invoiceName,invoice_notes:o?.invoiceNotes,max_redemptions:o?.maxRedemptions,name:o?.name},["invoice_notes"])}),t(Di({data:a,id:i}))}}}))(xt);function Ia(){const t=$(),e=L(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=E((I=>Ai(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[p,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const m=p===n;r.useEffect((()=>(t(J({id:n})),()=>{t(J({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(we({id:n}))}),[a,n,t]);const f=r.useCallback((I=>t(we({cacheOverride:!0,id:I}))),[t]),S=se(o.fetchState,o.isFormLoading,n,f);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(Sa,{hasLoadedRecord:m,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},S)]})}const ha=O((function(t){const e=Pn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(Ln({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t($i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(At);function Ca(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,couponListFetchState:h,runningDiscountActionId:y}=E((b=>{const A=Pn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),z),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ae({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ae({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:C,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>{t(ji(b)),t(Ae({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}const ka=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",step:n.step}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(K({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(K({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(K({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(K({action:"retry",id:i}))}:void 0}}))(jt);function Ea(){const t=$(),e=L(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=E((k=>Li(k,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,p]=r.useState("idle"),[v,m]=r.useState(!1),[f,S]=r.useState(),[I,C]=r.useState(!1),h=r.useCallback((()=>{p("idle"),m(!1),S(void 0),C(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(Pi({id:n})),p("idle"),m(!1);const k=o.emailPreview.preview;S(k==null?void 0:{body:k.body,cc:k.cc,subject:k.subject,to:k.to}),C(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((k=>{n!=null&&d!=="pending"&&(m(!1),p("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(K({action:"send-email",body:k,id:n})))}),[n,t,d,o.dunningCase]),b=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(wi({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(ke({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{p("idle"),m(!1),S(void 0),C(!1)}),[n]),r.useEffect((()=>{a||(p("idle"),m(!1),S(void 0),C(!1))}),[a]),r.useEffect((()=>{I&&f==null&&o.emailPreview.preview!=null&&S({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,f,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?v&&o.actionState.fetchState==="Completed"?(n!=null&&t(Ri({id:n})),h()):v&&o.actionState.fetchState==="Error"&&p("failed"):m(!0))}),[n,h,t,d,v,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(ka,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(Dt,{initialDraft:f,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const ya=O((function(t){const e=wn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,stepById:e.stepById,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(K({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))($t);function ba(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,dunningCaseListFetchState:h,dunningCases:y}=E((b=>{const A=wn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),z),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(De({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(De({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(ya,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,dunningCases:y,nextCursor:C,onSearchChange:o,onStatusChange:b=>{t(Fi(b)),t(De({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}const xa=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,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(q({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail",mode:"edit",...B(s,{due_date:a?.dueDate?.format("YYYY-MM-DD")??"",notes:(a?.notes??[]).map((u=>u.note)).filter((u=>u!=null&&u!=="")).join(`
|
|
2
|
-
`),po_number:a?.poNumber??""},["notes"])}),t(Oi({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
|
|
3
|
-
`).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(q({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(q({action:"void",invoiceId:i,body:s}))}}}))(Lt);function Aa(){const t=$(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=E((S=>Rn(S,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,p]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&p(n)}),[n,u]);const v=d===n;r.useEffect((()=>{a&&n!=null&&t(Ti({invoiceId:n}))}),[a,n,t]);const m=r.useCallback((S=>t(ke({invoiceId:S}))),[t]),f=se(o.actionState.fetchState,o.fetchState==="In-Progress",n,m);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(xa,{invoiceId:n??"",hasLoadedRecord:v,navigate:e,tenantEmailDomain:i,view:o},f)]})}const Da=O((function(t){const e=Fn(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(q({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(q({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(_n({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Pt);function ja(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=E((A=>{const k=Fn(A);return{activeStatus:k.activeTab,appliedSearch:k.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:k.nextCursor,invoiceListFetchState:k.fetchState,voidingInvoiceId:k.runningActionId,invoices:k.invoices}}),z),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(je({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Da,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,invoices:D,nextCursor:C,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(Mi(A)),t(je({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}function un(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),i=wt(),a=pn(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=E(Tn),p=Ni(i?.loggedInUserRoleMap),v=`/${n}/invoicing`,m=f=>{s(f)};return d==="completed"?c.jsx(H,{to:`${v}/overview`,replace:!0}):d==="settings"&&p?c.jsx(H,{to:`${v}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPromoPage}),c.jsx(No,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),c.jsx(Rt,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!p,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(Ui())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const $a=O((function(t,e){const n=On(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(qi({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Hi())}}}))(Ft);function La(){const t=$(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:p}=E((S=>On(S,n??""))),v=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>(t(sn()),m.current=null,()=>{t(sn())})),[t,n]),r.useEffect((()=>{a&&n!=null&&t(ke({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&m.current!==n&&(m.current=n,t(Bi({localData:Vi(s)})))}),[t,o,s,n]);const f=r.useRef(p.fetchState);return r.useEffect((()=>{const S=f.current;f.current=p.fetchState,S!=="Completed"&&p.fetchState==="Completed"&&d!=null&&e(`${v}/credits/${encodeURIComponent(d)}`)}),[d,e,p.fetchState,v]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx($a,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Pa=O((function(t){return{invoicingOverview:Mn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingOverviewRefreshed),t(Nn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(_t);function wa(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=E((s=>Mn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Nn(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(Pa,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const Ra=O((function(t){const e=Un(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Tt);function Fa(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:f,appliedSearch:S,appliedSort:I,nextCursor:C,transactionListFetchState:h,transactions:y}=E((j=>{const F=Un(j);return{activeType:F.activeTab,appliedSearch:F.filters.search,appliedSort:F.sort,nextCursor:F.nextCursor,transactionListFetchState:F.fetchState,transactions:F.transactions}}),z),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const F=y.find((T=>T.id===j)),U=F?.linkedInvoices?.[0]?.invoiceID??F?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),k=r.useCallback((j=>{const F=y.find((U=>U.id===j))?.customerID;F!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:F,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(F)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t($e({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t($e({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(Ra,{navigate:e,tenantEmailDomain:n,activeType:f,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:C,onSearchChange:o,onTypeChange:j=>{t(Qi(j)),t($e({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p,onViewTransactionCustomer:k,onViewTransactionInvoice:A})]})}const _a=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 gn(){const t=$(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=n!=null&&n!=="",s=E(he),u=E((k=>Ki(k))),d=E(Gi),p=E((k=>Rn(k,n??""))),v=p.invoice,m=`/${i}/invoicing`,f=r.useRef(null),S=r.useRef("");r.useEffect((()=>{t(Yi()),f.current=null,S.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?ke({invoiceId:n}):An({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&v!=null&&n!=null&&p.fetchState==="Completed"&&f.current!==n&&(f.current=n,t(Ji({contextInvoiceId:n,localData:Wi(v)})))}),[t,v,n,p.fetchState,o]),r.useEffect((()=>{if(o)return;const k=u.localData.customerId;k!==""&&k!==S.current&&(S.current=k,t(_n({filters:{customerId:k},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(rn({localData:{...u.localData,customerId:k,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const k=I.current;if(I.current=d.fetchState,k!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,m]);const C=r.useMemo((()=>s.customers.map((k=>({id:k.id,name:_a(k)})))),[s.customers]),h=E((k=>Zi(k,u.localData.customerId))),y=r.useMemo((()=>h.map((k=>{return{amountDue:(j=k.amountDue,F=Xi.currencySymbol,Nt("0,0.00",j,F)),amountDueValue:k.amountDue,id:k.id,label:k.invoiceNumber};var j,F}))),[h]),D=r.useMemo((()=>{if(!o||v==null)return;const k=v.currencyCode??"USD",j=v.amountDue?.amount??0;return{amountDue:Ot("0,0.00",v.amountDue),amountDueValue:j,currencyCode:k,customerName:v.customerName??v.customerID,invoiceId:v.id,invoiceNumber:v.invoiceNumber??v.id}}),[v,o]),b=o?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,A=!o||p.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(Mt,{customers:C,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:k=>{t(rn({localData:k}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(eo(o?n??void 0:void 0))}})]})}const et=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Ta=O((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,estimate:n.estimate,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Hn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(ee({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Q(ie)),t(io({id:i}))},onOpenAddress:()=>{const s=et(e.tenantEmailDomain??"",ie,i),u=ce(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onCloseEstimate:()=>{t(Ye())},onRequestEstimate:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,{mode:"edit",subscriptionId:i,...B(s,Te(e.editView.subscription))}),t(ee({id:i,localData:s})),t(Vn({id:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{mode:"edit",subscriptionId:i,...B(s,Te(e.editView.subscription))}),t(ee({id:i,localData:s})),t(Bn({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))(Ut);function Oa(){const t=$(),e=L(),n=ae(),{subscription_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),s=E((y=>Ge(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:p}=s,v=s.pageFetchState.fetchState,m=v==="Completed"&&!s.isFormLoading,[f,S]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&S(i)}),[i,m]);const I=f===i;Ee(o),r.useEffect((()=>{o&&i!=null&&t(no({id:i}))}),[o,i,t]);const C=r.useCallback((y=>t(to({id:y}))),[t]),h=se(s.fetchState,s.isFormLoading,i,C);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionDetailPage,isReady:m}),c.jsx(Ta,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:p,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const Ma=O((function(t,e){const n=Ge(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,estimate:n.estimate,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,savedSubscription:n.subscription,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e;return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(Oe({id:i})),t(Q(ie)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{t(ee({id:i,localData:a}))},onCloseEstimate:()=>{t(Ye())},onRequestEstimate:()=>{t(Vn({id:i}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const a=et(e.tenantEmailDomain??"",ie,i),o=ce(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.keepDraftOnLeave(),e.navigate(a,{state:{pathnameStackToGoBack:o}})},onSubmit:()=>{t(Bn({id:i}))}}}),(function({savedSubscription:t,...e},n,i){const a=()=>({mode:e.mode,subscriptionId:i.subscriptionId,...B(e.localData,t!=null?Te(t):void 0)});return{...i,...e,...n,onRequestEstimate:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,a()),n.onRequestEstimate()},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,a()),n.onSubmit()}}}))(Bt);function Na(){const t=$(),e=L(),n=ae(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=oe(),{areTenantIdsInSync:s}=_(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:p}=E((C=>oo(C,i))),v=E((C=>Ge(C,i).localData));Ee(s);const m=r.useRef(!1),f=r.useCallback((()=>{m.current=!0}),[]),S=r.useRef();r.useEffect((()=>(clearTimeout(S.current),m.current=!1,()=>{m.current||(S.current=setTimeout((()=>{t(Oe({id:i})),t(Q(ie)),t(Ye())}),0))})),[i,t]),r.useEffect((()=>{s&&t(ao({subscriptionId:i}))}),[s,i,t]);const I=r.useRef(!1);return r.useEffect((()=>{I.current||i!=null||u==null||u===""||v.customerId!==""||(I.current=!0,t(ee({id:i,localData:{...v,customerId:u}})))}),[u,i,v,t]),r.useEffect((()=>{if(d==="Completed"){const C=p??i,h=C!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(C)}`:`/${a}/invoicing/subscriptions`;e(h),t(Oe({id:i}))}}),[d,p,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(Ma,{keepDraftOnLeave:f,location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Ua=O((function(t){const e=qn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Hn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(ro({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Vt);function Ba(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:f,appliedSearch:S,appliedSort:I,nextCursor:C,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=E((k=>{const j=qn(k);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),z),b=h==="Completed";r.useEffect((()=>{const k=setTimeout((()=>u(a)),300);return()=>clearTimeout(k)}),[a]),r.useEffect((()=>{i&&t(Le({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==S||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Le({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,S,I]);const A=r.useRef(y);return r.useEffect((()=>{const k=A.current!=null&&y==null;A.current=y,k&&i&&t(co())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(Ua,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:C,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:k=>{t(so(k)),t(Le({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}const Va=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:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(go({action:"capture",id:i}))}:void 0}}))(Ht);function Ha(){const t=$(),e=L(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:a}=_(),o=E((u=>lo(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(uo({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(Va,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function nt(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=$(),{areTenantIdsInSync:s}=_(),u=E(Je),d=u.connection?.connected===!0,p=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&p!=="Not-Started"||o(Qn()),n&&o(mo()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(vo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const qa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function re(t){const e=$(),{areTenantIdsInSync:n}=_(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:p}=E(po),{configError:v,configFetchState:m,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:I,qboSyncStatusOptions:C}=E(zn),h=E(Je);nt({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(Ce),D=t==="dunning"||t==="quickbooks",b=y.companyId??te.getSignedInUserTenant(i??"")?.companyId,A=E((P=>$n(P,b))),k=fo(y.userRole??[]),j=y.tenantId??"",F=te.getSignedInUser(),U={userId:F?.userId??"",sessionId:F?.zeniSessionId??"",tenantId:j},T=s?.fileId,de=E((P=>T!=null&&T!==""?So(P,T):void 0)),We=E((P=>T!=null&&T!==""?Io(P,T):void 0)),tt=T!=null&&T!==""&&de!=null?{[T]:de}:{},it=T!=null&&T!==""&&We!=null?{[T]:We}:{};r.useEffect((()=>(e(dn()),()=>{e(dn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Ke()))}),[n,e,a]),r.useEffect((()=>{n&&D&&m==="Not-Started"&&e(ne())}),[n,e,m,D]),r.useEffect((()=>{if(!n)return;const P=F?.userId;P!=null&&P!==""&&j!==""&&en.shouldFetchActiveTenant(j)&&(en.markActiveTenantFetchStarted(j),e(ho(P,j,F?.zeniSessionId)))}),[n,e,F?.userId,F?.zeniSessionId,j]);const ot=f.length>0||S.length>0,at=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!ot&&(m==="Not-Started"||m==="In-Progress"),ct=a==="Completed"&&(!D||m==="Completed"),Ze=A.externalConnections?.revenue?.find((P=>P.connectionName==="chargebee"))?.connectionId,ye=pe?.invoicingMicroServiceBaseUrl,Xe=ye!=null&&ye.length>0?`${ye}/1.0/webhooks/stripe`:"",W={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:k,isStripeBusy:p.fetchState==="In-Progress",onConnectStripe:P=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(jo(P))},onDisconnect:(P,V)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:V,entityId:P,fromScreen:t??"hub"}),e(Do(j,P,ln(V))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(Ao())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const P=y.tenantEmailDomain??i??"";Ie.init("/connection/auth",P),Ie.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Yn()))},onSaveChargeBeeCredentials:(P,V)=>{Ze!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(bo(j,Ze,ln("revenue"),xo("chargebee"),{api_key:P,site:V})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Xe};return{authParams:U,deleteFileStatusById:tt,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:pe?.fileMicroServiceBaseUrl??"",integrationsSectionProps:W,isInvoicingPageReady:ct,isLoading:at,isSaving:u.fetchState==="In-Progress",isStripeBusy:p.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:I,qboSyncStatusOptions:C,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&m==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Xe,updateFileStatusById:it,onConnectStripe:W.onConnectStripe,onDeleteFile:P=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(yo(P,j))},onDisconnectStripe:W.onDisconnectStripe,onEditFileName:(P,V)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(Eo(P,V.split(".")[0],j))},onReconnectQBO:W.onReconnectQBO,onRefreshQBO:W.onRefreshQBO,onRetryQboSyncTask:P=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:P,fromScreen:t??"hub"}),e(Gn(P))},onSave:P=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:Object.keys(P).filter((V=>JSON.stringify(P[V])!==JSON.stringify(d?.[V]))),tab:t??"hub"}),e(ko({settings:P,snackbarSection:qa[t??""]}))},onStartQboBackfill:P=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Kn(P))},updateFilesEntity:P=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(Co({files:P}))}}}function mn({appContent:t}){const e=L(),n=ae(),i=$(),{tenantEmailDomain:a}=R(),o=re("branding"),s=E((d=>$o(d)));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&i(Lo())}),[s.saveState.fetchState,i]);const u=Ue(s.saveState.fetchState);return r.useEffect((()=>{u==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[u,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(qt,{address:s.address,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:d=>{i(Ro({localData:d}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const d=`/${a}/invoicing/settings/branding/${wo}/`,p=ce(n.state?.pathnameStackToGoBack,n.pathname);e(d,{state:{pathnameStackToGoBack:p}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"branding"}),i(Po())},updateFilesEntity:o.updateFilesEntity})]})}function Qa(){const t=L(),e=re("dunning");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function za(){const t=L(),e=re("integrations");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(zt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ka(){const t=L(),e=re("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Kt,{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 Ga=["autoCreateItems","closedPeriodVoidAsCreditMemo","customerMatching","isSyncEnabled","syncStartDate","trackingCategoriesEnabled"],Ya=O((function(t){const e=Jn(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,salesTaxPostingAccountName:e.salesTaxPostingAccountName,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(To({localData:e}))},onReset:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(_o())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Gn(e))},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Kn(e))}}}))(Gt);function Ja(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),i=E(Ce),{configFetchState:a,localData:o,savedLocalData:s,saveState:u,settingsFetchState:d}=E(Jn),p=r.useMemo((()=>{return m=o,f=s,[...[...new Set([...Object.keys(m.accountIdByMappingCode),...Object.keys(f.accountIdByMappingCode)])].some((S=>(m.accountIdByMappingCode[S]??"")!==(f.accountIdByMappingCode[S]??"")))?["account_mappings"]:[],...Ga.filter((S=>m[S]!==f[S]))];var m,f}),[o,s]),v=Ue(u.fetchState);return r.useEffect((()=>{v==="In-Progress"&&u.fetchState==="Completed"&&e("..")}),[e,v,u.fetchState]),r.useEffect((()=>{d!=="Not-Started"&&d!=="Error"||t(Ke())}),[t,d]),r.useEffect((()=>{a==="Not-Started"&&t(ne())}),[a,t]),nt({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Ya,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Ie.init("/connection/auth",i.tenantEmailDomain??n??""),Ie.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Yn())},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:p,tab:"quickbooks"}),t(Fo())}})]})}const Wa={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Za(){const t=pn(),e=$(),n=L(),[i,a]=oe(),o=re(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:p,isStripeConnected:v}=E(zn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const f=Wa[m];a({},{replace:!0}),f!=null&&n(f,{replace:!0})}),[m,n,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Yt,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:p,isStripePaymentsReady:v,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(Oo())}})]})}function vn(){return c.jsxs(ge,{children:[c.jsx(x,{index:!0,element:c.jsx(Za,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Ka,{})}),c.jsx(x,{path:"branding",element:c.jsx(mn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(mn,{appContent:c.jsx(Z,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(za,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Qa,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ja,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:"..",replace:!0})})]})}function Dc(){const t=$(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),{enableState:a,fetchState:o,status:s}=E(Tn),u=Ue(a.fetchState),d=`/${n}/invoicing`,p=r.useRef(!1),v=E((m=>Je(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||p.current||(p.current=!0,t(ne({cacheOverride:!1}))):t(ne({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&v==="Not-Started"&&t(Qn())}),[i,t,v]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(Mo()))}),[u,a.fetchState,d,t,e]),s!=null||o==="Error"&&p.current?s==null?c.jsx(Wt,{onGoHome:()=>e(`/${n??""}`),onReload:()=>t(ne({cacheOverride:!0}))}):s==="not_started"?c.jsxs(ge,{children:[c.jsx(x,{path:"promo",element:c.jsx(un,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ge,{children:[c.jsx(x,{path:"promo",element:c.jsx(un,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(vn,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ge,{children:[c.jsx(x,{path:"/",element:c.jsx(H,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(wa,{})}),c.jsx(x,{path:"promo",element:c.jsx(H,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(la,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(ra,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(Z,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(ca,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(Z,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(Ba,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(Na,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(Z,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(Oa,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(Z,{})}),c.jsx(x,{path:"invoices",element:c.jsx(ja,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(ea,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(Aa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(gn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(La,{})}),c.jsx(x,{path:"payments",element:c.jsx(Fa,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(gn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Ha,{})}),c.jsx(x,{path:"credits",element:c.jsx(oa,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(ta,{})}),c.jsx(x,{path:"discounts",element:c.jsx(Ca,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Zo,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(Ia,{})}),c.jsx(x,{path:"dunning",element:c.jsx(ba,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(Ea,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Jo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(Ko,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Ho,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(vn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(Uo,{})}),c.jsx(x,{path:"data_import",element:c.jsx(va,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(fa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ga,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]}):c.jsx(Jt,{fetchState:"In-Progress"})}export{Dc as default};
|