@zeniai/web-app-ui 5.1.56-dev → 5.1.56-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 (62) hide show
  1. package/dist/assets/{AddressRoutes-DOG6BtAE.js → AddressRoutes-DsuoPslx.js} +1 -1
  2. package/dist/assets/{AddressScreen-w3BS5T__.js → AddressScreen-Jgfq0eWZ.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-C4K6FzbI.js → AiCfoScreen-ngmwmSfT.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-D2l3MfyU.js → BillPayApprovalRoutes-DjjjDtRL.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-puCF7hIb.js → BillPayRoutes-zXfejo42.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-BCOKpvnp.js → BusinessVerificationPageScreen-BiV9G1-i.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen-DkQHJJyD.js → CardsAiCfoScreen-Z2PndTe3.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-Ch4Au-Rk.js → ChargeCardRoutes-CBFlKgnf.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-CLNMvqEv.js → CompanyPassportScreen-CE4f1mRO.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-yTkCaoK1.js → ConnectionAuthScreen-BFW2NVDD.js} +1 -1
  11. package/dist/assets/{CustomerOnboardingAuthScreen-DSnDsx1L.js → CustomerOnboardingAuthScreen-DZoaiMvV.js} +1 -1
  12. package/dist/assets/{CustomerOnboardingRoutes-_QxL9WL8.js → CustomerOnboardingRoutes-Doltk1XW.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-BKcrEPsw.js → DashboardRoutes-YclW7oS0.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-DWIyuza_.js → DefaultTenantHome-cEuyRwZp.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-CG8HU9uQ.js → DomesticWireDetailScreen-3X6dnm4U.js} +1 -1
  16. package/dist/assets/{DrawerScreen-BkOQSI_V.js → DrawerScreen-DcUdH_zJ.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-QX_SVg1Y.js → EntityDetailRoutes-D020FlPl.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-BoyNxPcQ.js → ExpenseAutomationRoutes-CTZlVWwO.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-DVS7yzIQ.js → FeaturePreviewScreen-DgqstYkZ.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-Dsb1nJdq.js → HubSpotOAuthCallbackScreen-DlnwVV1p.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-C4TLmrqp.js → MagicLinkRoutes-C901TSTh.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-Cp5Vo4Py.js → MagicLinkSignInScreen-DFljjGc3.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-BzjU__HS.js → MobileAppDrawer-B4f1me8_.js} +1 -1
  24. package/dist/assets/{NotFoundScreen-uCKl6Wx4.js → NotFoundScreen-CxRYls3k.js} +1 -1
  25. package/dist/assets/{NotificationRoutes-CC398QC1.js → NotificationRoutes-Dw__n9YA.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-DNPJKfDX.js → OAuthConsentScreen-Ur-mQS8z.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-C3ftWleu.js → PandLWithForecastRoutes-DSq1hcWm.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-DAFt_Bcx.js → PeopleRoutes-CUtLjfXT.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-DbR-tZSr.js → PerformanceRoutes-D4zDazyB.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-BEi0Zm8x.js → QBOConnectionScreen-CSgGZuyl.js} +1 -1
  31. package/dist/assets/{ReferralListScreen-DUY0_-v6.js → ReferralListScreen-CbCeYBu8.js} +1 -1
  32. package/dist/assets/{ReimbursementApprovalRoutes-Chh2ITQV.js → ReimbursementApprovalRoutes-CQrzmhSh.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js → ReimbursementApprovalRuleDetailScreen-DTZkQzQY.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-COtGoxgk.js → ReimbursementRoutes-CzlU6LYx.js} +1 -1
  35. package/dist/assets/{ReportsRoutes-BcPE2nyn.js → ReportsRoutes-D_wjWb18.js} +1 -1
  36. package/dist/assets/{RewardsRoutes-Dok3xTzo.js → RewardsRoutes-Bfg59urI.js} +1 -1
  37. package/dist/assets/{ScreenRoutes-C6QOgyjY.js → ScreenRoutes-D5k4uqAt.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-NVzDxtS7.js → SettingsRoutes-3hV9qN1I.js} +1 -1
  39. package/dist/assets/{SetupPagesScreen-Df4FCfYh.js → SetupPagesScreen-CPey4cOW.js} +1 -1
  40. package/dist/assets/{SignInScreen-DroHIon2.js → SignInScreen-gQzAHzdj.js} +1 -1
  41. package/dist/assets/{SignOutScreen-DoPJci6D.js → SignOutScreen-GvUCBNk6.js} +1 -1
  42. package/dist/assets/{TaskListScreen-NFjvdEWw.js → TaskListScreen-Cuce7GNl.js} +1 -1
  43. package/dist/assets/{TaskRoutes-8aOjIEkV.js → TaskRoutes-DmGo1lNA.js} +1 -1
  44. package/dist/assets/{TransactionDetailRoutes-D3MSXmNL.js → TransactionDetailRoutes-CgKCf_lf.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-CSArdLSZ.js → TransactionDetailScreen-CoGsdLTa.js} +1 -1
  46. package/dist/assets/{TransactionListRoutes-UucRW17G.js → TransactionListRoutes-C4QYqCpP.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-DwgadYGN.js → TreasuryRoutes-jiXgJCAb.js} +1 -1
  48. package/dist/assets/{VendorsRoutes-Im4S2wjo.js → VendorsRoutes-BZFmR2hI.js} +1 -1
  49. package/dist/assets/{WiseConfirmationScreen-C6UoDkmK.js → WiseConfirmationScreen-BLK_tJR5.js} +1 -1
  50. package/dist/assets/{ZeniAccountRoutes-Dczw62ti.js → ZeniAccountRoutes-DVnj5-p6.js} +1 -1
  51. package/dist/assets/{ZeniAccountStatementScreen-prmZg4t5.js → ZeniAccountStatementScreen-3bZVHWI7.js} +1 -1
  52. package/dist/assets/{analyticsHelper-B_k9Kjrd.js → analyticsHelper-BU5wlVa9.js} +1 -1
  53. package/dist/assets/{getLocaleForTenant-CDmBpg_y.js → getLocaleForTenant-Bn16hOPH.js} +1 -1
  54. package/dist/assets/{index-DLAYU8mN.js → index-NcZU0lXl.js} +5 -5
  55. package/dist/assets/{routePaths-CLQbotzs.js → routePaths-DZldr9mG.js} +1 -1
  56. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js → useAiCfoDashboardSuggestedQuestionsChips-DEWGXdch.js} +1 -1
  57. package/dist/assets/{useAskAiCfoHostNavButtonProps-Cw5yceVN.js → useAskAiCfoHostNavButtonProps-DS5Fxq3U.js} +1 -1
  58. package/dist/assets/{useCashManagementBanner-COC9VygZ.js → useCashManagementBanner-CtcuIjhq.js} +1 -1
  59. package/dist/assets/{useInitialThreadRequest-CgLG7-4I.js → useInitialThreadRequest-Bh1NrHII.js} +1 -1
  60. package/dist/assets/{withTransactionSidePanel-Dtr8LlVa.js → withTransactionSidePanel-DxHfrYsZ.js} +1 -1
  61. package/dist/index.html +1 -1
  62. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"./liveblocks-BUQfB0Zp.js";import{A as d}from"./AddressScreen-w3BS5T__.js";import i from"./NotFoundScreen-uCKl6Wx4.js";import"./sentry-BLIwU6uZ.js";import{o as s,p as r}from"./core-OMb8nkC1.js";import"./zeni-epic-state-BZ6N8nVI.js";import"./recharts-DAM4r1-u.js";import"./index-DLAYU8mN.js";import"./mui-JZY-3hhJ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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-BUQfB0Zp.js";import{A as d}from"./AddressScreen-Jgfq0eWZ.js";import i from"./NotFoundScreen-CxRYls3k.js";import"./sentry-BLIwU6uZ.js";import{o as s,p as r}from"./core-OMb8nkC1.js";import"./zeni-epic-state-BZ6N8nVI.js";import"./recharts-DAM4r1-u.js";import"./index-NcZU0lXl.js";import"./mui-JZY-3hhJ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-BUQfB0Zp.js";import{a as h}from"./sentry-BLIwU6uZ.js";import{h as T,u as _,g as E,i as j,j as M,n as B}from"./core-OMb8nkC1.js";import{J as $,m as D,z as L,j as K,B as N,E as R,d as C,f as S,x as z,k as b,q as F}from"./index-DLAYU8mN.js";import{Mk as k,hN as U,eV as V,Ml as q,c6 as G,Mm as O,l6 as H}from"./zeni-epic-state-BZ6N8nVI.js";import{n as J}from"./mui-JZY-3hhJ.js";import Q from"./NotFoundScreen-uCKl6Wx4.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]="c102055e-3927-402b-98f2-f05dad092bfa",e._sentryDebugIdIdentifier="sentry-dbid-c102055e-3927-402b-98f2-f05dad092bfa")}catch{}})();const W=J.div`
