@zeniai/web-app-ui 5.1.63-dev → 5.1.63-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.
Files changed (64) hide show
  1. package/dist/assets/{AddressRoutes-DiGYiZdH.js → AddressRoutes-DgZlzwKj.js} +1 -1
  2. package/dist/assets/{AddressScreen-GAHyIX-c.js → AddressScreen-DZz6iLRi.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-D2sAwMZS.js → AiCfoScreen-BJy_pYhd.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-BglCJxi-.js → BillPayApprovalRoutes-DJjLicyn.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-7zp9D6x8.js → BillPayRoutes-DAczZIUA.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-DMq3tKTs.js → BusinessVerificationPageScreen-CbhS3pML.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen--ED2OEzt.js → CardsAiCfoScreen-D3HVbkzL.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-CMdGvjPJ.js → ChargeCardRoutes-lmFHLgNx.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-DMJdNz2u.js → CompanyPassportScreen-BUt2L6sz.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-CC4jwpJn.js → ConnectionAuthScreen-BT3IRUL8.js} +1 -1
  11. package/dist/assets/{CustomerOnboardingAuthScreen-Bqsz81r8.js → CustomerOnboardingAuthScreen-BAn5X2Wb.js} +1 -1
  12. package/dist/assets/{CustomerOnboardingRoutes-DfaM8hGj.js → CustomerOnboardingRoutes-Dzhhfcds.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-BCVeePc3.js → DashboardRoutes-CDKfXwLt.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-BKFAUyCt.js → DefaultTenantHome-CXh59aBD.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-WRSPX-4X.js → DomesticWireDetailScreen-iXO5zWUm.js} +1 -1
  16. package/dist/assets/{DrawerScreen-DaMuYUCn.js → DrawerScreen-B_vR9_qC.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-Bcvb-t4n.js → EntityDetailRoutes-BcZQKkh1.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-BMNILnav.js → ExpenseAutomationRoutes-CWOOkRUe.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-D4Ah53J7.js → FeaturePreviewScreen-BQvRhW1f.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-DRjMsB35.js → HubSpotOAuthCallbackScreen-DeESKpku.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-Dtjlc8Bf.js → MagicLinkRoutes-6x7Us6_Q.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-D1bS19KK.js → MagicLinkSignInScreen-BsUi7-40.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-PDN1hPUR.js → MobileAppDrawer-CHF9nCsW.js} +1 -1
  24. package/dist/assets/{NotFoundScreen-CKyavEYX.js → NotFoundScreen-D0AQGcoe.js} +1 -1
  25. package/dist/assets/{NotificationRoutes-BP3RNHOU.js → NotificationRoutes-BPu1VkFm.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-CWy6K8Uy.js → OAuthConsentScreen-DkCTDJwq.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-BCTBlqwg.js → PandLWithForecastRoutes-BEFahy-o.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-84yTwmWw.js → PeopleRoutes-sN-axVAc.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-BQUXWKZE.js → PerformanceRoutes-DXXEZbBB.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-BDzJBSaJ.js → QBOConnectionScreen-_B3wLRiT.js} +1 -1
  31. package/dist/assets/{ReferralListScreen-CXBkdn17.js → ReferralListScreen-CzPMgGBj.js} +1 -1
  32. package/dist/assets/{ReimbursementApprovalRoutes-DFKDTo2d.js → ReimbursementApprovalRoutes-DCrHBh1u.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-77M2HLZ2.js → ReimbursementApprovalRuleDetailScreen-SmUpbSJe.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-YhP6hHRt.js → ReimbursementRoutes-xFL2a98D.js} +1 -1
  35. package/dist/assets/{ReportsRoutes-wzqHii7q.js → ReportsRoutes-BCmFjTfI.js} +1 -1
  36. package/dist/assets/{RewardsRoutes-DfmbXNc8.js → RewardsRoutes-OtuIPjdr.js} +1 -1
  37. package/dist/assets/{ScreenRoutes-DvRF1Ugr.js → ScreenRoutes-CEUjM6GK.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-xpOSQOkw.js → SettingsRoutes-BtEyetWY.js} +1 -1
  39. package/dist/assets/{SetupPagesScreen-CrjLDbOm.js → SetupPagesScreen-CCip2k58.js} +1 -1
  40. package/dist/assets/{SignInScreen-Ck9zXfCr.js → SignInScreen-jXShH9LP.js} +1 -1
  41. package/dist/assets/{SignOutScreen-DSoi64zr.js → SignOutScreen-CnWA4YZp.js} +1 -1
  42. package/dist/assets/{TaskListScreen-Cs7VLiUm.js → TaskListScreen-qq0yWrR-.js} +1 -1
  43. package/dist/assets/{TaskRoutes-dkq9ikjL.js → TaskRoutes-B3fEaAUN.js} +1 -1
  44. package/dist/assets/{TransactionDetailRoutes-2AtDo3dT.js → TransactionDetailRoutes-DWDGqu2s.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-CWpk0UU1.js → TransactionDetailScreen-DW8t3EC2.js} +1 -1
  46. package/dist/assets/{TransactionListRoutes-lHRZBvxi.js → TransactionListRoutes-DHSwzqfn.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-C4iGPRK3.js → TreasuryRoutes-Cxtbe06-.js} +1 -1
  48. package/dist/assets/{VendorsRoutes-7KkgbfcW.js → VendorsRoutes-MlvyyMTe.js} +1 -1
  49. package/dist/assets/{WiseConfirmationScreen-DshLBzeW.js → WiseConfirmationScreen-D-axhjl6.js} +1 -1
  50. package/dist/assets/{ZeniAccountRoutes-pWTshbAJ.js → ZeniAccountRoutes-BG6yVxGl.js} +1 -1
  51. package/dist/assets/{ZeniAccountStatementScreen-DEwEWZ2Q.js → ZeniAccountStatementScreen-D1CXmWJM.js} +1 -1
  52. package/dist/assets/{analyticsHelper-d524teZu.js → analyticsHelper-bAQTI-GF.js} +1 -1
  53. package/dist/assets/{getLocaleForTenant-DTwWZ3TG.js → getLocaleForTenant-DrFh6zlq.js} +1 -1
  54. package/dist/assets/{index-CwcEF-q7.js → index-CVpYlrKc.js} +5 -5
  55. package/dist/assets/{routePaths-CjJlLbxf.js → routePaths-DdjVf9j1.js} +1 -1
  56. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BQUVbUQb.js → useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js} +1 -1
  57. package/dist/assets/{useAskAiCfoHostNavButtonProps-XSnEPSCB.js → useAskAiCfoHostNavButtonProps-w5iOFbal.js} +1 -1
  58. package/dist/assets/{useCashManagementBanner-Cqvytrqk.js → useCashManagementBanner-Drz7Ezu4.js} +1 -1
  59. package/dist/assets/{useChargeCardPusherEvents-DWEn28bl.js → useChargeCardPusherEvents-FFGUOH8U.js} +1 -1
  60. package/dist/assets/{useEmailConnectResultRefresh-iMxOBvVh.js → useEmailConnectResultRefresh-DsiaZGrG.js} +1 -1
  61. package/dist/assets/{useInitialThreadRequest-BsceBU6n.js → useInitialThreadRequest-B3tsIQAR.js} +1 -1
  62. package/dist/assets/{withTransactionSidePanel-BzY2xiGY.js → withTransactionSidePanel-Dy09Dwri.js} +1 -1
  63. package/dist/index.html +1 -1
  64. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"./liveblocks-DC3GaKoW.js";import{A as d}from"./AddressScreen-GAHyIX-c.js";import i from"./NotFoundScreen-CKyavEYX.js";import"./sentry-CuaXjR5n.js";import{o as s,p as r}from"./core-Bv1T7LZC.js";import"./zeni-epic-state-DuQa9FMz.js";import"./recharts-D979ncoh.js";import"./index-CwcEF-q7.js";import"./mui-VYhJrGDQ.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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
