@zeniai/web-app-ui 5.1.95-dev → 5.1.95-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AddressRoutes-BGgBsLRh.js → AddressRoutes-Bvp69dKv.js} +1 -1
- package/dist/assets/{AddressScreen-BhzQLd2o.js → AddressScreen-60Qj_YsR.js} +1 -1
- package/dist/assets/{AiCfoScreen-CK90zIPE.js → AiCfoScreen-Di0AIuiw.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-DUR0CXqd.js → BillPayApprovalRoutes-DYpPCevA.js} +1 -1
- package/dist/assets/{BillPayRoutes-D1a18iDG.js → BillPayRoutes-Bu0-qZ-c.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-D7H_6Ycl.js → BusinessVerificationPageScreen-BJQI2dfg.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-D16oDYzS.js → CardsAiCfoScreen-DZM91jF5.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-COdlwnbU.js → ChargeCardRoutes-BAl2IXHY.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-BVAY4gEa.js → CompanyPassportScreen-BqFRrI6s.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-W3CoEBGV.js → ConnectionAuthScreen-BPYnoMNn.js} +1 -1
- package/dist/assets/{CustomerOnboardingAuthScreen-D644qhJo.js → CustomerOnboardingAuthScreen-CpFI1iA5.js} +1 -1
- package/dist/assets/{CustomerOnboardingRoutes-DdKnlwn5.js → CustomerOnboardingRoutes-BF11xENe.js} +1 -1
- package/dist/assets/{DashboardRoutes-DHqNqXXm.js → DashboardRoutes-21HP5X_L.js} +1 -1
- package/dist/assets/{DefaultTenantHome-4ZPXNy2A.js → DefaultTenantHome-DFLplybG.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-CYNJnP1G.js → DomesticWireDetailScreen-CDRDMeDf.js} +1 -1
- package/dist/assets/{DrawerScreen-Dw68qJE2.js → DrawerScreen-BUPBRQzG.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-CmbxziPm.js → EntityDetailRoutes-Q3W6ugXO.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-BhSurnrx.js → ExpenseAutomationRoutes-CVoR9HYp.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-D-CcSiZr.js → FeaturePreviewScreen-Cwp5VJhY.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-CdWLUkwz.js → HubSpotOAuthCallbackScreen-EZqM5g1_.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-Cufxx_9Z.js → MagicLinkRoutes-BDpBWVZh.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-BlnwJPL_.js → MagicLinkSignInScreen-JI4681jr.js} +1 -1
- package/dist/assets/{MobileAppDrawer-CB-RZZ92.js → MobileAppDrawer-zPhOmrIU.js} +1 -1
- package/dist/assets/{NotFoundScreen-iwRtifEl.js → NotFoundScreen-8EvUnY3z.js} +1 -1
- package/dist/assets/{NotificationRoutes-Da00R-X3.js → NotificationRoutes-Cdv9W6jW.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-DRfp49Um.js → OAuthConsentScreen-CUtdcAoz.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-CgigxmZu.js → PandLWithForecastRoutes-CuuM3cYK.js} +1 -1
- package/dist/assets/{PeopleRoutes-B8Qsj9Gp.js → PeopleRoutes-CphF1WML.js} +1 -1
- package/dist/assets/{PerformanceRoutes-CpaSU8a_.js → PerformanceRoutes-DSbitX-g.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-_UbPaBIH.js → QBOConnectionScreen-QhaMmbnN.js} +1 -1
- package/dist/assets/{ReferralListScreen-9chFTKdh.js → ReferralListScreen-DTyhwsoO.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-B9au9MRY.js → ReimbursementApprovalRoutes-OfO6QOTb.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BOtH5UIX.js → ReimbursementApprovalRuleDetailScreen-C909zELF.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BpKyNBJb.js → ReimbursementRoutes-D7NThH82.js} +1 -1
- package/dist/assets/{ReportsRoutes-CLFHU_O2.js → ReportsRoutes-C3CvAXR5.js} +1 -1
- package/dist/assets/{RewardsRoutes-CHL77VZM.js → RewardsRoutes-Dxy1QY7_.js} +1 -1
- package/dist/assets/{ScreenRoutes-RWbD63jU.js → ScreenRoutes-Bi_xt3-M.js} +2 -2
- package/dist/assets/{SettingsRoutes-CF5KYJhG.js → SettingsRoutes-Cpq8r6km.js} +1 -1
- package/dist/assets/{SetupPagesScreen-DNjkbEBz.js → SetupPagesScreen-BDROUOA_.js} +1 -1
- package/dist/assets/{SignInScreen-CRJsXgNI.js → SignInScreen-Bmr5nDta.js} +1 -1
- package/dist/assets/{SignOutScreen-Dbi2_r9c.js → SignOutScreen-p_VDTC3u.js} +1 -1
- package/dist/assets/{TaskListScreen-DZK7I68y.js → TaskListScreen-ey3bya3t.js} +1 -1
- package/dist/assets/{TaskRoutes-XZqLu999.js → TaskRoutes-e7xFo9Ej.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-35-dkTu-.js → TransactionDetailRoutes-DGUPG-G4.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-BTk8hKel.js → TransactionDetailScreen-BB5tBHdE.js} +1 -1
- package/dist/assets/{TransactionListRoutes-N6loT6Tb.js → TransactionListRoutes-D1CLAZ1r.js} +1 -1
- package/dist/assets/{TreasuryRoutes-C--NVOrM.js → TreasuryRoutes-Dw2aLpt8.js} +1 -1
- package/dist/assets/{VendorsRoutes-DX6hUZtV.js → VendorsRoutes-D1DStejL.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-DOt-sno6.js → WiseConfirmationScreen-CqRNL2k6.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-CRKI5nAD.js → ZeniAccountRoutes-DqgQBbks.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-uYvjpFdj.js → ZeniAccountStatementScreen-DN7zMc9n.js} +1 -1
- package/dist/assets/{analyticsHelper-C_-TghPV.js → analyticsHelper-B5fcdQll.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DTPQOzXV.js → getLocaleForTenant-CDIB5Rqc.js} +1 -1
- package/dist/assets/{index-BcXEZO_T.js → index-DW3WLCwX.js} +5 -5
- package/dist/assets/{routePaths-cxejtx48.js → routePaths-Bf6hqCDy.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CEM3mmbG.js → useAiCfoDashboardSuggestedQuestionsChips-BT0w9R5w.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-CybhtSUM.js → useAskAiCfoHostNavButtonProps-Dnw9TFpe.js} +1 -1
- package/dist/assets/{useCashManagementBanner-C_-asNx6.js → useCashManagementBanner-CY5tE-AL.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-BARxawWT.js → useChargeCardPusherEvents-Kefa2Uws.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-B4uzu3-e.js → useEmailConnectResultRefresh-DQEVaDNk.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-B3-16zoW.js → useInitialThreadRequest-Cm9uHxR_.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-Cokro6eW.js → withTransactionSidePanel-DvXF470h.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-4Rd12v3w.js";import{A as d}from"./AddressScreen-
|
|
1
|
+
import{j as e}from"./liveblocks-4Rd12v3w.js";import{A as d}from"./AddressScreen-60Qj_YsR.js";import i from"./NotFoundScreen-8EvUnY3z.js";import"./sentry-DNaNh7eC.js";import{o as s,p as r}from"./core-BSTuY0H-.js";import"./zeni-epic-state-C1K4xiie.js";import"./recharts-DWt5pa4F.js";import"./index-DW3WLCwX.js";import"./mui-BNQNnKUH.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-4Rd12v3w.js";import{a as h}from"./sentry-DNaNh7eC.js";import{h as P,u as _,g as M,i as j,j as E,n as B}from"./core-BSTuY0H-.js";import{J as L,y as $,z as D,T as K,B as U,A as N,e as C,g as S,r as z,m as b,s as F}from"./index-
|
|
1
|
+
import{j as r}from"./liveblocks-4Rd12v3w.js";import{a as h}from"./sentry-DNaNh7eC.js";import{h as P,u as _,g as M,i as j,j as E,n as B}from"./core-BSTuY0H-.js";import{J as L,y as $,z as D,T as K,B as U,A as N,e as C,g as S,r as z,m as b,s as F}from"./index-DW3WLCwX.js";import{ML as w,hU as R,eX as G,MM as O,c6 as V,MN as q,ld as H}from"./zeni-epic-state-C1K4xiie.js";import{n as J}from"./mui-BNQNnKUH.js";import X from"./NotFoundScreen-8EvUnY3z.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]="8142039d-b820-446e-b7ea-d9d1ade4578a",e._sentryDebugIdIdentifier="sentry-dbid-8142039d-b820-446e-b7ea-d9d1ade4578a")}catch{}})();const Q=J.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-4Rd12v3w.js";import{a as r}from"./sentry-DNaNh7eC.js";import{u as xe,h as Pe,g as we,j as K,i as ye,n as Ee}from"./core-BSTuY0H-.js";import{X as Te,dd as ve,z as Ae,J as Qe,de as _e,df as Oe,bb as Z,dg as ae,dh as Ue,ba as se,s as V,A as B,e as I,di as R,dj as je,dk as Le,a3 as Fe,g as De,a9 as Be,dl as Re,dm as Me,a4 as Ve,dn as $e,dp as Ge,dq as Ne,v as qe,b6 as We,dr as ze}from"./index-BcXEZO_T.js";import{gl as He,eW as oe,eX as Xe,iA as Ye,TX as Je,fq as Ke,iK as Ze,iG as et,eY as M,fx as tt,g6 as at,f$ as st,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-C1K4xiie.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-BNQNnKUH.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-CEM3mmbG.js";import{p as pt}from"./pathToGoBack-ujlITM0J.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.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]="6a8656cc-e914-49a2-88c0-ee2ee00dfe52",e._sentryDebugIdIdentifier="sentry-dbid-6a8656cc-e914-49a2-88c0-ee2ee00dfe52")}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=Me(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:`${Ve}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}}),(function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,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:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,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&&We(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=V(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=V(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)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect((()=>{t(He())}),[t]);const m=K((i=>oe(i))),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=K((i=>Xe(i))),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.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")??w?.aiCfoRef,L=N.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect((()=>{W.current||q!=="month-end-email"||L==null||n!=null||s==null||(t(Ye("controller",s.userId,L,"MONTH_END_EMAIL")),W.current=!0)}),[q,L,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(Je()))}),[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=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),Y=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(Y,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=V(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(Ke({sessionId:l,agentId:"controller"}))}),[]);const Ce=r.useMemo((()=>({events:z.map((i=>`private-encrypted-chat-${i}.${ne}`)),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)})),[z]);r.useEffect((()=>{F!=="In-Progress"&&D&&t(Ze())}),[F,D,t]),r.useEffect((()=>{n!=null&&H!=="In-Progress"&&X&&s!=null&&F==="Completed"&&!D&&t(et(n,s.userId))}),[H,X,n,s,t]);const J=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:J}),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(M(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:J}):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(M(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:Y,allUsers:x,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(M(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
1
|
+
import{j as c}from"./liveblocks-4Rd12v3w.js";import{a as r}from"./sentry-DNaNh7eC.js";import{u as xe,h as Pe,g as we,j as K,i as ye,n as Ee}from"./core-BSTuY0H-.js";import{X as Te,dd as ve,z as Ae,J as Qe,de as _e,df as Oe,bb as Z,dg as ae,dh as Ue,ba as se,s as V,A as B,e as I,di as R,dj as je,dk as Le,a3 as Fe,g as De,a9 as Be,dl as Re,dm as Me,a4 as Ve,dn as $e,dp as Ge,dq as Ne,v as qe,b6 as We,dr as ze}from"./index-DW3WLCwX.js";import{gl as He,eW as oe,eX as Xe,iA as Ye,TX as Je,fq as Ke,iK as Ze,iG as et,eY as M,fx as tt,g6 as at,f$ as st,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-C1K4xiie.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-BNQNnKUH.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-BT0w9R5w.js";import{p as pt}from"./pathToGoBack-ujlITM0J.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.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]="6a8656cc-e914-49a2-88c0-ee2ee00dfe52",e._sentryDebugIdIdentifier="sentry-dbid-6a8656cc-e914-49a2-88c0-ee2ee00dfe52")}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=Me(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:`${Ve}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}}),(function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,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:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,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&&We(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=V(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=V(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)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect((()=>{t(He())}),[t]);const m=K((i=>oe(i))),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=K((i=>Xe(i))),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.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")??w?.aiCfoRef,L=N.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect((()=>{W.current||q!=="month-end-email"||L==null||n!=null||s==null||(t(Ye("controller",s.userId,L,"MONTH_END_EMAIL")),W.current=!0)}),[q,L,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(Je()))}),[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=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),Y=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(Y,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=V(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(Ke({sessionId:l,agentId:"controller"}))}),[]);const Ce=r.useMemo((()=>({events:z.map((i=>`private-encrypted-chat-${i}.${ne}`)),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)})),[z]);r.useEffect((()=>{F!=="In-Progress"&&D&&t(Ze())}),[F,D,t]),r.useEffect((()=>{n!=null&&H!=="In-Progress"&&X&&s!=null&&F==="Completed"&&!D&&t(et(n,s.userId))}),[H,X,n,s,t]);const J=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:J}),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(M(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:J}):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(M(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:Y,allUsers:x,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(M(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-4Rd12v3w.js";import{a as v}from"./sentry-DNaNh7eC.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-BSTuY0H-.js";import{eX as P,Qa as A,PS as h,zt as E,zl as q,zp as R,ze as K,PU as Q,zv as ae,zh as X,zy as G,zu as C}from"./zeni-epic-state-C1K4xiie.js";import{z as V,a9 as H,bN as oe,ag as O,bE as J,bO as le,y as M,B as Y,bP as pe,bQ as se}from"./index-BcXEZO_T.js";import"./mui-BNQNnKUH.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-BOtH5UIX.js";import re from"./NotFoundScreen-iwRtifEl.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]="a6d0e56c-5c82-45de-8c7d-43f44dec0701",e._sentryDebugIdIdentifier="sentry-dbid-a6d0e56c-5c82-45de-8c7d-43f44dec0701")}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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=y((s=>P(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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...m})},_="bill-approval-rule-update",de=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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(H(le)),ue=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=y((s=>P(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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...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,u=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=M(),n=y((i=>h(i))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(v.useEffect((()=>{l||(d(!0),p(X(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t})}const 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,u=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=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:d(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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>P(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=M(),n=y((i=>h(i))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(d(!0),p(X(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(ue,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
1
|
+
import{j as c}from"./liveblocks-4Rd12v3w.js";import{a as v}from"./sentry-DNaNh7eC.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-BSTuY0H-.js";import{eX as P,Qa as A,PS as h,zt as E,zl as q,zp as R,ze as K,PU as Q,zv as ae,zh as X,zy as G,zu as C}from"./zeni-epic-state-C1K4xiie.js";import{z as V,a9 as H,bN as oe,ag as O,bE as J,bO as le,y as M,B as Y,bP as pe,bQ as se}from"./index-DW3WLCwX.js";import"./mui-BNQNnKUH.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-C909zELF.js";import re from"./NotFoundScreen-8EvUnY3z.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]="a6d0e56c-5c82-45de-8c7d-43f44dec0701",e._sentryDebugIdIdentifier="sentry-dbid-a6d0e56c-5c82-45de-8c7d-43f44dec0701")}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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}}))(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=y((s=>P(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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:d,location:t,navigate:p,...m})},_="bill-approval-rule-update",de=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:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}}))(H(le)),ue=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,u]=v.useState(!1),l=y((s=>s.billPaySetupApproverViewState.fetchState)),d=y((s=>P(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||(u(!0),o(R())),p("./new"))}),[n,i,o]);const m={events:d.companyId!=null?[`private-encrypted-${d.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return d?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(de,{currentTenant:d,location:t,navigate:p,isLoading:e,...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,u=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=M(),n=y((i=>h(i))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(v.useEffect((()=>{l||(d(!0),p(X(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t})}const 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,u=O(p.location);return{onApprovalRuleDataUpdated:l=>{const d=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:d(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:d(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||u?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}}))(se);function $(){const e=y((t=>P(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=M(),n=y((i=>h(i))),u=y((i=>A(i))),[l,d]=v.useState(!1);if(Z(),v.useEffect((()=>{l||(d(!0),p(X(!0)))})),v.useEffect((()=>{u.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[u,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:u,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(ue,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-4Rd12v3w.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as Y,l as na,o as ia,p as S}from"./core-BSTuY0H-.js";import{eX as W,Ps as Ue,bs as kt,Kg as oa,bq as wt,bJ as pe,Pt as At,yL as Ct,z_ as $e,zi as la,bn as De,Pu as sa,Pv as ra,c6 as ca,Pw as da,kx as Bt,Px as xt,Py as Et,Az as Ge,y_ as Be,Pz as ua,yz as tt,PA as pa,EE as ma,yD as ba,yJ as Dt,PB as ve,PC as Me,z$ as Oe,PD as ha,PE as ga,A2 as Ne,PF as ya,Af as Sa,PG as Pt,zL as at,zQ as fa,PH as va,PI as ue,PJ as jt,PK as Tt,PL as Ft,gp as Ia,z3 as Le,cA as Rt,PM as ka,fz as wa,PN as Aa,PO as Ca,fE as Vt,fC as $t,PP as ze,PQ as Ba,PR as xa,Na as Ze,PS as Ea,Nb as oe,Nc as He,PT as Da,PU as Pa,PV as ja,zS as nt,zP as Ta,PW as Fa,PX as Ra,PY as Va,zB as $a,PZ as La,P_ as _a,P$ as Ua,co as Lt,cQ as _t,kI as Ga,bP as Ma,bo as Ut,bQ as Gt,xR as Oa,Q0 as Na,Er as za,Ex as Za,ub as Ha,A0 as Wa,AG as Qa,kV as fe,Q1 as qa,Q2 as Mt,ln as Ka,kP as Ot,l8 as Nt,l7 as it,bE as be,bO as Ja,Q3 as Ya,Q4 as Ie,js as Xa,Q5 as ot,Q6 as en,jw as tn,jR as an,AU as nn,Q7 as on,lg as ln,AK as sn,Q8 as lt,AO as rn,AT as cn,AQ as dn,AI as un,Q9 as zt,yU as pn,Qa as mn,Qb as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as vn,l5 as In,AM as kn,jC as wn,lu as An,Qc as Cn,ju as Bn,rt as xn,Qd as En,zH as Dn,bK as Pn,bt as jn,L_ as Tn,cT as Fn,cS as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-C1K4xiie.js";import{y as me,z as $,T as ke,a0 as We,C as le,G as y,aS as xe,B as re,o as x,A as Pe,e as D,bj as Ln,s as H,a4 as Qe,v as E,J as we,bk as rt,bl as ct,bm as _n,al as Un,I as Gn,aM as Mn,D as Zt,a as qe,K as Ke,bn as On,au as Ht,bo as Nn,Y as zn,g as Wt,a9 as Zn,bp as Hn,bq as Wn,br as Qn,bs as qn,bt as Kn,bu as Jn,bv as Yn,bw as Xn,bx as ei,_ as ti,by as ai,be as ni,bz as ii,bA as oi,i as li}from"./index-BcXEZO_T.js";import{n as _,S as si}from"./mui-BNQNnKUH.js";import{A as dt}from"./AddressScreen-BhzQLd2o.js";import{g as ie,a as je,i as Qt,V as Je,b as Ye,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-CYNJnP1G.js";import{a as f}from"./sentry-DNaNh7eC.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-CybhtSUM.js";import{u as qt}from"./useInitialThreadRequest-B3-16zoW.js";import Ee from"./NotFoundScreen-iwRtifEl.js";import{D as ui}from"./DrawerScreen-Dw68qJE2.js";import{M as Kt}from"./MobileAppDrawer-CB-RZZ92.js";import{F as Jt}from"./FeaturePreviewScreen-D-CcSiZr.js";import{S as Te}from"./SetupPagesScreen-DNjkbEBz.js";import{B as pi}from"./BillPayApprovalRoutes-DUR0CXqd.js";import{FallBackRoute as mi}from"./ScreenRoutes-RWbD63jU.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./analyticsHelper-C_-TghPV.js";import"./routePaths-cxejtx48.js";import"./BusinessVerificationPageScreen-D7H_6Ycl.js";import"./ReimbursementApprovalRuleDetailScreen-BOtH5UIX.js";import"./getLocaleForTenant-DTPQOzXV.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]="c4f5a21f-54f1-4612-9521-958680b515da",e._sentryDebugIdIdentifier="sentry-dbid-c4f5a21f-54f1-4612-9521-958680b515da")}catch{}})();const bi=Y((function(e,t){const l=Ue(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:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(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(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=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(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}}))(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=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});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,C]=f.useState(!1),[B,U]=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:X}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(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(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t($e(!1,L,F,X,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:B,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=Y((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),C=I((R=>W(R))),[B,U]=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=>Ue(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=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&&B&&U(!1))}),[n]),f.useEffect((()=>{B||n==null||u||(U(!0),t(Ct(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)))}),[B,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",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(X??"",R,i?.userEmail??"","no"),t(ha({file:Q,billId:n}))}},ee=f.useCallback((()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(C.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,C.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:X}),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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),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(Un,{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(Yt,{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-4Rd12v3w.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as Y,l as na,o as ia,p as S}from"./core-BSTuY0H-.js";import{eX as W,Ps as Ue,bs as kt,Kg as oa,bq as wt,bJ as pe,Pt as At,yL as Ct,z_ as $e,zi as la,bn as De,Pu as sa,Pv as ra,c6 as ca,Pw as da,kx as Bt,Px as xt,Py as Et,Az as Ge,y_ as Be,Pz as ua,yz as tt,PA as pa,EE as ma,yD as ba,yJ as Dt,PB as ve,PC as Me,z$ as Oe,PD as ha,PE as ga,A2 as Ne,PF as ya,Af as Sa,PG as Pt,zL as at,zQ as fa,PH as va,PI as ue,PJ as jt,PK as Tt,PL as Ft,gp as Ia,z3 as Le,cA as Rt,PM as ka,fz as wa,PN as Aa,PO as Ca,fE as Vt,fC as $t,PP as ze,PQ as Ba,PR as xa,Na as Ze,PS as Ea,Nb as oe,Nc as He,PT as Da,PU as Pa,PV as ja,zS as nt,zP as Ta,PW as Fa,PX as Ra,PY as Va,zB as $a,PZ as La,P_ as _a,P$ as Ua,co as Lt,cQ as _t,kI as Ga,bP as Ma,bo as Ut,bQ as Gt,xR as Oa,Q0 as Na,Er as za,Ex as Za,ub as Ha,A0 as Wa,AG as Qa,kV as fe,Q1 as qa,Q2 as Mt,ln as Ka,kP as Ot,l8 as Nt,l7 as it,bE as be,bO as Ja,Q3 as Ya,Q4 as Ie,js as Xa,Q5 as ot,Q6 as en,jw as tn,jR as an,AU as nn,Q7 as on,lg as ln,AK as sn,Q8 as lt,AO as rn,AT as cn,AQ as dn,AI as un,Q9 as zt,yU as pn,Qa as mn,Qb as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as vn,l5 as In,AM as kn,jC as wn,lu as An,Qc as Cn,ju as Bn,rt as xn,Qd as En,zH as Dn,bK as Pn,bt as jn,L_ as Tn,cT as Fn,cS as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-C1K4xiie.js";import{y as me,z as $,T as ke,a0 as We,C as le,G as y,aS as xe,B as re,o as x,A as Pe,e as D,bj as Ln,s as H,a4 as Qe,v as E,J as we,bk as rt,bl as ct,bm as _n,al as Un,I as Gn,aM as Mn,D as Zt,a as qe,K as Ke,bn as On,au as Ht,bo as Nn,Y as zn,g as Wt,a9 as Zn,bp as Hn,bq as Wn,br as Qn,bs as qn,bt as Kn,bu as Jn,bv as Yn,bw as Xn,bx as ei,_ as ti,by as ai,be as ni,bz as ii,bA as oi,i as li}from"./index-DW3WLCwX.js";import{n as _,S as si}from"./mui-BNQNnKUH.js";import{A as dt}from"./AddressScreen-60Qj_YsR.js";import{g as ie,a as je,i as Qt,V as Je,b as Ye,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-CDRDMeDf.js";import{a as f}from"./sentry-DNaNh7eC.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-Dnw9TFpe.js";import{u as qt}from"./useInitialThreadRequest-Cm9uHxR_.js";import Ee from"./NotFoundScreen-8EvUnY3z.js";import{D as ui}from"./DrawerScreen-BUPBRQzG.js";import{M as Kt}from"./MobileAppDrawer-zPhOmrIU.js";import{F as Jt}from"./FeaturePreviewScreen-Cwp5VJhY.js";import{S as Te}from"./SetupPagesScreen-BDROUOA_.js";import{B as pi}from"./BillPayApprovalRoutes-DYpPCevA.js";import{FallBackRoute as mi}from"./ScreenRoutes-Bi_xt3-M.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./analyticsHelper-B5fcdQll.js";import"./routePaths-Bf6hqCDy.js";import"./BusinessVerificationPageScreen-BJQI2dfg.js";import"./ReimbursementApprovalRuleDetailScreen-C909zELF.js";import"./getLocaleForTenant-CDIB5Rqc.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]="c4f5a21f-54f1-4612-9521-958680b515da",e._sentryDebugIdIdentifier="sentry-dbid-c4f5a21f-54f1-4612-9521-958680b515da")}catch{}})();const bi=Y((function(e,t){const l=Ue(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:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(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(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=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(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}}))(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=>Ue(z,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});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,C]=f.useState(!1),[B,U]=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:X}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{L&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&w===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(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(Ct(n??"",L,F,!1)))}),[b,s,n,t]),f.useEffect((()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(C(!0),t($e(!1,L,F,X,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:B,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=Y((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),C=I((R=>W(R))),[B,U]=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=>Ue(R,n??"")));u===!1&&(N=q.fetchState,M=q.transactionDetails?.attachments?.[0],F=!1);const X=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&&B&&U(!1))}),[n]),f.useEffect((()=>{B||n==null||u||(U(!0),t(Ct(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)))}),[B,j,u,n,t]);const z={onOkClick:()=>{if(k(!1),!Q)return;const R=M!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",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(X??"",R,i?.userEmail??"","no"),t(ha({file:Q,billId:n}))}},ee=f.useCallback((()=>{const R=H(c.state?.pathnameStackToGoBack),ce=R.poppedPathname??ie(C.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:R.newStack}})}),[c.state,C.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:X}),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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),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(Un,{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(Yt,{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=_.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-4Rd12v3w.js";import{a as V}from"./sentry-DNaNh7eC.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-BSTuY0H-.js";import{T as ce,C as ue,aS as de,z,A as pe,e as B,ag as x,g as E,bJ as le,au as me,v as P,av as M}from"./index-
|
|
1
|
+
import{j as C}from"./liveblocks-4Rd12v3w.js";import{a as V}from"./sentry-DNaNh7eC.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-BSTuY0H-.js";import{T as ce,C as ue,aS as de,z,A as pe,e as B,ag as x,g as E,bJ as le,au as me,v as P,av as M}from"./index-DW3WLCwX.js";import{P_ as fe,eX as G,tC as ye,Kj as Se,zB as ge,D0 as Ie,FN as he,Gq as Te,Hq as be,Ql as De,Qm as Oe,Qn as Ce,Qo as ke,Qp as Ve,MM as Ae,Pn as we,M$ as Ne,E4 as Fe,N0 as _e,E8 as ve,ld as xe,gh as Ee,gg as ze,gf as Be,rC as Pe,rt as Me,rq as Re,l5 as Ue,tL as Le,tJ as R,bE as U,tX as L,cy as je}from"./zeni-epic-state-C1K4xiie.js";import{n as Ge}from"./mui-BNQNnKUH.js";import{d as j}from"./routePaths-Bf6hqCDy.js";import{M as qe}from"./MobileAppDrawer-zPhOmrIU.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]="fee4b644-8408-4c29-acb7-62dc4e70d832",t._sentryDebugIdIdentifier="sentry-dbid-fee4b644-8408-4c29-acb7-62dc4e70d832")}catch{}})();const Qe=Ge.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-4Rd12v3w.js";import{a as l}from"./sentry-DNaNh7eC.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-BSTuY0H-.js";import{X as ge,dd as be,z as ye,de as Pe,dg as z,dh as Ie,ba as W,A as we,e as $,di as H,ds as Ee,a as Ae,g as ke,a9 as Te,dl as xe,dm as Ue,a4 as _e,dq as Oe,b6 as ve,dr as Qe}from"./index-
|
|
1
|
+
import{j as g}from"./liveblocks-4Rd12v3w.js";import{a as l}from"./sentry-DNaNh7eC.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-BSTuY0H-.js";import{X as ge,dd as be,z as ye,de as Pe,dg as z,dh as Ie,ba as W,A as we,e as $,di as H,ds as Ee,a as Ae,g as ke,a9 as Te,dl as xe,dm as Ue,a4 as _e,dq as Oe,b6 as ve,dr as Qe}from"./index-DW3WLCwX.js";import{gl as Fe,eW as G,eX as $e,fq as De,iK as Le,iG as Ve,eY as B,g6 as je,f$ as qe,g3 as N,g7 as Re,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-C1K4xiie.js";import{D as ze,n as L,P as We,S as Ge}from"./mui-BNQNnKUH.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.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]="f19e1021-8c0a-43a3-b94c-d4883ef50d3c",e._sentryDebugIdIdentifier="sentry-dbid-f19e1021-8c0a-43a3-b94c-d4883ef50d3c")}catch{}})();const X="chat-response-generated",Y="cards/ask",K="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:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===K?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:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(qe()),m((function(n){return`/${n}/${Y}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=Ae.getLocalizedStrings(),k=J.pageTitle,Ye=ee.pageTitle,Ke=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(Fe())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M((r=>$e(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ye:k,subtitle:I?Ze:Ke})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,A=l.useRef(null);l.useEffect((()=>{if(S&&A.current!=null){const{question:r,shouldSubmit:w}=A.current;A.current=null,_(r),O(w),v.current=!1}}),[S]);const{visitedSessions:V}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",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&&p!==t&&c((function(r,w){return`/${r}/${Y}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:V.map((r=>`private-encrypted-chat-${r}.${X}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[V]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&j!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[j,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(ke.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:k,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:k,onCloseClick:()=>{c(I?Z(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(A.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Je=L(Ge)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-4Rd12v3w.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Xe,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-BSTuY0H-.js";import{f8 as Pt,RW as os,fk as wt,bt as Fe,RX as is,RY as ds,eZ as fn,RZ as Pn,f6 as wn,R_ as vn,R$ as Tn,S0 as Fn,S1 as xn,f7 as Bn,fj as Ln,S2 as Rn,S3 as ls,fd as us,fc as ms,S4 as Cs,C5 as On,fm as ia,S5 as ps,S6 as hs,e$ as fs,e_ as gs,fz as Ye,ff as Un,fe as jn,S7 as Ss,fg as bs,BC as ys,BB as Is,BF as ks,BH as Es,fs as As,eW as Mn,S8 as Ds,S9 as _s,fx as Nn,Sa as Ps,fy as yt,BN as ws,BK as vs,eX as ge,Sb as qa,fC as xe,fD as Be,fE as Le,gw as da,cv as la,Sc as ua,Sd as vt,uT as $a,kF as za,Se as Ya,Cl as ka,fn as Qe,Cn as Tt,kv as Vn,Sf as ma,C9 as _a,Sg as Ts,Sh as Fs,Cc as Qa,Si as xs,Qi as Xa,fi as Hn,Ci as Sa,hV as Bs,Sj as Gn,f9 as Ca,bo as Ls,Sk as Rs,gh as Ja,gg as et,CR as Os,gf as at,P_ as Us,Sl as $n,co as zn,cQ as js,Qh as wa,Dq as Yn,Sm as gn,D0 as Pa,Sn as Wn,Dr as Ms,QG as Ns,Ds as Vs,Ex as Hs,ub as Gs,Er as $s,So as zs,Cm as ca,Sp as Ys,Sq as Ws,Sr as Zs,Ss as Ks,St as qs,Su as Ft,Sv as Qs,CC as Zn,Cv as Xs,Sw as Js,gy as ec,CL as Kn,CP as qn,gx as ac,Sx as tc,Dc as Qn,Sy as nc,Sz as rc,SA as sc,CN as Xn,Cy as Jn,Cf as er,CH as ar,CF as tr,CJ as cc,SB as nr,SC as oc,fu as ic,fv as dc,fw as lc,SD as tt,fo as rr,cS as xt,SE as uc,SF as mc,SG as Cc,SH as pc,CX as It,Dj as hc,Df as fc,CT as gc,Dh as Sc,D7 as bc,D9 as yc,SI as sr,Dp as Ga,Kg as Ic,SJ as kc,SK as Ec,SL as Ac,SM as cr,SN as Dc,DM as _c,C$ as or,CW as Ne,C_ as Pc,SO as wc,SP as vc,C6 as Tc,SQ as ir,fh as dr,SR as Fc,C8 as xc,C7 as Sn,SS as Bc,ST as Lc,SU as Rc,MN as Oc,SV as Bt,SW as Uc,xU as lr,ld as jc,hL as Mc,DR as Nc,SX as ur,f3 as Vc,f4 as Hc,SY as Gc,dj as $c,fl as zc,DH as Yc,DB as qe,bs as Wc,bJ as Zc,cA as Kc,bK as qc,L_ as Qc}from"./zeni-epic-state-C1K4xiie.js";import{T as Re,cr as mr,s as we,cs as Cr,ct as pr,cu as Xc,a as ea,a0 as Lt,cv as Jc,cw as eo,X as hr,c as fr,$ as gr,v as ye,C as ue,G as W,ar as ya,cx as Sr,cy as ao,cz as to,z as te,B as va,cg as nt,cA as no,cB as ro,cC as so,J as Ta,aS as We,bt as Rt,cD as co,D as Fa,m as rt,y as Ot,e as J,a9 as st,cE as oo,bG as ba,cF as kt,cG as io,A as Ut,cH as lo,au as br,a4 as Et,cI as uo,Y as yr,Z as Ir,g as kr,cJ as mo,cK as Co,cL as po,cM as ho,cN as fo,cO as go,cP as So,o as Wa,cQ as bo,cR as yo,cS as ht,_ as Io,cT as ko,cU as Eo,cV as Ao,cW as Do,cX as _o,i as Po}from"./index-BcXEZO_T.js";import{n as He,D as Er,S as wo}from"./mui-BNQNnKUH.js";import{a as r}from"./sentry-DNaNh7eC.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CybhtSUM.js";import{M as Ie}from"./MobileAppDrawer-CB-RZZ92.js";import{d as jt}from"./recharts-DWt5pa4F.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Je,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-DNjkbEBz.js";import{u as wr}from"./useInitialThreadRequest-B3-16zoW.js";import ct from"./NotFoundScreen-iwRtifEl.js";import{u as Vt}from"./useChargeCardPusherEvents-BARxawWT.js";import{n as yn}from"./utils-pxMpwT17.js";import{t as Bo}from"./AddressScreen-BhzQLd2o.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./analyticsHelper-C_-TghPV.js";import"./routePaths-cxejtx48.js";import"./BusinessVerificationPageScreen-D7H_6Ycl.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]="15a6df43-f298-460d-90bc-f6f850f691c0",e._sentryDebugIdIdentifier="sentry-dbid-15a6df43-f298-460d-90bc-f6f850f691c0")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function 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(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>vn(E.cardPolicyState))),B=i((E=>Tn(E.cardPolicyState))),L=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(Ln())}),[a,w]),Tr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(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:L,suggestedBlockCategories:p}))}),[v,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),K=E.poppedPathname??_;e(K,{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 K=Cr(E);a(fs({templates:[K]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),Z=r.useCallback((()=>{a(fn())}),[a]),X=r.useRef($);r.useEffect((()=>{const E=X.current;X.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{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:Z})]}):c.jsx(Xe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>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(Ln())}),[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]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Jc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})}),[A,f,x,d,b,L,p,h,T]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),Z=r.useRef(D);r.useEffect((()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const X=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Xe,{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:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),T=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),v=ya(L.fetchState);r.useEffect((()=>{if(v==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(v==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,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(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=hr(),E=fr(),K=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=K&&E&&Z!=null&&!X,re=r.useCallback((oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/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,Z]),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]),R=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:R,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=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,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,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,Z]),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 X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Je(u,T,v,l),K=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:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:K,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Zo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Ko=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(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??Xo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Ko),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Xo=e=>`/${e}/cards`,Jo={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 L=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=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[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(L.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(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),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:Rt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Ja(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
1
|
+
import{j as c}from"./liveblocks-4Rd12v3w.js";import{u as me,j as i,h as le,g as he,i as Ve,N as Xe,s as _t,n as Pe,t as _n,o as cs,p as ce}from"./core-BSTuY0H-.js";import{f8 as Pt,RW as os,fk as wt,bt as Fe,RX as is,RY as ds,eZ as fn,RZ as Pn,f6 as wn,R_ as vn,R$ as Tn,S0 as Fn,S1 as xn,f7 as Bn,fj as Ln,S2 as Rn,S3 as ls,fd as us,fc as ms,S4 as Cs,C5 as On,fm as ia,S5 as ps,S6 as hs,e$ as fs,e_ as gs,fz as Ye,ff as Un,fe as jn,S7 as Ss,fg as bs,BC as ys,BB as Is,BF as ks,BH as Es,fs as As,eW as Mn,S8 as Ds,S9 as _s,fx as Nn,Sa as Ps,fy as yt,BN as ws,BK as vs,eX as ge,Sb as qa,fC as xe,fD as Be,fE as Le,gw as da,cv as la,Sc as ua,Sd as vt,uT as $a,kF as za,Se as Ya,Cl as ka,fn as Qe,Cn as Tt,kv as Vn,Sf as ma,C9 as _a,Sg as Ts,Sh as Fs,Cc as Qa,Si as xs,Qi as Xa,fi as Hn,Ci as Sa,hV as Bs,Sj as Gn,f9 as Ca,bo as Ls,Sk as Rs,gh as Ja,gg as et,CR as Os,gf as at,P_ as Us,Sl as $n,co as zn,cQ as js,Qh as wa,Dq as Yn,Sm as gn,D0 as Pa,Sn as Wn,Dr as Ms,QG as Ns,Ds as Vs,Ex as Hs,ub as Gs,Er as $s,So as zs,Cm as ca,Sp as Ys,Sq as Ws,Sr as Zs,Ss as Ks,St as qs,Su as Ft,Sv as Qs,CC as Zn,Cv as Xs,Sw as Js,gy as ec,CL as Kn,CP as qn,gx as ac,Sx as tc,Dc as Qn,Sy as nc,Sz as rc,SA as sc,CN as Xn,Cy as Jn,Cf as er,CH as ar,CF as tr,CJ as cc,SB as nr,SC as oc,fu as ic,fv as dc,fw as lc,SD as tt,fo as rr,cS as xt,SE as uc,SF as mc,SG as Cc,SH as pc,CX as It,Dj as hc,Df as fc,CT as gc,Dh as Sc,D7 as bc,D9 as yc,SI as sr,Dp as Ga,Kg as Ic,SJ as kc,SK as Ec,SL as Ac,SM as cr,SN as Dc,DM as _c,C$ as or,CW as Ne,C_ as Pc,SO as wc,SP as vc,C6 as Tc,SQ as ir,fh as dr,SR as Fc,C8 as xc,C7 as Sn,SS as Bc,ST as Lc,SU as Rc,MN as Oc,SV as Bt,SW as Uc,xU as lr,ld as jc,hL as Mc,DR as Nc,SX as ur,f3 as Vc,f4 as Hc,SY as Gc,dj as $c,fl as zc,DH as Yc,DB as qe,bs as Wc,bJ as Zc,cA as Kc,bK as qc,L_ as Qc}from"./zeni-epic-state-C1K4xiie.js";import{T as Re,cr as mr,s as we,cs as Cr,ct as pr,cu as Xc,a as ea,a0 as Lt,cv as Jc,cw as eo,X as hr,c as fr,$ as gr,v as ye,C as ue,G as W,ar as ya,cx as Sr,cy as ao,cz as to,z as te,B as va,cg as nt,cA as no,cB as ro,cC as so,J as Ta,aS as We,bt as Rt,cD as co,D as Fa,m as rt,y as Ot,e as J,a9 as st,cE as oo,bG as ba,cF as kt,cG as io,A as Ut,cH as lo,au as br,a4 as Et,cI as uo,Y as yr,Z as Ir,g as kr,cJ as mo,cK as Co,cL as po,cM as ho,cN as fo,cO as go,cP as So,o as Wa,cQ as bo,cR as yo,cS as ht,_ as Io,cT as ko,cU as Eo,cV as Ao,cW as Do,cX as _o,i as Po}from"./index-DW3WLCwX.js";import{n as He,D as Er,S as wo}from"./mui-BNQNnKUH.js";import{a as r}from"./sentry-DNaNh7eC.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Dnw9TFpe.js";import{M as Ie}from"./MobileAppDrawer-zPhOmrIU.js";import{d as jt}from"./recharts-DWt5pa4F.js";import{g as _e,a as Ba,b as Ar,c as Oe,d as Ue,e as Je,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-BDROUOA_.js";import{u as wr}from"./useInitialThreadRequest-Cm9uHxR_.js";import ct from"./NotFoundScreen-8EvUnY3z.js";import{u as Vt}from"./useChargeCardPusherEvents-Kefa2Uws.js";import{n as yn}from"./utils-pxMpwT17.js";import{t as Bo}from"./AddressScreen-60Qj_YsR.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./analyticsHelper-B5fcdQll.js";import"./routePaths-Bf6hqCDy.js";import"./BusinessVerificationPageScreen-BJQI2dfg.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]="15a6df43-f298-460d-90bc-f6f850f691c0",e._sentryDebugIdIdentifier="sentry-dbid-15a6df43-f298-460d-90bc-f6f850f691c0")}catch{}})();const Lo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Lo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function 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(),Ro=e=>Un(e,!1),Oo=e=>jn(e.name,!1);function Uo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((E=>{S(E)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{a(is()),a(ds()),a(fn())}),[a]);const w=i((E=>Pn(E.cardPolicyState))),l=i((E=>wn(E.cardPolicyState))),j=i((E=>vn(E.cardPolicyState))),B=i((E=>Tn(E.cardPolicyState))),L=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(Ln())}),[a,w]),Tr();const k=i((E=>Rn(E.createCardPolicyState))),U=i((E=>ls(E.createCardPolicyState))),A=i((E=>us(E.cardPolicyState))),b=i((E=>ms(E.cardPolicyState))),x=i((E=>Cs(E.createCardPolicyState))),d=i((E=>On(E)));r.useEffect((()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))}),[d.fetchState,a]);const f=r.useMemo((()=>l.map(Ro)),[l]),M=r.useMemo((()=>h.map(Oo)),[h]),V=r.useMemo((()=>d.cards.filter((E=>!mr(E.status.code))).map(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:L,suggestedBlockCategories:p}))}),[v,a,O,x,V,u,j,B,L,p]);const R=r.useMemo((()=>jt((E=>{a(wt(E))}),250)),[a]);r.useEffect((()=>()=>{R.cancel()}),[R]);const z=r.useCallback((E=>{R(E)}),[R]),$=k.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback((()=>{const E=we(n.state?.pathnameStackToGoBack),K=E.poppedPathname??_;e(K,{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 K=Cr(E);a(fs({templates:[K]}))}),[a]),N=r.useCallback((E=>{E.length!==0&&a(gs(E))}),[a]),Z=r.useCallback((()=>{a(fn())}),[a]),X=r.useRef($);r.useEffect((()=>{const E=X.current;X.current=$,$==="Completed"&&E!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))}),[a,$,U,e,_]);const o=$==="Error"?k.error?.message??In.createPolicyGenericErrorMessage:void 0;return y&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(pr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:D,onClickMenuIcon:m,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{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:Z})]}):c.jsx(Xe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:jo}}}=ea.getLocalizedStrings(),Mo=e=>Un(e,!1),No=e=>jn(e.name,!1);function Vo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),y=Re(),g=Fe(y?.loggedInUserRoleMap),[S,P]=r.useState(!1),m=r.useCallback((o=>{P(o)}),[]),C=r.useCallback((()=>{m(!0)}),[m]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),l=i((o=>Ss(o))),j=i((o=>Pn(o.cardPolicyState))),B=i((o=>wn(o.cardPolicyState))),L=i((o=>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(Ln())}),[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]);Lt({isDataReady:A!=null});const M=r.useMemo((()=>{if(A!=null)return Jc({draft:A,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:b,suggestedAllowMerchants:L,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})}),[A,f,x,d,b,L,p,h,T]),[V,O]=r.useState(void 0),R=r.useRef(!1);r.useEffect((()=>{R.current||V!=null||M==null||(R.current=!0,O(M))}),[V,M]);const z=r.useCallback((o=>{O(o)}),[]),$=r.useMemo((()=>jt((o=>{s(wt(o))}),250)),[s]);r.useEffect((()=>()=>{$.cancel()}),[$]);const _=r.useCallback((o=>{$(o)}),[$]),D=l.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback((()=>{const o=we(n.state?.pathnameStackToGoBack),E=o.poppedPathname??G;e(E,{state:{pathnameStackToGoBack:o.newStack}})}),[n.state,e,G]),I=r.useCallback((()=>{e(G)}),[e,G]),N=r.useCallback((o=>{if(a==null)return;const E=Cr(o);s(ks(E)),s(Es(a))}),[s,a]),Z=r.useRef(D);r.useEffect((()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))}),[s,D,e,G]);const X=D==="Error"?l.updateFetchState.error?.message??jo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(Xe,{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:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:m}),c.jsx(pr,{showUploadDocumentSection:!1,navBarTitle:l.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function Fr(e,n,t){return n?e.filter((a=>a!=null&&a.trim().length>0)).slice(0,t):[]}function xr(e){return i((n=>e==null||e===""?{chips:ft,isResolved:!1}:(function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}})(As(n,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ho,subheadline:Go,pageTitle:$o}}}}=ea.getLocalizedStrings(),zo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Yo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Re(),y=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback((_=>{S(_)}),[]),m=r.useCallback((()=>{P(!0)}),[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:l,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),B=i((_=>Ds(_))),L=i((_=>Rn(_.createCardPolicyState))),p=i((_=>_s(_.createCardPolicyState))),h=i((_=>p==null?[]:Nn(_.aiCfoState,p).filter((D=>D.kind==="creating_policy"))),_t),T=L.fetchState==="In-Progress"?Math.max(h.length,1):0,u=i((_=>Ps(_.createCardPolicyState))),v=ya(L.fetchState);r.useEffect((()=>{if(v==="In-Progress"&&L.fetchState==="Completed"&&p!=null)h.forEach((_=>{a(yt({chatSessionId:p,id:_.id,entityIds:u,kind:"created_policy"}))}));else if(v==="In-Progress"&&L.fetchState==="Error"&&p!=null){h.forEach((D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))}));const _=L.error?.message!=null&&L.error.message.length>0?L.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}}),[L.error?.message,L.fetchState,a,p,u,h,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(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[U,a,A]);const b=r.useMemo((()=>B.templates.map(zo)),[B.templates]);Lt({isDataReady:B.fetchState.fetchState==="Completed"});const x=b.length>0||T>0,d=(function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=hr(),E=fr(),K=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=K&&E&&Z!=null&&!X,re=r.useCallback((oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/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,Z]),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]),R=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:R,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=Re(),g=Fe(y?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,m]=r.useState(!1),C=i((q=>qa(q).firstViewAfterActivation));if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),l=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),B=xe(s),L=Be(s),p=Le(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:w,isBookKeepingTenant:L,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,R=O?.cardCreatedByUser?.userId,z=i((q=>R!=null?$a(q.userRoleState,R):void 0)),$=z?.accountingClassIDs[0],_=i((q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0)),D=O?.cardHolderUser?.userId,G=i((q=>D!=null?$a(q.userRoleState,D):void 0)),Q=G?.accountingClassIDs[0],I=i((q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0)),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect((()=>{C&&P===!1&&N&&(m(!0),setTimeout((()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[C,P,N,Z]),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 X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",E=Je(u,T,v,l),K=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:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:l,productInformation:E,creditAccountInformation:K,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:A,classListFetchState:x,creditAccountRepayment:b,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Br="charge-card-transaction-update",Lr="charge-card-transaction-created",Rr="charge-card-transaction-declined",Or="charge-card-transaction-updated",Ur="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Zo="charge-card-department-updated",jr="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map((t=>`private-encrypted-${e}.${t}`)),Ko=[Ra,La],qo=Pe((function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(n,t)=>{e(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??Xo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:j.newStack}})}),[e,t,s.tenantEmailDomain]),w=aa(s);if(Vt({events:ha(w,Ko),onEvent:j=>{switch(j){case Ra:case La:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect((()=>{S||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(P(!0),n(_a()))}),[S,m,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const l=m.cashbackSummary?.cashbackEarned?.amount!=null&&m.fetchState!=="Not-Started";return m.fetchState!=="In-Progress"||l?(m.cashbackSummary?.cashbackEarned?.amount??0)===0&&m.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(qo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(ro,{onBackClick:F})}const Xo=e=>`/${e}/cards`,Jo={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 L=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=Le(A,L),x=Oe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:b}),d=!!L.companyChargeCardInfo?.info?.isChargeCardEnabled,f=L.userRole.includes("charge_card_user"),M=xe(L),V=Be(L),O=L.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&R&&d;r.useEffect((()=>{S===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),P(!0)),m===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,R)))}),[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(L.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(L.tenantEmailDomain,s,B,u,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),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:Rt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:L,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(ti,{windowSize:n,children:e}):null]})},ai=Pe((function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Bs(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Gn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let m=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(m=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ls())||C,showMenuIcon:m,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}}),(function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=y;return{onGetOtp:m=>{S!=null&&e(at(m,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:m=>{e(Os(a,m))},onResendOtp:m=>{S!=null&&e(et(m,"ChargeCardHolder",a))},onVerifyOtp:(m,C)=>{S!=null&&e(Ja(m,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:m=>{m!=null&&te.saveZeniOtpTokenForCardHolder(m,a)},onCVVActivateSuccess:()=>{e(Rs({chargeCardId:a}))},onBackClick:()=>{const m=we(s.state?.pathnameStackToGoBack),C=m.poppedPathname==null||m.poppedPathname.includes("onboard")===!0?ta(P):m.poppedPathname;t(C,{state:{pathnameStackToGoBack:m.newStack}})}}}))(co),ti=He.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Jo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-4Rd12v3w.js";import{a as g}from"./sentry-DNaNh7eC.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-BSTuY0H-.js";import{z as C,be as P,A as F,e as V,g as j,ag as b,bf as A,au as L,av as U,v as B}from"./index-
|
|
1
|
+
import{j as m}from"./liveblocks-4Rd12v3w.js";import{a as g}from"./sentry-DNaNh7eC.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-BSTuY0H-.js";import{z as C,be as P,A as F,e as V,g as j,ag as b,bf as A,au as L,av as U,v as B}from"./index-DW3WLCwX.js";import{eX as D,gj as M,tC as _,ge as G,c6 as R,Pn as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Po as X,bE as Z,cy as N,mQ as $,mT as J}from"./zeni-epic-state-C1K4xiie.js";import"./mui-BNQNnKUH.js";import{d as K}from"./routePaths-Bf6hqCDy.js";import{M as W}from"./MobileAppDrawer-zPhOmrIU.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="7c64d460-7c5b-48c2-99a0-372a416a9dbf",a._sentryDebugIdIdentifier="sentry-dbid-7c64d460-7c5b-48c2-99a0-372a416a9dbf")}catch{}})();const ee=E((function(a){const t=G(a),i=C.getSignedInUser(),l=D(a),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}}),(function(a,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a($({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:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(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=>{a(X(e))},onCompanyOfficerUpdated:e=>{a(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=>{a(Q({files:e}))},onDeleteFile:e=>{a(H(e))},onEditFileName:(e,n)=>{a(q(e,n.split(".")[0]))}}}))(A);function de(){const a=w(),t=T(),i=x(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(p(!0),t(M(d)))}),[c,n,d,t]),g.useEffect((()=>{o==="Not-Started"&&t(_())}),[o,t]);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:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-4Rd12v3w.js";import{a}from"./sentry-DNaNh7eC.js";import{u as D,g as v,j as m,N as w}from"./core-BSTuY0H-.js";import{LW as A,eX as O,g1 as _,o9 as j,gs as h,g0 as L,fA as U,M1 as F}from"./zeni-epic-state-C1K4xiie.js";import{u as $,z as p,L as C,a as k,o as H}from"./index-
|
|
1
|
+
import{j as g}from"./liveblocks-4Rd12v3w.js";import{a}from"./sentry-DNaNh7eC.js";import{u as D,g as v,j as m,N as w}from"./core-BSTuY0H-.js";import{LW as A,eX as O,g1 as _,o9 as j,gs as h,g0 as L,fA as U,M1 as F}from"./zeni-epic-state-C1K4xiie.js";import{u as $,z as p,L as C,a as k,o as H}from"./index-DW3WLCwX.js";import{n as z}from"./mui-BNQNnKUH.js";import{t as R}from"./getLocaleForTenant-CDIB5Rqc.js";import{g as P,Q as G}from"./QBOConnectionScreen-QhaMmbnN.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./empty-DnsKiXU9.js";import"./pdf-lib-BsIrhPFz.js";import"./index-kHgGJTZG.js";import"./url-QenweuSk.js";import"./index-BVB9LccC.js";import"./decodeURIComponentSafe-BNCMkOsy.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]="b4b78fa5-2985-4494-adcd-66b73055d705",t._sentryDebugIdIdentifier="sentry-dbid-b4b78fa5-2985-4494-adcd-66b73055d705")}catch{}})();const M=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-4Rd12v3w.js";import{z as n}from"./index-
|
|
1
|
+
import{j as i}from"./liveblocks-4Rd12v3w.js";import{z as n}from"./index-DW3WLCwX.js";import{g as d}from"./QBOConnectionScreen-QhaMmbnN.js";import"./sentry-DNaNh7eC.js";import{g as p,N as s}from"./core-BSTuY0H-.js";import"./zeni-epic-state-C1K4xiie.js";import"./recharts-DWt5pa4F.js";import"./mui-BNQNnKUH.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./empty-DnsKiXU9.js";import"./pdf-lib-BsIrhPFz.js";import"./index-kHgGJTZG.js";import"./url-QenweuSk.js";import"./index-BVB9LccC.js";import"./decodeURIComponentSafe-BNCMkOsy.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-DdKnlwn5.js → CustomerOnboardingRoutes-BF11xENe.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-4Rd12v3w.js";import{t as yt,A as Ve}from"./AddressScreen-
|
|
1
|
+
import{j as a}from"./liveblocks-4Rd12v3w.js";import{t as yt,A as Ve}from"./AddressScreen-60Qj_YsR.js";import ht from"./NotFoundScreen-8EvUnY3z.js";import{a as d}from"./sentry-DNaNh7eC.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-BSTuY0H-.js";import{z as R,C as _e,G as H,d as bt,v as Q,A as ae,e as N,g as de,aq as It,J as kt,_ as tt,T 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-DW3WLCwX.js";import{eX as J,fE as ve,fC as Oe,bs as Et,fS as xt,bS as wt,o7 as At,tm as Pt,tp as Dt,MV as jt,MW as Ft,k9 as Ce,kc as at,Mq as Bt,bY as Ut,c6 as le,tQ as Te,tB as Vt,MX as ue,tR as ot,Kj as Lt,ld as st,MY as Rt,MZ as Nt,rj as Mt,hq as $t,Mi as ge,hn as Gt,Mj as zt,y1 as Qt,rn as Kt,hf as qt,hi as $e,M_ as it,M$ as Ht,E4 as Yt,N0 as Zt,E8 as Jt,ts as Wt,N1 as Xt,N2 as en,k7 as tn,ka as nn,u1 as an,tD as rt,tP as on,bE as Ge,cy as sn,u0 as ze,rC as rn,rq as cn,l5 as dn,gh as un,gg as ln,gf as pn,N3 as mn,tv as gn,u2 as fn,u5 as yn,u8 as hn,ue as Sn,cY as Cn}from"./zeni-epic-state-C1K4xiie.js";import{n as Ee}from"./mui-BNQNnKUH.js";import{g as bn,h as In,q as oe}from"./QBOConnectionScreen-QhaMmbnN.js";import{u as kn,a as _n}from"./useEmailConnectResultRefresh-DQEVaDNk.js";import{u as vn}from"./useChargeCardPusherEvents-Kefa2Uws.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./empty-DnsKiXU9.js";import"./pdf-lib-BsIrhPFz.js";import"./index-kHgGJTZG.js";import"./url-QenweuSk.js";import"./index-BVB9LccC.js";import"./decodeURIComponentSafe-BNCMkOsy.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]="e1aac368-4972-4636-8819-b7398c509864",t._sentryDebugIdIdentifier="sentry-dbid-e1aac368-4972-4636-8819-b7398c509864")}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(H.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(H.isArAgingFeatureEnabled),{isFeatureEnabled:_}=n(H.isReferralFeatureEnabled),{isFeatureEnabled:I}=n(H.isExpenseAutomationEnabledV2),{isFeatureEnabled:T}=n(H.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 E=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&&Et(f?.userRole),G=v?.resources?.find((h=>h.resource==="/bills"))==null&&!$,w=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"),w===!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 Y=xt(h,D,e,I,r);return wt(Y.reportsInOrder.map((A=>({fetchState:A.fetchState,error:A.error})))).fetchState}));d.useEffect((()=>{p!=="Completed"||o||E||P||(l(!0),i(At(e.userId,O,f.tenantId,!0,!1,m)))}),[o,p,E,P,e,f.tenantId,i]);const K=d.useRef(!1),z=d.useCallback((()=>{const h={pathnameStackToGoBack:Q(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};t(E?"../../checking":P?"../../cards":"../../dashboard",{state:h})}),[t,u,E,P]),V=d.useCallback((()=>{K.current||(K.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((()=>{E||P||!c||F!=="Completed"&&F!=="Error"||V()}),[c,F,E,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"],Qe=(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}))},Ke=(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=Ee.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-4Rd12v3w.js";import{i as K,j as k,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as O}from"./core-BSTuY0H-.js";import{eX as U,Nm as We,bE as ia,bo as xe,OA as Pn,i$ as On,OB as Kt,OC as Fn,j2 as Ct,OD as Ze,OE as Rn,j7 as Bn,OF as qt,OG as jn,jb as _t,OH as Qe,OI as Mn,co as yt,OJ as Ln,OK as Un,NG as Gn,k3 as Vn,OL as Yn,bn as Xe,OM as ca,Na as ce,bc as la,kh as da,oh as ua,k0 as ma,Nc as le,Nb as J,eW as pa,fs as Nn,g3 as kt,ON as $n,OO as zn,OP as ha,OQ as Oe,vT as Me,vU as Le,wf as we,w9 as de,vY as Ue,OR as Kn,OS as qn,OT as Zn,OU as fa,OV as Fe,OW as Qn,dK as Je,sa as ga,OX as Hn,OY as Wn,OZ as Xn,O_ as vt,Ms as At,kx as De,wn as It,si as Jn,O$ as eo,vV as Zt,sd as Ee,s9 as ba,P0 as ge,P1 as to,P2 as Et,Mr as Tt,ui as Ca,P3 as ao,P4 as no,P5 as oo,P6 as xt,uy as so,P7 as ro,vX as Qt,uh as _a,P8 as be,P9 as io,bs as ka,wr as Sa,Pa as co,Pb as lo,Pc as uo,Pd as wt,wm as mo,Pe as po,vW as Ht,wq as ya,Pf as Ce,Pg as ho,Ph as fo,Pi as va,km as Aa,oe as Ia,kr as Ea,oc as Ta,ob as xa,oa as wa,tG as go,Pj as bo,cS as Co,cT as _o,o7 as ko,fS as So,oo as yo,GE as dt,Gw as vo,GA as Ao,Pk as Io,Pl as Eo,Pm as To,b5 as et,fK as xo,hJ as wo,gj as Do,oi as Po,jV as Oo,of as Fo,od as Ro,fE as Bo,fC as jo}from"./zeni-epic-state-C1K4xiie.js";import{z as M,a4 as te,v as w,e as T,a as q,a_ as Mo,a0 as Ge,A as Ve,a$ as Da,g as Y,b0 as Lo,T as ke,b1 as Pa,C as Se,G as B,y as Uo,b2 as Go,b3 as Vo,X as Oa,J as Fa,c as Ra,$ as Yo,b4 as No,V as $o,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as zo,b8 as Ko,d as qo,ar as Zo,s as Qo,Y as Ho,b9 as Wo,ba as Xo,bb as Jo,bc as es,bd as _e}from"./index-BcXEZO_T.js";import{n as Dt}from"./mui-BNQNnKUH.js";import{a as b}from"./sentry-DNaNh7eC.js";import{w as Ua}from"./withTransactionSidePanel-Cokro6eW.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as ts}from"./routePaths-cxejtx48.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CybhtSUM.js";import je from"./NotFoundScreen-iwRtifEl.js";import{u as Ot}from"./useInitialThreadRequest-B3-16zoW.js";import{t as Va}from"./analyticsHelper-C_-TghPV.js";import{C as as}from"./CompanyPassportScreen-BVAY4gEa.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CEM3mmbG.js";import{F as os}from"./FeaturePreviewScreen-D-CcSiZr.js";import{R as ss}from"./ReferralListScreen-9chFTKdh.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./TransactionDetailScreen-BTk8hKel.js";import"./decodeURIComponentSafe-BNCMkOsy.js";import"./MobileAppDrawer-CB-RZZ92.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]="d20adba5-f2be-46b0-9f87-fa2d33f2eb76",e._sentryDebugIdIdentifier="sentry-dbid-d20adba5-f2be-46b0-9f87-fa2d33f2eb76")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k((I=>I.tenantState.currentTenantId)),c=k((I=>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):xe()),[r]),p=$(),f=W(),S=k((I=>Pn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),_=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),x=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),D=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(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=k((_=>Fn(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k((_=>_.tenantState.currentTenantId)),i=k((_=>U(_))),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo((()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((_=>{e(Ze({searchString:_}))}),[]),p=b.useCallback(((_,x)=>{e(Ze({sortKey:x,sortOrder:_}))}),[]),f=b.useCallback((_=>{a(`./${_}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((_=>{e(Ze({downloadState:_}))}),[]),E=b.useCallback(((_,x)=>{}),[]),v=b.useCallback(((_,x)=>{e(Ze({selectedDate:_,agingDateSelectionType:x})),e(Ct(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{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=k((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):xe()),[r]),h=$(),p=W(),f=k((y=>Rn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),_=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),x=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=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]),D=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"&&D()}),[f.fetchState,D]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=k((v=>jn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k((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??xe(),C=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))}),[]);b.useEffect((()=>{C()}),[]);const u=b.useCallback((()=>{a("../",{relative:"path"})}),[]),l=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),h=b.useCallback(((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(_t(v))}),[]),E=b.useCallback(((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:v=>v.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{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})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Gn(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(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=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=Ln(e).accountsInOrder.map(((n,o)=>Ya(n,o))),t=Un(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Na)(Pa),us=ee((function(e){const a=Yn(e).accountsInOrder.map(((o,r)=>Ya(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Na)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return k((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=ke(),o=yt(n?.loggedInUserRoleMap),r=k((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return k((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=Dt.div`
|
|
1
|
+
import{j as d}from"./liveblocks-4Rd12v3w.js";import{i as K,j as k,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as O}from"./core-BSTuY0H-.js";import{eX as U,Nm as We,bE as ia,bo as xe,OA as Pn,i$ as On,OB as Kt,OC as Fn,j2 as Ct,OD as Ze,OE as Rn,j7 as Bn,OF as qt,OG as jn,jb as _t,OH as Qe,OI as Mn,co as yt,OJ as Ln,OK as Un,NG as Gn,k3 as Vn,OL as Yn,bn as Xe,OM as ca,Na as ce,bc as la,kh as da,oh as ua,k0 as ma,Nc as le,Nb as J,eW as pa,fs as Nn,g3 as kt,ON as $n,OO as zn,OP as ha,OQ as Oe,vT as Me,vU as Le,wf as we,w9 as de,vY as Ue,OR as Kn,OS as qn,OT as Zn,OU as fa,OV as Fe,OW as Qn,dK as Je,sa as ga,OX as Hn,OY as Wn,OZ as Xn,O_ as vt,Ms as At,kx as De,wn as It,si as Jn,O$ as eo,vV as Zt,sd as Ee,s9 as ba,P0 as ge,P1 as to,P2 as Et,Mr as Tt,ui as Ca,P3 as ao,P4 as no,P5 as oo,P6 as xt,uy as so,P7 as ro,vX as Qt,uh as _a,P8 as be,P9 as io,bs as ka,wr as Sa,Pa as co,Pb as lo,Pc as uo,Pd as wt,wm as mo,Pe as po,vW as Ht,wq as ya,Pf as Ce,Pg as ho,Ph as fo,Pi as va,km as Aa,oe as Ia,kr as Ea,oc as Ta,ob as xa,oa as wa,tG as go,Pj as bo,cS as Co,cT as _o,o7 as ko,fS as So,oo as yo,GE as dt,Gw as vo,GA as Ao,Pk as Io,Pl as Eo,Pm as To,b5 as et,fK as xo,hJ as wo,gj as Do,oi as Po,jV as Oo,of as Fo,od as Ro,fE as Bo,fC as jo}from"./zeni-epic-state-C1K4xiie.js";import{z as M,a4 as te,v as w,e as T,a as q,a_ as Mo,a0 as Ge,A as Ve,a$ as Da,g as Y,b0 as Lo,T as ke,b1 as Pa,C as Se,G as B,y as Uo,b2 as Go,b3 as Vo,X as Oa,J as Fa,c as Ra,$ as Yo,b4 as No,V as $o,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as zo,b8 as Ko,d as qo,ar as Zo,s as Qo,Y as Ho,b9 as Wo,ba as Xo,bb as Jo,bc as es,bd as _e}from"./index-DW3WLCwX.js";import{n as Dt}from"./mui-BNQNnKUH.js";import{a as b}from"./sentry-DNaNh7eC.js";import{w as Ua}from"./withTransactionSidePanel-DvXF470h.js";import{c as Ga,t as Pe,f as ue,a as Pt,v as ts}from"./routePaths-Bf6hqCDy.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-Dnw9TFpe.js";import je from"./NotFoundScreen-8EvUnY3z.js";import{u as Ot}from"./useInitialThreadRequest-Cm9uHxR_.js";import{t as Va}from"./analyticsHelper-B5fcdQll.js";import{C as as}from"./CompanyPassportScreen-BqFRrI6s.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-BT0w9R5w.js";import{F as os}from"./FeaturePreviewScreen-Cwp5VJhY.js";import{R as ss}from"./ReferralListScreen-DTyhwsoO.js";import"./recharts-DWt5pa4F.js";import"./analytics-JEmFuY6G.js";import"./plaid-CR_panTl.js";import"./dnd-dl03JNeH.js";import"./stripe-cKAAJElX.js";import"./lottie-ljbmWmMi.js";import"./lexical-Dh5_f1t7.js";import"./pdf-ZOuFxOIc.js";import"./utils-pxMpwT17.js";import"./TransactionDetailScreen-BB5tBHdE.js";import"./decodeURIComponentSafe-BNCMkOsy.js";import"./MobileAppDrawer-zPhOmrIU.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]="d20adba5-f2be-46b0-9f87-fa2d33f2eb76",e._sentryDebugIdIdentifier="sentry-dbid-d20adba5-f2be-46b0-9f87-fa2d33f2eb76")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k((I=>I.tenantState.currentTenantId)),c=k((I=>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):xe()),[r]),p=$(),f=W(),S=k((I=>Pn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),_=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),x=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),D=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(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=k((_=>Fn(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k((_=>_.tenantState.currentTenantId)),i=k((_=>U(_))),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo((()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((_=>{e(Ze({searchString:_}))}),[]),p=b.useCallback(((_,x)=>{e(Ze({sortKey:x,sortOrder:_}))}),[]),f=b.useCallback((_=>{a(`./${_}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((_=>{e(Ze({downloadState:_}))}),[]),E=b.useCallback(((_,x)=>{}),[]),v=b.useCallback(((_,x)=>{e(Ze({selectedDate:_,agingDateSelectionType:x})),e(Ct(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{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=k((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):xe()),[r]),h=$(),p=W(),f=k((y=>Rn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),_=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),x=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=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]),D=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"&&D()}),[f.fetchState,D]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=k((v=>jn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k((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??xe(),C=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))}),[]);b.useEffect((()=>{C()}),[]);const u=b.useCallback((()=>{a("../",{relative:"path"})}),[]),l=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),h=b.useCallback(((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(_t(v))}),[]),E=b.useCallback(((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:v=>v.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{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})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Gn(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(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=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=Ln(e).accountsInOrder.map(((n,o)=>Ya(n,o))),t=Un(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Na)(Pa),us=ee((function(e){const a=Yn(e).accountsInOrder.map(((o,r)=>Ya(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Na)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return k((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=ke(),o=yt(n?.loggedInUserRoleMap),r=k((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return k((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=Dt.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|