@zeniai/web-app-ui 5.2.19-prod → 5.2.19-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-4d0GG7rG.js +1 -0
- package/dist/assets/{AddressScreen-CGTYstNo.js → AddressScreen-C1-59DB9.js} +1 -1
- package/dist/assets/{AiCfoScreen-CA8qqox4.js → AiCfoScreen-BDXW1pEG.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-guz2sdH1.js → BillPayApprovalRoutes-DNMaV2B3.js} +1 -1
- package/dist/assets/{BillPayRoutes-D0Ag3ATI.js → BillPayRoutes-nY9e-Ucu.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-BohezKn6.js → BusinessVerificationPageScreen-D2eu1jQC.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-GOQqQudn.js → CardsAiCfoScreen-B5bn7At3.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-C3e575qW.js → ChargeCardRoutes-DY752I-e.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-CxVFTUSz.js → CompanyPassportScreen-XItKjSib.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-CDBmxiL_.js → ConnectionAuthScreen-tEXIUU8s.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-WJgYXVGO.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-C6q0UB9j.js → CustomerOnboardingRoutes-DXg0Kf-I.js} +1 -1
- package/dist/assets/{DashboardRoutes-BCmwgis8.js → DashboardRoutes-X4CuSvKN.js} +1 -1
- package/dist/assets/{DefaultTenantHome-CC2FeaFy.js → DefaultTenantHome-3tZYTtZs.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-qVcyg1bS.js → DomesticWireDetailScreen-KZF7LYi4.js} +1 -1
- package/dist/assets/{DrawerScreen-YrXahOEM.js → DrawerScreen-C8ShIsGs.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-CteWzOFU.js → EntityDetailRoutes-CaaXRLoy.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-ChtLHwSX.js → ExpenseAutomationRoutes-B9Ri_GEg.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-C_bWMNSt.js → FeaturePreviewScreen-Df-HjHKO.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-CFlu3uRE.js → HubSpotOAuthCallbackScreen-C_AMn_zI.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-B6CyGV5n.js → MagicLinkRoutes-BTE6ILsC.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-CU5qkDL2.js → MagicLinkSignInScreen-BoZkLiIF.js} +1 -1
- package/dist/assets/{MobileAppDrawer-O95nPlSQ.js → MobileAppDrawer-DKR412hC.js} +1 -1
- package/dist/assets/NotFoundScreen-DVitp65R.js +1 -0
- package/dist/assets/{NotificationRoutes-dRraueia.js → NotificationRoutes-CUhoGF8j.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-CRSd0T8_.js → OAuthConsentScreen-CKk9r_kv.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-DdDF5n8o.js → PandLWithForecastRoutes-DDCfsce9.js} +1 -1
- package/dist/assets/{PeopleRoutes-DPUju30P.js → PeopleRoutes-D8NzEF0b.js} +1 -1
- package/dist/assets/{PerformanceRoutes-BSNXb7w3.js → PerformanceRoutes-D6q2fbPJ.js} +1 -1
- package/dist/assets/{Preview-CxHKvNb3.js → Preview-N8JE4dsu.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-vAHPaqo7.js → QBOConnectionScreen-B7QYuZy-.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-DhrGnU7Q.js → ReimbursementApprovalRoutes-CuqLUiW5.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BdQmAA7j.js → ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-OiL1KOsA.js → ReimbursementRoutes-D12Jt1bi.js} +1 -1
- package/dist/assets/{ReportsRoutes-cJ_74y1a.js → ReportsRoutes-BxecWoyx.js} +1 -1
- package/dist/assets/{RewardsRoutes-DaWb-BQo.js → RewardsRoutes-C4bn-KvF.js} +1 -1
- package/dist/assets/{ScreenRoutes-CRY8MlH6.js → ScreenRoutes-BNvEvG7L.js} +2 -2
- package/dist/assets/{SettingsRoutes-B0QfLxKl.js → SettingsRoutes-CN172aq_.js} +1 -1
- package/dist/assets/{SetupPagesScreen-DqGd8bGY.js → SetupPagesScreen-CiLpjjGD.js} +1 -1
- package/dist/assets/{SignInScreen-wUhLdLU-.js → SignInScreen-BQwWdLEK.js} +1 -1
- package/dist/assets/{SignOutScreen-BChwhvvy.js → SignOutScreen-DHYljL7t.js} +1 -1
- package/dist/assets/{TaskListScreen-q9ElonDb.js → TaskListScreen-B5yPteB2.js} +1 -1
- package/dist/assets/{TaskRoutes-B9S8VECk.js → TaskRoutes-I9rTbqEa.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-D9ZuqZEq.js → TransactionDetailRoutes-zN1P9Vz7.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-B77dqrVQ.js → TransactionDetailScreen-oIg47Woo.js} +1 -1
- package/dist/assets/{TransactionListRoutes-t_0rbITT.js → TransactionListRoutes-D_krEmlB.js} +1 -1
- package/dist/assets/{TreasuryRoutes-C2A809wv.js → TreasuryRoutes-B0g2RVn5.js} +1 -1
- package/dist/assets/{VendorsRoutes-Ba7d72j7.js → VendorsRoutes-DkWJ1EKQ.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-AJ6Zf-xE.js → WiseConfirmationScreen-DQmSckNf.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-DdIrrwcf.js → ZeniAccountRoutes-VA9YYfkO.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-BUgkOPv6.js → ZeniAccountStatementScreen-Cr2gc08z.js} +1 -1
- package/dist/assets/{accountMappingHelper-BmtW64tm.js → accountMappingHelper-NsHFWNkE.js} +1 -1
- package/dist/assets/{analytics-C2MbRoEp.js → analytics-C1xZTLEH.js} +1 -1
- package/dist/assets/{analyticsHelper-DqO64pHt.js → analyticsHelper-C5WvAo12.js} +1 -1
- package/dist/assets/{core-D2KaS3N5.js → core-u1EteL-v.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CD_zntJd.js → decodeURIComponentSafe-CjfYiJlM.js} +1 -1
- package/dist/assets/{dnd-D-AkKI2c.js → dnd-CIbUDnZz.js} +1 -1
- package/dist/assets/{empty-D1hMU_8M.js → empty-Bplt_RAY.js} +1 -1
- package/dist/assets/{empty-ByGkxZf5.js → empty-C5PjC6g0.js} +1 -1
- package/dist/assets/{emptyVideoElement-B0o6h5Gb.js → emptyVideoElement-CZ_82B6H.js} +1 -1
- package/dist/assets/{epic-C_V7SCDP.js → epic-uTwIf-FI.js} +1 -1
- package/dist/assets/{getLocaleForTenant--JGxRDjE.js → getLocaleForTenant-BFNl-yVT.js} +1 -1
- package/dist/assets/{index-BQPo7Zt4.js → index-29ukruDR.js} +1 -1
- package/dist/assets/{index-BFVwI6w6.js → index-B35sRjQe.js} +1 -1
- package/dist/assets/{index-D6D50L1U.js → index-CQm_vnbZ.js} +1 -1
- package/dist/assets/{index-nz48Z_9j.js → index-D5nyNcPu.js} +2 -2
- package/dist/assets/{index-Dyy6NuL-.js → index-DFSTqcuc.js} +1 -1
- package/dist/assets/{index-CHRJI22G.js → index-Df8xDBDT.js} +1 -1
- package/dist/assets/{index-CjrIzFQ1.js → index-pof_GVZP.js} +1 -1
- package/dist/assets/{index-CivdpZRT.js → index-tOfK8iY_.js} +8 -8
- package/dist/assets/{lexical-BQ-Po3YF.js → lexical-BuHlG7c0.js} +1 -1
- package/dist/assets/{liveblocks-BBLi67DG.js → liveblocks-B_acMj2M.js} +1 -1
- package/dist/assets/{lottie-Dz6JZ58r.js → lottie-DvAqKpNG.js} +1 -1
- package/dist/assets/{mui-C1ThRyKO.js → mui-DMXXvJHn.js} +1 -1
- package/dist/assets/{pathToGoBack-Du20FI7g.js → pathToGoBack-Ch1k07_O.js} +1 -1
- package/dist/assets/{pdf-2k8d7AeQ.js → pdf-Wf7vPJje.js} +3 -3
- package/dist/assets/{pdf-lib-DqPqgk_2.js → pdf-lib-Cw5xvhae.js} +1 -1
- package/dist/assets/{plaid-Do7hhR27.js → plaid-BGfWuOr6.js} +1 -1
- package/dist/assets/{pusher-TY6R8jm6.js → pusher-D19Erbfh.js} +1 -1
- package/dist/assets/{react-Bfs0rs07.js → react-B7zdDwoo.js} +1 -1
- package/dist/assets/{react-D8jfsv_0.js → react-C2iLidGy.js} +1 -1
- package/dist/assets/{react-CCcFi-WD.js → react-C3pQy8tf.js} +1 -1
- package/dist/assets/{react-DPqkDk9u.js → react-C9GijZet.js} +1 -1
- package/dist/assets/{react-BReY6fnO.js → react-CYyUBnNb.js} +1 -1
- package/dist/assets/{react-CASCBfCG.js → react-Ee9ncfbZ.js} +1 -1
- package/dist/assets/{recharts-jHFM5Sob.js → recharts-REl-3xYX.js} +1 -1
- package/dist/assets/{routePaths-TRamKMNj.js → routePaths-FKPzluZv.js} +1 -1
- package/dist/assets/{sentry-DW4kKH26.js → sentry-B7X8e_7J.js} +1 -1
- package/dist/assets/{url-GR46giUc.js → url-CUjb-zqA.js} +1 -1
- package/dist/assets/{url-8bOSIiqX.js → url-DyzfdPsq.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CuA1dWGl.js → useAiCfoDashboardSuggestedQuestionsChips-Drsr1_x0.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-CNoSipqI.js → useAskAiCfoHostNavButtonProps-D-klSIXS.js} +1 -1
- package/dist/assets/{useCashManagementBanner-COk5CYpf.js → useCashManagementBanner-D-KRAuwc.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-9ezHPs6j.js → useChargeCardPusherEvents-HnTE12S3.js} +1 -1
- package/dist/assets/{useDeviceId-CHTVQQ8G.js → useDeviceId-CPotDJHg.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-Ddee2XH0.js → useEmailConnectResultRefresh-Csv2ipfu.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-UA6eH2dj.js → useInitialThreadRequest-B6H0CI2K.js} +1 -1
- package/dist/assets/{utils-DIwqH7uj.js → utils-ChVfPml3.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DWx4OX2G.js → withTransactionSidePanel-DKYByGkd.js} +1 -1
- package/dist/assets/{zeni-epic-state-BJ_gdj7r.js → zeni-epic-state-DiB-ZYnx.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AddressRoutes-B7ET6G-y.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-DbN5QLGb.js +0 -1
- package/dist/assets/NotFoundScreen-BeJq256C.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-B_acMj2M.js";import{A as d}from"./AddressScreen-C1-59DB9.js";import i from"./NotFoundScreen-DVitp65R.js";import"./sentry-B7X8e_7J.js";import{o as s,p as r}from"./core-u1EteL-v.js";import"./zeni-epic-state-DiB-ZYnx.js";import"./recharts-REl-3xYX.js";import"./index-tOfK8iY_.js";import"./mui-DMXXvJHn.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.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 r}from"./liveblocks-
|
|
1
|
+
import{j as r}from"./liveblocks-B_acMj2M.js";import{a as h}from"./sentry-B7X8e_7J.js";import{h as T,u as _,g as E,i as j,j as B,n as $}from"./core-u1EteL-v.js";import{K as M,y as D,z as K,e as L,B as N,C as R,f as C,h as S,n as z,k as b,p as F}from"./index-tOfK8iY_.js";import{N2 as k,h$ as U,eZ as G,N3 as O,c7 as V,N4 as q,lm as H}from"./zeni-epic-state-DiB-ZYnx.js";import{n as Z}from"./mui-DMXXvJHn.js";import J from"./NotFoundScreen-DVitp65R.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]="4d73ce55-b89f-4083-b8c7-6d32edde93d6",e._sentryDebugIdIdentifier="sentry-dbid-4d73ce55-b89f-4083-b8c7-6d32edde93d6")}catch{}})();const Q=Z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BBLi67DG.js";import{a as r}from"./sentry-DW4kKH26.js";import{u as xe,h as Pe,g as we,j as J,i as ye,n as Ee}from"./core-D2KaS3N5.js";import{Z as Te,de as ve,z as Ae,K as Qe,df as _e,dg as Ue,bb as X,dh as se,di as Oe,ba as ae,p as V,C as R,f as I,dj as B,dk as je,dl as Fe,a3 as Le,h as De,a9 as Re,dm as Be,dn as Me,a4 as Ve,dp as $e,dq as Ge,dr as Ne,r as qe,b6 as ze,ds as He}from"./index-CivdpZRT.js";import{gp as We,eY as oe,eZ as Ye,iH as Ze,Ug as Ke,fs as Je,iR as Xe,iN as et,e_ as M,fz as tt,g8 as st,g9 as at,g1 as ot,g5 as ee,ga as nt,gb as it,gc as rt,gd as lt,ge as dt,gf as ct}from"./zeni-epic-state-BJ_gdj7r.js";import{D as ut,n as k,S as mt,P as pt}from"./mui-C1ThRyKO.js";import{u as ht}from"./useAiCfoDashboardSuggestedQuestionsChips-CuA1dWGl.js";import{p as St}from"./pathToGoBack-Du20FI7g.js";import"./recharts-jHFM5Sob.js";import"./analytics-C2MbRoEp.js";import"./plaid-Do7hhR27.js";import"./dnd-D-AkKI2c.js";import"./stripe-cKAAJElX.js";import"./lottie-Dz6JZ58r.js";import"./lexical-BQ-Po3YF.js";import"./pdf-2k8d7AeQ.js";import"./utils-DIwqH7uj.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]="44841d80-7306-4161-9b1b-dfced4f377bd",e._sentryDebugIdIdentifier="sentry-dbid-44841d80-7306-4161-9b1b-dfced4f377bd")}catch{}})();const ne="chat-response-generated",gt=Ee((function(e,o){const t=oe(e),m=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Me(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:m,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ve}/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,skills:st(e).skills,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}}),(function(e,o){const{location:t,currentTenant:m,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,p=m.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=rt(d.type),u=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,u);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,u,He(A,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,lt(d.visualization?.type??"")??null,u,d.summarized_title,d.metadata.message_id??null),e(dt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ct({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g,u)=>{a&&ze(e,a,l,S,x,s,g,d,void 0,u)},onFetchSkills:()=>{e(it())},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(nt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??St(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${m.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(ot());const a=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(at({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${p}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${p}/cards/policy`,{state:{...t.state}})}})}}))(Re(Be)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),m=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect((()=>{t(We())}),[t]);const p=J((i=>oe(i))),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Le(d),u=J((i=>Ye(i))),n=p.uiState.currentChatSessionId,P=u.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:u,currentChatSessionId:n,aiCfoView:p}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=ht(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect((()=>{const i=s.state;if(i?.[X]!==!0)return;S(!0);const f={...i};delete f[X],m(s,{replace:!0,state:f})}),[s.pathname,s.search,s.state,m]);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),m(s.pathname,{replace:!0,state:se(s.state)})}),[s.pathname,s.state,m]),N=r.useMemo((()=>new URLSearchParams(s.search)),[s.search]),q=N.get("ref")??w?.aiCfoRef,F=N.get("emailRefId")??w?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect((()=>{z.current||q!=="month-end-email"||F==null||n!=null||a==null||(t(Ze("controller",a.userId,F,"MONTH_END_EMAIL")),z.current=!0)}),[q,F,n,t,a]);const E=p.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=u.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:H}=Oe(n),L=p.fetchState,D=p.uiState.chatSessionsNextPageToken.hasMore||!p.uiState.chatSessionsFirstPageFetched,W=n!=null?p.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(p.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),Z=p.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(Z,n),ge=Se.length===0;r.useEffect((()=>{C||g||m("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})}),[C,g,m,s.state]);const fe=r.useCallback((()=>{const i=V(s.state?.pathnameStackToGoBack),f=u.tenantEmailDomain;m(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})}),[u.tenantEmailDomain,s.state,m]);r.useEffect((()=>{n!=null&&l!==n&&m(`../ai-cfo/${n}`,{state:{...s.state}})}),[n,l]),r.useEffect((()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Je({sessionId:l,agentId:"controller"}))}),[]);const Ce=r.useMemo((()=>({events:H.map((i=>`private-encrypted-chat-${i}.${ne}`)),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)})),[H]);r.useEffect((()=>{L!=="In-Progress"&&D&&t(Xe())}),[L,D,t]),r.useEffect((()=>{n!=null&&W!=="In-Progress"&&Y&&a!=null&&L==="Completed"&&!D&&t(et(n,a.userId))}),[W,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&&p.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(Ct,{children:[c.jsx(R,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(bt,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:p.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{u.userRoleId!=null&&t(M(u.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(R,{analytics:I,onLoad:K}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:p.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||u.userRoleId==null||t(M(u.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(ft,{children:[c.jsx(R,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(gt,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:Z,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:m,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:u,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(ut,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:It,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:p.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||u.userRoleId==null||t(M(u.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Fe,{children:Ie})}):null]})},te=k(mt)`
|
|
1
|
+
import{j as c}from"./liveblocks-B_acMj2M.js";import{a as r}from"./sentry-B7X8e_7J.js";import{u as xe,h as Pe,g as we,j as J,i as ye,n as Ee}from"./core-u1EteL-v.js";import{Z as Te,de as ve,z as Ae,K as Qe,df as _e,dg as Ue,bb as X,dh as se,di as Oe,ba as ae,p as V,C as R,f as I,dj as B,dk as je,dl as Fe,a3 as Le,h as De,a9 as Re,dm as Be,dn as Me,a4 as Ve,dp as $e,dq as Ge,dr as Ne,r as qe,b6 as ze,ds as He}from"./index-tOfK8iY_.js";import{gp as We,eY as oe,eZ as Ye,iH as Ze,Ug as Ke,fs as Je,iR as Xe,iN as et,e_ as M,fz as tt,g8 as st,g9 as at,g1 as ot,g5 as ee,ga as nt,gb as it,gc as rt,gd as lt,ge as dt,gf as ct}from"./zeni-epic-state-DiB-ZYnx.js";import{D as ut,n as k,S as mt,P as pt}from"./mui-DMXXvJHn.js";import{u as ht}from"./useAiCfoDashboardSuggestedQuestionsChips-Drsr1_x0.js";import{p as St}from"./pathToGoBack-Ch1k07_O.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.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]="44841d80-7306-4161-9b1b-dfced4f377bd",e._sentryDebugIdIdentifier="sentry-dbid-44841d80-7306-4161-9b1b-dfced4f377bd")}catch{}})();const ne="chat-response-generated",gt=Ee((function(e,o){const t=oe(e),m=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Me(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:m,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ve}/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,skills:st(e).skills,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}}),(function(e,o){const{location:t,currentTenant:m,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,p=m.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=rt(d.type),u=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,u);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,u,He(A,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,lt(d.visualization?.type??"")??null,u,d.summarized_title,d.metadata.message_id??null),e(dt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(ct({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g,u)=>{a&&ze(e,a,l,S,x,s,g,d,void 0,u)},onFetchSkills:()=>{e(it())},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(nt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??St(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=V(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${m.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(ot());const a=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(at({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${p}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${p}/cards/policy`,{state:{...t.state}})}})}}))(Re(Be)),Rt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),m=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect((()=>{t(We())}),[t]);const p=J((i=>oe(i))),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Le(d),u=J((i=>Ye(i))),n=p.uiState.currentChatSessionId,P=u.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:u,currentChatSessionId:n,aiCfoView:p}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=ht(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect((()=>{const i=s.state;if(i?.[X]!==!0)return;S(!0);const f={...i};delete f[X],m(s,{replace:!0,state:f})}),[s.pathname,s.search,s.state,m]);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),m(s.pathname,{replace:!0,state:se(s.state)})}),[s.pathname,s.state,m]),N=r.useMemo((()=>new URLSearchParams(s.search)),[s.search]),q=N.get("ref")??w?.aiCfoRef,F=N.get("emailRefId")??w?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect((()=>{z.current||q!=="month-end-email"||F==null||n!=null||a==null||(t(Ze("controller",a.userId,F,"MONTH_END_EMAIL")),z.current=!0)}),[q,F,n,t,a]);const E=p.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=u.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:H}=Oe(n),L=p.fetchState,D=p.uiState.chatSessionsNextPageToken.hasMore||!p.uiState.chatSessionsFirstPageFetched,W=n!=null?p.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(p.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),Z=p.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(Z,n),ge=Se.length===0;r.useEffect((()=>{C||g||m("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})}),[C,g,m,s.state]);const fe=r.useCallback((()=>{const i=V(s.state?.pathnameStackToGoBack),f=u.tenantEmailDomain;m(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})}),[u.tenantEmailDomain,s.state,m]);r.useEffect((()=>{n!=null&&l!==n&&m(`../ai-cfo/${n}`,{state:{...s.state}})}),[n,l]),r.useEffect((()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Je({sessionId:l,agentId:"controller"}))}),[]);const Ce=r.useMemo((()=>({events:H.map((i=>`private-encrypted-chat-${i}.${ne}`)),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)})),[H]);r.useEffect((()=>{L!=="In-Progress"&&D&&t(Xe())}),[L,D,t]),r.useEffect((()=>{n!=null&&W!=="In-Progress"&&Y&&a!=null&&L==="Completed"&&!D&&t(et(n,a.userId))}),[W,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&&p.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(Ct,{children:[c.jsx(R,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(bt,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:p.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{u.userRoleId!=null&&t(M(u.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(R,{analytics:I,onLoad:K}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:p.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||u.userRoleId==null||t(M(u.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(ft,{children:[c.jsx(R,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(gt,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:Z,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:m,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:u,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(ut,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:It,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:p.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||u.userRoleId==null||t(M(u.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Fe,{children:Ie})}):null]})},te=k(mt)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BBLi67DG.js";import{a as v}from"./sentry-DW4kKH26.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-D2KaS3N5.js";import{eZ as O,Qq as A,Q6 as h,zM as E,zE as q,zI as R,zx as Q,Q8 as K,zO as ae,zA as M,zR as Z,zN as C}from"./zeni-epic-state-BJ_gdj7r.js";import{z as V,a9 as G,bL as oe,ag as P,bC as H,bM as le,y as J,B as X,bN as pe,bO as se}from"./index-CivdpZRT.js";import"./mui-C1ThRyKO.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-BdQmAA7j.js";import re from"./NotFoundScreen-BeJq256C.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]="a0f6bebc-bcb3-45d1-9448-b86302e63208",e._sentryDebugIdIdentifier="sentry-dbid-a0f6bebc-bcb3-45d1-9448-b86302e63208")}catch{}})();const T="bill-approval-rule-update",ie=k((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(G(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(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]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(G(le)),de=()=>{const e=y((o=>O(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(s)));Y();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]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>O(t))),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Y(),v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
1
|
+
import{j as c}from"./liveblocks-B_acMj2M.js";import{a as v}from"./sentry-B7X8e_7J.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-u1EteL-v.js";import{eZ as O,Qq as A,Q6 as h,zM as E,zE as q,zI as R,zx as Q,Q8 as K,zO as ae,zA as M,zR as Z,zN as C}from"./zeni-epic-state-DiB-ZYnx.js";import{z as V,a9 as G,bL as oe,ag as P,bC as H,bM as le,y as J,B as X,bN as pe,bO as se}from"./index-tOfK8iY_.js";import"./mui-DMXXvJHn.js";import{u as Y,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js";import re from"./NotFoundScreen-DVitp65R.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]="a0f6bebc-bcb3-45d1-9448-b86302e63208",e._sentryDebugIdIdentifier="sentry-dbid-a0f6bebc-bcb3-45d1-9448-b86302e63208")}catch{}})();const T="bill-approval-rule-update",ie=k((function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(G(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(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]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k((function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(K(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Q(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(G(le)),de=()=>{const e=y((o=>O(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=H(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),u=y((s=>O(s)));Y();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]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect((()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex((n=>n.approvalRuleId===p.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach((s=>{const w=s.actors.selectedUsers.map((b=>({type:"user",userId:b.userId,isImplicitActor:!1}))),S=s.actors.selectedNonUsers.map((b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}})),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k((function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}}),(function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach((I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map((ee=>({type:"user",userId:ee.userId,isImplicitActor:!1}))));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})})),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(Z(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>O(t))),{isApprovalRulesV3Enabled:p}=H(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=J(),n=y((i=>h(i))),d=y((i=>A(i))),[l,u]=v.useState(!1);if(Y(),v.useEffect((()=>{l||(u(!0),p(M(!0)))})),v.useEffect((()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(X,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-BBLi67DG.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as ia,o as oa,p as y}from"./core-D2KaS3N5.js";import{eZ as W,PI as Ge,bs as wt,Kz as la,bq as Bt,bJ as pe,PJ as At,z2 as Ct,Ah as $e,zB as sa,bn as Ee,PK as ra,PL as ca,c7 as da,PM as ua,kG as xt,PN as Et,PO as Dt,AS as Me,zh as Ae,PP as pa,yS as tt,PQ as ma,EX as ba,yW as ha,z0 as jt,PR as fe,PS as Ne,Ai as Oe,PT as ga,PU as Sa,Al as ze,PV as ya,Ay as fa,PW as Tt,A2 as at,A7 as va,PX as Ia,PY as ue,PZ as Pt,P_ as Ft,P$ as Rt,gw as ka,zm as Le,cC as Vt,Q0 as wa,fB as Ba,Q1 as Aa,Q2 as Ca,fG as $t,fE as Lt,Q3 as Qe,Q4 as xa,Q5 as Ea,Nt as Ze,Q6 as Da,Nu as oe,Nv as We,Q7 as ja,Q8 as Ta,Q9 as Pa,A9 as nt,A6 as Fa,Qa as Ra,Qb as Va,Qc as $a,zU as La,Qd as _a,Qe as Ua,Qf as Ga,cq as _t,cS as Ut,kR as Ma,bP as Na,bo as Gt,bQ as Mt,y8 as Oa,Qg as za,EK as Qa,EQ as Za,uu as Wa,Aj as Ha,AZ as qa,l2 as ye,Qh as Ka,Qi as Nt,lw as Ja,kY as Ot,lh as zt,lg as it,bE as be,bO as Xa,Qj as Ya,Qk as ve,jB as en,Ql as ot,Qm as tn,jF as an,j_ as nn,Bb as on,Qn as ln,lp as sn,B1 as rn,Qo as lt,B5 as cn,Ba as dn,B7 as un,A$ as pn,Qp as Qt,zb as mn,Qq as bn,Qr as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rW as In,le as kn,B3 as wn,jL as Bn,lD as An,Qs as Cn,jD as xn,rN as En,Qt as Dn,z_ as jn,bK as Tn,bt as Pn,Mh as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-BJ_gdj7r.js";import{y as me,z as $,e as Ie,a0 as He,A as le,d as S,aS as Ce,B as re,o as x,C as De,f as D,bh as _n,p as Z,a4 as qe,r as E,K as ke,bi as rt,bj as ct,bk as Un,al as Gn,I as Mn,aM as Nn,F as Zt,O as je,J as Ke,bl as On,au as Wt,bm as zn,_ as Qn,h as Ht,a9 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Jn,bs as Xn,bt as Yn,bu as ei,bv as ti,v as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-CivdpZRT.js";import{n as _,S as ri}from"./mui-C1ThRyKO.js";import{A as dt}from"./AddressScreen-CGTYstNo.js";import{g as ie,a as Te,i as qt,V as Je,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-qVcyg1bS.js";import{a as f}from"./sentry-DW4kKH26.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CNoSipqI.js";import{u as Kt}from"./useInitialThreadRequest-UA6eH2dj.js";import xe from"./NotFoundScreen-BeJq256C.js";import{D as pi}from"./DrawerScreen-YrXahOEM.js";import{M as Jt}from"./MobileAppDrawer-O95nPlSQ.js";import{F as Xt}from"./FeaturePreviewScreen-C_bWMNSt.js";import{S as Pe}from"./SetupPagesScreen-DqGd8bGY.js";import{B as mi}from"./BillPayApprovalRoutes-guz2sdH1.js";import{FallBackRoute as bi}from"./ScreenRoutes-CRY8MlH6.js";import"./recharts-jHFM5Sob.js";import"./analytics-C2MbRoEp.js";import"./plaid-Do7hhR27.js";import"./dnd-D-AkKI2c.js";import"./stripe-cKAAJElX.js";import"./lottie-Dz6JZ58r.js";import"./lexical-BQ-Po3YF.js";import"./pdf-2k8d7AeQ.js";import"./utils-DIwqH7uj.js";import"./analyticsHelper-DqO64pHt.js";import"./routePaths-TRamKMNj.js";import"./BusinessVerificationPageScreen-BohezKn6.js";import"./ReimbursementApprovalRuleDetailScreen-BdQmAA7j.js";import"./getLocaleForTenant--JGxRDjE.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]="977ff043-7d50-44d8-957f-8cc99bc33595",e._sentryDebugIdIdentifier="sentry-dbid-977ff043-7d50-44d8-957f-8cc99bc33595")}catch{}})();const hi=X((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(_n);function gi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=Ie(),o=I((z=>W(z))),s=I((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,A]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I((R=>W(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[H,N]=f.useState(),w=I((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=I((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(ki,{children:`${_e.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-B_acMj2M.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as ia,o as oa,p as y}from"./core-u1EteL-v.js";import{eZ as W,PI as Ge,bs as wt,Kz as la,bq as Bt,bJ as pe,PJ as At,z2 as Ct,Ah as $e,zB as sa,bn as Ee,PK as ra,PL as ca,c7 as da,PM as ua,kG as xt,PN as Et,PO as Dt,AS as Me,zh as Ae,PP as pa,yS as tt,PQ as ma,EX as ba,yW as ha,z0 as jt,PR as fe,PS as Ne,Ai as Oe,PT as ga,PU as Sa,Al as ze,PV as ya,Ay as fa,PW as Tt,A2 as at,A7 as va,PX as Ia,PY as ue,PZ as Pt,P_ as Ft,P$ as Rt,gw as ka,zm as Le,cC as Vt,Q0 as wa,fB as Ba,Q1 as Aa,Q2 as Ca,fG as $t,fE as Lt,Q3 as Qe,Q4 as xa,Q5 as Ea,Nt as Ze,Q6 as Da,Nu as oe,Nv as We,Q7 as ja,Q8 as Ta,Q9 as Pa,A9 as nt,A6 as Fa,Qa as Ra,Qb as Va,Qc as $a,zU as La,Qd as _a,Qe as Ua,Qf as Ga,cq as _t,cS as Ut,kR as Ma,bP as Na,bo as Gt,bQ as Mt,y8 as Oa,Qg as za,EK as Qa,EQ as Za,uu as Wa,Aj as Ha,AZ as qa,l2 as ye,Qh as Ka,Qi as Nt,lw as Ja,kY as Ot,lh as zt,lg as it,bE as be,bO as Xa,Qj as Ya,Qk as ve,jB as en,Ql as ot,Qm as tn,jF as an,j_ as nn,Bb as on,Qn as ln,lp as sn,B1 as rn,Qo as lt,B5 as cn,Ba as dn,B7 as un,A$ as pn,Qp as Qt,zb as mn,Qq as bn,Qr as hn,gl as gn,gk as Sn,gj as yn,l5 as fn,ln as st,ly as vn,rW as In,le as kn,B3 as wn,jL as Bn,lD as An,Qs as Cn,jD as xn,rN as En,Qt as Dn,z_ as jn,bK as Tn,bt as Pn,Mh as Fn,cV as Rn,cU as Vn,cB as $n,cI as Ln}from"./zeni-epic-state-DiB-ZYnx.js";import{y as me,z as $,e as Ie,a0 as He,A as le,d as S,aS as Ce,B as re,o as x,C as De,f as D,bh as _n,p as Z,a4 as qe,r as E,K as ke,bi as rt,bj as ct,bk as Un,al as Gn,I as Mn,aM as Nn,F as Zt,O as je,J as Ke,bl as On,au as Wt,bm as zn,_ as Qn,h as Ht,a9 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Kn,br as Jn,bs as Xn,bt as Yn,bu as ei,bv as ti,v as ai,bw as ni,be as ii,bx as oi,by as li,i as si}from"./index-tOfK8iY_.js";import{n as _,S as ri}from"./mui-DMXXvJHn.js";import{A as dt}from"./AddressScreen-C1-59DB9.js";import{g as ie,a as Te,i as qt,V as Je,b as Xe,c as ci,v as di,d as ui,A as he,D as ge}from"./DomesticWireDetailScreen-KZF7LYi4.js";import{a as f}from"./sentry-B7X8e_7J.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-D-klSIXS.js";import{u as Kt}from"./useInitialThreadRequest-B6H0CI2K.js";import xe from"./NotFoundScreen-DVitp65R.js";import{D as pi}from"./DrawerScreen-C8ShIsGs.js";import{M as Jt}from"./MobileAppDrawer-DKR412hC.js";import{F as Xt}from"./FeaturePreviewScreen-Df-HjHKO.js";import{S as Pe}from"./SetupPagesScreen-CiLpjjGD.js";import{B as mi}from"./BillPayApprovalRoutes-DNMaV2B3.js";import{FallBackRoute as bi}from"./ScreenRoutes-BNvEvG7L.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./analyticsHelper-C5WvAo12.js";import"./routePaths-FKPzluZv.js";import"./BusinessVerificationPageScreen-D2eu1jQC.js";import"./ReimbursementApprovalRuleDetailScreen-CPcjJ9Q0.js";import"./getLocaleForTenant-BFNl-yVT.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]="977ff043-7d50-44d8-957f-8cc99bc33595",e._sentryDebugIdIdentifier="sentry-dbid-977ff043-7d50-44d8-957f-8cc99bc33595")}catch{}})();const hi=X((function(e,t){const l=Ge(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=Z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=Ee(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=ra(l.billActivities,ca(t.currentTenant),n);d=g,p=b}const m=da(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&ua(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:xt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(fe({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(jt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ha(l,s))},onSaveRealTimeApprovals:o=>{e(ba(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(ma({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ae(l,"retry")):e(Ae(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=Z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(pa({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ae(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Dt({data:i,billId:l})),e(Me(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(Et({billId:l}))}}}))(_n);function gi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=Ie(),o=I((z=>W(z))),s=I((z=>Ge(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Kt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&wt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[j,A]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=T(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=T(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(S.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=G(Ce.zeniAssistConfig),w=la(o),O=Bt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:q}=T(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(O||M||s.allApprovers.find((z=>z.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,O,M,o.isZeni,w,r]),f.useEffect((()=>{n!=null&&t(At(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(sa()))}),[j,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(De,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const _e=je.getLocalizedStrings().spendManagement.billPay.billDetails,ut=je.getLocalizedStrings().common,Si={containerWidth:new Zt(100,58)},pt=X((function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(ze(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(fa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Nn);function B({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=ke(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(Ce.zeniAssistConfig),j=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I((R=>W(R))),[C,U]=f.useState(!1),[T,G]=f.useState(!1),[L,k]=f.useState(!1),[H,N]=f.useState(),w=I((R=>Ne(R,m,g,n)));let O=w.fetchState,M=w.file,F=w.showAutofill;const q=I((R=>Ge(R,n??"")));u===!1&&(O=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const Y=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{O==="Not-Started"&&(u&&T?G(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(Ct(n,h,j,!1)),T||(G(!0),t($e(!1,h,j,b,n)))),u&&!T&&(G(!0),t($e(!1,h,j,b,n)))}),[C,T,u,n,t]);const z={onOkClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(Sa({replaceBillData:!0,billId:n})),t(ze(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ga({file:H,billId:n}))}},ee=f.useCallback((()=>{const R=Z(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(A.tenantEmailDomain);t(fe({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(O==="Error"||q.fetchState==="Error")return a.jsx(xe,{});if(O!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(bt,{}),a.jsx(Re,{}),a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:N,showActionButtons:!1,isInitialEdit:!!w.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||F?null:a.jsx(mt,{children:a.jsx(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const R=w.billPayInfo!=null&&w.billPayInfo.stage.code==="pending_approval"?w.billPayInfo.billStatus.code:w.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[F&&o!=="small"?a.jsx(bt,{}):null,L?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:_e.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:_e.overwriteDescription}),primaryButtonText:ut.yes,secondaryButtonText:ut.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(mt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(pt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,q,w),setShowConfirmationPopup:k,setPayload:N,showActionButtons:vi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Yt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(Ii,{children:[a.jsx(ki,{children:`${_e.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(wi,{})]}):void 0}function vi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const mt=_.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-B_acMj2M.js";import{a as V}from"./sentry-B7X8e_7J.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-u1EteL-v.js";import{e as ce,A as ue,aS as de,z,C as pe,f as B,ag as E,h as x,bH as le,au as me,r as P,av as U}from"./index-tOfK8iY_.js";import{Qe as fe,eZ as G,tV as ye,KC as Se,zU as ge,Dj as Ie,G4 as he,GJ as be,HJ as Te,QB as De,QC as Oe,QD as Ce,QE as ke,QF as Ve,N3 as Ae,PG as Ne,Ni as we,En as Fe,Nj as _e,Er as ve,lm as Ee,gl as xe,gk as ze,gj as Be,rW as Pe,rN as Ue,rK as Re,le as je,u2 as Le,u0 as R,bE as j,ue as L,cA as Me}from"./zeni-epic-state-DiB-ZYnx.js";import{n as Ge}from"./mui-DMXXvJHn.js";import{d as M}from"./routePaths-FKPzluZv.js";import{M as Qe}from"./MobileAppDrawer-DKR412hC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="24243581-4d35-42a1-b9f0-b80525723bec",t._sentryDebugIdIdentifier="sentry-dbid-24243581-4d35-42a1-b9f0-b80525723bec")}catch{}})();const Ze=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-B_acMj2M.js";import{a as l}from"./sentry-B7X8e_7J.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-u1EteL-v.js";import{Z as ge,de as be,z as ye,df as Pe,dh as z,di as Ie,ba as W,C as we,f as $,dj as H,dt as Ee,O as ke,h as Ae,a9 as Te,dm as xe,dn as Ue,a4 as _e,dr as Oe,b6 as ve,ds as Qe}from"./index-tOfK8iY_.js";import{gp as Fe,eY as G,eZ as $e,fs as De,iR as Le,iN as Ve,e_ as N,g9 as je,g1 as Re,g5 as B,ga as qe,gc as Me,gd as He,ge as Ne,gf as Be}from"./zeni-epic-state-DiB-ZYnx.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-DMXXvJHn.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.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]="221b025b-0d33-4c5e-9e01-ffe0a9d682c1",e._sentryDebugIdIdentifier="sentry-dbid-221b025b-0d33-4c5e-9e01-ffe0a9d682c1")}catch{}})();const Y="chat-response-generated",Z="cards/ask",X="card_policy_hero";function D(e){return`/${e}/cards`}function J(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===X?J(i):D(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Be({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(B(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(B(""))},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:K,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=K.pageTitle,Ze=ee.pageTitle,Xe=K.chatHeaderSubtitle,Je=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=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===X,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ze:A,subtitle:I?Je:Xe})),[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:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${Z}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(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(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?J(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(N(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(Ke,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(N(n.userRoleId)),h(!1)}})})})]})},Ke=L(Ge)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BBLi67DG.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-D2KaS3N5.js";import{fa as Pt,Sa as os,fm as wt,bt as Fe,Sb as is,Sc as ds,e$ as fn,Sd as Pn,f8 as wn,Se as Tn,Sf as vn,Sg as Fn,Sh as xn,f9 as Bn,fl as Ln,Si as Rn,Sj as ls,ff as us,fe as ms,Sk as Cs,Co as On,fo as ia,Sl as ps,Sm as hs,f1 as fs,f0 as gs,fB as Ye,fh as Un,fg as jn,Sn as Ss,fi as bs,BV as ys,BU as Is,BY as ks,B_ as Es,fu as As,eY as Mn,So as Ds,Sp as _s,fz as Nn,Sq as Ps,fA as yt,C4 as ws,C1 as Ts,eZ as ge,Sr as qa,fE as xe,fF as Be,fG as Le,gD as da,cx as la,Ss as ua,St as Tt,va as $a,kO as za,Su as Ya,CE as ka,fp as Qe,CG as vt,kE as Vn,Sv as ma,Cs as _a,Sw as vs,Sx as Fs,Cv as Qa,Sy as xs,Qy as Ja,fk as Hn,CB as Sa,i0 as Bs,Sz as Gn,fb as Ca,bo as Ls,SA as Rs,gl as Xa,gk as et,D8 as Os,gj as at,Qe as Us,SB as $n,cq as zn,cS as js,Qx as wa,DJ as Yn,SC as gn,Dj as Pa,SD as Zn,DK as Ms,QW as Ns,DL as Vs,EQ as Hs,uu as Gs,EK as $s,SE as zs,CF as ca,SF as Ys,SG as Zs,SH as Ks,SI as Ws,SJ as qs,SK as Ft,SL as Qs,CV as Kn,CO as Js,SM as Xs,gF as ec,D2 as Wn,D6 as qn,gE as ac,SN as tc,Dv as Qn,SO as nc,SP as rc,SQ as sc,D4 as Jn,CR as Xn,Cy as er,C_ as ar,CY as tr,D0 as cc,SR as nr,SS as oc,fw as ic,fx as dc,fy as lc,ST as tt,fq as rr,cU as xt,SU as uc,SV as mc,SW as Cc,SX as pc,De as It,DC as hc,Dy as fc,Da as gc,DA as Sc,Dq as bc,Ds as yc,SY as sr,DI as Ga,Kz as Ic,SZ as kc,S_ as Ec,S$ as Ac,T0 as cr,T1 as Dc,E3 as _c,Di as or,Dd as Ne,Dh as Pc,T2 as wc,T3 as Tc,Cp as vc,T4 as ir,fj as dr,T5 as Fc,Cr as xc,Cq as Sn,T6 as Bc,T7 as Lc,T8 as Rc,N4 as Oc,T9 as Bt,Ta as Uc,yb as lr,lm as jc,hS as Mc,E8 as Nc,Tb as ur,f5 as Vc,f6 as Hc,Tc as Gc,dj as $c,fn as zc,D_ as Yc,DU as qe,bs as Zc,bJ as Kc,cC as Wc,bK as qc,Mh as Qc}from"./zeni-epic-state-BJ_gdj7r.js";import{e as Re,cp as mr,p as we,cq as Cr,cr as pr,cs as Jc,O as ea,a0 as Lt,ct as Xc,cu as eo,Z as hr,a as fr,$ as gr,r as ye,A as ue,d as Z,ar as ya,cv as Sr,cw as ao,cx as to,z as te,B as Ta,ce as nt,cy as no,cz as ro,cA as so,K as va,aS as Ze,br as Rt,cB as co,F as Fa,k as rt,y as Ot,f as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,C as Ut,cF as lo,au as br,a4 as Et,cG as uo,_ as yr,S as Ir,h as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as So,o as Za,cO as bo,cP as yo,cQ as ht,v as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,i as Po}from"./index-CivdpZRT.js";import{n as He,D as Er,S as wo}from"./mui-C1ThRyKO.js";import{a as r}from"./sentry-DW4kKH26.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CNoSipqI.js";import{M as Ie}from"./MobileAppDrawer-O95nPlSQ.js";import{d as jt}from"./recharts-jHFM5Sob.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-DqGd8bGY.js";import{u as wr}from"./useInitialThreadRequest-UA6eH2dj.js";import ct from"./NotFoundScreen-BeJq256C.js";import{u as Vt}from"./useChargeCardPusherEvents-9ezHPs6j.js";import{n as yn}from"./utils-DIwqH7uj.js";import{t as Bo}from"./AddressScreen-CGTYstNo.js";import"./analytics-C2MbRoEp.js";import"./plaid-Do7hhR27.js";import"./dnd-D-AkKI2c.js";import"./stripe-cKAAJElX.js";import"./lottie-Dz6JZ58r.js";import"./lexical-BQ-Po3YF.js";import"./pdf-2k8d7AeQ.js";import"./analyticsHelper-DqO64pHt.js";import"./routePaths-TRamKMNj.js";import"./BusinessVerificationPageScreen-BohezKn6.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]="949ca72d-5cb4-486d-8d79-0a75771da07e",e._sentryDebugIdIdentifier="sentry-dbid-949ca72d-5cb4-486d-8d79-0a75771da07e")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),W=E.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const W=Cr(E);a(fs({templates:[W]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),K=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:K})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?bs(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const b=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,b,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),K=r.useRef(D);r.useEffect((()=>{const o=K.current;K.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),W=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=W&&E&&K!=null&&!J,re=r.useCallback((oe=>{if(K==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${K}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,K]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Zo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Z.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Z.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",K=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Ya()),K&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,K]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),W=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Ko="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Wo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(Z.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Wo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,S,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
1
|
+
import{j as c}from"./liveblocks-B_acMj2M.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Je,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-u1EteL-v.js";import{fa as Pt,Sa as os,fm as wt,bt as Fe,Sb as is,Sc as ds,e$ as fn,Sd as Pn,f8 as wn,Se as Tn,Sf as vn,Sg as Fn,Sh as xn,f9 as Bn,fl as Ln,Si as Rn,Sj as ls,ff as us,fe as ms,Sk as Cs,Co as On,fo as ia,Sl as ps,Sm as hs,f1 as fs,f0 as gs,fB as Ye,fh as Un,fg as jn,Sn as Ss,fi as bs,BV as ys,BU as Is,BY as ks,B_ as Es,fu as As,eY as Mn,So as Ds,Sp as _s,fz as Nn,Sq as Ps,fA as yt,C4 as ws,C1 as Ts,eZ as ge,Sr as qa,fE as xe,fF as Be,fG as Le,gD as da,cx as la,Ss as ua,St as Tt,va as $a,kO as za,Su as Ya,CE as ka,fp as Qe,CG as vt,kE as Vn,Sv as ma,Cs as _a,Sw as vs,Sx as Fs,Cv as Qa,Sy as xs,Qy as Ja,fk as Hn,CB as Sa,i0 as Bs,Sz as Gn,fb as Ca,bo as Ls,SA as Rs,gl as Xa,gk as et,D8 as Os,gj as at,Qe as Us,SB as $n,cq as zn,cS as js,Qx as wa,DJ as Yn,SC as gn,Dj as Pa,SD as Zn,DK as Ms,QW as Ns,DL as Vs,EQ as Hs,uu as Gs,EK as $s,SE as zs,CF as ca,SF as Ys,SG as Zs,SH as Ks,SI as Ws,SJ as qs,SK as Ft,SL as Qs,CV as Kn,CO as Js,SM as Xs,gF as ec,D2 as Wn,D6 as qn,gE as ac,SN as tc,Dv as Qn,SO as nc,SP as rc,SQ as sc,D4 as Jn,CR as Xn,Cy as er,C_ as ar,CY as tr,D0 as cc,SR as nr,SS as oc,fw as ic,fx as dc,fy as lc,ST as tt,fq as rr,cU as xt,SU as uc,SV as mc,SW as Cc,SX as pc,De as It,DC as hc,Dy as fc,Da as gc,DA as Sc,Dq as bc,Ds as yc,SY as sr,DI as Ga,Kz as Ic,SZ as kc,S_ as Ec,S$ as Ac,T0 as cr,T1 as Dc,E3 as _c,Di as or,Dd as Ne,Dh as Pc,T2 as wc,T3 as Tc,Cp as vc,T4 as ir,fj as dr,T5 as Fc,Cr as xc,Cq as Sn,T6 as Bc,T7 as Lc,T8 as Rc,N4 as Oc,T9 as Bt,Ta as Uc,yb as lr,lm as jc,hS as Mc,E8 as Nc,Tb as ur,f5 as Vc,f6 as Hc,Tc as Gc,dj as $c,fn as zc,D_ as Yc,DU as qe,bs as Zc,bJ as Kc,cC as Wc,bK as qc,Mh as Qc}from"./zeni-epic-state-DiB-ZYnx.js";import{e as Re,cp as mr,p as we,cq as Cr,cr as pr,cs as Jc,O as ea,a0 as Lt,ct as Xc,cu as eo,Z as hr,a as fr,$ as gr,r as ye,A as ue,d as Z,ar as ya,cv as Sr,cw as ao,cx as to,z as te,B as Ta,ce as nt,cy as no,cz as ro,cA as so,K as va,aS as Ze,br as Rt,cB as co,F as Fa,k as rt,y as Ot,f as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,C as Ut,cF as lo,au as br,a4 as Et,cG as uo,_ as yr,S as Ir,h as kr,cH as mo,cI as Co,cJ as po,cK as ho,cL as fo,cM as go,cN as So,o as Za,cO as bo,cP as yo,cQ as ht,v as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,i as Po}from"./index-tOfK8iY_.js";import{n as He,D as Er,S as wo}from"./mui-DMXXvJHn.js";import{a as r}from"./sentry-B7X8e_7J.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-D-klSIXS.js";import{M as Ie}from"./MobileAppDrawer-DKR412hC.js";import{d as jt}from"./recharts-REl-3xYX.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Xe,f as aa,h as ta,A as To,i as Mt,P as vo,j as Nt,s as Ia,k as Dr,l as oa,m as _r,n as Fo,o as Pr,p as xo,S as bn}from"./SetupPagesScreen-CiLpjjGD.js";import{u as wr}from"./useInitialThreadRequest-B6H0CI2K.js";import ct from"./NotFoundScreen-DVitp65R.js";import{u as Vt}from"./useChargeCardPusherEvents-HnTE12S3.js";import{n as yn}from"./utils-ChVfPml3.js";import{t as Bo}from"./AddressScreen-C1-59DB9.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./analyticsHelper-C5WvAo12.js";import"./routePaths-FKPzluZv.js";import"./BusinessVerificationPageScreen-D2eu1jQC.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]="949ca72d-5cb4-486d-8d79-0a75771da07e",e._sentryDebugIdIdentifier="sentry-dbid-949ca72d-5cb4-486d-8d79-0a75771da07e")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Tr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function vr(){const e=me(),n=i((a=>Pt(a.cardPolicyState))),t=i((a=>os(a.cardPolicyState)));r.useEffect((()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())}),[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>Tn(E.cardPolicyState))),B=i((E=>vn(E.cardPolicyState))),L=i((E=>Fn(E.cardPolicyState))),p=i((E=>xn(E.cardPolicyState))),h=i((E=>Bn(E.cardPolicyState))),v=i((E=>Pt(E.cardPolicyState))),u=i((E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount)),T=i((E=>E.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&a(Ln())}),[a,w]),vr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(Tr)),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect((()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:L,suggestedBlockCategories:p}))}),[T,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),W=E.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:E.newStack}})}),[n.state,e,_]),G=r.useCallback((()=>{e(_)}),[e,_]),Q=r.useCallback((E=>{a(hs(E))}),[a]),I=r.useCallback((E=>{const W=Cr(E);a(fs({templates:[W]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),K=r.useCallback((()=>{a(fn())}),[a]),J=r.useRef($);r.useEffect((()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:A,uploadedFileName:b,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:m,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:K})]}):c.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>Tn(o.cardPolicyState))),p=i((o=>vn(o.cardPolicyState))),h=i((o=>Fn(o.cardPolicyState))),v=i((o=>xn(o.cardPolicyState))),u=i((o=>Bn(o.cardPolicyState))),T=i((o=>Pt(o.cardPolicyState))),k=i((o=>On(o))),U=i((o=>a!=null?bs(o.cardPolicyState,a):void 0)),A=r.useMemo((()=>l.templateId===a&&l.formDraft!=null?l.formDraft:U!=null?ys(U):void 0),[l.templateId,l.formDraft,U,a]);r.useEffect((()=>{if(a==null)return;const o=l.detailFetchState.fetchState;l.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(Is(a))}),[s,a,l.templateId,l.detailFetchState.fetchState,U]),r.useEffect((()=>{j!=="Completed"&&j!=="In-Progress"&&s(Ln())}),[s,j]),vr();const b=i((o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{k.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[k.fetchState,s]);const x=r.useMemo((()=>B.map(Mo)),[B]),d=r.useMemo((()=>u.map(No)),[u]),f=r.useMemo((()=>k.cards.filter((o=>!mr(o.status.code))).map(Tr)),[k.cards]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:v})}),[A,f,x,d,b,L,p,h,v]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),K=r.useRef(D);r.useEffect((()=>{const o=K.current;K.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:J,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),v=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),T=ya(L.fetchState);r.useEffect((()=>{if(T==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(T==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,T]);const k=B.fetchState.fetchState;r.useEffect((()=>{k!=="Not-Started"&&k!=="Error"||a(ws())}),[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect((()=>{A==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||v>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),W=gr(),ne=i((oe=>Mn(oe))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),Te=r.useMemo((()=>Fr(q,ke,3)),[q,ke]),[fe,se]=r.useState(""),Ee=W&&E&&K!=null&&!J,re=r.useCallback((oe=>{if(K==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${K}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})}),[N.pathname,N.state,I,K]),Ce=r.useCallback((oe=>{oe.trim().length!==0&&(se(""),re(oe))}),[re]),Ae=r.useCallback((()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))}),[fe,re]),ee=r.useCallback((()=>{}),[]),ve=r.useCallback((oe=>{se(oe)}),[]),De=r.useCallback((()=>{o(!0)}),[o]),ae=r.useCallback((()=>{re(void 0)}),[re]);return r.useMemo((()=>{if(Ee&&!D&&G)return{aiAgentName:$o,headline:Ho,subheadline:Go,promptChips:Te,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:ve,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[fe,D,Ee,G,Q,ne,ve,ae,De,Ce,ee,Ae,Te])})({hasAnyPolicies:x,isChargeCardAdmin:y,isFileUploadEnabled:F}),f=w&&d!=null?c.jsx(Sr,{...d}):null,M=l&&f==null,V=r.useCallback((()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})}),[n.state,e]),O=r.useCallback((()=>{t!=null&&e(`/${t}/cards/policy/new`)}),[e,t]),R=r.useCallback((_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)}),[e,t]),z=r.useCallback((_=>{a(Ts(_))}),[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(ao,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:m,isAiCfoAccessEnabled:l,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(to,{policies:b,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:R,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Zo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i((q=>ge(q))),y=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Z.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Z.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=i((q=>da(q,s.companyId))),U=la(k.controllers),{creditAccount:A,creditAccountRepayment:b}=i((q=>ua(q))),x=i((q=>q.classListState.fetchState)),d=!F&&u&&l,f=i((q=>Tt(q,n,d,u))),[M,V]=r.useState(!1),O=f.chargeCard,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",K=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Ya()),K&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,K]),r.useEffect((()=>{M||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))}),[M,f,n,t]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}}),[f.fetchState,C,N]),r.useEffect((()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&l&&g&&t(Qe()),b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&u&&l&&g&&t(vt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())}),[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,v,T,l),W=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(Ta,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(no,{onGotItClick:J,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Ko="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Wo=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(vs({uiState:{sortKey:n,sortOrder:t}}))}}}))(so);function Qo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i((j=>ge(j))),{useFeatureGate:y}=ue(),{isFeatureEnabled:g}=y(Z.isCardsCommentingEnabled),[S,P]=r.useState(!1),m=i((j=>ma(j))),C=wr(s.companyId,{clearParams:m.fetchState==="Completed"}),F=r.useCallback((()=>{const j=we(t.state?.pathnameStackToGoBack),B=j.poppedPathname??Jo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Wo),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Jo=e=>`/${e}/cards`,Xo={containerWidth:new Fa(100,58)},ei=({appContent:e})=>{const n=va(),t=me(),a=le(),{cardId:s}=Ve(),y=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[m,C]=r.useState(!1),[F,w]=r.useState(!1),[l,j]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const L=i((I=>ge(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,v=i((I=>Fs(I,s))),u=v.chargeCard,T=i((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),b=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),P(!0)),m===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[m,v.fetchState,S,T]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(v.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&v.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}}),[v.fetchState,u?.type.code,F,v.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i((I=>Hn(I.userState,B.userId))),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect((()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(G,3e3),w(!0))}),[v.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(T!=="Completed"||u==null)return c.jsx(Ta,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(ni,{children:[c.jsx(Ie,{isAppContentDrawerOpen:l,handleDrawerToggle:Q}),c.jsx(ai,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Rt(),chargeCardDetailState:v,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Xa(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Xo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-B_acMj2M.js";import{a as g}from"./sentry-B7X8e_7J.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-u1EteL-v.js";import{z as C,be as P,C as F,f as V,h as A,ag as N,bf as j,au as L,av as U,r as B}from"./index-tOfK8iY_.js";import{eZ as h,gn as M,tV as _,gi as G,c7 as R,PG as z,bn as Z,rW as H,rK as Y,le as K,mP as S,PH as W,bE as $,cA as b,mZ as q,n0 as J}from"./zeni-epic-state-DiB-ZYnx.js";import"./mui-DMXXvJHn.js";import{d as Q}from"./routePaths-FKPzluZv.js";import{M as X}from"./MobileAppDrawer-DKR412hC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="6f7c96fe-4ae7-4934-9e0f-2982d44384bc",t._sentryDebugIdIdentifier="sentry-dbid-6f7c96fe-4ae7-4934-9e0f-2982d44384bc")}catch{}})();const ee=E((function(t){const a=G(t),i=C.getSignedInUser(),l=h(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Z(i)}}),(function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(W(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(K({files:e}))},onDeleteFile:e=>{t(Y(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>h(s))),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(_())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(A.Event.companyPassport,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:N(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-B_acMj2M.js";import{a}from"./sentry-B7X8e_7J.js";import{u as D,g as v,j as m,N as w}from"./core-u1EteL-v.js";import{Md as O,eZ as A,g3 as _,oi as j,gz as E,g2 as U,fC as L,Mk as k}from"./zeni-epic-state-DiB-ZYnx.js";import{u as F,z as p,L as g,O as $,o as z}from"./index-tOfK8iY_.js";import{n as H}from"./mui-DMXXvJHn.js";import{t as R}from"./getLocaleForTenant-BFNl-yVT.js";import{g as M,Q as P}from"./QBOConnectionScreen-B7QYuZy-.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./empty-Bplt_RAY.js";import"./pdf-lib-Cw5xvhae.js";import"./index-Df8xDBDT.js";import"./url-DyzfdPsq.js";import"./index-DFSTqcuc.js";import"./decodeURIComponentSafe-CjfYiJlM.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]="9e95b26a-613c-4925-bb44-276fb8272b83",t._sentryDebugIdIdentifier="sentry-dbid-9e95b26a-613c-4925-bb44-276fb8272b83")}catch{}})();const G=H.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-B_acMj2M.js";import{z as n}from"./index-tOfK8iY_.js";import{g as d}from"./QBOConnectionScreen-B7QYuZy-.js";import"./sentry-B7X8e_7J.js";import{g as p,N as s}from"./core-u1EteL-v.js";import"./zeni-epic-state-DiB-ZYnx.js";import"./recharts-REl-3xYX.js";import"./mui-DMXXvJHn.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./empty-Bplt_RAY.js";import"./pdf-lib-Cw5xvhae.js";import"./index-Df8xDBDT.js";import"./url-DyzfdPsq.js";import"./index-DFSTqcuc.js";import"./decodeURIComponentSafe-CjfYiJlM.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-C6q0UB9j.js → CustomerOnboardingRoutes-DXg0Kf-I.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-B_acMj2M.js";import{t as ht,A as Ne}from"./AddressScreen-C1-59DB9.js";import St from"./NotFoundScreen-DVitp65R.js";import{a as d}from"./sentry-B7X8e_7J.js";import{h as be,g as ke,u as ae,i as Ie,j as I,N as B,l as Ct,n as tt,o as bt,p as H}from"./core-u1EteL-v.js";import{eZ as X,fG as Oe,fE as _e,bs as kt,fU as It,bS as Ot,og as _t,tF as vt,tI as Tt,Nc as xt,Nd as wt,ki as he,kl as nt,MJ as Et,bZ as At,c7 as ue,u7 as ve,tU as Pt,Ne as de,u8 as at,KC as Dt,lm as ot,Nf as jt,Ng as Ft,rD as Bt,hx as Ut,MB as me,hu as Nt,MC as Vt,yk as Rt,rH as Lt,hm as Gt,hp as Ve,Nh as st,Ni as $t,En as Mt,Nj as Kt,Er as Qt,tL as zt,Nk as qt,Nl as Ht,kg as Zt,kj as Wt,uk as Jt,tW as it,u6 as Xt,bE as Re,cA as Yt,uj as Le,rW as en,rK as tn,le as nn,gl as an,gk as on,gj as sn,Nm as rn,tO as cn,ul as dn,uo as un,ur as ln,ux as pn,cZ as mn}from"./zeni-epic-state-DiB-ZYnx.js";import{z as L,A as Te,d as Z,c as gn,r as Q,C as oe,f as U,aq as fn,K as yn,v as rt,e as ct,ar as Ge,k as Se,h as Ce,as as hn,o as $e,at as Me,au as Sn,av as Ke,aw as Cn,ax as bn}from"./index-tOfK8iY_.js";import{n as xe}from"./mui-DMXXvJHn.js";import{g as kn,h as In,q as se}from"./QBOConnectionScreen-B7QYuZy-.js";import{u as On,a as _n}from"./useEmailConnectResultRefresh-Csv2ipfu.js";import{u as vn}from"./useChargeCardPusherEvents-HnTE12S3.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./empty-Bplt_RAY.js";import"./pdf-lib-Cw5xvhae.js";import"./index-Df8xDBDT.js";import"./url-DyzfdPsq.js";import"./index-DFSTqcuc.js";import"./decodeURIComponentSafe-CjfYiJlM.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new e.Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="d0d24812-deb2-4704-a542-3fbf1e17d891",e._sentryDebugIdIdentifier="sentry-dbid-d0d24812-deb2-4704-a542-3fbf1e17d891")}catch{}})();const Qe=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Tn=()=>{const e=be(),u=ke(),i=ae(),[o,l]=d.useState(!1),[c,y]=d.useState(!1),{tenantEmailDomain:S}=Ie(),t=L.getSignedInUser(),{useFeatureGate:n}=Te(),{isFeatureEnabled:s}=n(Z.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(Z.isArAgingFeatureEnabled),{isFeatureEnabled:O}=n(Z.isReferralFeatureEnabled),{isFeatureEnabled:k}=n(Z.isExpenseAutomationEnabledV2),{isFeatureEnabled:x}=n(Z.isDebitCardFeatureEnabled),r=gn(),g=I((h=>X(h))),p=I((h=>h.onboardingCustomerViewState.fetchState)),_=g.excludedResources,T=g.companyId??L.getSignedInUserTenant(S)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const w=Oe(x,g),D=_e(g),m=[],G=_?.resources?.find((h=>h.resource==="/reports/top_expenses"))==null,j=_?.resources?.find((h=>h.resource==="/reports/task_card"))==null,$=g?.userRole!=null&&kt(g?.userRole),M=_?.resources?.find((h=>h.resource==="/bills"))==null&&!$,A=_?.resources?.find((h=>h.resource==="/reimbursements"))==null;G===!1&&m.push("top_expenses"),j===!1&&m.push("task_card"),M===!1&&m.push("bill_pay_card","bill_pay_promo_card"),A===!1&&m.push("reimbursement_card","reimbursement_promo_card"),m.push("zeni_accounts_promo_card","treasury_promo_card"),O===!1&&m.push("rewards_card");const F=I((h=>{const v=[];s===!1&&v.push("accounts_payable_aging"),C===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),O===!1&&v.push("rewards_card"),r===!1&&v.push("expense_automation_card");const W=It(h,v,t,k,r);return Ot(W.reportsInOrder.map((P=>({fetchState:P.fetchState,error:P.error})))).fetchState}));d.useEffect((()=>{p!=="Completed"||o||w||D||(l(!0),i(_t(t.userId,T,g.tenantId,!0,!1,m)))}),[o,p,w,D,t,g.tenantId,i]);const z=d.useRef(!1),K=d.useCallback((()=>{const h={pathnameStackToGoBack:Q(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};e(w?"../../checking":D?"../../cards":"../../dashboard",{state:h})}),[e,u,w,D]),N=d.useCallback((()=>{z.current||(z.current=!0,K())}),[K]);if(d.useEffect((()=>{const h=setTimeout((()=>y(!0)),3e3);return()=>clearTimeout(h)}),[]),d.useEffect((()=>{const h=setTimeout(N,6e3);return()=>clearTimeout(h)}),[N]),d.useEffect((()=>{w||D||!c||F!=="Completed"&&F!=="Error"||N()}),[c,F,w,D,N]),p!=="Completed")return a.jsx(B,{to:"../"});const V=g.company?.companyOnboardingInfo?.onboardingInfo,q={timeSinceQuoteSign:V?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:V?.onboardingToQuoteSignMinutes??0,isKybDone:Qe(V?.businessVerified?.status),isKycDone:Qe(V?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:V?.accountingConnectionCreationMode??""};return a.jsxs(a.Fragment,{children:[a.jsx(oe,{analytics:U,onLoad:h=>h.trackOnboardingDashboardActivation(q)}),a.jsx(fn,{show:!0,onComplete:N})]})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],ze=(e,u)=>{const i=new Map(e.map((o=>[o.key,o])));return u.map((o=>{return l=i.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l}))},qe=(e,u)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return u.every((o=>i.get(o)?.status==="ready"))},He=xe.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${e=>e.theme.colors.grey4};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-BBLi67DG.js";import{i as K,j as _,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as F,N as Dn}from"./core-D2KaS3N5.js";import{eZ as U,NF as We,bE as ia,bo as Pe,OT as Fn,j8 as On,OU as Kt,OV as Rn,jb as Ct,OW as Ze,OX as Bn,jg as jn,OY as qt,OZ as Mn,jk as kt,O_ as Qe,O$ as Ln,cq as yt,P0 as Un,P1 as Gn,NZ as Vn,kc as Nn,P2 as Yn,bn as Xe,P3 as ca,Nt as ce,bc as la,kq as da,oq as ua,k9 as ma,Nv as le,Nu as J,eY as pa,fu as $n,g5 as _t,P4 as zn,P5 as Kn,P6 as ha,P7 as Fe,wa as Me,wb as Le,wy as we,ws as de,wf as Ue,P8 as qn,P9 as Zn,Pa as Qn,Pb as fa,Pc as Oe,Pd as Hn,dI as Je,su as ga,Pe as Wn,Pf as Xn,Pg as Jn,Ph as vt,ML as At,kG as xe,wG as It,sC as eo,Pi as to,wc as Zt,sx as Ee,st as ba,Pj as ge,Pk as ao,Pl as Et,MK as Tt,uB as Ca,Pm as no,Pn as oo,Po as so,Pp as Pt,uR as ro,Pq as io,we as Qt,uA as ka,Pr as be,Ps as co,bs as _a,wK as Sa,Pt as lo,Pu as uo,Pv as mo,Pw as wt,wF as po,Px as ho,wd as Ht,wJ as ya,Py as Ce,Pz as fo,PA as go,PB as va,kv as Aa,on as Ia,kA as Ea,ol as Ta,ok as Pa,oj as wa,tZ as bo,PC as Co,cU as ko,cV as _o,og as So,fU as yo,ox as vo,GX as dt,GP as Ao,GT as Io,PD as Eo,PE as To,PF as Po,b5 as et,fM as wo,hQ as xo,gn as Do,or as Fo,k2 as Oo,oo as Ro,om as Bo,fG as jo,fE as Mo}from"./zeni-epic-state-BJ_gdj7r.js";import{z as M,a4 as te,r as w,f as T,O as q,a_ as Lo,a0 as Ge,C as Ve,a$ as xa,h as N,b0 as Uo,e as _e,b1 as Da,A as Se,d as B,y as Go,b2 as Vo,b3 as No,Z as Fa,K as Oa,a as Ra,$ as Yo,b4 as $o,X as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,c as Zo,ar as Qo,p as Ho,_ as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-CivdpZRT.js";import{n as xt}from"./mui-C1ThRyKO.js";import{a as b}from"./sentry-DW4kKH26.js";import{w as Ua}from"./withTransactionSidePanel-DWx4OX2G.js";import{c as Ga,t as De,f as ue,a as Dt,v as as}from"./routePaths-TRamKMNj.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CNoSipqI.js";import je from"./NotFoundScreen-BeJq256C.js";import{u as Ft}from"./useInitialThreadRequest-UA6eH2dj.js";import{t as Va}from"./analyticsHelper-DqO64pHt.js";import{C as ns}from"./CompanyPassportScreen-CxVFTUSz.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-CuA1dWGl.js";import{F as ss}from"./FeaturePreviewScreen-C_bWMNSt.js";import"./recharts-jHFM5Sob.js";import"./analytics-C2MbRoEp.js";import"./plaid-Do7hhR27.js";import"./dnd-D-AkKI2c.js";import"./stripe-cKAAJElX.js";import"./lottie-Dz6JZ58r.js";import"./lexical-BQ-Po3YF.js";import"./pdf-2k8d7AeQ.js";import"./utils-DIwqH7uj.js";import"./TransactionDetailScreen-B77dqrVQ.js";import"./decodeURIComponentSafe-CD_zntJd.js";import"./MobileAppDrawer-O95nPlSQ.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]="4993d682-a7b8-483c-bf2e-9a670287a638",e._sentryDebugIdIdentifier="sentry-dbid-4993d682-a7b8-483c-bf2e-9a670287a638")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((I=>I.tenantState.currentTenantId)),c=_((I=>U(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?ia(r):Pe()),[r]),p=$(),f=W(),S=_((I=>Fn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),k=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),P=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),x=b.useCallback((I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=w(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}}),[m,e]),y=b.useCallback((()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(q.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(Lo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:x,onReload:E,onBackClick:v,onColumnSortConfigChanged:k,updateDownloadStateHandler:P,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=_((k=>Rn(k))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((k=>k.tenantState.currentTenantId)),i=_((k=>U(k))),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??Pe(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((k=>{e(Ze({searchString:k}))}),[]),p=b.useCallback(((k,P)=>{e(Ze({sortKey:P,sortOrder:k}))}),[]),f=b.useCallback((k=>{a(`./${k}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((k=>{e(Ze({downloadState:k}))}),[]),E=b.useCallback(((k,P)=>{}),[]),v=b.useCallback(((k,P)=>{e(Ze({selectedDate:k,agingDateSelectionType:P})),e(Ct(k))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(xa,{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=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((y=>U(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?ia(r):Pe()),[r]),h=$(),p=W(),f=_((y=>Bn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),k=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),P=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=w(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}}),[c,e]),x=b.useCallback((()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)}),[f.customer,l]);return b.useEffect((()=>{S()}),[]),b.useEffect((()=>{f.fetchState==="Completed"&&x()}),[f.fetchState,x]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:P,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=_((v=>Mn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((v=>U(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??Pe(),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,k)=>{e(Qe({sortKey:k,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,k)=>{e(Qe({selectedDate:v,agingDateSelectionType:k})),e(kt(v))}),[]),E=b.useCallback(((v,k)=>{e(Ln({nodeId:v,isCollapsed:k}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(xa,{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 Ya(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=De(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Nn(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=w(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=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Ya)(Da),us=ee((function(e){const a=Yn(e).accountsInOrder.map(((o,r)=>Na(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Ya)(Da);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return _((s=>s.cashBalanceState.fetchState))==="Error"?d.jsx(je,{}):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=_e(),o=yt(n?.loggedInUserRoleMap),r=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return _((s=>s.cardBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=xt.div`
|
|
1
|
+
import{j as d}from"./liveblocks-B_acMj2M.js";import{i as K,j as _,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as F,N as Dn}from"./core-u1EteL-v.js";import{eZ as U,NF as We,bE as ia,bo as Pe,OT as Fn,j8 as On,OU as Kt,OV as Rn,jb as Ct,OW as Ze,OX as Bn,jg as jn,OY as qt,OZ as Mn,jk as kt,O_ as Qe,O$ as Ln,cq as yt,P0 as Un,P1 as Gn,NZ as Vn,kc as Nn,P2 as Yn,bn as Xe,P3 as ca,Nt as ce,bc as la,kq as da,oq as ua,k9 as ma,Nv as le,Nu as J,eY as pa,fu as $n,g5 as _t,P4 as zn,P5 as Kn,P6 as ha,P7 as Fe,wa as Me,wb as Le,wy as we,ws as de,wf as Ue,P8 as qn,P9 as Zn,Pa as Qn,Pb as fa,Pc as Oe,Pd as Hn,dI as Je,su as ga,Pe as Wn,Pf as Xn,Pg as Jn,Ph as vt,ML as At,kG as xe,wG as It,sC as eo,Pi as to,wc as Zt,sx as Ee,st as ba,Pj as ge,Pk as ao,Pl as Et,MK as Tt,uB as Ca,Pm as no,Pn as oo,Po as so,Pp as Pt,uR as ro,Pq as io,we as Qt,uA as ka,Pr as be,Ps as co,bs as _a,wK as Sa,Pt as lo,Pu as uo,Pv as mo,Pw as wt,wF as po,Px as ho,wd as Ht,wJ as ya,Py as Ce,Pz as fo,PA as go,PB as va,kv as Aa,on as Ia,kA as Ea,ol as Ta,ok as Pa,oj as wa,tZ as bo,PC as Co,cU as ko,cV as _o,og as So,fU as yo,ox as vo,GX as dt,GP as Ao,GT as Io,PD as Eo,PE as To,PF as Po,b5 as et,fM as wo,hQ as xo,gn as Do,or as Fo,k2 as Oo,oo as Ro,om as Bo,fG as jo,fE as Mo}from"./zeni-epic-state-DiB-ZYnx.js";import{z as M,a4 as te,r as w,f as T,O as q,a_ as Lo,a0 as Ge,C as Ve,a$ as xa,h as N,b0 as Uo,e as _e,b1 as Da,A as Se,d as B,y as Go,b2 as Vo,b3 as No,Z as Fa,K as Oa,a as Ra,$ as Yo,b4 as $o,X as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,c as Zo,ar as Qo,p as Ho,_ as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-tOfK8iY_.js";import{n as xt}from"./mui-DMXXvJHn.js";import{a as b}from"./sentry-B7X8e_7J.js";import{w as Ua}from"./withTransactionSidePanel-DKYByGkd.js";import{c as Ga,t as De,f as ue,a as Dt,v as as}from"./routePaths-FKPzluZv.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-D-klSIXS.js";import je from"./NotFoundScreen-DVitp65R.js";import{u as Ft}from"./useInitialThreadRequest-B6H0CI2K.js";import{t as Va}from"./analyticsHelper-C5WvAo12.js";import{C as ns}from"./CompanyPassportScreen-XItKjSib.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-Drsr1_x0.js";import{F as ss}from"./FeaturePreviewScreen-Df-HjHKO.js";import"./recharts-REl-3xYX.js";import"./analytics-C1xZTLEH.js";import"./plaid-BGfWuOr6.js";import"./dnd-CIbUDnZz.js";import"./stripe-cKAAJElX.js";import"./lottie-DvAqKpNG.js";import"./lexical-BuHlG7c0.js";import"./pdf-Wf7vPJje.js";import"./utils-ChVfPml3.js";import"./TransactionDetailScreen-oIg47Woo.js";import"./decodeURIComponentSafe-CjfYiJlM.js";import"./MobileAppDrawer-DKR412hC.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]="4993d682-a7b8-483c-bf2e-9a670287a638",e._sentryDebugIdIdentifier="sentry-dbid-4993d682-a7b8-483c-bf2e-9a670287a638")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((I=>I.tenantState.currentTenantId)),c=_((I=>U(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?ia(r):Pe()),[r]),p=$(),f=W(),S=_((I=>Fn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),k=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),P=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),x=b.useCallback((I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=w(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}}),[m,e]),y=b.useCallback((()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(q.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(Lo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:x,onReload:E,onBackClick:v,onColumnSortConfigChanged:k,updateDownloadStateHandler:P,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=_((k=>Rn(k))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((k=>k.tenantState.currentTenantId)),i=_((k=>U(k))),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??Pe(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((k=>{e(Ze({searchString:k}))}),[]),p=b.useCallback(((k,P)=>{e(Ze({sortKey:P,sortOrder:k}))}),[]),f=b.useCallback((k=>{a(`./${k}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((k=>{e(Ze({downloadState:k}))}),[]),E=b.useCallback(((k,P)=>{}),[]),v=b.useCallback(((k,P)=>{e(Ze({selectedDate:k,agingDateSelectionType:P})),e(Ct(k))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(xa,{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=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((y=>U(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?ia(r):Pe()),[r]),h=$(),p=W(),f=_((y=>Bn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),k=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),P=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=w(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}}),[c,e]),x=b.useCallback((()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)}),[f.customer,l]);return b.useEffect((()=>{S()}),[]),b.useEffect((()=>{f.fetchState==="Completed"&&x()}),[f.fetchState,x]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:P,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=_((v=>Mn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((v=>U(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??Pe(),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,k)=>{e(Qe({sortKey:k,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,k)=>{e(Qe({selectedDate:v,agingDateSelectionType:k})),e(kt(v))}),[]),E=b.useCallback(((v,k)=>{e(Ln({nodeId:v,isCollapsed:k}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(xa,{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 Ya(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=De(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Nn(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=w(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=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Ya)(Da),us=ee((function(e){const a=Yn(e).accountsInOrder.map(((o,r)=>Na(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Ya)(Da);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return _((s=>s.cashBalanceState.fetchState))==="Error"?d.jsx(je,{}):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=_e(),o=yt(n?.loggedInUserRoleMap),r=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return _((s=>s.cardBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=xt.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|