1
+ import{j as r}from"./liveblocks-BUQfB0Zp.js";import{a as h}from"./sentry-BLIwU6uZ.js";import{h as T,u as _,g as E,i as j,j as M,n as B}from"./core-OMb8nkC1.js";import{J as $,m as D,z as L,j as K,B as N,E as R,d as C,f as S,x as z,k as b,q as F}from"./index-NcZU0lXl.js";import{Mk as k,hN as U,eV as V,Ml as q,c6 as G,Mm as O,l6 as H}from"./zeni-epic-state-BZ6N8nVI.js";import{n as J}from"./mui-JZY-3hhJ.js";import Q from"./NotFoundScreen-CxRYls3k.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]="c102055e-3927-402b-98f2-f05dad092bfa",e._sentryDebugIdIdentifier="sentry-dbid-c102055e-3927-402b-98f2-f05dad092bfa")}catch{}})();const W=J.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-BUQfB0Zp.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xe,h as Pe,g as we,j as X,i as ye,n as Ee}from"./core-OMb8nkC1.js";import{V as Te,d9 as ve,z as Ae,J as Qe,da as _e,db as Ue,b6 as Z,dc as ae,dd as Oe,b5 as se,q as M,E as V,d as I,de as B,df as je,dg as Le,a1 as De,f as Fe,a7 as Ve,dh as Be,di as Re,a2 as Me,dj as $e,dk as Ge,dl as qe,s as Ne,b1 as ze,dm as We}from"./index-DLAYU8mN.js";import{gi as He,eU as oe,eV as Ye,it as Je,Tr as Ke,fm as Xe,iD as Ze,iz as et,eW as R,ft as tt,g3 as at,fY as st,g0 as ee,g4 as ot,g5 as nt,g6 as it,g7 as rt,g8 as lt}from"./zeni-epic-state-BZ6N8nVI.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-JZY-3hhJ.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js";import{p as pt}from"./pathToGoBack-iJW8VSI1.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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]="f6f82459-1d9e-4e72-98da-d1822acbfba6",e._sentryDebugIdIdentifier="sentry-dbid-f6f82459-1d9e-4e72-98da-d1822acbfba6")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,We(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&ze(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Dt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=X(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=De(d),p=X(i=>Ye(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),q=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect(()=>{z.current||N!=="month-end-email"||L==null||n!=null||s==null||(t(Je("controller",s.userId,L,"MONTH_END_EMAIL")),z.current=!0)},[N,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Oe(n),D=m.fetchState,F=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Xe({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{D!=="In-Progress"&&F&&t(Ze())},[D,F,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&Y&&s!=null&&D==="Completed"&&!F&&t(et(n,s.userId))},[H,Y,n,s,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(R(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(V,{analytics:I,onLoad:K}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(V,{analytics:I,onLoad:i=>i.trackPageLoaded(Fe.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(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-BUQfB0Zp.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xe,h as Pe,g as we,j as X,i as ye,n as Ee}from"./core-OMb8nkC1.js";import{V as Te,d9 as ve,z as Ae,J as Qe,da as _e,db as Ue,b6 as Z,dc as ae,dd as Oe,b5 as se,q as M,E as V,d as I,de as B,df as je,dg as Le,a1 as De,f as Fe,a7 as Ve,dh as Be,di as Re,a2 as Me,dj as $e,dk as Ge,dl as qe,s as Ne,b1 as ze,dm as We}from"./index-NcZU0lXl.js";import{gi as He,eU as oe,eV as Ye,it as Je,Tr as Ke,fm as Xe,iD as Ze,iz as et,eW as R,ft as tt,g3 as at,fY as st,g0 as ee,g4 as ot,g5 as nt,g6 as it,g7 as rt,g8 as lt}from"./zeni-epic-state-BZ6N8nVI.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-JZY-3hhJ.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-DEWGXdch.js";import{p as pt}from"./pathToGoBack-iJW8VSI1.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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]="f6f82459-1d9e-4e72-98da-d1822acbfba6",e._sentryDebugIdIdentifier="sentry-dbid-f6f82459-1d9e-4e72-98da-d1822acbfba6")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,We(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&ze(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Dt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=X(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=De(d),p=X(i=>Ye(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),q=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,z=r.useRef(!1);r.useEffect(()=>{z.current||N!=="month-end-email"||L==null||n!=null||s==null||(t(Je("controller",s.userId,L,"MONTH_END_EMAIL")),z.current=!0)},[N,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ke()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:W}=Oe(n),D=m.fetchState,F=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Y=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),J=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(J,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Xe({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:W.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[W]);r.useEffect(()=>{D!=="In-Progress"&&F&&t(Ze())},[D,F,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&Y&&s!=null&&D==="Completed"&&!F&&t(et(n,s.userId))},[H,Y,n,s,t]);const K=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad:K}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(R(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(V,{analytics:I,onLoad:K}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(V,{analytics:I,onLoad:i=>i.trackPageLoaded(Fe.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:J,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(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-BUQfB0Zp.js";import{a as v}from"./sentry-BLIwU6uZ.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-OMb8nkC1.js";import{eV as V,PC as A,Pi as h,za as E,z2 as q,z6 as R,yX as K,Pk as J,zc as ae,y_ as X,zf as G,zb as C}from"./zeni-epic-state-BZ6N8nVI.js";import{z as P,a7 as H,bI as oe,af as O,bz as M,bJ as le,m as Q,B as Y,bK as pe,bL as se}from"./index-DLAYU8mN.js";import"./mui-JZY-3hhJ.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js";import re from"./NotFoundScreen-uCKl6Wx4.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]="d79f5ba6-1ced-4e53-9764-9a1466833c91",e._sentryDebugIdIdentifier="sentry-dbid-d79f5ba6-1ced-4e53-9764-9a1466833c91")}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(J(!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=>V(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]),P.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(J(!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=>V(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=M(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=>V(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]),P.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=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(X(!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=>V(t)),{isApprovalRulesV3Enabled:p}=M(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(X(!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-BUQfB0Zp.js";import{a as v}from"./sentry-BLIwU6uZ.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-OMb8nkC1.js";import{eV as V,PC as A,Pi as h,za as E,z2 as q,z6 as R,yX as K,Pk as J,zc as ae,y_ as X,zf as G,zb as C}from"./zeni-epic-state-BZ6N8nVI.js";import{z as P,a7 as H,bI as oe,af as O,bz as M,bJ as le,m as Q,B as Y,bK as pe,bL as se}from"./index-NcZU0lXl.js";import"./mui-JZY-3hhJ.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DTZkQzQY.js";import re from"./NotFoundScreen-CxRYls3k.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]="d79f5ba6-1ced-4e53-9764-9a1466833c91",e._sentryDebugIdIdentifier="sentry-dbid-d79f5ba6-1ced-4e53-9764-9a1466833c91")}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(J(!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=>V(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]),P.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(J(!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=>V(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=M(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=>V(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]),P.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=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(X(!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=>V(t)),{isApprovalRulesV3Enabled:p}=M(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=P.getSignedInUser(),r=Q(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(X(!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-BUQfB0Zp.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as Q,l as na,o as ia,p as S}from"./core-OMb8nkC1.js";import{eV as Z,OU as _e,bs as It,JR as oa,bq as wt,bJ as pe,OV as At,ys as Bt,zH as $e,y$ as la,bn as De,OW as sa,OX as ra,c6 as ca,OY as da,kq as Ct,OZ as xt,O_ as Et,Ag as Ge,yH as Ce,O$ as ua,yg as tt,P0 as pa,Ed as ma,yk as ba,yq as Dt,P1 as ve,P2 as Me,zI as Oe,P3 as ha,P4 as ga,zL as Ne,P5 as ya,zY as Sa,P6 as Pt,zs as at,zx as fa,P7 as va,P8 as ue,P9 as jt,Pa as Tt,Pb as Ft,gm as ka,yM as Le,cA as Rt,Pc as Ia,fv as wa,Pd as Aa,Pe as Ba,fA as Vt,fy as $t,Pf as ze,Pg as Ca,Ph as xa,MD as Ze,Pi as Ea,ME as oe,MF as He,Pj as Da,Pk as Pa,Pl as ja,zz as nt,zw as Ta,Pm as Fa,Pn as Ra,Po as Va,zi as $a,Pp as La,Pq as Ua,Pr as _a,co as Lt,cQ as Ut,kB as Ga,bP as Ma,bo as _t,bQ as Gt,xy as Oa,Ps as Na,E0 as za,E6 as Za,tY as Ha,zJ as Wa,An as qa,kO as fe,Pt as Ja,Pu as Mt,lg as Ka,kI as Ot,l1 as Nt,l0 as it,bE as be,bO as Ya,Pv as Qa,Pw as ke,jl as Xa,Px as ot,Py as en,jp as tn,jK as an,AB as nn,Pz as on,l9 as ln,Ar as sn,PA as lt,Av as rn,AA as cn,Ax as dn,Ap as un,PB as zt,yB as pn,PC as mn,PD as bn,ge as hn,gd as gn,gc as yn,kR as Sn,l7 as st,li as fn,rw as vn,k_ as kn,At as In,jv as wn,ln as An,PE as Bn,jn as Cn,rn as xn,PF as En,zo as Dn,bK as Pn,bt as jn,Lz as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-BZ6N8nVI.js";import{m as me,z as V,j as Ie,_ as We,a as le,F as y,aN as xe,B as re,o as x,E as Pe,d as D,be as Ln,q as z,a2 as qe,s as E,J as we,bf as rt,bg as ct,bh as Un,ak as _n,H as Gn,aH as Mn,A as Zt,D as Je,N as Ke,bi as On,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Yn,bq as Qn,br as Xn,bs as ei,Z as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-DLAYU8mN.js";import{n as U,S as si}from"./mui-JZY-3hhJ.js";import{A as dt}from"./AddressScreen-w3BS5T__.js";import{g as ie,a as je,i as qt,V as Ye,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-CG8HU9uQ.js";import{a as f}from"./sentry-BLIwU6uZ.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-Cw5yceVN.js";import{u as Jt}from"./useInitialThreadRequest-CgLG7-4I.js";import Ee from"./NotFoundScreen-uCKl6Wx4.js";import{D as ui}from"./DrawerScreen-BkOQSI_V.js";import{M as Kt}from"./MobileAppDrawer-BzjU__HS.js";import{F as Yt}from"./FeaturePreviewScreen-DVS7yzIQ.js";import{S as Te}from"./SetupPagesScreen-Df4FCfYh.js";import{B as pi}from"./BillPayApprovalRoutes-D2l3MfyU.js";import{FallBackRoute as mi}from"./ScreenRoutes-C6QOgyjY.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./analyticsHelper-B_k9Kjrd.js";import"./routePaths-CLQbotzs.js";import"./BusinessVerificationPageScreen-BCOKpvnp.js";import"./ReimbursementApprovalRuleDetailScreen-CoaTNR2u.js";import"./getLocaleForTenant-CDmBpg_y.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]="52595b0a-7e44-43a7-9e7b-61eac003b95a",e._sentryDebugIdIdentifier="sentry-dbid-52595b0a-7e44-43a7-9e7b-61eac003b95a")}catch{}})();const bi=Q(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:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=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(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=k(O=>Z(O)),s=k(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=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:J}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(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(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),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=k(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=k(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=k(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const X=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",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"||J.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:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:X}),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(Qt,{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=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.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:O,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:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Qt,{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(ki,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-BUQfB0Zp.js";import{h as K,u as se,g as Y,i as ae,j as k,N as te,n as Q,l as na,o as ia,p as S}from"./core-OMb8nkC1.js";import{eV as Z,OU as _e,bs as It,JR as oa,bq as wt,bJ as pe,OV as At,ys as Bt,zH as $e,y$ as la,bn as De,OW as sa,OX as ra,c6 as ca,OY as da,kq as Ct,OZ as xt,O_ as Et,Ag as Ge,yH as Ce,O$ as ua,yg as tt,P0 as pa,Ed as ma,yk as ba,yq as Dt,P1 as ve,P2 as Me,zI as Oe,P3 as ha,P4 as ga,zL as Ne,P5 as ya,zY as Sa,P6 as Pt,zs as at,zx as fa,P7 as va,P8 as ue,P9 as jt,Pa as Tt,Pb as Ft,gm as ka,yM as Le,cA as Rt,Pc as Ia,fv as wa,Pd as Aa,Pe as Ba,fA as Vt,fy as $t,Pf as ze,Pg as Ca,Ph as xa,MD as Ze,Pi as Ea,ME as oe,MF as He,Pj as Da,Pk as Pa,Pl as ja,zz as nt,zw as Ta,Pm as Fa,Pn as Ra,Po as Va,zi as $a,Pp as La,Pq as Ua,Pr as _a,co as Lt,cQ as Ut,kB as Ga,bP as Ma,bo as _t,bQ as Gt,xy as Oa,Ps as Na,E0 as za,E6 as Za,tY as Ha,zJ as Wa,An as qa,kO as fe,Pt as Ja,Pu as Mt,lg as Ka,kI as Ot,l1 as Nt,l0 as it,bE as be,bO as Ya,Pv as Qa,Pw as ke,jl as Xa,Px as ot,Py as en,jp as tn,jK as an,AB as nn,Pz as on,l9 as ln,Ar as sn,PA as lt,Av as rn,AA as cn,Ax as dn,Ap as un,PB as zt,yB as pn,PC as mn,PD as bn,ge as hn,gd as gn,gc as yn,kR as Sn,l7 as st,li as fn,rw as vn,k_ as kn,At as In,jv as wn,ln as An,PE as Bn,jn as Cn,rn as xn,PF as En,zo as Dn,bK as Pn,bt as jn,Lz as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-BZ6N8nVI.js";import{m as me,z as V,j as Ie,_ as We,a as le,F as y,aN as xe,B as re,o as x,E as Pe,d as D,be as Ln,q as z,a2 as qe,s as E,J as we,bf as rt,bg as ct,bh as Un,ak as _n,H as Gn,aH as Mn,A as Zt,D as Je,N as Ke,bi as On,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Yn,bq as Qn,br as Xn,bs as ei,Z as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-NcZU0lXl.js";import{n as U,S as si}from"./mui-JZY-3hhJ.js";import{A as dt}from"./AddressScreen-Jgfq0eWZ.js";import{g as ie,a as je,i as qt,V as Ye,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-3X6dnm4U.js";import{a as f}from"./sentry-BLIwU6uZ.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DS5Fxq3U.js";import{u as Jt}from"./useInitialThreadRequest-Bh1NrHII.js";import Ee from"./NotFoundScreen-CxRYls3k.js";import{D as ui}from"./DrawerScreen-DcUdH_zJ.js";import{M as Kt}from"./MobileAppDrawer-B4f1me8_.js";import{F as Yt}from"./FeaturePreviewScreen-DgqstYkZ.js";import{S as Te}from"./SetupPagesScreen-CPey4cOW.js";import{B as pi}from"./BillPayApprovalRoutes-DjjjDtRL.js";import{FallBackRoute as mi}from"./ScreenRoutes-D5k4uqAt.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./analyticsHelper-BU5wlVa9.js";import"./routePaths-DZldr9mG.js";import"./BusinessVerificationPageScreen-BiV9G1-i.js";import"./ReimbursementApprovalRuleDetailScreen-DTZkQzQY.js";import"./getLocaleForTenant-Bn16hOPH.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]="52595b0a-7e44-43a7-9e7b-61eac003b95a",e._sentryDebugIdIdentifier="sentry-dbid-52595b0a-7e44-43a7-9e7b-61eac003b95a")}catch{}})();const bi=Q(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:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=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(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Y(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=k(O=>Z(O)),s=k(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Xe({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=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:J}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:X}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,X,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(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(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=Y(),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=k(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=k(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=k(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const X=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(X??"",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"||J.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:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:X}),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(Qt,{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=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.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:O,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:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Qt,{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(ki,{children:`${ye.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as k}from"./liveblocks-BUQfB0Zp.js";import{a as V}from"./sentry-BLIwU6uZ.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-OMb8nkC1.js";import{j as ce,a as ue,aN as de,z as E,E as pe,d as z,af as P,f as x,bE as le,at as me,s as B,au as R}from"./index-DLAYU8mN.js";import{Pq as fe,eV as G,tn as ye,JU as Se,zi as ge,CK as Ie,Fm as he,F$ as be,G$ as Oe,PN as Te,PO as De,PP as ke,PQ as Ce,PR as Ve,Ml as we,OP as Ne,Mw as Ae,l6 as _e,ge as Fe,gd as ve,gc as Pe,rw as xe,rn as Ee,rk as ze,k_ as Be,tw as Re,tu as M,bE as U,tI as j,cy as Me}from"./zeni-epic-state-BZ6N8nVI.js";import{n as Ue}from"./mui-JZY-3hhJ.js";import{d as L}from"./routePaths-CLQbotzs.js";import{M as je}from"./MobileAppDrawer-BzjU__HS.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="00a72f73-38e2-40ee-9e3e-6aa06d675c21",e._sentryDebugIdIdentifier="sentry-dbid-00a72f73-38e2-40ee-9e3e-6aa06d675c21")}catch{}})();const Le=Ue.div`
1
+ import{j as k}from"./liveblocks-BUQfB0Zp.js";import{a as V}from"./sentry-BLIwU6uZ.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-OMb8nkC1.js";import{j as ce,a as ue,aN as de,z as E,E as pe,d as z,af as P,f as x,bE as le,at as me,s as B,au as R}from"./index-NcZU0lXl.js";import{Pq as fe,eV as G,tn as ye,JU as Se,zi as ge,CK as Ie,Fm as he,F$ as be,G$ as Oe,PN as Te,PO as De,PP as ke,PQ as Ce,PR as Ve,Ml as we,OP as Ne,Mw as Ae,l6 as _e,ge as Fe,gd as ve,gc as Pe,rw as xe,rn as Ee,rk as ze,k_ as Be,tw as Re,tu as M,bE as U,tI as j,cy as Me}from"./zeni-epic-state-BZ6N8nVI.js";import{n as Ue}from"./mui-JZY-3hhJ.js";import{d as L}from"./routePaths-DZldr9mG.js";import{M as je}from"./MobileAppDrawer-B4f1me8_.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="00a72f73-38e2-40ee-9e3e-6aa06d675c21",e._sentryDebugIdIdentifier="sentry-dbid-00a72f73-38e2-40ee-9e3e-6aa06d675c21")}catch{}})();const Le=Ue.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-BUQfB0Zp.js";import{a as l}from"./sentry-BLIwU6uZ.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-OMb8nkC1.js";import{V as ge,d9 as be,z as ye,da as Pe,dc as z,dd as Ie,b5 as W,E as we,d as D,de as B,dn as Ee,D as ke,f as Ae,a7 as Te,dh as xe,di as Ue,a2 as _e,dl as Oe,b1 as ve,dm as Qe}from"./index-DLAYU8mN.js";import{gi as Fe,eU as G,eV as De,fm as Ve,iD as $e,iz as Le,eW as H,g3 as je,fY as Re,g0 as N,g4 as qe,g5 as Me,g6 as Be,g7 as He,g8 as Ne}from"./zeni-epic-state-BZ6N8nVI.js";import{D as ze,n as $,P as We,S as Ge}from"./mui-JZY-3hhJ.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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]="b172a50c-53c3-49af-9b82-6d95b5951fc8",e._sentryDebugIdIdentifier="sentry-dbid-b172a50c-53c3-49af-9b82-6d95b5951fc8")}catch{}})();const Y="chat-response-generated",Z="cards/ask",J="card_policy_hero";function V(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Ye=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):V(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?D.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):D.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Be(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(He({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${Z}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=X.pageTitle,Ze=ee.pageTitle,Je=X.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>De(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Ze:A,subtitle:I?Ke:Je}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${Z}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${Y}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o($e())},[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:D,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(H(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Xe,{onClick:r=>r.stopPropagation(),children:g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(H(n.userRoleId)),h(!1)}})})})]})},Xe=$(Ge)`
1
+ import{j as g}from"./liveblocks-BUQfB0Zp.js";import{a as l}from"./sentry-BLIwU6uZ.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-OMb8nkC1.js";import{V as ge,d9 as be,z as ye,da as Pe,dc as z,dd as Ie,b5 as W,E as we,d as D,de as B,dn as Ee,D as ke,f as Ae,a7 as Te,dh as xe,di as Ue,a2 as _e,dl as Oe,b1 as ve,dm as Qe}from"./index-NcZU0lXl.js";import{gi as Fe,eU as G,eV as De,fm as Ve,iD as $e,iz as Le,eW as H,g3 as je,fY as Re,g0 as N,g4 as qe,g5 as Me,g6 as Be,g7 as He,g8 as Ne}from"./zeni-epic-state-BZ6N8nVI.js";import{D as ze,n as $,P as We,S as Ge}from"./mui-JZY-3hhJ.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.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]="b172a50c-53c3-49af-9b82-6d95b5951fc8",e._sentryDebugIdIdentifier="sentry-dbid-b172a50c-53c3-49af-9b82-6d95b5951fc8")}catch{}})();const Y="chat-response-generated",Z="cards/ask",J="card_policy_hero";function V(e){return`/${e}/cards`}function K(e){return`/${e}/cards/policy`}const Ye=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===J?K(i):V(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?D.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):D.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Be(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(He({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${Z}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:X,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=X.pageTitle,Ze=ee.pageTitle,Je=X.chatHeaderSubtitle,Ke=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>De(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===J,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Ze:A,subtitle:I?Ke:Je}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${Z}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${Y}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o($e())},[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:D,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ye,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?K(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(H(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Xe,{onClick:r=>r.stopPropagation(),children:g.jsx(B,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(H(n.userRoleId)),h(!1)}})})})]})},Xe=$(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-BUQfB0Zp.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-OMb8nkC1.js";import{bt as Pe,Rp as as,Rq as ts,eX as un,Rr as kn,f4 as En,Rs as An,Rt as Dn,Ru as _n,Rv as Pn,f5 as wn,f6 as vn,Rw as Tn,fg as Fn,fh as $a,Rx as xn,Ry as ns,fa as rs,f9 as ss,Rz as cs,BO as Rn,fj as ca,RA as os,RB as is,eZ as ds,eY as ls,fv as ze,fc as Bn,fb as Ln,RC as us,fd as ms,Bj as Cs,Bi as ps,Bm as hs,Bo as fs,fo as gs,eU as On,RD as bs,RE as Ss,ft as Un,RF as ys,fu as St,Bu as Is,Br as ks,eV as fe,RG as Ja,fy as we,fz as ve,fA as Te,gt as oa,cv as ia,RH as da,RI as _t,uB as za,ky as Za,RJ as Ya,C2 as ka,C4 as Je,C5 as Pt,ko as jn,RK as la,BS as _a,RL as Es,RM as As,BV as Qa,RN as Ds,PK as Xa,ff as Mn,B$ as ga,hO as _s,RO as Nn,RP as ua,bo as Ps,RQ as ws,ge as et,gd as at,Cz as vs,gc as tt,Pq as Ts,RR as Vn,co as Hn,cQ as Fs,PJ as wa,D8 as Gn,RS as mn,CK as Pa,RT as $n,D9 as xs,Q9 as Rs,Da as Bs,E6 as Ls,tY as Os,E0 as Us,RU as js,C3 as ra,RV as Ms,RW as Ns,RX as Vs,RY as Hs,RZ as Gs,R_ as wt,R$ as $s,Ck as zn,Cd as zs,S0 as Zs,gv as Ys,Ct as Zn,Cx as Yn,gu as Ws,S1 as Ks,CW as Wn,S2 as qs,S3 as Js,S4 as Qs,Cv as Kn,Cg as qn,BY as Jn,Cp as Qn,Cn as Xn,Cr as Xs,S5 as er,S6 as ec,fq as ac,fr as tc,fs as nc,S7 as nt,fk as ar,cR as vt,S8 as rc,S9 as sc,Sa as cc,Sb as oc,CF as yt,D1 as ic,CZ as dc,CB as lc,C$ as uc,CR as mc,CT as Cc,Sc as tr,D7 as Ga,JR as pc,Sd as hc,Se as fc,Sf as gc,Sg as nr,Sh as bc,Du as Sc,CJ as rr,CE as je,CI as yc,Si as Ic,Sj as kc,BP as Ec,Sk as sr,fe as cr,Sl as Ac,BR as Dc,BQ as Cn,Sm as _c,Sn as Pc,So as wc,Mm as vc,Sp as Tt,Sq as Tc,xB as or,l6 as Fc,hE as xc,Dz as Rc,Sr as ir,f1 as Bc,f2 as Lc,Ss as Oc,dh as Uc,fi as jc,Dp as Mc,Dj as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,Lz as $c}from"./zeni-epic-state-BZ6N8nVI.js";import{j as Fe,cm as dr,q as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Yc,V as mr,c as Cr,X as pr,s as ye,a as le,F as W,aq as ya,cs as hr,ct as Wc,cu as Kc,z as re,B as va,cb as rt,cv as qc,cw as Jc,cx as Qc,cy as Xc,cz as eo,J as Ta,aN as Ze,bo as xt,cA as ao,A as Fa,k as st,m as Rt,d as Q,a7 as ct,cB as to,bB as ba,cC as It,cD as no,E as Bt,cE as ro,at as fr,a2 as kt,cF as so,W as gr,f as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Wa,cM as Co,cN as po,cO as pt,Z as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-DLAYU8mN.js";import{n as Ne,D as Sr,S as ko}from"./mui-JZY-3hhJ.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Cw5yceVN.js";import{M as Ie}from"./MobileAppDrawer-BzjU__HS.js";import{d as Lt}from"./recharts-DAM4r1-u.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Qe,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-Df4FCfYh.js";import{u as Ar}from"./useInitialThreadRequest-CgLG7-4I.js";import ot from"./NotFoundScreen-uCKl6Wx4.js";import{n as hn}from"./utils-Bia5qc4p.js";import{t as Po}from"./AddressScreen-w3BS5T__.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./analyticsHelper-B_k9Kjrd.js";import"./routePaths-CLQbotzs.js";import"./BusinessVerificationPageScreen-BCOKpvnp.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]="3369e947-ff58-4869-9f3f-d528b4bfbdac",e._sentryDebugIdIdentifier="sentry-dbid-3369e947-ff58-4869-9f3f-d528b4bfbdac")}catch{}})();const wo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),J=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:Y,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:J,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),Y=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),J=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const R=X.current;X.current=Y,Y==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Yc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:J})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=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 No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:Y,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:J}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=T&&R&&J!=null&&!X,oe=r.useCallback(ce=>{if(J==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${J}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,J]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),We=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:We,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,We,te,Ee,Ye,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(K=>Ja(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(W.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(W.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),l=!B&&u&&d,p=o(K=>_t(K,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(K=>Z!=null?Za(K.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(K=>x!=null?za(K.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Za(K.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",J=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Ya()),J&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,J]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Je()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Qe(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Jc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Qc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(W.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),Y=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Ko,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Ko=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=Ne.div`
1
+ import{j as c}from"./liveblocks-BUQfB0Zp.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-OMb8nkC1.js";import{bt as Pe,Rp as as,Rq as ts,eX as un,Rr as kn,f4 as En,Rs as An,Rt as Dn,Ru as _n,Rv as Pn,f5 as wn,f6 as vn,Rw as Tn,fg as Fn,fh as $a,Rx as xn,Ry as ns,fa as rs,f9 as ss,Rz as cs,BO as Rn,fj as ca,RA as os,RB as is,eZ as ds,eY as ls,fv as ze,fc as Bn,fb as Ln,RC as us,fd as ms,Bj as Cs,Bi as ps,Bm as hs,Bo as fs,fo as gs,eU as On,RD as bs,RE as Ss,ft as Un,RF as ys,fu as St,Bu as Is,Br as ks,eV as fe,RG as Ja,fy as we,fz as ve,fA as Te,gt as oa,cv as ia,RH as da,RI as _t,uB as za,ky as Za,RJ as Ya,C2 as ka,C4 as Je,C5 as Pt,ko as jn,RK as la,BS as _a,RL as Es,RM as As,BV as Qa,RN as Ds,PK as Xa,ff as Mn,B$ as ga,hO as _s,RO as Nn,RP as ua,bo as Ps,RQ as ws,ge as et,gd as at,Cz as vs,gc as tt,Pq as Ts,RR as Vn,co as Hn,cQ as Fs,PJ as wa,D8 as Gn,RS as mn,CK as Pa,RT as $n,D9 as xs,Q9 as Rs,Da as Bs,E6 as Ls,tY as Os,E0 as Us,RU as js,C3 as ra,RV as Ms,RW as Ns,RX as Vs,RY as Hs,RZ as Gs,R_ as wt,R$ as $s,Ck as zn,Cd as zs,S0 as Zs,gv as Ys,Ct as Zn,Cx as Yn,gu as Ws,S1 as Ks,CW as Wn,S2 as qs,S3 as Js,S4 as Qs,Cv as Kn,Cg as qn,BY as Jn,Cp as Qn,Cn as Xn,Cr as Xs,S5 as er,S6 as ec,fq as ac,fr as tc,fs as nc,S7 as nt,fk as ar,cR as vt,S8 as rc,S9 as sc,Sa as cc,Sb as oc,CF as yt,D1 as ic,CZ as dc,CB as lc,C$ as uc,CR as mc,CT as Cc,Sc as tr,D7 as Ga,JR as pc,Sd as hc,Se as fc,Sf as gc,Sg as nr,Sh as bc,Du as Sc,CJ as rr,CE as je,CI as yc,Si as Ic,Sj as kc,BP as Ec,Sk as sr,fe as cr,Sl as Ac,BR as Dc,BQ as Cn,Sm as _c,Sn as Pc,So as wc,Mm as vc,Sp as Tt,Sq as Tc,xB as or,l6 as Fc,hE as xc,Dz as Rc,Sr as ir,f1 as Bc,f2 as Lc,Ss as Oc,dh as Uc,fi as jc,Dp as Mc,Dj as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,Lz as $c}from"./zeni-epic-state-BZ6N8nVI.js";import{j as Fe,cm as dr,q as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Yc,V as mr,c as Cr,X as pr,s as ye,a as le,F as W,aq as ya,cs as hr,ct as Wc,cu as Kc,z as re,B as va,cb as rt,cv as qc,cw as Jc,cx as Qc,cy as Xc,cz as eo,J as Ta,aN as Ze,bo as xt,cA as ao,A as Fa,k as st,m as Rt,d as Q,a7 as ct,cB as to,bB as ba,cC as It,cD as no,E as Bt,cE as ro,at as fr,a2 as kt,cF as so,W as gr,f as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Wa,cM as Co,cN as po,cO as pt,Z as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-NcZU0lXl.js";import{n as Ne,D as Sr,S as ko}from"./mui-JZY-3hhJ.js";import{a as r}from"./sentry-BLIwU6uZ.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-DS5Fxq3U.js";import{M as Ie}from"./MobileAppDrawer-B4f1me8_.js";import{d as Lt}from"./recharts-DAM4r1-u.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Qe,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-CPey4cOW.js";import{u as Ar}from"./useInitialThreadRequest-Bh1NrHII.js";import ot from"./NotFoundScreen-CxRYls3k.js";import{n as hn}from"./utils-Bia5qc4p.js";import{t as Po}from"./AddressScreen-Jgfq0eWZ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./analyticsHelper-BU5wlVa9.js";import"./routePaths-DZldr9mG.js";import"./BusinessVerificationPageScreen-BiV9G1-i.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]="3369e947-ff58-4869-9f3f-d528b4bfbdac",e._sentryDebugIdIdentifier="sentry-dbid-3369e947-ff58-4869-9f3f-d528b4bfbdac")}catch{}})();const wo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),J=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:Y,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:J,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),Y=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),J=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const R=X.current;X.current=Y,Y==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Yc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:J})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=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 No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:Y,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:J}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=T&&R&&J!=null&&!X,oe=r.useCallback(ce=>{if(J==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${J}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,J]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),We=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:We,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,We,te,Ee,Ye,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(K=>Ja(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(W.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(W.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),l=!B&&u&&d,p=o(K=>_t(K,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(K=>Z!=null?Za(K.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(K=>x!=null?za(K.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Za(K.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",J=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Ya()),J&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,J]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Je()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Qe(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Jc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Qc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(W.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(W.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(W.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Qa()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),Y=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(Y,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Ko,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Ko=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=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-BUQfB0Zp.js";import{a as g}from"./sentry-BLIwU6uZ.js";import{h as w,u as k,g as x,i as T,j as O,n as E}from"./core-OMb8nkC1.js";import{z as N,b9 as P,E as F,d as V,f as j,af as C,ba as A,at as L,au as M,s as U}from"./index-DLAYU8mN.js";import{eV as b,gg as _,tn as B,gb as z,c6 as R,OP as G,bn as Y,rw as H,rk as J,k_ as Q,mz as S,OQ as Z,bE as $,cy as D,mJ as q,mM as K}from"./zeni-epic-state-BZ6N8nVI.js";import"./mui-JZY-3hhJ.js";import{d as W}from"./routePaths-CLQbotzs.js";import{M as X}from"./MobileAppDrawer-BzjU__HS.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]="dd6096a0-e876-4396-8fc7-6c001e0d9c45",t._sentryDebugIdIdentifier="sentry-dbid-dd6096a0-e876-4396-8fc7-6c001e0d9c45")}catch{}})();const ee=E(function(t){const a=z(t),i=N.getSignedInUser(),p=b(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=W(f,e),o=U(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?D(u):void 0,meetingLink:y!=""&&y!=null?D(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:M(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears: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(Z(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(J(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>b(s)),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!0),a(_(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(B())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.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-BUQfB0Zp.js";import{a as g}from"./sentry-BLIwU6uZ.js";import{h as w,u as k,g as x,i as T,j as O,n as E}from"./core-OMb8nkC1.js";import{z as N,b9 as P,E as F,d as V,f as j,af as C,ba as A,at as L,au as M,s as U}from"./index-NcZU0lXl.js";import{eV as b,gg as _,tn as B,gb as z,c6 as R,OP as G,bn as Y,rw as H,rk as J,k_ as Q,mz as S,OQ as Z,bE as $,cy as D,mJ as q,mM as K}from"./zeni-epic-state-BZ6N8nVI.js";import"./mui-JZY-3hhJ.js";import{d as W}from"./routePaths-DZldr9mG.js";import{M as X}from"./MobileAppDrawer-B4f1me8_.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]="dd6096a0-e876-4396-8fc7-6c001e0d9c45",t._sentryDebugIdIdentifier="sentry-dbid-dd6096a0-e876-4396-8fc7-6c001e0d9c45")}catch{}})();const ee=E(function(t){const a=z(t),i=N.getSignedInUser(),p=b(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=W(f,e),o=U(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(q({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?D(u):void 0,meetingLink:y!=""&&y!=null?D(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:M(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears: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(Z(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(J(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>b(s)),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!0),a(_(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(B())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-BUQfB0Zp.js";import{a}from"./sentry-BLIwU6uZ.js";import{u as D,g as v,j as c,N as w}from"./core-OMb8nkC1.js";import{Lv as _,eV as A,f_ as L,o3 as O,gp as E,fZ as j,fw as U,LC as F}from"./zeni-epic-state-BZ6N8nVI.js";import{u as $,z as m,L as g,D as k,o as H}from"./index-DLAYU8mN.js";import{n as z}from"./mui-JZY-3hhJ.js";import{t as R}from"./getLocaleForTenant-CDmBpg_y.js";import{g as P,Q as V}from"./QBOConnectionScreen-BEi0Zm8x.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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]="2e73a0a3-c89e-4fb0-b4ba-bfed508bc9cb",t._sentryDebugIdIdentifier="sentry-dbid-2e73a0a3-c89e-4fb0-b4ba-bfed508bc9cb")}catch{}})();const G=z.div`
1
+ import{j as C}from"./liveblocks-BUQfB0Zp.js";import{a}from"./sentry-BLIwU6uZ.js";import{u as D,g as v,j as c,N as w}from"./core-OMb8nkC1.js";import{Lv as _,eV as A,f_ as L,o3 as O,gp as E,fZ as j,fw as U,LC as F}from"./zeni-epic-state-BZ6N8nVI.js";import{u as $,z as m,L as g,D as k,o as H}from"./index-NcZU0lXl.js";import{n as z}from"./mui-JZY-3hhJ.js";import{t as R}from"./getLocaleForTenant-Bn16hOPH.js";import{g as P,Q as V}from"./QBOConnectionScreen-CSgGZuyl.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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]="2e73a0a3-c89e-4fb0-b4ba-bfed508bc9cb",t._sentryDebugIdIdentifier="sentry-dbid-2e73a0a3-c89e-4fb0-b4ba-bfed508bc9cb")}catch{}})();const G=z.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -1 +1 @@
1
- import{j as i}from"./liveblocks-BUQfB0Zp.js";import{z as n}from"./index-DLAYU8mN.js";import{g as d}from"./QBOConnectionScreen-BEi0Zm8x.js";import"./sentry-BLIwU6uZ.js";import{g as p,N as s}from"./core-OMb8nkC1.js";import"./zeni-epic-state-BZ6N8nVI.js";import"./recharts-DAM4r1-u.js";import"./mui-JZY-3hhJ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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-BUQfB0Zp.js";import{z as n}from"./index-NcZU0lXl.js";import{g as d}from"./QBOConnectionScreen-CSgGZuyl.js";import"./sentry-BLIwU6uZ.js";import{g as p,N as s}from"./core-OMb8nkC1.js";import"./zeni-epic-state-BZ6N8nVI.js";import"./recharts-DAM4r1-u.js";import"./mui-JZY-3hhJ.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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 a}from"./liveblocks-BUQfB0Zp.js";import{t as Me,A as Ce}from"./AddressScreen-w3BS5T__.js";import $e from"./NotFoundScreen-uCKl6Wx4.js";import{a as g}from"./sentry-BLIwU6uZ.js";import{h as oe,g as se,u as ie,i as re,j as D,N as E,n as ce,l as ze,o as qe,p as z}from"./core-OMb8nkC1.js";import{Z as de,j as le,z as B,a as ue,m as Qe,F as _,s as V,E as H,d as N,B as ve,f as X,ap as Ke,J as Ze,aq as ke,k as te,ar as Je,as as Ie,o as He,at as We,au as Ee,av as Xe}from"./index-DLAYU8mN.js";import{bn as Ye,eV as ee,fS as et,fA as pe,fy as me,bs as tt,o1 as at,fO as nt,bS as ot,k2 as ae,k5 as je,L$ as st,bY as it,c6 as ge,tB as he,tm as rt,Mu as Y,tC as _e,JU as ct,l6 as Ue,Mv as Ve,Mw as dt,Mx as lt,My as ut,k0 as pt,k3 as mt,to as Be,tA as gt,bE as xe,cy as ht,tO as Te,rw as ft,rk as yt,k_ as St,ge as bt,gd as Ct,gc as kt,Mz as It,tg as Et,tP as xt,tS as Tt,tV as Ot,t$ as Pt,cX as At}from"./zeni-epic-state-BZ6N8nVI.js";import{n as fe}from"./mui-JZY-3hhJ.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-BEi0Zm8x.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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]="8a9da76d-41ea-4f4f-bcb6-ce838452552c",t._sentryDebugIdIdentifier="sentry-dbid-8a9da76d-41ea-4f4f-bcb6-ce838452552c")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),vt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),h=Ye(i),{useFeatureGate:m}=ue(),I=Qe(),{isFeatureEnabled:x}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:k}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:f}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),M=C||U&&h,c=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const v=pe(F,c),P=me(c),A=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=b?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&A.push("top_expenses"),$===!1&&A.push("task_card"),j===!1&&A.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&A.push("reimbursement_card","reimbursement_promo_card"),k===!1&&A.push("zeni_accounts_promo_card"),f===!1&&A.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,A)))},[d,O,v,P,i,c.tenantId,s]),g.useEffect(()=>{(v||P)&&setTimeout(()=>{S(!0)},5e3)},[v,P]),O!=="Completed")return a.jsx(E,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(v)return a.jsx(E,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(H,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(X.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard:f,isExpenseAutomationEnabledForUser:M,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(ve,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Oe=fe.div`
1
+ import{j as a}from"./liveblocks-BUQfB0Zp.js";import{t as Me,A as Ce}from"./AddressScreen-Jgfq0eWZ.js";import $e from"./NotFoundScreen-CxRYls3k.js";import{a as g}from"./sentry-BLIwU6uZ.js";import{h as oe,g as se,u as ie,i as re,j as D,N as E,n as ce,l as ze,o as qe,p as z}from"./core-OMb8nkC1.js";import{Z as de,j as le,z as B,a as ue,m as Qe,F as _,s as V,E as H,d as N,B as ve,f as X,ap as Ke,J as Ze,aq as ke,k as te,ar as Je,as as Ie,o as He,at as We,au as Ee,av as Xe}from"./index-NcZU0lXl.js";import{bn as Ye,eV as ee,fS as et,fA as pe,fy as me,bs as tt,o1 as at,fO as nt,bS as ot,k2 as ae,k5 as je,L$ as st,bY as it,c6 as ge,tB as he,tm as rt,Mu as Y,tC as _e,JU as ct,l6 as Ue,Mv as Ve,Mw as dt,Mx as lt,My as ut,k0 as pt,k3 as mt,to as Be,tA as gt,bE as xe,cy as ht,tO as Te,rw as ft,rk as yt,k_ as St,ge as bt,gd as Ct,gc as kt,Mz as It,tg as Et,tP as xt,tS as Tt,tV as Ot,t$ as Pt,cX as At}from"./zeni-epic-state-BZ6N8nVI.js";import{n as fe}from"./mui-JZY-3hhJ.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-CSgGZuyl.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./empty-BACf_dXg.js";import"./pdf-lib-CtBKoWQc.js";import"./index-CPre97x9.js";import"./url-BMb7_G4N.js";import"./index-BQIzm-tN.js";import"./decodeURIComponentSafe-CrZYJ6cg.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]="8a9da76d-41ea-4f4f-bcb6-ce838452552c",t._sentryDebugIdIdentifier="sentry-dbid-8a9da76d-41ea-4f4f-bcb6-ce838452552c")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),vt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),h=Ye(i),{useFeatureGate:m}=ue(),I=Qe(),{isFeatureEnabled:x}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:k}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:f}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),M=C||U&&h,c=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const v=pe(F,c),P=me(c),A=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=b?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&A.push("top_expenses"),$===!1&&A.push("task_card"),j===!1&&A.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&A.push("reimbursement_card","reimbursement_promo_card"),k===!1&&A.push("zeni_accounts_promo_card"),f===!1&&A.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,A)))},[d,O,v,P,i,c.tenantId,s]),g.useEffect(()=>{(v||P)&&setTimeout(()=>{S(!0)},5e3)},[v,P]),O!=="Completed")return a.jsx(E,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(v)return a.jsx(E,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(H,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(X.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard:f,isExpenseAutomationEnabledForUser:M,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(ve,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Oe=fe.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-BUQfB0Zp.js";import{i as K,j as S,g as H,u as z,h as W,n as te,k as ca,o as Ct,p as w}from"./core-OMb8nkC1.js";import{eV as U,MP as Xe,bE as la,bo as Oe,O1 as Pn,iU as Fn,O2 as Zt,O3 as Rn,iX as kt,O4 as Qe,O5 as Bn,j0 as jn,O6 as Qt,O7 as Mn,j4 as St,O8 as He,O9 as Ln,co as vt,Oa as Un,Ob as Gn,N7 as Vn,jY as Yn,Oc as Nn,bn as Ge,Od as da,MD as ie,bc as ua,ka as ma,ob as pa,jV as ha,MF as ce,ME as ee,eU as fa,fo as $n,g0 as _t,Oe as zn,Of as Kn,Og as ga,Oh as Be,vA as Ve,vB as Ye,vY as De,vS as le,vF as Ne,Oi as qn,Oj as Zn,Ok as Qn,Ol as ba,Om as je,On as Hn,dI as Je,s4 as Ca,Oo as Wn,Op as Xn,Oq as Jn,Or as At,M1 as It,kq as xe,w4 as Et,sc as eo,Os as to,vC as Ht,s7 as Ee,s3 as ka,Ot as ge,Ou as ao,Ov as Tt,M0 as Ot,u3 as Sa,Ow as no,Ox as oo,Oy as so,Oz as Dt,ug as ro,OA as io,vE as Wt,u2 as _a,OB as be,OC as co,bs as ya,w8 as va,OD as lo,OE as uo,OF as mo,OG as xt,w3 as po,OH as ho,vD as Xt,w7 as Aa,OI as Ce,OJ as fo,OK as go,OL as Ia,kf as Ea,o8 as Ta,kk as Oa,o6 as Da,o5 as xa,o4 as wa,tr as bo,fS as Co,cR as ko,cS as So,o1 as _o,fO as yo,oi as vo,Gd as ut,G5 as Ao,G9 as Io,OM as Eo,ON as To,OO as Oo,b5 as et,fG as Do,hC as xo,gg as wo,oc as Po,jO as Fo,o9 as Ro,o7 as Bo,fA as jo,fy as Mo}from"./zeni-epic-state-BZ6N8nVI.js";import{z as M,a2 as ae,s as D,d as O,D as q,aV as Lo,_ as $e,E as ze,aW as Pa,f as N,aX as Uo,j as Se,aY as Fa,a as _e,F as R,m as Go,aZ as Vo,a_ as Yo,V as Ra,J as Ba,c as ja,X as No,a$ as $o,T as zo,aN as Ma,$ as oe,b0 as La,b1 as Ua,a1 as Ga,b2 as Ko,b3 as qo,aq as Zo,q as Qo,W as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-DLAYU8mN.js";import{n as wt}from"./mui-JZY-3hhJ.js";import{a as b}from"./sentry-BLIwU6uZ.js";import{w as Va}from"./withTransactionSidePanel-Dtr8LlVa.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-CLQbotzs.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-Cw5yceVN.js";import Ue from"./NotFoundScreen-uCKl6Wx4.js";import{u as Ft}from"./useInitialThreadRequest-CgLG7-4I.js";import{t as Na}from"./analyticsHelper-B_k9Kjrd.js";import{C as as}from"./CompanyPassportScreen-CLNMvqEv.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-Dtkjagus.js";import{F as os}from"./FeaturePreviewScreen-DVS7yzIQ.js";import{R as ss}from"./ReferralListScreen-DUY0_-v6.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./TransactionDetailScreen-CSArdLSZ.js";import"./decodeURIComponentSafe-CrZYJ6cg.js";import"./MobileAppDrawer-BzjU__HS.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]="a64390ca-a366-4343-9376-fb30cb1b724a",e._sentryDebugIdIdentifier="sentry-dbid-a64390ca-a366-4343-9376-fb30cb1b724a")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>U(v)),{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:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):Oe(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Ya({id:v.transactionId,type:v.transactionType},m);f(B);const X=D(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:O,onTransactionClick:L,onReload:I,onBackClick:_,onColumnSortConfigChanged:T,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=S(T=>Rn(T)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AP Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(T=>T.tenantState.currentTenantId),i=S(T=>U(T)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),C=t.apAgingUIState.selectedDate??Oe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:T=>T.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:O,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>U(k)),{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:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),l=b.useMemo(()=>r!=null?la(r):Oe(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Ya({id:k.transactionId,type:k.transactionType},c);p(v);const B=D(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&O.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>U(_)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),g=t.arAgingUIState.selectedDate??Oe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:O,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=we(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Yn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?O.trackZeniAccountsCashBalancePromoClicked("Move Money"):(O.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else O.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Un(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:O}},za)(Fa),us=te(function(e){const a=Nn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ge(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:O}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):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=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
1
+ import{j as d}from"./liveblocks-BUQfB0Zp.js";import{i as K,j as S,g as H,u as z,h as W,n as te,k as ca,o as Ct,p as w}from"./core-OMb8nkC1.js";import{eV as U,MP as Xe,bE as la,bo as Oe,O1 as Pn,iU as Fn,O2 as Zt,O3 as Rn,iX as kt,O4 as Qe,O5 as Bn,j0 as jn,O6 as Qt,O7 as Mn,j4 as St,O8 as He,O9 as Ln,co as vt,Oa as Un,Ob as Gn,N7 as Vn,jY as Yn,Oc as Nn,bn as Ge,Od as da,MD as ie,bc as ua,ka as ma,ob as pa,jV as ha,MF as ce,ME as ee,eU as fa,fo as $n,g0 as _t,Oe as zn,Of as Kn,Og as ga,Oh as Be,vA as Ve,vB as Ye,vY as De,vS as le,vF as Ne,Oi as qn,Oj as Zn,Ok as Qn,Ol as ba,Om as je,On as Hn,dI as Je,s4 as Ca,Oo as Wn,Op as Xn,Oq as Jn,Or as At,M1 as It,kq as xe,w4 as Et,sc as eo,Os as to,vC as Ht,s7 as Ee,s3 as ka,Ot as ge,Ou as ao,Ov as Tt,M0 as Ot,u3 as Sa,Ow as no,Ox as oo,Oy as so,Oz as Dt,ug as ro,OA as io,vE as Wt,u2 as _a,OB as be,OC as co,bs as ya,w8 as va,OD as lo,OE as uo,OF as mo,OG as xt,w3 as po,OH as ho,vD as Xt,w7 as Aa,OI as Ce,OJ as fo,OK as go,OL as Ia,kf as Ea,o8 as Ta,kk as Oa,o6 as Da,o5 as xa,o4 as wa,tr as bo,fS as Co,cR as ko,cS as So,o1 as _o,fO as yo,oi as vo,Gd as ut,G5 as Ao,G9 as Io,OM as Eo,ON as To,OO as Oo,b5 as et,fG as Do,hC as xo,gg as wo,oc as Po,jO as Fo,o9 as Ro,o7 as Bo,fA as jo,fy as Mo}from"./zeni-epic-state-BZ6N8nVI.js";import{z as M,a2 as ae,s as D,d as O,D as q,aV as Lo,_ as $e,E as ze,aW as Pa,f as N,aX as Uo,j as Se,aY as Fa,a as _e,F as R,m as Go,aZ as Vo,a_ as Yo,V as Ra,J as Ba,c as ja,X as No,a$ as $o,T as zo,aN as Ma,$ as oe,b0 as La,b1 as Ua,a1 as Ga,b2 as Ko,b3 as qo,aq as Zo,q as Qo,W as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-NcZU0lXl.js";import{n as wt}from"./mui-JZY-3hhJ.js";import{a as b}from"./sentry-BLIwU6uZ.js";import{w as Va}from"./withTransactionSidePanel-DxHfrYsZ.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-DZldr9mG.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-DS5Fxq3U.js";import Ue from"./NotFoundScreen-CxRYls3k.js";import{u as Ft}from"./useInitialThreadRequest-Bh1NrHII.js";import{t as Na}from"./analyticsHelper-BU5wlVa9.js";import{C as as}from"./CompanyPassportScreen-CE4f1mRO.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-DEWGXdch.js";import{F as os}from"./FeaturePreviewScreen-DgqstYkZ.js";import{R as ss}from"./ReferralListScreen-CbCeYBu8.js";import"./recharts-DAM4r1-u.js";import"./analytics-BLbM2ksu.js";import"./plaid-B_OuebQv.js";import"./dnd-DVcQZAG5.js";import"./stripe-DMRn4zHo.js";import"./lottie-DDI83OWz.js";import"./lexical-CNfNgAkp.js";import"./pdf-6FZlivdz.js";import"./utils-Bia5qc4p.js";import"./TransactionDetailScreen-CoGsdLTa.js";import"./decodeURIComponentSafe-CrZYJ6cg.js";import"./MobileAppDrawer-B4f1me8_.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]="a64390ca-a366-4343-9376-fb30cb1b724a",e._sentryDebugIdIdentifier="sentry-dbid-a64390ca-a366-4343-9376-fb30cb1b724a")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>U(v)),{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:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):Oe(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Ya({id:v.transactionId,type:v.transactionType},m);f(B);const X=D(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:O,onTransactionClick:L,onReload:I,onBackClick:_,onColumnSortConfigChanged:T,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=S(T=>Rn(T)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AP Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(T=>T.tenantState.currentTenantId),i=S(T=>U(T)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),C=t.apAgingUIState.selectedDate??Oe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:T=>T.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:O,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>U(k)),{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:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),l=b.useMemo(()=>r!=null?la(r):Oe(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Ya({id:k.transactionId,type:k.transactionType},c);p(v);const B=D(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&O.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>U(_)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),g=t.arAgingUIState.selectedDate??Oe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:O,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=we(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Yn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?O.trackZeniAccountsCashBalancePromoClicked("Move Money"):(O.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else O.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Un(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:O}},za)(Fa),us=te(function(e){const a=Nn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ge(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:O}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):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=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;