@zeniai/web-app-ui 5.1.59-dev → 5.1.60-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-BfIfKyrk.js +1 -0
- package/dist/assets/{AddressScreen-fWJCm4zs.js → AddressScreen-B3VxKVsm.js} +1 -1
- package/dist/assets/{AiCfoScreen-RA-P0Ele.js → AiCfoScreen-CxUZrUe6.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-Bv9HP5Ed.js → BillPayApprovalRoutes-uGTk7D6Z.js} +1 -1
- package/dist/assets/{BillPayRoutes-DM71-NMQ.js → BillPayRoutes-B4MYuRle.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-9FWcKpyL.js → BusinessVerificationPageScreen-BoQL4-Oc.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-CJUAzHrT.js → CardsAiCfoScreen-DOjaOTIW.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-BKCoQWOu.js → ChargeCardRoutes-BwUyHx0V.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-Z-knYrxv.js → CompanyPassportScreen-D9FdVjLZ.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-Cev1gkS_.js → ConnectionAuthScreen-D2lagtAc.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-CkvBriLt.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-BTm1Abhx.js → CustomerOnboardingRoutes-DWKwUU9B.js} +1 -1
- package/dist/assets/{DashboardRoutes-wMhkTYla.js → DashboardRoutes-DdQJBKft.js} +1 -1
- package/dist/assets/{DefaultTenantHome-ClYhyRXO.js → DefaultTenantHome-Bq1e6Two.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-Cl_7XBwW.js → DomesticWireDetailScreen-CUtA9hl5.js} +1 -1
- package/dist/assets/{DrawerScreen-DqnvN1tq.js → DrawerScreen-DH8ydvUJ.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-Dy54l33K.js → EntityDetailRoutes-BDlOs1iD.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-BAwf_5XR.js → ExpenseAutomationRoutes-JFMM2o6Q.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-DCDhII3I.js → FeaturePreviewScreen-DttBoo3w.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-rLAbttjN.js → HubSpotOAuthCallbackScreen-CTIys_Ac.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-B-PPv0PR.js → MagicLinkRoutes-Bbrp9yb4.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-DlEpGGzi.js → MagicLinkSignInScreen-wsLKenOn.js} +1 -1
- package/dist/assets/{MobileAppDrawer-CDYOk1Tu.js → MobileAppDrawer-DOdKZ6eR.js} +1 -1
- package/dist/assets/NotFoundScreen-DMlQVohM.js +1 -0
- package/dist/assets/{NotificationRoutes-ye5VX3PS.js → NotificationRoutes-C3NJQaBA.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-DF7q2wgy.js → OAuthConsentScreen-BIGa0ruC.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-DZnjcm2C.js → PandLWithForecastRoutes-Ce2SPyhW.js} +1 -1
- package/dist/assets/{PeopleRoutes-Cshc61GL.js → PeopleRoutes-OwQwZ1NQ.js} +1 -1
- package/dist/assets/{PerformanceRoutes-UE1AlGRc.js → PerformanceRoutes-CoB1O0dR.js} +1 -1
- package/dist/assets/{Preview-COCp1vn_.js → Preview-dDFLUSBQ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-ClD_YrtC.js → QBOConnectionScreen-BQZ2NFG-.js} +1 -1
- package/dist/assets/{ReferralListScreen-BQiDRb4Q.js → ReferralListScreen-DoHN-iLK.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-B02Z7OIU.js → ReimbursementApprovalRoutes-BjB8dB9T.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CrNxSCRL.js → ReimbursementApprovalRuleDetailScreen-DJf65wBd.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BDTp98VH.js → ReimbursementRoutes--7oGilFy.js} +1 -1
- package/dist/assets/{ReportsRoutes-utyUVcdp.js → ReportsRoutes-COqA8f7e.js} +1 -1
- package/dist/assets/{RewardsRoutes-B0tydv2M.js → RewardsRoutes-DbUUR-tG.js} +1 -1
- package/dist/assets/{ScreenRoutes-C_5gtCcR.js → ScreenRoutes-Cx9i1dRt.js} +2 -2
- package/dist/assets/{SettingsRoutes-CItpcp8o.js → SettingsRoutes-XpIT8yrn.js} +1 -1
- package/dist/assets/{SetupPagesScreen-Cb_h1N2q.js → SetupPagesScreen-C883vxB-.js} +1 -1
- package/dist/assets/{SignInScreen-DayaVPul.js → SignInScreen-BlOBFJPA.js} +1 -1
- package/dist/assets/{SignOutScreen-DfnourF6.js → SignOutScreen-BbTKwHIb.js} +1 -1
- package/dist/assets/{TaskListScreen-DVU-iHmP.js → TaskListScreen-A7aV-yiF.js} +1 -1
- package/dist/assets/{TaskRoutes-DECOOPQm.js → TaskRoutes-BaTgjrdZ.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-Ln9HzXsS.js → TransactionDetailRoutes-C_Orz-Lz.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-qgLSqSNT.js → TransactionDetailScreen-DHdS4J3N.js} +1 -1
- package/dist/assets/{TransactionListRoutes-BqwHG3AV.js → TransactionListRoutes-B5wpQo4s.js} +1 -1
- package/dist/assets/{TreasuryRoutes-DxBKr4aJ.js → TreasuryRoutes-T4MLJL18.js} +1 -1
- package/dist/assets/{VendorsRoutes-BvKCtUVO.js → VendorsRoutes-ikvPe4Sn.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-DGdciAcq.js → WiseConfirmationScreen-CdZZPj6p.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-4nzGey-r.js → ZeniAccountRoutes-CUyHxcKz.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-C-juTt6c.js → ZeniAccountStatementScreen-DQWuTFCk.js} +1 -1
- package/dist/assets/{accountMappingHelper-BFxOrTVK.js → accountMappingHelper-BBILjeHz.js} +1 -1
- package/dist/assets/{analytics-BToIaEuE.js → analytics-BlxwN6GD.js} +1 -1
- package/dist/assets/{analyticsHelper-DE1SyLO3.js → analyticsHelper-JD26-jfw.js} +1 -1
- package/dist/assets/{core-CJUY0MOY.js → core-Ctjv24YM.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BXzU7C-M.js → decodeURIComponentSafe-Z8As9uQN.js} +1 -1
- package/dist/assets/{dnd-LV5QvpgJ.js → dnd-DdE4ICzz.js} +1 -1
- package/dist/assets/{empty-BrON4VTN.js → empty-BgBFHjf_.js} +1 -1
- package/dist/assets/{empty-DZsqgfyL.js → empty-Cgmg-ODN.js} +1 -1
- package/dist/assets/{emptyVideoElement-D28OtmxE.js → emptyVideoElement-BxJPDgaA.js} +1 -1
- package/dist/assets/{epic-DUxvu9Sx.js → epic-D1NCPIYf.js} +1 -1
- package/dist/assets/{getLocaleForTenant-BxE1cnSw.js → getLocaleForTenant-DSAEK88o.js} +1 -1
- package/dist/assets/{index-B2ukUPdb.js → index-B2_u2l5p.js} +1172 -1172
- package/dist/assets/{index-LSEqxgWI.js → index-B6LHkFfA.js} +1 -1
- package/dist/assets/{index-3T7v0Kjw.js → index-Brx9Hk6c.js} +1 -1
- package/dist/assets/{index-N--zv7t4.js → index-D5yqrruP.js} +2 -2
- package/dist/assets/{index-6y2Ha7q4.js → index-DN_Tvj5e.js} +1 -1
- package/dist/assets/{index-CQBukgOK.js → index-DZAo63F3.js} +1 -1
- package/dist/assets/{index-BUVIqiRA.js → index-DrylXWCT.js} +1 -1
- package/dist/assets/{index-7lEXxVMw.js → index-hzMyClsK.js} +1 -1
- package/dist/assets/{lexical-Cmpx8sPR.js → lexical-z-P2V9ug.js} +1 -1
- package/dist/assets/{liveblocks-qa_6WStS.js → liveblocks-UQZFqaDN.js} +1 -1
- package/dist/assets/{lottie-zGjtu-Uw.js → lottie-h9wdJ9gi.js} +1 -1
- package/dist/assets/{mui-CkYYTJAV.js → mui-DU4JyJ-_.js} +1 -1
- package/dist/assets/{pathToGoBack-BPCNomFS.js → pathToGoBack-dHZq4iEC.js} +1 -1
- package/dist/assets/{pdf-CZjXUklc.js → pdf-BK4Cbxeo.js} +4 -4
- package/dist/assets/{pdf-lib-1-yXS4qt.js → pdf-lib-BWuwD2_b.js} +1 -1
- package/dist/assets/{plaid-1xV6OFdB.js → plaid-Dtkg2fMC.js} +1 -1
- package/dist/assets/{pusher-D2ak7eHg.js → pusher-BRkEMaTd.js} +1 -1
- package/dist/assets/{react-BihdrB0K.js → react-B6jUeEM2.js} +1 -1
- package/dist/assets/{react-COkOWomn.js → react-BEV1hQDm.js} +1 -1
- package/dist/assets/{react-BQ9185Ee.js → react-BTEnGEot.js} +1 -1
- package/dist/assets/{react-CBo1BYNF.js → react-DDqHZ_bg.js} +1 -1
- package/dist/assets/{react-CVnQTP0R.js → react-Tzoiwmeg.js} +1 -1
- package/dist/assets/{react-BSs2nIas.js → react-lX-1Fc9t.js} +1 -1
- package/dist/assets/{recharts-D3JK2Byj.js → recharts-RL5R0Iqz.js} +1 -1
- package/dist/assets/{routePaths-DbnM8jAc.js → routePaths-DQVLxXKn.js} +1 -1
- package/dist/assets/{sentry-BTf2Dtmp.js → sentry-C0E1AQIe.js} +1 -1
- package/dist/assets/{url-DbiWYN-9.js → url-B8pn9E20.js} +1 -1
- package/dist/assets/{url-CnoP6Bkx.js → url-DASTrDxO.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-C9aknKEV.js → useAiCfoDashboardSuggestedQuestionsChips-B_thEjYk.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-DUCZkKew.js → useAskAiCfoHostNavButtonProps-Q4FV3LSW.js} +1 -1
- package/dist/assets/{useCashManagementBanner-Bqm1UKHq.js → useCashManagementBanner-NM9lBibn.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-Bxg7wg9x.js → useChargeCardPusherEvents-HzaLnrlm.js} +1 -1
- package/dist/assets/{useDeviceId-D5q7Ex2B.js → useDeviceId-_WmC04ST.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-BGSh8M-E.js → useEmailConnectResultRefresh-Dym62Z_F.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-CcPLE3h6.js → useInitialThreadRequest-iSw8uA8Y.js} +1 -1
- package/dist/assets/{utils-Bd6aVUzu.js → utils-hcCBORos.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-RlHJMQ4A.js → withTransactionSidePanel-DL6O8tOb.js} +1 -1
- package/dist/assets/{zeni-epic-state-Da9EwYbz.js → zeni-epic-state-ym9j-rvL.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +2 -2
- package/dist/assets/AddressRoutes-1t80Lwwm.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-GZfWR-j7.js +0 -1
- package/dist/assets/NotFoundScreen-DTvgxtkb.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-UQZFqaDN.js";import{A as d}from"./AddressScreen-B3VxKVsm.js";import i from"./NotFoundScreen-DMlQVohM.js";import"./sentry-C0E1AQIe.js";import{o as s,p as r}from"./core-Ctjv24YM.js";import"./zeni-epic-state-ym9j-rvL.js";import"./recharts-RL5R0Iqz.js";import"./index-B2_u2l5p.js";import"./mui-DU4JyJ-_.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.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-UQZFqaDN.js";import{a as h}from"./sentry-C0E1AQIe.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-Ctjv24YM.js";import{q as $,m as D,z as L,I as K,w as R,x as F,d as C,f as S,j as G,i as b,k as z}from"./index-B2_u2l5p.js";import{MF as w,hR as U,eV as V,MG as q,c6 as H,MH as N,la as O}from"./zeni-epic-state-ym9j-rvL.js";import{n as J}from"./mui-DU4JyJ-_.js";import Q from"./NotFoundScreen-DMlQVohM.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]="58c90981-6ae5-48a9-90f1-67381e34de06",e._sentryDebugIdIdentifier="sentry-dbid-58c90981-6ae5-48a9-90f1-67381e34de06")}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 c}from"./liveblocks-qa_6WStS.js";import{a as r}from"./sentry-BTf2Dtmp.js";import{u as xe,h as Pe,g as we,j as X,i as ye,n as Ee}from"./core-CJUY0MOY.js";import{Q as Te,da as ve,z as Qe,q as Ae,db as _e,dc as Ue,b9 as Z,dd as se,de as Oe,b8 as ae,k as M,x as B,d as I,df as R,dg as je,dh as Le,a1 as De,f as Fe,a7 as Be,di as Re,dj as Ve,a2 as Me,dk as $e,dl as Ge,dm as qe,s as Ne,b4 as He,dn as We}from"./index-B2ukUPdb.js";import{gi as ze,eU as oe,eV as Ye,ix as Je,TS as Ke,fm as Xe,iH as Ze,iD as et,eW as V,ft as tt,g3 as st,fY as at,g0 as ee,g4 as ot,g5 as nt,g6 as it,g7 as rt,g8 as lt}from"./zeni-epic-state-Da9EwYbz.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-CkYYTJAV.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-C9aknKEV.js";import{p as pt}from"./pathToGoBack-BPCNomFS.js";import"./recharts-D3JK2Byj.js";import"./analytics-BToIaEuE.js";import"./plaid-1xV6OFdB.js";import"./dnd-LV5QvpgJ.js";import"./stripe-DMRn4zHo.js";import"./lottie-zGjtu-Uw.js";import"./lexical-Cmpx8sPR.js";import"./pdf-CZjXUklc.js";import"./utils-Bd6aVUzu.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="94027e9a-e05f-4bf1-8ae3-cc48796ddb70",e._sentryDebugIdIdentifier="sentry-dbid-94027e9a-e05f-4bf1-8ae3-cc48796ddb70")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:Q}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,We(Q,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&He(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Dt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(ze())},[t]);const m=X(i=>oe(i)),a=Qe.getSignedInUser(),{session_id:l}=ye(),d=Ae(),g=De(d),p=X(i=>Ye(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:Q,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),A=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,H=r.useRef(!1);r.useEffect(()=>{H.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Je("controller",a.userId,L,"MONTH_END_EMAIL")),H.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Oe(n),D=m.fetchState,F=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,z=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Xe({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{D!=="In-Progress"&&F&&t(Ze())},[D,F,t]),r.useEffect(()=>{n!=null&&z!=="In-Progress"&&Y&&a!=null&&D==="Completed"&&!F&&t(et(n,a.userId))},[z,Y,n,a,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:K}),A.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:K}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(Fe.Event.aiCFOPage)}),g&&A.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?A.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:Q,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
1
|
+
import{j as c}from"./liveblocks-UQZFqaDN.js";import{a as r}from"./sentry-C0E1AQIe.js";import{u as xe,h as Pe,g as we,j as X,i as ye,n as Ee}from"./core-Ctjv24YM.js";import{Q as Te,da as ve,z as Qe,q as Ae,db as _e,dc as Ue,b9 as Z,dd as se,de as Oe,b8 as ae,k as M,x as B,d as I,df as R,dg as je,dh as Le,a1 as De,f as Fe,a7 as Be,di as Re,dj as Ve,a2 as Me,dk as $e,dl as Ge,dm as qe,s as Ne,b4 as He,dn as We}from"./index-B2_u2l5p.js";import{gi as ze,eU as oe,eV as Ye,ix as Je,TS as Ke,fm as Xe,iH as Ze,iD as et,eW as V,ft as tt,g3 as st,fY as at,g0 as ee,g4 as ot,g5 as nt,g6 as it,g7 as rt,g8 as lt}from"./zeni-epic-state-ym9j-rvL.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-DU4JyJ-_.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-B_thEjYk.js";import{p as pt}from"./pathToGoBack-dHZq4iEC.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="94027e9a-e05f-4bf1-8ae3-cc48796ddb70",e._sentryDebugIdIdentifier="sentry-dbid-94027e9a-e05f-4bf1-8ae3-cc48796ddb70")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:Q}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,We(Q,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&He(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Dt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(ze())},[t]);const m=X(i=>oe(i)),a=Qe.getSignedInUser(),{session_id:l}=ye(),d=Ae(),g=De(d),p=X(i=>Ye(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:Q,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),A=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,H=r.useRef(!1);r.useEffect(()=>{H.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Je("controller",a.userId,L,"MONTH_END_EMAIL")),H.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Oe(n),D=m.fetchState,F=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,z=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Xe({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{D!=="In-Progress"&&F&&t(Ze())},[D,F,t]),r.useEffect(()=>{n!=null&&z!=="In-Progress"&&Y&&a!=null&&D==="Completed"&&!F&&t(et(n,a.userId))},[z,Y,n,a,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:K}),A.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:K}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(Fe.Event.aiCFOPage)}),g&&A.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?A.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:Q,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-qa_6WStS.js";import{a as v}from"./sentry-BTf2Dtmp.js";import{h as U,g as B,u as j,j as y,N as z,n as V,i as W,o as te,p as D}from"./core-CJUY0MOY.js";import{eV as k,Q3 as A,PL as h,zm as E,ze as q,zi as R,z7 as K,PN as M,zo as ae,za as Q,zr as G,zn as C}from"./zeni-epic-state-Da9EwYbz.js";import{z as O,a7 as H,bL as oe,af as P,bC as J,bM as le,m as X,w as Y,bN as pe,bO as se}from"./index-B2ukUPdb.js";import"./mui-CkYYTJAV.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CrNxSCRL.js";import re from"./NotFoundScreen-DTvgxtkb.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]="7addaf2c-9c06-4c46-9fe7-db2b6dd87e16",e._sentryDebugIdIdentifier="sentry-dbid-7addaf2c-9c06-4c46-9fe7-db2b6dd87e16")}catch{}})();const T="bill-approval-rule-update",ie=V(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(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||(u(!0),o(R())),p("./new"))},[n,i,o]);const g={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...g})},_="bill-approval-rule-update",de=V(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(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),ue=()=>{const e=y(o=>k(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(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,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(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||(u(!0),o(R())),p("./new"))},[n,i,o]);const g={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...g})},fe=V(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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=f=>{const g=[];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}}),m=w.concat(S);g.push({action:s.stepType.selectedOption,actors:m,operator:m.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g},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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!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)),u=y(i=>A(i)),[l,d]=v.useState(!1);if(v.useEffect(()=>{l||(d(!0),p(Q(!0)))}),v.useEffect(()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[u,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:u,location:t})}const me=V(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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=m=>{const b=[];return m.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,g=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const m=i.comparator.selectedOption;s.amount={type:"amount",comparator:m,min:m==="less_than"?void 0:i.min,max:m==="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=g?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const m={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(ge,{}):c.jsx(ye,{})}function ge(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y(i=>h(i)),u=y(i=>A(i)),[l,d]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(d(!0),p(Q(!0)))}),v.useEffect(()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[u,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(me,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(ue,{})}),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-UQZFqaDN.js";import{a as v}from"./sentry-C0E1AQIe.js";import{h as U,g as B,u as j,j as y,N as z,n as V,i as W,o as te,p as D}from"./core-Ctjv24YM.js";import{eV as k,Q3 as A,PL as h,zm as E,ze as q,zi as R,z7 as K,PN as M,zo as ae,za as Q,zr as G,zn as C}from"./zeni-epic-state-ym9j-rvL.js";import{z as O,a7 as H,bL as oe,af as P,bC as J,bM as le,m as X,w as Y,bN as pe,bO as se}from"./index-B2_u2l5p.js";import"./mui-DU4JyJ-_.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DJf65wBd.js";import re from"./NotFoundScreen-DMlQVohM.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]="7addaf2c-9c06-4c46-9fe7-db2b6dd87e16",e._sentryDebugIdIdentifier="sentry-dbid-7addaf2c-9c06-4c46-9fe7-db2b6dd87e16")}catch{}})();const T="bill-approval-rule-update",ie=V(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(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||(u(!0),o(R())),p("./new"))},[n,i,o]);const g={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...g})},_="bill-approval-rule-update",de=V(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(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),ue=()=>{const e=y(o=>k(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(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,u]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),d=y(s=>k(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||(u(!0),o(R())),p("./new"))},[n,i,o]);const g={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...g})},fe=V(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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=f=>{const g=[];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}}),m=w.concat(S);g.push({action:s.stepType.selectedOption,actors:m,operator:m.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g},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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!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)),u=y(i=>A(i)),[l,d]=v.useState(!1);if(v.useEffect(()=>{l||(d(!0),p(Q(!0)))}),v.useEffect(()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[u,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:u,location:t})}const me=V(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,u=P(p.location);return{onApprovalRuleDataUpdated:l=>{const d=m=>{const b=[];return m.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,g=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const m=i.comparator.selectedOption;s.amount={type:"amount",comparator:m,min:m==="less_than"?void 0:i.min,max:m==="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=g?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const m={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}else{const m={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(m))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(ge,{}):c.jsx(ye,{})}function ge(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=O.getSignedInUser(),r=X(),n=y(i=>h(i)),u=y(i=>A(i)),[l,d]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(d(!0),p(Q(!0)))}),v.useEffect(()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[u,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(me,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(ue,{})}),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-qa_6WStS.js";import{h as K,u as se,g as J,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-CJUY0MOY.js";import{eV as Z,Pl as _e,bs as It,Ka as oa,bq as wt,bJ as pe,Pm as At,yE as Ct,zT as $e,zb as la,bn as De,Pn as sa,Po as ra,c6 as ca,Pp as da,ku as Bt,Pq as xt,Pr as Et,As as Ge,yT as Be,Ps as ua,ys as tt,Pt as pa,Ey as ma,yw as ba,yC as Dt,Pu as ke,Pv as Me,zU as Ne,Pw as ha,Px as ga,zX as Oe,Py as ya,A8 as Sa,Pz as Pt,zE as at,zJ as fa,PA as ka,PB as ue,PC as jt,PD as Tt,PE as Ft,gm as va,yY as Ue,cA as Rt,PF as Ia,fv as wa,PG as Aa,PH as Ca,fA as Vt,fy as $t,PI as ze,PJ as Ba,PK as xa,N4 as Ze,PL as Ea,N5 as oe,N6 as He,PM as Da,PN as Pa,PO as ja,zL as nt,zI as Ta,PP as Fa,PQ as Ra,PR as Va,zu as $a,PS as Ua,PT as La,PU as _a,co as Ut,cQ as Lt,kF as Ga,bP as Ma,bo as _t,bQ as Gt,xK as Na,PV as Oa,El as za,Er as Za,u8 as Ha,zV as Wa,Az as qa,kS as fe,PW as Qa,PX as Mt,lk as Ka,kM as Nt,l5 as Ot,l4 as it,bE as be,bO as Ja,PY as Xa,PZ as ve,jp as Ya,P_ as ot,P$ as en,jt as tn,jO as an,AN as nn,Q0 as on,ld as ln,AD as sn,Q1 as lt,AH as rn,AM as cn,AJ as dn,AB as un,Q2 as zt,yN as pn,Q3 as mn,Q4 as bn,ge as hn,gd as gn,gc as yn,kV as Sn,lb as st,lm as fn,rz as kn,l2 as vn,AF as In,jz as wn,lr as An,Q5 as Cn,jr as Bn,rq as xn,Q6 as En,zA as Dn,bK as Pn,bt as jn,LU as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-Da9EwYbz.js";import{m as me,z as V,I as Ie,Z as We,W as le,U as y,aQ as xe,w as re,o as x,x as Pe,d as D,bh as Un,k as z,a2 as qe,s as E,q as we,bi as rt,bj as ct,bk as Ln,ak as _n,A as Gn,aK as Mn,y as Zt,a as Qe,C as Ke,bl as Nn,au as Ht,bm as On,V as zn,f as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,$ as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-B2ukUPdb.js";import{n as L,S as si}from"./mui-CkYYTJAV.js";import{A as dt}from"./AddressScreen-fWJCm4zs.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-Cl_7XBwW.js";import{a as f}from"./sentry-BTf2Dtmp.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-DUCZkKew.js";import{u as Qt}from"./useInitialThreadRequest-CcPLE3h6.js";import Ee from"./NotFoundScreen-DTvgxtkb.js";import{D as ui}from"./DrawerScreen-DqnvN1tq.js";import{M as Kt}from"./MobileAppDrawer-CDYOk1Tu.js";import{F as Jt}from"./FeaturePreviewScreen-DCDhII3I.js";import{S as Te}from"./SetupPagesScreen-Cb_h1N2q.js";import{B as pi}from"./BillPayApprovalRoutes-Bv9HP5Ed.js";import{FallBackRoute as mi}from"./ScreenRoutes-C_5gtCcR.js";import"./recharts-D3JK2Byj.js";import"./analytics-BToIaEuE.js";import"./plaid-1xV6OFdB.js";import"./dnd-LV5QvpgJ.js";import"./stripe-DMRn4zHo.js";import"./lottie-zGjtu-Uw.js";import"./lexical-Cmpx8sPR.js";import"./pdf-CZjXUklc.js";import"./utils-Bd6aVUzu.js";import"./analyticsHelper-DE1SyLO3.js";import"./routePaths-DbnM8jAc.js";import"./BusinessVerificationPageScreen-9FWcKpyL.js";import"./ReimbursementApprovalRuleDetailScreen-CrNxSCRL.js";import"./getLocaleForTenant-BxE1cnSw.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]="a8ea9f1b-2bcd-495d-a0fe-51bf66fd3361",e._sentryDebugIdIdentifier="sentry-dbid-a8ea9f1b-2bcd-495d-a0fe-51bf66fd3361")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=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=De(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}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(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(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(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(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Un);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(N=>Z(N)),s=v(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),U=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(n??"",$,U,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,U,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,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(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:U,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${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=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),B=v(F=>Me(F,m,g,n));let q=B.fetchState,W=B.file,U=B.showAutofill;const Q=v(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,W=Q.transactionDetails?.attachments?.[0],U=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||U?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Ln,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[U&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||U?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:U,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,B),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(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(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-UQZFqaDN.js";import{h as K,u as se,g as J,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-Ctjv24YM.js";import{eV as Z,Pl as _e,bs as It,Ka as oa,bq as wt,bJ as pe,Pm as At,yE as Ct,zT as $e,zb as la,bn as De,Pn as sa,Po as ra,c6 as ca,Pp as da,ku as Bt,Pq as xt,Pr as Et,As as Ge,yT as Be,Ps as ua,ys as tt,Pt as pa,Ey as ma,yw as ba,yC as Dt,Pu as ke,Pv as Me,zU as Ne,Pw as ha,Px as ga,zX as Oe,Py as ya,A8 as Sa,Pz as Pt,zE as at,zJ as fa,PA as ka,PB as ue,PC as jt,PD as Tt,PE as Ft,gm as va,yY as Ue,cA as Rt,PF as Ia,fv as wa,PG as Aa,PH as Ca,fA as Vt,fy as $t,PI as ze,PJ as Ba,PK as xa,N4 as Ze,PL as Ea,N5 as oe,N6 as He,PM as Da,PN as Pa,PO as ja,zL as nt,zI as Ta,PP as Fa,PQ as Ra,PR as Va,zu as $a,PS as Ua,PT as La,PU as _a,co as Ut,cQ as Lt,kF as Ga,bP as Ma,bo as _t,bQ as Gt,xK as Na,PV as Oa,El as za,Er as Za,u8 as Ha,zV as Wa,Az as qa,kS as fe,PW as Qa,PX as Mt,lk as Ka,kM as Nt,l5 as Ot,l4 as it,bE as be,bO as Ja,PY as Xa,PZ as ve,jp as Ya,P_ as ot,P$ as en,jt as tn,jO as an,AN as nn,Q0 as on,ld as ln,AD as sn,Q1 as lt,AH as rn,AM as cn,AJ as dn,AB as un,Q2 as zt,yN as pn,Q3 as mn,Q4 as bn,ge as hn,gd as gn,gc as yn,kV as Sn,lb as st,lm as fn,rz as kn,l2 as vn,AF as In,jz as wn,lr as An,Q5 as Cn,jr as Bn,rq as xn,Q6 as En,zA as Dn,bK as Pn,bt as jn,LU as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-ym9j-rvL.js";import{m as me,z as V,I as Ie,Z as We,W as le,U as y,aQ as xe,w as re,o as x,x as Pe,d as D,bh as Un,k as z,a2 as qe,s as E,q as we,bi as rt,bj as ct,bk as Ln,ak as _n,A as Gn,aK as Mn,y as Zt,a as Qe,C as Ke,bl as Nn,au as Ht,bm as On,V as zn,f as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,$ as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-B2_u2l5p.js";import{n as L,S as si}from"./mui-DU4JyJ-_.js";import{A as dt}from"./AddressScreen-B3VxKVsm.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-CUtA9hl5.js";import{a as f}from"./sentry-C0E1AQIe.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Q4FV3LSW.js";import{u as Qt}from"./useInitialThreadRequest-iSw8uA8Y.js";import Ee from"./NotFoundScreen-DMlQVohM.js";import{D as ui}from"./DrawerScreen-DH8ydvUJ.js";import{M as Kt}from"./MobileAppDrawer-DOdKZ6eR.js";import{F as Jt}from"./FeaturePreviewScreen-DttBoo3w.js";import{S as Te}from"./SetupPagesScreen-C883vxB-.js";import{B as pi}from"./BillPayApprovalRoutes-uGTk7D6Z.js";import{FallBackRoute as mi}from"./ScreenRoutes-Cx9i1dRt.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";import"./analyticsHelper-JD26-jfw.js";import"./routePaths-DQVLxXKn.js";import"./BusinessVerificationPageScreen-BoQL4-Oc.js";import"./ReimbursementApprovalRuleDetailScreen-DJf65wBd.js";import"./getLocaleForTenant-DSAEK88o.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]="a8ea9f1b-2bcd-495d-a0fe-51bf66fd3361",e._sentryDebugIdIdentifier="sentry-dbid-a8ea9f1b-2bcd-495d-a0fe-51bf66fd3361")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=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=De(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}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(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(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(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(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Un);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(N=>Z(N)),s=v(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),U=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(n??"",$,U,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,U,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,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(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:U,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${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=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),B=v(F=>Me(F,m,g,n));let q=B.fetchState,W=B.file,U=B.showAutofill;const Q=v(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,W=Q.transactionDetails?.attachments?.[0],U=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||U?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Ln,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[U&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||U?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:U,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,B),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(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(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=L.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as k}from"./liveblocks-
|
|
1
|
+
import{j as k}from"./liveblocks-UQZFqaDN.js";import{a as V}from"./sentry-C0E1AQIe.js";import{h as ae,g as ne,u as se,i as oe,j as C,N as ie,n as re}from"./core-Ctjv24YM.js";import{I as ce,W as ue,aQ as de,z as E,x as pe,d as B,af as x,f as z,bH as le,au as me,s as P,av as M}from"./index-B2_u2l5p.js";import{PT as fe,eV as G,tz as ye,Kd as Se,zu as ge,CW as Ie,FH as be,Gk as he,Hk as Te,Qe as De,Qf as Oe,Qg as ke,Qh as Ce,Qi as Ve,MG as we,Pg as Ae,MX as Ne,D_ as Fe,MY as _e,E2 as ve,la as xe,ge as ze,gd as Ee,gc as Be,rz as Pe,rq as Me,rn as Ue,l2 as Re,tI as Le,tG as U,bE as R,tU as L,cy as je}from"./zeni-epic-state-ym9j-rvL.js";import{n as Ge}from"./mui-DU4JyJ-_.js";import{d as j}from"./routePaths-DQVLxXKn.js";import{M as Qe}from"./MobileAppDrawer-DOdKZ6eR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="96a81eba-0d38-4d3c-be3f-2c5ba861f49a",t._sentryDebugIdIdentifier="sentry-dbid-96a81eba-0d38-4d3c-be3f-2c5ba861f49a")}catch{}})();const qe=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-UQZFqaDN.js";import{a as l}from"./sentry-C0E1AQIe.js";import{u as pe,h as he,g as Ce,j as H,i as fe,n as Se}from"./core-Ctjv24YM.js";import{Q as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,x as we,d as $,df as B,dp as Ee,a as ke,f as Ae,a7 as Te,di as xe,dj as Ue,a2 as _e,dm as Oe,b4 as ve,dn as Qe}from"./index-B2_u2l5p.js";import{gi as Fe,eU as G,eV as $e,fm as De,iH as Ve,iD as Le,eW as M,g3 as je,fY as Re,g0 as N,g4 as qe,g5 as He,g6 as Be,g7 as Me,g8 as Ne}from"./zeni-epic-state-ym9j-rvL.js";import{D as ze,n as V,P as We,S as Ge}from"./mui-DU4JyJ-_.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.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]="54233e37-95db-43cb-9a2a-44cdec4890d6",e._sentryDebugIdIdentifier="sentry-dbid-54233e37-95db-43cb-9a2a-44cdec4890d6")}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:T,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=He(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,Be(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Me({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:T,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}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=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:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=H(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=H(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:A,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,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=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:L.map(r=>`private-encrypted-chat-${r}.${Y}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o(Ve())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(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(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(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(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},Xe=V(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-qa_6WStS.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as ba,s as Dt,n as De,t as In,o as es,p as se}from"./core-CJUY0MOY.js";import{bt as Pe,RQ as as,RR as ts,eX as un,RS as kn,f4 as En,RT as An,RU as Dn,RV as _n,RW as Pn,f5 as wn,f6 as vn,RX as Tn,fg as Fn,fh as $a,RY as xn,RZ as ns,fa as rs,f9 as ss,R_ as cs,B_ as Bn,fj as ca,R$ as os,S0 as is,eZ as ds,eY as ls,fv as ze,fc as Rn,fb as Ln,S1 as us,fd as ms,Bv as Cs,Bu as ps,By as hs,BA as fs,fo as gs,eU as Un,S2 as Ss,S3 as bs,ft as On,S4 as ys,fu as bt,BG as Is,BD as ks,eV as fe,S5 as Qa,fy as we,fz as ve,fA as Te,gt as oa,cv as ia,S6 as da,S7 as _t,uN as za,kC as Ya,S8 as Za,Ce as ka,Cg as Qe,Ch as Pt,ks as jn,S9 as la,C2 as _a,Sa as Es,Sb as As,C5 as Ja,Sc as Ds,Qb as Xa,ff as Mn,Cb as ga,hS as _s,Sd as Nn,Se as ua,bo as Ps,Sf as ws,ge as et,gd as at,CL as vs,gc as tt,PT as Ts,Sg as Vn,co as Hn,cQ as Fs,Qa as wa,Dk as Gn,Sh as mn,CW as Pa,Si as $n,Dl as xs,QA as Bs,Dm as Rs,Er as Ls,u8 as Us,El as Os,Sj as js,Cf as ra,Sk as Ms,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as wt,Sq as $s,Cw as zn,Cp as zs,Sr as Ys,gv as Zs,CF as Yn,CJ as Zn,gu as Ks,Ss as Ws,D6 as Kn,St as qs,Su as Qs,Sv as Js,CH as Wn,Cs as qn,C8 as Qn,CB as Jn,Cz as Xn,CD as Xs,Sw as er,Sx as ec,fq as ac,fr as tc,fs as nc,Sy as nt,fk as ar,cR as vt,Sz as rc,SA as sc,SB as cc,SC as oc,CR as yt,Dd as ic,D9 as dc,CN as lc,Db as uc,D1 as mc,D3 as Cc,SD as tr,Dj as Ga,Ka as pc,SE as hc,SF as fc,SG as gc,SH as nr,SI as Sc,DG as bc,CV as rr,CQ as je,CU as yc,SJ as Ic,SK as kc,B$ as Ec,SL as sr,fe as cr,SM as Ac,C1 as Dc,C0 as Cn,SN as _c,SO as Pc,SP as wc,MH as vc,SQ as Tt,SR as Tc,xN as or,la as Fc,hI as xc,DL as Bc,SS as ir,f1 as Rc,f2 as Lc,ST as Uc,dh as Oc,fi as jc,DB as Mc,Dv as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,LU as $c}from"./zeni-epic-state-Da9EwYbz.js";import{I as Fe,cp as dr,k as _e,cq as lr,cr as ur,cs as zc,a as Xe,Z as Ft,ct as Yc,cu as Zc,Q as mr,c as Cr,X as pr,s as ye,W as le,U as K,ar as ya,cv as hr,cw as Kc,cx as Wc,z as re,w as va,ce as rt,cy as qc,cz as Qc,cA as Jc,q as Ta,aQ as Ye,br as xt,cB as Xc,y as Fa,i as st,m as Bt,d as J,a7 as ct,cC as eo,bE as Sa,cD as It,cE as ao,x as Rt,cF as to,au as fr,a2 as kt,cG as no,V as gr,f as Sr,cH as ro,cI as so,cJ as co,cK as oo,cL as io,cM as lo,o as Ka,cN as uo,cO as mo,cP as pt,$ as Co,cQ as po,cR as ho,cS as fo,cT as go,cU as So,a9 as bo}from"./index-B2ukUPdb.js";import{n as Ne,D as br,S as yo}from"./mui-CkYYTJAV.js";import{a as r}from"./sentry-BTf2Dtmp.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-DUCZkKew.js";import{M as Ie}from"./MobileAppDrawer-CDYOk1Tu.js";import{d as Lt}from"./recharts-D3JK2Byj.js";import{g as Ae,a as Ba,b as yr,c as xe,d as Be,e as Je,f as ea,h as aa,A as Io,i as Ut,P as ko,j as Ot,s as Ia,k as Ir,l as sa,m as kr,n as Eo,o as Er,p as Ao,S as pn}from"./SetupPagesScreen-Cb_h1N2q.js";import{u as Ar}from"./useInitialThreadRequest-CcPLE3h6.js";import ot from"./NotFoundScreen-DTvgxtkb.js";import{u as jt}from"./useChargeCardPusherEvents-Bxg7wg9x.js";import{n as hn}from"./utils-Bd6aVUzu.js";import{t as Do}from"./AddressScreen-fWJCm4zs.js";import"./analytics-BToIaEuE.js";import"./plaid-1xV6OFdB.js";import"./dnd-LV5QvpgJ.js";import"./stripe-DMRn4zHo.js";import"./lottie-zGjtu-Uw.js";import"./lexical-Cmpx8sPR.js";import"./pdf-CZjXUklc.js";import"./analyticsHelper-DE1SyLO3.js";import"./routePaths-DbnM8jAc.js";import"./BusinessVerificationPageScreen-9FWcKpyL.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]="a5636aca-02b8-4823-96dc-0cc560dadd01",e._sentryDebugIdIdentifier="sentry-dbid-a5636aca-02b8-4823-96dc-0cc560dadd01")}catch{}})();const _o=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}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:_o(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),Po=e=>Rn(e,!1),wo=e=>Ln(e.name,!1);function vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(P=>{S(P)},[]),l=r.useCallback(()=>{w(!0)},[w]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const v=o(P=>kn(P.cardPolicyState)),u=o(P=>En(P.cardPolicyState)),M=o(P=>An(P.cardPolicyState)),x=o(P=>Dn(P.cardPolicyState)),B=o(P=>_n(P.cardPolicyState)),p=o(P=>Pn(P.cardPolicyState)),h=o(P=>wn(P.cardPolicyState)),D=o(P=>vn(P.cardPolicyState)),d=o(P=>Tn(P.cardPolicyState)),_=o(P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(P=>P.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(Fn())},[a,v]),r.useEffect(()=>{D==="Completed"&&d===""||D==="In-Progress"||a($a())},[a,D,d]);const j=o(P=>xn(P.createCardPolicyState)),A=o(P=>ns(P.createCardPolicyState)),I=o(P=>rs(P.cardPolicyState)),L=o(P=>ss(P.cardPolicyState)),i=o(P=>cs(P.createCardPolicyState)),C=o(P=>Bn(P));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>u.map(Po),[u]),G=r.useMemo(()=>h.map(wo),[h]),U=r.useMemo(()=>C.cards.filter(P=>!dr(P.status.code)).map(Dr),[C.cards]),O=v==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{O&&i==null&&a(os({cardsMasterList:U,defaultRequireReceiptAmount:_,suggestedAllowMerchants:M,suggestedBlockMerchants:x,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,O,i,U,_,M,x,B,p]);const z=r.useMemo(()=>Lt(P=>{a($a(P))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Y=r.useCallback(P=>{z(P)},[z]),b=j.fetchState,T=t!=null?`/${t}/cards/policy`:"..",Z=r.useCallback(()=>{const P=_e(n.state?.pathnameStackToGoBack),ee=P.poppedPathname??T;e(ee,{state:{pathnameStackToGoBack:P.newStack}})},[n.state,e,T]),q=r.useCallback(()=>{e(T)},[e,T]),E=r.useCallback(P=>{a(is(P))},[a]),V=r.useCallback(P=>{const ee=lr(P);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(P=>{P.length!==0&&a(ls(P))},[a]),X=r.useCallback(()=>{a(un())},[a]),g=r.useRef(b);r.useEffect(()=>{const P=g.current;g.current=b,b==="Completed"&&P!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))},[a,b,A,e,T]);const F=b==="Error"?j.error?.message??fn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?i==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Z,onClickMenuIcon:l,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(zc,{formDraft:i,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:D==="In-Progress",onVendorSearchTextChange:Y,submitState:b,submitErrorMessage:F,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Z,onCancelClick:q,onClickMenuIcon:l,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:To}}}=Xe.getLocalizedStrings(),Fo=e=>Rn(e,!1),xo=e=>Ln(e.name,!1);function Bo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),y=Fe(),f=Pe(y?.loggedInUserRoleMap),[S,w]=r.useState(!1),l=r.useCallback(F=>{w(F)},[]),m=r.useCallback(()=>{l(!0)},[l]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),u=o(F=>us(F)),M=o(F=>kn(F.cardPolicyState)),x=o(F=>En(F.cardPolicyState)),B=o(F=>An(F.cardPolicyState)),p=o(F=>Dn(F.cardPolicyState)),h=o(F=>_n(F.cardPolicyState)),D=o(F=>Pn(F.cardPolicyState)),d=o(F=>wn(F.cardPolicyState)),_=o(F=>vn(F.cardPolicyState)),k=o(F=>Tn(F.cardPolicyState)),j=o(F=>Bn(F)),A=o(F=>a!=null?ms(F.cardPolicyState,a):void 0),I=r.useMemo(()=>u.templateId===a&&u.formDraft!=null?u.formDraft:A!=null?Cs(A):void 0,[u.templateId,u.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=u.detailFetchState.fetchState;u.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(ps(a))},[s,a,u.templateId,u.detailFetchState.fetchState,A]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(Fn())},[s,M]),r.useEffect(()=>{_==="Completed"&&k===""||_==="In-Progress"||s($a())},[s,_,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{j.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[j.fetchState,s]);const i=r.useMemo(()=>x.map(Fo),[x]),C=r.useMemo(()=>d.map(xo),[d]),N=r.useMemo(()=>j.cards.filter(F=>!dr(F.status.code)).map(Dr),[j.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Yc({draft:I,cardRows:N,categorySearchOptions:i,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:D})},[I,N,i,C,L,B,p,h,D]),[U,O]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||U!=null||G==null||(z.current=!0,O(G))},[U,G]);const Y=r.useCallback(F=>{O(F)},[]),b=r.useMemo(()=>Lt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{b.cancel()},[b]);const T=r.useCallback(F=>{b(F)},[b]),Z=u.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),P=F.poppedPathname??q;e(P,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const P=lr(F);s(hs(P)),s(fs(a))},[s,a]),X=r.useRef(Z);r.useEffect(()=>{const F=X.current;X.current=Z,Z==="Completed"&&F!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Z,e,q]);const g=Z==="Error"?u.updateFetchState.error?.message??To.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):U!=null&&M==="Completed"&&j.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(Zc,{templateName:u.template?.name??"",formDraft:U,vendorSearchOptions:C,categorySearchOptions:i,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:Z,submitErrorMessage:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:v,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Y,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:u.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:v})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ro,subheadline:Lo,pageTitle:Uo}}}}=Xe.getLocalizedStrings(),Oo=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 jo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(b=>{S(b)},[]),l=r.useCallback(()=>{w(!0)},[w]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),x=o(b=>Ss(b)),B=o(b=>xn(b.createCardPolicyState)),p=o(b=>bs(b.createCardPolicyState)),h=o(b=>p==null?[]:On(b.aiCfoState,p).filter(T=>T.kind==="creating_policy"),Dt),D=B.fetchState==="In-Progress"?Math.max(h.length,1):0,d=o(b=>ys(b.createCardPolicyState)),_=ya(B.fetchState);r.useEffect(()=>{if(_==="In-Progress"&&B.fetchState==="Completed"&&p!=null)h.forEach(b=>{a(bt({chatSessionId:p,id:b.id,entityIds:d,kind:"created_policy"}))});else if(_==="In-Progress"&&B.fetchState==="Error"&&p!=null){h.forEach(T=>{a(bt({chatSessionId:p,id:T.id,kind:"errored_policy"}))});const b=B.error?.message!=null&&B.error.message.length>0?B.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b}]}))}},[B.error?.message,B.fetchState,a,p,d,h,_]);const k=x.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const j=x.archiveFetchState.fetchState,A=ya(j);r.useEffect(()=>{A==="In-Progress"&&j==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[j,a,A]);const I=r.useMemo(()=>x.templates.map(Oo),[x.templates]);Ft({isDataReady:x.fetchState.fetchState==="Completed"});const L=I.length>0||D>0,i=function(b){const{hasAnyPolicies:T,isChargeCardAdmin:Z,isFileUploadEnabled:q}=b,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:g}=mr(),F=Cr(),P=pr(),ee=o(ce=>Un(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=P&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ke=r.useCallback(()=>{g(!0)},[g]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!T&&Z)return{aiAgentName:Uo,headline:Ro,subheadline:Lo,promptChips:Se,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ke,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,T,ue,Z,q,ee,ne,Re,Ke,te,Ee,Ze,Se])}({hasAnyPolicies:L,isChargeCardAdmin:y,isFileUploadEnabled:R}),C=v&&i!=null?c.jsx(hr,{...i}):null,N=u&&C==null,G=r.useCallback(()=>{const b=_e(n.state?.pathnameStackToGoBack),T=b.poppedPathname??"..";e(T,{state:{pathnameStackToGoBack:b.newStack}})},[n.state,e]),U=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),O=r.useCallback(b=>{t!=null&&e(`/${t}/cards/policy/${b}/edit`)},[e,t]),z=r.useCallback(b=>{a(ks(b))},[a]),Y=x.fetchState.fetchState;return!L&&Y!=="Completed"&&Y!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Kc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:l,isAiCfoAccessEnabled:u,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Wc,{policies:I,archivingTemplateId:x.archiveTargetTemplateId,pendingCreationCount:D,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:O,onArchivePolicyClick:z,onClickMenuIcon:l,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:M})]})}function Mo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),y=Fe(),f=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[w,l]=r.useState(!1),m=o(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(K.isChargeCardFeatureEnabled),u=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(K.isDebitCardFeatureEnabled),x=we(s),B=ve(s),p=Te(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),d=Be({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:v,isBookKeepingTenant:B,isDebitCardProductVisible:D,chargeCardsCreditAccountLimit:h}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>oa(W,s.companyId)),j=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(W=>da(W)),L=o(W=>W.classListState.fetchState),i=!R&&d&&u,C=o(W=>_t(W,n,i,d)),[N,G]=r.useState(!1),U=C.chargeCard,O=U?.cardCreatedByUser?.userId,z=o(W=>O!=null?za(W.userRoleState,O):void 0),Y=z?.accountingClassIDs[0],b=o(W=>Y!=null?Ya(W.classState,{classId:Y,reportId:"class_list"}):void 0),T=U?.cardHolderUser?.userId,Z=o(W=>T!=null?za(W.userRoleState,T):void 0),q=Z?.accountingClassIDs[0],E=o(W=>q!=null?Ya(W.classState,{classId:q,reportId:"class_list"}):void 0),V=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",Q=U?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&w===!1&&V&&(l(!0),setTimeout(()=>{t(Za()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,w,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,i,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&U?.status?.code!=="active"||U?.cardHolderUserId!==a.userId||m===!1&&w===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const W=Ae(s.tenantEmailDomain,n,a,U,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&d&&u&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&d&&u&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,d,u,f,L]);const X=()=>{if(a!=null&&n!=null){t(Za());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},g=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",F=Je(d,D,_,u),P=Ba(d,u,f,A,I),ee=yr(g,C);return C.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:d,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:u,productInformation:F,creditAccountInformation:P,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:b?.className,cardHolderRoles:Z?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",No="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Vo=[La,Ra],Ho=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(Jc);function Go(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(M=>fe(M)),{useFeatureGate:y}=le(),{isFeatureEnabled:f}=y(K.isCardsCommentingEnabled),[S,w]=r.useState(!1),l=o(M=>la(M)),m=Ar(s.companyId,{clearParams:l.fetchState==="Completed"}),R=r.useCallback(()=>{const M=_e(t.state?.pathnameStackToGoBack),x=M.poppedPathname??$o(s.tenantEmailDomain);e(x,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(jt({events:Ca(v,Vo),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||l.fetchState==="Completed"||l.fetchState==="In-Progress"||(w(!0),n(_a()))},[S,l,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const u=l.cashbackSummary?.cashbackEarned?.amount!=null&&l.fetchState!=="Not-Started";return l.fetchState!=="In-Progress"||u?(l.cashbackSummary?.cashbackEarned?.amount??0)===0&&l.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(Ho,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Qc,{onBackClick:R})}const $o=e=>`/${e}/cards`,zo={containerWidth:new Fa(100,58)},Yo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f}=le(),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(!1),x=re.getSignedInUser();if(x==null)throw Error("Can't access onboarding card page without signing in...");const B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(Ye.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,D=o(E=>As(E,s)),d=D.chargeCard,_=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),I=Te(A,B),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),i=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),U=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:j,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:U}),z=!C&&O&&i;r.useEffect(()=>{S===!1&&_!=="In-Progress"&&_!=="Completed"&&(t(Ja()),w(!0)),l===!1&&D.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,O)))},[l,D.fetchState,S,_]);const Y=d?.type.code==="business_physical_credit_card"||d?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(R===!1&&(Y===!1||Y&&d?.status?.code!=="inactive"||d?.cardHolderUserId!==x.userId)){const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&D.isRefreshingViewInBackground===!1&&d?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[D.fetchState,d?.type.code,R,D.isRefreshingViewInBackground]);const b=re.getZeniOtpTokenForCardHolder(s),T=o(E=>Mn(E.userState,x.userId)),Z=()=>{d?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{D.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&d?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Z,3e3),v(!0))},[D.updatePhysicalChargeCardAttemptFetchState.fetchState,d?.cardActivationAttemptHistory]);const q=E=>{M(E)};if(_!=="Completed"||d==null)return c.jsx(va,{fetchState:"In-Progress"});if(d.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(T?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Wo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:u,handleDrawerToggle:q}),c.jsx(Zo,{cardId:s,card:d,shippingAddressId:d.shippingAddressId,phone:T.phone,signedInUser:x,isSandboxEnv:xt(),chargeCardDetailState:D,signedInUserToken:b,navigate:a,currentTenant:B,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(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=_s(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),S=n.updateStatus,w=ua(e,!1,!1,!1);let l=!1;w.fetchState==="Completed"&&w.cards.length<=1&&(l=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:l,shippingAddress:y,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:l=>{e(vs(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("onboard")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(Xc),Ko=Ne.div`
|
|
1
|
+
import{j as c}from"./liveblocks-UQZFqaDN.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as ba,s as Dt,n as De,t as In,o as es,p as se}from"./core-Ctjv24YM.js";import{bt as Pe,RQ as as,RR as ts,eX as un,RS as kn,f4 as En,RT as An,RU as Dn,RV as _n,RW as Pn,f5 as wn,f6 as vn,RX as Tn,fg as Fn,fh as $a,RY as xn,RZ as ns,fa as rs,f9 as ss,R_ as cs,B_ as Bn,fj as ca,R$ as os,S0 as is,eZ as ds,eY as ls,fv as ze,fc as Rn,fb as Ln,S1 as us,fd as ms,Bv as Cs,Bu as ps,By as hs,BA as fs,fo as gs,eU as Un,S2 as Ss,S3 as bs,ft as On,S4 as ys,fu as bt,BG as Is,BD as ks,eV as fe,S5 as Qa,fy as we,fz as ve,fA as Te,gt as oa,cv as ia,S6 as da,S7 as _t,uN as za,kC as Ya,S8 as Za,Ce as ka,Cg as Qe,Ch as Pt,ks as jn,S9 as la,C2 as _a,Sa as Es,Sb as As,C5 as Ja,Sc as Ds,Qb as Xa,ff as Mn,Cb as ga,hS as _s,Sd as Nn,Se as ua,bo as Ps,Sf as ws,ge as et,gd as at,CL as vs,gc as tt,PT as Ts,Sg as Vn,co as Hn,cQ as Fs,Qa as wa,Dk as Gn,Sh as mn,CW as Pa,Si as $n,Dl as xs,QA as Bs,Dm as Rs,Er as Ls,u8 as Us,El as Os,Sj as js,Cf as ra,Sk as Ms,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as wt,Sq as $s,Cw as zn,Cp as zs,Sr as Ys,gv as Zs,CF as Yn,CJ as Zn,gu as Ks,Ss as Ws,D6 as Kn,St as qs,Su as Qs,Sv as Js,CH as Wn,Cs as qn,C8 as Qn,CB as Jn,Cz as Xn,CD as Xs,Sw as er,Sx as ec,fq as ac,fr as tc,fs as nc,Sy as nt,fk as ar,cR as vt,Sz as rc,SA as sc,SB as cc,SC as oc,CR as yt,Dd as ic,D9 as dc,CN as lc,Db as uc,D1 as mc,D3 as Cc,SD as tr,Dj as Ga,Ka as pc,SE as hc,SF as fc,SG as gc,SH as nr,SI as Sc,DG as bc,CV as rr,CQ as je,CU as yc,SJ as Ic,SK as kc,B$ as Ec,SL as sr,fe as cr,SM as Ac,C1 as Dc,C0 as Cn,SN as _c,SO as Pc,SP as wc,MH as vc,SQ as Tt,SR as Tc,xN as or,la as Fc,hI as xc,DL as Bc,SS as ir,f1 as Rc,f2 as Lc,ST as Uc,dh as Oc,fi as jc,DB as Mc,Dv as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,LU as $c}from"./zeni-epic-state-ym9j-rvL.js";import{I as Fe,cp as dr,k as _e,cq as lr,cr as ur,cs as zc,a as Xe,Z as Ft,ct as Yc,cu as Zc,Q as mr,c as Cr,X as pr,s as ye,W as le,U as K,ar as ya,cv as hr,cw as Kc,cx as Wc,z as re,w as va,ce as rt,cy as qc,cz as Qc,cA as Jc,q as Ta,aQ as Ye,br as xt,cB as Xc,y as Fa,i as st,m as Bt,d as J,a7 as ct,cC as eo,bE as Sa,cD as It,cE as ao,x as Rt,cF as to,au as fr,a2 as kt,cG as no,V as gr,f as Sr,cH as ro,cI as so,cJ as co,cK as oo,cL as io,cM as lo,o as Ka,cN as uo,cO as mo,cP as pt,$ as Co,cQ as po,cR as ho,cS as fo,cT as go,cU as So,a9 as bo}from"./index-B2_u2l5p.js";import{n as Ne,D as br,S as yo}from"./mui-DU4JyJ-_.js";import{a as r}from"./sentry-C0E1AQIe.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Q4FV3LSW.js";import{M as Ie}from"./MobileAppDrawer-DOdKZ6eR.js";import{d as Lt}from"./recharts-RL5R0Iqz.js";import{g as Ae,a as Ba,b as yr,c as xe,d as Be,e as Je,f as ea,h as aa,A as Io,i as Ut,P as ko,j as Ot,s as Ia,k as Ir,l as sa,m as kr,n as Eo,o as Er,p as Ao,S as pn}from"./SetupPagesScreen-C883vxB-.js";import{u as Ar}from"./useInitialThreadRequest-iSw8uA8Y.js";import ot from"./NotFoundScreen-DMlQVohM.js";import{u as jt}from"./useChargeCardPusherEvents-HzaLnrlm.js";import{n as hn}from"./utils-hcCBORos.js";import{t as Do}from"./AddressScreen-B3VxKVsm.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./analyticsHelper-JD26-jfw.js";import"./routePaths-DQVLxXKn.js";import"./BusinessVerificationPageScreen-BoQL4-Oc.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]="a5636aca-02b8-4823-96dc-0cc560dadd01",e._sentryDebugIdIdentifier="sentry-dbid-a5636aca-02b8-4823-96dc-0cc560dadd01")}catch{}})();const _o=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}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:_o(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),Po=e=>Rn(e,!1),wo=e=>Ln(e.name,!1);function vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(P=>{S(P)},[]),l=r.useCallback(()=>{w(!0)},[w]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const v=o(P=>kn(P.cardPolicyState)),u=o(P=>En(P.cardPolicyState)),M=o(P=>An(P.cardPolicyState)),x=o(P=>Dn(P.cardPolicyState)),B=o(P=>_n(P.cardPolicyState)),p=o(P=>Pn(P.cardPolicyState)),h=o(P=>wn(P.cardPolicyState)),D=o(P=>vn(P.cardPolicyState)),d=o(P=>Tn(P.cardPolicyState)),_=o(P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(P=>P.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(Fn())},[a,v]),r.useEffect(()=>{D==="Completed"&&d===""||D==="In-Progress"||a($a())},[a,D,d]);const j=o(P=>xn(P.createCardPolicyState)),A=o(P=>ns(P.createCardPolicyState)),I=o(P=>rs(P.cardPolicyState)),L=o(P=>ss(P.cardPolicyState)),i=o(P=>cs(P.createCardPolicyState)),C=o(P=>Bn(P));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>u.map(Po),[u]),G=r.useMemo(()=>h.map(wo),[h]),U=r.useMemo(()=>C.cards.filter(P=>!dr(P.status.code)).map(Dr),[C.cards]),O=v==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{O&&i==null&&a(os({cardsMasterList:U,defaultRequireReceiptAmount:_,suggestedAllowMerchants:M,suggestedBlockMerchants:x,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,O,i,U,_,M,x,B,p]);const z=r.useMemo(()=>Lt(P=>{a($a(P))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Y=r.useCallback(P=>{z(P)},[z]),b=j.fetchState,T=t!=null?`/${t}/cards/policy`:"..",Z=r.useCallback(()=>{const P=_e(n.state?.pathnameStackToGoBack),ee=P.poppedPathname??T;e(ee,{state:{pathnameStackToGoBack:P.newStack}})},[n.state,e,T]),q=r.useCallback(()=>{e(T)},[e,T]),E=r.useCallback(P=>{a(is(P))},[a]),V=r.useCallback(P=>{const ee=lr(P);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(P=>{P.length!==0&&a(ls(P))},[a]),X=r.useCallback(()=>{a(un())},[a]),g=r.useRef(b);r.useEffect(()=>{const P=g.current;g.current=b,b==="Completed"&&P!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))},[a,b,A,e,T]);const F=b==="Error"?j.error?.message??fn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?i==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Z,onClickMenuIcon:l,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(zc,{formDraft:i,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:D==="In-Progress",onVendorSearchTextChange:Y,submitState:b,submitErrorMessage:F,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Z,onCancelClick:q,onClickMenuIcon:l,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:To}}}=Xe.getLocalizedStrings(),Fo=e=>Rn(e,!1),xo=e=>Ln(e.name,!1);function Bo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),y=Fe(),f=Pe(y?.loggedInUserRoleMap),[S,w]=r.useState(!1),l=r.useCallback(F=>{w(F)},[]),m=r.useCallback(()=>{l(!0)},[l]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),u=o(F=>us(F)),M=o(F=>kn(F.cardPolicyState)),x=o(F=>En(F.cardPolicyState)),B=o(F=>An(F.cardPolicyState)),p=o(F=>Dn(F.cardPolicyState)),h=o(F=>_n(F.cardPolicyState)),D=o(F=>Pn(F.cardPolicyState)),d=o(F=>wn(F.cardPolicyState)),_=o(F=>vn(F.cardPolicyState)),k=o(F=>Tn(F.cardPolicyState)),j=o(F=>Bn(F)),A=o(F=>a!=null?ms(F.cardPolicyState,a):void 0),I=r.useMemo(()=>u.templateId===a&&u.formDraft!=null?u.formDraft:A!=null?Cs(A):void 0,[u.templateId,u.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=u.detailFetchState.fetchState;u.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(ps(a))},[s,a,u.templateId,u.detailFetchState.fetchState,A]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(Fn())},[s,M]),r.useEffect(()=>{_==="Completed"&&k===""||_==="In-Progress"||s($a())},[s,_,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{j.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[j.fetchState,s]);const i=r.useMemo(()=>x.map(Fo),[x]),C=r.useMemo(()=>d.map(xo),[d]),N=r.useMemo(()=>j.cards.filter(F=>!dr(F.status.code)).map(Dr),[j.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Yc({draft:I,cardRows:N,categorySearchOptions:i,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:D})},[I,N,i,C,L,B,p,h,D]),[U,O]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||U!=null||G==null||(z.current=!0,O(G))},[U,G]);const Y=r.useCallback(F=>{O(F)},[]),b=r.useMemo(()=>Lt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{b.cancel()},[b]);const T=r.useCallback(F=>{b(F)},[b]),Z=u.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),P=F.poppedPathname??q;e(P,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const P=lr(F);s(hs(P)),s(fs(a))},[s,a]),X=r.useRef(Z);r.useEffect(()=>{const F=X.current;X.current=Z,Z==="Completed"&&F!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Z,e,q]);const g=Z==="Error"?u.updateFetchState.error?.message??To.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):U!=null&&M==="Completed"&&j.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(Zc,{templateName:u.template?.name??"",formDraft:U,vendorSearchOptions:C,categorySearchOptions:i,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:Z,submitErrorMessage:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:v,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Y,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:u.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:v})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ro,subheadline:Lo,pageTitle:Uo}}}}=Xe.getLocalizedStrings(),Oo=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 jo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(b=>{S(b)},[]),l=r.useCallback(()=>{w(!0)},[w]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),x=o(b=>Ss(b)),B=o(b=>xn(b.createCardPolicyState)),p=o(b=>bs(b.createCardPolicyState)),h=o(b=>p==null?[]:On(b.aiCfoState,p).filter(T=>T.kind==="creating_policy"),Dt),D=B.fetchState==="In-Progress"?Math.max(h.length,1):0,d=o(b=>ys(b.createCardPolicyState)),_=ya(B.fetchState);r.useEffect(()=>{if(_==="In-Progress"&&B.fetchState==="Completed"&&p!=null)h.forEach(b=>{a(bt({chatSessionId:p,id:b.id,entityIds:d,kind:"created_policy"}))});else if(_==="In-Progress"&&B.fetchState==="Error"&&p!=null){h.forEach(T=>{a(bt({chatSessionId:p,id:T.id,kind:"errored_policy"}))});const b=B.error?.message!=null&&B.error.message.length>0?B.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b}]}))}},[B.error?.message,B.fetchState,a,p,d,h,_]);const k=x.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const j=x.archiveFetchState.fetchState,A=ya(j);r.useEffect(()=>{A==="In-Progress"&&j==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[j,a,A]);const I=r.useMemo(()=>x.templates.map(Oo),[x.templates]);Ft({isDataReady:x.fetchState.fetchState==="Completed"});const L=I.length>0||D>0,i=function(b){const{hasAnyPolicies:T,isChargeCardAdmin:Z,isFileUploadEnabled:q}=b,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:g}=mr(),F=Cr(),P=pr(),ee=o(ce=>Un(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=P&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ke=r.useCallback(()=>{g(!0)},[g]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!T&&Z)return{aiAgentName:Uo,headline:Ro,subheadline:Lo,promptChips:Se,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ke,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,T,ue,Z,q,ee,ne,Re,Ke,te,Ee,Ze,Se])}({hasAnyPolicies:L,isChargeCardAdmin:y,isFileUploadEnabled:R}),C=v&&i!=null?c.jsx(hr,{...i}):null,N=u&&C==null,G=r.useCallback(()=>{const b=_e(n.state?.pathnameStackToGoBack),T=b.poppedPathname??"..";e(T,{state:{pathnameStackToGoBack:b.newStack}})},[n.state,e]),U=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),O=r.useCallback(b=>{t!=null&&e(`/${t}/cards/policy/${b}/edit`)},[e,t]),z=r.useCallback(b=>{a(ks(b))},[a]),Y=x.fetchState.fetchState;return!L&&Y!=="Completed"&&Y!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Kc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:l,isAiCfoAccessEnabled:u,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Wc,{policies:I,archivingTemplateId:x.archiveTargetTemplateId,pendingCreationCount:D,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:O,onArchivePolicyClick:z,onClickMenuIcon:l,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:M})]})}function Mo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),y=Fe(),f=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[w,l]=r.useState(!1),m=o(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(K.isChargeCardFeatureEnabled),u=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(K.isDebitCardFeatureEnabled),x=we(s),B=ve(s),p=Te(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),d=Be({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:v,isBookKeepingTenant:B,isDebitCardProductVisible:D,chargeCardsCreditAccountLimit:h}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>oa(W,s.companyId)),j=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(W=>da(W)),L=o(W=>W.classListState.fetchState),i=!R&&d&&u,C=o(W=>_t(W,n,i,d)),[N,G]=r.useState(!1),U=C.chargeCard,O=U?.cardCreatedByUser?.userId,z=o(W=>O!=null?za(W.userRoleState,O):void 0),Y=z?.accountingClassIDs[0],b=o(W=>Y!=null?Ya(W.classState,{classId:Y,reportId:"class_list"}):void 0),T=U?.cardHolderUser?.userId,Z=o(W=>T!=null?za(W.userRoleState,T):void 0),q=Z?.accountingClassIDs[0],E=o(W=>q!=null?Ya(W.classState,{classId:q,reportId:"class_list"}):void 0),V=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",Q=U?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&w===!1&&V&&(l(!0),setTimeout(()=>{t(Za()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,w,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,i,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&U?.status?.code!=="active"||U?.cardHolderUserId!==a.userId||m===!1&&w===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const W=Ae(s.tenantEmailDomain,n,a,U,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&d&&u&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&d&&u&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,d,u,f,L]);const X=()=>{if(a!=null&&n!=null){t(Za());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},g=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",F=Je(d,D,_,u),P=Ba(d,u,f,A,I),ee=yr(g,C);return C.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:d,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:u,productInformation:F,creditAccountInformation:P,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:b?.className,cardHolderRoles:Z?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",No="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Vo=[La,Ra],Ho=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(Jc);function Go(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(M=>fe(M)),{useFeatureGate:y}=le(),{isFeatureEnabled:f}=y(K.isCardsCommentingEnabled),[S,w]=r.useState(!1),l=o(M=>la(M)),m=Ar(s.companyId,{clearParams:l.fetchState==="Completed"}),R=r.useCallback(()=>{const M=_e(t.state?.pathnameStackToGoBack),x=M.poppedPathname??$o(s.tenantEmailDomain);e(x,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(jt({events:Ca(v,Vo),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||l.fetchState==="Completed"||l.fetchState==="In-Progress"||(w(!0),n(_a()))},[S,l,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const u=l.cashbackSummary?.cashbackEarned?.amount!=null&&l.fetchState!=="Not-Started";return l.fetchState!=="In-Progress"||u?(l.cashbackSummary?.cashbackEarned?.amount??0)===0&&l.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(Ho,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Qc,{onBackClick:R})}const $o=e=>`/${e}/cards`,zo={containerWidth:new Fa(100,58)},Yo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f}=le(),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(!1),x=re.getSignedInUser();if(x==null)throw Error("Can't access onboarding card page without signing in...");const B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(Ye.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,D=o(E=>As(E,s)),d=D.chargeCard,_=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),I=Te(A,B),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),i=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),U=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:j,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:U}),z=!C&&O&&i;r.useEffect(()=>{S===!1&&_!=="In-Progress"&&_!=="Completed"&&(t(Ja()),w(!0)),l===!1&&D.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,O)))},[l,D.fetchState,S,_]);const Y=d?.type.code==="business_physical_credit_card"||d?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(R===!1&&(Y===!1||Y&&d?.status?.code!=="inactive"||d?.cardHolderUserId!==x.userId)){const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&D.isRefreshingViewInBackground===!1&&d?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[D.fetchState,d?.type.code,R,D.isRefreshingViewInBackground]);const b=re.getZeniOtpTokenForCardHolder(s),T=o(E=>Mn(E.userState,x.userId)),Z=()=>{d?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{D.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&d?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Z,3e3),v(!0))},[D.updatePhysicalChargeCardAttemptFetchState.fetchState,d?.cardActivationAttemptHistory]);const q=E=>{M(E)};if(_!=="Completed"||d==null)return c.jsx(va,{fetchState:"In-Progress"});if(d.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(T?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Wo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:u,handleDrawerToggle:q}),c.jsx(Zo,{cardId:s,card:d,shippingAddressId:d.shippingAddressId,phone:T.phone,signedInUser:x,isSandboxEnv:xt(),chargeCardDetailState:D,signedInUserToken:b,navigate:a,currentTenant:B,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(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=_s(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),S=n.updateStatus,w=ua(e,!1,!1,!1);let l=!1;w.fetchState==="Completed"&&w.cards.length<=1&&(l=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:l,shippingAddress:y,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:l=>{e(vs(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("onboard")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(Xc),Ko=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${zo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-UQZFqaDN.js";import{a as g}from"./sentry-C0E1AQIe.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-Ctjv24YM.js";import{z as N,bc as P,x as F,d as V,f as j,af as b,bd as A,au as L,av as U,s as z}from"./index-B2_u2l5p.js";import{eV as D,gg as B,tz as M,gb as _,c6 as R,Pg as G,bn as Y,rz as H,rn as Q,l2 as Z,mD as S,Ph as $,bE as q,cy as C,mN as J,mQ as K}from"./zeni-epic-state-ym9j-rvL.js";import"./mui-DU4JyJ-_.js";import{d as W}from"./routePaths-DQVLxXKn.js";import{M as X}from"./MobileAppDrawer-DOdKZ6eR.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="1b7d0cd5-7a1a-4721-96b4-3973004aca60",n._sentryDebugIdIdentifier="sentry-dbid-1b7d0cd5-7a1a-4721-96b4-3973004aca60")}catch{}})();const ee=E(function(n){const t=_(n),i=N.getSignedInUser(),l=D(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(n,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(K())},onAddressClick:e=>{const a=W(f,e),o=z(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(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=>{n($(e))},onCompanyOfficerUpdated:e=>{n(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=>{n(Z({files:e}))},onDeleteFile:e=>{n(Q(e))},onEditFileName:(e,a)=>{n(H(e,a.split(".")[0]))}}})(A);function de(){const n=w(),t=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),a=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||a!=="Not-Started"||d==null||(p(!0),t(B(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(M())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(P,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-UQZFqaDN.js";import{a}from"./sentry-C0E1AQIe.js";import{u as w,g as D,j as m,N as v}from"./core-Ctjv24YM.js";import{LQ as _,eV as A,f_ as L,o6 as O,gp as E,fZ as j,fw as U,LX as F}from"./zeni-epic-state-ym9j-rvL.js";import{u as $,z as p,L as g,a as k,o as H}from"./index-B2_u2l5p.js";import{n as z}from"./mui-DU4JyJ-_.js";import{t as Q}from"./getLocaleForTenant-DSAEK88o.js";import{g as P,Q as R}from"./QBOConnectionScreen-BQZ2NFG-.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";import"./empty-BgBFHjf_.js";import"./pdf-lib-BWuwD2_b.js";import"./index-DrylXWCT.js";import"./url-DASTrDxO.js";import"./index-B6LHkFfA.js";import"./decodeURIComponentSafe-Z8As9uQN.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]="29e09035-c883-4bb8-9937-baa69157deeb",t._sentryDebugIdIdentifier="sentry-dbid-29e09035-c883-4bb8-9937-baa69157deeb")}catch{}})();const V=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-UQZFqaDN.js";import{z as n}from"./index-B2_u2l5p.js";import{g as d}from"./QBOConnectionScreen-BQZ2NFG-.js";import"./sentry-C0E1AQIe.js";import{g as p,N as s}from"./core-Ctjv24YM.js";import"./zeni-epic-state-ym9j-rvL.js";import"./recharts-RL5R0Iqz.js";import"./mui-DU4JyJ-_.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";import"./empty-BgBFHjf_.js";import"./pdf-lib-BWuwD2_b.js";import"./index-DrylXWCT.js";import"./url-DASTrDxO.js";import"./index-B6LHkFfA.js";import"./decodeURIComponentSafe-Z8As9uQN.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-BTm1Abhx.js → CustomerOnboardingRoutes-DWKwUU9B.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-UQZFqaDN.js";import{t as ht,A as Me}from"./AddressScreen-B3VxKVsm.js";import St from"./NotFoundScreen-DMlQVohM.js";import{a as u}from"./sentry-C0E1AQIe.js";import{h as Ce,g as ke,u as H,i as Ie,j as x,N as j,n as Ee,l as bt,o as Ct,p as K}from"./core-Ctjv24YM.js";import{$ as _e,I as xe,z as $,W as Ae,U as M,B as kt,s as N,x as ae,d as G,ap as at,f as de,aq as It,q as Et,ar as Ne,i as Se,as as _t,o as $e,at as Ge,au as xt,av as ze,aw as At}from"./index-B2_u2l5p.js";import{eV as W,fS as vt,fA as ve,fy as Oe,bs as Ot,o4 as Tt,fO as wt,bS as Pt,tj as Dt,tm as Ft,MP as jt,MQ as Ut,MR as Bt,xH as Vt,Er as Rt,u8 as Lt,MS as Mt,k6 as be,k9 as ot,Mk as Nt,bY as $t,c6 as le,tN as Te,ty as Gt,MT as ue,tO as st,Kd as zt,la as it,MU as Qt,MV as Kt,rg as qt,hn as Zt,Mc as ge,hk as Ht,Md as Wt,xW as Xt,rk as Yt,hc as Jt,hf as Qe,MW as rt,MX as en,D_ as tn,MY as nn,E2 as an,tp as on,MZ as sn,M_ as rn,k4 as cn,k7 as dn,t_ as un,tA as ct,tM as ln,bE as Ke,cy as pn,tZ as qe,rz as mn,rn as gn,l2 as fn,ge as yn,gd as hn,gc as Sn,M$ as bn,ts as Cn,t$ as kn,u2 as In,u5 as En,ub as _n,cX as xn}from"./zeni-epic-state-ym9j-rvL.js";import{n as we}from"./mui-DU4JyJ-_.js";import{g as An,h as vn,q as oe}from"./QBOConnectionScreen-BQZ2NFG-.js";import{u as On}from"./useEmailConnectResultRefresh-Dym62Z_F.js";import{u as Tn}from"./useChargeCardPusherEvents-HzaLnrlm.js";import{u as wn}from"./plaid-Dtkg2fMC.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";import"./empty-BgBFHjf_.js";import"./pdf-lib-BWuwD2_b.js";import"./index-DrylXWCT.js";import"./url-DASTrDxO.js";import"./index-B6LHkFfA.js";import"./decodeURIComponentSafe-Z8As9uQN.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="c4494e92-5dea-41cb-9f27-f7c1e4335027",t._sentryDebugIdIdentifier="sentry-dbid-c4494e92-5dea-41cb-9f27-f7c1e4335027")}catch{}})();const Pn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const o=wt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Pt(o.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:o,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const l=N(c.state?.pathnameStackToGoBack,c.pathname);o("../../dashboard",{state:{pathnameStackToGoBack:l,message:"activation"}})}}})(It),Dn=()=>{const t=Ce(),s=ke(),n=H(),o=_e(),[c,l]=u.useState(!1),[h,k]=u.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),d=$.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:A}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:g}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:_}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:m}=p(M.isDebitCardFeatureEnabled),U=kt(),S=x(I=>W(I)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&vt(S.company),y=P&&V,b=x(I=>I.onboardingCustomerViewState.fetchState),v=S.excludedResources,B=S.companyId??$.getSignedInUserTenant(e)?.companyId;if(d==null)throw Error("Can't access onboarding flow without signing in...");const D=ve(m,S),O=Oe(S),w=[],q=v?.resources?.find(I=>I.resource==="/reports/top_expenses")==null,z=v?.resources?.find(I=>I.resource==="/reports/task_card")==null,X=S?.userRole!=null&&Ot(S?.userRole),Y=v?.resources?.find(I=>I.resource==="/bills")==null&&!X,Q=v?.resources?.find(I=>I.resource==="/reimbursements")==null;if(q===!1&&w.push("top_expenses"),z===!1&&w.push("task_card"),Y===!1&&w.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&w.push("reimbursement_card","reimbursement_promo_card"),g===!1&&w.push("zeni_accounts_promo_card"),_===!1&&w.push("rewards_card"),u.useEffect(()=>{b!=="Completed"||c||D||O||(l(!0),n(Tt(d.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,O,d,S.tenantId,n]),u.useEffect(()=>{(D||O)&&setTimeout(()=>{k(!0)},5e3)},[D,O]),b!=="Completed")return a.jsx(j,{to:"../"});if(b==="Completed"&&h){const I=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return a.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:I,message:"activation"}});if(O)return a.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:I,message:"activation"}})}return i?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(ae,{analytics:G,onLoad:I=>(F=>F.trackPageLoaded(de.Event.onboardingDashboardActivation))(I)}),a.jsx(Pn,{navigate:t,location:s,themeState:o,signedInUser:d,isApAgingFeatureEnabled:A,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:g,shouldFetchRewardsPlanCard:_,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:y,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):a.jsx(at,{})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ze=(t,s)=>{const n=new Map(t.map(o=>[o.key,o]));return s.map(o=>{return c=n.get(o)?.status,c==="starting"||c==="building"?c:"idle";var c})},He=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(o=>[o.key,o]));return s.every(o=>n.get(o)?.status==="ready")},Fn=new Set(Mt),We=we.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${t=>t.theme.colors.grey4};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-qa_6WStS.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-CJUY0MOY.js";import{eV as L,Ng as We,bE as ca,bo as xe,Ou as On,iY as Pn,Ov as Zt,Ow as Fn,i$ as _t,Ox as qe,Oy as Rn,j4 as Bn,Oz as qt,OA as jn,j8 as kt,OB as Qe,OC as Mn,co as vt,OD as Un,OE as Ln,NA as Gn,k0 as Vn,OF as Yn,bn as Xe,OG as la,N4 as ce,bc as da,ke as ua,oe as ma,jZ as pa,N6 as le,N5 as J,eU as ha,fo as Nn,g0 as St,OH as $n,OI as zn,OJ as fa,OK as Fe,vM as Ue,vN as Le,w8 as De,w2 as de,vR as Ge,OL as Kn,OM as Zn,ON as qn,OO as ga,OP as Re,OQ as Qn,dI as Je,s7 as ba,OR as Hn,OS as Wn,OT as Xn,OU as At,Mm as It,ku as we,wg as Et,sf as Jn,OV as eo,vO as Qt,sa as Ee,s6 as Ca,OW as ge,OX as to,OY as Tt,Ml as xt,uf as _a,OZ as ao,O_ as no,O$ as oo,P0 as Dt,us as so,P1 as ro,vQ as Ht,ue as ka,P2 as be,P3 as io,bs as Sa,wk as ya,P4 as co,P5 as lo,P6 as uo,P7 as wt,wf as mo,P8 as po,vP as Wt,wj as va,P9 as Ce,Pa as ho,Pb as fo,Pc as Aa,kj as Ia,ob as Ea,ko as Ta,o9 as xa,o8 as Da,o7 as wa,tD as go,fS as bo,cR as Co,cS as _o,o4 as ko,fO as So,ol as yo,Gy as ut,Gq as vo,Gu as Ao,Pd as Io,Pe as Eo,Pf as To,b5 as et,fG as xo,hG as Do,gg as wo,of as Oo,jS as Po,oc as Fo,oa as Ro,fA as Bo,fy as jo}from"./zeni-epic-state-Da9EwYbz.js";import{z as M,a2 as te,s as D,d as T,a as Z,aY as Mo,Z as Ve,x as Ye,aZ as Oa,f as N,a_ as Uo,I as ke,a$ as Pa,W as Se,U as B,m as Lo,b0 as Go,b1 as Vo,Q as Fa,q as Ra,c as Ba,X as Yo,b2 as No,K as $o,aQ as ja,_ as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,B as Zo,ar as qo,k as Qo,V as Ho,b7 as Wo,b8 as Xo,b9 as Jo,ba as es,bb as _e}from"./index-B2ukUPdb.js";import{n as Ot}from"./mui-CkYYTJAV.js";import{a as b}from"./sentry-BTf2Dtmp.js";import{w as Ga}from"./withTransactionSidePanel-RlHJMQ4A.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-DbnM8jAc.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-DUCZkKew.js";import Me from"./NotFoundScreen-DTvgxtkb.js";import{u as Ft}from"./useInitialThreadRequest-CcPLE3h6.js";import{t as Ya}from"./analyticsHelper-DE1SyLO3.js";import{C as as}from"./CompanyPassportScreen-Z-knYrxv.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-C9aknKEV.js";import{F as os}from"./FeaturePreviewScreen-DCDhII3I.js";import{R as ss}from"./ReferralListScreen-BQiDRb4Q.js";import"./recharts-D3JK2Byj.js";import"./analytics-BToIaEuE.js";import"./plaid-1xV6OFdB.js";import"./dnd-LV5QvpgJ.js";import"./stripe-DMRn4zHo.js";import"./lottie-zGjtu-Uw.js";import"./lexical-Cmpx8sPR.js";import"./pdf-CZjXUklc.js";import"./utils-Bd6aVUzu.js";import"./TransactionDetailScreen-qgLSqSNT.js";import"./decodeURIComponentSafe-BXzU7C-M.js";import"./MobileAppDrawer-CDYOk1Tu.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]="c04cb67b-c185-48a3-9640-80a5e0a2b819",e._sentryDebugIdIdentifier="sentry-dbid-c04cb67b-c185-48a3-9640-80a5e0a2b819")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),v=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const U=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
|
|
1
|
+
import{j as d}from"./liveblocks-UQZFqaDN.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Ctjv24YM.js";import{eV as L,Ng as We,bE as ca,bo as xe,Ou as On,iY as Pn,Ov as Zt,Ow as Fn,i$ as _t,Ox as qe,Oy as Rn,j4 as Bn,Oz as qt,OA as jn,j8 as kt,OB as Qe,OC as Mn,co as vt,OD as Un,OE as Ln,NA as Gn,k0 as Vn,OF as Yn,bn as Xe,OG as la,N4 as ce,bc as da,ke as ua,oe as ma,jZ as pa,N6 as le,N5 as J,eU as ha,fo as Nn,g0 as St,OH as $n,OI as zn,OJ as fa,OK as Fe,vM as Ue,vN as Le,w8 as De,w2 as de,vR as Ge,OL as Kn,OM as Zn,ON as qn,OO as ga,OP as Re,OQ as Qn,dI as Je,s7 as ba,OR as Hn,OS as Wn,OT as Xn,OU as At,Mm as It,ku as we,wg as Et,sf as Jn,OV as eo,vO as Qt,sa as Ee,s6 as Ca,OW as ge,OX as to,OY as Tt,Ml as xt,uf as _a,OZ as ao,O_ as no,O$ as oo,P0 as Dt,us as so,P1 as ro,vQ as Ht,ue as ka,P2 as be,P3 as io,bs as Sa,wk as ya,P4 as co,P5 as lo,P6 as uo,P7 as wt,wf as mo,P8 as po,vP as Wt,wj as va,P9 as Ce,Pa as ho,Pb as fo,Pc as Aa,kj as Ia,ob as Ea,ko as Ta,o9 as xa,o8 as Da,o7 as wa,tD as go,fS as bo,cR as Co,cS as _o,o4 as ko,fO as So,ol as yo,Gy as ut,Gq as vo,Gu as Ao,Pd as Io,Pe as Eo,Pf as To,b5 as et,fG as xo,hG as Do,gg as wo,of as Oo,jS as Po,oc as Fo,oa as Ro,fA as Bo,fy as jo}from"./zeni-epic-state-ym9j-rvL.js";import{z as M,a2 as te,s as D,d as T,a as Z,aY as Mo,Z as Ve,x as Ye,aZ as Oa,f as N,a_ as Uo,I as ke,a$ as Pa,W as Se,U as B,m as Lo,b0 as Go,b1 as Vo,Q as Fa,q as Ra,c as Ba,X as Yo,b2 as No,K as $o,aQ as ja,_ as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,B as Zo,ar as qo,k as Qo,V as Ho,b7 as Wo,b8 as Xo,b9 as Jo,ba as es,bb as _e}from"./index-B2_u2l5p.js";import{n as Ot}from"./mui-DU4JyJ-_.js";import{a as b}from"./sentry-C0E1AQIe.js";import{w as Ga}from"./withTransactionSidePanel-DL6O8tOb.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-DQVLxXKn.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-Q4FV3LSW.js";import Me from"./NotFoundScreen-DMlQVohM.js";import{u as Ft}from"./useInitialThreadRequest-iSw8uA8Y.js";import{t as Ya}from"./analyticsHelper-JD26-jfw.js";import{C as as}from"./CompanyPassportScreen-D9FdVjLZ.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-B_thEjYk.js";import{F as os}from"./FeaturePreviewScreen-DttBoo3w.js";import{R as ss}from"./ReferralListScreen-DoHN-iLK.js";import"./recharts-RL5R0Iqz.js";import"./analytics-BlxwN6GD.js";import"./plaid-Dtkg2fMC.js";import"./dnd-DdE4ICzz.js";import"./stripe-DMRn4zHo.js";import"./lottie-h9wdJ9gi.js";import"./lexical-z-P2V9ug.js";import"./pdf-BK4Cbxeo.js";import"./utils-hcCBORos.js";import"./TransactionDetailScreen-DHdS4J3N.js";import"./decodeURIComponentSafe-Z8As9uQN.js";import"./MobileAppDrawer-DOdKZ6eR.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]="c04cb67b-c185-48a3-9640-80a5e0a2b819",e._sentryDebugIdIdentifier="sentry-dbid-c04cb67b-c185-48a3-9640-80a5e0a2b819")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),v=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const U=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|