@zeniai/web-app-ui 5.3.88-dev → 5.3.88-next
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-Db0caIkZ.js → AccountMappingScreen-tAX_b9Od.js} +1 -1
- package/dist/assets/{ActualMatchingMatchDetailScreen--akEs1x5.js → ActualMatchingMatchDetailScreen-B3U7XwKd.js} +1 -1
- package/dist/assets/AddressRoutes-L-MKHqTh.js +1 -0
- package/dist/assets/{AddressScreen-lx_HZDfg.js → AddressScreen-DQovxLbJ.js} +1 -1
- package/dist/assets/{AiCfoScreen-DH4uTpfZ.js → AiCfoScreen-D81-ptF3.js} +1 -1
- package/dist/assets/{AppDrawer-DAhxL0-t.js → AppDrawer-C_8vLLCD.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-z6WREO6S.js → BillPayApprovalRoutes-LlqJ9eB0.js} +1 -1
- package/dist/assets/{BillPayRoutes-BNtj5Z6g.js → BillPayRoutes-D1RGfqiM.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-CqCRDHlP.js → BusinessVerificationPageScreen-Do37GzKA.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-BtuN3Fna.js → CardsAiCfoScreen-B8OEFPfw.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-Bwd20GRb.js → ChargeCardRoutes-a3zKgMuR.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-BS8cAeG7.js → CompanyPassportScreen-By5bBcko.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-NpomCNmq.js → ConnectionAuthScreen-BWdupIod.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-DD6ylY5M.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-Ctei1yxR.js → CustomerOnboardingRoutes-gAKQNttA.js} +1 -1
- package/dist/assets/{DashboardRoutes-Yd6ytWgF.js → DashboardRoutes-Cjb4sltJ.js} +1 -1
- package/dist/assets/{DefaultTenantHome-C_ePwGG_.js → DefaultTenantHome-Cx9V2aC6.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-agLHT6HV.js → DomesticWireDetailScreen-BwldHnbW.js} +1 -1
- package/dist/assets/{DrawerScreen-B3BZEyK7.js → DrawerScreen-CbLKvWzA.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-DFTT7Jex.js → EntityDetailRoutes-DcGq1yuj.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-7J9OIwql.js → ExpenseAutomationRoutes-D1puWd3u.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-DInsBmdk.js → FeaturePreviewScreen-m622MoLl.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-wO_7Z3IU.js → HubSpotOAuthCallbackScreen-DQe0Wnil.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-CJ6RDL31.js → InboxNotificationsProvider-CMIqT4_Q.js} +1 -1
- package/dist/assets/{InvoicingRoutes-cvqoXavi.js → InvoicingRoutes-CAXyMLeP.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-B7dsytLy.js → MagicLinkRoutes-BZrIG853.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-D4aX7YwY.js → MagicLinkSignInScreen-BfMWTca8.js} +1 -1
- package/dist/assets/{MobileAppDrawer-CTQRP8UJ.js → MobileAppDrawer-Dew93Hd0.js} +1 -1
- package/dist/assets/NotFoundScreen-DCB7OcSg.js +1 -0
- package/dist/assets/{NotificationRoutes-DzRmN_jM.js → NotificationRoutes-Cx0kzpOe.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-eVNO9tpS.js → OAuthConsentScreen-Dl6o_HIj.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-B8_fFjT-.js → PandLWithForecastRoutes-Dknc8-6H.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-BFbh2fvr.js → PaymentLinkScreen-C9eMmtar.js} +1 -1
- package/dist/assets/{PeopleRoutes-DRqKHSzZ.js → PeopleRoutes-1UbnMr5e.js} +1 -1
- package/dist/assets/{PerformanceRoutes-DRekxiu8.js → PerformanceRoutes-DG2KbOtF.js} +1 -1
- package/dist/assets/{Preview-DOoN8piN.js → Preview-CWWjPoyG.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DwtmgRyN.js → QBOConnectionScreen-CvqHfJFQ.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CL2uUquG.js → ReimbursementApprovalRoutes-UTcShEGL.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CXdcXz04.js → ReimbursementApprovalRuleDetailScreen-1I1rQcTe.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-DRi4OeXU.js → ReimbursementRoutes-B_bjHUsT.js} +1 -1
- package/dist/assets/{ReportsRoutes-Bmh4S4Fl.js → ReportsRoutes-IlY7KPWM.js} +1 -1
- package/dist/assets/{RewardsRoutes-CdUHO7Yc.js → RewardsRoutes-BhO6qn3Y.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-B6e9FDGx.js → ScheduleDetailsPrepaidExpensesScreen-C6gGZxeR.js} +1 -1
- package/dist/assets/{ScreenRoutes-NcBi_D0j.js → ScreenRoutes-CDcwGWJY.js} +2 -2
- package/dist/assets/{SettingsRoutes-CXMPeImh.js → SettingsRoutes-pcY0t-rI.js} +1 -1
- package/dist/assets/{SetupPagesScreen-u4czjChG.js → SetupPagesScreen-DRx3iKSB.js} +1 -1
- package/dist/assets/{SignInScreen-DfoNrTd3.js → SignInScreen-of_LTaR8.js} +1 -1
- package/dist/assets/{SignOutScreen-CaEWLSLT.js → SignOutScreen-N9gvBdN0.js} +1 -1
- package/dist/assets/{TaskListScreen-C4v_wDqU.js → TaskListScreen-DWZ4c5lD.js} +1 -1
- package/dist/assets/{TaskRoutes-pNExaoog.js → TaskRoutes-Bsq5V9Nf.js} +1 -1
- package/dist/assets/TransactionDetailRoutes-C_1Ug4uB.js +1 -0
- package/dist/assets/{TransactionDetailScreen-BzGcsLih.js → TransactionDetailScreen-CMUcgBA9.js} +1 -1
- package/dist/assets/{TransactionListRoutes-B432YMQA.js → TransactionListRoutes-BFtSXlqW.js} +1 -1
- package/dist/assets/{TreasuryRoutes-Crl38a_q.js → TreasuryRoutes-DOViJD5i.js} +1 -1
- package/dist/assets/{VendorsRoutes-xIHUU5cC.js → VendorsRoutes-DR1CAwxG.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-COz0cxAH.js → WiseConfirmationScreen-DHEkOFfz.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-D0ESQTiE.js → ZeniAccountRoutes-DB2YRty-.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-mhMclD_-.js → ZeniAccountStatementScreen-C8dIDYGI.js} +1 -1
- package/dist/assets/{accountMappingHelper-CzuKXsfZ.js → accountMappingHelper-dVOVpqjl.js} +1 -1
- package/dist/assets/{analytics-BGlrzyDz.js → analytics-Bqd4cGOe.js} +1 -1
- package/dist/assets/{analyticsHelper-N9KfV3Ey.js → analyticsHelper-cWQXE2Ud.js} +1 -1
- package/dist/assets/{core-C6dxOS4P.js → core-CbG1OV1-.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DX5mm8tE.js → decodeURIComponentSafe-BvzftayX.js} +1 -1
- package/dist/assets/{dnd-BtyoSdzG.js → dnd-DsgSNuBw.js} +1 -1
- package/dist/assets/{empty-s4dMcXJj.js → empty-CI7HYMjf.js} +1 -1
- package/dist/assets/{empty-20Do0ayr.js → empty-D36H7yci.js} +1 -1
- package/dist/assets/{emptyVideoElement-Cn9_hQna.js → emptyVideoElement-BbfMSRNm.js} +1 -1
- package/dist/assets/{epic-DcczydaG.js → epic-DfXNmYcf.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-DCxx3oei.js → expenseAutomationHelper-BVzWGJR4.js} +1 -1
- package/dist/assets/{getLocaleForTenant-D3SNBEiv.js → getLocaleForTenant-DBrt2Owv.js} +1 -1
- package/dist/assets/{index-CZ8Bq_4q.js → index-BdnS6IZX.js} +1 -1
- package/dist/assets/{index-Bk0SSvS0.js → index-BlIcsGYD.js} +1 -1
- package/dist/assets/{index-DNfJb3gN.js → index-C0zCbJUk.js} +1 -1
- package/dist/assets/{index-pj4u0b1G.js → index-CWBFzzoG.js} +8 -8
- package/dist/assets/{index-I-q_Bo-e.js → index-Dd2DNMYP.js} +1 -1
- package/dist/assets/{index-B2UVgtaW.js → index-DoYtDpZc.js} +1 -1
- package/dist/assets/{index-DVkDiHzq.js → index-QSsIYmxJ.js} +1 -1
- package/dist/assets/{index-DQSzwhal.js → index-YQDXQOV5.js} +2 -2
- package/dist/assets/{lexical-plr3Wvpq.js → lexical-nruf00Lo.js} +1 -1
- package/dist/assets/{liveblocks-CRyd9n8B.js → liveblocks-Cnrd0Zxu.js} +1 -1
- package/dist/assets/{lottie-CXwABHQ0.js → lottie-sOqenOaw.js} +1 -1
- package/dist/assets/{mui-0pGBD9L4.js → mui-JBqam7ZJ.js} +1 -1
- package/dist/assets/{pathToGoBack-B8vmhE3I.js → pathToGoBack-BrXh0sbI.js} +1 -1
- package/dist/assets/{pdf-lib-kUoa-zRQ.js → pdf-lib-D-lybgoD.js} +1 -1
- package/dist/assets/{pdf-c_Y6aTYi.js → pdf-xXlSIFfJ.js} +3 -3
- package/dist/assets/{plaid-CO0-sO-T.js → plaid-DS9CUDf0.js} +1 -1
- package/dist/assets/{pusher-BfHG6cEQ.js → pusher-CEqeH9Au.js} +1 -1
- package/dist/assets/{react-rpmVlbhi.js → react-5Ulvwx3s.js} +1 -1
- package/dist/assets/{react-CKKOu6ZR.js → react-BFsjA3nr.js} +1 -1
- package/dist/assets/{react-B6rMqh5y.js → react-CBv0VANi.js} +1 -1
- package/dist/assets/{react-Ds8BzNi6.js → react-CkkqcYcn.js} +1 -1
- package/dist/assets/{react-B9ZK5e9A.js → react-CrVK22U8.js} +1 -1
- package/dist/assets/{react-C9Oqiteh.js → react-DgxKQz3r.js} +1 -1
- package/dist/assets/{recharts-C9C0kAsT.js → recharts-C8kt9j-2.js} +1 -1
- package/dist/assets/{routePaths-D6noST9U.js → routePaths-BXStbwFd.js} +1 -1
- package/dist/assets/{sentry-BOmfv4Oi.js → sentry-FYTScRKu.js} +1 -1
- package/dist/assets/{stripSplatSuffix-4upapLOu.js → stripSplatSuffix-CRSZSLNx.js} +1 -1
- package/dist/assets/{url-1eFiIl2c.js → url-CX60fG_a.js} +1 -1
- package/dist/assets/{url-BtRn4YUp.js → url-Cn29Apt_.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-CnwaLoCC.js → useActualMatchingMatchDetail-DBynp1Qz.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Br490_x2.js → useAiCfoDashboardSuggestedQuestionsChips-DVx6iiWl.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-D_lZcHX9.js → useAskAiCfoHostNavButtonProps-DwBC4EIF.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-ijimVvc8.js → useChargeCardPusherEvents-B29zDqMR.js} +1 -1
- package/dist/assets/{useDeviceId-AGSM87EZ.js → useDeviceId-CtrLToqV.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BRFhahB3.js → useEmailConnectResultRefresh-3WTdDCXP.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-B9k0MBEA.js → useInitialThreadRequest-DrHN756f.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-DlX9f1Pd.js → useTaskManagerAccess-CqgFuERm.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-CDCMnrHo.js → useTaskManagerPusherEvents-Ct3S7E3D.js} +1 -1
- package/dist/assets/{utils-DrAWZPZ0.js → utils-0scyINMC.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DfxhH5Jw.js → withTransactionSidePanel-BcUo0P8U.js} +1 -1
- package/dist/assets/{zeni-epic-state-C5-RfNOq.js → zeni-epic-state-CvqWLXMw.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AddressRoutes-Btf8GDJA.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-K1DQpnRo.js +0 -1
- package/dist/assets/NotFoundScreen-BWSuWGJw.js +0 -1
- package/dist/assets/TransactionDetailRoutes-Bi3Vmb5p.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as B}from"./liveblocks-
|
|
1
|
+
import{j as B}from"./liveblocks-Cnrd0Zxu.js";import{a as o}from"./sentry-FYTScRKu.js";import{h as W,g as Z,u as H,j as m,s as q,l as X}from"./core-CbG1OV1-.js";import{ag as Y,W as ee,A as R,z as te,n as J,ah as ne,h as ae,K as ce}from"./index-CWBFzzoG.js";import{bn as se,fI as oe,gZ as ie,oF as $,V8 as re,ic as K,gk as ue,ow as le,V9 as de,Va as pe,uh as ge,m3 as me,ou as Ae,oq as be,oB as Ie,ie as fe,Vb as ye,Vc as Se}from"./zeni-epic-state-CvqWLXMw.js";import{n as he}from"./mui-JBqam7ZJ.js";import{M as Ee}from"./MobileAppDrawer-Dew93Hd0.js";import{q as G}from"./QBOConnectionScreen-CvqHfJFQ.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-dVOVpqjl.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="d16e992a-6f53-4056-b60b-4594def4c1e1",a._sentryDebugIdIdentifier="sentry-dbid-d16e992a-6f53-4056-b60b-4594def4c1e1")}catch{}})();const u="zeni_pending_projects_enable",l={pending:"pending",ready:"ready"},we=he.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-Cnrd0Zxu.js";import{a as y}from"./sentry-FYTScRKu.js";import{a2 as A,dN as R}from"./index-CWBFzzoG.js";import"./mui-JBqam7ZJ.js";import{u as F}from"./useActualMatchingMatchDetail-DBynp1Qz.js";import b from"./NotFoundScreen-DCB7OcSg.js";import{i as P,h as U,g as w}from"./core-CbG1OV1-.js";import"./zeni-epic-state-CvqWLXMw.js";import"./recharts-C8kt9j-2.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.js";import"./stripSplatSuffix-CRSZSLNx.js";import"./decodeURIComponentSafe-BvzftayX.js";import"./routePaths-BXStbwFd.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]="53b1ac0a-3c44-49f1-a57e-5c08d5625e5f",t._sentryDebugIdIdentifier="sentry-dbid-53b1ac0a-3c44-49f1-a57e-5c08d5625e5f")}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 s.jsx(b,{});const{match:i,detailFetchState:a,handleOpenBill:l,handleRefresh:c,handleUndoReversal:h,handleApproveAndReverse:d,handleIgnoreMatchSuggestion:f,lastMatchResults:p,lastUndoResults:g,refreshStatus:m,ignoreStatus:u,matchAndReverseStatus:S,undoReversalStatus:I}=k;return i==null?a.fetchState==="Not-Started"||a.fetchState==="In-Progress"?s.jsx(R,{detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g}):s.jsx(b,{}):s.jsx(R,{match:i,detailFetchState:a.fetchState,isIgnoreInFlight:u.fetchState==="In-Progress",isApproveInFlight:S.fetchState==="In-Progress",isUndoInFlight:I.fetchState==="In-Progress",refreshStatus:m.fetchState,onNavigateBack:r,onOpenBill:l,onApproveAndReverse:d,onIgnoreMatchSuggestion:f,onRefresh:c,onUndoReversal:h,lastMatchResults:p,lastUndoResults:g})}export{V as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-Cnrd0Zxu.js";import{A as i}from"./AddressScreen-DQovxLbJ.js";import s from"./NotFoundScreen-DCB7OcSg.js";import"./sentry-FYTScRKu.js";import{n as d,o as r}from"./core-CbG1OV1-.js";import"./zeni-epic-state-CvqWLXMw.js";import"./recharts-C8kt9j-2.js";import"./index-CWBFzzoG.js";import"./mui-JBqam7ZJ.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.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]="81cbb5c1-1b56-4d87-a240-ae6c03b91825",t._sentryDebugIdIdentifier="sentry-dbid-81cbb5c1-1b56-4d87-a240-ae6c03b91825")}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-Cnrd0Zxu.js";import{a as h}from"./sentry-FYTScRKu.js";import{h as A,u as T,g as j,i as E,j as $,l as B}from"./core-CbG1OV1-.js";import{$ as L,z as M,V,a5 as D,a6 as K,h as C,K as S,a1 as R,R as b,a2 as z}from"./index-CWBFzzoG.js";import{VP as _,it as F,fI as U,VQ as G,c9 as N,VR as O,mL as q}from"./zeni-epic-state-CvqWLXMw.js";import{u as H,n as Q}from"./mui-JBqam7ZJ.js";import J from"./NotFoundScreen-DCB7OcSg.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]="658a5243-8388-4300-baf0-cb5e3a6475af",e._sentryDebugIdIdentifier="sentry-dbid-658a5243-8388-4300-baf0-cb5e3a6475af")}catch{}})();const W=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-CRyd9n8B.js";import{a as n}from"./sentry-BOmfv4Oi.js";import{u as Dt,h as Lt,i as Ft,g as Bt,j as v,l as Mt}from"./core-C6dxOS4P.js";import{e4 as Nt,a as $t,j as Vt,e5 as Gt,z as Ht,$ as qt,e6 as zt,e7 as Wt,e8 as Yt,bn as Fe,e9 as We,ea as Jt,bm as Ye,a2 as ge,a6 as ce,h as N,eb as me,ec as Kt,ed as Zt,as as Xt,K as es,w as ts,ee as ss,ef as ns,at as as,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Be,ek as ds}from"./index-pj4u0b1G.js";import{fH as M,gw as R,Ux as cs,a2M as ms,a2N as Ss,jQ as hs,a2O as ps,jN as fs,a2P as Se,jt as J,jW as K,jz as Ie,jg as he,je as gs,jY as Is,jI as Je,UG as Me,gy as $,gN as Cs,UF as ks,Uq as Ne,fI as bs,j7 as vs,a2Q as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a2R as Rs,a2S as Ts,a2T as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2U as He,jZ as Us,ji as _s,jC as Qs,jU as qe,jF as Ds,gA as Ls,gB as Fs,gC as Bs,gD as Ms}from"./zeni-epic-state-C5-RfNOq.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-0pGBD9L4.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-Br490_x2.js";import{p as Hs}from"./pathToGoBack-B8vmhE3I.js";import{j as qs}from"./routePaths-D6noST9U.js";import{u as zs}from"./useTaskManagerPusherEvents-CDCMnrHo.js";import"./recharts-C9C0kAsT.js";import"./analytics-BGlrzyDz.js";import"./plaid-CO0-sO-T.js";import"./dnd-BtyoSdzG.js";import"./stripe-cKAAJElX.js";import"./lottie-CXwABHQ0.js";import"./lexical-plr3Wvpq.js";import"./pdf-c_Y6aTYi.js";import"./utils-DrAWZPZ0.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]="a13b754c-3de5-4dc5-9ae9-7145b57fa4f7",t._sentryDebugIdIdentifier="sentry-dbid-a13b754c-3de5-4dc5-9ae9-7145b57fa4f7")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ke="chat-response-generated";function Ys(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 Js=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:Ys(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:K(t).detail,skillDetailError:K(t).fetchState==="Error",skillDetailLoading:K(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,F=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ke&&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}=Ye(g,E);j!=="answer"?N.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):N.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Fs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Bs({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&&Be(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Je())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(qe({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{t(_s({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Us({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t($()),t($e()),Be(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(He())},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??Hs(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(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(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(`/${F}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${F}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Ft(),i=Bt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),F=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),[Ze,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?J({scheduleId:P}):Se())}),[s,P]);const B=ke?.macroId,at=v((e=>K(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&s(Ie({macroId:B}))}),[s,be,B]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(J({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(J({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)),Z=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(Je()),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))),y=Ht.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ne()),void s(Me())):(T==null&&s(Se()),s(Ne()),void s($()))),[s,T,g,l]);const ft=qt(),U=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,D=w!=null&&w!=="",ee=n.useCallback((e=>{D&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,w]),te=n.useCallback((()=>{D&&d(`/${w}/ai-cfo/routines`)}),[D,d,w]),se=n.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&D&&d(`/${w}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,w]),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:Z.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,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Yt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:F,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,q=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;f(!0);const m={...e};delete m[Fe],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),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[q,we,i.state]);const yt=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")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);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}=Jt(u),W=I.fetchState,Y=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),Ue=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(Ue,u),Tt=Rt.length===0;n.useEffect((()=>{x||U||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,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]),_e=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=l!==_e.current,m=u!==Qe.current;_e.current=l,Qe.current=u,l!==u&&(!e||l==null||qs(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}.${Ke}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&Y&&s(ws())}),[W,Y,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&y!=null&&(l===u||W==="Completed"&&!Y)&&s(ys(u,y.userId))}),[Oe,W,Ae,Y,u,y,l,s]);const ue=y?.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(J({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:Ws.find((Qt=>Qt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(m);_!=null&&De(_.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const Ut=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&U)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:N,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 _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:N,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(Ks,{children:[S.jsx(ce,{analytics:N,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),U&&ne.drawerElement,S.jsx(Js,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Ut,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:U?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:Z,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:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:F,promoDismissalScope:w}),p&&U?S.jsx(Ns,{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&&!U?S.jsx(Kt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:_t})}):null]})},ze=V($s)`
|
|
1
|
+
import{j as S}from"./liveblocks-Cnrd0Zxu.js";import{a as n}from"./sentry-FYTScRKu.js";import{u as Dt,h as Lt,i as Ft,g as Bt,j as v,l as Mt}from"./core-CbG1OV1-.js";import{e4 as Nt,a as $t,j as Vt,e5 as Gt,z as Ht,$ as qt,e6 as zt,e7 as Wt,e8 as Yt,bn as Fe,e9 as We,ea as Jt,bm as Ye,a2 as ge,a6 as ce,h as N,eb as me,ec as Kt,ed as Zt,as as Xt,K as es,w as ts,ee as ss,ef as ns,at as as,eg as os,eh as is,ei as rs,ej as ls,p as us,bi as Be,ek as ds}from"./index-CWBFzzoG.js";import{fH as M,gw as R,Ux as cs,a2M as ms,a2N as Ss,jQ as hs,a2O as ps,jN as fs,a2P as Se,jt as J,jW as K,jz as Ie,jg as he,je as gs,jY as Is,jI as Je,UG as Me,gy as $,gN as Cs,UF as ks,Uq as Ne,fI as bs,j7 as vs,a2Q as Es,gb as Ps,jp as ws,jl as ys,fJ as pe,gi as xs,a2R as Rs,a2S as Ts,a2T as js,gx as Os,gr as $e,k8 as Ve,gt as Ge,gz as As,a2U as He,jZ as Us,ji as _s,jC as Qs,jU as qe,jF as Ds,gA as Ls,gB as Fs,gC as Bs,gD as Ms}from"./zeni-epic-state-CvqWLXMw.js";import{D as Ns,n as V,S as $s,v as Vs}from"./mui-JBqam7ZJ.js";import{u as Gs}from"./useAiCfoDashboardSuggestedQuestionsChips-DVx6iiWl.js";import{p as Hs}from"./pathToGoBack-BrXh0sbI.js";import{j as qs}from"./routePaths-BXStbwFd.js";import{u as zs}from"./useTaskManagerPusherEvents-Ct3S7E3D.js";import"./recharts-C8kt9j-2.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.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]="a13b754c-3de5-4dc5-9ae9-7145b57fa4f7",t._sentryDebugIdIdentifier="sentry-dbid-a13b754c-3de5-4dc5-9ae9-7145b57fa4f7")}catch{}})();const Ws=["claimed","running","succeeded","failed","timeout"],fe=t=>typeof t=="string"&&t!=="",Ke="chat-response-generated";function Ys(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 Js=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:Ys(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:K(t).detail,skillDetailError:K(t).fetchState==="Error",skillDetailLoading:K(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,F=s.tenantEmailDomain;return{onEventReceived:(a,o)=>{if(a===Ke&&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}=Ye(g,E);j!=="answer"?N.trackAICFOChatResponseGenerated(j,G?.question.questionText??"",c.text,E,ds(A,O),c.metadata.message_id??null):N.trackAICFOChatAnswerGenerated(c.text,G?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Fs(c.visualization?.type??"")??null,E,c.summarized_title,c.metadata.message_id??null),t(Bs({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&&Be(t,a,o,i,g,d,j,c,void 0,E)},onFetchSkills:()=>{t(Je())},onOpenSkill:a=>{t(Ie({macroId:a})),t(Ds({macroId:a}))},onSaveSkill:(a,o)=>{t(qe({draft:a,macroId:o}))},onSaveSkillDraft:a=>{const o=a.displayName?.trim()??"",c=a.name?.trim()??"";t(qe({draft:{name:o.length>0?o:c,description:a.description?.trim()??null,instructions:a.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(a,o)=>{t(Qs({macroId:a,version:o}))},onDeleteSkill:a=>{t(_s({macroId:a}))},onSetSkillVisibility:(a,o)=>{t(Us({macroId:a,visibility:o}))},onCloseSkillDetail:()=>{t(He())},onRunSkill:(a,o)=>{t($()),t($e()),Be(t,o,"user_input",void 0,g,d,void 0,void 0,void 0,a),t(He())},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??Hs(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(Ve(i,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(a,o)=>{i!=null&&o?.messageId!=null&&t(Ve(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(`/${F}/cards`,{state:{...h.state}})},onAfterCardPolicySubmit:()=>{L(!0),l(`/${F}/cards/policy`,{state:{...h.state}})}})}}))(ts(ss)),bn=({isFileUploadEnabled:t})=>{const r=Nt(),{setIsAiCfoOpen:h}=$t(),s=Dt(),d=Lt(),{session_id:l}=Ft(),i=Bt(),g=new URLSearchParams(i.search).get("routine")??void 0,[p,f]=n.useState(!1),L=v((e=>M(e).uiState.isSkillsBrowserOpen===!0)),F=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),[Ze,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?J({scheduleId:P}):Se())}),[s,P]);const B=ke?.macroId,at=v((e=>K(e))),be=B!=null&&B!==""&&at.fetchState==="Not-Started";n.useEffect((()=>{be&&B!=null&&s(Ie({macroId:B}))}),[s,be,B]);const ot=v((e=>M(e).uiState.currentChatSessionId))??l,k=o.routines.find((e=>e.scheduleId===g))??o.routines.find((e=>e.scheduleId===Vt(ot))),T=k?.scheduleId??null,[ve,it]=n.useState(!0);n.useEffect((()=>{T!=null&&s(J({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(J({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)),Z=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(Je()),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))),y=Ht.getSignedInUser();n.useEffect((()=>l==="routines"?(s($()),void s(ks())):l==="skills"?(s(Se()),s(Ne()),void s(Me())):(T==null&&s(Se()),s(Ne()),void s($()))),[s,T,g,l]);const ft=qt(),U=Xt(ft),b=v((e=>bs(e))),u=I.uiState.currentChatSessionId,w=b.tenantEmailDomain,D=w!=null&&w!=="",ee=n.useCallback((e=>{D&&d(`/${w}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,d,w]),te=n.useCallback((()=>{D&&d(`/${w}/ai-cfo/routines`)}),[D,d,w]),se=n.useCallback(((e,m)=>{const _=e.sessionId??C.sessionId;_!=null&&D&&d(`/${w}/ai-cfo/${_}?routine=${encodeURIComponent(m)}`)}),[D,d,C.sessionId,w]),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:Z.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,Z]),{handleUploadPromoClose:It,isUploadPromoVisible:Ct}=Wt({isFileUploadEnabled:t,tenantEmailDomain:w}),ne=Yt({currentTenant:b,currentChatSessionId:u,aiCfoView:I,skillsEnabled:F,onCloseSkills:ct,onOpenSkills:X}),{isSuggestedQuestionsLoading:kt,suggestedPromptQuestions:bt}=Gs(),H=i.state,q=H?.aiCfoInitialQuestion,we=!!H?.aiCfoShouldSubmit;n.useEffect((()=>{const e=i.state;if(e?.[Fe]!==!0)return;f(!0);const m={...e};delete m[Fe],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),[wt,re]=n.useState(void 0),ye=n.useRef(!1);n.useEffect((()=>{if(!ye.current&&q!=null&&q!==""){const e=i.state;ae(q),oe(we),ie(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const m=e?.aiCfoSuggestionIndex;re(typeof m=="number"?m:void 0),ye.current=!0}}),[q,we,i.state]);const yt=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")??H?.aiCfoRef,le=xe.get("emailRefId")??H?.aiCfoEmailRefId,Te=n.useRef(!1);n.useEffect((()=>{Te.current||Re!=="month-end-email"||le==null||u!=null||y==null||(s(vs("controller",y.userId,le,"MONTH_END_EMAIL")),Te.current=!0)}),[Re,le,u,s,y]);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}=Jt(u),W=I.fetchState,Y=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),Ue=I.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Rt}=Ye(Ue,u),Tt=Rt.length===0;n.useEffect((()=>{x||U||d("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[x,U,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]),_e=n.useRef(void 0),Qe=n.useRef(void 0);n.useEffect((()=>{const e=l!==_e.current,m=u!==Qe.current;_e.current=l,Qe.current=u,l!==u&&(!e||l==null||qs(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}.${Ke}`)),eventCallback:(e,m,_)=>_.onEventReceived(e,m)})),[je]);n.useEffect((()=>{W!=="In-Progress"&&Y&&s(ws())}),[W,Y,s]),n.useEffect((()=>{u!=null&&Oe!=="In-Progress"&&Ae&&y!=null&&(l===u||W==="Completed"&&!Y)&&s(ys(u,y.userId))}),[Oe,W,Ae,Y,u,y,l,s]);const ue=y?.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(J({scheduleId:e}))}),[s,a,T,P]);zs({events:At,onSubscribed:()=>De(P??T),onEvent:(e,m)=>{const _=(de=>{if(de==null||typeof de!="object")return null;const Q=de;return fe(Q.schedule_id)&&fe(Q.run_id)?{scheduleId:Q.schedule_id,runId:Q.run_id,status:Ws.find((Qt=>Qt===Q.status))??null,finishedAt:fe(Q.finished_at)?Q.finished_at:null}:null})(m);_!=null&&De(_.scheduleId)}});const Le=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(y==null||l==null)throw Error("Can't access AI Controller page without signing in...");const Ut=u!=null&&I.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!x&&U)return S.jsxs(Zs,{children:[S.jsx(ce,{analytics:N,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 _t=S.jsxs(S.Fragment,{children:[p&&!x?S.jsx(ce,{analytics:N,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(Ks,{children:[S.jsx(ce,{analytics:N,onLoad:e=>e.trackPageLoaded(es.Event.aiCFOPage)}),U&&ne.drawerElement,S.jsx(Js,{answerExportEndPoint:r,...Ot,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Ue,allUsers:mt,isAiCardCreationEnabled:St,isCardPolicyEnabled:ht,openOnboardingPage:()=>f(!0),userId:y.userId,setIsAiCfoOpen:h,navigate:d,sessionFromUrl:l,location:i,isSubmitting:Ut,isEmptyChatWithSession:Tt,currentTenant:b,emailLinkQuestion:vt??void 0,autoSubmitEmailLinkQuestion:Et,onEmailLinkQuestionProcessed:yt,routedInitialQuestionSource:Pt,routedInitialQuestionSuggestionIndex:wt,onCardPolicyVendorSearchTextChange:pt,onMenuClick:U?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:Z,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:Ze,onRoutineOpenDetail:ee,onRoutineEditorCancel:tt,onRoutineLoadSkillInstructions:dt,onRoutineSave:st,onRoutineSetEnabled:ut,isCreateSkillEnabled:F,promoDismissalScope:w}),p&&U?S.jsx(Ns,{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&&!U?S.jsx(Kt,{open:p,onClose:()=>f(!1),children:S.jsx(Zt,{children:_t})}):null]})},ze=V($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-CRyd9n8B.js";import{a as o,R as Ta}from"./sentry-BOmfv4Oi.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-C6dxOS4P.js";import{fI as Ge,Uo as xa,Up as Ze,gc as Aa,gy as Q,Uq as ee,jI as ye,jg as Te,Ur as _a,Us as Da,gS as Ua,q3 as Ma,Ut as Fa,Uu as $e,gp as Ga,Uv as x,fH as Za,gw as Ra,Uw as ja,Ux as Ha,Uy as Pa,Uz as Be,UA as Va,UB as xe,UC as La,Ev as Na,gq as Oa,h5 as qa,cW as za,UD as Wa,UE as Ya,qG as Ka,gb as Xa,ja as Ja,UF as Qa,UG as et,wK as at,gr as tt}from"./zeni-epic-state-C5-RfNOq.js";import{w as nt,i as ot,a as st,Z as rt,W as it,A as m,c as lt,u as dt,d as ct,O as ut,e as mt,f as Ct,S as pt,j as ht,g as ft,z as gt,h as P,p as h,m as Ae,k as bt,P as St,l as _e,n as kt,T as De,o as Et,X as wt,q as te,r as ae,s as It,v as vt,x as yt,L as Tt,y as $t,B as Bt,C as xt,D as At}from"./index-pj4u0b1G.js";import{u as _t,q as Dt,r as Ut,I as Mt,p as Ue,t as Ft,D as Me,s as ne}from"./mui-0pGBD9L4.js";import{u as Gt}from"./InboxNotificationsProvider-CJ6RDL31.js";import{u as Zt}from"./useTaskManagerAccess-DlX9f1Pd.js";import{u as Rt}from"./expenseAutomationHelper-DCxx3oei.js";import"./recharts-C9C0kAsT.js";import"./analytics-BGlrzyDz.js";import"./plaid-CO0-sO-T.js";import"./dnd-BtyoSdzG.js";import"./stripe-cKAAJElX.js";import"./lottie-CXwABHQ0.js";import"./lexical-plr3Wvpq.js";import"./pdf-c_Y6aTYi.js";import"./utils-DrAWZPZ0.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]="8de7fae9-4623-41d9-ab21-8cfc3aecd284",a._sentryDebugIdIdentifier="sentry-dbid-8de7fae9-4623-41d9-ab21-8cfc3aecd284")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},jt=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"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[V,_]=Ta.useState(!1),[k,Re]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[je,He]=o.useState(!1),L=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(Q()),n(ee()))}),[n,re]),o.useEffect((()=>{n(Q()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ge(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Ve}=Zt(E),le=ut(),I=mt(),U=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const J=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(J)}const R=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(R)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ye()),n(Te()))}),[n,U,I,i.tenantId,w]);const[O,Le]=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:M}=u(m.isReferralFeatureEnabled),We=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:v}=g,Ye=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Rt();o.useEffect((()=>{U&&I&&M&&!b&&q.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,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=Ye||b,z=r((e=>e.tenantState)),Xe=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Je}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=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)),W=r((e=>Za(e))),la=r((e=>Ra(e).skillsEnabled)),da=r((e=>ja(e))),Ce=r((e=>Ha(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(Pa),[y,Y]=o.useState(void 0),K=W.uiState.currentChatSessionId,G=y!=null?W.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(G),{inboxNotifications:X,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Gt(),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"&&G==="Completed"?(n(Be({chatSessionId:y})),Y(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:y})),Y(void 0)))}),[n,t.state,s,G,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&X!=null){const e=`dashboard_${i.companyId}`;Le(X.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,X]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(Va("task_manager","dashboard"))}),[I,D,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=[];Je===!1&&T.push("accounts_payable_aging"),Qe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),M===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>La(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=>{_(e)},ba=We,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Wa(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(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"?Xe:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(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=Ve?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=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Qa()),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(Q()),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(P.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const j=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:j,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,R=At(B)&&B!=="command_center";if(B!=="command_center"&&!R||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),R&&f[i.tenantId]!=null){const j=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${j.month}-${j.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const J=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}/${J}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),K===e&&Y(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:Re,aiCfoView:W,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Xa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:je?`1px solid ${L.colors.grey2}`:""},children:d.jsxs(Ut,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(Vt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Ue((e=>e.breakpoints.up("md"))),ya=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(jt,{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(Me,{container:window.document.body,variant:"temporary",open:V,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Me,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Ge(_))),V={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...V})},Pt=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-Cnrd0Zxu.js";import{a as o,R as Ta}from"./sentry-FYTScRKu.js";import{u as Fe,j as r,g as $a,h as Ba,q as H}from"./core-CbG1OV1-.js";import{fI as Ge,Uo as xa,Up as Ze,gc as Aa,gy as Q,Uq as ee,jI as ye,jg as Te,Ur as _a,Us as Da,gS as Ua,q3 as Ma,Ut as Fa,Uu as $e,gp as Ga,Uv as x,fH as Za,gw as Ra,Uw as ja,Ux as Ha,Uy as Pa,Uz as Be,UA as Va,UB as xe,UC as La,Ev as Na,gq as Oa,h5 as qa,cW as za,UD as Wa,UE as Ya,qG as Ka,gb as Xa,ja as Ja,UF as Qa,UG as et,wK as at,gr as tt}from"./zeni-epic-state-CvqWLXMw.js";import{w as nt,i as ot,a as st,Z as rt,W as it,A as m,c as lt,u as dt,d as ct,O as ut,e as mt,f as Ct,S as pt,j as ht,g as ft,z as gt,h as P,p as h,m as Ae,k as bt,P as St,l as _e,n as kt,T as De,o as Et,X as wt,q as te,r as ae,s as It,v as vt,x as yt,L as Tt,y as $t,B as Bt,C as xt,D as At}from"./index-CWBFzzoG.js";import{u as _t,q as Dt,r as Ut,I as Mt,p as Ue,t as Ft,D as Me,s as ne}from"./mui-JBqam7ZJ.js";import{u as Gt}from"./InboxNotificationsProvider-CMIqT4_Q.js";import{u as Zt}from"./useTaskManagerAccess-CqgFuERm.js";import{u as Rt}from"./expenseAutomationHelper-BVzWGJR4.js";import"./recharts-C8kt9j-2.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.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]="8de7fae9-4623-41d9-ab21-8cfc3aecd284",a._sentryDebugIdIdentifier="sentry-dbid-8de7fae9-4623-41d9-ab21-8cfc3aecd284")}catch{}})();const A="AppDrawer",c={root:`${A}-root`,drawer:`${A}-drawer`,appBar:`${A}-appBar`,menuButton:`${A}-menuButton`,appBarZenilogo:`${A}-appBarZenilogo`,drawerZenilogo:`${A}-drawerZenilogo`},jt=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"}}))),Ht=nt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:S}=st(),[V,_]=Ta.useState(!1),[k,Re]=o.useState(!1),t=$a(),s=Ba(),oe=Aa(),se=rt(),n=Fe(),[je,He]=o.useState(!1),L=_t(),re=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{re||(n(Q()),n(ee()))}),[n,re]),o.useEffect((()=>{n(Q()),n(ee())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:ie}=u(m.isDebitCardFeatureEnabled),E=lt(),i=r((e=>Ge(e))),N=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Pe}=dt(),w=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Ve}=Zt(E),le=ut(),I=mt(),U=(function(e=2e3){const[l,p]=o.useState(!1);return o.useEffect((()=>{if(l)return;const B=window.requestIdleCallback;if(B==null){const J=window.setTimeout((()=>p(!0)),e);return()=>window.clearTimeout(J)}const R=B((()=>p(!0)),{timeout:e});return()=>{window.cancelIdleCallback?.(R)}}),[e,l]),l})();o.useEffect((()=>{U&&I&&w&&(n(ye()),n(Te()))}),[n,U,I,i.tenantId,w]);const[O,Le]=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:M}=u(m.isReferralFeatureEnabled),We=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",de=r((e=>_a(e)));o.useEffect((()=>{const e=()=>{He(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const q=r((e=>Da(e))),f=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),g=r((e=>Ua(e))),{monthEndCloseChecksView:v}=g,Ye=H("/signout")!==null,F=H("/:tenantEmailDomain/dashboard")!==null,ce=H("/:tenantEmailDomain/reports")!==null,b=H("/:tenantEmailDomain/onboarding/*")!==null,ue=Rt();o.useEffect((()=>{U&&I&&M&&!b&&q.fetchState==="Not-Started"&&n(Ma(!0))}),[U,I,M,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=Ye||b,z=r((e=>e.tenantState)),Xe=r((e=>z.fetchState==="Completed"?Ga(e):[])),{isFeatureEnabled:Je}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:Qe}=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)),W=r((e=>Za(e))),la=r((e=>Ra(e).skillsEnabled)),da=r((e=>ja(e))),Ce=r((e=>Ha(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(Pa),[y,Y]=o.useState(void 0),K=W.uiState.currentChatSessionId,G=y!=null?W.deleteChatSessionStateByChatSessionId[y]?.fetchState:void 0,he=ft(G),{inboxNotifications:X,isLoading:fe,isFetchingMore:ge,hasFetchedAll:be,fetchMore:Ca}=Gt(),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"&&G==="Completed"?(n(Be({chatSessionId:y})),Y(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(G==="Error"&&(n(Be({chatSessionId:y})),Y(void 0)))}),[n,t.state,s,G,y,he,a]),o.useEffect((()=>{if(fe===!1&&ge===!1&&be===!0&&i?.companyId!=null&&X!=null){const e=`dashboard_${i.companyId}`;Le(X.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[fe,ge,be,i?.companyId,X]),o.useEffect((()=>{I&&D&&!b&&me.fetchState==="Not-Started"&&oe.tenantId!=null&&n(Va("task_manager","dashboard"))}),[I,D,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=[];Je===!1&&T.push("accounts_payable_aging"),Qe===!1&&T.push("accounts_receivable_aging"),T.push("zeni_accounts_promo_card","treasury_promo_card"),M===!1&&T.push("rewards_card"),le===!1&&T.push("expense_automation_card");const Se=r((e=>La(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=>{_(e)},ba=We,Sa=i?.rewardsLastViewedTime==null,ka=E?.userEmail!=null&&de.fetchState==="Completed"&&Wa(de.notificationSettings,E.userEmail,ie,i,D),Ea=o.useCallback((e=>{const l=t.state?.referrer;if(v.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,v.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",v.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(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"?Xe:we!=null?[we]:[],rewardsConfiguration:{isRewardsTabVisible:M,isRewardsAnimated:Sa,rewardsPlan:q.rewardsPlan},selectedMenu:C===!0?De("ai_cfo"):_e(t)&&pe!=="completed"?De("invoicing"):Et(t),isTenantDropdownDisabled:ha,isSettings:kt(t),isInvoicing:_e(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=Ve?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=>{Pe(Tt.TENANT_SWITCHING),$(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:E})},handleMenuChange:(e,l)=>{if(E!=null&&P.trackSidePanelClicked(e.type,e.group),$(!1),a==null)return;if(e.type==="routines")return N?(n(Te()),n(Qa()),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(Q()),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(P.trackAICFOChatScreenStateChanged("viewed","left_menu",K??null,null),!N)return void ae({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const j=h(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:j,referrer:"Sidebar"}})}const p=h(t.state?.pathnameStackToGoBack,t.pathname),B=e.type,R=At(B)&&B!=="command_center";if(B!=="command_center"&&!R||f[i.tenantId]==null||P.trackMonthEndCloseClicked(f[i.tenantId].month,f[i.tenantId].year,"Sidebar"),R&&f[i.tenantId]!=null){const j=f[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${j.month}-${j.year}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})}const J=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}/${J}`,{state:{pathnameStackToGoBack:p,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Ja(e)),K===e&&Y(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:Re,aiCfoView:W,isAiCfo:Ia,isOnDashboard:F,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Xa({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:ea,thanksGivingAnimationEnabled:aa,christmasAnimationEnabled:ta,newYearAnimationEnabled:na}),va=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:je?`1px solid ${L.colors.grey2}`:""},children:d.jsxs(Ut,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>$(!0),className:c.menuButton,size:"large",children:d.jsx(Pt,{})}),d.jsx(Vt,{className:c.appBarZenilogo,onClick:()=>{se.toggle()}})]})}),ve=Ue((e=>e.breakpoints.up("md"))),ya=Ue((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(jt,{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(Me,{container:window.document.body,variant:"temporary",open:V,onClose:()=>$(!1),PaperProps:{sx:{width:te,zIndex:Ae[2],borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background}},ModalProps:{keepMounted:!0},children:Ie}),ya?null:d.jsx(Me,{PaperProps:{sx:{width:te,borderRight:"none",backgroundImage:"none",backgroundColor:L.colors.background,...wa}},variant:"permanent",open:!0,children:Ie})]})]}):null]})})),i1=({tenantEmailDomain:a})=>{const C=Fe(),S=r((_=>Ge(_))),V={events:S.userRoleId!=null?[`private-encrypted-${S.userRoleId}.dashboard-user-notification`]:[],eventCallback:(_,k)=>{ot(k)&&xa(k.mode)==="dashboard"&&C(Ze({unreadCount:k.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...V})},Pt=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-CRyd9n8B.js";import{a as d}from"./sentry-BOmfv4Oi.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as Z,n as te,o as x}from"./core-C6dxOS4P.js";import{fI as P,Zq as w,Z7 as R,I3 as E,HZ as q,I1 as A,HS as H,Z9 as K,HW as ae,I5 as oe,HV as z,I8 as X,I4 as C}from"./zeni-epic-state-C5-RfNOq.js";import{z as O,w as J,bX as pe,n as T,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-pj4u0b1G.js";import{u as M}from"./mui-0pGBD9L4.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-CXdcXz04.js";import ie from"./NotFoundScreen-BWSuWGJw.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]="226b4645-2130-4651-8425-2bed575a3184",e._sentryDebugIdIdentifier="sentry-dbid-226b4645-2130-4651-8425-2bed575a3184")}catch{}})();const k="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(k)&&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"))}}}))(J(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))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!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 m={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...m})},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))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(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)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),m=y((i=>P(i)));Q();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(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,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:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:m,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=S=>{const m=[];return S.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);m.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},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 S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},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(X(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.getSignedInUser(),n=M(),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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const me=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 D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,m=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=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=m?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:m?.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(X(!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}=Y(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Q(),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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(me,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
1
|
+
import{j as u}from"./liveblocks-Cnrd0Zxu.js";import{a as d}from"./sentry-FYTScRKu.js";import{h as U,g as j,u as B,j as y,N as W,l as V,i as Z,n as te,o as x}from"./core-CbG1OV1-.js";import{fI as P,Zq as w,Z7 as R,I3 as E,HZ as q,I1 as A,HS as H,Z9 as K,HW as ae,I5 as oe,HV as z,I8 as X,I4 as C}from"./zeni-epic-state-CvqWLXMw.js";import{z as O,w as J,bX as pe,n as T,bR as Y,bY as le,a5 as G,bZ as se,b_ as ne}from"./index-CWBFzzoG.js";import{u as M}from"./mui-JBqam7ZJ.js";import{u as Q,i as re}from"./ReimbursementApprovalRuleDetailScreen-1I1rQcTe.js";import ie from"./NotFoundScreen-DCB7OcSg.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]="226b4645-2130-4651-8425-2bed575a3184",e._sentryDebugIdIdentifier="sentry-dbid-226b4645-2130-4651-8425-2bed575a3184")}catch{}})();const k="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(k)&&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"))}}}))(J(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))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!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 m={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,I)=>{r.endsWith(k)&&I.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...m})},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))}}}))(J(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Y(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)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),m=y((i=>P(i)));Q();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(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,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:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,b,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(W,{to:"../../promo"}):u.jsx(de,{currentTenant:m,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=S=>{const m=[];return S.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);m.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},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 S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},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(X(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.getSignedInUser(),n=M(),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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const me=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 D=[];N==="role"?D=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(D=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";b.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),b},c=p.amountCriteria,S=p.vendorCriteria,m=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=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const I=m?.selection.selectedOptions??[];if(I.length>0&&(r.department={type:"department",operator:m?.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(X(!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}=Y(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=Z(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(Q(),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(G,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(me,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-CRyd9n8B.js";import{h as J,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-C6dxOS4P.js";import{fI as Y,YJ as Ge,bq as It,SJ as ia,bo as vt,bK as de,YK as kt,Hj as wt,II as Re,HW as oa,bn as Ce,YL as la,YM as sa,c9 as ra,YN as ca,m3 as xt,YO as Bt,YP as Ct,Ja as Ue,HC as xe,YQ as da,H7 as et,YR as ua,N2 as pa,Hb as ma,Hh as At,YS as Se,YT as _e,IJ as Me,Hz as Dt,YU as ba,YV as ha,IM as Ze,YW as ga,IS as Sa,YX as Et,Il as tt,Iq as ya,YY as fa,YZ as ce,Y_ as jt,Y$ as Tt,Z0 as Pt,gZ as Ia,HH as Ve,cH as Ft,Z1 as va,gk as ka,Z2 as wa,Z3 as xa,e0 as Rt,d$ as Vt,Z4 as Oe,Z5 as Ba,Z6 as Ca,Xh as Ne,Z7 as Aa,Xi as ie,Xj as ze,Z8 as Da,Z9 as Ea,Za as ja,Is as at,Ip as Ta,Zb as Pa,Zc as Fa,Zd as Ra,Ib as Va,Ze as $a,Zf as La,cv as $t,db as Lt,me as Ga,bP as Ua,br as Gt,bQ as Ut,Gn as _a,Zg as Ma,MR as Za,MX as Oa,Cx as Na,IK as za,Jh as Ha,mr as ge,Zh as Wa,Zi as _t,mV as Ya,ml as Mt,mG as Zt,mF as nt,bF as pe,bO as qa,Zj as Ja,Zk as ye,kR as Ka,Zl as it,Zm as Xa,kV as Qa,le as en,Jv as tn,Zn as an,mO as nn,Jl as on,Zo as ot,Jp as ln,Ju as sn,Js as rn,Jj as cn,Zp as Ot,Hs as dn,Zq as un,Zr as pn,gJ as mn,gI as bn,gH as hn,mu as gn,mM as lt,mX as Sn,v2 as yn,mD as fn,Jn as In,k$ as vn,n0 as kn,Zs as wn,kT as xn,uV as Bn,Zt as Cn,Ih as An,bL as Dn,bu as En,UI as jn,de as Tn,dd as Pn,cG as Fn,cN as Rn}from"./zeni-epic-state-C5-RfNOq.js";import{z as V,V as fe,aq as He,W as oe,A as f,bg as We,a5 as se,C as A,a6 as Ae,h as E,bt as Vn,a2 as W,at as Ye,p as D,$ as Ie,bu as st,bv as rt,bw as $n,ax as Ln,ad as Gn,aQ as Un,a9 as Nt,G as De,ae as qe,bx as _n,ac as zt,by as Mn,ao as Zn,K as Ht,w as On,bz as Nn,bA as zn,bB as Hn,bC as Wn,bD as Yn,bE as qn,bF as Jn,bG as Kn,bH as Xn,Z as Qn,bI as ei,bq as ti,bJ as ai,ag as ni,bK as ii,f as oi}from"./index-pj4u0b1G.js";import{u as ue,n as G,S as li}from"./mui-0pGBD9L4.js";import{A as ct}from"./AddressScreen-lx_HZDfg.js";import{g as ne,a as Ee,i as Wt,V as Je,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-agLHT6HV.js";import{a as g}from"./sentry-BOmfv4Oi.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-D_lZcHX9.js";import{u as Yt}from"./useInitialThreadRequest-B9k0MBEA.js";import{u as di}from"./BusinessVerificationPageScreen-CqCRDHlP.js";import Be from"./NotFoundScreen-BWSuWGJw.js";import{D as ui}from"./DrawerScreen-B3BZEyK7.js";import{M as qt}from"./MobileAppDrawer-CTQRP8UJ.js";import{F as Jt}from"./FeaturePreviewScreen-DInsBmdk.js";import{S as je}from"./SetupPagesScreen-u4czjChG.js";import{B as pi}from"./BillPayApprovalRoutes-z6WREO6S.js";import{F as mi}from"./ScreenRoutes-NcBi_D0j.js";import"./recharts-C9C0kAsT.js";import"./analytics-BGlrzyDz.js";import"./plaid-CO0-sO-T.js";import"./dnd-BtyoSdzG.js";import"./stripe-cKAAJElX.js";import"./lottie-CXwABHQ0.js";import"./lexical-plr3Wvpq.js";import"./pdf-c_Y6aTYi.js";import"./utils-DrAWZPZ0.js";import"./routePaths-D6noST9U.js";import"./InboxNotificationsProvider-CJ6RDL31.js";import"./useTaskManagerAccess-DlX9f1Pd.js";import"./analyticsHelper-N9KfV3Ey.js";import"./ReimbursementApprovalRuleDetailScreen-CXdcXz04.js";import"./getLocaleForTenant-D3SNBEiv.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]="be86bc73-a3ad-4c0a-9575-0c03cc5263f9",e._sentryDebugIdIdentifier="sentry-dbid-be86bc73-a3ad-4c0a-9575-0c03cc5263f9")}catch{}})();const bi=X((function(e,t){const l=Ge(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:`${Ye}/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=J(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>Y(U))),s=v((U=>Ge(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Yt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({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,T]=g.useState(!1),[B,j]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:_}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?j(!1):j(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||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,M,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??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(T(!0),t(Re(!1,O,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,q]),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=>(Z=>{n!=null&&Z.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Nt(100,58)},ut=X((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(Ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=J(),{billId:n}=ee(),c=K(),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),T=v((P=>Y(P)));di();const[B,j]=g.useState(!1),[k,$]=g.useState(!1),[O,_]=g.useState(!1),[N,z]=g.useState(),w=v((P=>_e(P,m,h,n)));let M=w.fetchState,L=w.file,H=w.showAutofill;const q=v((P=>Ge(P,n??"")));u===!1&&(M=q.fetchState,L=q.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(Me(!0))}),[n,t]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&j(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(j(!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 Z={onOkClick:()=>{if(_(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Ze(N,m,n))},onCancelClick:()=>{if(_(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:N,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(T.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,T.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||q.fetchState==="Error")return a.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(Te,{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:_,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(Te,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Kt,{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(Te,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:Z,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,q,w),setShowConfirmationPopup:_,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=_n();return a.jsx(Kt,{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-Cnrd0Zxu.js";import{h as J,u as le,g as K,i as ee,j as v,N as Q,l as X,q as aa,n as na,o as y}from"./core-CbG1OV1-.js";import{fI as Y,YJ as Ge,bq as It,SJ as ia,bo as vt,bK as de,YK as kt,Hj as wt,II as Re,HW as oa,bn as Ce,YL as la,YM as sa,c9 as ra,YN as ca,m3 as xt,YO as Bt,YP as Ct,Ja as Ue,HC as xe,YQ as da,H7 as et,YR as ua,N2 as pa,Hb as ma,Hh as At,YS as Se,YT as _e,IJ as Me,Hz as Dt,YU as ba,YV as ha,IM as Ze,YW as ga,IS as Sa,YX as Et,Il as tt,Iq as ya,YY as fa,YZ as ce,Y_ as jt,Y$ as Tt,Z0 as Pt,gZ as Ia,HH as Ve,cH as Ft,Z1 as va,gk as ka,Z2 as wa,Z3 as xa,e0 as Rt,d$ as Vt,Z4 as Oe,Z5 as Ba,Z6 as Ca,Xh as Ne,Z7 as Aa,Xi as ie,Xj as ze,Z8 as Da,Z9 as Ea,Za as ja,Is as at,Ip as Ta,Zb as Pa,Zc as Fa,Zd as Ra,Ib as Va,Ze as $a,Zf as La,cv as $t,db as Lt,me as Ga,bP as Ua,br as Gt,bQ as Ut,Gn as _a,Zg as Ma,MR as Za,MX as Oa,Cx as Na,IK as za,Jh as Ha,mr as ge,Zh as Wa,Zi as _t,mV as Ya,ml as Mt,mG as Zt,mF as nt,bF as pe,bO as qa,Zj as Ja,Zk as ye,kR as Ka,Zl as it,Zm as Xa,kV as Qa,le as en,Jv as tn,Zn as an,mO as nn,Jl as on,Zo as ot,Jp as ln,Ju as sn,Js as rn,Jj as cn,Zp as Ot,Hs as dn,Zq as un,Zr as pn,gJ as mn,gI as bn,gH as hn,mu as gn,mM as lt,mX as Sn,v2 as yn,mD as fn,Jn as In,k$ as vn,n0 as kn,Zs as wn,kT as xn,uV as Bn,Zt as Cn,Ih as An,bL as Dn,bu as En,UI as jn,de as Tn,dd as Pn,cG as Fn,cN as Rn}from"./zeni-epic-state-CvqWLXMw.js";import{z as V,V as fe,aq as He,W as oe,A as f,bg as We,a5 as se,C as A,a6 as Ae,h as E,bt as Vn,a2 as W,at as Ye,p as D,$ as Ie,bu as st,bv as rt,bw as $n,ax as Ln,ad as Gn,aQ as Un,a9 as Nt,G as De,ae as qe,bx as _n,ac as zt,by as Mn,ao as Zn,K as Ht,w as On,bz as Nn,bA as zn,bB as Hn,bC as Wn,bD as Yn,bE as qn,bF as Jn,bG as Kn,bH as Xn,Z as Qn,bI as ei,bq as ti,bJ as ai,ag as ni,bK as ii,f as oi}from"./index-CWBFzzoG.js";import{u as ue,n as G,S as li}from"./mui-JBqam7ZJ.js";import{A as ct}from"./AddressScreen-DQovxLbJ.js";import{g as ne,a as Ee,i as Wt,V as Je,b as Ke,c as si,v as ri,d as ci,A as me,D as be}from"./DomesticWireDetailScreen-BwldHnbW.js";import{a as g}from"./sentry-FYTScRKu.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DwBC4EIF.js";import{u as Yt}from"./useInitialThreadRequest-DrHN756f.js";import{u as di}from"./BusinessVerificationPageScreen-Do37GzKA.js";import Be from"./NotFoundScreen-DCB7OcSg.js";import{D as ui}from"./DrawerScreen-CbLKvWzA.js";import{M as qt}from"./MobileAppDrawer-Dew93Hd0.js";import{F as Jt}from"./FeaturePreviewScreen-m622MoLl.js";import{S as je}from"./SetupPagesScreen-DRx3iKSB.js";import{B as pi}from"./BillPayApprovalRoutes-LlqJ9eB0.js";import{F as mi}from"./ScreenRoutes-CDcwGWJY.js";import"./recharts-C8kt9j-2.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.js";import"./routePaths-BXStbwFd.js";import"./InboxNotificationsProvider-CMIqT4_Q.js";import"./useTaskManagerAccess-CqgFuERm.js";import"./analyticsHelper-cWQXE2Ud.js";import"./ReimbursementApprovalRuleDetailScreen-1I1rQcTe.js";import"./getLocaleForTenant-DBrt2Owv.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]="be86bc73-a3ad-4c0a-9575-0c03cc5263f9",e._sentryDebugIdIdentifier="sentry-dbid-be86bc73-a3ad-4c0a-9575-0c03cc5263f9")}catch{}})();const bi=X((function(e,t){const l=Ge(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:`${Ye}/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=J(),t=le(),l=K(),{billId:n}=ee(),c=ue(),r=V.getSignedInUser(),u=fe(),o=v((U=>Y(U))),s=v((U=>Ge(U,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Yt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({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,T]=g.useState(!1),[B,j]=g.useState(!1),{useFeatureGate:k,useDynamicConfig:$}=oe(),{isFeatureEnabled:O}=k(f.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:_}=k(f.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=$(We.zeniAssistConfig),z=ia(o),w=vt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),L=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:H}=k(f.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=k(f.billPaySetupShowInternationalPaymentByWise);if(g.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&z===!1?j(!1):j(s.billActivities[0]?.isRealTimeApprovalEnabled&&(w||M||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,M,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??"",O,L,!1)))}),[b,s,n,t]),g.useEffect((()=>{I||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(T(!0),t(Re(!1,O,L,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(oa()))}),[I,s,n,t,O,L,q]),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=>(Z=>{n!=null&&Z.trackBillPayBillDetails(n,s.isRecurring)})(U)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:H,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:_,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const $e=De.getLocalizedStrings().spendManagement.billPay.billDetails,dt=De.getLocalizedStrings().common,gi={containerWidth:new Nt(100,58)},ut=X((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(Ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{E?.trackBillPaySkipAutofill(),e(Me(n))},onDeleteClick:()=>{e(ga({billId:t.billId})),E?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function x({appContent:e}){const t=le(),l=J(),{billId:n}=ee(),c=K(),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),T=v((P=>Y(P)));di();const[B,j]=g.useState(!1),[k,$]=g.useState(!1),[O,_]=g.useState(!1),[N,z]=g.useState(),w=v((P=>_e(P,m,h,n)));let M=w.fetchState,L=w.file,H=w.showAutofill;const q=v((P=>Ge(P,n??"")));u===!1&&(M=q.fetchState,L=q.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(Me(!0))}),[n,t]),g.useEffect((()=>{M==="Not-Started"&&(u&&k?$(!1):!u&&B&&j(!1))}),[n]),g.useEffect((()=>{B||n==null||u||(j(!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 Z={onOkClick:()=>{if(_(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","yes"),t(ha({replaceBillData:!0,billId:n})),t(Ze(N,m,n))},onCancelClick:()=>{if(_(!1),!N)return;const P=L!=null?"replace":"upload";E?.trackInvoiceActionClick(U??"",P,i?.userEmail??"","no"),t(ba({file:N,billId:n}))}},te=g.useCallback((()=>{const P=W(c.state?.pathnameStackToGoBack),ve=P.poppedPathname??ne(T.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:P.newStack}})}),[c.state,T.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(M==="Error"||q.fetchState==="Error")return a.jsx(Be,{});if(M!="Completed")return n==null&&o!=="small"?a.jsx(st,{fallback:te,children:a.jsxs(Te,{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:_,setPayload:z,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:U}),a.jsx(Fe,{windowSize:o,children:a.jsx(rt,{isNewBill:!0})})]})}):a.jsxs(Te,{windowSize:o,children:[o==="small"||H?null:a.jsx(pt,{children:a.jsx(Kt,{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(Te,{windowSize:o,children:[H&&o!=="small"?a.jsx(mt,{}):null,O?a.jsx(Ln,{titleComponent:a.jsx(wi,{children:$e.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:$e.overwriteDescription}),primaryButtonText:dt.yes,secondaryButtonText:dt.no,action:Z,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,q,w),setShowConfirmationPopup:_,setPayload:z,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:P}),a.jsx(Fe,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=_n();return a.jsx(Kt,{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=G.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-FYTScRKu.js";import{u as H,j as h,h as se,g as oe,i as ie,N as re,l as ce}from"./core-CbG1OV1-.js";import{fI as z,HZ as ue,Ib as de,Ln as le,Od as pe,OT as me,PI as fe,ZB as ye,BY as Se,SM as ge,ZC as Ie,ZD as he,ZE as be,ZF as Te,ZG as De,ZH as Ce,VQ as Oe,YH as ke,W3 as Ve,Mz as Ae,Mr as we,W4 as Fe,Mv as Ne,mL as ve,gJ as _e,gI as Ee,gH as xe,v2 as Be,uV as ze,uS as Re,mD as Me,C5 as Pe,C3 as R,bF as M,Ch as P,cF as Le}from"./zeni-epic-state-CvqWLXMw.js";import{bR as Ue,V as Ze,W as je,bg as Ge,z as B,a6 as He,h as L,n as E,K as x,bT as Ke,ac as We,p as U,aE as Z}from"./index-CWBFzzoG.js";import{n as qe}from"./mui-JBqam7ZJ.js";import{j as A}from"./liveblocks-Cnrd0Zxu.js";import{d as j}from"./routePaths-BXStbwFd.js";import{M as Ye}from"./MobileAppDrawer-Dew93Hd0.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="a90aa953-2a83-42b1-acf5-a345e3b99ed7",e._sentryDebugIdIdentifier="sentry-dbid-a90aa953-2a83-42b1-acf5-a345e3b99ed7")}catch{}})();function it(){const e=H(),r=h((u=>z(u))),a=r?.tenantId,{isApprovalRulesV3Enabled:s,isLoading:l}=Ue(a),p=h((u=>u.billPaySetupApproverViewState.fetchState));O.useEffect((()=>{a==null||l||p==="Not-Started"&&e(ue(!0,!0,s))}),[a,l,s,p,e])}function G(e,r,a,s=!1){switch(r){case"zeni_accounts":e(fe(a,!0,s));break;case"zeni_treasury":e(me(a,!0,s));break;case"reimbursement":e(pe(a,!0,s));break;case"charge_cards":e(le(a,!0,s));break;default:e(de(a,!0,s))}}const $e=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-Cnrd0Zxu.js";import{a as r}from"./sentry-FYTScRKu.js";import{u as he,h as fe,g as Ce,j as H,i as Se,l as ge}from"./core-CbG1OV1-.js";import{e4 as be,a as Pe,e5 as ye,z as Ie,e7 as we,e9 as W,ea as Ee,bm as G,a6 as ke,h as F,eb as M,el as xe,G as Ae,K as Te,w as Ue,ee as Oe,ef as _e,at as ve,ei as Qe,ej as je,bi as De,ek as Fe}from"./index-CWBFzzoG.js";import{gN as $e,fH as J,fI as Le,gb as Ve,jp as Re,jl as qe,fJ as N,gx as Be,gr as He,gt as z,gz as Me,gA as Ne,gB as ze,gC as We,gD as Ge}from"./zeni-epic-state-CvqWLXMw.js";import{D as Je,n as L,v as Ke,S as Ye}from"./mui-JBqam7ZJ.js";import"./recharts-C8kt9j-2.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./utils-0scyINMC.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]="007d8a32-9ccc-485b-bf88-700085003bff",t._sentryDebugIdIdentifier="sentry-dbid-007d8a32-9ccc-485b-bf88-700085003bff")}catch{}})();const K="chat-response-generated",Y="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 c=J(t),l=s.isSubmitting,u=_e(t,{allUsers:s.allUsers,onCardPolicyVendorSearchTextChange:s.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:s.sessionFromUrl==="new_chat"&&c.uiState.currentChatSessionId==null,aiCfoView:c,isSubmitting:l,isNewChatSession:s.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${ve}/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:c,currentTenant:l,userId:u,navigate:o,currentChatSessionId:P,allSessionsWithOrderedQuestionAnswers:f,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,cardPolicyPageContext:T}=s,C=l.tenantEmailDomain,d=c.state?.referrer,h=d===X?Z(C):$(C);return{onEventReceived:(a,n)=>{if(a===K&&typeof n.text=="string"&&typeof n.metadata=="object"){const e=n,m=Ne(e.type),y=e.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:b,currentQuestionAnswerSummary:p}=G(f,y);m!=="answer"?F.trackAICFOChatResponseGenerated(m,b?.question.questionText??"",e.text,y,Fe(p,U),e.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(e.text,b?.question.questionText??"",(e.follow_up_questions?.length??0)>0,!!e.assumptions,!!e.insights,e.visualization!=null,ze(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,f,u,m,e,T)},updateCurrentInput:a=>{t(z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{t(Me(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{o(-1)},onCloseClick:()=>{o(h,{state:{...c.state}}),t(z(""))},togglePageView:()=>{o(h,{state:W(c.state)}),s.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{o(-1)},onNewChatClick:()=>{P!=null&&t(He()),o((function(a){return`/${a}/${Y}`})(C),{state:{...c.state}})},onToggleCotCollapsed:(a,n)=>{t(Be({questionAnswerId:a,isCollapsed:n}))},...je(t,{isAiCardCreationEnabled:x,isCardPolicyEnabled:A,currentChatSessionId:P,onAfterCardsCreationSubmit:()=>{s.setIsAiCfoOpen(!0),o($(C),{state:{...c.state}})},onAfterCardPolicySubmit:()=>{s.setIsAiCfoOpen(!0),o(`/${C}/cards/policy`,{state:{...c.state}})}})}}))(Ue(Oe)),{spendManagement:{chargeCard:{cardsAiCfoHero:ee,cardPolicyAiCfoHero:te}}}=Ae.getLocalizedStrings(),k=ee.pageTitle,Ze=te.pageTitle,et=ee.chatHeaderSubtitle,tt=te.chatHeaderSubtitle,Pt=({isFileUploadEnabled:t})=>{const s=be(),{setIsAiCfoOpen:c}=Pe(),l=he(),u=fe(),o=Ce(),[P,f]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,onCardPolicyVendorSearchTextChange:C}=ye();r.useEffect((()=>{l($e())}),[l]);const d=H((i=>J(i))),h=Ie.getSignedInUser(),{session_id:a}=Se(),n=H((i=>Le(i))),e=d.uiState.currentChatSessionId,m=n.tenantEmailDomain,{handleUploadPromoClose:y,isUploadPromoVisible:U}=we({isFileUploadEnabled:t,tenantEmailDomain:m}),b=o.state,p=b?.aiCfoInitialQuestion??null,O=!!b?.aiCfoShouldSubmit,I=b?.referrer===X,se=I?"card_policy":void 0,ae=r.useMemo((()=>({title:I?Ze:k,subtitle:I?tt:et})),[I]),[oe,_]=r.useState(null),[ne,v]=r.useState(!1),Q=r.useRef(!1);r.useEffect((()=>{Q.current||p==null||p===""||(_(p),v(O),Q.current=!0)}),[p,O]);const ie=r.useCallback((()=>{_(null),v(!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:w}=E.current;E.current=null,_(i),v(w),Q.current=!1}}),[S]);const{visitedSessions:V}=Ee(e),j=d.fetchState,D=d.uiState.chatSessionsNextPageToken.hasMore||!d.uiState.chatSessionsFirstPageFetched,R=e!=null?d.fetchChatSessionHistoryByChatSessionId?.[e]?.fetchState??"Not-Started":"Not-Started",q=e==null||(d.uiState.chatHistoryNextPageToken[e]?.hasMore??!0),B=d.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:le}=G(B,e),ce=le.length===0;r.useEffect((()=>{e!=null&&a!==e&&u((function(i,w){return`/${i}/${Y}/${w}`})(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 de=r.useMemo((()=>({events:V.map((i=>`private-encrypted-chat-${i}.${K}`)),eventCallback:(i,w,pe)=>pe.onEventReceived(i,w)})),[V]);if(r.useEffect((()=>{j!=="In-Progress"&&D&&l(Re())}),[j,D,l]),r.useEffect((()=>{e!=null&&R!=="In-Progress"&&q&&h!=null&&j==="Completed"&&!D&&l(qe(e,h.userId))}),[R,q,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&&d.responseStateByChatSessionId?.[e]?.answer?.fetchState==="In-Progress";return g.jsxs(at,{children:[g.jsx(ke,{analytics:F,onLoad:i=>i.trackPageLoaded(Te.Event.aiCFOPage)}),S?g.jsx(Xe,{answerExportEndPoint:s,...de,currentChatSessionId:e,allSessionsWithOrderedQuestionAnswers:B,allUsers:x,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,openOnboardingPage:()=>f(!0),userId:h.userId,setIsAiCfoOpen:c,navigate:u,sessionFromUrl:ue,location:o,isSubmitting:me,isEmptyChatWithSession:ce,customPageTitle:k,chatHeader:ae,currentTenant:n,emailLinkQuestion:oe??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:ie,isFileUploadEnabled:t,isUploadPromoVisible:U,onUploadPromoClose:y,onCardPolicyVendorSearchTextChange:C,cardPolicyPageContext:se}):g.jsx(M,{isTOSAccepted:S,acceptMasterTOSState:d.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{u(I?Z(m):$(m),{state:{...o.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(p!=null&&p!==""&&(E.current={question:p,shouldSubmit:O}),l(N(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:()=>f(!1),children:g.jsx(st,{onClick:i=>i.stopPropagation(),children:g.jsx(M,{isTOSAccepted:S,acceptMasterTOSState:d.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>f(!1),onCompleteClick:()=>{S||n.userRoleId==null||l(N(n.userRoleId)),f(!1)}})})})]})},st=L(Ye)`
|
|
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-CRyd9n8B.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-C6dxOS4P.js";import{fV as _t,a0n as cs,g5 as Pt,bu as Fe,a0o as is,a0p as ds,fK as hn,a0q as _n,fT as Pn,a0r as wn,a0s as vn,a0t as Tn,a0u as Fn,fU as xn,g4 as Ln,a0v as Bn,a0w as ls,f_ as us,fZ as ms,a0x as Cs,Ks as Rn,g7 as ia,a0y as ps,a0z as hs,fM as fs,fL as gs,gk as Ye,g0 as On,f$ as Un,a0A as bs,g1 as Ss,J_ as ys,JZ as Is,K1 as ks,K3 as Es,gd as As,fH as jn,a0B as Ds,a0C as _s,gi as Mn,a0D as Ps,gj as St,K9 as ws,K6 as vs,fI as ge,a0E as Wa,d$ as xe,dj as Le,e0 as Be,h2 as da,cC as la,a0F as ua,a0G as wt,Dh as Ga,mb as $a,a0H as Ka,KI as Ia,g8 as Qe,KK as vt,m1 as Nn,a0I as ma,Kw as Da,a0J as Ts,a0K as Fs,Kz as qa,a0L as xs,Zy as Qa,g3 as Vn,KF as ga,iu as Ls,a0M as Hn,fW as Ca,br as Bs,a0N as Rs,gJ as Ja,gI as Xa,Lc as Os,gH as et,a0O as Gn,cv as $n,db as Us,Zx as Pa,LN as Kn,a0P as fn,Ln as _a,a0Q as zn,LO as js,ZY as Ms,LP as Ns,MX as Vs,Cx as Hs,MR as Gs,a0R as $s,KJ as oa,a0S as Ks,a0T as zs,a0U as Ys,a0V as Zs,a0W as Ws,a0X as Tt,a0Y as qs,KZ as Yn,KS as Qs,a0Z as Js,h4 as Xs,a0_ as Zn,L6 as Wn,La as qn,h3 as eo,a0$ as ao,Lz as Qn,a10 as to,a11 as no,a12 as ro,L8 as Jn,KV as Xn,KC as er,L2 as ar,L0 as tr,L4 as so,a13 as nr,a14 as oo,gf as co,gg as io,gh as lo,a15 as at,g9 as rr,dd as Ft,a16 as uo,a17 as mo,a18 as Co,a19 as po,Li as yt,LG as ho,LC as fo,Le as go,LE as bo,Lu as So,Lw as yo,a1a as sr,LM as Ha,SJ as Io,a1b as ko,a1c as Eo,a1d as Ao,a1e as or,a1f as Do,M7 as _o,Lm as cr,Lh as Ne,Ll as Po,a1g as wo,a1h as vo,Kt as To,a1i as ir,g2 as dr,a1j as Fo,Kv as xo,Ku as gn,a1k as Lo,a1l as Bo,a1m as Ro,VR as Oo,a1n as xt,a1o as Uo,xy as lr,mL as jo,ij as Mo,Mc as No,a1p as ur,fQ as Vo,fR as Ho,a1q as Go,dQ as $o,g6 as Ko,M2 as zo,LY as qe,bq as Yo,bK as Zo,cH as Wo,bL as qo,UI as Qo}from"./zeni-epic-state-C5-RfNOq.js";import{V as Re,dc as mr,a2 as we,dd as Cr,de as pr,df as Jo,G as aa,aq as Lt,dg as Xo,dh as ec,a as hr,d as fr,ap as gr,p as Ee,W as de,A as q,g as Sa,di as br,dj as ac,dk as tc,z as te,a5 as wa,d1 as tt,dl as nc,dm as rc,dn as sc,$ as va,bg as Xe,bD as Bt,dp as oc,a9 as Ta,R as nt,h as ee,w as rt,dq as cc,bP as ba,dr as It,ds as ic,a6 as Rt,dt as dc,ac as Sr,at as kt,du as lc,ao as yr,F as Ir,K as kr,bl as uc,dv as mc,dw as Cc,dx as pc,dy as hc,dz as fc,dA as gc,C as za,dB as bc,dC as Sc,m as pt,Z as yc,dD as Ic,dE as kc,dF as Ec,ag as Ac,dG as Dc,dH as _c,f as Pc}from"./index-pj4u0b1G.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-0pGBD9L4.js";import{a as r}from"./sentry-BOmfv4Oi.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-D_lZcHX9.js";import{M as Ae}from"./MobileAppDrawer-CTQRP8UJ.js";import{d as Ut}from"./recharts-C9C0kAsT.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 vc,i as jt,P as Tc,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-u4czjChG.js";import{u as wr}from"./useInitialThreadRequest-B9k0MBEA.js";import st from"./NotFoundScreen-BWSuWGJw.js";import{u as Nt}from"./useChargeCardPusherEvents-ijimVvc8.js";import{n as Sn}from"./utils-DrAWZPZ0.js";import{t as Lc}from"./AddressScreen-lx_HZDfg.js";import"./analytics-BGlrzyDz.js";import"./plaid-CO0-sO-T.js";import"./dnd-BtyoSdzG.js";import"./stripe-cKAAJElX.js";import"./lottie-CXwABHQ0.js";import"./lexical-plr3Wvpq.js";import"./pdf-c_Y6aTYi.js";import"./InboxNotificationsProvider-CJ6RDL31.js";import"./useTaskManagerAccess-DlX9f1Pd.js";import"./BusinessVerificationPageScreen-CqCRDHlP.js";import"./routePaths-D6noST9U.js";import"./analyticsHelper-N9KfV3Ey.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]="80d9e2c7-6b8f-4858-a130-20500de18e54",e._sentryDebugIdIdentifier="sentry-dbid-80d9e2c7-6b8f-4858-a130-20500de18e54")}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}},vr=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 Tr(){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=>vn(P.cardPolicyState))),S=d((P=>Tn(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]),Tr();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(vr)),[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]),W=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]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.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 v=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(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:Y,onClickMenuIcon:u,onFormChange:_,onSubmit:W,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Je,{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((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.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 v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="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]),Tr();const y=d((v=>v.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((v=>!mr(v.status.code))).map(vr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({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((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,Y=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??Y;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,Y]),W=r.useCallback((()=>{e(Y)}),[e,Y]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))}),[s,H,e,Y]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{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:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:W,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,W=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:ve}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,ve,3)),[X,ve]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!T,he=r.useCallback((Q=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);W(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,W,$]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=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:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,Y,_,Ce,De,Te,fe,oe,Se,J,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(vs(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((X=>ge(X))),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((X=>Wa(X).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((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,Y=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=Y?.accountingClassIDs[0],W=d((X=>_!=null?$a(X.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 X=_e(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=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(v,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:T,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:W?.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",Zc="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}`)),Wc=[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(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){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??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Wc),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 Jc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),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((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.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 W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),Y=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=W=>{O(W)};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(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(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-Cnrd0Zxu.js";import{u as le,j as d,h as ie,g as me,i as Ve,N as Je,s as Dt,l as Pe,t as Dn,n as os,o as ne}from"./core-CbG1OV1-.js";import{fV as _t,a0n as cs,g5 as Pt,bu as Fe,a0o as is,a0p as ds,fK as hn,a0q as _n,fT as Pn,a0r as wn,a0s as vn,a0t as Tn,a0u as Fn,fU as xn,g4 as Ln,a0v as Bn,a0w as ls,f_ as us,fZ as ms,a0x as Cs,Ks as Rn,g7 as ia,a0y as ps,a0z as hs,fM as fs,fL as gs,gk as Ye,g0 as On,f$ as Un,a0A as bs,g1 as Ss,J_ as ys,JZ as Is,K1 as ks,K3 as Es,gd as As,fH as jn,a0B as Ds,a0C as _s,gi as Mn,a0D as Ps,gj as St,K9 as ws,K6 as vs,fI as ge,a0E as Wa,d$ as xe,dj as Le,e0 as Be,h2 as da,cC as la,a0F as ua,a0G as wt,Dh as Ga,mb as $a,a0H as Ka,KI as Ia,g8 as Qe,KK as vt,m1 as Nn,a0I as ma,Kw as Da,a0J as Ts,a0K as Fs,Kz as qa,a0L as xs,Zy as Qa,g3 as Vn,KF as ga,iu as Ls,a0M as Hn,fW as Ca,br as Bs,a0N as Rs,gJ as Ja,gI as Xa,Lc as Os,gH as et,a0O as Gn,cv as $n,db as Us,Zx as Pa,LN as Kn,a0P as fn,Ln as _a,a0Q as zn,LO as js,ZY as Ms,LP as Ns,MX as Vs,Cx as Hs,MR as Gs,a0R as $s,KJ as oa,a0S as Ks,a0T as zs,a0U as Ys,a0V as Zs,a0W as Ws,a0X as Tt,a0Y as qs,KZ as Yn,KS as Qs,a0Z as Js,h4 as Xs,a0_ as Zn,L6 as Wn,La as qn,h3 as eo,a0$ as ao,Lz as Qn,a10 as to,a11 as no,a12 as ro,L8 as Jn,KV as Xn,KC as er,L2 as ar,L0 as tr,L4 as so,a13 as nr,a14 as oo,gf as co,gg as io,gh as lo,a15 as at,g9 as rr,dd as Ft,a16 as uo,a17 as mo,a18 as Co,a19 as po,Li as yt,LG as ho,LC as fo,Le as go,LE as bo,Lu as So,Lw as yo,a1a as sr,LM as Ha,SJ as Io,a1b as ko,a1c as Eo,a1d as Ao,a1e as or,a1f as Do,M7 as _o,Lm as cr,Lh as Ne,Ll as Po,a1g as wo,a1h as vo,Kt as To,a1i as ir,g2 as dr,a1j as Fo,Kv as xo,Ku as gn,a1k as Lo,a1l as Bo,a1m as Ro,VR as Oo,a1n as xt,a1o as Uo,xy as lr,mL as jo,ij as Mo,Mc as No,a1p as ur,fQ as Vo,fR as Ho,a1q as Go,dQ as $o,g6 as Ko,M2 as zo,LY as qe,bq as Yo,bK as Zo,cH as Wo,bL as qo,UI as Qo}from"./zeni-epic-state-CvqWLXMw.js";import{V as Re,dc as mr,a2 as we,dd as Cr,de as pr,df as Jo,G as aa,aq as Lt,dg as Xo,dh as ec,a as hr,d as fr,ap as gr,p as Ee,W as de,A as q,g as Sa,di as br,dj as ac,dk as tc,z as te,a5 as wa,d1 as tt,dl as nc,dm as rc,dn as sc,$ as va,bg as Xe,bD as Bt,dp as oc,a9 as Ta,R as nt,h as ee,w as rt,dq as cc,bP as ba,dr as It,ds as ic,a6 as Rt,dt as dc,ac as Sr,at as kt,du as lc,ao as yr,F as Ir,K as kr,bl as uc,dv as mc,dw as Cc,dx as pc,dy as hc,dz as fc,dA as gc,C as za,dB as bc,dC as Sc,m as pt,Z as yc,dD as Ic,dE as kc,dF as Ec,ag as Ac,dG as Dc,dH as _c,f as Pc}from"./index-CWBFzzoG.js";import{n as He,u as Ot,D as Er,S as wc}from"./mui-JBqam7ZJ.js";import{a as r}from"./sentry-FYTScRKu.js";import{u as Fa}from"./useAskAiCfoHostNavButtonProps-DwBC4EIF.js";import{M as Ae}from"./MobileAppDrawer-Dew93Hd0.js";import{d as Ut}from"./recharts-C8kt9j-2.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 vc,i as jt,P as Tc,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-DRx3iKSB.js";import{u as wr}from"./useInitialThreadRequest-DrHN756f.js";import st from"./NotFoundScreen-DCB7OcSg.js";import{u as Nt}from"./useChargeCardPusherEvents-B29zDqMR.js";import{n as Sn}from"./utils-0scyINMC.js";import{t as Lc}from"./AddressScreen-DQovxLbJ.js";import"./analytics-Bqd4cGOe.js";import"./plaid-DS9CUDf0.js";import"./dnd-DsgSNuBw.js";import"./stripe-cKAAJElX.js";import"./lottie-sOqenOaw.js";import"./lexical-nruf00Lo.js";import"./pdf-xXlSIFfJ.js";import"./InboxNotificationsProvider-CMIqT4_Q.js";import"./useTaskManagerAccess-CqgFuERm.js";import"./BusinessVerificationPageScreen-Do37GzKA.js";import"./routePaths-BXStbwFd.js";import"./analyticsHelper-cWQXE2Ud.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]="80d9e2c7-6b8f-4858-a130-20500de18e54",e._sentryDebugIdIdentifier="sentry-dbid-80d9e2c7-6b8f-4858-a130-20500de18e54")}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}},vr=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 Tr(){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=>vn(P.cardPolicyState))),S=d((P=>Tn(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]),Tr();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(vr)),[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]),W=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]),T=r.useRef(j);r.useEffect((()=>{const P=T.current;T.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 v=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(Jo,{formDraft:F,vendorSearchOptions:R,categorySearchOptions:g,isVendorSearchLoading:x==="In-Progress",onVendorSearchTextChange:z,submitState:j,submitErrorMessage:v,documentUploadState:w,uploadedFileName:y,isAiCfoAccessEnabled:l,onAskAiCfoClick:B,onBackClick:H,onCancelClick:Y,onClickMenuIcon:u,onFormChange:_,onSubmit:W,onUploadDocument:N,onRemoveDocument:$})]}):o.jsx(Je,{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((v=>{A(v)}),[]),l=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=Fa({mobileExploreReferrer:"Card Policy"}),C=d((v=>bs(v))),O=d((v=>_n(v.cardPolicyState))),U=d((v=>Pn(v.cardPolicyState))),S=d((v=>wn(v.cardPolicyState))),c=d((v=>vn(v.cardPolicyState))),p=d((v=>Tn(v.cardPolicyState))),x=d((v=>Fn(v.cardPolicyState))),E=d((v=>xn(v.cardPolicyState))),I=d((v=>_t(v.cardPolicyState))),k=d((v=>Rn(v))),V=d((v=>t!=null?Ss(v.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 v=C.detailFetchState.fetchState;C.templateId===t&&(v==="Completed"||v==="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]),Tr();const y=d((v=>v.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((v=>!mr(v.status.code))).map(vr)),[k.cards]);Lt({isDataReady:w!=null});const R=r.useMemo((()=>{if(w!=null)return Xo({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((v=>{M(v)}),[]),j=r.useMemo((()=>Ut((v=>{s(Pt(v))}),250)),[s]);r.useEffect((()=>()=>{j.cancel()}),[j]);const h=r.useCallback((v=>{j(v)}),[j]),H=C.updateFetchState.fetchState,Y=n!=null?`/${n}/cards/policy`:"..",_=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??Y;e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e,Y]),W=r.useCallback((()=>{e(Y)}),[e,Y]),N=r.useCallback((v=>{if(t==null)return;const P=Cr(v);s(ks(P)),s(Es(t))}),[s,t]),$=r.useRef(H);r.useEffect((()=>{const v=$.current;$.current=H,H==="Completed"&&v!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))}),[s,H,e,Y]);const T=H==="Error"?C.updateFetchState.error?.message??jc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{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:T,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:_,onCancelClick:W,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,W=ie(),N=me(),{tenantEmailDomain:$}=Ve(),{isAiCfoOpen:T,setIsAiCfoOpen:v}=hr(),P=fr(),ae=gr(),Ce=d((Q=>jn(Q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:ve}=xr("card_policy"),Ie=r.useMemo((()=>Fr(X,ve,3)),[X,ve]),[re,be]=r.useState(""),pe=ae&&P&&$!=null&&!T,he=r.useCallback((Q=>{if($==null)return;const Ge=Ee(N.state?.pathnameStackToGoBack,N.pathname);W(`/${$}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ge,referrer:"card_policy_hero",aiCfoInitialQuestion:Q,aiCfoShouldSubmit:Q!=null&&Q.trim().length>0}})}),[N.pathname,N.state,W,$]),oe=r.useCallback((Q=>{Q.trim().length!==0&&(be(""),he(Q))}),[he]),J=r.useCallback((()=>{const Q=re.trim();Q.length!==0&&(be(""),he(Q))}),[re,he]),Se=r.useCallback((()=>{}),[]),De=r.useCallback((Q=>{be(Q)}),[]),fe=r.useCallback((()=>{v(!0)}),[v]),Te=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:J,onStopSubmit:Se},onPromptClick:oe,onOpenSidePanel:fe,onOpenFullView:Te,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[re,H,pe,Y,_,Ce,De,Te,fe,oe,Se,J,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(vs(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((X=>ge(X))),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((X=>Wa(X).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((X=>da(X,s.companyId))),V=la(k.controllers),{creditAccount:w,creditAccountRepayment:y}=d((X=>ua(X))),F=d((X=>X.classListState.fetchState)),i=!B&&E&&C,g=d((X=>wt(X,a,i,E))),[R,G]=r.useState(!1),M=g.chargeCard,L=M?.cardCreatedByUser?.userId,z=d((X=>L!=null?Ga(X.userRoleState,L):void 0)),j=z?.accountingClassIDs[0],h=d((X=>j!=null?$a(X.classState,{classId:j,reportId:"class_list"}):void 0)),H=M?.cardHolderUser?.userId,Y=d((X=>H!=null?Ga(X.userRoleState,H):void 0)),_=Y?.accountingClassIDs[0],W=d((X=>_!=null?$a(X.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 X=_e(s.tenantEmailDomain,a,t,M,l);e(X)}}),[g.fetchState,l,N]),r.useEffect((()=>{w.fetchState!=="Completed"&&w.fetchState!=="In-Progress"&&E&&C&&b&&n(Qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&E&&C&&b&&n(vt()),F!=="Completed"&&F!=="In-Progress"&&n(Nn())}),[w.fetchState,y.fetchState,n,E,C,b,F]);const T=()=>{if(t!=null&&a!=null){n(Ka());const X=_e(s.tenantEmailDomain,a,t);e(X)}},v=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(v,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:T,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:W?.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",Zc="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}`)),Wc=[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(Ts({uiState:{sortKey:a,sortOrder:n}}))}}}))(sc);function Qc(){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??Jc(s.tenantEmailDomain);e(C,{state:{pathnameStackToGoBack:D.newStack}})}),[e,n,s.tenantEmailDomain]),l=ta(s);if(Nt({events:ha(l,Wc),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 Jc=e=>`/${e}/cards`,Xc={containerWidth:new Ta(100,58)},ei=({appContent:e})=>{const a=va(),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((W=>ge(W)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:c}=b(Xe.zeniCardsConfig),p=c.max_charge_card_activation_attempts_by_card_id,x=d((W=>Fs(W,s))),E=x.chargeCard,I=d((W=>W.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 W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);t(W,{state:{pathnameStackToGoBack:N}})}else if(B&&x.isRefreshingViewInBackground===!1&&E?.status?.code==="active"){n(xs({chargeCardId:s}));const W=_e(S.tenantEmailDomain,s,U,E,!0),N=Ee(f.state?.pathnameStackToGoBack,f.pathname);n(Qa()),t(W,{state:{pathnameStackToGoBack:N}})}}}),[x.fetchState,E?.type.code,B,x.isRefreshingViewInBackground]);const h=te.getZeniOtpTokenForCardHolder(s),H=d((W=>Vn(W.userState,U.userId))),Y=()=>{E?.status?.code!=="active"&&n(ga(s,!0))};r.useEffect((()=>{x.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&E?.cardActivationAttemptHistory.some((W=>W.statusCode==="success"))===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))}),[x.updatePhysicalChargeCardAttemptFetchState.fetchState,E?.cardActivationAttemptHistory]);const _=W=>{O(W)};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(Xa(u,"ChargeCardHolder",t))},onVerifyOtp:(u,l)=>{m!=null&&e(Ja(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=>`${Xc.containerWidth.value(e.windowSize)}%`};
|