@zeniai/web-app-ui 5.3.42-dev → 5.3.42-qa
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-5txeuTng.js → AccountMappingScreen-D4RlIlHq.js} +1 -1
- package/dist/assets/{ActualMatchingMatchDetailScreen-BvCTHIwN.js → ActualMatchingMatchDetailScreen-bQpbiVso.js} +1 -1
- package/dist/assets/{AddressRoutes-CysroEs-.js → AddressRoutes-DhHo5D0q.js} +1 -1
- package/dist/assets/{AddressScreen-C1CfOA8k.js → AddressScreen-BfaScJFK.js} +1 -1
- package/dist/assets/{AiCfoScreen-C0gnDsXr.js → AiCfoScreen-Box0GL8P.js} +1 -1
- package/dist/assets/{AppDrawer-CZ5MsAyB.js → AppDrawer-DD3NOfx7.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-Dba8jEIY.js → BillPayApprovalRoutes-CHOK-BIF.js} +1 -1
- package/dist/assets/{BillPayRoutes-BInjoPbL.js → BillPayRoutes-DFbBUbt3.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-BmHKq1LL.js → BusinessVerificationPageScreen-BL-rDXb4.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-C6Rnq8nD.js → CardsAiCfoScreen-c7VxfhZx.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-P239JK-b.js → ChargeCardRoutes-DgHOOT2d.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-yPmE04_9.js → CompanyPassportScreen-DW9fXsgC.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-6-1bG5gz.js → ConnectionAuthScreen-Dl4_e9UF.js} +1 -1
- package/dist/assets/{CustomerOnboardingAuthScreen-C__JnnR_.js → CustomerOnboardingAuthScreen-BDYIxUcT.js} +1 -1
- package/dist/assets/{CustomerOnboardingRoutes-CbzzxK0y.js → CustomerOnboardingRoutes-J_r_S5S6.js} +1 -1
- package/dist/assets/{DashboardRoutes-DhWNQvqz.js → DashboardRoutes-qEMySFwY.js} +1 -1
- package/dist/assets/{DefaultTenantHome-Fsi_QjM5.js → DefaultTenantHome-D0hA77jZ.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-CuBtrLRo.js → DomesticWireDetailScreen-tEEN6PNc.js} +1 -1
- package/dist/assets/{DrawerScreen-o43C4sHm.js → DrawerScreen-O-gM6ONw.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-Vj0NPJut.js → EntityDetailRoutes-CGS2jnu9.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-faxOwOvi.js → ExpenseAutomationRoutes-RAM77xQ5.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-CEOFkjIy.js → FeaturePreviewScreen-CfLYCS4M.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-CnHqx1ge.js → HubSpotOAuthCallbackScreen-BCoIXBGx.js} +1 -1
- package/dist/assets/{InvoicingRoutes--kNvLDpX.js → InvoicingRoutes-BSJKEbd0.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-_oMvrXOe.js → MagicLinkRoutes-DvFINUyu.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-D2yfAbuX.js → MagicLinkSignInScreen-DWA7XGFG.js} +1 -1
- package/dist/assets/{MobileAppDrawer-Q8q8ssn0.js → MobileAppDrawer-HCRn1e7J.js} +1 -1
- package/dist/assets/{NotFoundScreen-3YmbDG-O.js → NotFoundScreen-Due1Mflv.js} +1 -1
- package/dist/assets/{NotificationRoutes-BFjfuaHE.js → NotificationRoutes-BMD667yj.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-Ce7q6w-7.js → OAuthConsentScreen-BGUS6sNp.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-Cb8E55Qo.js → PandLWithForecastRoutes-BFUL28rL.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-CN69RRr9.js → PaymentLinkScreen-DdOQZBq6.js} +1 -1
- package/dist/assets/{PeopleRoutes-DNCzXaoC.js → PeopleRoutes-Qan4Ca75.js} +1 -1
- package/dist/assets/{PerformanceRoutes-DyNYMyLi.js → PerformanceRoutes-BUzsJ8JT.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DX5rBjLM.js → QBOConnectionScreen-B-JIz_OC.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-DifzmUQS.js → ReimbursementApprovalRoutes-Cz663ZFE.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-6W7aXQIv.js → ReimbursementApprovalRuleDetailScreen-D1uTDziv.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-Caztwlhg.js → ReimbursementRoutes-C0wQD-bc.js} +1 -1
- package/dist/assets/{ReportsRoutes-CfScWyxA.js → ReportsRoutes-CXJSK6N5.js} +1 -1
- package/dist/assets/{RewardsRoutes-BaqYIdkd.js → RewardsRoutes-UOKjC0-b.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-DuraGGsO.js → ScheduleDetailsPrepaidExpensesScreen-Cf3Sj0Dq.js} +1 -1
- package/dist/assets/{ScreenRoutes-QNvqH_bZ.js → ScreenRoutes-ChUwukZv.js} +2 -2
- package/dist/assets/{SettingsRoutes-DzQurTcP.js → SettingsRoutes-BeIHfkyW.js} +1 -1
- package/dist/assets/{SetupPagesScreen-CsSP_P2k.js → SetupPagesScreen-DSJF8gvU.js} +1 -1
- package/dist/assets/{SignInScreen-CRymVKij.js → SignInScreen-Q2IdOxGt.js} +1 -1
- package/dist/assets/{SignOutScreen-B0U7u8Hy.js → SignOutScreen-x1shfrTA.js} +1 -1
- package/dist/assets/{TaskListScreen-CXn6czhu.js → TaskListScreen-cpZyLi8u.js} +1 -1
- package/dist/assets/{TaskRoutes-0Yfh5AkX.js → TaskRoutes-CR7LYG5S.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-BiIqbu_-.js → TransactionDetailRoutes-c82zOTpF.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-Cxl44PLi.js → TransactionDetailScreen-C_Kji4P1.js} +1 -1
- package/dist/assets/{TransactionListRoutes-CBLSrFS8.js → TransactionListRoutes-BIMf99Cg.js} +1 -1
- package/dist/assets/{TreasuryRoutes-a3UpD3kR.js → TreasuryRoutes-BL8oTr8q.js} +1 -1
- package/dist/assets/{VendorsRoutes-DlFjWODu.js → VendorsRoutes-CO0cgAQM.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-BJ1TyqgG.js → WiseConfirmationScreen-BMU_QR7R.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-C0xgRuTa.js → ZeniAccountRoutes-f8fQbApR.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-C8J1M6mP.js → ZeniAccountStatementScreen-Bq5EWwlR.js} +1 -1
- package/dist/assets/{analyticsHelper-tF6p2yRC.js → analyticsHelper-C534_Opk.js} +1 -1
- package/dist/assets/{getLocaleForTenant-CZIO6uAG.js → getLocaleForTenant-COb4gZwj.js} +1 -1
- package/dist/assets/{index-DGjciFPC.js → index-CVAekD3p.js} +5 -5
- package/dist/assets/{routePaths-COaM8xFB.js → routePaths-nMSO0ytp.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-Dtg-Odjs.js → useActualMatchingMatchDetail-BK8kbpN5.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DXgID2ue.js → useAiCfoDashboardSuggestedQuestionsChips-BGckv6CX.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-DY2m50un.js → useAskAiCfoHostNavButtonProps-BHyPLCCo.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-C-hT_5jI.js → useChargeCardPusherEvents-DTBTr-3d.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-B7XzuZ4T.js → useEmailConnectResultRefresh-C8kd-UP4.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-Cdwnj1Ib.js → useInitialThreadRequest-DtdvMhZQ.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-i7vk79Wr.js → useTaskManagerAccess-DnvaNO8w.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-_ek7stLz.js → withTransactionSidePanel-DGZchFy0.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as D}from"./liveblocks-DRsJ0YIJ.js";import{a as o}from"./sentry-G4ZANa8Z.js";import{h as K,g as W,u as X,j as m,s as R,l as Y}from"./core-DGLzDXWl.js";import{ai as Z,O as ee,c as q,z as te,o as J,aj as ne,k as ae,T as ce}from"./index-
|
|
1
|
+
import{j as D}from"./liveblocks-DRsJ0YIJ.js";import{a as o}from"./sentry-G4ZANa8Z.js";import{h as K,g as W,u as X,j as m,s as R,l as Y}from"./core-DGLzDXWl.js";import{ai as Z,O as ee,c as q,z as te,o as J,aj as ne,k as ae,T as ce}from"./index-CVAekD3p.js";import{bn as se,fE as oe,gU as ie,oA as $,Ut as re,i7 as Q,gg as le,or as ue,Uu as de,Uv as pe,u5 as ge,l_ as me,op as Ae,ol as be,ow as fe,i9 as Ie,Uw as ye,Ux as Se}from"./zeni-epic-state-Dm2vDWXH.js";import{n as he}from"./mui-BuJ3P0FU.js";import{M as Ee}from"./MobileAppDrawer-HCRn1e7J.js";import{q as G}from"./QBOConnectionScreen-B-JIz_OC.js";import{g as h,a as E,m as we}from"./accountMappingHelper-2xXLJj4S.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]="f114e42e-4fd2-4acc-8d22-284921e356f4",a._sentryDebugIdIdentifier="sentry-dbid-f114e42e-4fd2-4acc-8d22-284921e356f4")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},ze=he.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-DRsJ0YIJ.js";import{a as k}from"./sentry-G4ZANa8Z.js";import{a4 as I,dR as g}from"./index-
|
|
1
|
+
import{j as s}from"./liveblocks-DRsJ0YIJ.js";import{a as k}from"./sentry-G4ZANa8Z.js";import{a4 as I,dR as g}from"./index-CVAekD3p.js";import"./mui-BuJ3P0FU.js";import{u as y}from"./useActualMatchingMatchDetail-BK8kbpN5.js";import R from"./NotFoundScreen-Due1Mflv.js";import{i as v,h as U,g as w}from"./core-DGLzDXWl.js";import"./zeni-epic-state-Dm2vDWXH.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.js";import"./stripSplatSuffix-BTaD_7hZ.js";import"./decodeURIComponentSafe-k3ZAUeWI.js";import"./routePaths-nMSO0ytp.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]="ce9c10db-7449-433c-997f-f15acb078a66",t._sentryDebugIdIdentifier="sentry-dbid-ce9c10db-7449-433c-997f-f15acb078a66")}catch{}})();function K(){const{matchId:t,tenantEmailDomain:e}=v(),n=U(),r=w(),b=y(t??""),a=k.useCallback((()=>{const S=I(r.state?.pathnameStackToGoBack);n(S.poppedPathname??`/${e??""}/month_end_close_checks/review`,{state:{pathnameStackToGoBack:S.newStack}})}),[r.state,n,e]);if(t==null)return s.jsx(R,{});const{match:i,detailFetchState:o,handleOpenBill:l,handleRefresh:c,handleUndoReversal:d,handleContinueMatch:h,lastMatchResults:f,lastUndoResults:m,refreshStatus:p,undoReversalStatus:u}=b;return i==null?o.fetchState==="Not-Started"||o.fetchState==="In-Progress"?s.jsx(g,{detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m}):s.jsx(R,{}):s.jsx(g,{match:i,detailFetchState:o.fetchState,isUndoInFlight:u.fetchState==="In-Progress",refreshStatus:p.fetchState,onNavigateBack:a,onOpenBill:l,onContinueMatch:()=>{h(),a()},onRefresh:c,onUndoReversal:d,lastMatchResults:f,lastUndoResults:m})}export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-DRsJ0YIJ.js";import{A as i}from"./AddressScreen-
|
|
1
|
+
import{j as e}from"./liveblocks-DRsJ0YIJ.js";import{A as i}from"./AddressScreen-BfaScJFK.js";import s from"./NotFoundScreen-Due1Mflv.js";import"./sentry-G4ZANa8Z.js";import{n as d,o as r}from"./core-DGLzDXWl.js";import"./zeni-epic-state-Dm2vDWXH.js";import"./recharts-CJlXFxhv.js";import"./index-CVAekD3p.js";import"./mui-BuJ3P0FU.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.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-DRsJ0YIJ.js";import{a as h}from"./sentry-G4ZANa8Z.js";import{h as T,u as P,g as E,i as j,j as B,l as M}from"./core-DGLzDXWl.js";import{a1 as $,E as D,z as L,U as V,a7 as K,a8 as U,k as C,T as S,a3 as z,X as b,a4 as F}from"./index-
|
|
1
|
+
import{j as r}from"./liveblocks-DRsJ0YIJ.js";import{a as h}from"./sentry-G4ZANa8Z.js";import{h as T,u as P,g as E,i as j,j as B,l as M}from"./core-DGLzDXWl.js";import{a1 as $,E as D,z as L,U as V,a7 as K,a8 as U,k as C,T as S,a3 as z,X as b,a4 as F}from"./index-CVAekD3p.js";import{V8 as _,io as G,fE as R,V9 as N,c8 as O,Va as q,mG as H}from"./zeni-epic-state-Dm2vDWXH.js";import{n as X}from"./mui-BuJ3P0FU.js";import J from"./NotFoundScreen-Due1Mflv.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]="3062278a-cccb-486e-a29d-27e13879489b",e._sentryDebugIdIdentifier="sentry-dbid-3062278a-cccb-486e-a29d-27e13879489b")}catch{}})();const Q=X.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as S}from"./liveblocks-DRsJ0YIJ.js";import{a}from"./sentry-G4ZANa8Z.js";import{u as Tt,h as Rt,i as jt,g as Ot,j as b,l as At}from"./core-DGLzDXWl.js";import{a as Qt,y as Dt,e8 as Lt,z as _t,a1 as Ut,e9 as Ft,ea as $t,eb as Bt,bo as Ae,ec as Ne,ed as Mt,bn as Ge,a4 as me,a8 as re,k as F,ee as le,ef as Vt,eg as Nt,au as Gt,T as qt,w as Ht,eh as zt,ei as Wt,av as Jt,ej as Yt,ek as Kt,el as Xt,em as Zt,p as es,bk as Qe,en as ts}from"./index-DGjciFPC.js";import{fD as U,gs as w,TS as ss,a1$ as as,a20 as ns,jL as os,a21 as is,jI as rs,a22 as ue,jC as de,jS as z,jk as Se,jA as De,jy as ls,jP as us,jt as qe,T$ as Le,gu as $,gJ as ds,T_ as cs,TL as _e,fE as ms,j2 as Ss,a23 as hs,g7 as ps,jg as fs,jc as gs,fF as ce,ge as Cs,a24 as Is,a25 as ks,a26 as bs,gt as vs,gn as Ue,k3 as Fe,gp as $e,gv as Es,a27 as Be,jU as Ps,j9 as ys,jn as ws,jQ as Me,jq as xs,gw as Ts,gx as Rs,gy as js,gz as Os}from"./zeni-epic-state-Dm2vDWXH.js";import{D as As,n as B,S as Qs,P as Ds}from"./mui-BuJ3P0FU.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-DXgID2ue.js";import{p as _s}from"./pathToGoBack-BzjHaNqp.js";import{j as Us}from"./routePaths-COaM8xFB.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="2614e440-77f7-4145-947a-015fffd70666",s._sentryDebugIdIdentifier="sentry-dbid-2614e440-77f7-4145-947a-015fffd70666")}catch{}})();const He="chat-response-generated";function Fs(s,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 t=w(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const $s=At((function(s,r){const t=U(s),l=r.isSubmitting,d=t.uiState?.currentChatSessionId,i=d!=null?Cs(s.aiCfoState,d):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),R=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),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:w(s).skills,skillSaveState:Fs(s,R),skillsEnabled:w(s).skillsEnabled,skillsList:w(s).skills,skillsListError:w(s).fetchState==="Error",skillsListLoading:w(s).fetchState==="In-Progress",skillsCanPublish:w(s).canPublish,skillSaving:R.fetchState==="In-Progress",skillSaveError:R.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Yt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:d,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:R,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Ts(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=Ge(p,v);E!=="answer"?F.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Rs(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,d,E,c,void 0,v)},onFetchSkills:()=>{s(qe())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Me({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Me({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ws({macroId:n,version:o}))},onDeleteSkill:n=>{s(ys({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Be())},onRunSkill:(n,o)=>{s($()),s(Ue()),Qe(s,o,"user_input",void 0,p,d,void 0,void 0,void 0,n),s(Be())},updateCurrentInput:n=>{s($e(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??_s(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s($e(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s($()),f!=null&&s(Ue());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:R,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Tt(),l=Rt(),{session_id:d}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),R=b((e=>U(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>w(e).skillsEnabled)),Q=b((e=>U(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ye=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?de({scheduleId:j}):ue())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>U(e).uiState.currentChatSessionId))??d,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),_=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{_!=null&&t(de({scheduleId:_}))}),[t,_]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(de({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(us({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>w(e).skills)),Y=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(qe()),t(Le())}),[t]),ot=a.useCallback((()=>{t($())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:ut}=Lt();a.useEffect((()=>{t(ds())}),[t]);const g=b((e=>U(e))),T=_t.getSignedInUser();a.useEffect((()=>d==="routines"?(t($()),void t(cs())):d==="skills"?(t(ue()),t(_e()),void t(Le())):(_==null&&t(ue()),t(_e()),void t($()))),[t,_,f,d]);const dt=Ut(),O=Gt(dt),k=b((e=>ms(e))),u=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Ft(I),skillName:I.isAdHoc===!0?void 0:Y.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,Y]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=$t({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Bt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),M=i.state,V=M?.aiCfoInitialQuestion,ke=!!M?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&V!=null&&V!==""){const e=i.state;se(V),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[V,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??M?.aiCfoRef,ie=ve.get("emailRefId")??M?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||u!=null||T==null||(t(Ss("controller",T.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,u,t,T]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&u!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,u,t]);const bt=k.masterTOSInfo,y=bt?.isMasterTOSAccepted??!1,{visitedSessions:ye}=Mt(u),G=g.fetchState,q=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,we=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",xe=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Te=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Te,u),Et=vt.length===0;a.useEffect((()=>{y||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[y,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Re=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=d!==Re.current,h=u!==je.current;Re.current=d,je.current=u,d!==u&&(!e||d==null||Us(d)?h&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(ps({sessionId:d,agentId:"controller"})))}),[u,d]);const yt=a.useMemo((()=>({events:ye.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[ye]);a.useEffect((()=>{G!=="In-Progress"&&q&&t(fs())}),[G,q,t]),a.useEffect((()=>{u!=null&&we!=="In-Progress"&&xe&&T!=null&&(d===u||G==="Completed"&&!q)&&t(gs(u,T.userId))}),[we,G,xe,q,u,T,d,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(T==null||d==null)throw Error("Can't access AI Controller page without signing in...");const wt=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!y&&O)return S.jsxs(Ms,{children:[S.jsx(re,{analytics:F,onLoad:Oe}),te.drawerElement,S.jsx(Vs,{children:S.jsx(Ve,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!y?S.jsx(re,{analytics:F,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:y,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:y?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{y||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Bs,{children:[S.jsx(re,{analytics:F,onLoad:e=>e.trackPageLoaded(qt.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx($s,{...yt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Te,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:T.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:d,location:i,isSubmitting:wt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:ut,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:R,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:Y,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ye,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx(Ve,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:y,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{y||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx(Vt,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},Ve=B(Qs)`
|
|
1
|
+
import{j as S}from"./liveblocks-DRsJ0YIJ.js";import{a}from"./sentry-G4ZANa8Z.js";import{u as Tt,h as Rt,i as jt,g as Ot,j as b,l as At}from"./core-DGLzDXWl.js";import{a as Qt,y as Dt,e8 as Lt,z as _t,a1 as Ut,e9 as Ft,ea as $t,eb as Bt,bo as Ae,ec as Ne,ed as Mt,bn as Ge,a4 as me,a8 as re,k as F,ee as le,ef as Vt,eg as Nt,au as Gt,T as qt,w as Ht,eh as zt,ei as Wt,av as Jt,ej as Yt,ek as Kt,el as Xt,em as Zt,p as es,bk as Qe,en as ts}from"./index-CVAekD3p.js";import{fD as U,gs as w,TS as ss,a1$ as as,a20 as ns,jL as os,a21 as is,jI as rs,a22 as ue,jC as de,jS as z,jk as Se,jA as De,jy as ls,jP as us,jt as qe,T$ as Le,gu as $,gJ as ds,T_ as cs,TL as _e,fE as ms,j2 as Ss,a23 as hs,g7 as ps,jg as fs,jc as gs,fF as ce,ge as Cs,a24 as Is,a25 as ks,a26 as bs,gt as vs,gn as Ue,k3 as Fe,gp as $e,gv as Es,a27 as Be,jU as Ps,j9 as ys,jn as ws,jQ as Me,jq as xs,gw as Ts,gx as Rs,gy as js,gz as Os}from"./zeni-epic-state-Dm2vDWXH.js";import{D as As,n as B,S as Qs,P as Ds}from"./mui-BuJ3P0FU.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-BGckv6CX.js";import{p as _s}from"./pathToGoBack-BzjHaNqp.js";import{j as Us}from"./routePaths-nMSO0ytp.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="2614e440-77f7-4145-947a-015fffd70666",s._sentryDebugIdIdentifier="sentry-dbid-2614e440-77f7-4145-947a-015fffd70666")}catch{}})();const He="chat-response-generated";function Fs(s,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 t=w(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const $s=At((function(s,r){const t=U(s),l=r.isSubmitting,d=t.uiState?.currentChatSessionId,i=d!=null?Cs(s.aiCfoState,d):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),R=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),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:w(s).skills,skillSaveState:Fs(s,R),skillsEnabled:w(s).skillsEnabled,skillsList:w(s).skills,skillsListError:w(s).fetchState==="Error",skillsListLoading:w(s).fetchState==="In-Progress",skillsCanPublish:w(s).canPublish,skillSaving:R.fetchState==="In-Progress",skillSaveError:R.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Yt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:d,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:R,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Ts(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=Ge(p,v);E!=="answer"?F.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Rs(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,d,E,c,void 0,v)},onFetchSkills:()=>{s(qe())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s(Me({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s(Me({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ws({macroId:n,version:o}))},onDeleteSkill:n=>{s(ys({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Be())},onRunSkill:(n,o)=>{s($()),s(Ue()),Qe(s,o,"user_input",void 0,p,d,void 0,void 0,void 0,n),s(Be())},updateCurrentInput:n=>{s($e(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??_s(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s($e(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s($()),f!=null&&s(Ue());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:R,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Tt(),l=Rt(),{session_id:d}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),R=b((e=>U(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>w(e).skillsEnabled)),Q=b((e=>U(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ye=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?de({scheduleId:j}):ue())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>U(e).uiState.currentChatSessionId))??d,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),_=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{_!=null&&t(de({scheduleId:_}))}),[t,_]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(de({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(us({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>w(e).skills)),Y=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(qe()),t(Le())}),[t]),ot=a.useCallback((()=>{t($())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:ut}=Lt();a.useEffect((()=>{t(ds())}),[t]);const g=b((e=>U(e))),T=_t.getSignedInUser();a.useEffect((()=>d==="routines"?(t($()),void t(cs())):d==="skills"?(t(ue()),t(_e()),void t(Le())):(_==null&&t(ue()),t(_e()),void t($()))),[t,_,f,d]);const dt=Ut(),O=Gt(dt),k=b((e=>ms(e))),u=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Ft(I),skillName:I.isAdHoc===!0?void 0:Y.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,Y]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=$t({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Bt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),M=i.state,V=M?.aiCfoInitialQuestion,ke=!!M?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&V!=null&&V!==""){const e=i.state;se(V),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[V,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??M?.aiCfoRef,ie=ve.get("emailRefId")??M?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||u!=null||T==null||(t(Ss("controller",T.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,u,t,T]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&u!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,u,t]);const bt=k.masterTOSInfo,y=bt?.isMasterTOSAccepted??!1,{visitedSessions:ye}=Mt(u),G=g.fetchState,q=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,we=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",xe=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Te=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=Ge(Te,u),Et=vt.length===0;a.useEffect((()=>{y||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[y,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Re=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=d!==Re.current,h=u!==je.current;Re.current=d,je.current=u,d!==u&&(!e||d==null||Us(d)?h&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(ps({sessionId:d,agentId:"controller"})))}),[u,d]);const yt=a.useMemo((()=>({events:ye.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[ye]);a.useEffect((()=>{G!=="In-Progress"&&q&&t(fs())}),[G,q,t]),a.useEffect((()=>{u!=null&&we!=="In-Progress"&&xe&&T!=null&&(d===u||G==="Completed"&&!q)&&t(gs(u,T.userId))}),[we,G,xe,q,u,T,d,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(T==null||d==null)throw Error("Can't access AI Controller page without signing in...");const wt=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!y&&O)return S.jsxs(Ms,{children:[S.jsx(re,{analytics:F,onLoad:Oe}),te.drawerElement,S.jsx(Vs,{children:S.jsx(Ve,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!y?S.jsx(re,{analytics:F,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:y,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:y?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{y||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Bs,{children:[S.jsx(re,{analytics:F,onLoad:e=>e.trackPageLoaded(qt.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx($s,{...yt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Te,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:T.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:d,location:i,isSubmitting:wt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:ut,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:R,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:Y,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ye,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx(Ve,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:y,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{y||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx(Vt,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},Ve=B(Qs)`
|
|
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-DRsJ0YIJ.js";import{a as o,R as va}from"./sentry-G4ZANa8Z.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-DGLzDXWl.js";import{fE as Fe,TJ as Ba,TK as Ze,g8 as Aa,gu as K,TL as W,jt as Te,jA as Ie,TM as xa,TN as _a,gN as Da,p_ as Ma,TO as Fa,TP as ve,gl as Za,TQ as $,fD as Ra,gs as Ga,TR as Pa,TS as Va,TT as ja,TU as ye,TV as Ha,TW as $e,TX as La,D_ as Na,gm as Oa,h0 as Ua,cV as za,TY as Ya,TZ as qa,qB as Ja,g7 as Ka,j5 as Wa,T_ as Qa,T$ as Xa,wp as et,gn as at}from"./zeni-epic-state-Dm2vDWXH.js";import{w as tt,i as nt,a as ot,$ as st,E as rt,O as it,c as m,d as lt,u as dt,e as ct,B as ut,f as mt,g as Ct,h as pt,y as ht,j as ft,z as gt,k as P,p,m as Be,l as bt,S as St,n as Ae,o as kt,q as xe,r as Et,s as wt,v as X,x as Q,A as Tt,C as It,D as vt,L as yt,F as $t,H as Bt,I as ee,J as At,K as xt}from"./index-DGjciFPC.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-BuJ3P0FU.js";import{u as Zt}from"./InboxNotificationsProvider-Cf5DQSg3.js";import{u as Rt}from"./useTaskManagerAccess-i7vk79Wr.js";import{u as Gt}from"./expenseAutomationHelper-DWDIPthN.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.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]="75803c07-87c7-474a-93a5-80a93950b248",a._sentryDebugIdIdentifier="sentry-dbid-75803c07-87c7-474a-93a5-80a93950b248")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Pt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,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"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,x]=va.useState(!1),[S,Re]=o.useState(!1),t=ya(),s=$a(),ae=Aa(),te=st(),n=Me(),[Ge,Pe]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Rt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Te()),n(Ie()))}),[n,w,i.tenantId,E]);const[L,He]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ne}=u(m.isChargeCardFeatureEnabled),Oe=Ct(i,Ne,oe),{isFeatureEnabled:Ue}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>xa(e)));o.useEffect((()=>{const e=()=>{Pe(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const N=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:T}=f,Ye=G("/signout")!==null,M=G("/:tenantEmailDomain/dashboard")!==null,ie=G("/:tenantEmailDomain/reports")!==null,g=G("/:tenantEmailDomain/onboarding/*")!==null,le=Gt();o.useEffect((()=>{w&&D&&!g&&N.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,N.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const qe=Ye||g,O=r((e=>e.tenantState)),Je=r((e=>O.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),U=r((e=>Ra(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Pa(e))),ce=r((e=>Va(e).routines)),la=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]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[I,z]=o.useState(void 0),Y=U.uiState.currentChatSessionId,F=I!=null?U.deleteChatSessionStateByChatSessionId[I]?.fetchState:void 0,me=ft(F),{inboxNotifications:q,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Zt(),Z=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(I!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:I})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:I})),z(void 0)))}),[n,t.state,s,F,I,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&q!=null){const e=`dashboard_${i.companyId}`;He(q.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,q]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(L!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:L},"comments")))}}),[L,Z.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Ke===!1&&v.push("accounts_payable_aging"),We===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>La(e,v).fetchState)),ge=r((e=>Na(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Oa(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Ua(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{x(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&Ya(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(T.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,T.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",T.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(qa(i.tenantId,e)),h[i.tenantId]!=null){const A=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:A,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,T.monthEndCloseChecks?.auditSummary,T.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:O.currentTenantId??"",tenants:O.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:N.rewardsPlan},selectedMenu:C===!0?xe("ai_cfo"):Ae(t)&&ue!=="completed"?xe("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:Ae(t)&&ue==="completed",isSettingsFeatureEnabled:Ue,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Le,isChargeCardEnabled:Oe,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&P.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&Tt(e.type)&&b(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",Y??null,null),!H)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const R=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:R,referrer:"Sidebar"}})}const A=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=xt(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||P.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const R=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${R.month}-${R.year}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})}const Ia=It(e.type);vt(e.type)?(Y!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:A.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ia}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),Y===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(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:T,onPeriodChange:Sa,onCalendarOpen:Re,aiCfoView:U,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ge?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ta=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Pt,{className:c.root,children:[d.jsx(Ft,{}),qe===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>y(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ta?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((x=>Fe(x))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(x,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ze({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((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-DRsJ0YIJ.js";import{a as o,R as va}from"./sentry-G4ZANa8Z.js";import{u as Me,j as r,g as ya,h as $a,q as G}from"./core-DGLzDXWl.js";import{fE as Fe,TJ as Ba,TK as Ze,g8 as Aa,gu as K,TL as W,jt as Te,jA as Ie,TM as xa,TN as _a,gN as Da,p_ as Ma,TO as Fa,TP as ve,gl as Za,TQ as $,fD as Ra,gs as Ga,TR as Pa,TS as Va,TT as ja,TU as ye,TV as Ha,TW as $e,TX as La,D_ as Na,gm as Oa,h0 as Ua,cV as za,TY as Ya,TZ as qa,qB as Ja,g7 as Ka,j5 as Wa,T_ as Qa,T$ as Xa,wp as et,gn as at}from"./zeni-epic-state-Dm2vDWXH.js";import{w as tt,i as nt,a as ot,$ as st,E as rt,O as it,c as m,d as lt,u as dt,e as ct,B as ut,f as mt,g as Ct,h as pt,y as ht,j as ft,z as gt,k as P,p,m as Be,l as bt,S as St,n as Ae,o as kt,q as xe,r as Et,s as wt,v as X,x as Q,A as Tt,C as It,D as vt,L as yt,F as $t,H as Bt,I as ee,J as At,K as xt}from"./index-CVAekD3p.js";import{A as _t,b as Dt,I as Mt,a as _e,d as Ft,D as De}from"./mui-BuJ3P0FU.js";import{u as Zt}from"./InboxNotificationsProvider-Cf5DQSg3.js";import{u as Rt}from"./useTaskManagerAccess-DnvaNO8w.js";import{u as Gt}from"./expenseAutomationHelper-DWDIPthN.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.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]="75803c07-87c7-474a-93a5-80a93950b248",a._sentryDebugIdIdentifier="sentry-dbid-75803c07-87c7-474a-93a5-80a93950b248")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},Pt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,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"}}))),Vt=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[V,x]=va.useState(!1),[S,Re]=o.useState(!1),t=ya(),s=$a(),ae=Aa(),te=st(),n=Me(),[Ge,Pe]=o.useState(!1),j=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),H=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:Ve}=dt(),E=ct(),{isTaskManagerAccessEnabled:_,isZeniUser:je}=Rt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Te()),n(Ie()))}),[n,w,i.tenantId,E]);const[L,He]=o.useState(void 0),Le=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Ne}=u(m.isChargeCardFeatureEnabled),Oe=Ct(i,Ne,oe),{isFeatureEnabled:Ue}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:D}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>xa(e)));o.useEffect((()=>{const e=()=>{Pe(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const N=r((e=>_a(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>Da(e))),{monthEndCloseChecksView:T}=f,Ye=G("/signout")!==null,M=G("/:tenantEmailDomain/dashboard")!==null,ie=G("/:tenantEmailDomain/reports")!==null,g=G("/:tenantEmailDomain/onboarding/*")!==null,le=Gt();o.useEffect((()=>{w&&D&&!g&&N.fetchState==="Not-Started"&&n(Ma(!0))}),[w,D,N.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const qe=Ye||g,O=r((e=>e.tenantState)),Je=r((e=>O.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),U=r((e=>Ra(e))),ra=r((e=>Ga(e).skillsEnabled)),ia=r((e=>Pa(e))),ce=r((e=>Va(e).routines)),la=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]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(ja),[I,z]=o.useState(void 0),Y=U.uiState.currentChatSessionId,F=I!=null?U.deleteChatSessionStateByChatSessionId[I]?.fetchState:void 0,me=ft(F),{inboxNotifications:q,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Zt(),Z=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(I!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:I})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:I})),z(void 0)))}),[n,t.state,s,F,I,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&q!=null){const e=`dashboard_${i.companyId}`;He(q.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,q]),o.useEffect((()=>{w&&_&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(Ha("task_manager","dashboard"))}),[w,_,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(L!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:L},"comments")))}}),[L,Z.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Ke===!1&&v.push("accounts_payable_aging"),We===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),D===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>La(e,v).fetchState)),ge=r((e=>Na(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Oa(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Ua(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{x(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&Ya(re.notificationSettings,k.userEmail,oe,i,_),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(T.monthEndCloseChecks?.auditSummary!=null&&P.trackMonthCloseAuditPage(e.month,e.year,T.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",T.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(qa(i.tenantId,e)),h[i.tenantId]!=null){const A=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:A,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,T.monthEndCloseChecks?.auditSummary,T.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:O.currentTenantId??"",tenants:O.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:D,isRewardsAnimated:ga,rewardsPlan:N.rewardsPlan},selectedMenu:C===!0?xe("ai_cfo"):Ae(t)&&ue!=="completed"?xe("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:Ae(t)&&ue==="completed",isSettingsFeatureEnabled:Ue,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Le,isChargeCardEnabled:Oe,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=je?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{Ve(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&P.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return H?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return H?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&Tt(e.type)&&b(!1),e.type==="ai_cfo"){if(P.trackAICFOChatScreenStateChanged("viewed","left_menu",Y??null,null),!H)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const R=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:R,referrer:"Sidebar"}})}const A=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=xt(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||P.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const R=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${R.month}-${R.year}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})}const Ia=It(e.type);vt(e.type)?(Y!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:A.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ia}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),Y===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(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:T,onPeriodChange:Sa,onCalendarOpen:Re,aiCfoView:U,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:_,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(_t,{position:"fixed",className:c.appBar,style:{borderBottom:Ge?`1px solid ${j.colors.grey2}`:""},children:d.jsxs(Dt,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(jt,{})}),d.jsx(Ht,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=_e((e=>e.breakpoints.up("md"))),Ta=_e((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(Pt,{className:c.root,children:[d.jsx(Ft,{}),qe===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(De,{container:window.document.body,variant:"temporary",open:V,onClose:()=>y(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ta?null:d.jsx(De,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:j.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((x=>Fe(x))),V={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(x,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ze({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Vt,{tenantEmailDomain:a,...V})},jt=ee((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-DRsJ0YIJ.js";import{a as d}from"./sentry-G4ZANa8Z.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as D}from"./core-DGLzDXWl.js";import{fE as P,YK as w,Yr as R,Hv as E,Hp as Y,Ht as A,Hi as q,Yt as K,Hm as ae,Hx as oe,Hl as z,HA as Z,Hw as C}from"./zeni-epic-state-Dm2vDWXH.js";import{z as O,w as J,bY as pe,o as T,bS as G,bZ as le,E as M,a7 as Q,b_ as se,b$ as ne}from"./index-DGjciFPC.js";import"./mui-BuJ3P0FU.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-6W7aXQIv.js";import ie from"./NotFoundScreen-3YmbDG-O.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]="f42901f3-a735-4721-a859-fff4d6b2b4f0",e._sentryDebugIdIdentifier="sentry-dbid-f42901f3-a735-4721-a859-fff4d6b2b4f0")}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(q(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(Y(!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,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{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(q(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}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),m=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(Y(!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 b={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,I,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:m,location:t,navigate:l,isLoading:e,...b})},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((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const g=!!re(I.value);return{type:g?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(b);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(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),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(Q,{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 I=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let x=[];N==="role"?x=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(x=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";I.push({action:$,actors:x,operator:x.length>1?$==="require_approval"?"or":"and":"is"})})),I},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 b=m?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:b}),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(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{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 De(){return u.jsxs(te,{children:[u.jsx(D,{path:"/",element:u.jsx(ve,{})}),u.jsx(D,{path:"/new",element:u.jsx(H,{})}),u.jsx(D,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(D,{path:"*",element:u.jsx(ie,{})})]})}export{De as B};
|
|
1
|
+
import{j as u}from"./liveblocks-DRsJ0YIJ.js";import{a as d}from"./sentry-G4ZANa8Z.js";import{h as U,g as j,u as B,j as y,N as F,l as V,i as W,n as te,o as D}from"./core-DGLzDXWl.js";import{fE as P,YK as w,Yr as R,Hv as E,Hp as Y,Ht as A,Hi as q,Yt as K,Hm as ae,Hx as oe,Hl as z,HA as Z,Hw as C}from"./zeni-epic-state-Dm2vDWXH.js";import{z as O,w as J,bY as pe,o as T,bS as G,bZ as le,E as M,a7 as Q,b_ as se,b$ as ne}from"./index-CVAekD3p.js";import"./mui-BuJ3P0FU.js";import{u as X,i as re}from"./ReimbursementApprovalRuleDetailScreen-D1uTDziv.js";import ie from"./NotFoundScreen-Due1Mflv.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]="f42901f3-a735-4721-a859-fff4d6b2b4f0",e._sentryDebugIdIdentifier="sentry-dbid-f42901f3-a735-4721-a859-fff4d6b2b4f0")}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(q(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(Y(!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,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{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(q(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}=G(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),m=y((i=>P(i)));X();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(Y(!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 b={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${L}`]:[],eventCallback:(i,I,g)=>{i.endsWith(L)&&g.onApprovalRulesEventReceived(i)}};return m?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(F,{to:"../../promo"}):u.jsx(de,{currentTenant:m,location:t,navigate:l,isLoading:e,...b})},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((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const g=!!re(I.value);return{type:g?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!g}})),i=h.concat(b);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(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),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(Q,{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 I=[];return i.forEach((g=>{const N=g.actorKind?.selectedOption,ee=g.selectedRole?.selectedNonUsers??[];let x=[];N==="role"?x=ee.map((_=>({type:"attribute",subType:_.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):N==="specific_person"&&(x=(g.persons?.selectedUsers??[]).map((_=>({type:"user",userId:_.userId,isImplicitActor:!1}))));const $=g.action??"require_approval";I.push({action:$,actors:x,operator:x.length>1?$==="require_approval"?"or":"and":"is"})})),I},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 b=m?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:b}),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(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function H(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=G(e?.tenantId);return l?u.jsx(ge,{}):u.jsx(Se,{})}function ge(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),n=M(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(X(),d.useEffect((()=>{p||(f(!0),l(z(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(Q,{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 De(){return u.jsxs(te,{children:[u.jsx(D,{path:"/",element:u.jsx(ve,{})}),u.jsx(D,{path:"/new",element:u.jsx(H,{})}),u.jsx(D,{path:"/:approvalRuleId/edit",element:u.jsx(H,{})}),u.jsx(D,{path:"*",element:u.jsx(ie,{})})]})}export{De as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-DRsJ0YIJ.js";import{h as K,u as le,g as Q,i as te,j as k,N as ee,l as X,q as na,n as ia,o as y}from"./core-DGLzDXWl.js";import{fE as Z,Y1 as Ue,bq as kt,S2 as oa,bo as wt,bJ as de,Y2 as Bt,GP as Ct,I0 as Ve,Hm as la,bn as Ae,Y3 as sa,Y4 as ra,c8 as ca,Y5 as da,l_ as xt,Y6 as At,Y7 as Et,IB as _e,H2 as Ce,Y8 as ua,GD as at,Y9 as pa,Mq as ma,GH as ba,GN as Dt,Ya as Se,Yb as Me,I1 as Oe,Yc as ha,Yd as ga,I4 as Ne,Ye as Sa,Ih as ya,Yf as Tt,HN as nt,HS as fa,Yg as Ia,Yh as ce,Yi as jt,Yj as Pt,Yk as Ft,gU as va,H7 as $e,cG as Rt,Yl as ka,gg as wa,Ym as Ba,Yn as Ca,dZ as Vt,dY as $t,Yo as Ye,Yp as xa,Yq as Aa,WC as ze,Yr as Ea,WD as ie,WE as He,Ys as Da,Yt as Ta,Yu as ja,HU as it,HR as Pa,Yv as Fa,Yw as Ra,Yx as Va,HD as $a,Yy as La,Yz as Ga,cu as Lt,d9 as Gt,m9 as Ua,bO as _a,br as Ut,bP as _t,FS as Ma,YA as Oa,Md as Na,Mj as Ya,C2 as za,I2 as Ha,II as Za,mm as ge,YB as Wa,YC as Mt,mQ as qa,mg as Ot,mB as Nt,mA as ot,bE as pe,bN as Ja,YD as Ka,YE as ye,kM as Qa,YF as lt,YG as Xa,kQ as en,l9 as tn,IW as an,YH as nn,mJ as on,IM as ln,YI as st,IQ as sn,IV as rn,IT as cn,IK as dn,YJ as Yt,GY as un,YK as pn,YL as mn,gF as bn,gE as hn,gD as gn,mp as Sn,mH as rt,mS as yn,uS as fn,my as In,IO as vn,kW as kn,mX as wn,YM as Bn,kO as Cn,uJ as xn,YN as An,HJ as En,bK as Dn,bt as Tn,U1 as jn,dc as Pn,db as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-Dm2vDWXH.js";import{E as ue,z as L,U as fe,as as Ze,O as oe,c as g,bi as We,a7 as se,J as A,a8 as Ee,k as j,bu as $n,a4 as H,av as qe,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as Un,aS as _n,ab as zt,G as De,ag as Je,by as Mn,ae as Ht,bz as On,aq as Nn,T as Zt,w as Yn,bA as zn,bB as Hn,bC as Zn,bD as Wn,bE as qn,bF as Jn,bG as Kn,bH as Qn,bI as Xn,$ as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,g as li}from"./index-DGjciFPC.js";import{n as U,S as si}from"./mui-BuJ3P0FU.js";import{A as ut}from"./AddressScreen-C1CfOA8k.js";import{g as ne,a as Te,i as Wt,V as Ke,b as Qe,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-CuBtrLRo.js";import{a as f}from"./sentry-G4ZANa8Z.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DY2m50un.js";import{u as qt}from"./useInitialThreadRequest-Cdwnj1Ib.js";import{u as ui}from"./BusinessVerificationPageScreen-BmHKq1LL.js";import xe from"./NotFoundScreen-3YmbDG-O.js";import{D as pi}from"./DrawerScreen-o43C4sHm.js";import{M as Jt}from"./MobileAppDrawer-Q8q8ssn0.js";import{F as Kt}from"./FeaturePreviewScreen-CEOFkjIy.js";import{S as je}from"./SetupPagesScreen-CsSP_P2k.js";import{B as mi}from"./BillPayApprovalRoutes-Dba8jEIY.js";import{F as bi}from"./ScreenRoutes-QNvqH_bZ.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.js";import"./routePaths-COaM8xFB.js";import"./InboxNotificationsProvider-Cf5DQSg3.js";import"./useTaskManagerAccess-i7vk79Wr.js";import"./analyticsHelper-tF6p2yRC.js";import"./ReimbursementApprovalRuleDetailScreen-6W7aXQIv.js";import"./getLocaleForTenant-CZIO6uAG.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]="9c994475-1ca6-493d-87a1-0c67d4953b7a",e._sentryDebugIdIdentifier="sentry-dbid-9c994475-1ca6-493d-87a1-0c67d4953b7a")}catch{}})();const hi=X((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,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=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=K(),t=le(),l=Q(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,C]=f.useState(!1),[x,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t(Ve(!1,O,$,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{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(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new zt(100,58)},mt=X((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,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=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=K(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));ui();const[x,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const J=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&_(!1))}),[n]),f.useEffect((()=>{x||n==null||u||(_(!0),t(Ct(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[x,D,u,n,t,S,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(C.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:J}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Ci,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(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(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-DRsJ0YIJ.js";import{h as K,u as le,g as Q,i as te,j as k,N as ee,l as X,q as na,n as ia,o as y}from"./core-DGLzDXWl.js";import{fE as Z,Y1 as Ue,bq as kt,S2 as oa,bo as wt,bJ as de,Y2 as Bt,GP as Ct,I0 as Ve,Hm as la,bn as Ae,Y3 as sa,Y4 as ra,c8 as ca,Y5 as da,l_ as xt,Y6 as At,Y7 as Et,IB as _e,H2 as Ce,Y8 as ua,GD as at,Y9 as pa,Mq as ma,GH as ba,GN as Dt,Ya as Se,Yb as Me,I1 as Oe,Yc as ha,Yd as ga,I4 as Ne,Ye as Sa,Ih as ya,Yf as Tt,HN as nt,HS as fa,Yg as Ia,Yh as ce,Yi as jt,Yj as Pt,Yk as Ft,gU as va,H7 as $e,cG as Rt,Yl as ka,gg as wa,Ym as Ba,Yn as Ca,dZ as Vt,dY as $t,Yo as Ye,Yp as xa,Yq as Aa,WC as ze,Yr as Ea,WD as ie,WE as He,Ys as Da,Yt as Ta,Yu as ja,HU as it,HR as Pa,Yv as Fa,Yw as Ra,Yx as Va,HD as $a,Yy as La,Yz as Ga,cu as Lt,d9 as Gt,m9 as Ua,bO as _a,br as Ut,bP as _t,FS as Ma,YA as Oa,Md as Na,Mj as Ya,C2 as za,I2 as Ha,II as Za,mm as ge,YB as Wa,YC as Mt,mQ as qa,mg as Ot,mB as Nt,mA as ot,bE as pe,bN as Ja,YD as Ka,YE as ye,kM as Qa,YF as lt,YG as Xa,kQ as en,l9 as tn,IW as an,YH as nn,mJ as on,IM as ln,YI as st,IQ as sn,IV as rn,IT as cn,IK as dn,YJ as Yt,GY as un,YK as pn,YL as mn,gF as bn,gE as hn,gD as gn,mp as Sn,mH as rt,mS as yn,uS as fn,my as In,IO as vn,kW as kn,mX as wn,YM as Bn,kO as Cn,uJ as xn,YN as An,HJ as En,bK as Dn,bt as Tn,U1 as jn,dc as Pn,db as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-Dm2vDWXH.js";import{E as ue,z as L,U as fe,as as Ze,O as oe,c as g,bi as We,a7 as se,J as A,a8 as Ee,k as j,bu as $n,a4 as H,av as qe,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as Un,aS as _n,ab as zt,G as De,ag as Je,by as Mn,ae as Ht,bz as On,aq as Nn,T as Zt,w as Yn,bA as zn,bB as Hn,bC as Zn,bD as Wn,bE as qn,bF as Jn,bG as Kn,bH as Qn,bI as Xn,$ as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,g as li}from"./index-CVAekD3p.js";import{n as U,S as si}from"./mui-BuJ3P0FU.js";import{A as ut}from"./AddressScreen-BfaScJFK.js";import{g as ne,a as Te,i as Wt,V as Ke,b as Qe,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-tEEN6PNc.js";import{a as f}from"./sentry-G4ZANa8Z.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-BHyPLCCo.js";import{u as qt}from"./useInitialThreadRequest-DtdvMhZQ.js";import{u as ui}from"./BusinessVerificationPageScreen-BL-rDXb4.js";import xe from"./NotFoundScreen-Due1Mflv.js";import{D as pi}from"./DrawerScreen-O-gM6ONw.js";import{M as Jt}from"./MobileAppDrawer-HCRn1e7J.js";import{F as Kt}from"./FeaturePreviewScreen-CfLYCS4M.js";import{S as je}from"./SetupPagesScreen-DSJF8gvU.js";import{B as mi}from"./BillPayApprovalRoutes-CHOK-BIF.js";import{F as bi}from"./ScreenRoutes-ChUwukZv.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.js";import"./routePaths-nMSO0ytp.js";import"./InboxNotificationsProvider-Cf5DQSg3.js";import"./useTaskManagerAccess-DnvaNO8w.js";import"./analyticsHelper-C534_Opk.js";import"./ReimbursementApprovalRuleDetailScreen-D1uTDziv.js";import"./getLocaleForTenant-COb4gZwj.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]="9c994475-1ca6-493d-87a1-0c67d4953b7a",e._sentryDebugIdIdentifier="sentry-dbid-9c994475-1ca6-493d-87a1-0c67d4953b7a")}catch{}})();const hi=X((function(e,t){const l=Ue(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,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=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=K(),t=le(),l=Q(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((z=>Z(z))),s=k((z=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,C]=f.useState(!1),[x,_]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),Y=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:J}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Y||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Y,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t(Ve(!1,O,$,J,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,J]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(ee,{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(Ee,{analytics:j,onLoad:z=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:x,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new zt(100,58)},mt=X((function(e,t){const l=L.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:j,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=L.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(_n);function w({appContent:e}){const t=le(),l=K(),{billId:n}=te(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),C=k((F=>Z(F)));ui();const[x,_]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let Y=v.fetchState,M=v.file,$=v.showAutofill;const q=k((F=>Ue(F,n??"")));u===!1&&(Y=q.fetchState,M=q.transactionDetails?.attachments?.[0],$=!1);const J=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{Y==="Not-Started"&&(u&&D?B(!1):!u&&x&&_(!1))}),[n]),f.useEffect((()=>{x||n==null||u||(_(!0),t(Ct(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[x,D,u,n,t,S,E,b]);const z={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(J??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(C.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,C.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Y==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(Y!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:J}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Qt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(Ci,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:z,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(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(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(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 bt=U.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as V}from"./sentry-G4ZANa8Z.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-DGLzDXWl.js";import{fE as z,Hp as ce,YV as ue,Bt as de,S5 as pe,HD as le,KO as me,NB as fe,Of as ye,P4 as Se,YW as ge,YX as Ie,YY as be,YZ as he,Y_ as Te,V9 as Oe,X$ as De,Vo as Ce,LS as ke,Vp as Ve,LW as Ae,mG as we,gF as Ne,gE as Fe,gD as _e,uS as ve,uJ as Ee,uG as Be,my as xe,BC as ze,BA as P,bE as U,BO as L,cE as Pe}from"./zeni-epic-state-Dm2vDWXH.js";import{bS as Ue,U as Le,O as Re,bi as Me,z as x,a8 as je,k as R,o as E,T as B,bU as Ge,ae as Ye,p as M,aG as j}from"./index-
|
|
1
|
+
import{a as V}from"./sentry-G4ZANa8Z.js";import{u as Y,j as h,h as ne,g as se,i as oe,N as ie,l as re}from"./core-DGLzDXWl.js";import{fE as z,Hp as ce,YV as ue,Bt as de,S5 as pe,HD as le,KO as me,NB as fe,Of as ye,P4 as Se,YW as ge,YX as Ie,YY as be,YZ as he,Y_ as Te,V9 as Oe,X$ as De,Vo as Ce,LS as ke,Vp as Ve,LW as Ae,mG as we,gF as Ne,gE as Fe,gD as _e,uS as ve,uJ as Ee,uG as Be,my as xe,BC as ze,BA as P,bE as U,BO as L,cE as Pe}from"./zeni-epic-state-Dm2vDWXH.js";import{bS as Ue,U as Le,O as Re,bi as Me,z as x,a8 as je,k as R,o as E,T as B,bU as Ge,ae as Ye,p as M,aG as j}from"./index-CVAekD3p.js";import{n as We}from"./mui-BuJ3P0FU.js";import{j as k}from"./liveblocks-DRsJ0YIJ.js";import{d as G}from"./routePaths-nMSO0ytp.js";import{M as Ze}from"./MobileAppDrawer-HCRn1e7J.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="3357f450-07f1-4f83-ab22-959363eaba1e",t._sentryDebugIdIdentifier="sentry-dbid-3357f450-07f1-4f83-ab22-959363eaba1e")}catch{}})();function nt(){const t=Y(),u=h((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Ue(n),p=h((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const $e=We.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as S}from"./liveblocks-DRsJ0YIJ.js";import{a as l}from"./sentry-G4ZANa8Z.js";import{u as pe,h as he,g as Ce,j as M,i as fe,l as ge}from"./core-DGLzDXWl.js";import{a as Se,e8 as be,z as ye,ea as Pe,ec as N,ed as Ie,bn as W,a8 as we,k as D,ee as H,eo as Ee,G as ke,T as Te,w as xe,eh as Ae,ei as Ue,av as _e,el as ve,em as Oe,bk as Qe,en as Fe}from"./index-
|
|
1
|
+
import{j as S}from"./liveblocks-DRsJ0YIJ.js";import{a as l}from"./sentry-G4ZANa8Z.js";import{u as pe,h as he,g as Ce,j as M,i as fe,l as ge}from"./core-DGLzDXWl.js";import{a as Se,e8 as be,z as ye,ea as Pe,ec as N,ed as Ie,bn as W,a8 as we,k as D,ee as H,eo as Ee,G as ke,T as Te,w as xe,eh as Ae,ei as Ue,av as _e,el as ve,em as Oe,bk as Qe,en as Fe}from"./index-CVAekD3p.js";import{gJ as De,fD as G,fE as $e,g7 as je,jg as Le,jc as Ve,fF as z,gt as Re,gn as qe,gp as B,gv as Me,gw as He,gx as ze,gy as Be,gz as Ne}from"./zeni-epic-state-Dm2vDWXH.js";import{D as We,n as j,P as Ge,S as Je}from"./mui-BuJ3P0FU.js";import"./recharts-CJlXFxhv.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./utils-Bz8wuSWM.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]="e8a8c34b-a4d9-42eb-ba8f-7fc1c0a5ce7a",e._sentryDebugIdIdentifier="sentry-dbid-e8a8c34b-a4d9-42eb-ba8f-7fc1c0a5ce7a")}catch{}})();const J="chat-response-generated",Y="cards/ask",K="card_policy_hero";function $(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Ye=ge((function(e,a){const o=G(e),d=a.isSubmitting,c=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:d,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:ve(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...c}}),(function(e,a){const{location:o,currentTenant:d,userId:c,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,cardPolicyPageContext:U}=a,i=d.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):$(i);return{onEventReceived:(n,t)=>{if(n===J&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?D.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):D.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,ze(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:c}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,c,f,s,U)},updateCurrentInput:n=>{e(B(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Me(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(B(""))},togglePageView:()=>{m(p,{state:N(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(qe()),m((function(n){return`/${n}/${Y}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(Re({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:x,isCardPolicyEnabled:A,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m($(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(xe(Ae)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),T=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=Se(),o=pe(),d=he(),c=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(De())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=c.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:T,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,v]=l.useState(!1),O=l.useRef(!1);l.useEffect((()=>{O.current||u==null||u===""||(_(u),v(P),O.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),v(!1),d(c.pathname,{replace:!0,state:N(c.state)})}),[c.pathname,c.state,d]),ie=n.masterTOSInfo,g=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(g&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),v(w),O.current=!1}}),[g]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&d((function(r,w){return`/${r}/${Y}/${w}`})(s,t),{state:{...c.state},replace:!0})}),[t,p,s,d,c.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(je({sessionId:p,agentId:"controller"}))}),[]);const ce=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${J}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const de=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return S.jsxs(tt,{children:[S.jsx(we,{analytics:D,onLoad:r=>r.trackPageLoaded(Te.Event.aiCFOPage)}),g?S.jsx(Ye,{...ce,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:x,isCardPolicyEnabled:A,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:d,sessionFromUrl:de,location:c,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:T,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>{d(I?X(s):$(s),{state:{...c.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(z(n.userRoleId)))}}),S.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:S.jsx(et,{onClick:r=>r.stopPropagation(),children:S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>h(!1),onCompleteClick:()=>{g||n.userRoleId==null||o(z(n.userRoleId)),h(!1)}})})})]})},et=j(Je)`
|
|
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-DRsJ0YIJ.js";import{u as me,j as d,h as de,g as he,i as Ne,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-DGLzDXWl.js";import{fR as Pt,$H as is,g1 as wt,bt as Te,$I as ds,$J as ls,fG as fn,$K as Pn,fP as wn,$L as vn,$M as Tn,$N as Fn,$O as xn,fQ as Ln,g0 as Bn,$P as Rn,$Q as us,fW as ms,fV as Cs,$R as ps,JT as On,g3 as ia,$S as hs,$T as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$U as Ss,fZ as ys,Jp as Is,Jo as ks,Js as Es,Ju as As,g9 as Ds,fD as Mn,$V as _s,$W as Ps,ge as Nn,$X as ws,gf as yt,JA as vs,Jx as Ts,fE as fe,$Y as qa,dY as Fe,dh as xe,dZ as Le,gZ as da,cB as la,$Z as ua,$_ as vt,CO as Ga,m6 as Ka,$$ as za,K7 as ka,g4 as qe,K9 as Tt,lY as Vn,a00 as ma,JX as _a,a01 as Fs,a02 as xs,J_ as Ja,a03 as Ls,YS as Qa,f$ as Hn,K4 as ba,ip as Bs,a04 as $n,fS as Ca,br as Rs,a05 as Os,gF as Xa,gE as et,KD as Us,gD as at,a06 as Gn,cu as Kn,d9 as js,YR as wa,Lc as zn,a07 as gn,KO as Pa,a08 as Yn,Ld as Ms,Zf as Ns,Le as Vs,Mj as Hs,C2 as $s,Md as Gs,a09 as Ks,K8 as oa,a0a as zs,a0b as Ys,a0c as Ws,a0d as Zs,a0e as qs,a0f as Ft,a0g as Js,Ko as Wn,Kh as Qs,a0h as Xs,g$ as eo,a0i as Zn,Kx as qn,KB as Jn,g_ as ao,a0j as to,K_ as Qn,a0k as no,a0l as ro,a0m as so,Kz as Xn,Kk as er,K1 as ar,Kt as tr,Kr as nr,Kv as oo,a0n as rr,a0o as co,gb as io,gc as lo,gd as uo,a0p as tt,g5 as sr,db as xt,a0q as mo,a0r as Co,a0s as po,a0t as ho,KJ as It,L5 as fo,L1 as go,KF as bo,L3 as So,KV as yo,KX as Io,a0u as or,Lb as $a,S2 as ko,a0v as Eo,a0w as Ao,a0x as Do,a0y as cr,a0z as _o,Ly as Po,KN as ir,KI as Me,KM as wo,a0A as vo,a0B as To,JU as Fo,a0C as dr,f_ as lr,a0D as xo,JW as Lo,JV as bn,a0E as Bo,a0F as Ro,a0G as Oo,Va as Uo,a0H as Lt,a0I as jo,FV as ur,mG as Mo,id as No,LD as Vo,a0J as mr,fM as Ho,fN as $o,a0K as Go,dN as Ko,g2 as zo,Lt as Yo,Ln as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,U1 as Qo}from"./zeni-epic-state-Dm2vDWXH.js";import{U as Be,df as Cr,a4 as we,dg as pr,dh as hr,di as Xo,G as ea,as as Bt,dj as ec,dk as ac,a as fr,e as gr,ar as br,p as ke,O as le,c as W,j as ya,dl as Sr,dm as tc,dn as nc,z as te,a7 as va,d4 as nt,dp as rc,dq as sc,dr as oc,a1 as Ta,bi as Qe,bE as Rt,ds as cc,ab as Fa,X as rt,E as Ot,k as ae,w as st,dt as ic,bQ as Sa,du as kt,dv as dc,a8 as Ut,dw as lc,ae as yr,av as Et,dx as uc,aq as Ir,N as kr,T as Er,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,dE as bc,J as Ya,dF as Sc,dG as yc,m as ht,$ as Ic,dH as kc,dI as Ec,dJ as Ac,ai as Dc,dK as _c,dL as Pc,g as wc}from"./index-DGjciFPC.js";import{n as Ve,D as Ar,S as vc}from"./mui-BuJ3P0FU.js";import{a as r}from"./sentry-G4ZANa8Z.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-DY2m50un.js";import{M as Ee}from"./MobileAppDrawer-Q8q8ssn0.js";import{d as jt}from"./recharts-CJlXFxhv.js";import{g as _e,a as La,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as Tc,i as Mt,P as Fc,j as Nt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Lc,S as Sn}from"./SetupPagesScreen-CsSP_P2k.js";import{u as vr}from"./useInitialThreadRequest-Cdwnj1Ib.js";import ot from"./NotFoundScreen-3YmbDG-O.js";import{u as Vt}from"./useChargeCardPusherEvents-C-hT_5jI.js";import{n as yn}from"./utils-Bz8wuSWM.js";import{t as Bc}from"./AddressScreen-C1CfOA8k.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./InboxNotificationsProvider-Cf5DQSg3.js";import"./useTaskManagerAccess-i7vk79Wr.js";import"./BusinessVerificationPageScreen-BmHKq1LL.js";import"./routePaths-COaM8xFB.js";import"./analyticsHelper-tF6p2yRC.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]="b9a32006-aceb-477d-980a-988c55ecae66",e._sentryDebugIdIdentifier="sentry-dbid-b9a32006-aceb-477d-980a-988c55ecae66")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Be(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),T=d((O=>vn(O.cardPolicyState))),B=d((O=>Tn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Ln(O.cardPolicyState))),L=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Bn())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),M=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(Tr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:T,suggestedBlockMerchants:B,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,T,B,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),H=D.fetchState,v=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??v;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,v]),K=r.useCallback((()=>{e(v)}),[e,v]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),N=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),V=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(H);r.useEffect((()=>{const O=Q.current;Q.current=H,H==="Completed"&&O!=="Completed"&&M!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(v))}),[t,H,M,e,v]);const c=H==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:L==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:N,onRemoveDocument:V})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Mc}}}=ea.getLocalizedStrings(),Nc=e=>Un(e,!1),Vc=e=>jn(e.name,!1);function Hc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Ne(),s=me(),g=Be(),b=Te(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),T=d((c=>Pn(c.cardPolicyState))),B=d((c=>wn(c.cardPolicyState))),S=d((c=>vn(c.cardPolicyState))),l=d((c=>Tn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),L=d((c=>xn(c.cardPolicyState))),k=d((c=>Ln(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),M=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:M!=null?Is(M):void 0),[p.templateId,p.formDraft,M,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||M!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,M]),r.useEffect((()=>{T!=="Completed"&&T!=="In-Progress"&&s(Bn())}),[s,T]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>B.map(Nc)),[B]),i=r.useMemo((()=>k.map(Vc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(Tr)),[D.cards]);Bt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:L})}),[E,f,R,i,y,S,l,C,L]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),H=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{H.cancel()}),[H]);const v=r.useCallback((c=>{H(c)}),[H]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),N=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),V=r.useRef(P);r.useEffect((()=>{const c=V.current;V.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??Mc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&T==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:v,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Lr(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:$c,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=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 Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Be(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((v=>{h(v)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Card Policy"}),B=d((v=>_s(v))),S=d((v=>Rn(v.createCardPolicyState))),l=d((v=>Ps(v.createCardPolicyState))),C=d((v=>l==null?[]:Nn(v.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),L=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((v=>ws(v.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((v=>{t(yt({chatSessionId:l,id:v.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const v=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:v}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=B.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(vs())}),[t,D]);const M=B.archiveFetchState.fetchState,E=ya(M);r.useEffect((()=>{E==="In-Progress"&&M==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[M,t,E]);const y=r.useMemo((()=>B.templates.map(zc)),[B.templates]);Bt({isDataReady:B.fetchState.fetchState==="Completed"});const R=y.length>0||L>0,i=(function(v){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=v,I=de(),N=he(),{tenantEmailDomain:V}=Ne(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>Mn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:He}=Lr("card_policy"),Ae=r.useMemo((()=>xr(X,He,3)),[X,He]),[ge,re]=r.useState(""),be=q&&O&&V!=null&&!Q,ue=r.useCallback((J=>{if(V==null)return;const fa=ke(N.state?.pathnameStackToGoBack,N.pathname);I(`/${V}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,I,V]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),ve=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:$c,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:ve,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,ve,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((v=>{n!=null&&e(`/${n}/cards/policy/${v}/edit`)}),[e,n]),z=r.useCallback((v=>{t(Ts(v))}),[t]),H=B.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:T})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:L,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:T})]})}function Wc(){const e=de(),{cardId:a}=Ne(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Be(),b=Te(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:T}=h(W.isDebitCardFeatureEnabled),B=Fe(s),S=xe(s),l=Le(T,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Re({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),M=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>vt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),H=z?.accountingClassIDs[0],v=d((X=>H!=null?Ka(X.classState,{classId:H,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",V=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&N&&(u(!0),setTimeout((()=>{n(za()),V&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,N,V]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,N]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(Tt()),R!=="Completed"&&R!=="In-Progress"&&n(Vn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,L,_,p),q=La(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(va,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:L,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:v?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",$t="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",Mr="charge-card-repayment-completed",Nr="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,Ba],Jc=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(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((T=>fe(T))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((T=>ma(T))),m=vr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const T=we(n.state?.pathnameStackToGoBack),B=T.poppedPathname??Xc(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:T.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,qc),onEvent:T=>{switch(T){case Ra:case Ba:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,L=d((I=>xs(I,s))),k=L.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:M}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Le(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&L.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,L.fetchState,h,_]);const H=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(L.fetchState==="Completed"){if(F===!1&&(H===!1||H&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==B.userId)){const I=_e(S.tenantEmailDomain,s,B,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:N}})}else if(F&&L.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Ls({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,B,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:N}})}}}),[L.fetchState,k?.type.code,F,L.isRefreshingViewInBackground]);const v=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Hn(I.userState,B.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{L.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[L.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{T(I)};if(_!=="Completed"||k==null)return o.jsx(va,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:L,signedInUserToken:v,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Bs(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=$n(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ve.div`
|
|
1
|
+
import{j as o}from"./liveblocks-DRsJ0YIJ.js";import{u as me,j as d,h as de,g as he,i as Ne,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-DGLzDXWl.js";import{fR as Pt,$H as is,g1 as wt,bt as Te,$I as ds,$J as ls,fG as fn,$K as Pn,fP as wn,$L as vn,$M as Tn,$N as Fn,$O as xn,fQ as Ln,g0 as Bn,$P as Rn,$Q as us,fW as ms,fV as Cs,$R as ps,JT as On,g3 as ia,$S as hs,$T as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$U as Ss,fZ as ys,Jp as Is,Jo as ks,Js as Es,Ju as As,g9 as Ds,fD as Mn,$V as _s,$W as Ps,ge as Nn,$X as ws,gf as yt,JA as vs,Jx as Ts,fE as fe,$Y as qa,dY as Fe,dh as xe,dZ as Le,gZ as da,cB as la,$Z as ua,$_ as vt,CO as Ga,m6 as Ka,$$ as za,K7 as ka,g4 as qe,K9 as Tt,lY as Vn,a00 as ma,JX as _a,a01 as Fs,a02 as xs,J_ as Ja,a03 as Ls,YS as Qa,f$ as Hn,K4 as ba,ip as Bs,a04 as $n,fS as Ca,br as Rs,a05 as Os,gF as Xa,gE as et,KD as Us,gD as at,a06 as Gn,cu as Kn,d9 as js,YR as wa,Lc as zn,a07 as gn,KO as Pa,a08 as Yn,Ld as Ms,Zf as Ns,Le as Vs,Mj as Hs,C2 as $s,Md as Gs,a09 as Ks,K8 as oa,a0a as zs,a0b as Ys,a0c as Ws,a0d as Zs,a0e as qs,a0f as Ft,a0g as Js,Ko as Wn,Kh as Qs,a0h as Xs,g$ as eo,a0i as Zn,Kx as qn,KB as Jn,g_ as ao,a0j as to,K_ as Qn,a0k as no,a0l as ro,a0m as so,Kz as Xn,Kk as er,K1 as ar,Kt as tr,Kr as nr,Kv as oo,a0n as rr,a0o as co,gb as io,gc as lo,gd as uo,a0p as tt,g5 as sr,db as xt,a0q as mo,a0r as Co,a0s as po,a0t as ho,KJ as It,L5 as fo,L1 as go,KF as bo,L3 as So,KV as yo,KX as Io,a0u as or,Lb as $a,S2 as ko,a0v as Eo,a0w as Ao,a0x as Do,a0y as cr,a0z as _o,Ly as Po,KN as ir,KI as Me,KM as wo,a0A as vo,a0B as To,JU as Fo,a0C as dr,f_ as lr,a0D as xo,JW as Lo,JV as bn,a0E as Bo,a0F as Ro,a0G as Oo,Va as Uo,a0H as Lt,a0I as jo,FV as ur,mG as Mo,id as No,LD as Vo,a0J as mr,fM as Ho,fN as $o,a0K as Go,dN as Ko,g2 as zo,Lt as Yo,Ln as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,U1 as Qo}from"./zeni-epic-state-Dm2vDWXH.js";import{U as Be,df as Cr,a4 as we,dg as pr,dh as hr,di as Xo,G as ea,as as Bt,dj as ec,dk as ac,a as fr,e as gr,ar as br,p as ke,O as le,c as W,j as ya,dl as Sr,dm as tc,dn as nc,z as te,a7 as va,d4 as nt,dp as rc,dq as sc,dr as oc,a1 as Ta,bi as Qe,bE as Rt,ds as cc,ab as Fa,X as rt,E as Ot,k as ae,w as st,dt as ic,bQ as Sa,du as kt,dv as dc,a8 as Ut,dw as lc,ae as yr,av as Et,dx as uc,aq as Ir,N as kr,T as Er,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,dE as bc,J as Ya,dF as Sc,dG as yc,m as ht,$ as Ic,dH as kc,dI as Ec,dJ as Ac,ai as Dc,dK as _c,dL as Pc,g as wc}from"./index-CVAekD3p.js";import{n as Ve,D as Ar,S as vc}from"./mui-BuJ3P0FU.js";import{a as r}from"./sentry-G4ZANa8Z.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BHyPLCCo.js";import{M as Ee}from"./MobileAppDrawer-HCRn1e7J.js";import{d as jt}from"./recharts-CJlXFxhv.js";import{g as _e,a as La,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as Tc,i as Mt,P as Fc,j as Nt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Lc,S as Sn}from"./SetupPagesScreen-DSJF8gvU.js";import{u as vr}from"./useInitialThreadRequest-DtdvMhZQ.js";import ot from"./NotFoundScreen-Due1Mflv.js";import{u as Vt}from"./useChargeCardPusherEvents-DTBTr-3d.js";import{n as yn}from"./utils-Bz8wuSWM.js";import{t as Bc}from"./AddressScreen-BfaScJFK.js";import"./analytics-CvsRIk3B.js";import"./plaid-i7y7YD6O.js";import"./dnd-SnD389s6.js";import"./stripe-cKAAJElX.js";import"./lottie-DEqUWUd5.js";import"./lexical-CMBMntF_.js";import"./pdf-B_v4zyN7.js";import"./InboxNotificationsProvider-Cf5DQSg3.js";import"./useTaskManagerAccess-DnvaNO8w.js";import"./BusinessVerificationPageScreen-BL-rDXb4.js";import"./routePaths-nMSO0ytp.js";import"./analyticsHelper-C534_Opk.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]="b9a32006-aceb-477d-980a-988c55ecae66",e._sentryDebugIdIdentifier="sentry-dbid-b9a32006-aceb-477d-980a-988c55ecae66")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Be(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),T=d((O=>vn(O.cardPolicyState))),B=d((O=>Tn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Ln(O.cardPolicyState))),L=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Bn())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),M=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(Tr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:T,suggestedBlockMerchants:B,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,T,B,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),H=D.fetchState,v=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??v;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,v]),K=r.useCallback((()=>{e(v)}),[e,v]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),N=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),V=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(H);r.useEffect((()=>{const O=Q.current;Q.current=H,H==="Completed"&&O!=="Completed"&&M!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(v))}),[t,H,M,e,v]);const c=H==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:L==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:N,onRemoveDocument:V})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Mc}}}=ea.getLocalizedStrings(),Nc=e=>Un(e,!1),Vc=e=>jn(e.name,!1);function Hc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Ne(),s=me(),g=Be(),b=Te(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),T=d((c=>Pn(c.cardPolicyState))),B=d((c=>wn(c.cardPolicyState))),S=d((c=>vn(c.cardPolicyState))),l=d((c=>Tn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),L=d((c=>xn(c.cardPolicyState))),k=d((c=>Ln(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),M=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:M!=null?Is(M):void 0),[p.templateId,p.formDraft,M,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||M!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,M]),r.useEffect((()=>{T!=="Completed"&&T!=="In-Progress"&&s(Bn())}),[s,T]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>B.map(Nc)),[B]),i=r.useMemo((()=>k.map(Vc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(Tr)),[D.cards]);Bt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:L})}),[E,f,R,i,y,S,l,C,L]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),H=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{H.cancel()}),[H]);const v=r.useCallback((c=>{H(c)}),[H]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),N=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),V=r.useRef(P);r.useEffect((()=>{const c=V.current;V.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??Mc.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&T==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:v,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:N})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Lr(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:$c,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=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 Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Ne(),t=me(),s=Be(),g=Te(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((v=>{h(v)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Card Policy"}),B=d((v=>_s(v))),S=d((v=>Rn(v.createCardPolicyState))),l=d((v=>Ps(v.createCardPolicyState))),C=d((v=>l==null?[]:Nn(v.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),L=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((v=>ws(v.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((v=>{t(yt({chatSessionId:l,id:v.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const v=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:v}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=B.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(vs())}),[t,D]);const M=B.archiveFetchState.fetchState,E=ya(M);r.useEffect((()=>{E==="In-Progress"&&M==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[M,t,E]);const y=r.useMemo((()=>B.templates.map(zc)),[B.templates]);Bt({isDataReady:B.fetchState.fetchState==="Completed"});const R=y.length>0||L>0,i=(function(v){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=v,I=de(),N=he(),{tenantEmailDomain:V}=Ne(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>Mn(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:He}=Lr("card_policy"),Ae=r.useMemo((()=>xr(X,He,3)),[X,He]),[ge,re]=r.useState(""),be=q&&O&&V!=null&&!Q,ue=r.useCallback((J=>{if(V==null)return;const fa=ke(N.state?.pathnameStackToGoBack,N.pathname);I(`/${V}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[N.pathname,N.state,I,V]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),ve=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:$c,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:ve,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,ve,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const v=we(a.state?.pathnameStackToGoBack),P=v.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:v.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((v=>{n!=null&&e(`/${n}/cards/policy/${v}/edit`)}),[e,n]),z=r.useCallback((v=>{t(Ts(v))}),[t]),H=B.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:T})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:L,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:T})]})}function Wc(){const e=de(),{cardId:a}=Ne(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Be(),b=Te(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:T}=h(W.isDebitCardFeatureEnabled),B=Fe(s),S=xe(s),l=Le(T,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Re({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),M=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>vt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),H=z?.accountingClassIDs[0],v=d((X=>H!=null?Ka(X.classState,{classId:H,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",V=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&N&&(u(!0),setTimeout((()=>{n(za()),V&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,N,V]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,N]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(Tt()),R!=="Completed"&&R!=="In-Progress"&&n(Vn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,L,_,p),q=La(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(va,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:L,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:v?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",$t="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",Mr="charge-card-repayment-completed",Nr="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,Ba],Jc=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(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((T=>fe(T))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((T=>ma(T))),m=vr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const T=we(n.state?.pathnameStackToGoBack),B=T.poppedPathname??Xc(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:T.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,qc),onEvent:T=>{switch(T){case Ra:case Ba:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=Ta(),n=me(),t=de(),{cardId:s}=Ne(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,T]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,L=d((I=>xs(I,s))),k=L.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:M}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Le(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&L.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,L.fetchState,h,_]);const H=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(L.fetchState==="Completed"){if(F===!1&&(H===!1||H&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==B.userId)){const I=_e(S.tenantEmailDomain,s,B,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:N}})}else if(F&&L.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Ls({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,B,k,!0),N=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:N}})}}}),[L.fetchState,k?.type.code,F,L.isRefreshingViewInBackground]);const v=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Hn(I.userState,B.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{L.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[L.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{T(I)};if(_!=="Completed"||k==null)return o.jsx(va,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:L,signedInUserToken:v,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Bs(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=$n(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ve.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
|