@zeniai/web-app-ui 5.2.6-dev → 5.2.6-prod
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-B11BWz9A.js +1 -0
- package/dist/assets/{AddressScreen-_QOTUIVr.js → AddressScreen-C1s7NWDx.js} +1 -1
- package/dist/assets/{AiCfoScreen-CX7E8Peo.js → AiCfoScreen-Dp4ShYbp.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-ClmCpYFd.js → BillPayApprovalRoutes-B2aIkKau.js} +1 -1
- package/dist/assets/{BillPayRoutes-DoSwk72T.js → BillPayRoutes-4G3mhWaD.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-CzDFv09Y.js → BusinessVerificationPageScreen-Dv6OHSFD.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-eeV0SveA.js → CardsAiCfoScreen-D3cCxHW4.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-D-2cGFR8.js → ChargeCardRoutes-DGi3hSwm.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-Dgc1b90N.js → CompanyPassportScreen-DF5d8NUa.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-BJNKfgFC.js → ConnectionAuthScreen-HqiWg1VC.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-D9TGaoAG.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CU2s9JFJ.js → CustomerOnboardingRoutes-BPRzngBR.js} +1 -1
- package/dist/assets/{DashboardRoutes-D_nR7gnV.js → DashboardRoutes-B7uS0X5y.js} +1 -1
- package/dist/assets/{DefaultTenantHome-CAghXBT6.js → DefaultTenantHome--j5odGQE.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-BrMTJ0LT.js → DomesticWireDetailScreen-DSRP-CLA.js} +1 -1
- package/dist/assets/{DrawerScreen-DbaoUmyp.js → DrawerScreen-Cjm_n2i4.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-RWRqdoUW.js → EntityDetailRoutes-CSfMVzjI.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-Bg1lugdX.js → ExpenseAutomationRoutes-N4_vNJpb.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-BfuOs-n9.js → FeaturePreviewScreen-Cyx3f191.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-Tm6-OaLw.js → HubSpotOAuthCallbackScreen-B8DXCYB7.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-BPFrOlQS.js → MagicLinkRoutes-CZlt6pdT.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-_-oIW3R9.js → MagicLinkSignInScreen-BHAH1gLA.js} +1 -1
- package/dist/assets/{MobileAppDrawer-BVsx0d52.js → MobileAppDrawer-B0d8DjDW.js} +1 -1
- package/dist/assets/NotFoundScreen-d1rjMqeE.js +1 -0
- package/dist/assets/{NotificationRoutes-m7aisVZh.js → NotificationRoutes-C_o1dpat.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-Dr5xHicR.js → OAuthConsentScreen-EI72GMvs.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-DWPW45GW.js → PandLWithForecastRoutes-Dj2eHfCD.js} +1 -1
- package/dist/assets/{PeopleRoutes-CeN9aIQp.js → PeopleRoutes-DWSpE3po.js} +1 -1
- package/dist/assets/{PerformanceRoutes-Dhkh0POj.js → PerformanceRoutes-CVAB-XyH.js} +1 -1
- package/dist/assets/{Preview-B54tVRwE.js → Preview-cu61JPQA.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DaV3loZh.js → QBOConnectionScreen-zYBPrktU.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-D6a0suIn.js → ReimbursementApprovalRoutes-DKOqqw6J.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-LSfhRsMC.js → ReimbursementApprovalRuleDetailScreen-CDu793NT.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-Bh9_hMkC.js → ReimbursementRoutes-CNTZ5rhB.js} +1 -1
- package/dist/assets/{ReportsRoutes-vW__-mqO.js → ReportsRoutes-BvFjbiv_.js} +1 -1
- package/dist/assets/{RewardsRoutes-DTUZ1AWT.js → RewardsRoutes-eLeA1pP8.js} +1 -1
- package/dist/assets/{ScreenRoutes-foz6ng2P.js → ScreenRoutes-_kIhb2Vm.js} +2 -2
- package/dist/assets/{SettingsRoutes-fWbhF4uP.js → SettingsRoutes-CbEKkb0t.js} +1 -1
- package/dist/assets/{SetupPagesScreen-B8WYHzUu.js → SetupPagesScreen-dZPczJbV.js} +1 -1
- package/dist/assets/{SignInScreen-CHWWmIOt.js → SignInScreen-Czcu63oR.js} +1 -1
- package/dist/assets/{SignOutScreen-xt4AkWg7.js → SignOutScreen-DMy0EcTT.js} +1 -1
- package/dist/assets/{TaskListScreen-BNNdSA1G.js → TaskListScreen-Inp8gff6.js} +1 -1
- package/dist/assets/{TaskRoutes-Brk_g9vS.js → TaskRoutes-kduIpKWg.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-D6y-8FuE.js → TransactionDetailRoutes--GPRS3dt.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-CHtoQtM9.js → TransactionDetailScreen-OoYWWqNu.js} +1 -1
- package/dist/assets/{TransactionListRoutes-DqRETwf-.js → TransactionListRoutes-nvKtuBtP.js} +1 -1
- package/dist/assets/{TreasuryRoutes-Bgqikq-u.js → TreasuryRoutes-BXoLztQc.js} +1 -1
- package/dist/assets/{VendorsRoutes-CHFxSJdV.js → VendorsRoutes-DxP1NV5b.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-XYoM1z3h.js → WiseConfirmationScreen-CwvRXxNr.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-Chw_TTRS.js → ZeniAccountRoutes-BBo6GzMk.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-C6Lownq7.js → ZeniAccountStatementScreen-D2Iot37-.js} +1 -1
- package/dist/assets/{accountMappingHelper-Cb6Phjli.js → accountMappingHelper--Fr1sRub.js} +1 -1
- package/dist/assets/{analytics-CMhYvjgp.js → analytics-BJExxbwc.js} +1 -1
- package/dist/assets/{analyticsHelper-D86wGf3h.js → analyticsHelper-Blc9zWJE.js} +1 -1
- package/dist/assets/{core-BjRnoVdN.js → core-BJ2hvem7.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-8RHUrhvv.js → decodeURIComponentSafe-D-dduCwh.js} +1 -1
- package/dist/assets/{dnd-DD1NomKe.js → dnd-DZ9CRV59.js} +1 -1
- package/dist/assets/{empty-BxET7kap.js → empty-C58nz7T4.js} +1 -1
- package/dist/assets/{empty-Lyk-jq4r.js → empty-mhhptQt_.js} +1 -1
- package/dist/assets/{emptyVideoElement-6B6_1DjQ.js → emptyVideoElement-DKuz-T4y.js} +1 -1
- package/dist/assets/{epic-Bndm1KHn.js → epic-BJfU2jNb.js} +1 -1
- package/dist/assets/{getLocaleForTenant-B67NSzYh.js → getLocaleForTenant-CL6-EEpd.js} +1 -1
- package/dist/assets/{index-BgcyTzzQ.js → index-CHu6S232.js} +2 -2
- package/dist/assets/{index-DG5dsziC.js → index-Cb2H8bRb.js} +7 -7
- package/dist/assets/{index-BfsWyp4D.js → index-DP4JOHKc.js} +1 -1
- package/dist/assets/{index-CQBqRx-l.js → index-DRUqAoda.js} +1 -1
- package/dist/assets/{index-DlX43o9f.js → index-DS4arKmw.js} +1 -1
- package/dist/assets/{index-0VsUkhux.js → index-De1lB-0i.js} +1 -1
- package/dist/assets/{index-BT-czevE.js → index-Dvw5M8XH.js} +1 -1
- package/dist/assets/{index-DaCvER1D.js → index-yq2hIdUD.js} +1 -1
- package/dist/assets/{lexical-CkYiXWk9.js → lexical-XHlNR9IH.js} +1 -1
- package/dist/assets/{liveblocks-BxpjjfmG.js → liveblocks-BmXELsn-.js} +1 -1
- package/dist/assets/{lottie-iCzPfqr5.js → lottie-Bnlt89v4.js} +1 -1
- package/dist/assets/{mui-CdxnWIp4.js → mui-B3F8TWde.js} +1 -1
- package/dist/assets/{pathToGoBack-ne1S9CXU.js → pathToGoBack-DkWeLnko.js} +1 -1
- package/dist/assets/{pdf-C9PyNDT1.js → pdf-De5tezT3.js} +3 -3
- package/dist/assets/{pdf-lib-AYWezrZl.js → pdf-lib-V8KKPtc-.js} +1 -1
- package/dist/assets/{plaid-DtXw88Ai.js → plaid-BJIJT42b.js} +1 -1
- package/dist/assets/{pusher-BKAtqq4a.js → pusher-CFpeN8C-.js} +1 -1
- package/dist/assets/{react-DT4sGgUJ.js → react-BLbhzBRI.js} +1 -1
- package/dist/assets/{react-CpTVGU-U.js → react-BMRZbJyU.js} +1 -1
- package/dist/assets/{react-BoUZ92nm.js → react-CJOW3T6s.js} +1 -1
- package/dist/assets/{react-nOMx_HSn.js → react-Cx5Xm5nk.js} +1 -1
- package/dist/assets/{react-BU5_UEj2.js → react-DZGJrM0B.js} +1 -1
- package/dist/assets/{react-C9kbZlRC.js → react-pmYrldRZ.js} +1 -1
- package/dist/assets/{recharts-CFinCL-a.js → recharts-oBt1fY2y.js} +1 -1
- package/dist/assets/{routePaths-C7myDwxn.js → routePaths-DOpTNS7B.js} +1 -1
- package/dist/assets/{sentry-B06otMHd.js → sentry-C2-xEC_Q.js} +1 -1
- package/dist/assets/{url-CX7iFnba.js → url-CknUO84a.js} +1 -1
- package/dist/assets/{url-C1h0szFu.js → url-DDcxEA7v.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-TpXXYr6r.js → useAiCfoDashboardSuggestedQuestionsChips-BwLMNzEC.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-CFgUcHmD.js → useAskAiCfoHostNavButtonProps-BOzbn95k.js} +1 -1
- package/dist/assets/{useCashManagementBanner-FLL8Hs1-.js → useCashManagementBanner-Cj5KQWn0.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-DT2ptjCA.js → useChargeCardPusherEvents-Cd4kJm1v.js} +1 -1
- package/dist/assets/{useDeviceId-BTkaAWDK.js → useDeviceId-Bm2mCSyU.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-DG9AkHtd.js → useEmailConnectResultRefresh-BgBSgX9b.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-Dc7yU2XH.js → useInitialThreadRequest-BdYNCiJn.js} +1 -1
- package/dist/assets/{utils-CaYSR2MR.js → utils-JA-6PgLD.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-tBE2uHP9.js → withTransactionSidePanel-r761w2FA.js} +1 -1
- package/dist/assets/{zeni-epic-state-BkEKIYbX.js → zeni-epic-state-DloJeuBO.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AddressRoutes-CRqr9Fgx.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-B5MRHJlf.js +0 -1
- package/dist/assets/NotFoundScreen-6c0jfbLt.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-BmXELsn-.js";import{A as d}from"./AddressScreen-C1s7NWDx.js";import i from"./NotFoundScreen-d1rjMqeE.js";import"./sentry-C2-xEC_Q.js";import{o as s,p as r}from"./core-BJ2hvem7.js";import"./zeni-epic-state-DloJeuBO.js";import"./recharts-oBt1fY2y.js";import"./index-Cb2H8bRb.js";import"./mui-B3F8TWde.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-
|
|
1
|
+
import{j as d}from"./liveblocks-BmXELsn-.js";import{a as h}from"./sentry-C2-xEC_Q.js";import{h as P,u as _,g as M,i as j,j as E,n as B}from"./core-BJ2hvem7.js";import{K as D,y as K,z as L,k as $,B as z,D as F,d as C,f as S,q as N,m as b,r as R}from"./index-Cb2H8bRb.js";import{MK as k,hT as U,eW as q,ML as G,c7 as O,MM as V,lc as H}from"./zeni-epic-state-DloJeuBO.js";import{n as W}from"./mui-B3F8TWde.js";import J from"./NotFoundScreen-d1rjMqeE.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]="e27d52ce-e3fe-4eaf-a7f1-784238721354",e._sentryDebugIdIdentifier="sentry-dbid-e27d52ce-e3fe-4eaf-a7f1-784238721354")}catch{}})();const Q=W.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BxpjjfmG.js";import{a as r}from"./sentry-B06otMHd.js";import{u as we,h as xe,g as Pe,j as Y,i as ye,n as Ee}from"./core-BjRnoVdN.js";import{X as Te,db as ve,z as Ae,K as Qe,dc as _e,dd as Oe,bb as Z,de as ae,df as Ue,ba as se,r as M,D as B,d as I,dg as R,dh as je,di as Fe,a3 as Le,f as De,a9 as Be,dj as Re,dk as Ve,a4 as Me,dl as $e,dm as Ge,dn as Ne,s as qe,b6 as ze,dp as We}from"./index-DG5dsziC.js";import{gk as He,eV as oe,eW as Xe,iz as Je,TT as Ke,fp as Ye,iJ as Ze,iF as et,eX as V,fw as tt,g5 as at,f_ as st,g2 as ee,g6 as ot,g7 as nt,g8 as it,g9 as rt,ga as lt}from"./zeni-epic-state-BkEKIYbX.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-CdxnWIp4.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-TpXXYr6r.js";import{p as pt}from"./pathToGoBack-ne1S9CXU.js";import"./recharts-CFinCL-a.js";import"./analytics-CMhYvjgp.js";import"./plaid-DtXw88Ai.js";import"./dnd-DD1NomKe.js";import"./stripe-DMRn4zHo.js";import"./lottie-iCzPfqr5.js";import"./lexical-CkYiXWk9.js";import"./pdf-C9PyNDT1.js";import"./utils-CaYSR2MR.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]="a1d3a060-7a73-43d9-b303-e4beee9eefee",e._sentryDebugIdIdentifier="sentry-dbid-a1d3a060-7a73-43d9-b303-e4beee9eefee")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=se(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,We(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&ze(e,s,l,S,w,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Lt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=we(),u=xe(),a=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Y(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Le(d),p=Y(i=>Xe(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=a.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),N=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),q=N.get("ref")??P?.aiCfoRef,F=N.get("emailRefId")??P?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect(()=>{z.current||q!=="month-end-email"||F==null||n!=null||s==null||(t(Je("controller",s.userId,F,"MONTH_END_EMAIL")),z.current=!0)},[q,F,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Ue(n),L=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",X=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ye({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{L!=="In-Progress"&&D&&t(Ze())},[L,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&X&&s!=null&&L==="Completed"&&!D&&t(et(n,s.userId))},[H,X,n,s,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:K}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,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(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Fe,{children:Ie})}):null]})},te=k(ct)`
|
|
1
|
+
import{j as c}from"./liveblocks-BmXELsn-.js";import{a as r}from"./sentry-C2-xEC_Q.js";import{u as we,h as xe,g as Pe,j as Y,i as ye,n as Ee}from"./core-BJ2hvem7.js";import{X as Te,db as ve,z as Ae,K as Qe,dc as _e,dd as Oe,bb as Z,de as ae,df as Ue,ba as se,r as M,D as B,d as I,dg as R,dh as je,di as Fe,a3 as Le,f as De,a9 as Be,dj as Re,dk as Ve,a4 as Me,dl as $e,dm as Ge,dn as Ne,s as qe,b6 as ze,dp as We}from"./index-Cb2H8bRb.js";import{gk as He,eV as oe,eW as Xe,iz as Je,TT as Ke,fp as Ye,iJ as Ze,iF as et,eX as V,fw as tt,g5 as at,f_ as st,g2 as ee,g6 as ot,g7 as nt,g8 as it,g9 as rt,ga as lt}from"./zeni-epic-state-DloJeuBO.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-B3F8TWde.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-BwLMNzEC.js";import{p as pt}from"./pathToGoBack-DkWeLnko.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.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]="a1d3a060-7a73-43d9-b303-e4beee9eefee",e._sentryDebugIdIdentifier="sentry-dbid-a1d3a060-7a73-43d9-b303-e4beee9eefee")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=se(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,We(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&ze(e,s,l,S,w,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Be(Re)),Lt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=we(),u=xe(),a=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Y(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Le(d),p=Y(i=>Xe(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=a.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),N=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),q=N.get("ref")??P?.aiCfoRef,F=N.get("emailRefId")??P?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect(()=>{z.current||q!=="month-end-email"||F==null||n!=null||s==null||(t(Je("controller",s.userId,F,"MONTH_END_EMAIL")),z.current=!0)},[q,F,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Ue(n),L=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",X=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ye({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{L!=="In-Progress"&&D&&t(Ze())},[L,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&X&&s!=null&&L==="Completed"&&!D&&t(et(n,s.userId))},[H,X,n,s,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:K}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,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(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Fe,{children:Ie})}):null]})},te=k(ct)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BxpjjfmG.js";import{a as v}from"./sentry-B06otMHd.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-BjRnoVdN.js";import{eW as O,Q6 as A,PO as h,zs as E,zk as q,zo as R,zd as K,PQ as Q,zu as ae,zg as M,zx as G,zt as C}from"./zeni-epic-state-BkEKIYbX.js";import{z as V,a9 as H,bL as oe,ag as P,bC as J,bM as le,y as X,B as Y,bN as pe,bO as se}from"./index-DG5dsziC.js";import"./mui-CdxnWIp4.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-LSfhRsMC.js";import re from"./NotFoundScreen-6c0jfbLt.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]="fb7cdd56-266c-40b1-9199-5081fa7f417a",e._sentryDebugIdIdentifier="sentry-dbid-fb7cdd56-266c-40b1-9199-5081fa7f417a")}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(Q(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,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(Q(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>O(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),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(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=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(G(!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}=J(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=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
1
|
+
import{j as c}from"./liveblocks-BmXELsn-.js";import{a as v}from"./sentry-C2-xEC_Q.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-BJ2hvem7.js";import{eW as O,Q6 as A,PO as h,zs as E,zk as q,zo as R,zd as K,PQ as Q,zu as ae,zg as M,zx as G,zt as C}from"./zeni-epic-state-DloJeuBO.js";import{z as V,a9 as H,bL as oe,ag as P,bC as J,bM as le,y as X,B as Y,bN as pe,bO as se}from"./index-Cb2H8bRb.js";import"./mui-B3F8TWde.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CDu793NT.js";import re from"./NotFoundScreen-d1rjMqeE.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]="fb7cdd56-266c-40b1-9199-5081fa7f417a",e._sentryDebugIdIdentifier="sentry-dbid-fb7cdd56-266c-40b1-9199-5081fa7f417a")}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(Q(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,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(Q(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>O(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),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(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=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(G(!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}=J(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=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),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(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-BxpjjfmG.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 na,o as ia,p as S}from"./core-BjRnoVdN.js";import{eW as W,Po as _e,bs as kt,Kf as oa,bq as wt,bJ as pe,Pp as At,yK as Bt,zZ as $e,zh as la,bn as De,Pq as sa,Pr as ra,c7 as ca,Ps as da,kw as Ct,Pt as xt,Pu as Et,Ay as Ge,yZ as Ce,Pv as ua,yy as tt,Pw as pa,ED as ma,yC as ba,yI as Dt,Px as ve,Py as Me,z_ as Oe,Pz as ha,PA as ga,A1 as Ne,PB as ya,Ae as Sa,PC as Pt,zK as at,zP as fa,PD as va,PE as ue,PF as jt,PG as Tt,PH as Ft,go as Ia,z2 as Le,cC as Rt,PI as ka,fy as wa,PJ as Aa,PK as Ba,fD as Vt,fB as $t,PL as ze,PM as Ca,PN as xa,N9 as Ze,PO as Ea,Na as oe,Nb as He,PP as Da,PQ as Pa,PR as ja,zR as nt,zO as Ta,PS as Fa,PT as Ra,PU as Va,zA as $a,PV as La,PW as Ua,PX as _a,cq as Lt,cS as Ut,kH as Ga,bP as Ma,bo as _t,bQ as Gt,xQ as Oa,PY as Na,Eq as za,Ew as Za,ua as Ha,z$ as Wa,AF as qa,kU as fe,PZ as Qa,P_ as Mt,lm as Ka,kO as Ot,l7 as Nt,l6 as it,bE as be,bO as Ja,P$ as Xa,Q0 as Ie,jr as Ya,Q1 as ot,Q2 as en,jv as tn,jQ as an,AT as nn,Q3 as on,lf as ln,AJ as sn,Q4 as lt,AN as rn,AS as cn,AP as dn,AH as un,Q5 as zt,yT as pn,Q6 as mn,Q7 as bn,gg as hn,gf as gn,ge as yn,kX as Sn,ld as st,lo as fn,rB as vn,l4 as In,AL as kn,jB as wn,lt as An,Q8 as Bn,jt as Cn,rs as xn,Q9 as En,zG as Dn,bK as Pn,bt as jn,LZ as Tn,cV as Fn,cU as Rn,cB as Vn,cI as $n}from"./zeni-epic-state-BkEKIYbX.js";import{y as me,z as $,k as ke,a0 as We,C as le,G as y,aS as xe,B as re,o as x,D as Pe,d as D,bh as Ln,r as H,a4 as qe,s as E,K as we,bi as rt,bj as ct,bk as Un,al as _n,J as Gn,aM as Mn,F as Zt,a as Qe,Y as Ke,bl as On,au as Ht,bm as Nn,Z as zn,f as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,w as ti,bw as ai,be as ni,bx as ii,by as oi,i as li}from"./index-DG5dsziC.js";import{n as U,S as si}from"./mui-CdxnWIp4.js";import{A as dt}from"./AddressScreen-_QOTUIVr.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-BrMTJ0LT.js";import{a as f}from"./sentry-B06otMHd.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CFgUcHmD.js";import{u as Qt}from"./useInitialThreadRequest-Dc7yU2XH.js";import Ee from"./NotFoundScreen-6c0jfbLt.js";import{D as ui}from"./DrawerScreen-DbaoUmyp.js";import{M as Kt}from"./MobileAppDrawer-BVsx0d52.js";import{F as Jt}from"./FeaturePreviewScreen-BfuOs-n9.js";import{S as Te}from"./SetupPagesScreen-B8WYHzUu.js";import{B as pi}from"./BillPayApprovalRoutes-ClmCpYFd.js";import{FallBackRoute as mi}from"./ScreenRoutes-foz6ng2P.js";import"./recharts-CFinCL-a.js";import"./analytics-CMhYvjgp.js";import"./plaid-DtXw88Ai.js";import"./dnd-DD1NomKe.js";import"./stripe-DMRn4zHo.js";import"./lottie-iCzPfqr5.js";import"./lexical-CkYiXWk9.js";import"./pdf-C9PyNDT1.js";import"./utils-CaYSR2MR.js";import"./analyticsHelper-D86wGf3h.js";import"./routePaths-C7myDwxn.js";import"./BusinessVerificationPageScreen-CzDFv09Y.js";import"./ReimbursementApprovalRuleDetailScreen-LSfhRsMC.js";import"./getLocaleForTenant-B67NSzYh.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]="f972f3e5-09bd-4906-9a56-0024fafe43f6",e._sentryDebugIdIdentifier="sentry-dbid-f972f3e5-09bd-4906-9a56-0024fafe43f6")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(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(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=I(z=>W(z)),s=I(z=>_e(z,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,B]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:q}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(xe.zeniAssistConfig),w=oa(o),N=wt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||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,N,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(Bt(n??"",L,F,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(B(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:q,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({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)}}})(Mn);function A({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),B=I(R=>W(R)),[C,_]=f.useState(!1),[j,G]=f.useState(!1),[L,k]=f.useState(!1),[q,O]=f.useState(),w=I(R=>Me(R,m,g,n));let N=w.fetchState,M=w.file,F=w.showAutofill;const Q=I(R=>_e(R,n??""));u===!1&&(N=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(()=>{N==="Not-Started"&&(u&&j?G(!1):!u&&C&&_(!1))},[n]),f.useEffect(()=>{C||n==null||u||(_(!0),t(Bt(n,h,P,!1)),j||(G(!0),t($e(!1,h,P,b,n)))),u&&!j&&(G(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(q,m,n))},onCancelClick:()=>{if(k(!1),!q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ha({file:q,billId:n}))}},ee=f.useCallback(()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(B.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})},[c.state,B.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:O,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(pt,{children:a.jsx(Xt,{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(mt,{}):null,L?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,w),setShowConfirmationPopup:k,setPayload:O,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-BmXELsn-.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 na,o as ia,p as S}from"./core-BJ2hvem7.js";import{eW as W,Po as _e,bs as kt,Kf as oa,bq as wt,bJ as pe,Pp as At,yK as Bt,zZ as $e,zh as la,bn as De,Pq as sa,Pr as ra,c7 as ca,Ps as da,kw as Ct,Pt as xt,Pu as Et,Ay as Ge,yZ as Ce,Pv as ua,yy as tt,Pw as pa,ED as ma,yC as ba,yI as Dt,Px as ve,Py as Me,z_ as Oe,Pz as ha,PA as ga,A1 as Ne,PB as ya,Ae as Sa,PC as Pt,zK as at,zP as fa,PD as va,PE as ue,PF as jt,PG as Tt,PH as Ft,go as Ia,z2 as Le,cC as Rt,PI as ka,fy as wa,PJ as Aa,PK as Ba,fD as Vt,fB as $t,PL as ze,PM as Ca,PN as xa,N9 as Ze,PO as Ea,Na as oe,Nb as He,PP as Da,PQ as Pa,PR as ja,zR as nt,zO as Ta,PS as Fa,PT as Ra,PU as Va,zA as $a,PV as La,PW as Ua,PX as _a,cq as Lt,cS as Ut,kH as Ga,bP as Ma,bo as _t,bQ as Gt,xQ as Oa,PY as Na,Eq as za,Ew as Za,ua as Ha,z$ as Wa,AF as qa,kU as fe,PZ as Qa,P_ as Mt,lm as Ka,kO as Ot,l7 as Nt,l6 as it,bE as be,bO as Ja,P$ as Xa,Q0 as Ie,jr as Ya,Q1 as ot,Q2 as en,jv as tn,jQ as an,AT as nn,Q3 as on,lf as ln,AJ as sn,Q4 as lt,AN as rn,AS as cn,AP as dn,AH as un,Q5 as zt,yT as pn,Q6 as mn,Q7 as bn,gg as hn,gf as gn,ge as yn,kX as Sn,ld as st,lo as fn,rB as vn,l4 as In,AL as kn,jB as wn,lt as An,Q8 as Bn,jt as Cn,rs as xn,Q9 as En,zG as Dn,bK as Pn,bt as jn,LZ as Tn,cV as Fn,cU as Rn,cB as Vn,cI as $n}from"./zeni-epic-state-DloJeuBO.js";import{y as me,z as $,k as ke,a0 as We,C as le,G as y,aS as xe,B as re,o as x,D as Pe,d as D,bh as Ln,r as H,a4 as qe,s as E,K as we,bi as rt,bj as ct,bk as Un,al as _n,J as Gn,aM as Mn,F as Zt,a as Qe,Y as Ke,bl as On,au as Ht,bm as Nn,Z as zn,f as Wt,a9 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,w as ti,bw as ai,be as ni,bx as ii,by as oi,i as li}from"./index-Cb2H8bRb.js";import{n as U,S as si}from"./mui-B3F8TWde.js";import{A as dt}from"./AddressScreen-C1s7NWDx.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-DSRP-CLA.js";import{a as f}from"./sentry-C2-xEC_Q.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BOzbn95k.js";import{u as Qt}from"./useInitialThreadRequest-BdYNCiJn.js";import Ee from"./NotFoundScreen-d1rjMqeE.js";import{D as ui}from"./DrawerScreen-Cjm_n2i4.js";import{M as Kt}from"./MobileAppDrawer-B0d8DjDW.js";import{F as Jt}from"./FeaturePreviewScreen-Cyx3f191.js";import{S as Te}from"./SetupPagesScreen-dZPczJbV.js";import{B as pi}from"./BillPayApprovalRoutes-B2aIkKau.js";import{FallBackRoute as mi}from"./ScreenRoutes-_kIhb2Vm.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";import"./analyticsHelper-Blc9zWJE.js";import"./routePaths-DOpTNS7B.js";import"./BusinessVerificationPageScreen-Dv6OHSFD.js";import"./ReimbursementApprovalRuleDetailScreen-CDu793NT.js";import"./getLocaleForTenant-CL6-EEpd.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]="f972f3e5-09bd-4906-9a56-0024fafe43f6",e._sentryDebugIdIdentifier="sentry-dbid-f972f3e5-09bd-4906-9a56-0024fafe43f6")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=$.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(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(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=$.getSignedInUser(),u=ke(),o=I(z=>W(z)),s=I(z=>_e(z,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,B]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:G}=le(),{isFeatureEnabled:L}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:q}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:O}=G(xe.zeniAssistConfig),w=oa(o),N=wt(o.userRole),M=g&&pe(u?.loggedInUserRoleMap),F=O.user_ids!=null&&r?.userId!=null&&O.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(N||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,N,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(Bt(n??"",L,F,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(B(!0),t($e(!1,L,F,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:z=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(z)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:L,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:F,isDetectInsufficientFundsEnabled:q,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=$.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=$.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({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)}}})(Mn);function A({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=$.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),B=I(R=>W(R)),[C,_]=f.useState(!1),[j,G]=f.useState(!1),[L,k]=f.useState(!1),[q,O]=f.useState(),w=I(R=>Me(R,m,g,n));let N=w.fetchState,M=w.file,F=w.showAutofill;const Q=I(R=>_e(R,n??""));u===!1&&(N=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(()=>{N==="Not-Started"&&(u&&j?G(!1):!u&&C&&_(!1))},[n]),f.useEffect(()=>{C||n==null||u||(_(!0),t(Bt(n,h,P,!1)),j||(G(!0),t($e(!1,h,P,b,n)))),u&&!j&&(G(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(q,m,n))},onCancelClick:()=>{if(k(!1),!q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",R,i?.userEmail??"","no"),t(ha({file:q,billId:n}))}},ee=f.useCallback(()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(B.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})},[c.state,B.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(N==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(N!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:O,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(pt,{children:a.jsx(Xt,{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(mt,{}):null,L?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:z,isEditPopup:!0}):null,o==="small"||F?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:F,uploadStatus:w.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,w),setShowConfirmationPopup:k,setPayload:O,showActionButtons:fi(u,w),isInitialEdit:!!w.isInitialEdit,billStage:R}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.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-BmXELsn-.js";import{a as V}from"./sentry-C2-xEC_Q.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-BJ2hvem7.js";import{k as ce,C as ue,aS as de,z,D as pe,d as B,ag as x,f as E,bH as le,au as me,s as M,av as P}from"./index-Cb2H8bRb.js";import{PW as fe,eW as G,tB as ye,Ki as Se,zA as ge,C$ as Ie,FM as he,Gp as be,Hp as Te,Qh as De,Qi as Oe,Qj as Ce,Qk as ke,Ql as Ve,ML as Ae,Pm as we,M_ as Ne,E3 as Fe,M$ as _e,E7 as ve,lc as xe,gg as Ee,gf as ze,ge as Be,rB as Me,rs as Pe,rp as Re,l4 as Ue,tK as Le,tI as R,bE as U,tW as L,cA as je}from"./zeni-epic-state-DloJeuBO.js";import{n as Ge}from"./mui-B3F8TWde.js";import{d as j}from"./routePaths-DOpTNS7B.js";import{M as Qe}from"./MobileAppDrawer-B0d8DjDW.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]="af9748cb-79be-4457-91f6-93f1f5e061b4",t._sentryDebugIdIdentifier="sentry-dbid-af9748cb-79be-4457-91f6-93f1f5e061b4")}catch{}})();const We=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-BmXELsn-.js";import{a as l}from"./sentry-C2-xEC_Q.js";import{u as me,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-BJ2hvem7.js";import{X as ge,db as be,z as ye,dc as Pe,de as z,df as Ie,ba as W,D as we,d as $,dg as H,dq as Ee,a as ke,f as Ae,a9 as Te,dj as xe,dk as Ue,a4 as _e,dn as Oe,b6 as ve,dp as Qe}from"./index-Cb2H8bRb.js";import{gk as Fe,eV as G,eW as $e,fp as De,iJ as Ve,iF as Le,eX as B,g5 as je,f_ as qe,g2 as N,g6 as Re,g7 as Me,g8 as He,g9 as Be,ga as Ne}from"./zeni-epic-state-DloJeuBO.js";import{D as ze,n as V,P as We,S as Ge}from"./mui-B3F8TWde.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.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]="e0607289-0422-4248-8cbf-51f3d29eac7a",e._sentryDebugIdIdentifier="sentry-dbid-e0607289-0422-4248-8cbf-51f3d29eac7a")}catch{}})();const X="chat-response-generated",J="cards/ask",Y="card_policy_hero";function D(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Xe=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:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,m=C===Y?Z(i):D(i);return{onEventReceived:(n,t)=>{if(n===X&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Re(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{p(m,{state:{...o.state}}),e(N(""))},togglePageView:()=>{p(m,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&e(qe()),p(function(n){return`/${n}/${J}`}(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),p(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),p(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:K,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=K.pageTitle,Je=ee.pageTitle,Ye=K.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=me(),c=he(),d=Ce(),[p,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:m}=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===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Je:A,subtitle:I?Ze:Ye}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect(()=>{t!=null&&m!==t&&c(function(r,w){return`/${r}/${J}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,m,s,c,d.state]),l.useEffect(()=>{m!=null&&t==null&&m!=="new_chat"&&o(De({sessionId:m,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${X}`),eventCallback:(r,w,pe)=>pe.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o(Ve())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))},[j,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=m??"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(Xe,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,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?Z(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:p,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(B(n.userRoleId)),h(!1)}})})})]})},Ke=V(Ge)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-BxpjjfmG.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-BjRnoVdN.js";import{f7 as Pt,RS as os,fj as wt,bt as Fe,RT as is,RU as ds,eY as fn,RV as Pn,f5 as wn,RW as vn,RX as Tn,RY as Fn,RZ as xn,f6 as Bn,fi as Rn,R_ as Ln,R$ as ls,fc as us,fb as ms,S0 as Cs,C4 as On,fl as ia,S1 as ps,S2 as hs,e_ as fs,eZ as gs,fy as Ze,fe as Un,fd as jn,S3 as Ss,ff as bs,BB as ys,BA as Is,BE as ks,BG as Es,fr as As,eV as Mn,S4 as Ds,S5 as _s,fw as Nn,S6 as Ps,fx as yt,BM as ws,BJ as vs,eW as ge,S7 as qa,fB as xe,fC as Be,fD as Re,gv as da,cx as la,S8 as ua,S9 as vt,uS as $a,kE as za,Sa as Za,Ck as ka,fm as Qe,Cm as Tt,ku as Vn,Sb as ma,C8 as _a,Sc as Ts,Sd as Fs,Cb as Qa,Se as xs,Qe as Ja,fh as Hn,Ch as Sa,hU as Bs,Sf as Gn,f8 as Ca,bo as Rs,Sg as Ls,gg as Xa,gf as et,CQ as Os,ge as at,PW as Us,Sh as $n,cq as zn,cS as js,Qd as wa,Dp as Zn,Si as gn,C$ as Pa,Sj as Wn,Dq as Ms,QC as Ns,Dr as Vs,Ew as Hs,ua as Gs,Eq as $s,Sk as zs,Cl as ca,Sl as Zs,Sm as Ws,Sn as Ks,So as Ys,Sp as qs,Sq as Ft,Sr as Qs,CB as Kn,Cu as Js,Ss as Xs,gx as ec,CK as Yn,CO as qn,gw as ac,St as tc,Db as Qn,Su as nc,Sv as rc,Sw as sc,CM as Jn,Cx as Xn,Ce as er,CG as ar,CE as tr,CI as cc,Sx as nr,Sy as oc,ft as ic,fu as dc,fv as lc,Sz as tt,fn as rr,cU as xt,SA as uc,SB as mc,SC as Cc,SD as pc,CW as It,Di as hc,De as fc,CS as gc,Dg as Sc,D6 as bc,D8 as yc,SE as sr,Do as Ga,Kf as Ic,SF as kc,SG as Ec,SH as Ac,SI as cr,SJ as Dc,DL as _c,C_ as or,CV as Ne,CZ as Pc,SK as wc,SL as vc,C5 as Tc,SM as ir,fg as dr,SN as Fc,C7 as xc,C6 as Sn,SO as Bc,SP as Rc,SQ as Lc,MM as Oc,SR as Bt,SS as Uc,xT as lr,lc as jc,hK as Mc,DQ as Nc,ST as ur,f2 as Vc,f3 as Hc,SU as Gc,dj as $c,fk as zc,DG as Zc,DA as qe,bs as Wc,bJ as Kc,cC as Yc,bK as qc,LZ as Qc}from"./zeni-epic-state-BkEKIYbX.js";import{k as Le,cp as mr,r as we,cq as Cr,cr as pr,cs as Jc,a as ea,a0 as Rt,ct as Xc,cu as eo,X as hr,c as fr,_ as gr,s as ye,C as ue,G as W,ar as ya,cv as Sr,cw as ao,cx as to,z as te,B as va,ce as nt,cy as no,cz as ro,cA as so,K as Ta,aS as We,br as Lt,cB as co,F as Fa,m as rt,y as Ot,d as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,D as Ut,cF as lo,au as br,a4 as Et,cG as uo,Z as yr,W as Ir,f 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 Wa,cO as bo,cP as yo,cQ as ht,w as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,i as Po}from"./index-DG5dsziC.js";import{n as He,D as Er,S as wo}from"./mui-CdxnWIp4.js";import{a as r}from"./sentry-B06otMHd.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CFgUcHmD.js";import{M as Ie}from"./MobileAppDrawer-BVsx0d52.js";import{d as jt}from"./recharts-CFinCL-a.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 vo,i as Mt,P as To,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-B8WYHzUu.js";import{u as wr}from"./useInitialThreadRequest-Dc7yU2XH.js";import ct from"./NotFoundScreen-6c0jfbLt.js";import{u as Vt}from"./useChargeCardPusherEvents-DT2ptjCA.js";import{n as yn}from"./utils-CaYSR2MR.js";import{t as Bo}from"./AddressScreen-_QOTUIVr.js";import"./analytics-CMhYvjgp.js";import"./plaid-DtXw88Ai.js";import"./dnd-DD1NomKe.js";import"./stripe-DMRn4zHo.js";import"./lottie-iCzPfqr5.js";import"./lexical-CkYiXWk9.js";import"./pdf-C9PyNDT1.js";import"./analyticsHelper-D86wGf3h.js";import"./routePaths-C7myDwxn.js";import"./BusinessVerificationPageScreen-CzDFv09Y.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]="f8e72ee3-d8d0-4e69-879b-bbe92f5ef14a",e._sentryDebugIdIdentifier="sentry-dbid-f8e72ee3-d8d0-4e69-879b-bbe92f5ef14a")}catch{}})();const Ro=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}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Ro(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){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(),Lo=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),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=>vn(E.cardPolicyState)),B=i(E=>Tn(E.cardPolicyState)),R=i(E=>Fn(E.cardPolicyState)),p=i(E=>xn(E.cardPolicyState)),h=i(E=>Bn(E.cardPolicyState)),T=i(E=>Pt(E.cardPolicyState)),u=i(E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount),v=i(E=>E.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Rn())},[a,w]),Tr();const k=i(E=>Ln(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(Lo),[l]),M=r.useMemo(()=>h.map(Oo),[h]),V=r.useMemo(()=>d.cards.filter(E=>!mr(E.status.code)).map(vr),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&v==="Completed";r.useEffect(()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[v,a,O,x,V,u,j,B,R,p]);const L=r.useMemo(()=>jt(E=>{a(wt(E))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(E=>{L(E)},[L]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const E=we(n.state?.pathnameStackToGoBack),Y=E.poppedPathname??_;e(Y,{state:{pathnameStackToGoBack:E.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(E=>{a(hs(E))},[a]),I=r.useCallback(E=>{const Y=Cr(E);a(fs({templates:[Y]}))},[a]),N=r.useCallback(E=>{E.length!==0&&a(gs(E))},[a]),K=r.useCallback(()=>{a(fn())},[a]),J=r.useRef($);r.useEffect(()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:T==="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=Le(),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)),R=i(o=>vn(o.cardPolicyState)),p=i(o=>Tn(o.cardPolicyState)),h=i(o=>Fn(o.cardPolicyState)),T=i(o=>xn(o.cardPolicyState)),u=i(o=>Bn(o.cardPolicyState)),v=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(Rn())},[s,j]),Tr();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(vr),[k.cards]);Rt({isDataReady:A!=null});const M=r.useMemo(()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[A,f,x,d,b,R,p,h,T]),[V,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.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(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:v==="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 Zo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),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(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Ds(_)),R=i(_=>Ln(_.createCardPolicyState)),p=i(_=>_s(_.createCardPolicyState)),h=i(_=>p==null?[]:Nn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i(_=>Ps(_.createCardPolicyState)),v=ya(R.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,u,h,v]);const k=B.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ws())},[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect(()=>{A==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,A]);const b=r.useMemo(()=>B.templates.map(zo),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),Y=gr(),ne=i(oe=>Mn(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),ve=r.useMemo(()=>Fr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=Y&&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(()=>{},[]),Te=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:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({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]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(vs(_))},[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:T,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Wo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),y=Le(),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(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),v=!!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=>vt(q,n,d,u)),[M,V]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):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(Za()),K&&t(Ze({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(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())},[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,T,v,l),Y=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(va,{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:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:Y,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",Rr="charge-card-transaction-created",Lr="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",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Yo=[La,Ra],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(Ts({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(W.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,Yo),onEvent:j=>{switch(j){case La:case Ra: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=Ta(),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 R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Fs(I,s)),u=T.chargeCard,v=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),b=Re(A,R),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),M=xe(R),V=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[m,T.fetchState,S,v]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,u?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Hn(I.userState,B.userId)),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),w(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(v!=="Completed"||u==null)return c.jsx(va,{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:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,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(Rs())||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(Ls({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-BmXELsn-.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-BJ2hvem7.js";import{f7 as Pt,RS as os,fj as wt,bt as Fe,RT as is,RU as ds,eY as fn,RV as Pn,f5 as wn,RW as vn,RX as Tn,RY as Fn,RZ as xn,f6 as Bn,fi as Rn,R_ as Ln,R$ as ls,fc as us,fb as ms,S0 as Cs,C4 as On,fl as ia,S1 as ps,S2 as hs,e_ as fs,eZ as gs,fy as Ze,fe as Un,fd as jn,S3 as Ss,ff as bs,BB as ys,BA as Is,BE as ks,BG as Es,fr as As,eV as Mn,S4 as Ds,S5 as _s,fw as Nn,S6 as Ps,fx as yt,BM as ws,BJ as vs,eW as ge,S7 as qa,fB as xe,fC as Be,fD as Re,gv as da,cx as la,S8 as ua,S9 as vt,uS as $a,kE as za,Sa as Za,Ck as ka,fm as Qe,Cm as Tt,ku as Vn,Sb as ma,C8 as _a,Sc as Ts,Sd as Fs,Cb as Qa,Se as xs,Qe as Ja,fh as Hn,Ch as Sa,hU as Bs,Sf as Gn,f8 as Ca,bo as Rs,Sg as Ls,gg as Xa,gf as et,CQ as Os,ge as at,PW as Us,Sh as $n,cq as zn,cS as js,Qd as wa,Dp as Zn,Si as gn,C$ as Pa,Sj as Wn,Dq as Ms,QC as Ns,Dr as Vs,Ew as Hs,ua as Gs,Eq as $s,Sk as zs,Cl as ca,Sl as Zs,Sm as Ws,Sn as Ks,So as Ys,Sp as qs,Sq as Ft,Sr as Qs,CB as Kn,Cu as Js,Ss as Xs,gx as ec,CK as Yn,CO as qn,gw as ac,St as tc,Db as Qn,Su as nc,Sv as rc,Sw as sc,CM as Jn,Cx as Xn,Ce as er,CG as ar,CE as tr,CI as cc,Sx as nr,Sy as oc,ft as ic,fu as dc,fv as lc,Sz as tt,fn as rr,cU as xt,SA as uc,SB as mc,SC as Cc,SD as pc,CW as It,Di as hc,De as fc,CS as gc,Dg as Sc,D6 as bc,D8 as yc,SE as sr,Do as Ga,Kf as Ic,SF as kc,SG as Ec,SH as Ac,SI as cr,SJ as Dc,DL as _c,C_ as or,CV as Ne,CZ as Pc,SK as wc,SL as vc,C5 as Tc,SM as ir,fg as dr,SN as Fc,C7 as xc,C6 as Sn,SO as Bc,SP as Rc,SQ as Lc,MM as Oc,SR as Bt,SS as Uc,xT as lr,lc as jc,hK as Mc,DQ as Nc,ST as ur,f2 as Vc,f3 as Hc,SU as Gc,dj as $c,fk as zc,DG as Zc,DA as qe,bs as Wc,bJ as Kc,cC as Yc,bK as qc,LZ as Qc}from"./zeni-epic-state-DloJeuBO.js";import{k as Le,cp as mr,r as we,cq as Cr,cr as pr,cs as Jc,a as ea,a0 as Rt,ct as Xc,cu as eo,X as hr,c as fr,_ as gr,s as ye,C as ue,G as W,ar as ya,cv as Sr,cw as ao,cx as to,z as te,B as va,ce as nt,cy as no,cz as ro,cA as so,K as Ta,aS as We,br as Lt,cB as co,F as Fa,m as rt,y as Ot,d as X,a9 as st,cC as oo,bE as ba,cD as kt,cE as io,D as Ut,cF as lo,au as br,a4 as Et,cG as uo,Z as yr,W as Ir,f 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 Wa,cO as bo,cP as yo,cQ as ht,w as Io,cR as ko,cS as Eo,cT as Ao,cU as Do,cV as _o,i as Po}from"./index-Cb2H8bRb.js";import{n as He,D as Er,S as wo}from"./mui-B3F8TWde.js";import{a as r}from"./sentry-C2-xEC_Q.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BOzbn95k.js";import{M as Ie}from"./MobileAppDrawer-B0d8DjDW.js";import{d as jt}from"./recharts-oBt1fY2y.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 vo,i as Mt,P as To,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-dZPczJbV.js";import{u as wr}from"./useInitialThreadRequest-BdYNCiJn.js";import ct from"./NotFoundScreen-d1rjMqeE.js";import{u as Vt}from"./useChargeCardPusherEvents-Cd4kJm1v.js";import{n as yn}from"./utils-JA-6PgLD.js";import{t as Bo}from"./AddressScreen-C1s7NWDx.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./analyticsHelper-Blc9zWJE.js";import"./routePaths-DOpTNS7B.js";import"./BusinessVerificationPageScreen-Dv6OHSFD.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]="f8e72ee3-d8d0-4e69-879b-bbe92f5ef14a",e._sentryDebugIdIdentifier="sentry-dbid-f8e72ee3-d8d0-4e69-879b-bbe92f5ef14a")}catch{}})();const Ro=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}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Ro(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Tr(){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(),Lo=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),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=>vn(E.cardPolicyState)),B=i(E=>Tn(E.cardPolicyState)),R=i(E=>Fn(E.cardPolicyState)),p=i(E=>xn(E.cardPolicyState)),h=i(E=>Bn(E.cardPolicyState)),T=i(E=>Pt(E.cardPolicyState)),u=i(E=>E.chargeCardConfigState.receiptRequiredAboveAmount.amount),v=i(E=>E.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Rn())},[a,w]),Tr();const k=i(E=>Ln(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(Lo),[l]),M=r.useMemo(()=>h.map(Oo),[h]),V=r.useMemo(()=>d.cards.filter(E=>!mr(E.status.code)).map(vr),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&v==="Completed";r.useEffect(()=>{O&&x==null&&a(ps({cardsMasterList:V,defaultRequireReceiptAmount:u,suggestedAllowMerchants:j,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[v,a,O,x,V,u,j,B,R,p]);const L=r.useMemo(()=>jt(E=>{a(wt(E))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(E=>{L(E)},[L]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const E=we(n.state?.pathnameStackToGoBack),Y=E.poppedPathname??_;e(Y,{state:{pathnameStackToGoBack:E.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(E=>{a(hs(E))},[a]),I=r.useCallback(E=>{const Y=Cr(E);a(fs({templates:[Y]}))},[a]),N=r.useCallback(E=>{E.length!==0&&a(gs(E))},[a]),K=r.useCallback(()=>{a(fn())},[a]),J=r.useRef($);r.useEffect(()=>{const E=J.current;J.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Jc,{formDraft:x,vendorSearchOptions:M,categorySearchOptions:f,isVendorSearchLoading:T==="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=Le(),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)),R=i(o=>vn(o.cardPolicyState)),p=i(o=>Tn(o.cardPolicyState)),h=i(o=>Fn(o.cardPolicyState)),T=i(o=>xn(o.cardPolicyState)),u=i(o=>Bn(o.cardPolicyState)),v=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(Rn())},[s,j]),Tr();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(vr),[k.cards]);Rt({isDataReady:A!=null});const M=r.useMemo(()=>{if(A!=null)return Xc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[A,f,x,d,b,R,p,h,T]),[V,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.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(Ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const J=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Je,{to:"..",replace:!0}):V!=null&&j==="Completed"&&k.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(eo,{templateName:l.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:v==="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 Zo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),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(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Ds(_)),R=i(_=>Ln(_.createCardPolicyState)),p=i(_=>_s(_.createCardPolicyState)),h=i(_=>p==null?[]:Nn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i(_=>Ps(_.createCardPolicyState)),v=ya(R.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,u,h,v]);const k=B.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ws())},[a,k]);const U=B.archiveFetchState.fetchState,A=ya(U);r.useEffect(()=>{A==="In-Progress"&&U==="Completed"&&a(Ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,A]);const b=r.useMemo(()=>B.templates.map(zo),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:K}=Ve(),{isAiCfoOpen:J,setIsAiCfoOpen:o}=hr(),E=fr(),Y=gr(),ne=i(oe=>Mn(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=xr("card_policy"),ve=r.useMemo(()=>Fr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=Y&&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(()=>{},[]),Te=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:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({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]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(vs(_))},[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:T,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:m,policyAiCfoHero:f,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function Wo(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),y=Le(),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(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),v=!!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=>vt(q,n,d,u)),[M,V]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):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(Za()),K&&t(Ze({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(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Vn())},[A.fetchState,b.fetchState,t,u,l,g,x]);const J=()=>{if(a!=null&&n!=null){t(Za());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Xe(u,T,v,l),Y=Ba(u,l,g,A,b),ne=Ar(o,f);return f.fetchState!=="Completed"?c.jsx(va,{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:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:Y,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",Rr="charge-card-transaction-created",Lr="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",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Yo=[La,Ra],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(Ts({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(W.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,Yo),onEvent:j=>{switch(j){case La:case Ra: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=Ta(),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 R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Fs(I,s)),u=T.chargeCard,v=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:k}=ue(),{isFeatureEnabled:U}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),b=Re(A,R),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),M=xe(R),V=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[m,T.fetchState,S,v]);const $=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(xs({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,u?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Hn(I.userState,B.userId)),G=()=>{u?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),w(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const Q=I=>{j(I)};if(v!=="Completed"||u==null)return c.jsx(va,{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:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,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(Rs())||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(Ls({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-BmXELsn-.js";import{a as g}from"./sentry-C2-xEC_Q.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-BJ2hvem7.js";import{z as D,be as P,D as F,d as V,f as A,ag as C,bf as j,au as L,av as B,s as U}from"./index-Cb2H8bRb.js";import{eW as b,gi as M,tB as _,gd as R,c7 as z,Pm as G,bn as Y,rB as H,rp as W,l4 as Z,mF as S,Pn as $,bE as q,cA as N,mP as J,mS as K}from"./zeni-epic-state-DloJeuBO.js";import"./mui-B3F8TWde.js";import{d as Q}from"./routePaths-DOpTNS7B.js";import{M as X}from"./MobileAppDrawer-B0d8DjDW.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]="4ef618f8-7b48-4072-a598-e1fefcd60167",t._sentryDebugIdIdentifier="sentry-dbid-4ef618f8-7b48-4072-a598-e1fefcd60167")}catch{}})();const ee=E(function(t){const a=R(t),i=D.getSignedInUser(),p=b(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=Q(f,e),o=U(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({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:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(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:B(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?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};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($(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(Z({files:e}))},onDeleteFile:e=>{t(W(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}})(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>b(s)),d=r.companyId??D.getSignedInUserTenant(p)?.companyId;if(D.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!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,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-BmXELsn-.js";import{a}from"./sentry-C2-xEC_Q.js";import{u as D,g as v,j as m,N as w}from"./core-BJ2hvem7.js";import{LV as A,eW as O,g0 as _,o8 as j,gr as h,f$ as L,fz as U,M0 as $}from"./zeni-epic-state-DloJeuBO.js";import{u as F,z as f,L as g,a as k,o as z}from"./index-Cb2H8bRb.js";import{n as H}from"./mui-B3F8TWde.js";import{t as R}from"./getLocaleForTenant-CL6-EEpd.js";import{g as P,Q as V}from"./QBOConnectionScreen-zYBPrktU.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";import"./empty-C58nz7T4.js";import"./pdf-lib-V8KKPtc-.js";import"./index-Dvw5M8XH.js";import"./url-CknUO84a.js";import"./index-De1lB-0i.js";import"./decodeURIComponentSafe-D-dduCwh.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="f3a3c05e-1dee-4bbf-aaa3-b58061976062",t._sentryDebugIdIdentifier="sentry-dbid-f3a3c05e-1dee-4bbf-aaa3-b58061976062")}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-BmXELsn-.js";import{z as n}from"./index-Cb2H8bRb.js";import{g as d}from"./QBOConnectionScreen-zYBPrktU.js";import"./sentry-C2-xEC_Q.js";import{g as p,N as s}from"./core-BJ2hvem7.js";import"./zeni-epic-state-DloJeuBO.js";import"./recharts-oBt1fY2y.js";import"./mui-B3F8TWde.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";import"./empty-C58nz7T4.js";import"./pdf-lib-V8KKPtc-.js";import"./index-Dvw5M8XH.js";import"./url-CknUO84a.js";import"./index-De1lB-0i.js";import"./decodeURIComponentSafe-D-dduCwh.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-CU2s9JFJ.js → CustomerOnboardingRoutes-BPRzngBR.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-BmXELsn-.js";import{t as yt,A as Ve}from"./AddressScreen-C1s7NWDx.js";import ht from"./NotFoundScreen-d1rjMqeE.js";import{a as d}from"./sentry-C2-xEC_Q.js";import{h as be,g as Ie,u as ne,i as ke,j as k,N as U,l as St,n as et,o as Ct,p as q}from"./core-BJ2hvem7.js";import{z as R,C as _e,G as Z,A as bt,s as K,D as ae,d as N,f as de,aq as It,K as kt,w as tt,k as nt,ar as Le,m as Se,as as _t,o as Re,at as Ne,au as vt,av as Me,aw as Ot,ax as Tt}from"./index-Cb2H8bRb.js";import{eW as J,fD as ve,fB as Oe,bs as wt,fR as xt,bS as Et,o6 as At,tl as Pt,to as Dt,MU as jt,MV as Ft,k8 as Ce,kb as at,Mp as Bt,bZ as Ut,c7 as le,tP as Te,tA as Vt,MW as ue,tQ as ot,Ki as Lt,lc as st,MX as Rt,MY as Nt,ri as Mt,hp as $t,Mh as ge,hm as Gt,Mi as zt,y0 as Kt,rm as Qt,he as qt,hh as $e,MZ as it,M_ as Zt,E3 as Ht,M$ as Wt,E7 as Jt,tr as Xt,N0 as Yt,N1 as en,k6 as tn,k9 as nn,u0 as an,tC as rt,tO as on,bE as Ge,cA as sn,t$ as ze,rB as rn,rp as cn,l4 as dn,gg as un,gf as ln,ge as pn,N2 as mn,tu as gn,u1 as fn,u4 as yn,u7 as hn,ud as Sn,cZ as Cn}from"./zeni-epic-state-DloJeuBO.js";import{n as we}from"./mui-B3F8TWde.js";import{g as bn,h as In,q as oe}from"./QBOConnectionScreen-zYBPrktU.js";import{u as kn,a as _n}from"./useEmailConnectResultRefresh-BgBSgX9b.js";import{u as vn}from"./useChargeCardPusherEvents-Cd4kJm1v.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";import"./empty-C58nz7T4.js";import"./pdf-lib-V8KKPtc-.js";import"./index-Dvw5M8XH.js";import"./url-CknUO84a.js";import"./index-De1lB-0i.js";import"./decodeURIComponentSafe-D-dduCwh.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]="b954459d-2fb7-43ea-afcd-2319d0bdf286",t._sentryDebugIdIdentifier="sentry-dbid-b954459d-2fb7-43ea-afcd-2319d0bdf286")}catch{}})();const On=()=>{const t=be(),u=Ie(),i=ne(),[o,l]=d.useState(!1),[c,y]=d.useState(!1),{tenantEmailDomain:S}=ke(),e=R.getSignedInUser(),{useFeatureGate:n}=_e(),{isFeatureEnabled:s}=n(Z.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(Z.isArAgingFeatureEnabled),{isFeatureEnabled:_}=n(Z.isReferralFeatureEnabled),{isFeatureEnabled:I}=n(Z.isExpenseAutomationEnabledV2),{isFeatureEnabled:T}=n(Z.isDebitCardFeatureEnabled),r=bt(),f=k(h=>J(h)),p=k(h=>h.onboardingCustomerViewState.fetchState),v=f.excludedResources,O=f.companyId??R.getSignedInUserTenant(S)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const w=ve(T,f),P=Oe(f),m=[],M=v?.resources?.find(h=>h.resource==="/reports/top_expenses")==null,j=v?.resources?.find(h=>h.resource==="/reports/task_card")==null,$=f?.userRole!=null&&wt(f?.userRole),G=v?.resources?.find(h=>h.resource==="/bills")==null&&!$,E=v?.resources?.find(h=>h.resource==="/reimbursements")==null;M===!1&&m.push("top_expenses"),j===!1&&m.push("task_card"),G===!1&&m.push("bill_pay_card","bill_pay_promo_card"),E===!1&&m.push("reimbursement_card","reimbursement_promo_card"),m.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&m.push("rewards_card");const F=k(h=>{const D=[];s===!1&&D.push("accounts_payable_aging"),C===!1&&D.push("accounts_receivable_aging"),D.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&D.push("rewards_card"),r===!1&&D.push("expense_automation_card");const H=xt(h,D,e,I,r);return Et(H.reportsInOrder.map(A=>({fetchState:A.fetchState,error:A.error}))).fetchState});d.useEffect(()=>{p!=="Completed"||o||w||P||(l(!0),i(At(e.userId,O,f.tenantId,!0,!1,m)))},[o,p,w,P,e,f.tenantId,i]);const Q=d.useRef(!1),z=d.useCallback(()=>{const h={pathnameStackToGoBack:K(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};t(w?"../../checking":P?"../../cards":"../../dashboard",{state:h})},[t,u,w,P]),V=d.useCallback(()=>{Q.current||(Q.current=!0,z())},[z]);return d.useEffect(()=>{const h=setTimeout(()=>y(!0),3e3);return()=>clearTimeout(h)},[]),d.useEffect(()=>{const h=setTimeout(V,6e3);return()=>clearTimeout(h)},[V]),d.useEffect(()=>{w||P||!c||F!=="Completed"&&F!=="Error"||V()},[c,F,w,P,V]),p!=="Completed"?a.jsx(U,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(ae,{analytics:N,onLoad:h=>h.trackPageLoaded(de.Event.onboardingDashboardActivation)}),a.jsx(It,{show:!0,onComplete:V})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ke=(t,u)=>{const i=new Map(t.map(o=>[o.key,o]));return u.map(o=>{return l=i.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l})},Qe=(t,u)=>{if(t.length===0)return!1;const i=new Map(t.map(o=>[o.key,o]));return u.every(o=>i.get(o)?.status==="ready")},qe=we.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${t=>t.theme.colors.grey4};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-BxpjjfmG.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 O,N as Pn}from"./core-BjRnoVdN.js";import{eW as U,Nl as We,bE as ia,bo as De,Oz as On,i_ as Fn,OA as Kt,OB as Rn,j1 as Ct,OC as Ze,OD as Bn,j6 as jn,OE as qt,OF as Mn,ja as kt,OG as Qe,OH as Ln,cq as yt,OI as Un,OJ as Gn,NF as Vn,k2 as Nn,OK as Yn,bn as Xe,OL as ca,N9 as ce,bc as la,kg as da,og as ua,j$ as ma,Nb as le,Na as J,eV as pa,fr as $n,g2 as _t,OM as zn,ON as Kn,OO as ha,OP as Oe,vS as Me,vT as Le,we,w8 as de,vX as Ue,OQ as qn,OR as Zn,OS as Qn,OT as fa,OU as Fe,OV as Hn,dI as Je,s9 as ga,OW as Wn,OX as Xn,OY as Jn,OZ as vt,Mr as At,kw as xe,wm as It,sh as eo,O_ as to,vU as Zt,sc as Ee,s8 as ba,O$ as ge,P0 as ao,P1 as Et,Mq as Tt,uh as Ca,P2 as no,P3 as oo,P4 as so,P5 as Dt,ux as ro,P6 as io,vW as Qt,ug as ka,P7 as be,P8 as co,bs as _a,wq as Sa,P9 as lo,Pa as uo,Pb as mo,Pc as wt,wl as po,Pd as ho,vV as Ht,wp as ya,Pe as Ce,Pf as fo,Pg as go,Ph as va,kl as Aa,od as Ia,kq as Ea,ob as Ta,oa as Da,o9 as wa,tF as bo,Pi as Co,cU as ko,cV as _o,o6 as So,fR as yo,on as vo,GD as dt,Gv as Ao,Gz as Io,Pj as Eo,Pk as To,Pl as Do,b5 as et,fJ as wo,hI as xo,gi as Po,oh as Oo,jU as Fo,oe as Ro,oc as Bo,fD as jo,fB as Mo}from"./zeni-epic-state-BkEKIYbX.js";import{z as M,a4 as te,s as w,d as T,a as q,a_ as Lo,a0 as Ge,D as Ve,a$ as xa,f as N,b0 as Uo,k as _e,b1 as Pa,C as Se,G as B,y as Go,b2 as Vo,b3 as No,X as Oa,K as Fa,c as Ra,_ as Yo,b4 as $o,T as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,A as Zo,ar as Qo,r as Ho,Z as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-DG5dsziC.js";import{n as xt}from"./mui-CdxnWIp4.js";import{a as b}from"./sentry-B06otMHd.js";import{w as Ua}from"./withTransactionSidePanel-tBE2uHP9.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as as}from"./routePaths-C7myDwxn.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CFgUcHmD.js";import je from"./NotFoundScreen-6c0jfbLt.js";import{u as Ot}from"./useInitialThreadRequest-Dc7yU2XH.js";import{t as Va}from"./analyticsHelper-D86wGf3h.js";import{C as ns}from"./CompanyPassportScreen-Dgc1b90N.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-TpXXYr6r.js";import{F as ss}from"./FeaturePreviewScreen-BfuOs-n9.js";import"./recharts-CFinCL-a.js";import"./analytics-CMhYvjgp.js";import"./plaid-DtXw88Ai.js";import"./dnd-DD1NomKe.js";import"./stripe-DMRn4zHo.js";import"./lottie-iCzPfqr5.js";import"./lexical-CkYiXWk9.js";import"./pdf-C9PyNDT1.js";import"./utils-CaYSR2MR.js";import"./TransactionDetailScreen-CHtoQtM9.js";import"./decodeURIComponentSafe-8RHUrhvv.js";import"./MobileAppDrawer-BVsx0d52.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]="f3eddb24-de73-4860-99a7-93d41a10ebbb",e._sentryDebugIdIdentifier="sentry-dbid-f3eddb24-de73-4860-99a7-93d41a10ebbb")}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):De(),[r]),p=$(),f=W(),S=_(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Fn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),k=b.useCallback((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))},[]),D=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:D,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??De(),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,D)=>{e(Ze({sortKey:D,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,D)=>{},[]),v=b.useCallback((k,D)=>{e(Ze({selectedDate:k,agingDateSelectionType:D})),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):De(),[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}))},[]),D=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:D,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??De(),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=Pe(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)(Pa),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)(Pa);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-BmXELsn-.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 O,N as Pn}from"./core-BJ2hvem7.js";import{eW as U,Nl as We,bE as ia,bo as De,Oz as On,i_ as Fn,OA as Kt,OB as Rn,j1 as Ct,OC as Ze,OD as Bn,j6 as jn,OE as qt,OF as Mn,ja as kt,OG as Qe,OH as Ln,cq as yt,OI as Un,OJ as Gn,NF as Vn,k2 as Nn,OK as Yn,bn as Xe,OL as ca,N9 as ce,bc as la,kg as da,og as ua,j$ as ma,Nb as le,Na as J,eV as pa,fr as $n,g2 as _t,OM as zn,ON as Kn,OO as ha,OP as Oe,vS as Me,vT as Le,we,w8 as de,vX as Ue,OQ as qn,OR as Zn,OS as Qn,OT as fa,OU as Fe,OV as Hn,dI as Je,s9 as ga,OW as Wn,OX as Xn,OY as Jn,OZ as vt,Mr as At,kw as xe,wm as It,sh as eo,O_ as to,vU as Zt,sc as Ee,s8 as ba,O$ as ge,P0 as ao,P1 as Et,Mq as Tt,uh as Ca,P2 as no,P3 as oo,P4 as so,P5 as Dt,ux as ro,P6 as io,vW as Qt,ug as ka,P7 as be,P8 as co,bs as _a,wq as Sa,P9 as lo,Pa as uo,Pb as mo,Pc as wt,wl as po,Pd as ho,vV as Ht,wp as ya,Pe as Ce,Pf as fo,Pg as go,Ph as va,kl as Aa,od as Ia,kq as Ea,ob as Ta,oa as Da,o9 as wa,tF as bo,Pi as Co,cU as ko,cV as _o,o6 as So,fR as yo,on as vo,GD as dt,Gv as Ao,Gz as Io,Pj as Eo,Pk as To,Pl as Do,b5 as et,fJ as wo,hI as xo,gi as Po,oh as Oo,jU as Fo,oe as Ro,oc as Bo,fD as jo,fB as Mo}from"./zeni-epic-state-DloJeuBO.js";import{z as M,a4 as te,s as w,d as T,a as q,a_ as Lo,a0 as Ge,D as Ve,a$ as xa,f as N,b0 as Uo,k as _e,b1 as Pa,C as Se,G as B,y as Go,b2 as Vo,b3 as No,X as Oa,K as Fa,c as Ra,_ as Yo,b4 as $o,T as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,A as Zo,ar as Qo,r as Ho,Z as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-Cb2H8bRb.js";import{n as xt}from"./mui-B3F8TWde.js";import{a as b}from"./sentry-C2-xEC_Q.js";import{w as Ua}from"./withTransactionSidePanel-r761w2FA.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as as}from"./routePaths-DOpTNS7B.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-BOzbn95k.js";import je from"./NotFoundScreen-d1rjMqeE.js";import{u as Ot}from"./useInitialThreadRequest-BdYNCiJn.js";import{t as Va}from"./analyticsHelper-Blc9zWJE.js";import{C as ns}from"./CompanyPassportScreen-DF5d8NUa.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-BwLMNzEC.js";import{F as ss}from"./FeaturePreviewScreen-Cyx3f191.js";import"./recharts-oBt1fY2y.js";import"./analytics-BJExxbwc.js";import"./plaid-BJIJT42b.js";import"./dnd-DZ9CRV59.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bnlt89v4.js";import"./lexical-XHlNR9IH.js";import"./pdf-De5tezT3.js";import"./utils-JA-6PgLD.js";import"./TransactionDetailScreen-OoYWWqNu.js";import"./decodeURIComponentSafe-D-dduCwh.js";import"./MobileAppDrawer-B0d8DjDW.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]="f3eddb24-de73-4860-99a7-93d41a10ebbb",e._sentryDebugIdIdentifier="sentry-dbid-f3eddb24-de73-4860-99a7-93d41a10ebbb")}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):De(),[r]),p=$(),f=W(),S=_(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Fn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),k=b.useCallback((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))},[]),D=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:D,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??De(),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,D)=>{e(Ze({sortKey:D,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,D)=>{},[]),v=b.useCallback((k,D)=>{e(Ze({selectedDate:k,agingDateSelectionType:D})),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):De(),[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}))},[]),D=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:D,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??De(),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=Pe(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)(Pa),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)(Pa);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%;
|