@zeniai/web-app-ui 5.2.20-qa → 5.2.21-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/AddressRoutes-DsPUKLM8.js +1 -0
- package/dist/assets/{AddressScreen-Gd3rLr7o.js → AddressScreen-CiaeHzMQ.js} +1 -1
- package/dist/assets/{AiCfoScreen-GqFvcBB1.js → AiCfoScreen-Dkc2K8WZ.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-CbPB6Cz2.js → BillPayApprovalRoutes-DLylp8D7.js} +1 -1
- package/dist/assets/{BillPayRoutes-DGiViCr3.js → BillPayRoutes-D1Tl6Jb1.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-W5WuCBLZ.js → BusinessVerificationPageScreen-JbVAjzAy.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-D_U3dSti.js → CardsAiCfoScreen-C8ZjNDac.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-B27ureXO.js → ChargeCardRoutes-DufcIszo.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-ErXIYp45.js → CompanyPassportScreen-CZIzscoH.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-DJjWE9Ho.js → ConnectionAuthScreen-CXkJEI26.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-BqWUOwu1.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-B98Qqcry.js → CustomerOnboardingRoutes-DyfzWNjv.js} +1 -1
- package/dist/assets/DashboardRoutes-CKOE1UKI.js +20 -0
- package/dist/assets/{DefaultTenantHome-d6BXVPTI.js → DefaultTenantHome-Dt-ZttGa.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-JSSitzK8.js → DomesticWireDetailScreen-ClCEmr89.js} +1 -1
- package/dist/assets/{DrawerScreen-DNRTfvlv.js → DrawerScreen-DqZSrPso.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-BkmcXMq3.js → EntityDetailRoutes-DTEEaVmJ.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-BrNpDBh0.js → ExpenseAutomationRoutes-Ct03OyXj.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-C_G_t4I9.js → FeaturePreviewScreen-RPVxMb0u.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-B7NyqTm6.js → HubSpotOAuthCallbackScreen-W5gYsSav.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-DDsl9O0f.js → MagicLinkRoutes-B3NpG1gq.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-Dry_XVDq.js → MagicLinkSignInScreen-C4xl9cY8.js} +1 -1
- package/dist/assets/{MobileAppDrawer-DHMYVxFj.js → MobileAppDrawer-CRLaoS9b.js} +1 -1
- package/dist/assets/NotFoundScreen-BEj9MjFe.js +1 -0
- package/dist/assets/{NotificationRoutes-oG7avNKP.js → NotificationRoutes-DvlspGFD.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-Dh63jZlt.js → OAuthConsentScreen-C_UXcpAq.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-BVXECLJI.js → PandLWithForecastRoutes-8rDjc2Vf.js} +1 -1
- package/dist/assets/{PeopleRoutes-CQXZ97tH.js → PeopleRoutes-DXSlyB9m.js} +1 -1
- package/dist/assets/{PerformanceRoutes-Dioa22VE.js → PerformanceRoutes-CD2KNw8_.js} +1 -1
- package/dist/assets/{Preview-K7kVfJNZ.js → Preview-CRPYVI6t.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-8ZFrKnn9.js → QBOConnectionScreen--ycxEhUp.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-C8xbikTE.js → ReimbursementApprovalRoutes-DZL_z1mV.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DcC6kKsi.js → ReimbursementApprovalRuleDetailScreen-DG8xpE7m.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-DiSJ1F-L.js → ReimbursementRoutes-Pd_j0Kuw.js} +1 -1
- package/dist/assets/{ReportsRoutes-BPxWGssU.js → ReportsRoutes-BvbFxYaP.js} +1 -1
- package/dist/assets/{RewardsRoutes-DqiMNP30.js → RewardsRoutes-ChEdfM4m.js} +1 -1
- package/dist/assets/{ScreenRoutes-CBj7JgTH.js → ScreenRoutes-DBr3qw38.js} +2 -2
- package/dist/assets/{SettingsRoutes-CXmkByZI.js → SettingsRoutes-BaiCSjlR.js} +1 -1
- package/dist/assets/{SetupPagesScreen-BaE6w_Lx.js → SetupPagesScreen-DifY7gaU.js} +1 -1
- package/dist/assets/{SignInScreen-CwKX1cxj.js → SignInScreen-DYd156jI.js} +1 -1
- package/dist/assets/{SignOutScreen-B9gpIBeY.js → SignOutScreen-DDruLQut.js} +1 -1
- package/dist/assets/{TaskListScreen-CM1HvPkl.js → TaskListScreen-BEqD4wPV.js} +1 -1
- package/dist/assets/{TaskRoutes-CeoNkmPK.js → TaskRoutes-GZWWcLPu.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-CF2S0_wV.js → TransactionDetailRoutes-C5Tj5i38.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-CSzx81zE.js → TransactionDetailScreen-CaupyqkA.js} +1 -1
- package/dist/assets/{TransactionListRoutes-D0BHQcx7.js → TransactionListRoutes-DCnjf_2j.js} +1 -1
- package/dist/assets/{TreasuryRoutes-BSGTUZAU.js → TreasuryRoutes-JnJmwKGX.js} +1 -1
- package/dist/assets/{VendorsRoutes-D82zHUvQ.js → VendorsRoutes-B4Lj1jCG.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-C8a_Kzcy.js → WiseConfirmationScreen-juJTkPHv.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-C5ejtB2q.js → ZeniAccountRoutes-BZGxxall.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-B6jIO9ea.js → ZeniAccountStatementScreen-o2U5WdzW.js} +1 -1
- package/dist/assets/{accountMappingHelper-gMZWceAt.js → accountMappingHelper-DXKNp4_g.js} +1 -1
- package/dist/assets/{analytics-BP5D4JyB.js → analytics-Det0UZFe.js} +1 -1
- package/dist/assets/{analyticsHelper-Ib8eUq2U.js → analyticsHelper-DyhEHOhh.js} +1 -1
- package/dist/assets/{core-BfWJ7zKT.js → core-DslHP-Nt.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-D2jiQ7Do.js → decodeURIComponentSafe-uhKYYVbR.js} +1 -1
- package/dist/assets/{dnd-tQgCG5z3.js → dnd-CQxwFT7m.js} +1 -1
- package/dist/assets/{empty-0zu7mfa-.js → empty-Wy9lgs00.js} +1 -1
- package/dist/assets/{empty-D4KL-CgN.js → empty-pFhUOX6X.js} +1 -1
- package/dist/assets/{emptyVideoElement-D2WpBqYb.js → emptyVideoElement-w1_MywKD.js} +1 -1
- package/dist/assets/{epic-_aUX4Son.js → epic-DTnE0Nui.js} +1 -1
- package/dist/assets/{getLocaleForTenant-0y5Rz6LJ.js → getLocaleForTenant-CkKXTx9H.js} +1 -1
- package/dist/assets/{index-oBgu7-MV.js → index--54UVqXL.js} +2 -2
- package/dist/assets/{index-DpTDwQon.js → index-B3Qv-ngJ.js} +1 -1
- package/dist/assets/{index-zYcXrqlT.js → index-BSV1Wtow.js} +1 -1
- package/dist/assets/{index-edb9TugW.js → index-Cbw-Hudf.js} +1 -1
- package/dist/assets/{index-D9NLhglj.js → index-Cny4F3UP.js} +9953 -9953
- package/dist/assets/{index-BtVRjclm.js → index-D9jKQIPj.js} +1 -1
- package/dist/assets/{index-C2k_pBZi.js → index-DCO11L1y.js} +1 -1
- package/dist/assets/{index-CiS2dMrM.js → index-H3qfOHz1.js} +1 -1
- package/dist/assets/{lexical-Bg8ldM3i.js → lexical-DYyincEg.js} +1 -1
- package/dist/assets/{liveblocks-DJbBe3tc.js → liveblocks-Dge8uQhE.js} +1 -1
- package/dist/assets/{lottie-BaCgeYyk.js → lottie-JtX4it7w.js} +1 -1
- package/dist/assets/{mui-ts7KHm6i.js → mui-DskYaYyd.js} +1 -1
- package/dist/assets/{pathToGoBack-DG10zCZ4.js → pathToGoBack-DPWssLbl.js} +1 -1
- package/dist/assets/{pdf-C9HGpLCu.js → pdf-8n9gC55d.js} +3 -3
- package/dist/assets/{pdf-lib-DX6kz8a9.js → pdf-lib-CuyyFcf5.js} +1 -1
- package/dist/assets/{plaid-Cv0mPYlm.js → plaid-ajCcP-UI.js} +1 -1
- package/dist/assets/{pusher-CgG6vGRj.js → pusher-gYNLjWxj.js} +1 -1
- package/dist/assets/{react-tqWON72J.js → react-B1cHKI31.js} +1 -1
- package/dist/assets/{react-r7Nkvi02.js → react-Cj6es5B3.js} +1 -1
- package/dist/assets/{react-Bu9a3mw7.js → react-D56X5BsD.js} +1 -1
- package/dist/assets/{react-LH5dN4Ph.js → react-D8SoUGP2.js} +1 -1
- package/dist/assets/{react-Dp-aIPjg.js → react-h386o274.js} +1 -1
- package/dist/assets/{react-CdB2kFeI.js → react-qy_mbxl-.js} +1 -1
- package/dist/assets/{recharts-DNnhB5R_.js → recharts-BV1Rao9g.js} +1 -1
- package/dist/assets/{routePaths-DxGoZobb.js → routePaths-BRZr86UY.js} +1 -1
- package/dist/assets/{sentry-C6T1HHHS.js → sentry-ConJlCAk.js} +1 -1
- package/dist/assets/{url-CJ3E3PSB.js → url-FGF171Cm.js} +1 -1
- package/dist/assets/{url-Xy6MI2YY.js → url-rW6Xsakn.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-C2dvtIj1.js → useAiCfoDashboardSuggestedQuestionsChips-CNFp4dUE.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-D8n0-rNW.js → useAskAiCfoHostNavButtonProps-Dbk2QnY2.js} +1 -1
- package/dist/assets/{useCashManagementBanner-gOTcVHZg.js → useCashManagementBanner-B8l-9mNC.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-D846Tvtv.js → useChargeCardPusherEvents-7z8f-VNH.js} +1 -1
- package/dist/assets/{useDeviceId-DNuYTM17.js → useDeviceId-DS-lzRmX.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-a9kkk9YH.js → useEmailConnectResultRefresh-Dd3ZNdiP.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-BlvltKSe.js → useInitialThreadRequest-BP8PKnuv.js} +1 -1
- package/dist/assets/{utils-xWcqC4Wl.js → utils-KyL5SnF3.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-QwShhfS-.js → withTransactionSidePanel-BWGtTu19.js} +1 -1
- package/dist/assets/{zeni-epic-state-kow6PLud.js → zeni-epic-state-COMt8QIe.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-DYJsnvRP.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-Dk9pmK5M.js +0 -1
- package/dist/assets/DashboardRoutes-5YFzvPKk.js +0 -20
- package/dist/assets/NotFoundScreen-DsR8VsQv.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-Dge8uQhE.js";import{A as d}from"./AddressScreen-CiaeHzMQ.js";import i from"./NotFoundScreen-BEj9MjFe.js";import"./sentry-ConJlCAk.js";import{o as s,p as r}from"./core-DslHP-Nt.js";import"./zeni-epic-state-COMt8QIe.js";import"./recharts-BV1Rao9g.js";import"./index-Cny4F3UP.js";import"./mui-DskYaYyd.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.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]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-
|
|
1
|
+
import{j as d}from"./liveblocks-Dge8uQhE.js";import{a as S}from"./sentry-ConJlCAk.js";import{h as T,u as _,g as E,i as j,j as B,n as D}from"./core-DslHP-Nt.js";import{J as $,E as M,z as L,D as N,B as K,A as z,f as C,h as m,r as F,m as h,s as R}from"./index-Cny4F3UP.js";import{Nf as w,i1 as U,e$ as G,Ng as O,c7 as V,Nh as q,lr as H}from"./zeni-epic-state-COMt8QIe.js";import{n as J}from"./mui-DskYaYyd.js";import Q from"./NotFoundScreen-BEj9MjFe.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]="d812e280-bb87-44eb-a92b-180bac80a8d0",e._sentryDebugIdIdentifier="sentry-dbid-d812e280-bb87-44eb-a92b-180bac80a8d0")}catch{}})();const W=J.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-DJbBe3tc.js";import{a as l}from"./sentry-C6T1HHHS.js";import{u as we,h as Pe,g as ye,j as X,i as Ee,n as Te}from"./core-BfWJ7zKT.js";import{W as ve,de as Ae,z as Qe,J as _e,df as Ue,dg as Oe,bb as Z,dh as ae,di as je,ba as oe,s as V,A as B,f as I,dj as R,dk as Fe,dl as Le,a3 as De,h as Be,a9 as Re,dm as Me,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,v as We,b6 as ze,ds as He}from"./index-D9NLhglj.js";import{gr as Je,e_ as ne,e$ as Ye,iJ as Ke,Uw as Xe,fu as Ze,iT as et,iP as tt,f0 as M,fB as st,ga as at,gb as ot,g3 as nt,j7 as ee,g7 as te,gc as it,gd as rt,ge as lt,gf as dt,gg as ct,gh as ut}from"./zeni-epic-state-kow6PLud.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-ts7KHm6i.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-C2dvtIj1.js";import{p as gt}from"./pathToGoBack-DG10zCZ4.js";import"./recharts-DNnhB5R_.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="545de085-684d-4056-bc08-738731441871",e._sentryDebugIdIdentifier="sentry-dbid-545de085-684d-4056-bc08-738731441871")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:A}=oe(x,m);g!=="answer"?I.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,He(A,i),c.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&ze(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=We(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{b(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{b(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Re(Me)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=ye(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=Ae();l.useEffect((()=>{a(Je())}),[a]);const h=X((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=X((r=>Ye(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:re}=Ue({isFileUploadEnabled:e,tenantEmailDomain:w}),Q=Oe({currentTenant:m,currentChatSessionId:i,aiCfoView:h}),{isSuggestedQuestionsLoading:le,suggestedPromptQuestions:de}=St(),P=o.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;l.useEffect((()=>{const r=o.state;if(r?.[Z]!==!0)return;d(!0);const f={...r};delete f[Z],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,U]=l.useState(!1),[me,O]=l.useState(void 0),[pe,j]=l.useState(void 0),G=l.useRef(!1);l.useEffect((()=>{if(!G.current&&y!=null&&y!==""){const r=o.state;_(y),U($),O(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[y,$,o.state]);const he=l.useCallback((()=>{_(null),U(!1),O(void 0),j(void 0),p(o.pathname,{replace:!0,state:ae(o.state)})}),[o.pathname,o.state,p]),q=l.useMemo((()=>new URLSearchParams(o.search)),[o.search]),N=q.get("ref")??P?.aiCfoRef,F=q.get("emailRefId")??P?.aiCfoEmailRefId,W=l.useRef(!1);l.useEffect((()=>{W.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Ke("controller",s.userId,F,"MONTH_END_EMAIL")),W.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),U(!0),O(void 0),j(void 0),a(Xe()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:z}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,H=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",J=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),Y=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(Y,i),fe=ge.length===0;l.useEffect((()=>{C||g||p("../dashboard",{state:{...o.state,message:"open_ai_cfo_drawer"}})}),[C,g,p,o.state]);const Ce=l.useCallback((()=>{const r=V(o.state?.pathnameStackToGoBack),f=m.tenantEmailDomain;p(r.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...o.state,pathnameStackToGoBack:r.newStack}})}),[m.tenantEmailDomain,o.state,p]);l.useEffect((()=>{i!=null&&t!==i&&p(`../ai-cfo/${i}`,{state:{...o.state}})}),[i,t]),l.useEffect((()=>{t!=null&&i==null&&t!=="new_chat"&&t!=="explore"&&a(Ze({sessionId:t,agentId:"controller"}))}),[]);const be=l.useMemo((()=>({events:z.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[z]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&H!=="In-Progress"&&J&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[H,J,i,s,a]);const K=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const Ie=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(bt,{children:[u.jsx(B,{analytics:I,onLoad:K}),Q.drawerElement,u.jsx(It,{children:u.jsx(se,{children:u.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(M(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:I,onLoad:K}):null,u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:I,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&Q.drawerElement,u.jsx(ft,{...be,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:Y,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>d(!0),userId:s.userId,setIsAiCfoOpen:n,navigate:p,sessionFromUrl:t,location:o,isSubmitting:Ie,isEmptyChatWithSession:fe,currentTenant:m,emailLinkQuestion:ce??void 0,autoSubmitEmailLinkQuestion:ue,onEmailLinkQuestionProcessed:he,routedInitialQuestionSource:me,routedInitialQuestionSuggestionIndex:pe,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:re,onUploadPromoClose:A,exploreSuggestedPromptQuestions:de,exploreSuggestedPromptQuestionsLoading:le}),S&&g?u.jsx(mt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:kt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:u.jsx(se,{onClick:r=>r.stopPropagation(),children:u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})})}):null]}),S&&!g?u.jsx(Fe,{open:S,onClose:()=>d(!1),children:u.jsx(Le,{children:ke})}):null]})},se=k(pt)`
|
|
1
|
+
import{j as u}from"./liveblocks-Dge8uQhE.js";import{a as l}from"./sentry-ConJlCAk.js";import{u as we,h as Pe,g as ye,j as X,i as Ee,n as Te}from"./core-DslHP-Nt.js";import{W as ve,de as Ae,z as Qe,J as _e,df as Ue,dg as Oe,bb as Z,dh as ae,di as je,ba as oe,s as V,A as B,f as I,dj as R,dk as Fe,dl as Le,a3 as De,h as Be,a9 as Re,dm as Me,dn as Ve,a4 as $e,dp as Ge,dq as qe,dr as Ne,v as We,b6 as ze,ds as He}from"./index-Cny4F3UP.js";import{gr as Je,e_ as ne,e$ as Ye,iJ as Ke,Uw as Xe,fu as Ze,iT as et,iP as tt,f0 as M,fB as st,ga as at,gb as ot,g3 as nt,j7 as ee,g7 as te,gc as it,gd as rt,ge as lt,gf as dt,gg as ct,gh as ut}from"./zeni-epic-state-COMt8QIe.js";import{D as mt,n as k,S as pt,P as ht}from"./mui-DskYaYyd.js";import{u as St}from"./useAiCfoDashboardSuggestedQuestionsChips-CNFp4dUE.js";import{p as gt}from"./pathToGoBack-DPWssLbl.js";import"./recharts-BV1Rao9g.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="545de085-684d-4056-bc08-738731441871",e._sentryDebugIdIdentifier="sentry-dbid-545de085-684d-4056-bc08-738731441871")}catch{}})();const ie="chat-response-generated",ft=Te((function(e,n){const a=ne(e),p=n.isSubmitting,o=a.uiState?.currentChatSessionId,S=o!=null?st(e.aiCfoState,o):[],d=Ve(e,{allUsers:n.allUsers,onCardPolicyVendorSearchTextChange:n.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:n.sessionFromUrl==="explore"&&a.uiState.currentChatSessionId==null,aiCfoView:a,isSubmitting:p,isNewChatSession:n.sessionFromUrl==="new_chat"||n.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${$e}/tableDownload`,emailLinkQuestion:n.emailLinkQuestion,autoSubmitEmailLinkQuestion:n.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:n.onEmailLinkQuestionProcessed,routedInitialQuestionSource:n.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:n.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:n.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:n.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:n.isFileUploadEnabled,isUploadPromoVisible:n.isUploadPromoVisible,onUploadPromoClose:n.onUploadPromoClose,skills:at(e).skills,syntheticAnswers:S,resolveSyntheticAnswerCardTile:qe(e),resolveSyntheticAnswerPolicyTile:Ge(e),...d}}),(function(e,n){const{location:a,currentTenant:p,userId:o,navigate:S,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=n,h=p.tenantEmailDomain;return{onEventReceived:(s,t)=>{if(s===ie&&typeof t.text=="string"&&typeof t.metadata=="object"){const c=t,g=lt(c.type),m=c.metadata.chat_session_id??null,{currentChatSession:i,currentQuestionAnswer:w,currentQuestionAnswerSummary:A}=oe(x,m);g!=="answer"?I.trackAICFOChatResponseGenerated(g,w?.question.questionText??"",c.text,m,He(A,i),c.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(c.text,w?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,dt(c.visualization?.type??"")??null,m,c.summarized_title,c.metadata.message_id??null),e(ct({chatSessionId:c.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ut({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:o}))}},onSubmit:(s,t,c,g,m)=>{s&&ze(e,s,t,d,x,o,g,c,void 0,m)},onFetchSkills:()=>{e(rt())},updateCurrentInput:s=>{e(te(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(it(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{S(-1)},onCloseClick:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??gt(1);S(t,{state:{...a.state,pathnameStackToGoBack:s.newStack}}),e(te(""))},togglePageView:()=>{const s=V(a.state?.pathnameStackToGoBack),t=s.poppedPathname??`/${p.tenantEmailDomain}/dashboard`;S(t,{state:{...ae(a.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"positive",t.questionText,t.answerText))},onThumbsDown:(s,t)=>{d!=null&&t?.messageId!=null&&e(ee(d,t.messageId,"negative",t.questionText,t.answerText))},onTogglePageView:()=>{S(-1)},onNewChatClick:()=>{d!=null&&e(nt());const s=We(a.state?.pathnameStackToGoBack,a.pathname);S(`/${p.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,t)=>{e(ot({questionAnswerId:s,isCollapsed:t}))},onMenuClick:n.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:d,onAfterCardsCreationSubmit:()=>{b(!0),S(`/${h}/cards`,{state:{...a.state}})},onAfterCardPolicySubmit:()=>{b(!0),S(`/${h}/cards/policy`,{state:{...a.state}})}})}}))(Re(Me)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:n}=ve(),a=we(),p=Pe(),o=ye(),[S,d]=l.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=Ae();l.useEffect((()=>{a(Je())}),[a]);const h=X((r=>ne(r))),s=Qe.getSignedInUser(),{session_id:t}=Ee(),c=_e(),g=De(c),m=X((r=>Ye(r))),i=h.uiState.currentChatSessionId,w=m.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:re}=Ue({isFileUploadEnabled:e,tenantEmailDomain:w}),Q=Oe({currentTenant:m,currentChatSessionId:i,aiCfoView:h}),{isSuggestedQuestionsLoading:le,suggestedPromptQuestions:de}=St(),P=o.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;l.useEffect((()=>{const r=o.state;if(r?.[Z]!==!0)return;d(!0);const f={...r};delete f[Z],p(o,{replace:!0,state:f})}),[o.pathname,o.search,o.state,p]);const[ce,_]=l.useState(null),[ue,U]=l.useState(!1),[me,O]=l.useState(void 0),[pe,j]=l.useState(void 0),G=l.useRef(!1);l.useEffect((()=>{if(!G.current&&y!=null&&y!==""){const r=o.state;_(y),U($),O(r?.aiCfoInitialSubmissionSource!=null?r.aiCfoInitialSubmissionSource:void 0);const f=r?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}}),[y,$,o.state]);const he=l.useCallback((()=>{_(null),U(!1),O(void 0),j(void 0),p(o.pathname,{replace:!0,state:ae(o.state)})}),[o.pathname,o.state,p]),q=l.useMemo((()=>new URLSearchParams(o.search)),[o.search]),N=q.get("ref")??P?.aiCfoRef,F=q.get("emailRefId")??P?.aiCfoEmailRefId,W=l.useRef(!1);l.useEffect((()=>{W.current||N!=="month-end-email"||F==null||i!=null||s==null||(a(Ke("controller",s.userId,F,"MONTH_END_EMAIL")),W.current=!0)}),[N,F,i,a,s]);const E=h.uiState.lastContextMessage;l.useEffect((()=>{E!=null&&E!==""&&i!=null&&(_(E),U(!0),O(void 0),j(void 0),a(Xe()))}),[E,i,a]);const Se=m.masterTOSInfo,C=Se?.isMasterTOSAccepted??!1,{visitedSessions:z}=je(i),L=h.fetchState,D=h.uiState.chatSessionsNextPageToken.hasMore||!h.uiState.chatSessionsFirstPageFetched,H=i!=null?h.fetchChatSessionHistoryByChatSessionId?.[i]?.fetchState??"Not-Started":"Not-Started",J=i==null||(h.uiState.chatHistoryNextPageToken[i]?.hasMore??!0),Y=h.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ge}=oe(Y,i),fe=ge.length===0;l.useEffect((()=>{C||g||p("../dashboard",{state:{...o.state,message:"open_ai_cfo_drawer"}})}),[C,g,p,o.state]);const Ce=l.useCallback((()=>{const r=V(o.state?.pathnameStackToGoBack),f=m.tenantEmailDomain;p(r.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...o.state,pathnameStackToGoBack:r.newStack}})}),[m.tenantEmailDomain,o.state,p]);l.useEffect((()=>{i!=null&&t!==i&&p(`../ai-cfo/${i}`,{state:{...o.state}})}),[i,t]),l.useEffect((()=>{t!=null&&i==null&&t!=="new_chat"&&t!=="explore"&&a(Ze({sessionId:t,agentId:"controller"}))}),[]);const be=l.useMemo((()=>({events:z.map((r=>`private-encrypted-chat-${r}.${ie}`)),eventCallback:(r,f,xe)=>xe.onEventReceived(r,f)})),[z]);l.useEffect((()=>{L!=="In-Progress"&&D&&a(et())}),[L,D,a]),l.useEffect((()=>{i!=null&&H!=="In-Progress"&&J&&s!=null&&L==="Completed"&&!D&&a(tt(i,s.userId))}),[H,J,i,s,a]);const K=r=>r.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||t==null)throw Error("Can't access AI Controller page without signing in...");const Ie=i!=null&&h.responseStateByChatSessionId?.[i]?.answer?.fetchState==="In-Progress";if(!C&&g)return u.jsxs(bt,{children:[u.jsx(B,{analytics:I,onLoad:K}),Q.drawerElement,u.jsx(It,{children:u.jsx(se,{children:u.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:Ce,onCompleteClick:()=>{m.userRoleId!=null&&a(M(m.userRoleId))}})})})]});const ke=u.jsxs(u.Fragment,{children:[S&&!C?u.jsx(B,{analytics:I,onLoad:K}):null,u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>d(!1):void 0,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})]});return u.jsxs(u.Fragment,{children:[u.jsxs(Ct,{children:[u.jsx(B,{analytics:I,onLoad:r=>r.trackPageLoaded(Be.Event.aiCFOPage)}),g&&Q.drawerElement,u.jsx(ft,{...be,currentChatSessionId:i,allSessionsWithOrderedQuestionAnswers:Y,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>d(!0),userId:s.userId,setIsAiCfoOpen:n,navigate:p,sessionFromUrl:t,location:o,isSubmitting:Ie,isEmptyChatWithSession:fe,currentTenant:m,emailLinkQuestion:ce??void 0,autoSubmitEmailLinkQuestion:ue,onEmailLinkQuestionProcessed:he,routedInitialQuestionSource:me,routedInitialQuestionSuggestionIndex:pe,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:re,onUploadPromoClose:A,exploreSuggestedPromptQuestions:de,exploreSuggestedPromptQuestionsLoading:le}),S&&g?u.jsx(mt,{anchor:"right",open:S,transitionDuration:250,PaperProps:{component:kt,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:u.jsx(se,{onClick:r=>r.stopPropagation(),children:u.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:h.masterTOSAcceptanceState,onCloseClick:()=>d(!1),onCompleteClick:()=>{C||m.userRoleId==null||a(M(m.userRoleId)),d(!1)}})})}):null]}),S&&!g?u.jsx(Fe,{open:S,onClose:()=>d(!1),children:u.jsx(Le,{children:ke})}):null]})},se=k(pt)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-DJbBe3tc.js";import{a as v}from"./sentry-C6T1HHHS.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-BfWJ7zKT.js";import{e$ as V,QG as A,Qm as h,zR as E,zJ as q,zN as R,zC as Q,Qo as K,zT as ae,zF as G,zW as J,zS as C}from"./zeni-epic-state-kow6PLud.js";import{z as O,a9 as M,bL as oe,ag as T,bC as H,bM as le,E as X,B as Y,bN as pe,bO as se}from"./index-D9NLhglj.js";import"./mui-ts7KHm6i.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DcC6kKsi.js";import re from"./NotFoundScreen-DsR8VsQv.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02",e._sentryDebugIdIdentifier="sentry-dbid-2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02")}catch{}})();const P="bill-approval-rule-update",ie=k((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(P)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(M(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>V(s))),i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${P}`]:[],eventCallback:(s,w,S)=>{s.endsWith(P)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(M(le)),de=()=>{const e=y((o=>V(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>V(s)));Z();const i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=T(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=T(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>V(t))),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
1
|
+
import{j as c}from"./liveblocks-Dge8uQhE.js";import{a as v}from"./sentry-ConJlCAk.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-DslHP-Nt.js";import{e$ as V,QG as A,Qm as h,zR as E,zJ as q,zN as R,zC as Q,Qo as K,zT as ae,zF as G,zW as J,zS as C}from"./zeni-epic-state-COMt8QIe.js";import{z as O,a9 as M,bL as oe,ag as T,bC as H,bM as le,E as X,B as Y,bN as pe,bO as se}from"./index-Cny4F3UP.js";import"./mui-DskYaYyd.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DG8xpE7m.js";import re from"./NotFoundScreen-BEj9MjFe.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02",e._sentryDebugIdIdentifier="sentry-dbid-2e5ed8aa-0a11-4665-a70c-6c5dd7cf7e02")}catch{}})();const P="bill-approval-rule-update",ie=k((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(P)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(M(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>V(s))),i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${P}`]:[],eventCallback:(s,w,S)=>{s.endsWith(P)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{T(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(M(le)),de=()=>{const e=y((o=>V(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>V(s)));Z();const i=y((s=>A(s))),f=y((s=>h(s).billPaySetupApproverViewUpdateData));if(v.useEffect((()=>{f?.updateStatus.fetchState==="Completed"&&o(E())}),[f]),v.useEffect((()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))}),[a,l,e,o]),O.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=T(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=T(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(J(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>V(t))),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(u(!0),p(G(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-DJbBe3tc.js";import{h as J,u as se,g as K,i as ae,j as v,N as te,n as X,l as ia,o as oa,p as y}from"./core-BfWJ7zKT.js";import{e$ as H,PY as Ge,bs as wt,KM as la,bq as Bt,bJ as pe,PZ as At,z7 as Ct,Am as $e,zG as sa,bn as Ee,P_ as ra,P$ as ca,c7 as da,Q0 as ua,kL as xt,Q1 as Et,Q2 as Dt,AX as Me,zm as Ae,Q3 as pa,yX as tt,Q4 as ma,F0 as ba,y$ as ha,z5 as jt,Q5 as fe,Q6 as Ne,An as Oe,Q7 as ga,Q8 as Sa,Aq as ze,Q9 as ya,AD as fa,Qa as Tt,A7 as at,Ac as Ia,Qb as va,Qc as ue,Qd as Pt,Qe as Ft,Qf as Rt,gy as ka,zr as Le,cD as Vt,Qg as wa,fD as Ba,Qh as Aa,Qi as Ca,fI as $t,fG as Lt,Qj as Qe,Qk as xa,Ql as Ea,NG as Ze,Qm as Da,NH as oe,NI as He,Qn as ja,Qo as Ta,Qp as Pa,Ae as nt,Ab as Fa,Qq as Ra,Qr as Va,Qs as $a,zZ as La,Qt as _a,Qu as Ua,Qv as Ga,cr as _t,cT as Ut,kW as Ma,bP as Na,bo as Gt,bQ as Mt,yd as Oa,Qw as za,EP as Qa,EV as Za,uz as Ha,Ao as Wa,B2 as qa,l7 as ye,Qx as Ja,Qy as Nt,lB as Ka,l1 as Ot,lm as zt,ll as it,bE as be,bO as Xa,Qz as Ya,QA as Ie,jG as en,QB as ot,QC as tn,jK as an,k3 as nn,Bg as on,QD as ln,lu as sn,B6 as rn,QE as lt,Ba as cn,Bf as dn,Bc as un,B4 as pn,QF as Qt,zg as mn,QG as bn,QH as hn,gn,gm as Sn,gl as yn,la as fn,ls as st,lD as In,r$ as vn,lj as kn,B8 as wn,jQ as Bn,lI as An,QI as Cn,jI as xn,rS as En,QJ as Dn,A3 as jn,bK as Tn,bt as Pn,Mu as Fn,cW as Rn,cV as Vn,cC as $n,cJ as Ln}from"./zeni-epic-state-kow6PLud.js";import{E as me,z as $,D as ve,a0 as We,w as le,i as S,aS as Ce,B as re,o as x,A as De,f as D,bh as _n,s as Z,a4 as qe,v as E,J as ke,bi as rt,bj as ct,bk as Un,al as Gn,H as Mn,aM as Nn,F as Zt,a as je,I as Je,bl as On,au as Ht,bm as zn,X as Qn,h as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Jn,br as Kn,bs as Xn,bt as Yn,bu as ei,bv as ti,x as ai,bw as ni,be as ii,bx as oi,by as li,d as si}from"./index-D9NLhglj.js";import{n as _,S as ri}from"./mui-ts7KHm6i.js";import{A as dt}from"./AddressScreen-Gd3rLr7o.js";import{g as ie,a as Te,i as qt,V as Ke,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-JSSitzK8.js";import{a as f}from"./sentry-C6T1HHHS.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-D8n0-rNW.js";import{u as Jt}from"./useInitialThreadRequest-BlvltKSe.js";import xe from"./NotFoundScreen-DsR8VsQv.js";import{D as pi}from"./DrawerScreen-DNRTfvlv.js";import{M as Kt}from"./MobileAppDrawer-DHMYVxFj.js";import{F as Xt}from"./FeaturePreviewScreen-C_G_t4I9.js";import{S as Pe}from"./SetupPagesScreen-BaE6w_Lx.js";import{B as mi}from"./BillPayApprovalRoutes-CbPB6Cz2.js";import{FallBackRoute as bi}from"./ScreenRoutes-CBj7JgTH.js";import"./recharts-DNnhB5R_.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./utils-xWcqC4Wl.js";import"./analyticsHelper-Ib8eUq2U.js";import"./routePaths-DxGoZobb.js";import"./BusinessVerificationPageScreen-W5WuCBLZ.js";import"./ReimbursementApprovalRuleDetailScreen-DcC6kKsi.js";import"./getLocaleForTenant-0y5Rz6LJ.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]="bf0a92c8-b4c7-4145-a809-ba88596f9369",e._sentryDebugIdIdentifier="sentry-dbid-bf0a92c8-b4c7-4145-a809-ba88596f9369")}catch{}})();const hi=X((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(_n);function gi(){const e=J(),t=se(),l=K(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ve(),o=v((z=>H(z))),s=v((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,I]=f.useState(!1),[j,A]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:W}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||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,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),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(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((function(e,t){const 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:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({appContent:e}){const t=se(),l=J(),{billId:n}=ae(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(Ce.zeniAssistConfig),j=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),A=v((R=>H(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[W,N]=f.useState(),w=v((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=v((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(W,m,n))},onCancelClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ga({file:W,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:Ii(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{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:`${_e.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-Dge8uQhE.js";import{h as J,u as se,g as K,i as ae,j as v,N as te,n as X,l as ia,o as oa,p as y}from"./core-DslHP-Nt.js";import{e$ as H,PY as Ge,bs as wt,KM as la,bq as Bt,bJ as pe,PZ as At,z7 as Ct,Am as $e,zG as sa,bn as Ee,P_ as ra,P$ as ca,c7 as da,Q0 as ua,kL as xt,Q1 as Et,Q2 as Dt,AX as Me,zm as Ae,Q3 as pa,yX as tt,Q4 as ma,F0 as ba,y$ as ha,z5 as jt,Q5 as fe,Q6 as Ne,An as Oe,Q7 as ga,Q8 as Sa,Aq as ze,Q9 as ya,AD as fa,Qa as Tt,A7 as at,Ac as Ia,Qb as va,Qc as ue,Qd as Pt,Qe as Ft,Qf as Rt,gy as ka,zr as Le,cD as Vt,Qg as wa,fD as Ba,Qh as Aa,Qi as Ca,fI as $t,fG as Lt,Qj as Qe,Qk as xa,Ql as Ea,NG as Ze,Qm as Da,NH as oe,NI as He,Qn as ja,Qo as Ta,Qp as Pa,Ae as nt,Ab as Fa,Qq as Ra,Qr as Va,Qs as $a,zZ as La,Qt as _a,Qu as Ua,Qv as Ga,cr as _t,cT as Ut,kW as Ma,bP as Na,bo as Gt,bQ as Mt,yd as Oa,Qw as za,EP as Qa,EV as Za,uz as Ha,Ao as Wa,B2 as qa,l7 as ye,Qx as Ja,Qy as Nt,lB as Ka,l1 as Ot,lm as zt,ll as it,bE as be,bO as Xa,Qz as Ya,QA as Ie,jG as en,QB as ot,QC as tn,jK as an,k3 as nn,Bg as on,QD as ln,lu as sn,B6 as rn,QE as lt,Ba as cn,Bf as dn,Bc as un,B4 as pn,QF as Qt,zg as mn,QG as bn,QH as hn,gn,gm as Sn,gl as yn,la as fn,ls as st,lD as In,r$ as vn,lj as kn,B8 as wn,jQ as Bn,lI as An,QI as Cn,jI as xn,rS as En,QJ as Dn,A3 as jn,bK as Tn,bt as Pn,Mu as Fn,cW as Rn,cV as Vn,cC as $n,cJ as Ln}from"./zeni-epic-state-COMt8QIe.js";import{E as me,z as $,D as ve,a0 as We,w as le,i as S,aS as Ce,B as re,o as x,A as De,f as D,bh as _n,s as Z,a4 as qe,v as E,J as ke,bi as rt,bj as ct,bk as Un,al as Gn,H as Mn,aM as Nn,F as Zt,a as je,I as Je,bl as On,au as Ht,bm as zn,X as Qn,h as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Jn,br as Kn,bs as Xn,bt as Yn,bu as ei,bv as ti,x as ai,bw as ni,be as ii,bx as oi,by as li,d as si}from"./index-Cny4F3UP.js";import{n as _,S as ri}from"./mui-DskYaYyd.js";import{A as dt}from"./AddressScreen-CiaeHzMQ.js";import{g as ie,a as Te,i as qt,V as Ke,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-ClCEmr89.js";import{a as f}from"./sentry-ConJlCAk.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Dbk2QnY2.js";import{u as Jt}from"./useInitialThreadRequest-BP8PKnuv.js";import xe from"./NotFoundScreen-BEj9MjFe.js";import{D as pi}from"./DrawerScreen-DqZSrPso.js";import{M as Kt}from"./MobileAppDrawer-CRLaoS9b.js";import{F as Xt}from"./FeaturePreviewScreen-RPVxMb0u.js";import{S as Pe}from"./SetupPagesScreen-DifY7gaU.js";import{B as mi}from"./BillPayApprovalRoutes-DLylp8D7.js";import{FallBackRoute as bi}from"./ScreenRoutes-DBr3qw38.js";import"./recharts-BV1Rao9g.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.js";import"./analyticsHelper-DyhEHOhh.js";import"./routePaths-BRZr86UY.js";import"./BusinessVerificationPageScreen-JbVAjzAy.js";import"./ReimbursementApprovalRuleDetailScreen-DG8xpE7m.js";import"./getLocaleForTenant-CkKXTx9H.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]="bf0a92c8-b4c7-4145-a809-ba88596f9369",e._sentryDebugIdIdentifier="sentry-dbid-bf0a92c8-b4c7-4145-a809-ba88596f9369")}catch{}})();const hi=X((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(_n);function gi(){const e=J(),t=se(),l=K(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ve(),o=v((z=>H(z))),s=v((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,I]=f.useState(!1),[j,A]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:W}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||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,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),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(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((function(e,t){const 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:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({appContent:e}){const t=se(),l=J(),{billId:n}=ae(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(Ce.zeniAssistConfig),j=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),A=v((R=>H(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[W,N]=f.useState(),w=v((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=v((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(W,m,n))},onCancelClick:()=>{if(k(!1),!W)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ga({file:W,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:Ii(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{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:`${_e.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 mt=_.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-Dge8uQhE.js";import{a as V}from"./sentry-ConJlCAk.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-DslHP-Nt.js";import{D as ce,w as ue,aS as de,z,A as pe,f as B,ag as x,h as E,bH as le,au as me,v as P,av as R}from"./index-Cny4F3UP.js";import{Qu as fe,e$ as G,t_ as ye,KP as Se,zZ as ge,Do as Ie,G9 as he,GO as Te,HO as be,QR as De,QS as Oe,QT as Ce,QU as ke,QV as Ve,Ng as we,PW as Ae,Nv as Ne,Es as _e,Nw as ve,Ew as Fe,lr as xe,gn as Ee,gm as ze,gl as Be,r$ as Pe,rS as Re,rP as Ue,lj as je,u7 as Le,u5 as U,bE as j,uj as L,cB as Me}from"./zeni-epic-state-COMt8QIe.js";import{n as Ge}from"./mui-DskYaYyd.js";import{d as M}from"./routePaths-BRZr86UY.js";import{M as Qe}from"./MobileAppDrawer-CRLaoS9b.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]="3718da47-8feb-4225-9861-4a01ac92e6d8",t._sentryDebugIdIdentifier="sentry-dbid-3718da47-8feb-4225-9861-4a01ac92e6d8")}catch{}})();const $e=Ge.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-
|
|
1
|
+
import{j as g}from"./liveblocks-Dge8uQhE.js";import{a as l}from"./sentry-ConJlCAk.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-DslHP-Nt.js";import{W as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,A as we,f as $,dj as H,dt as Ee,a as Ae,h as Te,a9 as ke,dm as xe,dn as Ue,a4 as _e,dr as Oe,b6 as ve,ds as Qe}from"./index-Cny4F3UP.js";import{gr as Fe,e_ as G,e$ as $e,fu as De,iT as Le,iP as Ve,f0 as B,gb as je,g3 as Re,g7 as N,gc as qe,ge as Me,gf as He,gg as Be,gh as Ne}from"./zeni-epic-state-COMt8QIe.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-DskYaYyd.js";import"./recharts-BV1Rao9g.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.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]="1df07971-366d-4056-91f9-756ad9301ecb",e._sentryDebugIdIdentifier="sentry-dbid-1df07971-366d-4056-91f9-756ad9301ecb")}catch{}})();const Y="chat-response-generated",Z="cards/ask",J="card_policy_hero";function D(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(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:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${Z}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:k,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(ke(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=Ae.getLocalizedStrings(),T=X.pageTitle,Ze=ee.pageTitle,Je=X.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(Fe())}),[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=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ze:T,subtitle:I?Ke:Je})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,A=l.useRef(null);l.useEffect((()=>{if(S&&A.current!=null){const{question:r,shouldSubmit:w}=A.current;A.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=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&&c((function(r,w){return`/${r}/${Z}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Te.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:k,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,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}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>{c(I?K(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(A.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Xe,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:T,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Xe=L(Ge)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-DJbBe3tc.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-BfWJ7zKT.js";import{fc as Pt,Sq as os,fo as wt,bt as Fe,Sr as is,Ss as ds,f1 as fn,St as Pn,fa as wn,Su as Tn,Sv as vn,Sw as Fn,Sx as xn,fb as Bn,fn as Ln,Sy as Rn,Sz as ls,fh as us,fg as ms,SA as Cs,Ct as On,fq as ia,SB as ps,SC as hs,f3 as fs,f2 as gs,fD as Ze,fj as Un,fi as jn,SD as bs,fk as Ss,B_ as ys,BZ as Is,C1 as ks,C3 as Es,fw as As,e_ as Mn,SE as Ds,SF as _s,fB as Nn,SG as Ps,fC as yt,C9 as ws,C6 as Ts,e$ as ge,SH as qa,fG as xe,fH as Be,fI as Le,gF as da,cy as la,SI as ua,SJ as Tt,vf as $a,kT as za,SK as Za,CJ as ka,fr as Qe,CL as vt,kJ as Vn,SL as ma,Cx as _a,SM as vs,SN as Fs,CA as Qa,SO as xs,QO as Ja,fm as Hn,CG as ba,i2 as Bs,SP as Gn,fd as Ca,bo as Ls,SQ as Rs,gn as Xa,gm as et,Dd as Os,gl as at,Qu as Us,SR as $n,cr as zn,cT as js,QN as wa,DO as Zn,SS as gn,Do as Pa,ST as Kn,DP as Ms,Ra as Ns,DQ as Vs,EV as Hs,uz as Gs,EP as $s,SU as zs,CK as ca,SV as Zs,SW as Ks,SX as Ws,SY as Ys,SZ as qs,S_ as Ft,S$ as Qs,C_ as Wn,CT as Js,T0 as Xs,gH as ec,D7 as Yn,Db as qn,gG as ac,T1 as tc,DA as Qn,T2 as nc,T3 as rc,T4 as sc,D9 as Jn,CW as Xn,CD as er,D3 as ar,D1 as tr,D5 as cc,T5 as nr,T6 as oc,fy as ic,fz as dc,fA as lc,T7 as tt,fs as rr,cV as xt,T8 as uc,T9 as mc,Ta as Cc,Tb as pc,Dj as It,DH as hc,DD as fc,Df as gc,DF as bc,Dv as Sc,Dx as yc,Tc as sr,DN as Ga,KM as Ic,Td as kc,Te as Ec,Tf as Ac,Tg as cr,Th as Dc,E8 as _c,Dn as or,Di as Ne,Dm as Pc,Ti as wc,Tj as Tc,Cu as vc,Tk as ir,fl as dr,Tl as Fc,Cw as xc,Cv as bn,Tm as Bc,Tn as Lc,To as Rc,Nh as Oc,Tp as Bt,Tq as Uc,yg as lr,lr as jc,hU as Mc,Ed as Nc,Tr as ur,f7 as Vc,f8 as Hc,Ts as Gc,dm as $c,fp as zc,E3 as Zc,DZ as qe,bs as Kc,bJ as Wc,cD as Yc,bK as qc,Mu as Qc}from"./zeni-epic-state-kow6PLud.js";import{D as Re,cp as mr,s as we,cq as Cr,cr as pr,cs as Jc,a as ea,a0 as Lt,ct as Xc,cu as eo,W as hr,c as fr,Z as gr,v as ye,w as ue,i as K,ar as ya,cv as br,cw as ao,cx as to,z as te,B as Ta,ce as nt,cy as no,cz as ro,cA as so,J as va,aS as Ke,br as Rt,cB as co,F as Fa,m as rt,E as Ot,f as X,a9 as st,cC as oo,bE as Sa,cD as kt,cE as io,A as Ut,cF as lo,au as Sr,a4 as Et,cG as uo,X as yr,e as Ir,h as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as bo,o as Ka,cO as So,cP as yo,cQ as ht,x as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,d as Po}from"./index-D9NLhglj.js";import{n as He,D as Er,S as wo}from"./mui-ts7KHm6i.js";import{a as r}from"./sentry-C6T1HHHS.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-D8n0-rNW.js";import{M as Ie}from"./MobileAppDrawer-DHMYVxFj.js";import{d as jt}from"./recharts-DNnhB5R_.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as Sn}from"./SetupPagesScreen-BaE6w_Lx.js";import{u as wr}from"./useInitialThreadRequest-BlvltKSe.js";import ct from"./NotFoundScreen-DsR8VsQv.js";import{u as Vt}from"./useChargeCardPusherEvents-D846Tvtv.js";import{n as yn}from"./utils-xWcqC4Wl.js";import{t as Bo}from"./AddressScreen-Gd3rLr7o.js";import"./analytics-BP5D4JyB.js";import"./plaid-Cv0mPYlm.js";import"./dnd-tQgCG5z3.js";import"./stripe-cKAAJElX.js";import"./lottie-BaCgeYyk.js";import"./lexical-Bg8ldM3i.js";import"./pdf-C9HGpLCu.js";import"./analyticsHelper-Ib8eUq2U.js";import"./routePaths-DxGoZobb.js";import"./BusinessVerificationPageScreen-W5WuCBLZ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be3eafe1-e69a-4472-9618-07b5f4dc171f",e._sentryDebugIdIdentifier="sentry-dbid-be3eafe1-e69a-4472-9618-07b5f4dc171f")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,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:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,b]=r.useState(!1),P=r.useCallback((E=>{b(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),S=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),Y=E.poppedPathname??_;e(Y,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const Y=Cr(E);a(fs({templates:[Y]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),W=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:S,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:W})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[b,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>bs(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?Ss(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const S=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:S,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,S,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),W=r.useRef(D);r.useEffect((()=>{const o=W.current;W.current=D,D==="Completed"&&o!=="Completed"&&(s(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:b,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:b,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=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:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Zo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,b]=r.useState(!1),P=r.useCallback((_=>{b(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const S=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=S.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:W}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),Y=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=Y&&E&&W!=null&&!J,re=r.useCallback((oe=>{if(W==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${W}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,W]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(br,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:S,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Ko(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:b}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=b(K.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=b(K.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:S}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",W=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Za()),W&&t(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,W]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),S.fetchState!=="Completed"&&S.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,S.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),Y=Ba(u,l,g,A,S),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:Y,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:S,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Wo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Yo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(K.isCardsCommentingEnabled),[b,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Yo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{b||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[b,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[b,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ke.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),S=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:S}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{b===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,b,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(ba(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),b=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:b,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,b=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{b!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{b!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{b!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
1
|
+
import{j as c}from"./liveblocks-Dge8uQhE.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-DslHP-Nt.js";import{fc as Pt,Sq as os,fo as wt,bt as Fe,Sr as is,Ss as ds,f1 as fn,St as Pn,fa as wn,Su as Tn,Sv as vn,Sw as Fn,Sx as xn,fb as Bn,fn as Ln,Sy as Rn,Sz as ls,fh as us,fg as ms,SA as Cs,Ct as On,fq as ia,SB as ps,SC as hs,f3 as fs,f2 as gs,fD as Ze,fj as Un,fi as jn,SD as bs,fk as Ss,B_ as ys,BZ as Is,C1 as ks,C3 as Es,fw as As,e_ as Mn,SE as Ds,SF as _s,fB as Nn,SG as Ps,fC as yt,C9 as ws,C6 as Ts,e$ as ge,SH as qa,fG as xe,fH as Be,fI as Le,gF as da,cy as la,SI as ua,SJ as Tt,vf as $a,kT as za,SK as Za,CJ as ka,fr as Qe,CL as vt,kJ as Vn,SL as ma,Cx as _a,SM as vs,SN as Fs,CA as Qa,SO as xs,QO as Ja,fm as Hn,CG as ba,i2 as Bs,SP as Gn,fd as Ca,bo as Ls,SQ as Rs,gn as Xa,gm as et,Dd as Os,gl as at,Qu as Us,SR as $n,cr as zn,cT as js,QN as wa,DO as Zn,SS as gn,Do as Pa,ST as Kn,DP as Ms,Ra as Ns,DQ as Vs,EV as Hs,uz as Gs,EP as $s,SU as zs,CK as ca,SV as Zs,SW as Ks,SX as Ws,SY as Ys,SZ as qs,S_ as Ft,S$ as Qs,C_ as Wn,CT as Js,T0 as Xs,gH as ec,D7 as Yn,Db as qn,gG as ac,T1 as tc,DA as Qn,T2 as nc,T3 as rc,T4 as sc,D9 as Jn,CW as Xn,CD as er,D3 as ar,D1 as tr,D5 as cc,T5 as nr,T6 as oc,fy as ic,fz as dc,fA as lc,T7 as tt,fs as rr,cV as xt,T8 as uc,T9 as mc,Ta as Cc,Tb as pc,Dj as It,DH as hc,DD as fc,Df as gc,DF as bc,Dv as Sc,Dx as yc,Tc as sr,DN as Ga,KM as Ic,Td as kc,Te as Ec,Tf as Ac,Tg as cr,Th as Dc,E8 as _c,Dn as or,Di as Ne,Dm as Pc,Ti as wc,Tj as Tc,Cu as vc,Tk as ir,fl as dr,Tl as Fc,Cw as xc,Cv as bn,Tm as Bc,Tn as Lc,To as Rc,Nh as Oc,Tp as Bt,Tq as Uc,yg as lr,lr as jc,hU as Mc,Ed as Nc,Tr as ur,f7 as Vc,f8 as Hc,Ts as Gc,dm as $c,fp as zc,E3 as Zc,DZ as qe,bs as Kc,bJ as Wc,cD as Yc,bK as qc,Mu as Qc}from"./zeni-epic-state-COMt8QIe.js";import{D as Re,cp as mr,s as we,cq as Cr,cr as pr,cs as Jc,a as ea,a0 as Lt,ct as Xc,cu as eo,W as hr,c as fr,Z as gr,v as ye,w as ue,i as K,ar as ya,cv as br,cw as ao,cx as to,z as te,B as Ta,ce as nt,cy as no,cz as ro,cA as so,J as va,aS as Ke,br as Rt,cB as co,F as Fa,m as rt,E as Ot,f as X,a9 as st,cC as oo,bE as Sa,cD as kt,cE as io,A as Ut,cF as lo,au as Sr,a4 as Et,cG as uo,X as yr,e as Ir,h as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as bo,o as Ka,cO as So,cP as yo,cQ as ht,x as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,d as Po}from"./index-Cny4F3UP.js";import{n as He,D as Er,S as wo}from"./mui-DskYaYyd.js";import{a as r}from"./sentry-ConJlCAk.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Dbk2QnY2.js";import{M as Ie}from"./MobileAppDrawer-CRLaoS9b.js";import{d as jt}from"./recharts-BV1Rao9g.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as Sn}from"./SetupPagesScreen-DifY7gaU.js";import{u as wr}from"./useInitialThreadRequest-BP8PKnuv.js";import ct from"./NotFoundScreen-BEj9MjFe.js";import{u as Vt}from"./useChargeCardPusherEvents-7z8f-VNH.js";import{n as yn}from"./utils-KyL5SnF3.js";import{t as Bo}from"./AddressScreen-CiaeHzMQ.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./analyticsHelper-DyhEHOhh.js";import"./routePaths-BRZr86UY.js";import"./BusinessVerificationPageScreen-JbVAjzAy.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="be3eafe1-e69a-4472-9618-07b5f4dc171f",e._sentryDebugIdIdentifier="sentry-dbid-be3eafe1-e69a-4472-9618-07b5f4dc171f")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,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:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,b]=r.useState(!1),P=r.useCallback((E=>{b(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),S=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),Y=E.poppedPathname??_;e(Y,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const Y=Cr(E);a(fs({templates:[Y]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),W=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:S,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:W})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[b,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>bs(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?Ss(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const S=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:S,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,S,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),W=r.useRef(D);r.useEffect((()=>{const o=W.current;W.current=D,D==="Completed"&&o!=="Completed"&&(s(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:b,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:b,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=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:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Zo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,b]=r.useState(!1),P=r.useCallback((_=>{b(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const S=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=S.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:W}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),Y=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=Y&&E&&W!=null&&!J,re=r.useCallback((oe=>{if(W==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${W}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,W]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(br,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:S,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Ko(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:b}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=b(K.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=b(K.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:S}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",W=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Za()),W&&t(Ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,W]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),S.fetchState!=="Completed"&&S.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,S.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),Y=Ba(u,l,g,A,S),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:Y,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:S,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Wo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Yo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(K.isCardsCommentingEnabled),[b,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Yo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{b||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[b,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[b,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ke.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),S=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:S}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{b===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,b,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(ba(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),b=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:b,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,b=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{b!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{b!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{b!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Xo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-Dge8uQhE.js";import{a as g}from"./sentry-ConJlCAk.js";import{h as w,u as k,g as x,i as T,j as O,n as E}from"./core-DslHP-Nt.js";import{z as N,be as P,A as F,f as V,h as j,ag as C,bf as A,au as L,av as U,v as B}from"./index-Cny4F3UP.js";import{e$ as D,gp as _,t_ as M,gk as R,c7 as z,PW as G,bn as $,r$ as Y,rP as H,lj as W,mU as S,PX as X,bE as Z,cB as h,n2 as q,n5 as J}from"./zeni-epic-state-COMt8QIe.js";import"./mui-DskYaYyd.js";import{d as K}from"./routePaths-BRZr86UY.js";import{M as Q}from"./MobileAppDrawer-CRLaoS9b.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="42f024cd-ac51-472e-9331-43e792ed6c08",t._sentryDebugIdIdentifier="sentry-dbid-42f024cd-ac51-472e-9331-43e792ed6c08")}catch{}})();const ee=E((function(t){const a=R(t),i=N.getSignedInUser(),p=D(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:$(i)}}),(function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...n,website:u!=""&&u!=null?h(u):void 0,meetingLink:y!=""&&y!=null?h(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(X(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(W({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(Y(e,n.split(".")[0]))}}}))(A);function de(){const t=w(),a=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(l(!0),a(_(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(M())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(Q,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-
|
|
1
|
+
import{j as g}from"./liveblocks-Dge8uQhE.js";import{a}from"./sentry-ConJlCAk.js";import{u as D,g as v,j as m,N as w}from"./core-DslHP-Nt.js";import{Mq as A,e$ as O,g5 as _,on as j,gB as h,g4 as U,fE as L,Mx as $}from"./zeni-epic-state-COMt8QIe.js";import{u as F,z as p,L as C,a as k,o as H}from"./index-Cny4F3UP.js";import{n as z}from"./mui-DskYaYyd.js";import{t as R}from"./getLocaleForTenant-CkKXTx9H.js";import{g as M,Q as P}from"./QBOConnectionScreen--ycxEhUp.js";import"./recharts-BV1Rao9g.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.js";import"./empty-pFhUOX6X.js";import"./pdf-lib-CuyyFcf5.js";import"./index-H3qfOHz1.js";import"./url-FGF171Cm.js";import"./index-B3Qv-ngJ.js";import"./decodeURIComponentSafe-uhKYYVbR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="5140ed66-599a-4d8b-8ba4-d190bcad8302",t._sentryDebugIdIdentifier="sentry-dbid-5140ed66-599a-4d8b-8ba4-d190bcad8302")}catch{}})();const q=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-Dge8uQhE.js";import{z as n}from"./index-Cny4F3UP.js";import{g as d}from"./QBOConnectionScreen--ycxEhUp.js";import"./sentry-ConJlCAk.js";import{g as p,N as s}from"./core-DslHP-Nt.js";import"./zeni-epic-state-COMt8QIe.js";import"./recharts-BV1Rao9g.js";import"./mui-DskYaYyd.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.js";import"./empty-pFhUOX6X.js";import"./pdf-lib-CuyyFcf5.js";import"./index-H3qfOHz1.js";import"./url-FGF171Cm.js";import"./index-B3Qv-ngJ.js";import"./decodeURIComponentSafe-uhKYYVbR.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]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
package/dist/assets/{CustomerOnboardingRoutes-B98Qqcry.js → CustomerOnboardingRoutes-DyfzWNjv.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-Dge8uQhE.js";import{t as ht,A as Ve}from"./AddressScreen-CiaeHzMQ.js";import St from"./NotFoundScreen-BEj9MjFe.js";import{a as d}from"./sentry-ConJlCAk.js";import{h as Ce,g as Ie,u as ae,i as ke,j as k,N as B,l as bt,n as tt,o as Ct,p as H}from"./core-DslHP-Nt.js";import{e$ as X,fI as _e,fG as ve,bs as It,fW as kt,bS as _t,ol as vt,tK as Ot,tN as Tt,Np as wt,Nq as xt,kn as he,kq as nt,MW as Et,bZ as At,c7 as ue,uc as Oe,tZ as Pt,Nr as de,ud as at,KP as Dt,lr as ot,Ns as jt,Nt as Ft,rI as Bt,hz as Nt,MO as me,hw as Vt,MP as Ut,yp as Rt,rM as Lt,ho as $t,hr as Ue,Nu as st,Nv as Gt,Es as Mt,Nw as Qt,Ew as zt,tQ as Kt,Nx as qt,Ny as Ht,kl as Zt,ko as Wt,up as Jt,t$ as it,ub as Xt,bE as Re,cB as Yt,uo as Le,r$ as en,rP as tn,lj as nn,gn as an,gm as on,gl as sn,Nz as rn,tT as cn,uq as dn,ut as un,uw as ln,uC as pn,c_ as mn}from"./zeni-epic-state-COMt8QIe.js";import{z as L,w as Te,i as Z,Q as gn,v as z,A as oe,f as N,aq as fn,J as yn,x as rt,D as ct,ar as $e,m as Se,h as be,as as hn,o as Ge,at as Me,au as Sn,av as Qe,aw as bn,ax as Cn}from"./index-Cny4F3UP.js";import{n as we}from"./mui-DskYaYyd.js";import{g as In,h as kn,q as se}from"./QBOConnectionScreen--ycxEhUp.js";import{u as _n,a as vn}from"./useEmailConnectResultRefresh-Dd3ZNdiP.js";import{u as On}from"./useChargeCardPusherEvents-7z8f-VNH.js";import"./recharts-BV1Rao9g.js";import"./analytics-Det0UZFe.js";import"./plaid-ajCcP-UI.js";import"./dnd-CQxwFT7m.js";import"./stripe-cKAAJElX.js";import"./lottie-JtX4it7w.js";import"./lexical-DYyincEg.js";import"./pdf-8n9gC55d.js";import"./utils-KyL5SnF3.js";import"./empty-pFhUOX6X.js";import"./pdf-lib-CuyyFcf5.js";import"./index-H3qfOHz1.js";import"./url-FGF171Cm.js";import"./index-B3Qv-ngJ.js";import"./decodeURIComponentSafe-uhKYYVbR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new e.Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="4985027c-59fe-485d-9ce1-57b0459464ce",e._sentryDebugIdIdentifier="sentry-dbid-4985027c-59fe-485d-9ce1-57b0459464ce")}catch{}})();const ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Tn=()=>{const e=Ce(),u=Ie(),i=ae(),[o,l]=d.useState(!1),[c,y]=d.useState(!1),{tenantEmailDomain:S}=ke(),t=L.getSignedInUser(),{useFeatureGate:n}=Te(),{isFeatureEnabled:s}=n(Z.isApAgingFeatureEnabled),{isFeatureEnabled:b}=n(Z.isArAgingFeatureEnabled),{isFeatureEnabled:_}=n(Z.isReferralFeatureEnabled),{isFeatureEnabled:I}=n(Z.isExpenseAutomationEnabledV2),{isFeatureEnabled:w}=n(Z.isDebitCardFeatureEnabled),r=gn(),g=k((h=>X(h))),p=k((h=>h.onboardingCustomerViewState.fetchState)),v=g.excludedResources,T=g.companyId??L.getSignedInUserTenant(S)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const x=_e(w,g),D=ve(g),m=[],$=v?.resources?.find((h=>h.resource==="/reports/top_expenses"))==null,j=v?.resources?.find((h=>h.resource==="/reports/task_card"))==null,G=g?.userRole!=null&&It(g?.userRole),M=v?.resources?.find((h=>h.resource==="/bills"))==null&&!G,A=v?.resources?.find((h=>h.resource==="/reimbursements"))==null;$===!1&&m.push("top_expenses"),j===!1&&m.push("task_card"),M===!1&&m.push("bill_pay_card","bill_pay_promo_card"),A===!1&&m.push("reimbursement_card","reimbursement_promo_card"),m.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&m.push("rewards_card");const F=k((h=>{const O=[];s===!1&&O.push("accounts_payable_aging"),b===!1&&O.push("accounts_receivable_aging"),O.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&O.push("rewards_card"),r===!1&&O.push("expense_automation_card");const W=kt(h,O,t,I,r);return _t(W.reportsInOrder.map((P=>({fetchState:P.fetchState,error:P.error})))).fetchState}));d.useEffect((()=>{p!=="Completed"||o||x||D||(l(!0),i(vt(t.userId,T,g.tenantId,!0,!1,m)))}),[o,p,x,D,t,g.tenantId,i]);const K=d.useRef(!1),Q=d.useCallback((()=>{const h={pathnameStackToGoBack:z(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};e(x?"../../checking":D?"../../cards":"../../dashboard",{state:h})}),[e,u,x,D]),V=d.useCallback((()=>{K.current||(K.current=!0,Q())}),[Q]);if(d.useEffect((()=>{const h=setTimeout((()=>y(!0)),3e3);return()=>clearTimeout(h)}),[]),d.useEffect((()=>{const h=setTimeout(V,6e3);return()=>clearTimeout(h)}),[V]),d.useEffect((()=>{x||D||!c||F!=="Completed"&&F!=="Error"||V()}),[c,F,x,D,V]),p!=="Completed")return a.jsx(B,{to:"../"});const U=g.company?.companyOnboardingInfo?.onboardingInfo,q={timeSinceQuoteSign:U?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:U?.onboardingToQuoteSignMinutes??0,isKybDone:ze(U?.businessVerified?.status),isKycDone:ze(U?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:U?.accountingConnectionCreationMode??""};return a.jsxs(a.Fragment,{children:[a.jsx(oe,{analytics:N,onLoad:h=>h.trackOnboardingDashboardActivation(q)}),a.jsx(fn,{show:!0,onComplete:V})]})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ke=(e,u)=>{const i=new Map(e.map((o=>[o.key,o])));return u.map((o=>{return l=i.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l}))},qe=(e,u)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return u.every((o=>i.get(o)?.status==="ready"))},He=we.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${e=>e.theme.colors.grey4};
|