+ import{j as e}from"./liveblocks-DC3GaKoW.js";import{A as d}from"./AddressScreen-DZz6iLRi.js";import i from"./NotFoundScreen-D0AQGcoe.js";import"./sentry-CuaXjR5n.js";import{o as s,p as r}from"./core-Bv1T7LZC.js";import"./zeni-epic-state-DuQa9FMz.js";import"./recharts-D979ncoh.js";import"./index-CVpYlrKc.js";import"./mui-VYhJrGDQ.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-DC3GaKoW.js";import{a as h}from"./sentry-CuaXjR5n.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-Bv1T7LZC.js";import{Z as $,m as D,z as L,I as K,B as U,w as z,d as C,f as S,j as F,h as b,p as N}from"./index-CwcEF-q7.js";import{MH as I,hU as R,eW as G,MI as H,c6 as O,MJ as V,ld as q}from"./zeni-epic-state-DuQa9FMz.js";import{n as J}from"./mui-VYhJrGDQ.js";import W from"./NotFoundScreen-CKyavEYX.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]="324f5416-f826-4c7f-9287-664bfc2ea28a",e._sentryDebugIdIdentifier="sentry-dbid-324f5416-f826-4c7f-9287-664bfc2ea28a")}catch{}})();const Z=J.div`
1
+ import{j as d}from"./liveblocks-DC3GaKoW.js";import{a as h}from"./sentry-CuaXjR5n.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-Bv1T7LZC.js";import{Z as $,m as D,z as L,I as K,B as U,w as z,d as C,f as S,j as F,h as b,p as N}from"./index-CVpYlrKc.js";import{MH as I,hU as R,eW as G,MI as H,c6 as O,MJ as V,ld as q}from"./zeni-epic-state-DuQa9FMz.js";import{n as J}from"./mui-VYhJrGDQ.js";import W from"./NotFoundScreen-D0AQGcoe.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]="324f5416-f826-4c7f-9287-664bfc2ea28a",e._sentryDebugIdIdentifier="sentry-dbid-324f5416-f826-4c7f-9287-664bfc2ea28a")}catch{}})();const Z=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-DC3GaKoW.js";import{a as r}from"./sentry-CuaXjR5n.js";import{u as we,h as xe,g as Pe,j as Z,i as ye,n as Ee}from"./core-Bv1T7LZC.js";import{O as Te,da as ve,z as Ae,Z as Qe,db as _e,dc as Oe,b9 as J,dd as se,de as Ue,b8 as ae,p as M,w as B,d as I,df as R,dg as je,dh as Le,a1 as Fe,f as De,a7 as Be,di as Re,dj as Ve,a2 as Me,dk as $e,dl as Ge,dm as Ne,n as qe,b4 as We,dn as ze}from"./index-CwcEF-q7.js";import{gl as He,eV as oe,eW as Ke,iA as Xe,TT as Ye,fp as Ze,iK as Je,iG as et,eX as V,fw as tt,g6 as st,f$ as at,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-DuQa9FMz.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-VYhJrGDQ.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-BQUVbUQb.js";import{p as pt}from"./pathToGoBack-BPhnwklb.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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]="31b5cbc9-e107-4495-a5d3-29fefc29139c",e._sentryDebugIdIdentifier="sentry-dbid-31b5cbc9-e107-4495-a5d3-29fefc29139c")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=ae(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,w,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...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=we(),u=xe(),s=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Z(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=Z(i=>Ke(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=s.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[J]!==!0)return;S(!0);const f={...i};delete f[J],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.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=s.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,$,s.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),N=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),q=N.get("ref")??P?.aiCfoRef,L=N.get("emailRefId")??P?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||q!=="month-end-email"||L==null||n!=null||a==null||(t(Xe("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[q,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ye()))},[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",K=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ze({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(Je())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&K&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,K,n,a,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:Y}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
1
+ import{j as c}from"./liveblocks-DC3GaKoW.js";import{a as r}from"./sentry-CuaXjR5n.js";import{u as we,h as xe,g as Pe,j as Z,i as ye,n as Ee}from"./core-Bv1T7LZC.js";import{O as Te,da as ve,z as Ae,Z as Qe,db as _e,dc as Oe,b9 as J,dd as se,de as Ue,b8 as ae,p as M,w as B,d as I,df as R,dg as je,dh as Le,a1 as Fe,f as De,a7 as Be,di as Re,dj as Ve,a2 as Me,dk as $e,dl as Ge,dm as Ne,n as qe,b4 as We,dn as ze}from"./index-CVpYlrKc.js";import{gl as He,eV as oe,eW as Ke,iA as Xe,TT as Ye,fp as Ze,iK as Je,iG as et,eX as V,fw as tt,g6 as st,f$ as at,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-DuQa9FMz.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-VYhJrGDQ.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js";import{p as pt}from"./pathToGoBack-BPhnwklb.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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]="31b5cbc9-e107-4495-a5d3-29fefc29139c",e._sentryDebugIdIdentifier="sentry-dbid-31b5cbc9-e107-4495-a5d3-29fefc29139c")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=ae(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,w,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...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=we(),u=xe(),s=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Z(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=Z(i=>Ke(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=s.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[J]!==!0)return;S(!0);const f={...i};delete f[J],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.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=s.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,$,s.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),N=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),q=N.get("ref")??P?.aiCfoRef,L=N.get("emailRefId")??P?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||q!=="month-end-email"||L==null||n!=null||a==null||(t(Xe("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[q,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ye()))},[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",K=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Ze({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(Je())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&K&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,K,n,a,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(B,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:Y}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(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-DC3GaKoW.js";import{a as v}from"./sentry-CuaXjR5n.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-Bv1T7LZC.js";import{eW as P,Q5 as A,PN as h,zp as E,zh as q,zl as R,za as K,PP as M,zr as ae,zd as Q,zu as G,zq as C}from"./zeni-epic-state-DuQa9FMz.js";import{z as V,a7 as H,bL as oe,af as O,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-CwcEF-q7.js";import"./mui-VYhJrGDQ.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-77M2HLZ2.js";import re from"./NotFoundScreen-CKyavEYX.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]="2604ea1c-0791-41d5-8a53-bac75ebe34f1",e._sentryDebugIdIdentifier="sentry-dbid-2604ea1c-0791-41d5-8a53-bac75ebe34f1")}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(M(!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,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=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||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!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)),de=()=>{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,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=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||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>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=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
1
+ import{j as c}from"./liveblocks-DC3GaKoW.js";import{a as v}from"./sentry-CuaXjR5n.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-Bv1T7LZC.js";import{eW as P,Q5 as A,PN as h,zp as E,zh as q,zl as R,za as K,PP as M,zr as ae,zd as Q,zu as G,zq as C}from"./zeni-epic-state-DuQa9FMz.js";import{z as V,a7 as H,bL as oe,af as O,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-CVpYlrKc.js";import"./mui-VYhJrGDQ.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-SmUpbSJe.js";import re from"./NotFoundScreen-D0AQGcoe.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]="2604ea1c-0791-41d5-8a53-bac75ebe34f1",e._sentryDebugIdIdentifier="sentry-dbid-2604ea1c-0791-41d5-8a53-bac75ebe34f1")}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(M(!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,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=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||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!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)),de=()=>{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,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=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||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>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=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-DC3GaKoW.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as na,o as ia,p as S}from"./core-Bv1T7LZC.js";import{eW as Z,Pn as _e,bs as kt,Kc as oa,bq as wt,bJ as pe,Po as At,yH as Ct,zW as $e,ze as la,bn as De,Pp as sa,Pq as ra,c6 as ca,Pr as da,kx as Bt,Ps as xt,Pt as Et,Av as Ge,yW as Be,Pu as ua,yv as tt,Pv as pa,EA as ma,yz as ba,yF as Dt,Pw as ve,Px as Me,zX as Ne,Py as ha,Pz as ga,z_ as Oe,PA as ya,Ab as Sa,PB as Pt,zH as at,zM as fa,PC as va,PD as ue,PE as jt,PF as Tt,PG as Ft,gp as Ia,y$ as Le,cA as Rt,PH as ka,fy as wa,PI as Aa,PJ as Ca,fD as Vt,fB as $t,PK as ze,PL as Ba,PM as xa,N6 as Ze,PN as Ea,N7 as oe,N8 as He,PO as Da,PP as Pa,PQ as ja,zO as nt,zL as Ta,PR as Fa,PS as Ra,PT as Va,zx as $a,PU as La,PV as Ua,PW as _a,co as Lt,cQ as Ut,kI as Ga,bP as Ma,bo as _t,bQ as Gt,xN as Na,PX as Oa,En as za,Et as Za,ub as Ha,zY as Wa,AC as qa,kV as fe,PY as Qa,PZ as Mt,ln as Ka,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ja,P_ as Xa,P$ as Ie,js as Ya,Q0 as ot,Q1 as en,jw as tn,jR as an,AQ as nn,Q2 as on,lg as ln,AG as sn,Q3 as lt,AK as rn,AP as cn,AM as dn,AE as un,Q4 as zt,yQ as pn,Q5 as mn,Q6 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,AI as kn,jC as wn,lu as An,Q7 as Cn,ju as Bn,rt as xn,Q8 as En,zD as Dn,bK as Pn,bt as jn,LW as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-DuQa9FMz.js";import{m as me,z as V,I as ke,X as We,W as le,U as y,aQ as xe,B as re,o as x,w as Pe,d as D,bh as Ln,p as z,a2 as qe,n as E,Z as we,bi as rt,bj as ct,bk as Un,ak as _n,A as Gn,aK as Mn,x as Zt,a as Qe,R as Ke,bl as Nn,au as Ht,bm as On,T as zn,f as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,r as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-CwcEF-q7.js";import{n as U,S as si}from"./mui-VYhJrGDQ.js";import{A as dt}from"./AddressScreen-GAHyIX-c.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-WRSPX-4X.js";import{a as f}from"./sentry-CuaXjR5n.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-XSnEPSCB.js";import{u as Qt}from"./useInitialThreadRequest-BsceBU6n.js";import Ee from"./NotFoundScreen-CKyavEYX.js";import{D as ui}from"./DrawerScreen-DaMuYUCn.js";import{M as Kt}from"./MobileAppDrawer-PDN1hPUR.js";import{F as Jt}from"./FeaturePreviewScreen-D4Ah53J7.js";import{S as Te}from"./SetupPagesScreen-CrjLDbOm.js";import{B as pi}from"./BillPayApprovalRoutes-BglCJxi-.js";import{FallBackRoute as mi}from"./ScreenRoutes-DvRF1Ugr.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./analyticsHelper-d524teZu.js";import"./routePaths-CjJlLbxf.js";import"./BusinessVerificationPageScreen-DMq3tKTs.js";import"./ReimbursementApprovalRuleDetailScreen-77M2HLZ2.js";import"./getLocaleForTenant-DTwWZ3TG.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]="92b8b86b-fc86-435f-9b99-8fe3a9feb544",e._sentryDebugIdIdentifier="sentry-dbid-92b8b86b-fc86-435f-9b99-8fe3a9feb544")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(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=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=ke(),o=I(N=>Z(N)),s=I(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,k]=f.useState(!1),[H,M]=f.useState(),B=I(F=>Me(F,m,g,n));let q=B.fetchState,W=B.file,L=B.showAutofill;const Q=I(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,W=Q.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,B),setShowConfirmationPopup:k,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-DC3GaKoW.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as na,o as ia,p as S}from"./core-Bv1T7LZC.js";import{eW as Z,Pn as _e,bs as kt,Kc as oa,bq as wt,bJ as pe,Po as At,yH as Ct,zW as $e,ze as la,bn as De,Pp as sa,Pq as ra,c6 as ca,Pr as da,kx as Bt,Ps as xt,Pt as Et,Av as Ge,yW as Be,Pu as ua,yv as tt,Pv as pa,EA as ma,yz as ba,yF as Dt,Pw as ve,Px as Me,zX as Ne,Py as ha,Pz as ga,z_ as Oe,PA as ya,Ab as Sa,PB as Pt,zH as at,zM as fa,PC as va,PD as ue,PE as jt,PF as Tt,PG as Ft,gp as Ia,y$ as Le,cA as Rt,PH as ka,fy as wa,PI as Aa,PJ as Ca,fD as Vt,fB as $t,PK as ze,PL as Ba,PM as xa,N6 as Ze,PN as Ea,N7 as oe,N8 as He,PO as Da,PP as Pa,PQ as ja,zO as nt,zL as Ta,PR as Fa,PS as Ra,PT as Va,zx as $a,PU as La,PV as Ua,PW as _a,co as Lt,cQ as Ut,kI as Ga,bP as Ma,bo as _t,bQ as Gt,xN as Na,PX as Oa,En as za,Et as Za,ub as Ha,zY as Wa,AC as qa,kV as fe,PY as Qa,PZ as Mt,ln as Ka,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ja,P_ as Xa,P$ as Ie,js as Ya,Q0 as ot,Q1 as en,jw as tn,jR as an,AQ as nn,Q2 as on,lg as ln,AG as sn,Q3 as lt,AK as rn,AP as cn,AM as dn,AE as un,Q4 as zt,yQ as pn,Q5 as mn,Q6 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,AI as kn,jC as wn,lu as An,Q7 as Cn,ju as Bn,rt as xn,Q8 as En,zD as Dn,bK as Pn,bt as jn,LW as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-DuQa9FMz.js";import{m as me,z as V,I as ke,X as We,W as le,U as y,aQ as xe,B as re,o as x,w as Pe,d as D,bh as Ln,p as z,a2 as qe,n as E,Z as we,bi as rt,bj as ct,bk as Un,ak as _n,A as Gn,aK as Mn,x as Zt,a as Qe,R as Ke,bl as Nn,au as Ht,bm as On,T as zn,f as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,r as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-CVpYlrKc.js";import{n as U,S as si}from"./mui-VYhJrGDQ.js";import{A as dt}from"./AddressScreen-DZz6iLRi.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-iXO5zWUm.js";import{a as f}from"./sentry-CuaXjR5n.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import{u as Qt}from"./useInitialThreadRequest-B3tsIQAR.js";import Ee from"./NotFoundScreen-D0AQGcoe.js";import{D as ui}from"./DrawerScreen-B_vR9_qC.js";import{M as Kt}from"./MobileAppDrawer-CHF9nCsW.js";import{F as Jt}from"./FeaturePreviewScreen-BQvRhW1f.js";import{S as Te}from"./SetupPagesScreen-CCip2k58.js";import{B as pi}from"./BillPayApprovalRoutes-DJjLicyn.js";import{FallBackRoute as mi}from"./ScreenRoutes-CEUjM6GK.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./analyticsHelper-bAQTI-GF.js";import"./routePaths-DdjVf9j1.js";import"./BusinessVerificationPageScreen-CbhS3pML.js";import"./ReimbursementApprovalRuleDetailScreen-SmUpbSJe.js";import"./getLocaleForTenant-DrFh6zlq.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]="92b8b86b-fc86-435f-9b99-8fe3a9feb544",e._sentryDebugIdIdentifier="sentry-dbid-92b8b86b-fc86-435f-9b99-8fe3a9feb544")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(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=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=ke(),o=I(N=>Z(N)),s=I(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,k]=f.useState(!1),[H,M]=f.useState(),B=I(F=>Me(F,m,g,n));let q=B.fetchState,W=B.file,L=B.showAutofill;const Q=I(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,W=Q.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,B),setShowConfirmationPopup:k,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-DC3GaKoW.js";import{a as V}from"./sentry-CuaXjR5n.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-Bv1T7LZC.js";import{I as ce,W as ue,aQ as de,z,w as pe,d as B,af as x,f as E,bH as le,au as me,n as P,av as M}from"./index-CwcEF-q7.js";import{PV as fe,eW as G,tC as ye,Kf as Se,zx as ge,CY as Ie,FJ as he,Gm as be,Hm as Te,Qg as De,Qh as Oe,Qi as Ce,Qj as ke,Qk as Ve,MI as we,Pi as Ae,MZ as Ne,E0 as Fe,M_ as _e,E4 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-DuQa9FMz.js";import{n as Ge}from"./mui-VYhJrGDQ.js";import{d as j}from"./routePaths-CjJlLbxf.js";import{M as Qe}from"./MobileAppDrawer-PDN1hPUR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="e63e321d-86f9-4bdb-a63c-e5a312f227f7",t._sentryDebugIdIdentifier="sentry-dbid-e63e321d-86f9-4bdb-a63c-e5a312f227f7")}catch{}})();const qe=Ge.div`
1
+ import{j as C}from"./liveblocks-DC3GaKoW.js";import{a as V}from"./sentry-CuaXjR5n.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-Bv1T7LZC.js";import{I as ce,W as ue,aQ as de,z,w as pe,d as B,af as x,f as E,bH as le,au as me,n as P,av as M}from"./index-CVpYlrKc.js";import{PV as fe,eW as G,tC as ye,Kf as Se,zx as ge,CY as Ie,FJ as he,Gm as be,Hm as Te,Qg as De,Qh as Oe,Qi as Ce,Qj as ke,Qk as Ve,MI as we,Pi as Ae,MZ as Ne,E0 as Fe,M_ as _e,E4 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-DuQa9FMz.js";import{n as Ge}from"./mui-VYhJrGDQ.js";import{d as j}from"./routePaths-DdjVf9j1.js";import{M as Qe}from"./MobileAppDrawer-CHF9nCsW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="e63e321d-86f9-4bdb-a63c-e5a312f227f7",t._sentryDebugIdIdentifier="sentry-dbid-e63e321d-86f9-4bdb-a63c-e5a312f227f7")}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-DC3GaKoW.js";import{a as l}from"./sentry-CuaXjR5n.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Bv1T7LZC.js";import{O as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,w as we,d as $,df as H,dp as Ee,a as ke,f as Ae,a7 as Te,di as xe,dj as Oe,a2 as Ue,dm as _e,b4 as ve,dn as Qe}from"./index-CwcEF-q7.js";import{gl as Fe,eV as G,eW as $e,fp as Ve,iK as De,iG as Le,eX as B,g6 as je,f$ as Re,g3 as N,g7 as qe,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-DuQa9FMz.js";import{D as ze,n as D,P as We,S as Ge}from"./mui-VYhJrGDQ.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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]="896b7220-2c8f-42e2-94fa-0667984a4b72",e._sentryDebugIdIdentifier="sentry-dbid-896b7220-2c8f-42e2-94fa-0667984a4b72")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function V(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Oe(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:`${Ue}/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:O}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===Y?Z(i):V(i);return{onEventReceived:(n,t)=>{if(n===K&&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,O)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${X}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},..._e(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=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:O}=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===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,U]=l.useState(null),[oe,_]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(U(u),_(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{U(null),_(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,U(r),_(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o(De())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))},[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:O,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open: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:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Je=D(Ge)`
1
+ import{j as g}from"./liveblocks-DC3GaKoW.js";import{a as l}from"./sentry-CuaXjR5n.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Bv1T7LZC.js";import{O as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,w as we,d as $,df as H,dp as Ee,a as ke,f as Ae,a7 as Te,di as xe,dj as Oe,a2 as Ue,dm as _e,b4 as ve,dn as Qe}from"./index-CVpYlrKc.js";import{gl as Fe,eV as G,eW as $e,fp as Ve,iK as De,iG as Le,eX as B,g6 as je,f$ as Re,g3 as N,g7 as qe,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-DuQa9FMz.js";import{D as ze,n as D,P as We,S as Ge}from"./mui-VYhJrGDQ.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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]="896b7220-2c8f-42e2-94fa-0667984a4b72",e._sentryDebugIdIdentifier="sentry-dbid-896b7220-2c8f-42e2-94fa-0667984a4b72")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function V(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Oe(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:`${Ue}/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:O}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===Y?Z(i):V(i);return{onEventReceived:(n,t)=>{if(n===K&&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,O)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${X}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},..._e(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=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:O}=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===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,U]=l.useState(null),[oe,_]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(U(u),_(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{U(null),_(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,U(r),_(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o(De())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))},[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:O,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open: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:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Je=D(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-DC3GaKoW.js";import{u as ue,j as i,h as de,g as pe,i as Me,N as ba,s as At,n as De,t as kn,o as es,p as se}from"./core-Bv1T7LZC.js";import{f7 as Dt,RS as as,fj as _t,bt as Pe,RT as ts,RU as ns,eY as mn,RV as En,f5 as An,RW as Dn,RX as _n,RY as Pn,RZ as wn,f6 as vn,fi as Tn,R_ as Fn,R$ as rs,fc as ss,fb as cs,S0 as os,C1 as xn,fl as ca,S1 as is,S2 as ds,e_ as ls,eZ as us,fy as ze,fe as Bn,fd as Rn,S3 as ms,ff as Cs,By as ps,Bx as hs,BB as fs,BD as gs,fr as Ss,eV as Ln,S4 as bs,S5 as ys,fw as On,S6 as Is,fx as St,BJ as ks,BG as Es,eW as fe,S7 as qa,fB as we,fC as ve,fD as Te,gw as oa,cv as ia,S8 as da,S9 as Pt,uQ as $a,kF as za,Sa as Ya,Ch as ka,fm as Qe,Cj as wt,kv as Un,Sb as la,C5 as _a,Sc as As,Sd as Ds,C8 as Qa,Se as _s,Qd as Ja,fh as jn,Ce as ga,hV as Ps,Sf as Mn,f8 as ua,bo as ws,Sg as vs,gh as Xa,gg as et,CN as Ts,gf as at,PV as Fs,Sh as Nn,co as Vn,cQ as xs,Qc as wa,Dm as Hn,Si as Cn,CY as Pa,Sj as Gn,Dn as Bs,QC as Rs,Do as Ls,Et as Os,ub as Us,En as js,Sk as Ms,Ci as ra,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as $s,Sq as vt,Sr as zs,Cy as $n,Cr as Ys,Ss as Ws,gy as Zs,CH as zn,CL as Yn,gx as Ks,St as qs,D8 as Wn,Su as Qs,Sv as Js,Sw as Xs,CJ as Zn,Cu as Kn,Cb as qn,CD as Qn,CB as Jn,CF as ec,Sx as Xn,Sy as ac,ft as tc,fu as nc,fv as rc,Sz as tt,fn as er,cR as Tt,SA as sc,SB as cc,SC as oc,SD as ic,CT as bt,Df as dc,Db as lc,CP as uc,Dd as mc,D3 as Cc,D5 as pc,SE as ar,Dl as Ga,Kc as hc,SF as fc,SG as gc,SH as Sc,SI as tr,SJ as bc,DI as yc,CX as nr,CS as je,CW as Ic,SK as kc,SL as Ec,C2 as Ac,SM as rr,fg as sr,SN as Dc,C4 as _c,C3 as pn,SO as Pc,SP as wc,SQ as vc,MJ as Tc,SR as Ft,SS as Fc,xQ as cr,ld as xc,hL as Bc,DN as Rc,ST as or,f2 as Lc,f3 as Oc,SU as Uc,di as jc,fk as Mc,DD as Nc,Dx as qe,bs as Vc,bJ as Hc,cA as Gc,bK as $c,LW as zc}from"./zeni-epic-state-DuQa9FMz.js";import{I as Fe,cp as ir,p as _e,cq as dr,cr as lr,cs as Yc,a as Xe,X as xt,ct as Wc,cu as Zc,O as ur,c as mr,V as Cr,n as ye,W as le,U as W,ar as ya,cv as pr,cw as Kc,cx as qc,z as ne,B as va,ce as nt,cy as Qc,cz as Jc,cA as Xc,Z as Ta,aQ as Ye,br as Bt,cB as eo,x as Fa,h as rt,m as Rt,d as J,a7 as st,cC as ao,bE as Sa,cD as yt,cE as to,w as Lt,cF as no,au as hr,a2 as It,cG as ro,T as fr,f as gr,cH as so,cI as co,cJ as oo,cK as io,cL as lo,cM as uo,o as Wa,cN as mo,cO as Co,cP as Ct,r as po,cQ as ho,cR as fo,cS as go,cT as So,cU as bo,a9 as yo}from"./index-CwcEF-q7.js";import{n as Ne,D as Sr,S as Io}from"./mui-VYhJrGDQ.js";import{a as r}from"./sentry-CuaXjR5n.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-XSnEPSCB.js";import{M as Ie}from"./MobileAppDrawer-PDN1hPUR.js";import{d as Ot}from"./recharts-D979ncoh.js";import{g as Ae,a as Ba,b as br,c as xe,d as Be,e as Je,f as ea,h as aa,A as ko,i as Ut,P as Eo,j as jt,s as Ia,k as yr,l as sa,m as Ir,n as Ao,o as kr,p as Do,S as hn}from"./SetupPagesScreen-CrjLDbOm.js";import{u as Er}from"./useInitialThreadRequest-BsceBU6n.js";import ct from"./NotFoundScreen-CKyavEYX.js";import{u as Mt}from"./useChargeCardPusherEvents-DWEn28bl.js";import{n as fn}from"./utils-DPYDOv00.js";import{t as _o}from"./AddressScreen-GAHyIX-c.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./analyticsHelper-d524teZu.js";import"./routePaths-CjJlLbxf.js";import"./BusinessVerificationPageScreen-DMq3tKTs.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]="65d9da41-abb7-4a74-8e8f-8ab5c13687c4",e._sentryDebugIdIdentifier="sentry-dbid-65d9da41-abb7-4a74-8e8f-8ab5c13687c4")}catch{}})();const Po=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}},Ar=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Po(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Dr(){const e=ue(),n=i(a=>Dt(a.cardPolicyState)),t=i(a=>as(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(_t())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:gn}}}=Xe.getLocalizedStrings(),wo=e=>Bn(e,!1),vo=e=>Rn(e.name,!1);function To(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(mn())},[a]);const w=i(A=>En(A.cardPolicyState)),m=i(A=>An(A.cardPolicyState)),j=i(A=>Dn(A.cardPolicyState)),F=i(A=>_n(A.cardPolicyState)),x=i(A=>Pn(A.cardPolicyState)),h=i(A=>wn(A.cardPolicyState)),f=i(A=>vn(A.cardPolicyState)),v=i(A=>Dt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),T=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Tn())},[a,w]),Dr();const b=i(A=>Fn(A.createCardPolicyState)),U=i(A=>rs(A.createCardPolicyState)),D=i(A=>ss(A.cardPolicyState)),k=i(A=>cs(A.cardPolicyState)),R=i(A=>os(A.createCardPolicyState)),d=i(A=>xn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[d.fetchState,a]);const p=r.useMemo(()=>m.map(wo),[m]),M=r.useMemo(()=>f.map(vo),[f]),V=r.useMemo(()=>d.cards.filter(A=>!ir(A.status.code)).map(Ar),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect(()=>{O&&R==null&&a(is({cardsMasterList:V,defaultRequireReceiptAmount:l,suggestedAllowMerchants:j,suggestedBlockMerchants:F,suggestedAllowCategories:x,suggestedBlockCategories:h}))},[T,a,O,R,V,l,j,F,x,h]);const L=r.useMemo(()=>Ot(A=>{a(_t(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),H=b.fetchState,I=t!=null?`/${t}/cards/policy`:"..",P=r.useCallback(()=>{const A=_e(n.state?.pathnameStackToGoBack),K=A.poppedPathname??I;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,I]),Y=r.useCallback(()=>{e(I)},[e,I]),Q=r.useCallback(A=>{a(ds(A))},[a]),E=r.useCallback(A=>{const K=dr(A);a(ls({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(us(A))},[a]),Z=r.useCallback(()=>{a(mn())},[a]),X=r.useRef(H);r.useEffect(()=>{const A=X.current;X.current=H,H==="Completed"&&A!=="Completed"&&U!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(I))},[a,H,U,e,I]);const o=H==="Error"?b.error?.message??gn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?R==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(lr,{showUploadDocumentSection:!0,navBarTitle:gn.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Yc,{formDraft:R,vendorSearchOptions:M,categorySearchOptions:p,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:o,documentUploadState:D,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:B,onBackClick:P,onCancelClick:Y,onClickMenuIcon:u,onFormChange:Q,onSubmit:E,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Fo}}}=Xe.getLocalizedStrings(),xo=e=>Bn(e,!1),Bo=e=>Rn(e.name,!1);function Ro(){const e=de(),n=pe(),{tenantEmailDomain:t,templateId:a}=Me(),s=ue(),y=Fe(),g=Pe(y?.loggedInUserRoleMap),[S,_]=r.useState(!1),u=r.useCallback(o=>{_(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ms(o)),j=i(o=>En(o.cardPolicyState)),F=i(o=>An(o.cardPolicyState)),x=i(o=>Dn(o.cardPolicyState)),h=i(o=>_n(o.cardPolicyState)),f=i(o=>Pn(o.cardPolicyState)),v=i(o=>wn(o.cardPolicyState)),l=i(o=>vn(o.cardPolicyState)),T=i(o=>Dt(o.cardPolicyState)),b=i(o=>xn(o)),U=i(o=>a!=null?Cs(o.cardPolicyState,a):void 0),D=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?ps(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(hs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),Dr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{b.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[b.fetchState,s]);const R=r.useMemo(()=>F.map(xo),[F]),d=r.useMemo(()=>l.map(Bo),[l]),p=r.useMemo(()=>b.cards.filter(o=>!ir(o.status.code)).map(Ar),[b.cards]);xt({isDataReady:D!=null});const M=r.useMemo(()=>{if(D!=null)return Wc({draft:D,cardRows:p,categorySearchOptions:R,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:x,suggestedBlockMerchants:h,suggestedAllowCategories:f,suggestedBlockCategories:v})},[D,p,R,d,k,x,h,f,v]),[V,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.current=!0,O(M))},[V,M]);const z=r.useCallback(o=>{O(o)},[]),H=r.useMemo(()=>Ot(o=>{s(_t(o))},250),[s]);r.useEffect(()=>()=>{H.cancel()},[H]);const I=r.useCallback(o=>{H(o)},[H]),P=m.updateFetchState.fetchState,Y=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=_e(n.state?.pathnameStackToGoBack),A=o.poppedPathname??Y;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,Y]),E=r.useCallback(()=>{e(Y)},[e,Y]),N=r.useCallback(o=>{if(a==null)return;const A=dr(o);s(fs(A)),s(gs(a))},[s,a]),Z=r.useRef(P);r.useEffect(()=>{const o=Z.current;Z.current=P,P==="Completed"&&o!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))},[s,P,e,Y]);const X=P==="Error"?m.updateFetchState.error?.message??Fo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):V!=null&&j==="Completed"&&b.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(Zc,{templateName:m.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:R,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:I,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:B,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:E,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(lr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:B,onAskAiCfoClick:w})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return i(n=>e==null||e===""?{chips:pt,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??pt:pt,isResolved:s}}(Ss(n,e)),At)}const pt=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Lo,subheadline:Oo,pageTitle:Uo}}}}=Xe.getLocalizedStrings(),jo=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 Mo(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(I=>{S(I)},[]),u=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),F=i(I=>bs(I)),x=i(I=>Fn(I.createCardPolicyState)),h=i(I=>ys(I.createCardPolicyState)),f=i(I=>h==null?[]:On(I.aiCfoState,h).filter(P=>P.kind==="creating_policy"),At),v=x.fetchState==="In-Progress"?Math.max(f.length,1):0,l=i(I=>Is(I.createCardPolicyState)),T=ya(x.fetchState);r.useEffect(()=>{if(T==="In-Progress"&&x.fetchState==="Completed"&&h!=null)f.forEach(I=>{a(St({chatSessionId:h,id:I.id,entityIds:l,kind:"created_policy"}))});else if(T==="In-Progress"&&x.fetchState==="Error"&&h!=null){f.forEach(P=>{a(St({chatSessionId:h,id:P.id,kind:"errored_policy"}))});const I=x.error?.message!=null&&x.error.message.length>0?x.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:I}]}))}},[x.error?.message,x.fetchState,a,h,l,f,T]);const b=F.fetchState.fetchState;r.useEffect(()=>{b!=="Not-Started"&&b!=="Error"||a(ks())},[a,b]);const U=F.archiveFetchState.fetchState,D=ya(U);r.useEffect(()=>{D==="In-Progress"&&U==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,D]);const k=r.useMemo(()=>F.templates.map(jo),[F.templates]);xt({isDataReady:F.fetchState.fetchState==="Completed"});const R=k.length>0||v>0,d=function(I){const{hasAnyPolicies:P,isChargeCardAdmin:Y,isFileUploadEnabled:Q}=I,E=de(),N=pe(),{tenantEmailDomain:Z}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=ur(),A=mr(),K=Cr(),re=i(ce=>Ln(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(q,ke,3),[q,ke]),[ge,ee]=r.useState(""),me=K&&A&&Z!=null&&!X,oe=r.useCallback(ce=>{if(Z==null)return;const Ea=ye(N.state?.pathnameStackToGoBack,N.pathname);E(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[N.pathname,N.state,E,Z]),ae=r.useCallback(ce=>{ce.trim().length!==0&&(ee(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ee(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),te=r.useCallback(ce=>{ee(ce)},[]),Ze=r.useCallback(()=>{o(!0)},[o]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(me&&!P&&Y)return{aiAgentName:Uo,headline:Lo,subheadline:Oo,promptChips:Se,composer:{currentInput:ge,isSubmitting:re,isFileUploadEnabled:Q,onInputChange:te,onSubmit:We,onStopSubmit:Ee},onPromptClick:ae,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,P,me,Y,Q,re,te,Re,Ze,ae,Ee,We,Se])}({hasAnyPolicies:R,isChargeCardAdmin:y,isFileUploadEnabled:B}),p=w&&d!=null?c.jsx(pr,{...d}):null,M=m&&p==null,V=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),P=I.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),H=F.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(qc,{policies:k,archivingTemplateId:F.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:p,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function No(){const e=de(),{cardId:n}=Me(),t=ue(),a=ne.getSignedInUser(),s=i(q=>fe(q)),y=Fe(),g=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),F=we(s),x=ve(s),h=Te(j,s),f=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),l=Be({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:w,isBookKeepingTenant:x,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:f}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(q=>oa(q,s.companyId)),U=ia(b.controllers),{creditAccount:D,creditAccountRepayment:k}=i(q=>da(q)),R=i(q=>q.classListState.fetchState),d=!B&&l&&m,p=i(q=>Pt(q,n,d,l)),[M,V]=r.useState(!1),O=p.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),H=z?.accountingClassIDs[0],I=i(q=>H!=null?za(q.classState,{classId:H,reportId:"class_list"}):void 0),P=O?.cardHolderUser?.userId,Y=i(q=>P!=null?$a(q.userRoleState,P):void 0),Q=Y?.accountingClassIDs[0],E=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&&_===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,_,N,Z]),r.useEffect(()=>{M||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=Ae(s.tenantEmailDomain,n,a,O,C);e(q)}},[p.fetchState,C,N]),r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(wt()),R!=="Completed"&&R!=="In-Progress"&&t(Un())},[D.fetchState,k.fetchState,t,l,m,g,R]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=Ae(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Je(l,v,T,m),K=Ba(l,m,g,D,k),re=br(o,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:re,chargeCardDetailView:p,creditAccount:D,classListFetchState:R,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Nt="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Vt="charge-card-limit-updated",Ht="charge-card-limit-reset",Gt="charge-card-renamed",Vo="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ho=[La,Ra],Go=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(Xc);function $o(){const e=de(),n=ue(),t=pe(),a=ne.getSignedInUser(),s=i(j=>fe(j)),{useFeatureGate:y}=le(),{isFeatureEnabled:g}=y(W.isCardsCommentingEnabled),[S,_]=r.useState(!1),u=i(j=>la(j)),C=Er(s.companyId,{clearParams:u.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),F=j.poppedPathname??zo(s.tenantEmailDomain);e(F,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=ea(s);if(Mt({events:Ca(w,Ho),onEvent:j=>{switch(j){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(_(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(Go,{onBackClick:B,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(Jc,{onBackClick:B})}const zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g}=le(),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(!1),F=ne.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const x=i(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ye.zeniCardsConfig),f=h.max_charge_card_activation_attempts_by_card_id,v=i(E=>Ds(E,s)),l=v.chargeCard,T=i(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:b}=le(),{isFeatureEnabled:U}=b(W.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=b(W.isDebitCardFeatureEnabled),k=Te(D,x),R=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:k}),d=!!x.companyChargeCardInfo?.info?.isChargeCardEnabled,p=x.userRole.includes("charge_card_user"),M=we(x),V=ve(x),O=x.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:O}),z=!p&&L&&d;r.useEffect(()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),_(!0)),u===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,v.fetchState,S,T]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(B===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==F.userId)){const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:N}})}else if(B&&v.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(E,{state:{pathnameStackToGoBack:N}})}}},[v.fetchState,l?.type.code,B,v.isRefreshingViewInBackground]);const I=ne.getZeniOtpTokenForCardHolder(s),P=i(E=>jn(E.userState,F.userId)),Y=()=>{l?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),w(!0))},[v.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=E=>{j(E)};if(T!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(Zo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:P.phone,signedInUser:F,isSandboxEnv:Bt(),chargeCardDetailState:v,signedInUserToken:I,navigate:a,currentTenant:x,location:y,maxChargeCardActivationAttempts:f[s]!=null?f[s]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Ps(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Mn(e,s),S=n.updateStatus,_=ua(e,!1,!1,!1);let u=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||C,showMenuIcon:u,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:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(Ts(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(eo),Ko=Ne.div`
1
+ import{j as c}from"./liveblocks-DC3GaKoW.js";import{u as ue,j as i,h as de,g as pe,i as Me,N as ba,s as At,n as De,t as kn,o as es,p as se}from"./core-Bv1T7LZC.js";import{f7 as Dt,RS as as,fj as _t,bt as Pe,RT as ts,RU as ns,eY as mn,RV as En,f5 as An,RW as Dn,RX as _n,RY as Pn,RZ as wn,f6 as vn,fi as Tn,R_ as Fn,R$ as rs,fc as ss,fb as cs,S0 as os,C1 as xn,fl as ca,S1 as is,S2 as ds,e_ as ls,eZ as us,fy as ze,fe as Bn,fd as Rn,S3 as ms,ff as Cs,By as ps,Bx as hs,BB as fs,BD as gs,fr as Ss,eV as Ln,S4 as bs,S5 as ys,fw as On,S6 as Is,fx as St,BJ as ks,BG as Es,eW as fe,S7 as qa,fB as we,fC as ve,fD as Te,gw as oa,cv as ia,S8 as da,S9 as Pt,uQ as $a,kF as za,Sa as Ya,Ch as ka,fm as Qe,Cj as wt,kv as Un,Sb as la,C5 as _a,Sc as As,Sd as Ds,C8 as Qa,Se as _s,Qd as Ja,fh as jn,Ce as ga,hV as Ps,Sf as Mn,f8 as ua,bo as ws,Sg as vs,gh as Xa,gg as et,CN as Ts,gf as at,PV as Fs,Sh as Nn,co as Vn,cQ as xs,Qc as wa,Dm as Hn,Si as Cn,CY as Pa,Sj as Gn,Dn as Bs,QC as Rs,Do as Ls,Et as Os,ub as Us,En as js,Sk as Ms,Ci as ra,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as $s,Sq as vt,Sr as zs,Cy as $n,Cr as Ys,Ss as Ws,gy as Zs,CH as zn,CL as Yn,gx as Ks,St as qs,D8 as Wn,Su as Qs,Sv as Js,Sw as Xs,CJ as Zn,Cu as Kn,Cb as qn,CD as Qn,CB as Jn,CF as ec,Sx as Xn,Sy as ac,ft as tc,fu as nc,fv as rc,Sz as tt,fn as er,cR as Tt,SA as sc,SB as cc,SC as oc,SD as ic,CT as bt,Df as dc,Db as lc,CP as uc,Dd as mc,D3 as Cc,D5 as pc,SE as ar,Dl as Ga,Kc as hc,SF as fc,SG as gc,SH as Sc,SI as tr,SJ as bc,DI as yc,CX as nr,CS as je,CW as Ic,SK as kc,SL as Ec,C2 as Ac,SM as rr,fg as sr,SN as Dc,C4 as _c,C3 as pn,SO as Pc,SP as wc,SQ as vc,MJ as Tc,SR as Ft,SS as Fc,xQ as cr,ld as xc,hL as Bc,DN as Rc,ST as or,f2 as Lc,f3 as Oc,SU as Uc,di as jc,fk as Mc,DD as Nc,Dx as qe,bs as Vc,bJ as Hc,cA as Gc,bK as $c,LW as zc}from"./zeni-epic-state-DuQa9FMz.js";import{I as Fe,cp as ir,p as _e,cq as dr,cr as lr,cs as Yc,a as Xe,X as xt,ct as Wc,cu as Zc,O as ur,c as mr,V as Cr,n as ye,W as le,U as W,ar as ya,cv as pr,cw as Kc,cx as qc,z as ne,B as va,ce as nt,cy as Qc,cz as Jc,cA as Xc,Z as Ta,aQ as Ye,br as Bt,cB as eo,x as Fa,h as rt,m as Rt,d as J,a7 as st,cC as ao,bE as Sa,cD as yt,cE as to,w as Lt,cF as no,au as hr,a2 as It,cG as ro,T as fr,f as gr,cH as so,cI as co,cJ as oo,cK as io,cL as lo,cM as uo,o as Wa,cN as mo,cO as Co,cP as Ct,r as po,cQ as ho,cR as fo,cS as go,cT as So,cU as bo,a9 as yo}from"./index-CVpYlrKc.js";import{n as Ne,D as Sr,S as Io}from"./mui-VYhJrGDQ.js";import{a as r}from"./sentry-CuaXjR5n.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import{M as Ie}from"./MobileAppDrawer-CHF9nCsW.js";import{d as Ot}from"./recharts-D979ncoh.js";import{g as Ae,a as Ba,b as br,c as xe,d as Be,e as Je,f as ea,h as aa,A as ko,i as Ut,P as Eo,j as jt,s as Ia,k as yr,l as sa,m as Ir,n as Ao,o as kr,p as Do,S as hn}from"./SetupPagesScreen-CCip2k58.js";import{u as Er}from"./useInitialThreadRequest-B3tsIQAR.js";import ct from"./NotFoundScreen-D0AQGcoe.js";import{u as Mt}from"./useChargeCardPusherEvents-FFGUOH8U.js";import{n as fn}from"./utils-DPYDOv00.js";import{t as _o}from"./AddressScreen-DZz6iLRi.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./analyticsHelper-bAQTI-GF.js";import"./routePaths-DdjVf9j1.js";import"./BusinessVerificationPageScreen-CbhS3pML.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]="65d9da41-abb7-4a74-8e8f-8ab5c13687c4",e._sentryDebugIdIdentifier="sentry-dbid-65d9da41-abb7-4a74-8e8f-8ab5c13687c4")}catch{}})();const Po=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}},Ar=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Po(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Dr(){const e=ue(),n=i(a=>Dt(a.cardPolicyState)),t=i(a=>as(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(_t())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:gn}}}=Xe.getLocalizedStrings(),wo=e=>Bn(e,!1),vo=e=>Rn(e.name,!1);function To(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(mn())},[a]);const w=i(A=>En(A.cardPolicyState)),m=i(A=>An(A.cardPolicyState)),j=i(A=>Dn(A.cardPolicyState)),F=i(A=>_n(A.cardPolicyState)),x=i(A=>Pn(A.cardPolicyState)),h=i(A=>wn(A.cardPolicyState)),f=i(A=>vn(A.cardPolicyState)),v=i(A=>Dt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),T=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Tn())},[a,w]),Dr();const b=i(A=>Fn(A.createCardPolicyState)),U=i(A=>rs(A.createCardPolicyState)),D=i(A=>ss(A.cardPolicyState)),k=i(A=>cs(A.cardPolicyState)),R=i(A=>os(A.createCardPolicyState)),d=i(A=>xn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[d.fetchState,a]);const p=r.useMemo(()=>m.map(wo),[m]),M=r.useMemo(()=>f.map(vo),[f]),V=r.useMemo(()=>d.cards.filter(A=>!ir(A.status.code)).map(Ar),[d.cards]),O=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect(()=>{O&&R==null&&a(is({cardsMasterList:V,defaultRequireReceiptAmount:l,suggestedAllowMerchants:j,suggestedBlockMerchants:F,suggestedAllowCategories:x,suggestedBlockCategories:h}))},[T,a,O,R,V,l,j,F,x,h]);const L=r.useMemo(()=>Ot(A=>{a(_t(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),H=b.fetchState,I=t!=null?`/${t}/cards/policy`:"..",P=r.useCallback(()=>{const A=_e(n.state?.pathnameStackToGoBack),K=A.poppedPathname??I;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,I]),Y=r.useCallback(()=>{e(I)},[e,I]),Q=r.useCallback(A=>{a(ds(A))},[a]),E=r.useCallback(A=>{const K=dr(A);a(ls({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(us(A))},[a]),Z=r.useCallback(()=>{a(mn())},[a]),X=r.useRef(H);r.useEffect(()=>{const A=X.current;X.current=H,H==="Completed"&&A!=="Completed"&&U!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(I))},[a,H,U,e,I]);const o=H==="Error"?b.error?.message??gn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?R==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(lr,{showUploadDocumentSection:!0,navBarTitle:gn.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Yc,{formDraft:R,vendorSearchOptions:M,categorySearchOptions:p,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:o,documentUploadState:D,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:B,onBackClick:P,onCancelClick:Y,onClickMenuIcon:u,onFormChange:Q,onSubmit:E,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Fo}}}=Xe.getLocalizedStrings(),xo=e=>Bn(e,!1),Bo=e=>Rn(e.name,!1);function Ro(){const e=de(),n=pe(),{tenantEmailDomain:t,templateId:a}=Me(),s=ue(),y=Fe(),g=Pe(y?.loggedInUserRoleMap),[S,_]=r.useState(!1),u=r.useCallback(o=>{_(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ms(o)),j=i(o=>En(o.cardPolicyState)),F=i(o=>An(o.cardPolicyState)),x=i(o=>Dn(o.cardPolicyState)),h=i(o=>_n(o.cardPolicyState)),f=i(o=>Pn(o.cardPolicyState)),v=i(o=>wn(o.cardPolicyState)),l=i(o=>vn(o.cardPolicyState)),T=i(o=>Dt(o.cardPolicyState)),b=i(o=>xn(o)),U=i(o=>a!=null?Cs(o.cardPolicyState,a):void 0),D=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?ps(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(hs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),Dr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{b.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[b.fetchState,s]);const R=r.useMemo(()=>F.map(xo),[F]),d=r.useMemo(()=>l.map(Bo),[l]),p=r.useMemo(()=>b.cards.filter(o=>!ir(o.status.code)).map(Ar),[b.cards]);xt({isDataReady:D!=null});const M=r.useMemo(()=>{if(D!=null)return Wc({draft:D,cardRows:p,categorySearchOptions:R,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:x,suggestedBlockMerchants:h,suggestedAllowCategories:f,suggestedBlockCategories:v})},[D,p,R,d,k,x,h,f,v]),[V,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.current=!0,O(M))},[V,M]);const z=r.useCallback(o=>{O(o)},[]),H=r.useMemo(()=>Ot(o=>{s(_t(o))},250),[s]);r.useEffect(()=>()=>{H.cancel()},[H]);const I=r.useCallback(o=>{H(o)},[H]),P=m.updateFetchState.fetchState,Y=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=_e(n.state?.pathnameStackToGoBack),A=o.poppedPathname??Y;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,Y]),E=r.useCallback(()=>{e(Y)},[e,Y]),N=r.useCallback(o=>{if(a==null)return;const A=dr(o);s(fs(A)),s(gs(a))},[s,a]),Z=r.useRef(P);r.useEffect(()=>{const o=Z.current;Z.current=P,P==="Completed"&&o!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(Y))},[s,P,e,Y]);const X=P==="Error"?m.updateFetchState.error?.message??Fo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):V!=null&&j==="Completed"&&b.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(Zc,{templateName:m.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:R,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:I,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:B,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:E,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(lr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:B,onAskAiCfoClick:w})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return i(n=>e==null||e===""?{chips:pt,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??pt:pt,isResolved:s}}(Ss(n,e)),At)}const pt=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Lo,subheadline:Oo,pageTitle:Uo}}}}=Xe.getLocalizedStrings(),jo=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 Mo(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(I=>{S(I)},[]),u=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),F=i(I=>bs(I)),x=i(I=>Fn(I.createCardPolicyState)),h=i(I=>ys(I.createCardPolicyState)),f=i(I=>h==null?[]:On(I.aiCfoState,h).filter(P=>P.kind==="creating_policy"),At),v=x.fetchState==="In-Progress"?Math.max(f.length,1):0,l=i(I=>Is(I.createCardPolicyState)),T=ya(x.fetchState);r.useEffect(()=>{if(T==="In-Progress"&&x.fetchState==="Completed"&&h!=null)f.forEach(I=>{a(St({chatSessionId:h,id:I.id,entityIds:l,kind:"created_policy"}))});else if(T==="In-Progress"&&x.fetchState==="Error"&&h!=null){f.forEach(P=>{a(St({chatSessionId:h,id:P.id,kind:"errored_policy"}))});const I=x.error?.message!=null&&x.error.message.length>0?x.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:I}]}))}},[x.error?.message,x.fetchState,a,h,l,f,T]);const b=F.fetchState.fetchState;r.useEffect(()=>{b!=="Not-Started"&&b!=="Error"||a(ks())},[a,b]);const U=F.archiveFetchState.fetchState,D=ya(U);r.useEffect(()=>{D==="In-Progress"&&U==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,D]);const k=r.useMemo(()=>F.templates.map(jo),[F.templates]);xt({isDataReady:F.fetchState.fetchState==="Completed"});const R=k.length>0||v>0,d=function(I){const{hasAnyPolicies:P,isChargeCardAdmin:Y,isFileUploadEnabled:Q}=I,E=de(),N=pe(),{tenantEmailDomain:Z}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=ur(),A=mr(),K=Cr(),re=i(ce=>Ln(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(q,ke,3),[q,ke]),[ge,ee]=r.useState(""),me=K&&A&&Z!=null&&!X,oe=r.useCallback(ce=>{if(Z==null)return;const Ea=ye(N.state?.pathnameStackToGoBack,N.pathname);E(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[N.pathname,N.state,E,Z]),ae=r.useCallback(ce=>{ce.trim().length!==0&&(ee(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ee(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),te=r.useCallback(ce=>{ee(ce)},[]),Ze=r.useCallback(()=>{o(!0)},[o]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(me&&!P&&Y)return{aiAgentName:Uo,headline:Lo,subheadline:Oo,promptChips:Se,composer:{currentInput:ge,isSubmitting:re,isFileUploadEnabled:Q,onInputChange:te,onSubmit:We,onStopSubmit:Ee},onPromptClick:ae,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,P,me,Y,Q,re,te,Re,Ze,ae,Ee,We,Se])}({hasAnyPolicies:R,isChargeCardAdmin:y,isFileUploadEnabled:B}),p=w&&d!=null?c.jsx(pr,{...d}):null,M=m&&p==null,V=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),P=I.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),H=F.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:V,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(qc,{policies:k,archivingTemplateId:F.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:p,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function No(){const e=de(),{cardId:n}=Me(),t=ue(),a=ne.getSignedInUser(),s=i(q=>fe(q)),y=Fe(),g=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(W.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(W.isDebitCardFeatureEnabled),F=we(s),x=ve(s),h=Te(j,s),f=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),l=Be({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:w,isBookKeepingTenant:x,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:f}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(q=>oa(q,s.companyId)),U=ia(b.controllers),{creditAccount:D,creditAccountRepayment:k}=i(q=>da(q)),R=i(q=>q.classListState.fetchState),d=!B&&l&&m,p=i(q=>Pt(q,n,d,l)),[M,V]=r.useState(!1),O=p.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),H=z?.accountingClassIDs[0],I=i(q=>H!=null?za(q.classState,{classId:H,reportId:"class_list"}):void 0),P=O?.cardHolderUser?.userId,Y=i(q=>P!=null?$a(q.userRoleState,P):void 0),Q=Y?.accountingClassIDs[0],E=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&&_===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,_,N,Z]),r.useEffect(()=>{M||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=Ae(s.tenantEmailDomain,n,a,O,C);e(q)}},[p.fetchState,C,N]),r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(wt()),R!=="Completed"&&R!=="In-Progress"&&t(Un())},[D.fetchState,k.fetchState,t,l,m,g,R]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=Ae(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Je(l,v,T,m),K=Ba(l,m,g,D,k),re=br(o,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:re,chargeCardDetailView:p,creditAccount:D,classListFetchState:R,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Nt="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Vt="charge-card-limit-updated",Ht="charge-card-limit-reset",Gt="charge-card-renamed",Vo="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ho=[La,Ra],Go=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(Xc);function $o(){const e=de(),n=ue(),t=pe(),a=ne.getSignedInUser(),s=i(j=>fe(j)),{useFeatureGate:y}=le(),{isFeatureEnabled:g}=y(W.isCardsCommentingEnabled),[S,_]=r.useState(!1),u=i(j=>la(j)),C=Er(s.companyId,{clearParams:u.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),F=j.poppedPathname??zo(s.tenantEmailDomain);e(F,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=ea(s);if(Mt({events:Ca(w,Ho),onEvent:j=>{switch(j){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(_(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(Go,{onBackClick:B,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(Jc,{onBackClick:B})}const zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g}=le(),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(!1),F=ne.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const x=i(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ye.zeniCardsConfig),f=h.max_charge_card_activation_attempts_by_card_id,v=i(E=>Ds(E,s)),l=v.chargeCard,T=i(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:b}=le(),{isFeatureEnabled:U}=b(W.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=b(W.isDebitCardFeatureEnabled),k=Te(D,x),R=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:k}),d=!!x.companyChargeCardInfo?.info?.isChargeCardEnabled,p=x.userRole.includes("charge_card_user"),M=we(x),V=ve(x),O=x.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:U,isBookKeepingTenant:V,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:O}),z=!p&&L&&d;r.useEffect(()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),_(!0)),u===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,v.fetchState,S,T]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(B===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==F.userId)){const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:N}})}else if(B&&v.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(E,{state:{pathnameStackToGoBack:N}})}}},[v.fetchState,l?.type.code,B,v.isRefreshingViewInBackground]);const I=ne.getZeniOtpTokenForCardHolder(s),P=i(E=>jn(E.userState,F.userId)),Y=()=>{l?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),w(!0))},[v.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=E=>{j(E)};if(T!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(Zo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:P.phone,signedInUser:F,isSandboxEnv:Bt(),chargeCardDetailState:v,signedInUserToken:I,navigate:a,currentTenant:x,location:y,maxChargeCardActivationAttempts:f[s]!=null?f[s]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Ps(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Mn(e,s),S=n.updateStatus,_=ua(e,!1,!1,!1);let u=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||C,showMenuIcon:u,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:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(Ts(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(eo),Ko=Ne.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${Yo.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-DC3GaKoW.js";import{a as g}from"./sentry-CuaXjR5n.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-Bv1T7LZC.js";import{z as N,bc as P,w as F,d as j,f as V,af as C,bd as A,au as L,av as U,n as B}from"./index-CwcEF-q7.js";import{eW as D,gj as M,tC as _,ge as G,c6 as R,Pi as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Pj as W,bE as Z,cy as b,mQ as $,mT as J}from"./zeni-epic-state-DuQa9FMz.js";import"./mui-VYhJrGDQ.js";import{d as K}from"./routePaths-CjJlLbxf.js";import{M as X}from"./MobileAppDrawer-PDN1hPUR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="a8ce9541-d9da-4ee8-83c8-7cb8d2326372",t._sentryDebugIdIdentifier="sentry-dbid-a8ce9541-d9da-4ee8-83c8-7cb8d2326372")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({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?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?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]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(W(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Q({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=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??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:j,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-DC3GaKoW.js";import{a as g}from"./sentry-CuaXjR5n.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-Bv1T7LZC.js";import{z as N,bc as P,w as F,d as j,f as V,af as C,bd as A,au as L,av as U,n as B}from"./index-CVpYlrKc.js";import{eW as D,gj as M,tC as _,ge as G,c6 as R,Pi as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Pj as W,bE as Z,cy as b,mQ as $,mT as J}from"./zeni-epic-state-DuQa9FMz.js";import"./mui-VYhJrGDQ.js";import{d as K}from"./routePaths-DdjVf9j1.js";import{M as X}from"./MobileAppDrawer-CHF9nCsW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="a8ce9541-d9da-4ee8-83c8-7cb8d2326372",t._sentryDebugIdIdentifier="sentry-dbid-a8ce9541-d9da-4ee8-83c8-7cb8d2326372")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({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?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?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]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t(W(e))},onCompanyOfficerUpdated:e=>{t(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Q({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=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??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:j,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-DC3GaKoW.js";import{a}from"./sentry-CuaXjR5n.js";import{u as D,g as v,j as m,N as w}from"./core-Bv1T7LZC.js";import{LS as A,eW as L,g1 as O,o9 as _,gs as E,g0 as j,fz as U,LZ as F}from"./zeni-epic-state-DuQa9FMz.js";import{u as $,z as c,L as C,a as k,o as z}from"./index-CwcEF-q7.js";import{n as H}from"./mui-VYhJrGDQ.js";import{t as R}from"./getLocaleForTenant-DTwWZ3TG.js";import{g as P,Q as G}from"./QBOConnectionScreen-BDzJBSaJ.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.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]="5f3bc941-31eb-4bc2-ae36-dd15a969f40b",t._sentryDebugIdIdentifier="sentry-dbid-5f3bc941-31eb-4bc2-ae36-dd15a969f40b")}catch{}})();const Q=H.div`
1
+ import{j as g}from"./liveblocks-DC3GaKoW.js";import{a}from"./sentry-CuaXjR5n.js";import{u as D,g as v,j as m,N as w}from"./core-Bv1T7LZC.js";import{LS as A,eW as L,g1 as O,o9 as _,gs as E,g0 as j,fz as U,LZ as F}from"./zeni-epic-state-DuQa9FMz.js";import{u as $,z as c,L as C,a as k,o as z}from"./index-CVpYlrKc.js";import{n as H}from"./mui-VYhJrGDQ.js";import{t as R}from"./getLocaleForTenant-DrFh6zlq.js";import{g as P,Q as G}from"./QBOConnectionScreen-_B3wLRiT.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.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]="5f3bc941-31eb-4bc2-ae36-dd15a969f40b",t._sentryDebugIdIdentifier="sentry-dbid-5f3bc941-31eb-4bc2-ae36-dd15a969f40b")}catch{}})();const Q=H.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-DC3GaKoW.js";import{z as n}from"./index-CwcEF-q7.js";import{g as d}from"./QBOConnectionScreen-BDzJBSaJ.js";import"./sentry-CuaXjR5n.js";import{g as p,N as s}from"./core-Bv1T7LZC.js";import"./zeni-epic-state-DuQa9FMz.js";import"./recharts-D979ncoh.js";import"./mui-VYhJrGDQ.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.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};
1
+ import{j as i}from"./liveblocks-DC3GaKoW.js";import{z as n}from"./index-CVpYlrKc.js";import{g as d}from"./QBOConnectionScreen-_B3wLRiT.js";import"./sentry-CuaXjR5n.js";import{g as p,N as s}from"./core-Bv1T7LZC.js";import"./zeni-epic-state-DuQa9FMz.js";import"./recharts-D979ncoh.js";import"./mui-VYhJrGDQ.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.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};
@@ -1,4 +1,4 @@
1
- import{j as o}from"./liveblocks-DC3GaKoW.js";import{t as ft,A as Ne}from"./AddressScreen-GAHyIX-c.js";import ht from"./NotFoundScreen-CKyavEYX.js";import{a as d}from"./sentry-CuaXjR5n.js";import{h as Ce,g as ke,u as H,i as Ie,j as _,N as j,n as Ee,l as yt,o as St,p as K}from"./core-Bv1T7LZC.js";import{r as _e,I as xe,z as G,W as Ae,U as M,s as bt,n as N,w as ce,d as Q,ap as nt,f as ve,aq as Ct,Z as kt,ar as Ge,h as ye,as as It,o as $e,at as ze,au as Et,av as Ke,aw as _t}from"./index-CwcEF-q7.js";import{eW as W,fV as xt,fD as Te,fB as Oe,bs as At,o7 as vt,fR as Tt,bS as Ot,tm as wt,tp as Pt,MR as Dt,MS as Ft,MT as jt,xK as Ut,Et as Bt,ub as Vt,MU as Rt,k9 as Se,kc as at,Mm as Lt,bY as Mt,c6 as ue,tQ as we,tB as Nt,MV as de,tR as ot,Kf as Gt,ld as st,MW as $t,MX as zt,rj as Kt,hq as Qt,Me as me,hn as Zt,Mf as qt,xZ as Ht,rn as Wt,hf as Yt,hi as Qe,MY as it,MZ as Jt,E0 as Xt,M_ as en,E4 as tn,ts as nn,tD as be,M$ as an,N0 as on,k7 as sn,ka as rn,u1 as cn,tP as dn,bE as Ze,cy as un,u0 as qe,rC as ln,rq as pn,l5 as mn,gh as gn,gg as fn,gf as hn,N1 as yn,tv as Sn,u2 as bn,u5 as Cn,u8 as kn,ue as In}from"./zeni-epic-state-DuQa9FMz.js";import{n as Pe}from"./mui-VYhJrGDQ.js";import{g as En,h as _n,q as ae}from"./QBOConnectionScreen-BDzJBSaJ.js";import{u as xn}from"./useEmailConnectResultRefresh-iMxOBvVh.js";import{u as An}from"./useChargeCardPusherEvents-DWEn28bl.js";import{u as vn}from"./plaid-BlhDSPsk.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f7436143-34fa-4dc0-8bd3-56c9e6b55852",t._sentryDebugIdIdentifier="sentry-dbid-f7436143-34fa-4dc0-8bd3-56c9e6b55852")}catch{}})();const Tn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const a=Tt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Ot(a.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:a,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const u=N(c.state?.pathnameStackToGoBack,c.pathname);a("../../dashboard",{state:{pathnameStackToGoBack:u,message:"activation"}})}}})(Ct),On=()=>{const t=Ce(),s=ke(),n=H(),a=_e(),[c,u]=d.useState(!1),[y,I]=d.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),l=G.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:T}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:m}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:x}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:g}=p(M.isDebitCardFeatureEnabled),U=bt(),S=_(k=>W(k)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&xt(S.company),h=P&&V,b=_(k=>k.onboardingCustomerViewState.fetchState),A=S.excludedResources,B=S.companyId??G.getSignedInUserTenant(e)?.companyId;if(l==null)throw Error("Can't access onboarding flow without signing in...");const D=Te(g,S),v=Oe(S),w=[],Z=A?.resources?.find(k=>k.resource==="/reports/top_expenses")==null,$=A?.resources?.find(k=>k.resource==="/reports/task_card")==null,Y=S?.userRole!=null&&At(S?.userRole),J=A?.resources?.find(k=>k.resource==="/bills")==null&&!Y,z=A?.resources?.find(k=>k.resource==="/reimbursements")==null;if(Z===!1&&w.push("top_expenses"),$===!1&&w.push("task_card"),J===!1&&w.push("bill_pay_card","bill_pay_promo_card"),z===!1&&w.push("reimbursement_card","reimbursement_promo_card"),m===!1&&w.push("zeni_accounts_promo_card"),x===!1&&w.push("rewards_card"),d.useEffect(()=>{b!=="Completed"||c||D||v||(u(!0),n(vt(l.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,v,l,S.tenantId,n]),d.useEffect(()=>{(D||v)&&setTimeout(()=>{I(!0)},5e3)},[D,v]),b!=="Completed")return o.jsx(j,{to:"../"});if(b==="Completed"&&y){const k=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return o.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}});if(v)return o.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}})}return i?.loggedInUserRoleMap!=null?o.jsxs(o.Fragment,{children:[o.jsx(ce,{analytics:Q,onLoad:k=>(F=>F.trackPageLoaded(ve.Event.onboardingDashboardActivation))(k)}),o.jsx(Tn,{navigate:t,location:s,themeState:a,signedInUser:l,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:m,shouldFetchRewardsPlanCard:x,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:h,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):o.jsx(nt,{})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],He=(t,s)=>{const n=new Map(t.map(a=>[a.key,a]));return s.map(a=>{return c=n.get(a)?.status,c==="starting"||c==="building"?c:"idle";var c})},We=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(a=>[a.key,a]));return s.every(a=>n.get(a)?.status==="ready")},wn=new Set(Rt),Ye=Pe.div`
1
+ import{j as o}from"./liveblocks-DC3GaKoW.js";import{t as ft,A as Ne}from"./AddressScreen-DZz6iLRi.js";import ht from"./NotFoundScreen-D0AQGcoe.js";import{a as d}from"./sentry-CuaXjR5n.js";import{h as Ce,g as ke,u as H,i as Ie,j as _,N as j,n as Ee,l as yt,o as St,p as K}from"./core-Bv1T7LZC.js";import{r as _e,I as xe,z as G,W as Ae,U as M,s as bt,n as N,w as ce,d as Q,ap as nt,f as ve,aq as Ct,Z as kt,ar as Ge,h as ye,as as It,o as $e,at as ze,au as Et,av as Ke,aw as _t}from"./index-CVpYlrKc.js";import{eW as W,fV as xt,fD as Te,fB as Oe,bs as At,o7 as vt,fR as Tt,bS as Ot,tm as wt,tp as Pt,MR as Dt,MS as Ft,MT as jt,xK as Ut,Et as Bt,ub as Vt,MU as Rt,k9 as Se,kc as at,Mm as Lt,bY as Mt,c6 as ue,tQ as we,tB as Nt,MV as de,tR as ot,Kf as Gt,ld as st,MW as $t,MX as zt,rj as Kt,hq as Qt,Me as me,hn as Zt,Mf as qt,xZ as Ht,rn as Wt,hf as Yt,hi as Qe,MY as it,MZ as Jt,E0 as Xt,M_ as en,E4 as tn,ts as nn,tD as be,M$ as an,N0 as on,k7 as sn,ka as rn,u1 as cn,tP as dn,bE as Ze,cy as un,u0 as qe,rC as ln,rq as pn,l5 as mn,gh as gn,gg as fn,gf as hn,N1 as yn,tv as Sn,u2 as bn,u5 as Cn,u8 as kn,ue as In}from"./zeni-epic-state-DuQa9FMz.js";import{n as Pe}from"./mui-VYhJrGDQ.js";import{g as En,h as _n,q as ae}from"./QBOConnectionScreen-_B3wLRiT.js";import{u as xn}from"./useEmailConnectResultRefresh-DsiaZGrG.js";import{u as An}from"./useChargeCardPusherEvents-FFGUOH8U.js";import{u as vn}from"./plaid-BlhDSPsk.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./empty-BGU_c4p_.js";import"./pdf-lib-CPh8no6v.js";import"./index-B-VkC3pW.js";import"./url-DXrWvdUh.js";import"./index-Bgxmla6x.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f7436143-34fa-4dc0-8bd3-56c9e6b55852",t._sentryDebugIdIdentifier="sentry-dbid-f7436143-34fa-4dc0-8bd3-56c9e6b55852")}catch{}})();const Tn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const a=Tt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Ot(a.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:a,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const u=N(c.state?.pathnameStackToGoBack,c.pathname);a("../../dashboard",{state:{pathnameStackToGoBack:u,message:"activation"}})}}})(Ct),On=()=>{const t=Ce(),s=ke(),n=H(),a=_e(),[c,u]=d.useState(!1),[y,I]=d.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),l=G.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:T}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:m}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:x}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:g}=p(M.isDebitCardFeatureEnabled),U=bt(),S=_(k=>W(k)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&xt(S.company),h=P&&V,b=_(k=>k.onboardingCustomerViewState.fetchState),A=S.excludedResources,B=S.companyId??G.getSignedInUserTenant(e)?.companyId;if(l==null)throw Error("Can't access onboarding flow without signing in...");const D=Te(g,S),v=Oe(S),w=[],Z=A?.resources?.find(k=>k.resource==="/reports/top_expenses")==null,$=A?.resources?.find(k=>k.resource==="/reports/task_card")==null,Y=S?.userRole!=null&&At(S?.userRole),J=A?.resources?.find(k=>k.resource==="/bills")==null&&!Y,z=A?.resources?.find(k=>k.resource==="/reimbursements")==null;if(Z===!1&&w.push("top_expenses"),$===!1&&w.push("task_card"),J===!1&&w.push("bill_pay_card","bill_pay_promo_card"),z===!1&&w.push("reimbursement_card","reimbursement_promo_card"),m===!1&&w.push("zeni_accounts_promo_card"),x===!1&&w.push("rewards_card"),d.useEffect(()=>{b!=="Completed"||c||D||v||(u(!0),n(vt(l.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,v,l,S.tenantId,n]),d.useEffect(()=>{(D||v)&&setTimeout(()=>{I(!0)},5e3)},[D,v]),b!=="Completed")return o.jsx(j,{to:"../"});if(b==="Completed"&&y){const k=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return o.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}});if(v)return o.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}})}return i?.loggedInUserRoleMap!=null?o.jsxs(o.Fragment,{children:[o.jsx(ce,{analytics:Q,onLoad:k=>(F=>F.trackPageLoaded(ve.Event.onboardingDashboardActivation))(k)}),o.jsx(Tn,{navigate:t,location:s,themeState:a,signedInUser:l,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:m,shouldFetchRewardsPlanCard:x,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:h,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):o.jsx(nt,{})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],He=(t,s)=>{const n=new Map(t.map(a=>[a.key,a]));return s.map(a=>{return c=n.get(a)?.status,c==="starting"||c==="building"?c:"idle";var c})},We=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(a=>[a.key,a]));return s.every(a=>n.get(a)?.status==="ready")},wn=new Set(Rt),Ye=Pe.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-DC3GaKoW.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Bv1T7LZC.js";import{eW as L,Ni as We,bE as ca,bo as we,Ow as On,i$ as Pn,Ox as Zt,Oy as Fn,j2 as _t,Oz as qe,OA as Rn,j7 as Bn,OB as qt,OC as jn,jb as kt,OD as Qe,OE as Mn,co as vt,OF as Un,OG as Ln,NC as Gn,k3 as Vn,OH as Yn,bn as Je,OI as la,N6 as ce,bc as da,kh as ua,oh as ma,k0 as pa,N8 as le,N7 as X,eV as ha,fr as Nn,g3 as St,OJ as $n,OK as zn,OL as fa,OM as Fe,vP as Ue,vQ as Le,wb as xe,w5 as de,vU as Ge,ON as Kn,OO as Zn,OP as qn,OQ as ga,OR as Re,OS as Qn,dJ as Xe,sa as ba,OT as Hn,OU as Wn,OV as Jn,OW as At,Mo as It,kx as De,wj as Et,si as Xn,OX as eo,vR as Qt,sd as Ee,s9 as Ca,OY as ge,OZ as to,O_ as Tt,Mn as wt,ui as _a,O$ as ao,P0 as no,P1 as oo,P2 as xt,uv as so,P3 as ro,vT as Ht,uh as ka,P4 as be,P5 as io,bs as Sa,wn as ya,P6 as co,P7 as lo,P8 as uo,P9 as Dt,wi as mo,Pa as po,vS as Wt,wm as va,Pb as Ce,Pc as ho,Pd as fo,Pe as Aa,km as Ia,oe as Ea,kr as Ta,oc as wa,ob as xa,oa as Da,tG as go,fV as bo,cR as Co,cS as _o,o7 as ko,fR as So,oo as yo,GA as ut,Gs as vo,Gw as Ao,Pf as Io,Pg as Eo,Ph as To,b5 as et,fJ as wo,hJ as xo,gj as Do,oi as Oo,jV as Po,of as Fo,od as Ro,fD as Bo,fB as jo}from"./zeni-epic-state-DuQa9FMz.js";import{z as M,a2 as te,n as x,d as T,a as Z,aY as Mo,X as Ve,w as Ye,aZ as Oa,f as N,a_ as Uo,I as ke,a$ as Pa,W as Se,U as B,m as Lo,b0 as Go,b1 as Vo,O as Fa,Z as Ra,c as Ba,V as Yo,b2 as No,K as $o,aQ as ja,Y as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,s as Zo,ar as qo,p as Qo,T as Ho,b7 as Wo,b8 as Jo,b9 as Xo,ba as es,bb as _e}from"./index-CwcEF-q7.js";import{n as Ot}from"./mui-VYhJrGDQ.js";import{a as b}from"./sentry-CuaXjR5n.js";import{w as Ga}from"./withTransactionSidePanel-BzY2xiGY.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-CjJlLbxf.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-XSnEPSCB.js";import Me from"./NotFoundScreen-CKyavEYX.js";import{u as Ft}from"./useInitialThreadRequest-BsceBU6n.js";import{t as Ya}from"./analyticsHelper-d524teZu.js";import{C as as}from"./CompanyPassportScreen-DMJdNz2u.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-BQUVbUQb.js";import{F as os}from"./FeaturePreviewScreen-D4Ah53J7.js";import{R as ss}from"./ReferralListScreen-CXBkdn17.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./TransactionDetailScreen-CWpk0UU1.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";import"./MobileAppDrawer-PDN1hPUR.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]="a61b2f5c-51cb-4886-9be1-84acec237c69",e._sentryDebugIdIdentifier="sentry-dbid-a61b2f5c-51cb-4886-9be1-84acec237c69")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):we(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),w=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),D=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=x(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:w,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??we(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,w)=>{e(qe({sortKey:w,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,w)=>{},[]),v=b.useCallback((_,w)=>{e(qe({selectedDate:_,agingDateSelectionType:w})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):we(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),w=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const U=x(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[c,e]),D=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&D()},[f.fetchState,D]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:w,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??we(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(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=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Je(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
1
+ import{j as d}from"./liveblocks-DC3GaKoW.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Bv1T7LZC.js";import{eW as L,Ni as We,bE as ca,bo as we,Ow as On,i$ as Pn,Ox as Zt,Oy as Fn,j2 as _t,Oz as qe,OA as Rn,j7 as Bn,OB as qt,OC as jn,jb as kt,OD as Qe,OE as Mn,co as vt,OF as Un,OG as Ln,NC as Gn,k3 as Vn,OH as Yn,bn as Je,OI as la,N6 as ce,bc as da,kh as ua,oh as ma,k0 as pa,N8 as le,N7 as X,eV as ha,fr as Nn,g3 as St,OJ as $n,OK as zn,OL as fa,OM as Fe,vP as Ue,vQ as Le,wb as xe,w5 as de,vU as Ge,ON as Kn,OO as Zn,OP as qn,OQ as ga,OR as Re,OS as Qn,dJ as Xe,sa as ba,OT as Hn,OU as Wn,OV as Jn,OW as At,Mo as It,kx as De,wj as Et,si as Xn,OX as eo,vR as Qt,sd as Ee,s9 as Ca,OY as ge,OZ as to,O_ as Tt,Mn as wt,ui as _a,O$ as ao,P0 as no,P1 as oo,P2 as xt,uv as so,P3 as ro,vT as Ht,uh as ka,P4 as be,P5 as io,bs as Sa,wn as ya,P6 as co,P7 as lo,P8 as uo,P9 as Dt,wi as mo,Pa as po,vS as Wt,wm as va,Pb as Ce,Pc as ho,Pd as fo,Pe as Aa,km as Ia,oe as Ea,kr as Ta,oc as wa,ob as xa,oa as Da,tG as go,fV as bo,cR as Co,cS as _o,o7 as ko,fR as So,oo as yo,GA as ut,Gs as vo,Gw as Ao,Pf as Io,Pg as Eo,Ph as To,b5 as et,fJ as wo,hJ as xo,gj as Do,oi as Oo,jV as Po,of as Fo,od as Ro,fD as Bo,fB as jo}from"./zeni-epic-state-DuQa9FMz.js";import{z as M,a2 as te,n as x,d as T,a as Z,aY as Mo,X as Ve,w as Ye,aZ as Oa,f as N,a_ as Uo,I as ke,a$ as Pa,W as Se,U as B,m as Lo,b0 as Go,b1 as Vo,O as Fa,Z as Ra,c as Ba,V as Yo,b2 as No,K as $o,aQ as ja,Y as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,s as Zo,ar as qo,p as Qo,T as Ho,b7 as Wo,b8 as Jo,b9 as Xo,ba as es,bb as _e}from"./index-CVpYlrKc.js";import{n as Ot}from"./mui-VYhJrGDQ.js";import{a as b}from"./sentry-CuaXjR5n.js";import{w as Ga}from"./withTransactionSidePanel-Dy09Dwri.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-DdjVf9j1.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import Me from"./NotFoundScreen-D0AQGcoe.js";import{u as Ft}from"./useInitialThreadRequest-B3tsIQAR.js";import{t as Ya}from"./analyticsHelper-bAQTI-GF.js";import{C as as}from"./CompanyPassportScreen-BUt2L6sz.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js";import{F as os}from"./FeaturePreviewScreen-BQvRhW1f.js";import{R as ss}from"./ReferralListScreen-CzPMgGBj.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./TransactionDetailScreen-DW8t3EC2.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";import"./MobileAppDrawer-CHF9nCsW.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]="a61b2f5c-51cb-4886-9be1-84acec237c69",e._sentryDebugIdIdentifier="sentry-dbid-a61b2f5c-51cb-4886-9be1-84acec237c69")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):we(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),w=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),D=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=x(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:w,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??we(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,w)=>{e(qe({sortKey:w,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,w)=>{},[]),v=b.useCallback((_,w)=>{e(qe({selectedDate:_,agingDateSelectionType:w})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):we(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),w=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const U=x(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[c,e]),D=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&D()},[f.fetchState,D]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:w,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??we(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(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=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Je(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;