@zeniai/web-app-ui 5.4.11-dev → 5.4.12-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-CMj3JkGt.js → AccountMappingScreen-CtnQtVOI.js} +1 -1
- package/dist/assets/{ActualMatchingMatchDetailScreen-Dd_vJSSr.js → ActualMatchingMatchDetailScreen-COb45lJn.js} +1 -1
- package/dist/assets/AddressRoutes-CXRpuLt0.js +1 -0
- package/dist/assets/{AddressScreen-BbgME8aO.js → AddressScreen-CiPLLpNX.js} +1 -1
- package/dist/assets/{AiCfoScreen-CU1e2Oi8.js → AiCfoScreen-DPuJRDN-.js} +1 -1
- package/dist/assets/{AppDrawer-Dm9C8j__.js → AppDrawer-Bxmzf_KR.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-GN_PKZBM.js → BillPayApprovalRoutes-Bhwrq5tr.js} +1 -1
- package/dist/assets/{BillPayRoutes-7abJ7Y81.js → BillPayRoutes-CQCAwPWX.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-8VbyEZWD.js → BusinessVerificationPageScreen-71JxUYXB.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-BcEHiZtA.js → CardsAiCfoScreen-Dze-_SQs.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-BR5_qY8y.js → ChargeCardRoutes-CvC_JvPH.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-L6OY8AwA.js → CompanyPassportScreen-dRN2jnGn.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-F-iZ536h.js → ConnectionAuthScreen-CrQ3LZFB.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-BUiUC1A4.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-3OH4ZWPk.js → CustomerOnboardingRoutes-BMrjyYZ8.js} +1 -1
- package/dist/assets/{DashboardRoutes-X31R7cQf.js → DashboardRoutes-DYfRGtw5.js} +1 -1
- package/dist/assets/{DefaultTenantHome-FpeIWNLr.js → DefaultTenantHome-DmRqFqlc.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-BZbvzqXc.js → DomesticWireDetailScreen-YfGiQgSo.js} +1 -1
- package/dist/assets/{DrawerScreen-CmgVB1Zi.js → DrawerScreen-DH40ycW6.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-5IMi-E-b.js → EntityDetailRoutes-BgqO6DqU.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-DH5uN2wQ.js → ExpenseAutomationRoutes-Bks-mNnn.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-Cnh2Fe6t.js → FeaturePreviewScreen-B9UACzAC.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-C94ZBMtd.js → HubSpotOAuthCallbackScreen-BjEMURaY.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-CJt6vmnU.js → InboxNotificationsProvider-Cd4NxEtR.js} +1 -1
- package/dist/assets/{InvoicingRoutes-Q-6aUqgu.js → InvoicingRoutes-UHPes0q9.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-CR6ShXCQ.js → MagicLinkRoutes-BQns5k2S.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-CBjgwG_1.js → MagicLinkSignInScreen-IXnuvHt3.js} +1 -1
- package/dist/assets/{MobileAppDrawer-B4_Hh2uX.js → MobileAppDrawer-rCVKr3J3.js} +1 -1
- package/dist/assets/NotFoundScreen-C94S-cmy.js +1 -0
- package/dist/assets/{NotificationRoutes-CDa5TISi.js → NotificationRoutes-h53g4kBO.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-D8WvwiVN.js → OAuthConsentScreen-35XPz7Vp.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-CiaozOzI.js → PandLWithForecastRoutes-OnVWoGgX.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-BN13u2tw.js → PaymentLinkScreen-BADSNyXp.js} +1 -1
- package/dist/assets/{PeopleRoutes-B5eZw1Xs.js → PeopleRoutes-CnmV1pW5.js} +1 -1
- package/dist/assets/{PerformanceRoutes-B5KqyHoS.js → PerformanceRoutes-MYTxvcMA.js} +1 -1
- package/dist/assets/{Preview-gj_-pUjR.js → Preview-DGZHmpgt.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BD6w4pxT.js → QBOConnectionScreen-C1Kn9y8q.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-_wQ1m-SZ.js → ReimbursementApprovalRoutes-CsG7QtOs.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js → ReimbursementApprovalRuleDetailScreen-BzhkgPjS.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-mHGAbMEo.js → ReimbursementRoutes-BcjYsUHB.js} +1 -1
- package/dist/assets/{ReportsRoutes-DNdr9gVu.js → ReportsRoutes-Bcm2EvxJ.js} +1 -1
- package/dist/assets/{RewardsRoutes-CRQaDmuu.js → RewardsRoutes-Do7moyFI.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-Bgrqk-Br.js → ScheduleDetailsPrepaidExpensesScreen-v3zw3e0R.js} +1 -1
- package/dist/assets/{ScreenRoutes-Cix6ynkH.js → ScreenRoutes-vTLuTGuW.js} +2 -2
- package/dist/assets/{SettingsRoutes-CXzUd0P6.js → SettingsRoutes-CwW3Kcyz.js} +1 -1
- package/dist/assets/{SetupPagesScreen-DzLiX5R5.js → SetupPagesScreen-DPnnq4jj.js} +1 -1
- package/dist/assets/{SignInScreen-VX0iUVME.js → SignInScreen-ColMnPgQ.js} +1 -1
- package/dist/assets/{SignOutScreen-BXVxv4o-.js → SignOutScreen-DILD5ueP.js} +1 -1
- package/dist/assets/{TaskListScreen-Dv5TjArL.js → TaskListScreen-aizYXFWj.js} +1 -1
- package/dist/assets/{TaskRoutes-aDI7RZCK.js → TaskRoutes-CWWa57kf.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-C0gGgGik.js → TransactionDetailRoutes-DWXM95sG.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-BsGN3Yd5.js → TransactionDetailScreen-CNMo1Iyr.js} +2 -2
- package/dist/assets/{TransactionListRoutes-_bc9UoMG.js → TransactionListRoutes-aYhnWH8H.js} +1 -1
- package/dist/assets/{TreasuryRoutes-C7ABXX2A.js → TreasuryRoutes-DnAsQTrn.js} +1 -1
- package/dist/assets/{VendorsRoutes-BlorNbi4.js → VendorsRoutes-QudM99vQ.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-DhPTIeWc.js → WiseConfirmationScreen-CkFHmO99.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-QObrERl4.js → ZeniAccountRoutes-DeSodvmm.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-BHlw6cTG.js → ZeniAccountStatementScreen-DKVtRt3N.js} +1 -1
- package/dist/assets/{accountMappingHelper-BbISzw1n.js → accountMappingHelper-7kGWRPlV.js} +1 -1
- package/dist/assets/{analytics-C4ICDJLl.js → analytics-BfKlFVdJ.js} +4 -4
- package/dist/assets/{analyticsHelper-CPHVprda.js → analyticsHelper-Cn2rORl_.js} +1 -1
- package/dist/assets/{core-C4Vfz6Ll.js → core-BWRpGVdr.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CYsmEPcV.js → decodeURIComponentSafe-DN9u1X8y.js} +1 -1
- package/dist/assets/{dnd-kAQqqaX2.js → dnd-wLfPcqQ_.js} +1 -1
- package/dist/assets/{empty-uRyODf4S.js → empty-BxjviaN4.js} +1 -1
- package/dist/assets/{empty-asCy4wrm.js → empty-CKwCpajm.js} +1 -1
- package/dist/assets/{emptyVideoElement-79iYt27c.js → emptyVideoElement-BURd-WPn.js} +1 -1
- package/dist/assets/epic-Nc2-Ka61.js +2 -0
- package/dist/assets/{expenseAutomationHelper-hmRJBbGd.js → expenseAutomationHelper-Dr99xbt1.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DJIJUZ-c.js → getLocaleForTenant-BNAJG7gN.js} +1 -1
- package/dist/assets/{index-CJ_pjNEa.js → index-9pdMsp-M.js} +7 -7
- package/dist/assets/{index-E3novWwq.js → index-BXpurrfG.js} +1 -1
- package/dist/assets/{index-B_kv_EmZ.js → index-BtcZVjM1.js} +1 -1
- package/dist/assets/{index-UMoTq5JU.js → index-CcNUb4uI.js} +2 -2
- package/dist/assets/{index-Doknm_HP.js → index-D6O1UsWW.js} +1 -1
- package/dist/assets/{index-BTd7WWV0.js → index-DYK9WSJX.js} +1 -1
- package/dist/assets/{index-Bg8f4cim.js → index-DwbDgvVM.js} +1 -1
- package/dist/assets/{index-pA4BduR_.js → index-mJCZBkgN.js} +1 -1
- package/dist/assets/{lexical-SeD-pdYj.js → lexical-ljfsYSTd.js} +1 -1
- package/dist/assets/{liveblocks-DZUXZ-JO.js → liveblocks-V5YQZeeY.js} +1 -1
- package/dist/assets/{lottie-txhqSe8x.js → lottie-ByqRhfis.js} +1 -1
- package/dist/assets/{mui-C0PYnbt1.js → mui-BmHHlwSU.js} +1 -1
- package/dist/assets/{pathToGoBack-DF1y-0ht.js → pathToGoBack-Dr_s0YFt.js} +1 -1
- package/dist/assets/{pdf-bOGTjHnz.js → pdf-C42gprG9.js} +3 -3
- package/dist/assets/{pdf-lib-BsfRp21l.js → pdf-lib-D4o6Nk27.js} +1 -1
- package/dist/assets/{plaid-hQES7k9Y.js → plaid-CNV6JDhi.js} +1 -1
- package/dist/assets/{pusher-BoH5mrch.js → pusher-DvjXiGU0.js} +1 -1
- package/dist/assets/{react-Boil267a.js → react-CFX1RFZH.js} +1 -1
- package/dist/assets/{react-BgJrrMxk.js → react-CFwPpD-1.js} +1 -1
- package/dist/assets/{react-ZM05SSz2.js → react-CdlDO5TG.js} +1 -1
- package/dist/assets/{react-BQ6jUfzX.js → react-Ct2ZzE_U.js} +1 -1
- package/dist/assets/{react-DXSBT-1v.js → react-DJxNpxcE.js} +1 -1
- package/dist/assets/{react-qLaRPrw4.js → react-s5yBxYCg.js} +1 -1
- package/dist/assets/{recharts-rN5v_P87.js → recharts-BXLxGQ-T.js} +1 -1
- package/dist/assets/{reportTimeframe-C5AD1AL2.js → reportTimeframe-tJTkNTvP.js} +1 -1
- package/dist/assets/{routePaths-DYebh4Li.js → routePaths--TXDBUUo.js} +1 -1
- package/dist/assets/{sentry-DfoGRlTp.js → sentry-bpmZUW7k.js} +1 -1
- package/dist/assets/{stripSplatSuffix-Db8ayksN.js → stripSplatSuffix-Bizh1-Tx.js} +1 -1
- package/dist/assets/{url-B-JScRaX.js → url-8ONn8gmN.js} +1 -1
- package/dist/assets/{url-BtS-4pap.js → url-Cc_9bwX-.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-DPtaMcdm.js → useActualMatchingMatchDetail-Mft821vz.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-D2InIpSO.js → useAiCfoDashboardSuggestedQuestionsChips-3ayut61P.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-k11tYjVi.js → useAskAiCfoHostNavButtonProps-E2UGdnp9.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-Bf7Vv0PE.js → useChargeCardPusherEvents-DVeqwUB9.js} +1 -1
- package/dist/assets/{useDeviceId-_3Ay4Sah.js → useDeviceId-3o80RPjJ.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BCLtP2Ad.js → useEmailConnectResultRefresh-F8OBO8EU.js} +1 -1
- package/dist/assets/{useEnsureVendorListLoaded-Bud-c91I.js → useEnsureVendorListLoaded-CKZrwkQQ.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-BVMcY486.js → useInitialThreadRequest-Df-inltN.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-Cp8R2Cu9.js → useTaskManagerAccess-Bq9TDvwr.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-p1TIydvw.js → useTaskManagerPusherEvents-Ctn5L7kn.js} +1 -1
- package/dist/assets/{utils-CmKqkYr5.js → utils-CXFQdt3d.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-btBdqPWA.js → withTransactionSidePanel-DOV8YzFf.js} +1 -1
- package/dist/assets/{zeni-epic-state-DmXGRK_Y.js → zeni-epic-state-BlWDBO75.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-7FdlQcLM.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-Gnqx1b1N.js +0 -1
- package/dist/assets/NotFoundScreen-CxVO6BUm.js +0 -1
- package/dist/assets/epic-B2pHLhBD.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as R}from"./liveblocks-
|
|
1
|
+
import{j as R}from"./liveblocks-V5YQZeeY.js";import{a as i}from"./sentry-bpmZUW7k.js";import{h as K,g as X,u as Y,j as A,s as q,l as Z}from"./core-BWRpGVdr.js";import{ah as ee,p as te,c as B,z as ne,x as G,ai as ae,m as ce,S as oe}from"./index-9pdMsp-M.js";import{bj as se,fE as ie,gV as ue,oF as $,Vr as re,i8 as J,gg as le,os as de,Vs as pe,Vt as ge,Vu as me,uh as Ae,l$ as be,oq as Ie,om as ye,oB as fe,ox as Se,ia as he,Vv as Ee,Vw as ve}from"./zeni-epic-state-BlWDBO75.js";import{n as we}from"./mui-BmHHlwSU.js";import{M as ze}from"./MobileAppDrawer-rCVKr3J3.js";import{q as Q}from"./QBOConnectionScreen-C1Kn9y8q.js";import{g as h,a as E,m as Ce}from"./accountMappingHelper-7kGWRPlV.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="ca93a334-04e6-4217-8394-7c0d894e587c",n._sentryDebugIdIdentifier="sentry-dbid-ca93a334-04e6-4217-8394-7c0d894e587c")}catch{}})();const r="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},Ve=we.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-V5YQZeeY.js";import{a as y}from"./sentry-bpmZUW7k.js";import{a3 as A,dQ as R}from"./index-9pdMsp-M.js";import"./mui-BmHHlwSU.js";import{a as F}from"./useActualMatchingMatchDetail-Mft821vz.js";import b from"./NotFoundScreen-C94S-cmy.js";import{i as P,h as U,g as w}from"./core-BWRpGVdr.js";import"./recharts-BXLxGQ-T.js";import"./zeni-epic-state-BlWDBO75.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.js";import"./stripSplatSuffix-Bizh1-Tx.js";import"./decodeURIComponentSafe-DN9u1X8y.js";import"./routePaths--TXDBUUo.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]="f1509e0b-d219-4e94-9110-db368d54d455",t._sentryDebugIdIdentifier="sentry-dbid-f1509e0b-d219-4e94-9110-db368d54d455")}catch{}})();function V(){const{matchId:t,tenantEmailDomain:e}=P(),o=U(),n=w(),k=F(t??""),r=y.useCallback((()=>{const v=A(n.state?.pathnameStackToGoBack);o(v.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:v.newStack}})}),[n.state,o,e]);if(t==null)return a.jsx(b,{});const{match:i,detailFetchState:s,handleOpenBill:l,handleRefresh:d,handleUndoReversal:h,handleApproveAndReverse:c,handleIgnoreMatchSuggestion:p,lastMatchResults:f,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?s.fetchState==="Not-Started"||s.fetchState==="In-Progress"?a.jsx(R,{detailFetchState:s.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:p,onRefresh:d,onUndoReversal:h,lastMatchResults:f,lastUndoResults:g}):a.jsx(b,{}):a.jsx(R,{match:i,detailFetchState:s.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:c,onIgnoreMatchSuggestion:p,onRefresh:d,onUndoReversal:h,lastMatchResults:f,lastUndoResults:g})}export{V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-V5YQZeeY.js";import{A as i}from"./AddressScreen-CiPLLpNX.js";import s from"./NotFoundScreen-C94S-cmy.js";import"./sentry-bpmZUW7k.js";import{n as d,o as r}from"./core-BWRpGVdr.js";import"./recharts-BXLxGQ-T.js";import"./zeni-epic-state-BlWDBO75.js";import"./index-9pdMsp-M.js";import"./mui-BmHHlwSU.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="615cd506-7547-4074-9c74-f0ab1266c907",t._sentryDebugIdIdentifier="sentry-dbid-615cd506-7547-4074-9c74-f0ab1266c907")}catch{}})();function _(){return e.jsxs(d,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(i,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(i,{})}),e.jsx(r,{path:"*",element:e.jsx(s,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-
|
|
1
|
+
import{j as r}from"./liveblocks-V5YQZeeY.js";import{a as h}from"./sentry-bpmZUW7k.js";import{h as T,u as P,g as j,i as E,j as B,l as M}from"./core-BWRpGVdr.js";import{a0 as $,z as D,V as L,a6 as K,a7 as R,m as C,S,a2 as z,X as b,a3 as F}from"./index-9pdMsp-M.js";import{W8 as _,ip as N,fE as U,W9 as V,c6 as W,Wa as G,mH as H}from"./zeni-epic-state-BlWDBO75.js";import{u as O,n as q}from"./mui-BmHHlwSU.js";import X from"./NotFoundScreen-C94S-cmy.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="91f32acb-fe57-432f-9259-2928e6741362",e._sentryDebugIdIdentifier="sentry-dbid-91f32acb-fe57-432f-9259-2928e6741362")}catch{}})();const J=q.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as S}from"./liveblocks-DZUXZ-JO.js";import{a as n}from"./sentry-DfoGRlTp.js";import{u as Dt,h as Lt,i as Bt,g as Ft,j as v,l as Mt}from"./core-C4Vfz6Ll.js";import{ea as Vt,a as $t,k as Nt,eb as Gt,z as qt,a0 as Ht,ec as zt,ed as Wt,ee as Jt,br as Be,ef as We,eg as Yt,bq as Je,a3 as ge,a7 as ce,m as V,eh as me,ei as Zt,ej as Kt,at as Xt,S as es,w as ts,ek as ss,el as ns,au as as,em as os,en as is,eo as rs,ep as ls,n as us,bm as Fe,eq as ds}from"./index-CJ_pjNEa.js";import{fD as M,gs as R,UQ as cs,a3h as ms,a3i as Ss,jM as hs,a3j as ps,jJ as fs,a3k as Se,jp as Y,jS as Z,jv as Ie,jc as he,ja as gs,jU as Is,jE as Ye,UZ as Me,gu as $,gJ as Cs,UY as ks,UJ as Ve,fE as bs,j3 as vs,a3l as Es,g7 as Ps,jl as ys,jh as ws,fF as pe,ge as xs,a3m as Rs,a3n as Ts,a3o as js,gt as Os,gn as $e,k4 as Ne,gp as Ge,gv as As,a3p as qe,jV as _s,je as Qs,jy as Us,jQ as He,jB as Ds,gw as Ls,gx as Bs,gy as Fs,gz as Ms}from"./zeni-epic-state-DmXGRK_Y.js";import{D as Vs,n as N,S as $s,v as Ns}from"./mui-C0PYnbt1.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-D2InIpSO.js";import{p as qs}from"./pathToGoBack-DF1y-0ht.js";import{k as Hs}from"./routePaths-DYebh4Li.js";import{u as zs}from"./useTaskManagerPusherEvents-p1TIydvw.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="05513786-a309-4992-97f2-482097c9427f",t._sentryDebugIdIdentifier="sentry-dbid-05513786-a309-4992-97f2-482097c9427f")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ze="chat-response-generated";function Js(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Ys=Mt((function(t,r){const h=M(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=js(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:Z(t).detail,skillDetailError:Z(t).fetchState==="Error",skillDetailLoading:Z(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ze&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,j=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:O,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Je(g,E);j!=="answer"?V.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Fs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(a,o,c,j,E)=>{a&&Fe(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Ye())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(He({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Us({macroId:a,version:o}))},onDeleteSkill:a=>{t(Qs({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(_s({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(qe())},onRunSkill:(a,o)=>{t($()),t($e()),Fe(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(qe())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(As(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??qs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Vt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Bt(),i=Ft(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=n.useState(void 0),[G,A]=n.useState(!1),[Ke,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=n.useCallback((e=>{O(e),A(!0)}),[]),tt=n.useCallback((()=>{O(void 0),A(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),O(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?Y({scheduleId:P}):Se())}),[s,P]);const F=ke?.macroId,at=v((e=>Z(e))),be=F!=null&&F!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&F!=null&&s(Ie({macroId:F}))}),[s,be,F]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Nt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(Y({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(Y({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=n.useCallback((()=>{s(Ye()),s(Me())}),[s]),ct=n.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),w=qt.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ve()),void s(Me())):(T==null&&s(Se()),s(Ve()),void s($()))),[s,T,g,l]);const ft=Ht(),_=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,y=b.tenantEmailDomain,D=y!=null&&y!=="",ee=n.useCallback((e=>{D&&d(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,y]),te=n.useCallback((()=>{D&&d(`/${y}/ai-cfo/routines`)}),[D,d,y]),se=n.useCallback(((e,m)=>{const Q=e.sessionId??C.sessionId;Q!=null&&D&&d(`/${y}/ai-cfo/${Q}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,y]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:zt(k),skillName:k.isAdHoc===!0?void 0:K.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,K]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:y}),ne=Jt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),q=i.state,H=q?.aiCfoInitialQuestion,ye=!!q?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[yt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&H!=null&&H!==""){const e=i.state;ae(H),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),we.current=!0}}),[H,ye,i.state]);const wt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??q?.aiCfoRef,le=xe.get("emailRefId")??q?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(s(vs("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,w]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Yt(u),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Oe=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(_e,u),Tt=Rt.length===0;n.useEffect((()=>{x||_||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,d,i.state]);const jt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),Qe=n.useRef(void 0),Ue=n.useRef(void 0);n.useEffect((()=>{const e=l!==Qe.current,m=u!==Ue.current;Qe.current=l,Ue.current=u,l!==u&&(!e||l==null||Hs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ze}`)),eventCallback:(e,m,Q)=>Q.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&J&&s(ys())}),[W,J,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(l===u||W==="Completed"&&!J)&&s(ws(u,w.userId))}),[Oe,W,Ae,J,u,w,l,s]);const ue=w?.userId,At=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(Y({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const Q=(de=>{if(de==null||typeof de!="object")return null;const U=de;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);Q!=null&&De(Q.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||l==null)throw Error("Can't access AI Controller page without signing in...");const _t=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:V,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const Qt=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:V,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Zs,{children:[S.jsx(ce,{analytics:V,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),_&&ne.drawerElement,S.jsx(Ys,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:w.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:_t,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:wt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:yt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:j,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:K,routines:o.routines,onRoutineCreate:Xe,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ke,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:y}),p&&_?S.jsx(Vs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!_?S.jsx(Zt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:Qt})}):null]})},ze=N($s)`
|
|
1
|
+
import{j as S}from"./liveblocks-V5YQZeeY.js";import{a as n}from"./sentry-bpmZUW7k.js";import{u as Dt,h as Lt,i as Bt,g as Ft,j as v,l as Mt}from"./core-BWRpGVdr.js";import{ea as Vt,a as $t,k as Nt,eb as Gt,z as qt,a0 as Ht,ec as zt,ed as Wt,ee as Jt,br as Be,ef as We,eg as Yt,bq as Je,a3 as ge,a7 as ce,m as V,eh as me,ei as Zt,ej as Kt,at as Xt,S as es,w as ts,ek as ss,el as ns,au as as,em as os,en as is,eo as rs,ep as ls,n as us,bm as Fe,eq as ds}from"./index-9pdMsp-M.js";import{fD as M,gs as R,UQ as cs,a3h as ms,a3i as Ss,jM as hs,a3j as ps,jJ as fs,a3k as Se,jp as Y,jS as Z,jv as Ie,jc as he,ja as gs,jU as Is,jE as Ye,UZ as Me,gu as $,gJ as Cs,UY as ks,UJ as Ve,fE as bs,j3 as vs,a3l as Es,g7 as Ps,jl as ys,jh as ws,fF as pe,ge as xs,a3m as Rs,a3n as Ts,a3o as js,gt as Os,gn as $e,k4 as Ne,gp as Ge,gv as As,a3p as qe,jV as _s,je as Qs,jy as Us,jQ as He,jB as Ds,gw as Ls,gx as Bs,gy as Fs,gz as Ms}from"./zeni-epic-state-BlWDBO75.js";import{D as Vs,n as N,S as $s,v as Ns}from"./mui-BmHHlwSU.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-3ayut61P.js";import{p as qs}from"./pathToGoBack-Dr_s0YFt.js";import{k as Hs}from"./routePaths--TXDBUUo.js";import{u as zs}from"./useTaskManagerPusherEvents-Ctn5L7kn.js";import"./recharts-BXLxGQ-T.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="05513786-a309-4992-97f2-482097c9427f",t._sentryDebugIdIdentifier="sentry-dbid-05513786-a309-4992-97f2-482097c9427f")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ze="chat-response-generated";function Js(t,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const h=R(t).skills.find((s=>s.macroId===r.savedMacroId));return h==null?void 0:{status:"saved",command:h.name}}const Ys=Mt((function(t,r){const h=M(t),s=r.isSubmitting,d=h.uiState?.currentChatSessionId,l=d!=null?xs(t.aiCfoState,d):[],i=ns(t,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),g=Rs(t),p=Ts(t),f=js(t);return{showSampleQuestions:r.sessionFromUrl==="explore"&&h.uiState.currentChatSessionId==null,aiCfoView:h,isSubmitting:s,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${as}/tableDownload`,exportDownloadEndPoint:rs(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:R(t).skills,skillSaveState:Js(t,f),skillsEnabled:R(t).skillsEnabled,skillsList:R(t).skills,skillsListError:R(t).fetchState==="Error",skillsListLoading:R(t).fetchState==="In-Progress",skillsCanPublish:R(t).canPublish,skillSaving:f.fetchState==="In-Progress",skillSaveError:f.fetchState==="Error",skillVersionHistory:g.macroId!=null?{macroId:g.macroId,versions:g.versions,error:g.fetchState==="Error",loading:g.fetchState==="In-Progress"}:void 0,skillRestoreBody:p.macroId!=null&&p.version!=null?{macroId:p.macroId,version:p.version,instructions:p.instructions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillDetail:Z(t).detail,skillDetailError:Z(t).fetchState==="Error",skillDetailLoading:Z(t).fetchState==="In-Progress",syntheticAnswers:l,resolveSyntheticAnswerCardTile:is(t),resolveSyntheticAnswerPolicyTile:os(t),...i}}),(function(t,r){const{location:h,currentTenant:s,userId:d,navigate:l,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:g,isAiCardCreationEnabled:p,isCardPolicyEnabled:f,setIsAiCfoOpen:L}=r,B=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ze&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,j=Ls(c.type),E=c.metadata.chat_session_id??null,{currentChatSession:O,currentQuestionAnswer:G,currentQuestionAnswerSummary:A}=Je(g,E);j!=="answer"?V.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Bs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Fs({chatSessionId:c.metadata.chat_session_id,responseType:j,fetchState:{fetchState:"Completed",error:void 0}})),t(Ms({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(a,o,c,j,E)=>{a&&Fe(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Ye())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(He({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(He({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Us({macroId:a,version:o}))},onDeleteSkill:a=>{t(Qs({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(_s({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(qe())},onRunSkill:(a,o)=>{t($()),t($e()),Fe(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(qe())},updateCurrentInput:a=>{t(Ge(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(As(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{l(-1)},onCloseClick:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??qs(1);l(o,{state:{...h.state,pathnameStackToGoBack:a.newStack}}),t(Ge(""))},togglePageView:()=>{const a=ge(h.state?.pathnameStackToGoBack),o=a.poppedPathname??`/${s.tenantEmailDomain}/dashboard`;l(o,{state:{...We(h.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),L(!0)},onCopy:()=>{},onThumbsUp:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ne(i,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{l(-1)},onNewChatClick:()=>{t($()),i!=null&&t($e());const a=us(h.state?.pathnameStackToGoBack,h.pathname);l(`/${s.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,o)=>{t(Os({questionAnswerId:a,isCollapsed:o}))},onMenuClick:r.onMenuClick,...ls(t,{isAiCardCreationEnabled:p,isCardPolicyEnabled:f,currentChatSessionId:i,onAfterCardsCreationSubmit:()=>{L(!0),l(`/${B}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${B}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Vt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Bt(),i=Ft(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),B=v((e=>R(e).skillsEnabled)),a=v((e=>M(e).uiState.isRoutinesBrowserOpen===!0)),o=v((e=>cs(e))),c=v((e=>ms(e))),j=v((e=>Ss(e))),[E,O]=n.useState(void 0),[G,A]=n.useState(!1),[Ke,Ce]=n.useState(void 0),Xe=n.useCallback((()=>{Ce(void 0),O(void 0),A(!0)}),[]),et=n.useCallback((e=>{O(e),A(!0)}),[]),tt=n.useCallback((()=>{O(void 0),A(!1)}),[]),st=n.useCallback((e=>{s(hs({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),O(void 0),A(!1)}),[s,E]),P=g,ke=o.routines.find((e=>e.scheduleId===P)),C=v((e=>ps(e))),nt=n.useCallback((e=>{s(fs({scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{s(P!=null?Y({scheduleId:P}):Se())}),[s,P]);const F=ke?.macroId,at=v((e=>Z(e))),be=F!=null&&F!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&F!=null&&s(Ie({macroId:F}))}),[s,be,F]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Nt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(Y({scheduleId:T}))}),[s,T]);const Ee=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;n.useEffect((()=>{if(P==null||Ee!==!0)return;const e=window.setInterval((()=>{s(Y({scheduleId:P})),s(he())}),5e3);return()=>window.clearInterval(e)}),[s,Ee,P]);const rt=n.useCallback((e=>{Ce(e),O(void 0),A(!0)}),[]),lt=n.useCallback((e=>{s(gs({scheduleId:e.scheduleId}))}),[s]),ut=n.useCallback(((e,m)=>{s(Is({enabled:m,scheduleId:e.scheduleId}))}),[s]);n.useEffect((()=>{a&&s(he())}),[s,a]);const Pe=v((e=>R(e).skills)),K=n.useMemo((()=>Pe.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Pe]),dt=n.useCallback((e=>{s(Ie({macroId:e}))}),[s]),X=n.useCallback((()=>{s(Ye()),s(Me())}),[s]),ct=n.useCallback((()=>{s($())}),[s]),{allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,onCardPolicyVendorSearchTextChange:pt}=Gt();n.useEffect((()=>{s(Cs())}),[s]);const I=v((e=>M(e))),w=qt.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ve()),void s(Me())):(T==null&&s(Se()),s(Ve()),void s($()))),[s,T,g,l]);const ft=Ht(),_=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,y=b.tenantEmailDomain,D=y!=null&&y!=="",ee=n.useCallback((e=>{D&&d(`/${y}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,y]),te=n.useCallback((()=>{D&&d(`/${y}/ai-cfo/routines`)}),[D,d,y]),se=n.useCallback(((e,m)=>{const Q=e.sessionId??C.sessionId;Q!=null&&D&&d(`/${y}/ai-cfo/${Q}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,y]),gt=n.useMemo((()=>k==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:k.name,schedule:zt(k),skillName:k.isAdHoc===!0?void 0:K.find((e=>e.macroId===k.macroId))?.name,onOpenSkill:k.isAdHoc===!0?void 0:X,runs:C.runs,tzName:k.tzName,unreadCount:k.unreadRuns,open:ve,onToggle:()=>it((e=>!e)),onOpenRun:e=>se(e,k.scheduleId),onOpenRoutine:()=>ee(k),onOpenRoutines:te}),[X,te,ee,se,ve,k,C.fetchState,C.runs,K]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:y}),ne=Jt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:B,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),q=i.state,H=q?.aiCfoInitialQuestion,ye=!!q?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Be]!==!0)return;f(!0);const m={...e};delete m[Be],d(i,{replace:!0,state:m})}),[i.pathname,i.search,i.state,d]);const[vt,ae]=n.useState(null),[Et,oe]=n.useState(!1),[Pt,ie]=n.useState(void 0),[yt,re]=n.useState(void 0),we=n.useRef(!1);n.useEffect((()=>{if(!we.current&&H!=null&&H!==""){const e=i.state;ae(H),oe(ye),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),we.current=!0}}),[H,ye,i.state]);const wt=n.useCallback((()=>{ae(null),oe(!1),ie(void 0),re(void 0),d(i.pathname,{replace:!0,state:We(i.state)})}),[i.pathname,i.state,d]),xe=n.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Re=xe.get("ref")??q?.aiCfoRef,le=xe.get("emailRefId")??q?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||w==null||(s(vs("controller",w.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,w]);const z=I.uiState.lastContextMessage;n.useEffect((()=>{z!=null&&z!==""&&u!=null&&(ae(z),oe(!0),ie(void 0),re(void 0),s(Es()))}),[z,u,s]);const xt=b.masterTOSInfo,x=xt?.isMasterTOSAccepted??!1,{visitedSessions:je}=Yt(u),W=I.fetchState,J=I.uiState.chatSessionsNextPageToken.hasMore||!I.uiState.chatSessionsFirstPageFetched,Oe=u!=null?I.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",Ae=u==null||(I.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),_e=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Je(_e,u),Tt=Rt.length===0;n.useEffect((()=>{x||_||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,_,d,i.state]);const jt=n.useCallback((()=>{const e=ge(i.state?.pathnameStackToGoBack),m=b.tenantEmailDomain;d(e.poppedPathname??(m!=null?`/${m}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[b.tenantEmailDomain,i.state,d]),Qe=n.useRef(void 0),Ue=n.useRef(void 0);n.useEffect((()=>{const e=l!==Qe.current,m=u!==Ue.current;Qe.current=l,Ue.current=u,l!==u&&(!e||l==null||Hs(l)?m&&u!=null&&d(`../ai-cfo/${u}`,{state:{...i.state}}):s(Ps({sessionId:l,agentId:"controller"})))}),[u,l]);const Ot=n.useMemo((()=>({events:je.map((e=>`private-encrypted-chat-${e}.${Ze}`)),eventCallback:(e,m,Q)=>Q.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&J&&s(ys())}),[W,J,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&w!=null&&(l===u||W==="Completed"&&!J)&&s(ws(u,w.userId))}),[Oe,W,Ae,J,u,w,l,s]);const ue=w?.userId,At=n.useMemo((()=>{return ue==null?[]:[(e=ue,`private-encrypted-routines-${e}.routine-run-updated`)];var e}),[ue]),De=n.useCallback((e=>{const m=e!=null&&(e===P||e===T);(a||m)&&s(he()),m&&s(Y({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const Q=(de=>{if(de==null||typeof de!="object")return null;const U=de;return fe(U.schedule_id)&&fe(U.run_id)?{scheduleId:U.schedule_id,runId:U.run_id,status:Ws.find((Ut=>Ut===U.status))??null,finishedAt:fe(U.finished_at)?U.finished_at:null}:null})(m);Q!=null&&De(Q.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(w==null||l==null)throw Error("Can't access AI Controller page without signing in...");const _t=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&_)return S.jsxs(Ks,{children:[S.jsx(ce,{analytics:V,onLoad:Le}),ne.drawerElement,S.jsx(Xs,{children:S.jsx(ze,{children:S.jsx(me,{isTOSAccepted:!1,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:jt,onCompleteClick:()=>{b.userRoleId!=null&&s(pe(b.userRoleId))}})})})]});const Qt=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:V,onLoad:Le}):null,S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,showHeader:!1,togglePageView:x?()=>f(!1):void 0,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Zs,{children:[S.jsx(ce,{analytics:V,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),_&&ne.drawerElement,S.jsx(Ys,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:_e,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:w.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:_t,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:wt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:yt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:_?ne.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:Ct,onUploadPromoClose:It,exploreSuggestedPromptQuestions:bt,exploreSuggestedPromptQuestionsLoading:kt,isSkillsOpen:L,isRoutinesOpen:a,routineCanCreate:j,routineEditing:E,routineEditorOpen:G,routineListError:o.fetchState==="Error",routineListLoading:o.fetchState==="In-Progress",routineMaxRoutines:o.maxRoutines,routineSaveError:c.fetchState==="Error",routineSaving:c.fetchState==="In-Progress",routineSchedulableSkills:K,routines:o.routines,onRoutineCreate:Xe,onRoutineDelete:lt,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:gt,routineDetail:ke,routineRunningScheduleId:c.runningScheduleId,routineRuns:C.runs,onRoutineEdit:et,onRoutineOpenRun:(e,m)=>se(m,e.scheduleId),onRoutineRun:nt,onRoutineCloseDetail:te,onRoutineDraft:rt,routineDraftPrompt:Ke,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:B,promoDismissalScope:y}),p&&_?S.jsx(Vs,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:en,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:S.jsx(ze,{onClick:e=>e.stopPropagation(),children:S.jsx(me,{isTOSAccepted:x,acceptMasterTOSState:I.masterTOSAcceptanceState,onCloseClick:()=>f(!1),onCompleteClick:()=>{x||b.userRoleId==null||s(pe(b.userRoleId)),f(!1)}})})}):null]}),p&&!_?S.jsx(Zt,{open:p,onClose:()=>f(!1),children:S.jsx(Kt,{children:Qt})}):null]})},ze=N($s)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-DZUXZ-JO.js";import{a as o,R as Ta}from"./sentry-DfoGRlTp.js";import{u as Fe,j as r,g as $a,h as Ba,q as L}from"./core-C4Vfz6Ll.js";import{fE as Re,UH as xa,UI as Ze,g8 as Aa,gu as X,UJ as ee,jE as ye,jc as Te,UK as Da,UL as _a,gO as Ma,q3 as Ua,UM as Fa,UN as $e,gl as Ra,UO as x,fD as Za,gs as Ga,UP as Ha,UQ as La,UR as Va,US as Be,UT as ja,UU as xe,UV as Pa,ED as Na,gm as Oa,h1 as qa,cT as za,UW as Ya,UX as Ja,qG as Ka,g7 as Wa,j6 as Qa,UY as Xa,UZ as et,wL as at,gn as tt}from"./zeni-epic-state-DmXGRK_Y.js";import{w as nt,i as ot,a as st,g as rt,p as it,c as m,d as lt,u as dt,e as ct,f as ut,h as mt,j as Ct,o as pt,k as ht,l as ft,z as gt,m as V,n as h,q as Ae,r as bt,s as St,v as De,x as kt,y as _e,A as Et,B as wt,C as te,D as ae,E as It,F as vt,H as yt,L as Tt,I as $t,J as Bt,K as xt,M as At}from"./index-CJ_pjNEa.js";import{u as Dt,q as _t,r as Mt,I as Ut,p as Me,t as Ft,D as Ue,s as ne}from"./mui-C0PYnbt1.js";import{u as Rt}from"./InboxNotificationsProvider-CJt6vmnU.js";import{u as Zt}from"./useTaskManagerAccess-Cp8R2Cu9.js";import{u as Gt}from"./expenseAutomationHelper-hmRJBbGd.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="8edfed66-92cb-42ba-89a6-ad2a78766eba",a._sentryDebugIdIdentifier="sentry-dbid-8edfed66-92cb-42ba-89a6-ad2a78766eba")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ht=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Lt=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,D]=Ta.useState(!1),[k,Ge]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[He,Le]=o.useState(!1),P=Dt(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Re(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),w=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const Q=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(Q)}const G=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(G)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Pe]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:U}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>Da(e)));o.useEffect((()=>{const e=()=>{Le(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>_a(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Je=L("/signout")!==null,F=L("/:tenantEmailDomain/dashboard")!==null,ce=L("/:tenantEmailDomain/reports")!==null,b=L("/:tenantEmailDomain/onboarding/*")!==null,ue=Gt();o.useEffect((()=>{M&&I&&U&&!b&&q.fetchState==="Not-Started"&&n(Ua(!0))}),[M,I,U,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Ke=Je||b,z=r((e=>e.tenantState)),We=r((e=>z.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Qe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Za(e))),la=r((e=>Ga(e).skillsEnabled)),da=r((e=>Ha(e))),Ce=r((e=>La(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Va),[y,J]=o.useState(void 0),K=Y.uiState.currentChatSessionId,R=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(R),{inboxNotifications:W,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Rt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&R==="Completed"?(n(Be({chatSessionId:y})),J(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(R==="Error"&&(n(Be({chatSessionId:y})),J(void 0)))}),[n,t.state,s,R,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&W!=null){const e=`dashboard_${i.companyId}`;Pe(W.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,W]),o.useEffect((()=>{I&&_&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,_,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Qe===!1&&T.push("accounts_payable_aging"),Xe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),U===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Pa(e,T).fetchState)),ke=r((e=>Na(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{D(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,_),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&V.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ja(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Ka({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?We:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:U,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?_e("ai_cfo"):De(t)&&pe!=="completed"?_e("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:De(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ne,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Ve(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&V.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return N?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(V.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const H=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:H,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,G=At(B)&&B!=="command_center";if(B!=="command_center"&&!G||f[i.tenantId]==null||V.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),G&&f[i.tenantId]!=null){const H=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${H.month}-${H.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const Q=vt(e.type);yt(e.type)?(K!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Q}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),K===e&&J(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ge,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:He?`1px solid ${P.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Ut,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ht,{className:c.root,children:[d.jsx(Ft,{}),Ke===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ue,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ue,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((D=>Re(D))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(D,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Lt,{tenantEmailDomain:a,...j})},Vt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
1
|
+
import{j as d}from"./liveblocks-V5YQZeeY.js";import{a as o,R as Ta}from"./sentry-bpmZUW7k.js";import{u as Fe,j as r,g as $a,h as Ba,q as L}from"./core-BWRpGVdr.js";import{fE as Re,UH as xa,UI as Ze,g8 as Aa,gu as X,UJ as ee,jE as ye,jc as Te,UK as Da,UL as _a,gO as Ma,q3 as Ua,UM as Fa,UN as $e,gl as Ra,UO as x,fD as Za,gs as Ga,UP as Ha,UQ as La,UR as Va,US as Be,UT as ja,UU as xe,UV as Pa,ED as Na,gm as Oa,h1 as qa,cT as za,UW as Ya,UX as Ja,qG as Ka,g7 as Wa,j6 as Qa,UY as Xa,UZ as et,wL as at,gn as tt}from"./zeni-epic-state-BlWDBO75.js";import{w as nt,i as ot,a as st,g as rt,p as it,c as m,d as lt,u as dt,e as ct,f as ut,h as mt,j as Ct,o as pt,k as ht,l as ft,z as gt,m as V,n as h,q as Ae,r as bt,s as St,v as De,x as kt,y as _e,A as Et,B as wt,C as te,D as ae,E as It,F as vt,H as yt,L as Tt,I as $t,J as Bt,K as xt,M as At}from"./index-9pdMsp-M.js";import{u as Dt,q as _t,r as Mt,I as Ut,p as Me,t as Ft,D as Ue,s as ne}from"./mui-BmHHlwSU.js";import{u as Rt}from"./InboxNotificationsProvider-Cd4NxEtR.js";import{u as Zt}from"./useTaskManagerAccess-Bq9TDvwr.js";import{u as Gt}from"./expenseAutomationHelper-Dr99xbt1.js";import"./recharts-BXLxGQ-T.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="8edfed66-92cb-42ba-89a6-ad2a78766eba",a._sentryDebugIdIdentifier="sentry-dbid-8edfed66-92cb-42ba-89a6-ad2a78766eba")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},Ht=ne("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:te,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Lt=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[j,D]=Ta.useState(!1),[k,Ge]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[He,Le]=o.useState(!1),P=Dt(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(X()),n(ee()))}),[n,re]),o.useEffect((()=>{n(X()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Re(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),w=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Zt(E),le=ut(),I=mt(),M=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const Q=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(Q)}const G=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(G)}}),[e,l]),l})();o.useEffect((()=>{M&&I&&w&&(n(ye()),n(Te()))}),[n,M,I,i.tenantId,w]);const[O,Pe]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Oe}=u(m.isChargeCardFeatureEnabled),qe=Ct(i,Oe,ie),{isFeatureEnabled:ze}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:U}=u(m.isReferralFeatureEnabled),Ye=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>Da(e)));o.useEffect((()=>{const e=()=>{Le(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>_a(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ma(e))),{monthEndCloseChecksView:v}=g,Je=L("/signout")!==null,F=L("/:tenantEmailDomain/dashboard")!==null,ce=L("/:tenantEmailDomain/reports")!==null,b=L("/:tenantEmailDomain/onboarding/*")!==null,ue=Gt();o.useEffect((()=>{M&&I&&U&&!b&&q.fetchState==="Not-Started"&&n(Ua(!0))}),[M,I,U,q.fetchState,b]),o.useEffect((()=>{if(ue){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n($e(l))}}}),[ue,t.state]);const Ke=Je||b,z=r((e=>e.tenantState)),We=r((e=>z.fetchState==="Completed"?Ra(e):[])),{isFeatureEnabled:Qe}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Xe}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ta}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:na}=u(m.isDashboardSidebarNewYearAnimationEnabled),oa=r((e=>x(e).totalUnreadCount)),sa=r((e=>x(e).notificationDetailsByTab.tasks.uiState.unreadCount)),ra=r((e=>x(e).notificationDetailsByTab.comments.uiState.unreadCount)),ia=r((e=>x(e).reducedFetchCountState)),me=r((e=>x(e).notificationDetailsByTab.tasks.fetchCountState)),Y=r((e=>Za(e))),la=r((e=>Ga(e).skillsEnabled)),da=r((e=>Ha(e))),Ce=r((e=>La(e).routines)),ca=o.useMemo((()=>Ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[Ce]),ua=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ma=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:pe}=r(Va),[y,J]=o.useState(void 0),K=Y.uiState.currentChatSessionId,R=y!=null?Y.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(R),{inboxNotifications:W,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Rt(),Z=r((e=>x(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>Ca?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(y!=null)return he==="In-Progress"&&R==="Completed"?(n(Be({chatSessionId:y})),J(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(R==="Error"&&(n(Be({chatSessionId:y})),J(void 0)))}),[n,t.state,s,R,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&W!=null){const e=`dashboard_${i.companyId}`;Pe(W.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,W]),o.useEffect((()=>{I&&_&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(ja("task_manager","dashboard"))}),[I,_,b,me.fetchState,oe.tenantId,n]),o.useEffect((()=>{b||Z.fetchState!=="Not-Started"||n(xe({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[b,Z.fetchState,n]),o.useEffect((()=>{if(O!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n(xe({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:O},"comments")))}}),[O,Z.fetchState]);const pa={fetchStatus:ia,count:oa},T=[];Qe===!1&&T.push("accounts_payable_aging"),Xe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),U===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>Pa(e,T).fetchState)),ke=r((e=>Na(e).fetchState)),Ee=a!=null?gt.getSignedInUserTenant(a):null,we=r((e=>Ee?.tenantId!=null?Oa(e,Ee.tenantId):void 0)),ha=F&&(Se==="Completed"||Se==="Error")||ce&&(ke==="Completed"||ke==="Error")||!F&&!ce?void 0:"disabled",fa=o.useMemo((()=>qa(i.userRole)),[i.userRole]),ga=za(fa),$=e=>{D(e)},ba=Ye,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Ya(de.notificationSettings,E.userEmail,ie,i,_),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&V.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ja(i.tenantId,e)),f[i.tenantId]!=null){const p=h(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${g.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:p,referrer:g.currentSelectedView}})}n($e(g.currentSelectedView)),g.reconciliation.selectedAccountId!=null&&n(Ka({selectedAccountId:void 0}))}),[g.reconciliation.selectedAccountId,g.currentSelectedView,i.tenantId,v.monthEndCloseChecks?.auditSummary,v.monthEndCloseChecks?.reportEmailSentDate,f,a,t.state,t.pathname]),wa=o.useMemo((()=>({zIndex:k?12:Ae[2]})),[k]),Ia=w&&bt(t),Ie=d.jsx(St,{signedInUser:E,currentTenantId:z.currentTenantId??"",tenants:z.fetchState==="Completed"?We:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:U,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?_e("ai_cfo"):De(t)&&pe!=="completed"?_e("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:De(t)&&pe==="completed",isSettingsFeatureEnabled:ze,currentTenant:i,isVendorsTabVisible:ga,isZeniAccountEnabled:Ne,isChargeCardEnabled:qe,isTreasuryEnabled:ba,isNotificationsTabVisible:ka,notificationCountDetails:pa,isExpenseAutomationEnabledForUser:le,isAiCfoAccessEnabled:w,skillsEnabled:la&&w,routinesEnabled:da===!0&&w,routines:ca,selectedRoutineId:ua,onRoutineSelect:ma,onNotificationIconClick:()=>{$(!1);const e=je?sa===0&&ra>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=h(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{se.toggle()},handleTenantSelect:e=>{Ve(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&V.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return N?(n(ye()),n(et()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(X()),n(ee()),e.type==="invoicing")return C&&S(!1),n(at({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:h(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&It(e.type)&&S(!1),e.type==="ai_cfo"){if(V.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const H=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:H,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,G=At(B)&&B!=="command_center";if(B!=="command_center"&&!G||f[i.tenantId]==null||V.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),G&&f[i.tenantId]!=null){const H=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${H.month}-${H.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const Q=vt(e.type);yt(e.type)?(K!=null&&n(tt()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:p.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Q}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Qa(e)),K===e&&J(e)},handleLogOutClick:()=>{$(!1);const e=h(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:v,onPeriodChange:Ea,onCalendarOpen:Ge,aiCfoView:Y,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Wa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:He?`1px solid ${P.colors.grey2}`:""},children:d.jsxs(Mt,{style:{minHeight:wt},children:[d.jsx(Ut,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),d.jsx(jt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Me((e=>e.breakpoints.up("md"))),ya=Me((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Ht,{className:c.root,children:[d.jsx(Ft,{}),Ke===!1?d.jsxs(d.Fragment,{children:[ve||!F?null:va,d.jsxs("nav",{className:c.drawer,children:[ve?null:d.jsx(Ue,{container:window.document.body,variant:"temporary",open:j,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Ue,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:P.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((D=>Re(D))),j={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(D,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Lt,{tenantEmailDomain:a,...j})},Vt=ne((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
2
2
|
height: 20px;
|
|
3
3
|
width: 20px;
|
|
4
4
|
color: ${a=>a.theme.colors.primary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-DZUXZ-JO.js";import{a as d}from"./sentry-DfoGRlTp.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as D}from"./core-C4Vfz6Ll.js";import{fE as P,ZY as w,ZF as R,Ic as E,I6 as Z,Ia as A,H$ as H,ZH as K,I3 as ae,Ie as oe,I2 as z,Ih as Y,Id as C}from"./zeni-epic-state-DmXGRK_Y.js";import{z as O,w as M,b$ as pe,x as T,bV as G,c0 as le,a6 as J,c1 as se,c2 as ne}from"./index-CJ_pjNEa.js";import{u as Q}from"./mui-C0PYnbt1.js";import{u as X}from"./useEnsureVendorListLoaded-Bud-c91I.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js";import ie from"./NotFoundScreen-CxVO6BUm.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="f8ff2332-f4be-4727-88a8-bd3e334989c3",e._sentryDebugIdIdentifier="sentry-dbid-f8ff2332-f4be-4727-88a8-bd3e334989c3")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(Z(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${_}`]:[],eventCallback:(r,h,I)=>{r.endsWith(_)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(Z(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Y(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let x=[];N==="role"?x=ee.map((k=>({type:"attribute",subType:k.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(x=(g.persons?.selectedUsers??[]).map((k=>({type:"user",userId:k.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:x,operator:x.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Y(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function Ce(){return u.jsxs(te,{children:[u.jsx(D,{path:"/",element:u.jsx(ve,{})}),u.jsx(D,{path:"/new",element:u.jsx(F,{})}),u.jsx(D,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(D,{path:"*",element:u.jsx(ie,{})})]})}export{Ce as B};
|
|
1
|
+
import{j as u}from"./liveblocks-V5YQZeeY.js";import{a as d}from"./sentry-bpmZUW7k.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as q,n as te,o as D}from"./core-BWRpGVdr.js";import{fE as P,ZY as w,ZF as R,Ic as E,I6 as Z,Ia as A,H$ as H,ZH as K,I3 as ae,Ie as oe,I2 as z,Ih as Y,Id as C}from"./zeni-epic-state-BlWDBO75.js";import{z as O,w as M,b$ as pe,x as T,bV as G,c0 as le,a6 as J,c1 as se,c2 as ne}from"./index-9pdMsp-M.js";import{u as Q}from"./mui-BmHHlwSU.js";import{u as X}from"./useEnsureVendorListLoaded-CKZrwkQQ.js";import{i as re}from"./ReimbursementApprovalRuleDetailScreen-BzhkgPjS.js";import ie from"./NotFoundScreen-C94S-cmy.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="f8ff2332-f4be-4727-88a8-bd3e334989c3",e._sentryDebugIdIdentifier="sentry-dbid-f8ff2332-f4be-4727-88a8-bd3e334989c3")}catch{}})();const _="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(M(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),m=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{m?.updateStatus.fetchState==="Completed"&&o(E())}),[m]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(Z(!0,!0,!1)))}),[a,p,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const S={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${_}`]:[],eventCallback:(r,h,I)=>{r.endsWith(_)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...S})},L="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(L)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(H(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(M(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),m=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),S=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(Z(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||m!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,m,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const I={events:S.companyId!=null?[`private-encrypted-${S.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return S?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:S,location:t,navigate:l,isLoading:e,...I})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=m=>{const S=[];return m.forEach((r=>{const h=r.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),I=r.actors.selectedNonUsers.map((b=>{const g=!!re(b.value);return{type:g?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(I);S.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const m={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Y(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(z(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const Se=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=T(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const b=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let x=[];N==="role"?x=ee.map((k=>({type:"attribute",subType:k.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(x=(g.persons?.selectedUsers??[]).map((k=>({type:"user",userId:k.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:x,operator:x.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,m=p.vendorCriteria,S=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=m?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:m?.operator.selectedOption??"is",vendorIds:h});const I=S?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:I}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Y(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(me,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=q(),a=O.getSignedInUser(),n=Q(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(Se,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function Ce(){return u.jsxs(te,{children:[u.jsx(D,{path:"/",element:u.jsx(ve,{})}),u.jsx(D,{path:"/new",element:u.jsx(F,{})}),u.jsx(D,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(D,{path:"*",element:u.jsx(ie,{})})]})}export{Ce as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-DZUXZ-JO.js";import{h as K,u as le,g as X,i as ee,j as v,N as Q,l as Y,q as aa,n as na,o as y}from"./core-C4Vfz6Ll.js";import{fE as q,Zf as _e,bm as It,S$ as ia,bk as vt,bH as de,Zg as kt,Hs as wt,IR as Re,I3 as oa,bj as Ce,Zh as la,Zi as sa,c6 as ra,Zj as ca,l$ as xt,Zk as Bt,Zl as Ct,Jj as Ue,HL as xe,Zm as da,Hg as et,Zn as ua,Nb as pa,Hk as ma,Hq as At,Zo as Se,Zp as Ge,IS as Ze,HI as Dt,Zq as ba,Zr as ha,IV as Me,Zs as ga,I$ as Sa,Zt as Et,Iu as tt,Iz as ya,Zu as fa,Zv as ce,Zw as Tt,Zx as jt,Zy as Pt,gV as Ia,HQ as Ve,cE as Ft,Zz as va,gg as ka,ZA as wa,ZB as xa,dZ as Rt,dY as Vt,ZC as Ne,ZD as Ba,ZE as Ca,XC as Oe,ZF as Aa,XD as ie,XE as ze,ZG as Da,ZH as Ea,ZI as Ta,IB as at,Iy as ja,ZJ as Pa,ZK as Fa,ZL as Ra,Ik as Va,ZM as $a,ZN as La,cs as $t,d8 as Lt,ma as _a,bM as Ua,bn as _t,bN as Ut,Gw as Ga,ZO as Za,M_ as Ma,N4 as Na,CA as Oa,IT as za,Jq as Ha,mn as ge,ZP as Wa,ZQ as Gt,mR as qa,mh as Zt,mC as Mt,mB as nt,bC as pe,bL as Ja,ZR as Ka,ZS as ye,kN as Xa,ZT as it,ZU as Ya,kR as Qa,la as en,JE as tn,ZV as an,mK as nn,Ju as on,ZW as ot,Jy as ln,JD as sn,JB as rn,Js as cn,ZX as Nt,HB as dn,ZY as un,ZZ as pn,gF as mn,gE as bn,gD as hn,mq as gn,mI as lt,mT as Sn,v2 as yn,mz as fn,Jw as In,kX as vn,mY as kn,Z_ as wn,kP as xn,uV as Bn,Z$ as Cn,Iq as An,bI as Dn,bq as En,U$ as Tn,db as jn,da as Pn,cD as Fn,cK as Rn}from"./zeni-epic-state-DmXGRK_Y.js";import{z as V,V as fe,ar as He,p as oe,c as f,bk as We,a6 as se,K as A,a7 as Ae,m as E,bx as Vn,a3 as W,au as qe,n as D,a0 as Ie,by as st,bz as rt,bA as $n,ay as Ln,ae as _n,aR as Un,aa as Ot,G as De,af as Je,bB as Gn,ad as zt,bC as Zn,ap as Mn,S as Ht,w as Nn,bD as On,bE as zn,bF as Hn,bG as Wn,bH as qn,bI as Jn,bJ as Kn,bK as Xn,bL as Yn,g as Qn,bM as ei,bu as ti,bN as ai,ah as ni,bO as ii,j as oi}from"./index-CJ_pjNEa.js";import{u as ue,n as _,S as li}from"./mui-C0PYnbt1.js";import{A as ct}from"./AddressScreen-BbgME8aO.js";import{g as ne,a as Ee,i as Wt,V as Ke,b as Xe,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-BZbvzqXc.js";import{a as g}from"./sentry-DfoGRlTp.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-k11tYjVi.js";import{u as qt}from"./useInitialThreadRequest-BVMcY486.js";import{u as di}from"./BusinessVerificationPageScreen-8VbyEZWD.js";import Be from"./NotFoundScreen-CxVO6BUm.js";import{D as ui}from"./DrawerScreen-CmgVB1Zi.js";import{M as Jt}from"./MobileAppDrawer-B4_Hh2uX.js";import{F as Kt}from"./FeaturePreviewScreen-Cnh2Fe6t.js";import{S as Te}from"./SetupPagesScreen-DzLiX5R5.js";import{B as pi}from"./BillPayApprovalRoutes-GN_PKZBM.js";import{F as mi}from"./ScreenRoutes-Cix6ynkH.js";import"./recharts-rN5v_P87.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./utils-CmKqkYr5.js";import"./routePaths-DYebh4Li.js";import"./InboxNotificationsProvider-CJt6vmnU.js";import"./useTaskManagerAccess-Cp8R2Cu9.js";import"./analyticsHelper-CPHVprda.js";import"./useEnsureVendorListLoaded-Bud-c91I.js";import"./ReimbursementApprovalRuleDetailScreen-CQJ7WhRf.js";import"./getLocaleForTenant-DJIJUZ-c.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]="fa6d556b-ed19-49e8-a469-fda520297d32",e._sentryDebugIdIdentifier="sentry-dbid-fa6d556b-ed19-49e8-a469-fda520297d32")}catch{}})();const bi=Y((function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=W(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(At(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=W(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ct({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:l}))}}}))(Vn);function hi(){const e=K(),t=le(),l=X(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>q(U))),s=v((U=>_e(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:N}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),Z=h&&de(u?.loggedInUserRoleMap),L=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||Z||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,Z,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),t(wt(n??"",N,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,N,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,N,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:U=>(M=>{n!=null&&M.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Ot(100,58)},ut=Y((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Me(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Ze(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=K(),{billId:n}=ee(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(We.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>q(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[N,G]=g.useState(!1),[O,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let Z=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(Z=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Ze(!0))}),[n,t]),g.useEffect((()=>{Z==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[B,k,u,n,t,S,I,b]);const M={onOkClick:()=>{if(G(!1),!O)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Me(O,m,n))},onCancelClick:()=>{if(G(!1),!O)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:O,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Z==="Error"||J.fetchState==="Error")return a.jsx(Be,{});if(Z!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,N?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:M,isEditPopup:!0}):null,o==="small"||H?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-V5YQZeeY.js";import{h as K,u as le,g as X,i as ee,j as v,N as Q,l as Y,q as aa,n as na,o as y}from"./core-BWRpGVdr.js";import{fE as q,Zf as _e,bm as It,S$ as ia,bk as vt,bH as de,Zg as kt,Hs as wt,IR as Re,I3 as oa,bj as Ce,Zh as la,Zi as sa,c6 as ra,Zj as ca,l$ as xt,Zk as Bt,Zl as Ct,Jj as Ue,HL as xe,Zm as da,Hg as et,Zn as ua,Nb as pa,Hk as ma,Hq as At,Zo as Se,Zp as Ge,IS as Ze,HI as Dt,Zq as ba,Zr as ha,IV as Me,Zs as ga,I$ as Sa,Zt as Et,Iu as tt,Iz as ya,Zu as fa,Zv as ce,Zw as Tt,Zx as jt,Zy as Pt,gV as Ia,HQ as Ve,cE as Ft,Zz as va,gg as ka,ZA as wa,ZB as xa,dZ as Rt,dY as Vt,ZC as Ne,ZD as Ba,ZE as Ca,XC as Oe,ZF as Aa,XD as ie,XE as ze,ZG as Da,ZH as Ea,ZI as Ta,IB as at,Iy as ja,ZJ as Pa,ZK as Fa,ZL as Ra,Ik as Va,ZM as $a,ZN as La,cs as $t,d8 as Lt,ma as _a,bM as Ua,bn as _t,bN as Ut,Gw as Ga,ZO as Za,M_ as Ma,N4 as Na,CA as Oa,IT as za,Jq as Ha,mn as ge,ZP as Wa,ZQ as Gt,mR as qa,mh as Zt,mC as Mt,mB as nt,bC as pe,bL as Ja,ZR as Ka,ZS as ye,kN as Xa,ZT as it,ZU as Ya,kR as Qa,la as en,JE as tn,ZV as an,mK as nn,Ju as on,ZW as ot,Jy as ln,JD as sn,JB as rn,Js as cn,ZX as Nt,HB as dn,ZY as un,ZZ as pn,gF as mn,gE as bn,gD as hn,mq as gn,mI as lt,mT as Sn,v2 as yn,mz as fn,Jw as In,kX as vn,mY as kn,Z_ as wn,kP as xn,uV as Bn,Z$ as Cn,Iq as An,bI as Dn,bq as En,U$ as Tn,db as jn,da as Pn,cD as Fn,cK as Rn}from"./zeni-epic-state-BlWDBO75.js";import{z as V,V as fe,ar as He,p as oe,c as f,bk as We,a6 as se,K as A,a7 as Ae,m as E,bx as Vn,a3 as W,au as qe,n as D,a0 as Ie,by as st,bz as rt,bA as $n,ay as Ln,ae as _n,aR as Un,aa as Ot,G as De,af as Je,bB as Gn,ad as zt,bC as Zn,ap as Mn,S as Ht,w as Nn,bD as On,bE as zn,bF as Hn,bG as Wn,bH as qn,bI as Jn,bJ as Kn,bK as Xn,bL as Yn,g as Qn,bM as ei,bu as ti,bN as ai,ah as ni,bO as ii,j as oi}from"./index-9pdMsp-M.js";import{u as ue,n as _,S as li}from"./mui-BmHHlwSU.js";import{A as ct}from"./AddressScreen-CiPLLpNX.js";import{g as ne,a as Ee,i as Wt,V as Ke,b as Xe,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-YfGiQgSo.js";import{a as g}from"./sentry-bpmZUW7k.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-E2UGdnp9.js";import{u as qt}from"./useInitialThreadRequest-Df-inltN.js";import{u as di}from"./BusinessVerificationPageScreen-71JxUYXB.js";import Be from"./NotFoundScreen-C94S-cmy.js";import{D as ui}from"./DrawerScreen-DH40ycW6.js";import{M as Jt}from"./MobileAppDrawer-rCVKr3J3.js";import{F as Kt}from"./FeaturePreviewScreen-B9UACzAC.js";import{S as Te}from"./SetupPagesScreen-DPnnq4jj.js";import{B as pi}from"./BillPayApprovalRoutes-Bhwrq5tr.js";import{F as mi}from"./ScreenRoutes-vTLuTGuW.js";import"./recharts-BXLxGQ-T.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.js";import"./routePaths--TXDBUUo.js";import"./InboxNotificationsProvider-Cd4NxEtR.js";import"./useTaskManagerAccess-Bq9TDvwr.js";import"./analyticsHelper-Cn2rORl_.js";import"./useEnsureVendorListLoaded-CKZrwkQQ.js";import"./ReimbursementApprovalRuleDetailScreen-BzhkgPjS.js";import"./getLocaleForTenant-BNAJG7gN.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]="fa6d556b-ed19-49e8-a469-fda520297d32",e._sentryDebugIdIdentifier="sentry-dbid-fa6d556b-ed19-49e8-a469-fda520297d32")}catch{}})();const bi=Y((function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=W(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ce(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=la(l.billActivities,sa(t.currentTenant),n);i=S,d=h}const p=ra(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&ca(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:E,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=D(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{E.trackBillPayDeleteBill(l,o),e(At(l))},cancelAndDeleteBill:(o,s)=>{s===!0?E.trackBillPayCancelAndDeleteBill(l,o):E.trackBillPayCancelBill(l),e(ma(l,s))},onSaveRealTimeApprovals:o=>{e(pa(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ua({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(et(l,o.type,"")):e(et(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Ee(u,o,s),d=D(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=W(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=D(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(da({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Ct({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Bt({billId:l}))}}}))(Vn);function hi(){const e=K(),t=le(),l=X(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>q(U))),s=v((U=>_e(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&It(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,C]=g.useState(!1),[I,j]=g.useState(!1),[B,T]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:N}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:G}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),Z=h&&de(u?.loggedInUserRoleMap),L=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{N&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?T(!1):T(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||Z||s.allApprovers.find((U=>U.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,w,Z,o.isZeni,z,r]),g.useEffect((()=>{n!=null&&t(kt(n))}),[n]),g.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(C(!0),t(wt(n??"",N,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(j(!0),t(Re(!1,N,L,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,N,L,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(Q,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ae,{analytics:E,onLoad:U=>(M=>{n!=null&&M.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:N,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:G,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Ot(100,58)},ut=Y((function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${zt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:E,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Me(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Ze(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=K(),{billId:n}=ee(),c=X(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(f.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(f.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(f.billPaySetupShowInternationalPaymentByWise),{configValue:C}=p(We.zeniAssistConfig),I=C.user_ids!=null&&i?.userId!=null&&C.user_ids.includes(i?.userId),j=v((P=>q(P)));di();const[B,T]=g.useState(!1),[k,$]=g.useState(!1),[N,G]=g.useState(!1),[O,z]=g.useState(),w=v((P=>Ge(P,m,h,n)));let Z=w.fetchState,L=w.file,H=w.showAutofill;const J=v((P=>_e(P,n??"")));u===!1&&(Z=J.fetchState,L=J.transactionDetails?.attachments?.[0],H=!1);const U=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;g.useEffect((()=>{n==null&&t(Ze(!0))}),[n,t]),g.useEffect((()=>{Z==="Not-Started"&&(u&&k?$(!1):!u&&B&&T(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(T(!0),t(wt(n,S,I,!1)),t(Dt(n)),k||($(!0),t(Re(!1,S,I,b,n)))),u&&!k&&($(!0),t(Re(!1,S,I,b,n)))}),[B,k,u,n,t,S,I,b]);const M={onOkClick:()=>{if(G(!1),!O)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Me(O,m,n))},onCancelClick:()=>{if(G(!1),!O)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:O,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(j.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,j.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Z==="Error"||J.fetchState==="Error")return a.jsx(Be,{});if(Z!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Pe,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:G,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(je,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:te,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx($n,{}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:n==null})})]});{const P=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(st,{fallback:te,children:a.jsxs(je,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,N?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:M,isEditPopup:!0}):null,o==="small"||H?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Pe,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:L,showAutofill:H,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,w),setShowConfirmationPopup:G,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=Gn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(vi,{children:`${$e.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=_.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as O}from"./sentry-
|
|
1
|
+
import{a as O}from"./sentry-bpmZUW7k.js";import{u as K,j as b,h as se,g as oe,i as ie,N as ce,l as re}from"./core-BWRpGVdr.js";import{fE as B,I6 as ue,Ik as de,Lw as pe,Om as le,P0 as me,PR as fe,_7 as ye,B$ as Se,T3 as ge,_8 as Ie,_9 as be,_a as he,_b as Te,_c as Ce,_d as De,W9 as Oe,Zd as ke,Wo as Ve,MI as Ae,MA as _e,Wp as we,ME as Ne,mH as Fe,gF as ve,gE as Ee,gD as xe,v2 as ze,uV as Be,uS as Pe,mz as Re,C8 as Me,C6 as P,bC as R,Ck as M,cC as Le}from"./zeni-epic-state-BlWDBO75.js";import{bV as Ue,V as je,p as Ge,bk as We,z,a7 as Ke,m as L,x as E,S as x,bX as Ze,ad as $e,n as U,aF as j}from"./index-9pdMsp-M.js";import{n as qe}from"./mui-BmHHlwSU.js";import{j as A}from"./liveblocks-V5YQZeeY.js";import{d as G}from"./routePaths--TXDBUUo.js";import{M as He}from"./MobileAppDrawer-rCVKr3J3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},c=new e.Error().stack;c&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[c]="b9357a02-6475-4821-bcd3-3e7d9471cccb",e._sentryDebugIdIdentifier="sentry-dbid-b9357a02-6475-4821-bcd3-3e7d9471cccb")}catch{}})();function it(){const e=K(),c=b((u=>B(u))),a=c?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:p}=Ue(a),l=b((u=>u.billPaySetupApproverViewState.fetchState));O.useEffect((()=>{a==null||p||l==="Not-Started"&&e(ue(!0,!0,s))}),[a,p,s,l,e])}function W(e,c,a,s=!1){switch(c){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(le(a,!0,s));break;case"charge_cards":e(pe(a,!0,s));break;default:e(de(a,!0,s))}}const Xe=qe.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-
|
|
1
|
+
import{j as g}from"./liveblocks-V5YQZeeY.js";import{a as r}from"./sentry-bpmZUW7k.js";import{u as he,h as Ce,g as fe,j as B,i as Se,l as ge}from"./core-BWRpGVdr.js";import{ea as be,a as Pe,eb as ye,z as we,ed as Ie,ef as W,eg as Ee,bq as G,a7 as ke,m as j,eh as z,er as xe,G as Te,S as Ae,w as Ue,ek as ve,el as Oe,au as _e,eo as Qe,ep as Fe,bm as De,eq as je}from"./index-9pdMsp-M.js";import{gJ as $e,fD as J,fE as Le,g7 as Ve,jl as qe,jh as Re,fF as H,gt as Me,gn as Be,gp as N,gv as ze,gw as He,gx as Ne,gy as We,gz as Ge}from"./zeni-epic-state-BlWDBO75.js";import{D as Je,n as L,v as Ye,S as Ke}from"./mui-BmHHlwSU.js";import"./recharts-BXLxGQ-T.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./utils-CXFQdt3d.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]="1cc48d64-afba-4954-a9ea-4b75949815d8",t._sentryDebugIdIdentifier="sentry-dbid-1cc48d64-afba-4954-a9ea-4b75949815d8")}catch{}})();const Y="chat-response-generated",K="cards/ask",X="card_policy_hero";function $(t){return`/${t}/cards`}function Z(t){return`/${t}/cards/policy`}const Xe=ge((function(t,s){const d=J(t),l=s.isSubmitting,u=Oe(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&d.uiState.currentChatSessionId==null,aiCfoView:d,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Qe(),emailLinkQuestion:s.emailLinkQuestion,autoSubmitEmailLinkQuestion:s.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:s.onEmailLinkQuestionProcessed,isFileUploadEnabled:s.isFileUploadEnabled,isUploadPromoVisible:s.isUploadPromoVisible,onUploadPromoClose:s.onUploadPromoClose,...u}}),(function(t,s){const{location:d,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:x,isCardPolicyEnabled:T,cardPolicyPageContext:A}=s,f=l.tenantEmailDomain,c=d.state?.referrer,h=c===X?Z(f):$(f);return{onEventReceived:(a,n)=>{if(a===Y&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=He(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(C,y);m!=="answer"?j.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,je(p,U),e.metadata.message_id??null):j.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,Ne(e.visualization?.type??"")??null,y,e.summarized_title,e.metadata.message_id??null),t(We({chatSessionId:e.metadata.chat_session_id,responseType:m,fetchState:{fetchState:"Completed",error:void 0}})),t(Ge({chatSessionId:e.metadata.chat_session_id,answerPayload:e,userId:u}))}},onSubmit:(a,n,e,m)=>{a&&De(t,a,n,P,C,u,m,e,A)},updateCurrentInput:a=>{t(N(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(ze(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...d.state}}),t(N(""))},togglePageView:()=>{o(h,{state:W(d.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(Be()),o((function(a){return`/${a}/${K}`})(f),{state:{...d.state}})},onToggleCotCollapsed:(a,n)=>{t(Me({questionAnswerId:a,isCollapsed:n}))},...Fe(t,{isAiCardCreationEnabled:x,isCardPolicyEnabled:T,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(f),{state:{...d.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${f}/cards/policy`,{state:{...d.state}})}})}}))(Ue(ve)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Te.getLocalizedStrings(),k=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:d}=Pe(),l=he(),u=Ce(),o=fe(),[P,C]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:A,onCardPolicyVendorSearchTextChange:f}=ye();r.useEffect((()=>{l($e())}),[l]);const c=B((i=>J(i))),h=we.getSignedInUser(),{session_id:a}=Se(),n=B((i=>Le(i))),e=c.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=Ie({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,v=!!b?.aiCfoShouldSubmit,w=b?.referrer===X,se=w?"card_policy":void 0,ae=r.useMemo((()=>({title:w?Ze:k,subtitle:w?tt:et})),[w]),[oe,O]=r.useState(null),[ne,_]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(O(p),_(v),Q.current=!0)}),[p,v]);const ie=r.useCallback((()=>{O(null),_(!1),u(o.pathname,{replace:!0,state:W(o.state)})}),[o.pathname,o.state,u]),re=n.masterTOSInfo,S=re?.isMasterTOSAccepted??!1,E=r.useRef(null);r.useEffect((()=>{if(S&&E.current!=null){const{question:i,shouldSubmit:I}=E.current;E.current=null,O(i),_(I),Q.current=!1}}),[S]);const{visitedSessions:V}=Ee(e),F=c.fetchState,D=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=e!=null?c.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",R=e==null||(c.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),M=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(M,e),de=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,I){return`/${i}/${K}/${I}`})(m,e),{state:{...o.state},replace:!0})}),[e,a,m,u,o.state]),r.useEffect((()=>{a!=null&&e==null&&a!=="new_chat"&&l(Ve({sessionId:a,agentId:"controller"}))}),[]);const ce=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${Y}`)),eventCallback:(i,I,pe)=>pe.onEventReceived(i,I)})),[V]);if(r.useEffect((()=>{F!=="In-Progress"&&D&&l(qe())}),[F,D,l]),r.useEffect((()=>{e!=null&&q!=="In-Progress"&&R&&h!=null&&F==="Completed"&&!D&&l(Re(e,h.userId))}),[q,R,e,h,l]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ue=a??"new_chat",me=e!=null&&c.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return g.jsxs(at,{children:[g.jsx(ke,{analytics:j,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Xe,{answerExportEndPoint:s,...ce,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:M,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:A,openOnboardingPage:()=>C(!0),userId:h.userId,setIsAiCfoOpen:d,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:de,customPageTitle:k,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:f,cardPolicyPageContext:se}):g.jsx(z,{isTOSAccepted:S,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{u(w?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:v}),l(H(n.userRoleId)))}}),g.jsx(Je,{anchor:"right",open:P,transitionDuration:250,PaperProps:{component:ot,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>C(!1),children:g.jsx(st,{onClick:i=>i.stopPropagation(),children:g.jsx(z,{isTOSAccepted:S,acceptMasterTOSState:c.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>C(!1),onCompleteClick:()=>{S||n.userRoleId==null||l(H(n.userRoleId)),C(!1)}})})})]})},st=L(Ke)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-DZUXZ-JO.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Qe,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-C4Vfz6Ll.js";import{fR as _t,a0V as cs,g1 as Pt,bq as Fe,a0W as is,a0X as ds,fG as hn,a0Y as _n,fP as Pn,a0Z as wn,a0_ as Tn,a0$ as vn,a10 as Fn,fQ as xn,g0 as Ln,a11 as Bn,a12 as ls,fW as us,fV as ms,a13 as Cs,KB as Rn,g3 as ia,a14 as ps,a15 as hs,fI as fs,fH as gs,gg as Ye,fY as On,fX as Un,a16 as bs,fZ as Ss,K7 as ys,K6 as Is,Ka as ks,Kc as Es,g9 as As,fD as jn,a17 as Ds,a18 as _s,ge as Mn,a19 as Ps,gf as St,Ki as ws,Kf as Ts,fE as ge,a1a as Za,dY as xe,dg as Le,dZ as Be,g_ as da,cz as la,a1b as ua,a1c as wt,Dk as Ga,m7 as $a,a1d as Ka,KR as Ia,g4 as Xe,KT as Tt,lZ as Nn,a1e as ma,KF as Da,a1f as vs,a1g as Fs,KI as qa,a1h as xs,_4 as Xa,f$ as Vn,KO as ga,iq as Ls,a1i as Hn,fS as Ca,bn as Bs,a1j as Rs,gF as Qa,gE as Ja,Ll as Os,gD as et,a1k as Gn,cs as $n,d8 as Us,_3 as Pa,LW as Kn,a1l as fn,Lw as _a,a1m as zn,LX as js,_u as Ms,LY as Ns,N4 as Vs,CA as Hs,M_ as Gs,a1n as $s,KS as oa,a1o as Ks,a1p as zs,a1q as Ys,a1r as Ws,a1s as Zs,a1t as vt,a1u as qs,L6 as Yn,K$ as Xs,a1v as Qs,h0 as Js,a1w as Wn,Lf as Zn,Lj as qn,g$ as eo,a1x as ao,LI as Xn,a1y as to,a1z as no,a1A as ro,Lh as Qn,L2 as Jn,KL as er,Lb as ar,L9 as tr,Ld as so,a1B as nr,a1C as oo,gb as co,gc as io,gd as lo,a1D as at,g5 as rr,da as Ft,a1E as uo,a1F as mo,a1G as Co,a1H as po,Lr as yt,LP as ho,LL as fo,Ln as go,LN as bo,LD as So,LF as yo,a1I as sr,LV as Ha,S$ as Io,a1J as ko,a1K as Eo,a1L as Ao,a1M as or,a1N as Do,Mg as _o,Lv as cr,Lq as Ne,Lu as Po,a1O as wo,a1P as To,KC as vo,a1Q as ir,f_ as dr,a1R as Fo,KE as xo,KD as gn,a1S as Lo,a1T as Bo,a1U as Ro,Wa as Oo,a1V as xt,a1W as Uo,xz as lr,mH as jo,ie as Mo,Ml as No,a1X as ur,fM as Vo,fN as Ho,a1Y as Go,dN as $o,g2 as Ko,Mb as zo,M5 as qe,bm as Yo,bH as Wo,cE as Zo,bI as qo,U$ as Xo}from"./zeni-epic-state-DmXGRK_Y.js";import{V as Re,df as mr,a3 as we,dg as Cr,dh as pr,di as Qo,G as aa,ar as Lt,dj as Jo,dk as ec,a as hr,e as fr,aq as gr,n as Ee,p as de,c as q,l as Sa,dl as br,dm as ac,dn as tc,z as te,a6 as wa,d4 as tt,dp as nc,dq as rc,dr as sc,a0 as Ta,bk as Je,bH as Bt,ds as oc,aa as va,X as nt,m as ee,w as rt,dt as cc,bT as ba,du as It,dv as ic,a7 as Rt,dw as dc,ad as Sr,au as kt,dx as lc,ap as yr,O as Ir,S as kr,bp as uc,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,K as za,dE as bc,dF as Sc,q as pt,g as yc,dG as Ic,dH as kc,dI as Ec,ah as Ac,dJ as Dc,dK as _c,j as Pc}from"./index-CJ_pjNEa.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-C0PYnbt1.js";import{a as r}from"./sentry-DfoGRlTp.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-k11tYjVi.js";import{M as Ae}from"./MobileAppDrawer-B4_Hh2uX.js";import{d as Ut}from"./recharts-rN5v_P87.js";import{g as _e,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as Tc,i as jt,P as vc,j as Mt,s as ya,k as Dr,l as ca,m as _r,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-DzLiX5R5.js";import{u as wr}from"./useInitialThreadRequest-BVMcY486.js";import st from"./NotFoundScreen-CxVO6BUm.js";import{u as Nt}from"./useChargeCardPusherEvents-Bf7Vv0PE.js";import{n as Sn}from"./utils-CmKqkYr5.js";import{t as Lc}from"./AddressScreen-BbgME8aO.js";import"./analytics-C4ICDJLl.js";import"./plaid-hQES7k9Y.js";import"./dnd-kAQqqaX2.js";import"./stripe-cKAAJElX.js";import"./lottie-txhqSe8x.js";import"./lexical-SeD-pdYj.js";import"./pdf-bOGTjHnz.js";import"./InboxNotificationsProvider-CJt6vmnU.js";import"./useTaskManagerAccess-Cp8R2Cu9.js";import"./BusinessVerificationPageScreen-8VbyEZWD.js";import"./routePaths-DYebh4Li.js";import"./analyticsHelper-CPHVprda.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="a18b9927-5ee6-49bb-9be3-f79a50b12c7f",e._sentryDebugIdIdentifier="sentry-dbid-a18b9927-5ee6-49bb-9be3-f79a50b12c7f")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=le(),a=d((t=>_t(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const D=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>Tn(P.cardPolicyState))),S=d((P=>vn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),vr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(Tr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),Y=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),v=r.useRef(j);r.useEffect((()=>{const P=v.current;v.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const T=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Qo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:T,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:Y,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Qe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((T=>{A(T)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((T=>bs(T))),O=d((T=>_n(T.cardPolicyState))),U=d((T=>Pn(T.cardPolicyState))),S=d((T=>wn(T.cardPolicyState))),c=d((T=>Tn(T.cardPolicyState))),p=d((T=>vn(T.cardPolicyState))),x=d((T=>Fn(T.cardPolicyState))),E=d((T=>xn(T.cardPolicyState))),I=d((T=>_t(T.cardPolicyState))),k=d((T=>Rn(T))),V=d((T=>t!=null?Ss(T.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const T=C.detailFetchState.fetchState;C.templateId===t&&(T==="Completed"||T==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),vr();const y=d((T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((T=>!mr(T.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Jo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((T=>{M(T)}),[]),j=r.useMemo((()=>Ut((T=>{s(Pt(T))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((T=>{j(T)}),[j]),H=C.updateFetchState.fetchState,Y=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??Y;e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e,Y]),Z=r.useCallback((()=>{e(Y)}),[e,Y]),N=r.useCallback((T=>{if(t==null)return;const P=Cr(T);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const T=$.current;$.current=H,H==="Completed"&&T!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))}),[s,H,e,Y]);const v=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Qe,{to:"..",replace:!0}):G!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:v,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:Y,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:v,setIsAiCfoOpen:T}=hr(),P=fr(),ae=gr(),Ce=d((X=>jn(X))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:J,isResolved:Te}=xr("card_policy"),Ie=r.useMemo((()=>Fr(J,Te,3)),[J,Te]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!v,he=r.useCallback((X=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:X,aiCfoShouldSubmit:X!=null&&X.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((X=>{X.trim().length!==0&&(be(""),he(X))}),[he]),Q=r.useCallback((()=>{const X=re.trim();X.length!==0&&(be(""),he(X))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((X=>{be(X)}),[]),fe=r.useCallback((()=>{T(!0)}),[T]),ve=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&Y)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:Q,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:ve,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,Y,_,Ce,De,ve,fe,oe,Se,Q,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),z=r.useCallback((h=>{t(Ts(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:G,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Yc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((J=>ge(J))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((J=>Za(J).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:D,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((J=>da(J,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((J=>ua(J))),F=d((J=>J.classListState.fetchState)),i=!B&&E&&C,g=d((J=>wt(J,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((J=>L!=null?Ga(J.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((J=>j!=null?$a(J.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,Y=d((J=>H!=null?Ga(J.userRoleState,H):void 0)),_=Y?.accountingClassIDs[0],Z=d((J=>_!=null?$a(J.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const J=_e(s.tenantEmailDomain,a,t,M,l);e(J)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Xe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(Tt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const v=()=>{if(t!=null&&a!=null){n(Ka());const J=_e(s.tenantEmailDomain,a,t);e(J)}},T=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(T,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:v,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:Z?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",$t="charge-card-renamed",Wc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Zc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(vs({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Xc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((D=>ge(D))),[f,b]=r.useState(!1),m=d((D=>ma(D))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const D=we(n.state?.pathnameStackToGoBack),C=D.poppedPathname??Qc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Qc=e=>`/${e}/cards`,Jc={containerWidth:new va(100,58)},ei=({appContent:e})=>{const a=Ta(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((Z=>ge(Z)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Je.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,z,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Xa()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),Y=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{_(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Ja(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Qa(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
|
|
1
|
+
import{j as o}from"./liveblocks-V5YQZeeY.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Qe,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-BWRpGVdr.js";import{fR as _t,a0V as cs,g1 as Pt,bq as Fe,a0W as is,a0X as ds,fG as hn,a0Y as _n,fP as Pn,a0Z as wn,a0_ as Tn,a0$ as vn,a10 as Fn,fQ as xn,g0 as Ln,a11 as Bn,a12 as ls,fW as us,fV as ms,a13 as Cs,KB as Rn,g3 as ia,a14 as ps,a15 as hs,fI as fs,fH as gs,gg as Ye,fY as On,fX as Un,a16 as bs,fZ as Ss,K7 as ys,K6 as Is,Ka as ks,Kc as Es,g9 as As,fD as jn,a17 as Ds,a18 as _s,ge as Mn,a19 as Ps,gf as St,Ki as ws,Kf as Ts,fE as ge,a1a as Za,dY as xe,dg as Le,dZ as Be,g_ as da,cz as la,a1b as ua,a1c as wt,Dk as Ga,m7 as $a,a1d as Ka,KR as Ia,g4 as Xe,KT as Tt,lZ as Nn,a1e as ma,KF as Da,a1f as vs,a1g as Fs,KI as qa,a1h as xs,_4 as Xa,f$ as Vn,KO as ga,iq as Ls,a1i as Hn,fS as Ca,bn as Bs,a1j as Rs,gF as Qa,gE as Ja,Ll as Os,gD as et,a1k as Gn,cs as $n,d8 as Us,_3 as Pa,LW as Kn,a1l as fn,Lw as _a,a1m as zn,LX as js,_u as Ms,LY as Ns,N4 as Vs,CA as Hs,M_ as Gs,a1n as $s,KS as oa,a1o as Ks,a1p as zs,a1q as Ys,a1r as Ws,a1s as Zs,a1t as vt,a1u as qs,L6 as Yn,K$ as Xs,a1v as Qs,h0 as Js,a1w as Wn,Lf as Zn,Lj as qn,g$ as eo,a1x as ao,LI as Xn,a1y as to,a1z as no,a1A as ro,Lh as Qn,L2 as Jn,KL as er,Lb as ar,L9 as tr,Ld as so,a1B as nr,a1C as oo,gb as co,gc as io,gd as lo,a1D as at,g5 as rr,da as Ft,a1E as uo,a1F as mo,a1G as Co,a1H as po,Lr as yt,LP as ho,LL as fo,Ln as go,LN as bo,LD as So,LF as yo,a1I as sr,LV as Ha,S$ as Io,a1J as ko,a1K as Eo,a1L as Ao,a1M as or,a1N as Do,Mg as _o,Lv as cr,Lq as Ne,Lu as Po,a1O as wo,a1P as To,KC as vo,a1Q as ir,f_ as dr,a1R as Fo,KE as xo,KD as gn,a1S as Lo,a1T as Bo,a1U as Ro,Wa as Oo,a1V as xt,a1W as Uo,xz as lr,mH as jo,ie as Mo,Ml as No,a1X as ur,fM as Vo,fN as Ho,a1Y as Go,dN as $o,g2 as Ko,Mb as zo,M5 as qe,bm as Yo,bH as Wo,cE as Zo,bI as qo,U$ as Xo}from"./zeni-epic-state-BlWDBO75.js";import{V as Re,df as mr,a3 as we,dg as Cr,dh as pr,di as Qo,G as aa,ar as Lt,dj as Jo,dk as ec,a as hr,e as fr,aq as gr,n as Ee,p as de,c as q,l as Sa,dl as br,dm as ac,dn as tc,z as te,a6 as wa,d4 as tt,dp as nc,dq as rc,dr as sc,a0 as Ta,bk as Je,bH as Bt,ds as oc,aa as va,X as nt,m as ee,w as rt,dt as cc,bT as ba,du as It,dv as ic,a7 as Rt,dw as dc,ad as Sr,au as kt,dx as lc,ap as yr,O as Ir,S as kr,bp as uc,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,K as za,dE as bc,dF as Sc,q as pt,g as yc,dG as Ic,dH as kc,dI as Ec,ah as Ac,dJ as Dc,dK as _c,j as Pc}from"./index-9pdMsp-M.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-BmHHlwSU.js";import{a as r}from"./sentry-bpmZUW7k.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-E2UGdnp9.js";import{M as Ae}from"./MobileAppDrawer-rCVKr3J3.js";import{d as Ut}from"./recharts-BXLxGQ-T.js";import{g as _e,a as xa,b as Ar,c as Oe,d as Ue,e as ea,f as ta,h as na,A as Tc,i as jt,P as vc,j as Mt,s as ya,k as Dr,l as ca,m as _r,n as Fc,o as Pr,p as xc,S as bn}from"./SetupPagesScreen-DPnnq4jj.js";import{u as wr}from"./useInitialThreadRequest-Df-inltN.js";import st from"./NotFoundScreen-C94S-cmy.js";import{u as Nt}from"./useChargeCardPusherEvents-DVeqwUB9.js";import{n as Sn}from"./utils-CXFQdt3d.js";import{t as Lc}from"./AddressScreen-CiPLLpNX.js";import"./analytics-BfKlFVdJ.js";import"./plaid-CNV6JDhi.js";import"./dnd-wLfPcqQ_.js";import"./stripe-cKAAJElX.js";import"./lottie-ByqRhfis.js";import"./lexical-ljfsYSTd.js";import"./pdf-C42gprG9.js";import"./InboxNotificationsProvider-Cd4NxEtR.js";import"./useTaskManagerAccess-Bq9TDvwr.js";import"./BusinessVerificationPageScreen-71JxUYXB.js";import"./routePaths--TXDBUUo.js";import"./analyticsHelper-Cn2rORl_.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="a18b9927-5ee6-49bb-9be3-f79a50b12c7f",e._sentryDebugIdIdentifier="sentry-dbid-a18b9927-5ee6-49bb-9be3-f79a50b12c7f")}catch{}})();const Bc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Bc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=le(),a=d((t=>_t(t.cardPolicyState))),n=d((t=>cs(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(Pt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:yn}}}=aa.getLocalizedStrings(),Rc=e=>On(e,!1),Oc=e=>Un(e.name,!1);function Uc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((P=>{m(P)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:l,onAskAiCfoClick:B}=Fa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(is()),t(ds()),t(hn())}),[t]);const D=d((P=>_n(P.cardPolicyState))),C=d((P=>Pn(P.cardPolicyState))),O=d((P=>wn(P.cardPolicyState))),U=d((P=>Tn(P.cardPolicyState))),S=d((P=>vn(P.cardPolicyState))),c=d((P=>Fn(P.cardPolicyState))),p=d((P=>xn(P.cardPolicyState))),x=d((P=>_t(P.cardPolicyState))),E=d((P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount)),I=d((P=>P.chargeCardConfigState.fetchState));r.useEffect((()=>{D!=="Completed"&&D!=="In-Progress"&&t(Ln())}),[t,D]),vr();const k=d((P=>Bn(P.createCardPolicyState))),V=d((P=>ls(P.createCardPolicyState))),w=d((P=>us(P.cardPolicyState))),y=d((P=>ms(P.cardPolicyState))),F=d((P=>Cs(P.createCardPolicyState))),i=d((P=>Rn(P)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const g=r.useMemo((()=>C.map(Rc)),[C]),R=r.useMemo((()=>p.map(Oc)),[p]),G=r.useMemo((()=>i.cards.filter((P=>!mr(P.status.code))).map(Tr)),[i.cards]),M=D==="Completed"&&i.fetchState==="Completed"&&I==="Completed";r.useEffect((()=>{M&&F==null&&t(ps({cardsMasterList:G,defaultRequireReceiptAmount:E,suggestedAllowMerchants:O,suggestedBlockMerchants:U,suggestedAllowCategories:S,suggestedBlockCategories:c}))}),[I,t,M,F,G,E,O,U,S,c]);const L=r.useMemo((()=>Ut((P=>{t(Pt(P))}),250)),[t]);r.useEffect((()=>()=>{L.cancel()}),[L]);const z=r.useCallback((P=>{L(P)}),[L]),j=k.fetchState,h=n!=null?`/${n}/cards/policy`:"..",H=r.useCallback((()=>{const P=we(a.state?.pathnameStackToGoBack),ae=P.poppedPathname??h;e(ae,{state:{pathnameStackToGoBack:P.newStack}})}),[a.state,e,h]),Y=r.useCallback((()=>{e(h)}),[e,h]),_=r.useCallback((P=>{t(hs(P))}),[t]),Z=r.useCallback((P=>{const ae=Cr(P);t(fs({templates:[ae]}))}),[t]),N=r.useCallback((P=>{P.length!==0&&t(gs(P))}),[t]),$=r.useCallback((()=>{t(hn())}),[t]),v=r.useRef(j);r.useEffect((()=>{const P=v.current;v.current=j,j==="Completed"&&P!=="Completed"&&V!=null&&(t(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(h))}),[t,j,V,e,h]);const T=j==="Error"?k.error?.message??yn.createPolicyGenericErrorMessage:void 0;return f&&n!=null?F==null?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:yn.createPageTitle,onBackClick:H,onClickMenuIcon:u,isAiCfoAccessEnabled:l,onAskAiCfoClick:B})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Qo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:T,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:Y,onClickMenuIcon:u,onFormChange:_,onSubmit:Z,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Qe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jc}}}=aa.getLocalizedStrings(),Mc=e=>On(e,!1),Nc=e=>Un(e.name,!1);function Vc(){const e=ie(),a=me(),{tenantEmailDomain:n,templateId:t}=Ve(),s=le(),f=Re(),b=Fe(f?.loggedInUserRoleMap),[m,A]=r.useState(!1),u=r.useCallback((T=>{A(T)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((T=>bs(T))),O=d((T=>_n(T.cardPolicyState))),U=d((T=>Pn(T.cardPolicyState))),S=d((T=>wn(T.cardPolicyState))),c=d((T=>Tn(T.cardPolicyState))),p=d((T=>vn(T.cardPolicyState))),x=d((T=>Fn(T.cardPolicyState))),E=d((T=>xn(T.cardPolicyState))),I=d((T=>_t(T.cardPolicyState))),k=d((T=>Rn(T))),V=d((T=>t!=null?Ss(T.cardPolicyState,t):void 0)),w=r.useMemo((()=>C.templateId===t&&C.formDraft!=null?C.formDraft:V!=null?ys(V):void 0),[C.templateId,C.formDraft,V,t]);r.useEffect((()=>{if(t==null)return;const T=C.detailFetchState.fetchState;C.templateId===t&&(T==="Completed"||T==="In-Progress")||V!=null||s(Is(t))}),[s,t,C.templateId,C.detailFetchState.fetchState,V]),r.useEffect((()=>{O!=="Completed"&&O!=="In-Progress"&&s(Ln())}),[s,O]),vr();const y=d((T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const F=r.useMemo((()=>U.map(Mc)),[U]),i=r.useMemo((()=>E.map(Nc)),[E]),g=r.useMemo((()=>k.cards.filter((T=>!mr(T.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Jo({draft:w,cardRows:g,categorySearchOptions:F,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:c,suggestedAllowCategories:p,suggestedBlockCategories:x})}),[w,g,F,i,y,S,c,p,x]),[G,M]=r.useState(void 0),L=r.useRef(!1);r.useEffect((()=>{L.current||G!=null||R==null||(L.current=!0,M(R))}),[G,R]);const z=r.useCallback((T=>{M(T)}),[]),j=r.useMemo((()=>Ut((T=>{s(Pt(T))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((T=>{j(T)}),[j]),H=C.updateFetchState.fetchState,Y=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??Y;e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e,Y]),Z=r.useCallback((()=>{e(Y)}),[e,Y]),N=r.useCallback((T=>{if(t==null)return;const P=Cr(T);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const T=$.current;$.current=H,H==="Completed"&&T!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))}),[s,H,e,Y]);const v=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Qe,{to:"..",replace:!0}):G!=null&&O==="Completed"&&k.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(ec,{templateName:C.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:F,isVendorSearchLoading:I==="In-Progress",onVendorSearchTextChange:h,submitState:H,submitErrorMessage:v,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:Z,onClickMenuIcon:l,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:m,handleDrawerToggle:u}),o.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:C.template?.name,onBackClick:_,onClickMenuIcon:l,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function Fr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function xr(e){return d((a=>e==null||e===""?{chips:ht,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ht:ht,isResolved:s}})(As(a,e))),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:$c}}}}=aa.getLocalizedStrings(),Kc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function zc(){const e=ie(),a=me(),{tenantEmailDomain:n}=Ve(),t=le(),s=Re(),f=Fe(s?.loggedInUserRoleMap),[b,m]=r.useState(!1),A=r.useCallback((h=>{m(h)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:l}=de(),{isFeatureEnabled:B}=l(q.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=l(q.isCardPolicyEnabled),{isAiCfoAccessEnabled:C,onAskAiCfoClick:O}=Fa({mobileExploreReferrer:"Card Policy"}),U=d((h=>Ds(h))),S=d((h=>Bn(h.createCardPolicyState))),c=d((h=>_s(h.createCardPolicyState))),p=d((h=>c==null?[]:Mn(h.aiCfoState,c).filter((H=>H.kind==="creating_policy"))),Dt),x=S.fetchState==="In-Progress"?Math.max(p.length,1):0,E=d((h=>Ps(h.createCardPolicyState))),I=Sa(S.fetchState);r.useEffect((()=>{if(I==="In-Progress"&&S.fetchState==="Completed"&&c!=null)p.forEach((h=>{t(St({chatSessionId:c,id:h.id,entityIds:E,kind:"created_policy"}))}));else if(I==="In-Progress"&&S.fetchState==="Error"&&c!=null){p.forEach((H=>{t(St({chatSessionId:c,id:H.id,kind:"errored_policy"}))}));const h=S.error?.message!=null&&S.error.message.length>0?S.error.message:aa.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h}]}))}}),[S.error?.message,S.fetchState,t,c,E,p,I]);const k=U.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||t(ws())}),[t,k]);const V=U.archiveFetchState.fetchState,w=Sa(V);r.useEffect((()=>{w==="In-Progress"&&V==="Completed"&&t(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[V,t,w]);const y=r.useMemo((()=>U.templates.map(Kc)),[U.templates]);Lt({isDataReady:U.fetchState.fetchState==="Completed"});const F=y.length>0||x>0,i=(function(h){const{hasAnyPolicies:H,isChargeCardAdmin:Y,isFileUploadEnabled:_}=h,Z=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:v,setIsAiCfoOpen:T}=hr(),P=fr(),ae=gr(),Ce=d((X=>jn(X))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:J,isResolved:Te}=xr("card_policy"),Ie=r.useMemo((()=>Fr(J,Te,3)),[J,Te]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!v,he=r.useCallback((X=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);Z(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:X,aiCfoShouldSubmit:X!=null&&X.trim().length>0}})}),[N.pathname,N.state,Z,$]),oe=r.useCallback((X=>{X.trim().length!==0&&(be(""),he(X))}),[he]),Q=r.useCallback((()=>{const X=re.trim();X.length!==0&&(be(""),he(X))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((X=>{be(X)}),[]),fe=r.useCallback((()=>{T(!0)}),[T]),ve=r.useCallback((()=>{he(void 0)}),[he]);return r.useMemo((()=>{if(pe&&!H&&Y)return{aiAgentName:$c,headline:Hc,subheadline:Gc,promptChips:Ie,composer:{currentInput:re,isSubmitting:Ce,isFileUploadEnabled:_,onInputChange:De,onSubmit:Q,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:ve,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,Y,_,Ce,De,ve,fe,oe,Se,Q,Ie])})({hasAnyPolicies:F,isChargeCardAdmin:f,isFileUploadEnabled:B}),g=D&&i!=null?o.jsx(br,{...i}):null,R=C&&g==null,G=r.useCallback((()=>{const h=we(a.state?.pathnameStackToGoBack),H=h.poppedPathname??"..";e(H,{state:{pathnameStackToGoBack:h.newStack}})}),[a.state,e]),M=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),L=r.useCallback((h=>{n!=null&&e(`/${n}/cards/policy/${h}/edit`)}),[e,n]),z=r.useCallback((h=>{t(Ts(h))}),[t]),j=U.fetchState.fetchState;return!F&&j!=="Completed"&&j!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(ac,{onBackClick:G,onNewPolicyClick:M,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:O})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ae,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{policies:y,archivingTemplateId:U.archiveTargetTemplateId,pendingCreationCount:x,onBackClick:G,onNewPolicyClick:M,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:O})]})}function Yc(){const e=ie(),{cardId:a}=Ve(),n=le(),t=te.getSignedInUser(),s=d((J=>ge(J))),f=Re(),b=Fe(f?.loggedInUserRoleMap),{useFeatureGate:m}=de();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),l=d((J=>Za(J).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=m(q.isChargeCardFeatureEnabled),C=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:O}=m(q.isDebitCardFeatureEnabled),U=xe(s),S=Le(s),c=Be(O,s),p=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:O,isBankingOnlyTenant:c}),E=Ue({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:D,isBookKeepingTenant:S,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:p}),I=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=d((J=>da(J,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((J=>ua(J))),F=d((J=>J.classListState.fetchState)),i=!B&&E&&C,g=d((J=>wt(J,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((J=>L!=null?Ga(J.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((J=>j!=null?$a(J.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,Y=d((J=>H!=null?Ga(J.userRoleState,H):void 0)),_=Y?.accountingClassIDs[0],Z=d((J=>_!=null?$a(J.classState,{classId:_,reportId:"class_list"}):void 0)),N=M?.type.code==="business_physical_credit_card"||M?.type.code==="business_physical_debit_card",$=M?.type.code==="business_physical_debit_card";r.useEffect((()=>{l&&A===!1&&N&&(u(!0),setTimeout((()=>{n(Ka()),$&&n(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[l,A,N,$]),r.useEffect((()=>{R||g.fetchState==="Completed"||g.fetchState==="In-Progress"||a==null||(G(!0),n(Ia(a,i,!1)))}),[R,g,a,n]),r.useEffect((()=>{if(g.fetchState==="Completed"&&(N===!1||N&&M?.status?.code!=="active"||M?.cardHolderUserId!==t.userId||l===!1&&A===!1||M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card")){const J=_e(s.tenantEmailDomain,a,t,M,l);e(J)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Xe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(Tt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const v=()=>{if(t!=null&&a!=null){n(Ka());const J=_e(s.tenantEmailDomain,a,t);e(J)}},T=M?.type.code==="business_physical_debit_card"||M?.type.code==="business_virtual_debit_card",P=ea(E,x,I,C),ae=xa(E,C,b,w,y),Ce=Ar(T,g);return g.fetchState!=="Completed"?o.jsx(wa,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(tt,{showConfetti:l}),o.jsx(nc,{onGotItClick:v,isDebitCard:M?.type.code==="business_physical_debit_card",controllerEmails:V,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:x,isDebitCardSetupEnabled:I,isChargeCardSetupEnabled:C,productInformation:P,creditAccountInformation:ae,debitAccountInformation:Ce,chargeCardDetailView:g,creditAccount:w,classListFetchState:F,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:h?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:Z?.className})]})}const Lr="charge-card-transaction-update",Br="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ot="credit-account-balance-updated",ct="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",$t="charge-card-renamed",Wc="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ba="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Zc=[Ba,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(vs({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Xc(){const e=ie(),a=le(),n=me(),t=te.getSignedInUser(),s=d((D=>ge(D))),[f,b]=r.useState(!1),m=d((D=>ma(D))),A=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),u=r.useCallback((()=>{const D=we(n.state?.pathnameStackToGoBack),C=D.poppedPathname??Qc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Zc),onEvent:D=>{switch(D){case Ba:case La:return void a(Da(!0))}},onSubscribed:()=>{a(Da(!0))}}),r.useEffect((()=>{f||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(b(!0),a(Da()))}),[f,m,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const B=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||B?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?o.jsx(st,{}):o.jsx(qc,{onBackClick:u,initialOpenThreadRequest:A}):o.jsx(rc,{onBackClick:u})}const Qc=e=>`/${e}/cards`,Jc={containerWidth:new va(100,58)},ei=({appContent:e})=>{const a=Ta(),n=le(),t=ie(),{cardId:s}=Ve(),f=me(),{useDynamicConfig:b}=de(),[m,A]=r.useState(!1),[u,l]=r.useState(!1),[B,D]=r.useState(!1),[C,O]=r.useState(!1),U=te.getSignedInUser();if(U==null)throw Error("Can't access onboarding card page without signing in...");const S=d((Z=>ge(Z)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Je.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((Z=>Fs(Z,s))),E=x.chargeCard,I=d((Z=>Z.chargeCardConfigState.fetchState)),{useFeatureGate:k}=de(),{isFeatureEnabled:V}=k(q.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=k(q.isDebitCardFeatureEnabled),y=Be(w,S),F=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,g=S.userRole.includes("charge_card_user"),R=xe(S),G=Le(S),M=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:V,isBookKeepingTenant:G,isDebitCardProductVisible:F,chargeCardsCreditAccountLimit:M}),z=!g&&L&&i;r.useEffect((()=>{m===!1&&I!=="In-Progress"&&I!=="Completed"&&(n(qa()),A(!0)),u===!1&&x.fetchState==="Not-Started"&&(l(!0),n(Ia(s,z,L)))}),[u,x.fetchState,m,I]);const j=E?.type.code==="business_physical_credit_card"||E?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(x.fetchState==="Completed"){if(B===!1&&(j===!1||j&&E?.status?.code!=="inactive"||E?.cardHolderUserId!==U.userId)){const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(Z,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const Z=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Xa()),t(Z,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((Z=>Vn(Z.userState,U.userId))),Y=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((Z=>Z.statusCode==="success"))===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=Z=>{O(Z)};if(I!=="Completed"||E==null)return o.jsx(wa,{fetchState:"In-Progress"});if(E.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(H?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ni,{children:[o.jsx(Ae,{isAppContentDrawerOpen:C,handleDrawerToggle:_}),o.jsx(ai,{cardId:s,card:E,shippingAddressId:E.shippingAddressId,phone:H.phone,signedInUser:U,isSandboxEnv:Bt(),chargeCardDetailState:x,signedInUserToken:h,navigate:t,currentTenant:S,location:f,maxChargeCardActivationAttempts:p[s]!=null?p[s]:c.default_max_charge_card_activation_attempts!=null?c.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:c.charge_card_cashback_rate_per_transaction!=null?c.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{_(!0)}}),e!=null?o.jsx(ti,{windowSize:a,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const f=Ls(e.addressState,n);if(f==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),m=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const l=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Bs())||l,showMenuIcon:u,shippingAddress:f,vgsVaultId:nt.cardVaultId,twoFAView:b,activationWaitStatus:m,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:f,chargeCardDetailState:b}=a,m=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=f;return{onGetOtp:u=>{m!=null&&e(et(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Os(t,u))},onResendOtp:u=>{m!=null&&e(Ja(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Qa(u,l,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),l=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?na(A):u.poppedPathname;n(l,{state:{pathnameStackToGoBack:u.newStack}})}}}))(oc),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Jc.containerWidth.value(e.windowSize)}%`};
|