@zeniai/web-app-ui 5.1.48-dev → 5.1.48-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-Cfx49so1.js → AddressRoutes-zp_f5BIT.js} +1 -1
  2. package/dist/assets/{AddressScreen-BdkkfpOD.js → AddressScreen-CnWN_Byu.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-CJ2jNf-v.js → AiCfoScreen-BLL_nNLI.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-C9K9cwdL.js → BillPayApprovalRoutes-fwQ-KbdW.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-DI9tqZg4.js → BillPayRoutes-CXPLgeMx.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-BvxrLE03.js → BusinessVerificationPageScreen-CQCM86dl.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen-7dPiCcoy.js → CardsAiCfoScreen-B1gDFQIg.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-BIha80p-.js → ChargeCardRoutes-r0QCF0_O.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-CuQ-1lmT.js → CompanyPassportScreen-C21kd0sW.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-CZ8o3YZi.js → ConnectionAuthScreen-Dy-zRzti.js} +1 -1
  11. package/dist/assets/{CustomerOnboardingAuthScreen-BnNax-8a.js → CustomerOnboardingAuthScreen-DZRY0rMp.js} +1 -1
  12. package/dist/assets/{CustomerOnboardingRoutes-BgHk9KVG.js → CustomerOnboardingRoutes-BYPXAjQ4.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-BRz85PCY.js → DashboardRoutes-HvDL4JQ9.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-BcFCHmoG.js → DefaultTenantHome-BgvzypN4.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-BgEqXJEl.js → DomesticWireDetailScreen-B4-ngaAr.js} +1 -1
  16. package/dist/assets/{DrawerScreen-_1RQlY4y.js → DrawerScreen-CCOxeY1b.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-C7uFwXUz.js → EntityDetailRoutes-DmdWYlHp.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-C-CBTBm8.js → ExpenseAutomationRoutes-BCAAiII0.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-CeZNu_Vi.js → FeaturePreviewScreen-DJsA6G2u.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-C0pKe0vy.js → HubSpotOAuthCallbackScreen-gYH68XtL.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-7XFxi-_N.js → MagicLinkRoutes-DPMWh3Wi.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-CGIo0N71.js → MagicLinkSignInScreen-BHjwFaIK.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-D6Fu3M_x.js → MobileAppDrawer-Co1JEy80.js} +1 -1
  24. package/dist/assets/{NotFoundScreen-_JeeXwwE.js → NotFoundScreen-BzCRT55X.js} +1 -1
  25. package/dist/assets/{NotificationRoutes-DN56rmti.js → NotificationRoutes-Bg32ZXm1.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-DCckgFNN.js → OAuthConsentScreen-CguAVsyN.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-DQXcPbfr.js → PandLWithForecastRoutes-D4CBd4Zm.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-CVdNkMW2.js → PeopleRoutes-BB-x72kE.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-BFxcHJn-.js → PerformanceRoutes-B2gf_KmS.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-CL_uJ9x0.js → QBOConnectionScreen-BQDAvDNh.js} +1 -1
  31. package/dist/assets/{ReferralListScreen-Cb-o7kTE.js → ReferralListScreen-dGvD_TyP.js} +1 -1
  32. package/dist/assets/{ReimbursementApprovalRoutes-BV3UuxT_.js → ReimbursementApprovalRoutes-B_LzfI5s.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DGivgXWQ.js → ReimbursementApprovalRuleDetailScreen-DTKjwmY6.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-CqFV9Upl.js → ReimbursementRoutes-BLhdkUwt.js} +1 -1
  35. package/dist/assets/{ReportsRoutes-iiURxm9r.js → ReportsRoutes-4lWPPfqg.js} +1 -1
  36. package/dist/assets/{RewardsRoutes-6b8h1meH.js → RewardsRoutes-3GOO5hHW.js} +1 -1
  37. package/dist/assets/{ScreenRoutes-BVYp-4m8.js → ScreenRoutes-Q9t_VXud.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-DOfAWDHL.js → SettingsRoutes-DcAtX4HB.js} +1 -1
  39. package/dist/assets/{SetupPagesScreen-Djxd17id.js → SetupPagesScreen-CYV12QsA.js} +1 -1
  40. package/dist/assets/{SignInScreen-D7gytnqh.js → SignInScreen-CCIcAet0.js} +1 -1
  41. package/dist/assets/{SignOutScreen-C-j9YPM-.js → SignOutScreen-DzR-6ySq.js} +1 -1
  42. package/dist/assets/{TaskListScreen-Dreq2LHj.js → TaskListScreen-DhuFLEvi.js} +1 -1
  43. package/dist/assets/{TaskRoutes-Dy3OoIyM.js → TaskRoutes-BePPWsqJ.js} +1 -1
  44. package/dist/assets/{TransactionDetailRoutes-Bs9ghT0l.js → TransactionDetailRoutes-Cw9T-pK7.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-s_jEo2WG.js → TransactionDetailScreen-Bpr92k5W.js} +1 -1
  46. package/dist/assets/{TransactionListRoutes-BgdTO4HR.js → TransactionListRoutes-C6ZbEcTu.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-8u7u_9F8.js → TreasuryRoutes-BvamC7Re.js} +1 -1
  48. package/dist/assets/{VendorsRoutes-CYZmnwrv.js → VendorsRoutes-lu3A3G0M.js} +1 -1
  49. package/dist/assets/{WiseConfirmationScreen-BiPmlGq6.js → WiseConfirmationScreen-CX-Fzehj.js} +1 -1
  50. package/dist/assets/{ZeniAccountRoutes-DO2fE8r2.js → ZeniAccountRoutes-DpUutqtc.js} +1 -1
  51. package/dist/assets/{ZeniAccountStatementScreen-Cb_rEVWr.js → ZeniAccountStatementScreen-CeBv1Cnr.js} +1 -1
  52. package/dist/assets/{analyticsHelper-DaDCazpC.js → analyticsHelper-CakEIbyY.js} +1 -1
  53. package/dist/assets/{getLocaleForTenant-yX1iEbj2.js → getLocaleForTenant-ePVFO9y0.js} +1 -1
  54. package/dist/assets/{index-Det3Ki3b.js → index-CVCyRaz2.js} +5 -5
  55. package/dist/assets/{routePaths-CbGdb8gZ.js → routePaths-BYsH7YxB.js} +1 -1
  56. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-D8RjKLM8.js → useAiCfoDashboardSuggestedQuestionsChips-DIXV_4D6.js} +1 -1
  57. package/dist/assets/{useAskAiCfoHostNavButtonProps-BXGcqvyl.js → useAskAiCfoHostNavButtonProps-DdDNWlhJ.js} +1 -1
  58. package/dist/assets/{useCashManagementBanner-CdVrtcFk.js → useCashManagementBanner-e8VaEdGn.js} +1 -1
  59. package/dist/assets/{useInitialThreadRequest-D9NRPlO5.js → useInitialThreadRequest-CCHKjkJV.js} +1 -1
  60. package/dist/assets/{withTransactionSidePanel-D8vEjelm.js → withTransactionSidePanel-CYQhrzsL.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-GsPfxkQ7.js";import{A as d}from"./AddressScreen-BdkkfpOD.js";import i from"./NotFoundScreen-_JeeXwwE.js";import"./sentry-B2TzMFx9.js";import{o as s,p as r}from"./core-wjM80qIn.js";import"./zeni-epic-state-DrcliB1J.js";import"./recharts-D4VpFd5q.js";import"./index-Det3Ki3b.js";import"./mui-BSDa87ap.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.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-GsPfxkQ7.js";import{A as d}from"./AddressScreen-CnWN_Byu.js";import i from"./NotFoundScreen-BzCRT55X.js";import"./sentry-B2TzMFx9.js";import{o as s,p as r}from"./core-wjM80qIn.js";import"./zeni-epic-state-DrcliB1J.js";import"./recharts-D4VpFd5q.js";import"./index-CVCyRaz2.js";import"./mui-BSDa87ap.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.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-GsPfxkQ7.js";import{a as h}from"./sentry-B2TzMFx9.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-wjM80qIn.js";import{K as $,m as D,z as K,j as L,B as R,s as z,c as C,e as S,J as F,h as b,p as N}from"./index-Det3Ki3b.js";import{Mk as k,hP as U,eW as G,Ml as O,c7 as V,Mm as q,l8 as H}from"./zeni-epic-state-DrcliB1J.js";import{n as J}from"./mui-BSDa87ap.js";import W from"./NotFoundScreen-_JeeXwwE.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]="0d81ea4c-6efd-4889-9edf-4eeec990b49a",e._sentryDebugIdIdentifier="sentry-dbid-0d81ea4c-6efd-4889-9edf-4eeec990b49a")}catch{}})();const Q=J.div`
1
+ import{j as r}from"./liveblocks-GsPfxkQ7.js";import{a as h}from"./sentry-B2TzMFx9.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-wjM80qIn.js";import{K as $,m as D,z as K,j as L,B as R,s as z,c as C,e as S,J as F,h as b,p as N}from"./index-CVCyRaz2.js";import{Mk as k,hP as U,eW as G,Ml as O,c7 as V,Mm as q,l8 as H}from"./zeni-epic-state-DrcliB1J.js";import{n as J}from"./mui-BSDa87ap.js";import W from"./NotFoundScreen-BzCRT55X.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]="0d81ea4c-6efd-4889-9edf-4eeec990b49a",e._sentryDebugIdIdentifier="sentry-dbid-0d81ea4c-6efd-4889-9edf-4eeec990b49a")}catch{}})();const Q=J.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-GsPfxkQ7.js";import{a as l}from"./sentry-B2TzMFx9.js";import{u as ge,h as Ce,g as Ie,j as X,i as ke,n as be}from"./core-wjM80qIn.js";import{X as we,z as xe,K as Pe,d9 as Ee,da as ye,b6 as K,db as Te,b5 as J,p as D,s as F,c as I,dc as L,dd as ve,de as Qe,a1 as _e,e as Ae,a7 as Oe,df as je,a2 as Ue,dg as Fe,dh as Le,n as Be,b1 as De,di as Re}from"./index-Det3Ki3b.js";import{gj as Me,eV as ee,eW as Ve,iv as Ge,Ts as $e,f0 as Ne,iF as qe,iB as We,eX as B,f7 as ze,fY as He,fB as Xe,fF as Y,fZ as Ke,f_ as Ye,f$ as Ze,g0 as Je,g1 as et}from"./zeni-epic-state-DrcliB1J.js";import{D as tt,n as k,S as st,P as ot}from"./mui-BSDa87ap.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-D8RjKLM8.js";import{p as nt}from"./pathToGoBack-CAzQiLsh.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="c723c9e4-214d-4703-a5f6-17ef92229af8",t._sentryDebugIdIdentifier="sentry-dbid-c723c9e4-214d-4703-a5f6-17ef92229af8")}catch{}})();const te="chat-response-generated",it=be(function(t,r){const s=ee(t),m=r.isSubmitting,n=s.uiState?.currentChatSessionId,p=n!=null?ze(t.aiCfoState,n):[];return{showSampleQuestions:r.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:m,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ue}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,syntheticAnswers:p,resolveSyntheticAnswerCardTile:Le(t),resolveSyntheticAnswerPolicyTile:Fe(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:u,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,h)=>{if(e===te&&typeof h.text=="string"&&typeof h.metadata=="object"){const a=h,c=Ye(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:E,currentQuestionAnswer:b,currentQuestionAnswerSummary:y}=J(u,o);c!=="answer"?I.trackAICFOChatResponseGenerated(c,b?.question.questionText??"",a.text,o,Re(y,E),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,b?.question.questionText??"",(a.follow_up_questions?.length??0)>0,!!a.assumptions,!!a.insights,a.visualization!=null,Ze(a.visualization?.type??"")??null,o,a.summarized_title,a.metadata.message_id??null),t(Je({chatSessionId:a.metadata.chat_session_id,responseType:c,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,h,a,c)=>{e&&De(t,e,h,S,u,n,c,a)},updateCurrentInput:e=>{t(Y(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Ke(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),h=e.poppedPathname??nt(1);p(h,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(Y(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),h=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(h,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{S!=null&&t(Xe());const e=Be(s.state?.pathnameStackToGoBack,s.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,h)=>{t(He({questionAnswerId:e,isCollapsed:h}))},onMenuClick:r.onMenuClick}})(Oe(je)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,S]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const u=X(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=ke(),h=Pe(),a=_e(h),c=X(i=>Ve(i)),o=u.uiState.currentChatSessionId,E=c.tenantEmailDomain,{handleUploadPromoClose:b,isUploadPromoVisible:y}=Ee({isFileUploadEnabled:t,tenantEmailDomain:E}),T=ye({currentTenant:c,currentChatSessionId:o,aiCfoView:u}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[K]!==!0)return;S(!0);const g={...i};delete g[K],m(n,{replace:!0,state:g})},[n.pathname,n.search,n.state,m]);const[ae,v]=l.useState(null),[ne,Q]=l.useState(!1),[ie,_]=l.useState(void 0),[re,A]=l.useState(void 0),M=l.useRef(!1);l.useEffect(()=>{if(!M.current&&x!=null&&x!==""){const i=n.state;v(x),Q(R),_(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const g=i?.aiCfoSuggestionIndex;A(typeof g=="number"?g:void 0),M.current=!0}},[x,R,n.state]);const le=l.useCallback(()=>{v(null),Q(!1),_(void 0),A(void 0)},[]),V=l.useMemo(()=>new URLSearchParams(n.search),[n.search]),G=V.get("ref")??w?.aiCfoRef,O=V.get("emailRefId")??w?.aiCfoEmailRefId,$=l.useRef(!1);l.useEffect(()=>{$.current||G!=="month-end-email"||O==null||o!=null||f==null||(s(Ge("controller",f.userId,O,"MONTH_END_EMAIL")),$.current=!0)},[G,O,o,s,f]);const P=u.uiState.lastContextMessage;l.useEffect(()=>{P!=null&&P!==""&&o!=null&&(v(P),Q(!0),_(void 0),A(void 0),s($e()))},[P,o,s]);const de=c.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),j=u.fetchState,U=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,q=o!=null?u.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(u.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ce}=J(z,o),ue=ce.length===0;l.useEffect(()=>{C||a||m("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})},[C,a,m,n.state]);const me=l.useCallback(()=>{const i=D(n.state?.pathnameStackToGoBack),g=c.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[c.tenantEmailDomain,n.state,m]);l.useEffect(()=>{o!=null&&e!==o&&m(`../ai-cfo/${o}`,{state:{...n.state}})},[o,e]),l.useEffect(()=>{e!=null&&o==null&&e!=="new_chat"&&e!=="explore"&&s(Ne({sessionId:e,agentId:"controller"}))},[]);const pe=l.useMemo(()=>({events:N.map(i=>`private-encrypted-chat-${i}.${te}`),eventCallback:(i,g,fe)=>fe.onEventReceived(i,g)}),[N]);l.useEffect(()=>{j!=="In-Progress"&&U&&s(qe())},[j,U,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&j==="Completed"&&!U&&s(We(o,f.userId))},[q,W,o,f,s]);const H=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(f==null||e==null)throw Error("Can't access AI Controller page without signing in...");const he=o!=null&&u.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(F,{analytics:I,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(L,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{c.userRoleId!=null&&s(B(c.userRoleId))}})})})]});const Se=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(F,{analytics:I,onLoad:H}):null,d.jsx(L,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),S(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(F,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>S(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:he,isEmptyChatWithSession:ue,currentTenant:c,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:y,onUploadPromoClose:b,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(L,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),S(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>S(!1),children:d.jsx(Qe,{children:Se})}):null]})},Z=k(st)`
1
+ import{j as d}from"./liveblocks-GsPfxkQ7.js";import{a as l}from"./sentry-B2TzMFx9.js";import{u as ge,h as Ce,g as Ie,j as X,i as ke,n as be}from"./core-wjM80qIn.js";import{X as we,z as xe,K as Pe,d9 as Ee,da as ye,b6 as K,db as Te,b5 as J,p as D,s as F,c as I,dc as L,dd as ve,de as Qe,a1 as _e,e as Ae,a7 as Oe,df as je,a2 as Ue,dg as Fe,dh as Le,n as Be,b1 as De,di as Re}from"./index-CVCyRaz2.js";import{gj as Me,eV as ee,eW as Ve,iv as Ge,Ts as $e,f0 as Ne,iF as qe,iB as We,eX as B,f7 as ze,fY as He,fB as Xe,fF as Y,fZ as Ke,f_ as Ye,f$ as Ze,g0 as Je,g1 as et}from"./zeni-epic-state-DrcliB1J.js";import{D as tt,n as k,S as st,P as ot}from"./mui-BSDa87ap.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-DIXV_4D6.js";import{p as nt}from"./pathToGoBack-CAzQiLsh.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="c723c9e4-214d-4703-a5f6-17ef92229af8",t._sentryDebugIdIdentifier="sentry-dbid-c723c9e4-214d-4703-a5f6-17ef92229af8")}catch{}})();const te="chat-response-generated",it=be(function(t,r){const s=ee(t),m=r.isSubmitting,n=s.uiState?.currentChatSessionId,p=n!=null?ze(t.aiCfoState,n):[];return{showSampleQuestions:r.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:m,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Ue}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,syntheticAnswers:p,resolveSyntheticAnswerCardTile:Le(t),resolveSyntheticAnswerPolicyTile:Fe(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:u,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,h)=>{if(e===te&&typeof h.text=="string"&&typeof h.metadata=="object"){const a=h,c=Ye(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:E,currentQuestionAnswer:b,currentQuestionAnswerSummary:y}=J(u,o);c!=="answer"?I.trackAICFOChatResponseGenerated(c,b?.question.questionText??"",a.text,o,Re(y,E),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,b?.question.questionText??"",(a.follow_up_questions?.length??0)>0,!!a.assumptions,!!a.insights,a.visualization!=null,Ze(a.visualization?.type??"")??null,o,a.summarized_title,a.metadata.message_id??null),t(Je({chatSessionId:a.metadata.chat_session_id,responseType:c,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,h,a,c)=>{e&&De(t,e,h,S,u,n,c,a)},updateCurrentInput:e=>{t(Y(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Ke(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),h=e.poppedPathname??nt(1);p(h,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(Y(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),h=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(h,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{S!=null&&t(Xe());const e=Be(s.state?.pathnameStackToGoBack,s.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,h)=>{t(He({questionAnswerId:e,isCollapsed:h}))},onMenuClick:r.onMenuClick}})(Oe(je)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,S]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const u=X(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=ke(),h=Pe(),a=_e(h),c=X(i=>Ve(i)),o=u.uiState.currentChatSessionId,E=c.tenantEmailDomain,{handleUploadPromoClose:b,isUploadPromoVisible:y}=Ee({isFileUploadEnabled:t,tenantEmailDomain:E}),T=ye({currentTenant:c,currentChatSessionId:o,aiCfoView:u}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[K]!==!0)return;S(!0);const g={...i};delete g[K],m(n,{replace:!0,state:g})},[n.pathname,n.search,n.state,m]);const[ae,v]=l.useState(null),[ne,Q]=l.useState(!1),[ie,_]=l.useState(void 0),[re,A]=l.useState(void 0),M=l.useRef(!1);l.useEffect(()=>{if(!M.current&&x!=null&&x!==""){const i=n.state;v(x),Q(R),_(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const g=i?.aiCfoSuggestionIndex;A(typeof g=="number"?g:void 0),M.current=!0}},[x,R,n.state]);const le=l.useCallback(()=>{v(null),Q(!1),_(void 0),A(void 0)},[]),V=l.useMemo(()=>new URLSearchParams(n.search),[n.search]),G=V.get("ref")??w?.aiCfoRef,O=V.get("emailRefId")??w?.aiCfoEmailRefId,$=l.useRef(!1);l.useEffect(()=>{$.current||G!=="month-end-email"||O==null||o!=null||f==null||(s(Ge("controller",f.userId,O,"MONTH_END_EMAIL")),$.current=!0)},[G,O,o,s,f]);const P=u.uiState.lastContextMessage;l.useEffect(()=>{P!=null&&P!==""&&o!=null&&(v(P),Q(!0),_(void 0),A(void 0),s($e()))},[P,o,s]);const de=c.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),j=u.fetchState,U=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,q=o!=null?u.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(u.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ce}=J(z,o),ue=ce.length===0;l.useEffect(()=>{C||a||m("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})},[C,a,m,n.state]);const me=l.useCallback(()=>{const i=D(n.state?.pathnameStackToGoBack),g=c.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[c.tenantEmailDomain,n.state,m]);l.useEffect(()=>{o!=null&&e!==o&&m(`../ai-cfo/${o}`,{state:{...n.state}})},[o,e]),l.useEffect(()=>{e!=null&&o==null&&e!=="new_chat"&&e!=="explore"&&s(Ne({sessionId:e,agentId:"controller"}))},[]);const pe=l.useMemo(()=>({events:N.map(i=>`private-encrypted-chat-${i}.${te}`),eventCallback:(i,g,fe)=>fe.onEventReceived(i,g)}),[N]);l.useEffect(()=>{j!=="In-Progress"&&U&&s(qe())},[j,U,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&j==="Completed"&&!U&&s(We(o,f.userId))},[q,W,o,f,s]);const H=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(f==null||e==null)throw Error("Can't access AI Controller page without signing in...");const he=o!=null&&u.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(F,{analytics:I,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(L,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{c.userRoleId!=null&&s(B(c.userRoleId))}})})})]});const Se=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(F,{analytics:I,onLoad:H}):null,d.jsx(L,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),S(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(F,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>S(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:he,isEmptyChatWithSession:ue,currentTenant:c,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:y,onUploadPromoClose:b,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(L,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),S(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>S(!1),children:d.jsx(Qe,{children:Se})}):null]})},Z=k(st)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-GsPfxkQ7.js";import{a as v}from"./sentry-B2TzMFx9.js";import{h as B,g as j,u as P,j as y,N as q,n as U,i as K,o as ee,p as C}from"./core-wjM80qIn.js";import{eW as k,PB as A,Ph as g,zf as E,z3 as J,zb as R,yZ as Z,Pj as G,z0 as te,z4 as H,zh as M,zg as D}from"./zeni-epic-state-DrcliB1J.js";import{m as O,z as V,B as T,a7 as Q,bI as ae,af as _,bz as X,bJ as oe,bK as le,bL as pe}from"./index-Det3Ki3b.js";import"./mui-BSDa87ap.js";import{i as se}from"./ReimbursementApprovalRuleDetailScreen-DGivgXWQ.js";import re from"./NotFoundScreen-_JeeXwwE.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]="2582ad8d-b7e0-49c3-83f8-65335cdc1852",e._sentryDebugIdIdentifier="sentry-dbid-2582ad8d-b7e0-49c3-83f8-65335cdc1852")}catch{}})();const N="bill-approval-rule-update",ne=U(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:g(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(Q(ae)),ie=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>g(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!1)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${N}`]:[],eventCallback:(l,w,h)=>{l.endsWith(N)&&h.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ne,{currentTenant:u,location:p,navigate:e,...m})},F="bill-approval-rule-update",ce=U(function(e){const p=A(e),t=g(e).billPaySetupApproverViewUpdateData,s={};for(const i of Object.values(e.contactState.contactById))i?.id!=null&&(s[i.id]=i.fullName);const a={};for(const i of Object.values(e.classState.classesByKey))i?.classId!=null&&(a[i.classId]=i.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:s,departmentNamesById:a}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(F)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(te(a,!0))}}})(Q(oe)),ue=()=>{const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(de,{}):c.jsx(ie,{})},de=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>g(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!0)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${F}`]:[],eventCallback:(l,w,h)=>{l.endsWith(F)&&h.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ce,{currentTenant:u,location:p,navigate:e,...m})},ve=U(function(e,p){const t=g(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=s==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return p.approvalRuleId&&(i=t.allApprovalRules.findIndex(r=>r.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:i,approvalUpdateActionType:s}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=f=>{const m=[];return f.forEach(l=>{const w=l.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),h=l.actors.selectedNonUsers.map(b=>{const I=!!se(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),S=w.concat(h);m.push({action:l.stepType.selectedOption,actors:S,operator:S.length>1?l.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},n={amount:{type:"amount",comparator:"range",min:{amount:o.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:o.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const f={criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}else{const f={approvalRuleId:i,criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!1))},onSaveRuleSuccess:()=>{t("../")}}})(le);function fe(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>g(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ve,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t})}const ye=U(function(e,p){const t=g(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],i={};for(const r of Object.values(e.contactState.contactById))r?.id!=null&&(a.push(r.id),i[r.id]=r.fullName);return{localData:t,approvalUpdateActionType:s,allVendorIds:a,vendorNamesById:i,editingRuleId:s==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=S=>{const b=[];return S.forEach(I=>{const $=I.actorKind?.selectedOption,z=I.selectedRole?.selectedOption;let x=[];$==="role"&&z!=null?x=[{type:"attribute",subType:z,userId:void 0,idType:void 0,isImplicitActor:!1}]:$==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(Y=>({type:"user",userId:Y.userId,isImplicitActor:!1})));const L=I.action??"require_approval";b.push({action:L,actors:x,operator:x.length>1?L==="require_approval"?"or":"and":"is"})}),b},n=o.amountCriteria,f=o.vendorCriteria,m=o.departmentCriteria,l={};if(n!=null&&n.comparator.selectedOption!=null){const S=n.comparator.selectedOption;l.amount={type:"amount",comparator:S,min:S==="less_than"?void 0:n.min,max:S==="greater_than"?void 0:n.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(l.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const h=m?.selection.selectedOptions??[];if(h.length>0&&(l.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:h}),r==="approval_create"){const S={name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}else{const S={approvalRuleId:i,name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:o=>{e(R(o)),t(r==="approval_update"?`../../${o}/edit`:`../${o}/edit`)}}})(pe);function W(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(Se,{}):c.jsx(fe,{})}function Se(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>g(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ye,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t},s??"new")}function Ee(){return c.jsxs(ee,{children:[c.jsx(C,{path:"/",element:c.jsx(ue,{})}),c.jsx(C,{path:"/new",element:c.jsx(W,{})}),c.jsx(C,{path:"/:approvalRuleId/edit",element:c.jsx(W,{})}),c.jsx(C,{path:"*",element:c.jsx(re,{})})]})}export{Ee as B};
1
+ import{j as c}from"./liveblocks-GsPfxkQ7.js";import{a as v}from"./sentry-B2TzMFx9.js";import{h as B,g as j,u as P,j as y,N as q,n as U,i as K,o as ee,p as C}from"./core-wjM80qIn.js";import{eW as k,PB as A,Ph as g,zf as E,z3 as J,zb as R,yZ as Z,Pj as G,z0 as te,z4 as H,zh as M,zg as D}from"./zeni-epic-state-DrcliB1J.js";import{m as O,z as V,B as T,a7 as Q,bI as ae,af as _,bz as X,bJ as oe,bK as le,bL as pe}from"./index-CVCyRaz2.js";import"./mui-BSDa87ap.js";import{i as se}from"./ReimbursementApprovalRuleDetailScreen-DTKjwmY6.js";import re from"./NotFoundScreen-BzCRT55X.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]="2582ad8d-b7e0-49c3-83f8-65335cdc1852",e._sentryDebugIdIdentifier="sentry-dbid-2582ad8d-b7e0-49c3-83f8-65335cdc1852")}catch{}})();const N="bill-approval-rule-update",ne=U(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:g(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(Q(ae)),ie=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>g(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!1)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${N}`]:[],eventCallback:(l,w,h)=>{l.endsWith(N)&&h.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ne,{currentTenant:u,location:p,navigate:e,...m})},F="bill-approval-rule-update",ce=U(function(e){const p=A(e),t=g(e).billPaySetupApproverViewUpdateData,s={};for(const i of Object.values(e.contactState.contactById))i?.id!=null&&(s[i.id]=i.fullName);const a={};for(const i of Object.values(e.classState.classesByKey))i?.classId!=null&&(a[i.classId]=i.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:s,departmentNamesById:a}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(F)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Z(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(te(a,!0))}}})(Q(oe)),ue=()=>{const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(de,{}):c.jsx(ie,{})},de=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>g(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!0)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${F}`]:[],eventCallback:(l,w,h)=>{l.endsWith(F)&&h.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ce,{currentTenant:u,location:p,navigate:e,...m})},ve=U(function(e,p){const t=g(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=s==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return p.approvalRuleId&&(i=t.allApprovalRules.findIndex(r=>r.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:i,approvalUpdateActionType:s}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=f=>{const m=[];return f.forEach(l=>{const w=l.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),h=l.actors.selectedNonUsers.map(b=>{const I=!!se(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),S=w.concat(h);m.push({action:l.stepType.selectedOption,actors:S,operator:S.length>1?l.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},n={amount:{type:"amount",comparator:"range",min:{amount:o.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:o.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const f={criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}else{const f={approvalRuleId:i,criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!1))},onSaveRuleSuccess:()=>{t("../")}}})(le);function fe(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>g(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ve,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t})}const ye=U(function(e,p){const t=g(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],i={};for(const r of Object.values(e.contactState.contactById))r?.id!=null&&(a.push(r.id),i[r.id]=r.fullName);return{localData:t,approvalUpdateActionType:s,allVendorIds:a,vendorNamesById:i,editingRuleId:s==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=S=>{const b=[];return S.forEach(I=>{const $=I.actorKind?.selectedOption,z=I.selectedRole?.selectedOption;let x=[];$==="role"&&z!=null?x=[{type:"attribute",subType:z,userId:void 0,idType:void 0,isImplicitActor:!1}]:$==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(Y=>({type:"user",userId:Y.userId,isImplicitActor:!1})));const L=I.action??"require_approval";b.push({action:L,actors:x,operator:x.length>1?L==="require_approval"?"or":"and":"is"})}),b},n=o.amountCriteria,f=o.vendorCriteria,m=o.departmentCriteria,l={};if(n!=null&&n.comparator.selectedOption!=null){const S=n.comparator.selectedOption;l.amount={type:"amount",comparator:S,min:S==="less_than"?void 0:n.min,max:S==="greater_than"?void 0:n.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(l.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const h=m?.selection.selectedOptions??[];if(h.length>0&&(l.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:h}),r==="approval_create"){const S={name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}else{const S={approvalRuleId:i,name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:o=>{e(R(o)),t(r==="approval_update"?`../../${o}/edit`:`../${o}/edit`)}}})(pe);function W(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(Se,{}):c.jsx(fe,{})}function Se(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>g(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ye,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t},s??"new")}function Ee(){return c.jsxs(ee,{children:[c.jsx(C,{path:"/",element:c.jsx(ue,{})}),c.jsx(C,{path:"/new",element:c.jsx(W,{})}),c.jsx(C,{path:"/:approvalRuleId/edit",element:c.jsx(W,{})}),c.jsx(C,{path:"*",element:c.jsx(re,{})})]})}export{Ee as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-GsPfxkQ7.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as Y,l as na,o as ia,p as S}from"./core-wjM80qIn.js";import{eW as Z,OT as Ue,bt as It,JR as oa,bo as wt,bJ as pe,OU as At,yu as Bt,zJ as $e,z5 as la,bn as De,OV as sa,OW as ra,c7 as ca,OX as da,ks as Ct,OY as xt,OZ as Et,Ai as Ge,yJ as Ce,O_ as ua,yi as tt,O$ as pa,Ed as ma,ym as ba,ys as Dt,P0 as ke,P1 as Me,zK as Oe,P2 as ha,P3 as ga,zN as Ne,P4 as ya,z_ as Sa,P5 as Pt,zu as at,zz as fa,P6 as ka,P7 as ue,P8 as jt,P9 as Tt,Pa as Ft,gn as va,yO as Le,cB as Rt,Pb as Ia,hF as wa,Pc as Aa,Pd as Ba,fd as Vt,fb as $t,Pe as ze,Pf as Ca,Pg as xa,MD as Ze,Ph as Ea,ME as oe,MF as He,Pi as Da,Pj as Pa,Pk as ja,zB as nt,zy as Ta,Pl as Fa,Pm as Ra,Pn as Va,zk as $a,Po as La,Pp as _a,Pq as Ua,cp as Lt,cR as _t,kD as Ga,bP as Ma,bq as Ut,bQ as Gt,xA as Oa,Pr as Na,E0 as za,E6 as Za,t_ as Ha,zL as Wa,Ap as qa,kQ as fe,Ps as Ja,Pt as Mt,li as Ka,kK as Ot,l3 as Nt,l2 as it,bE as be,bO as Qa,Pu as Ya,Pv as ve,jn as Xa,Pw as ot,Px as en,jr as tn,jM as an,AD as nn,Py as on,lb as ln,At as sn,Pz as lt,Ax as rn,AC as cn,Az as dn,Ar as un,PA as zt,yD as pn,PB as mn,PC as bn,gf as hn,ge as gn,gd as yn,kT as Sn,l9 as st,lk as fn,ry as kn,l0 as vn,Av as In,jx as wn,lp as An,PD as Bn,jp as Cn,rp as xn,PE as En,zq as Dn,bK as Pn,bs as jn,Lz as Tn,cT as Fn,cS as Rn,cA as Vn,cH as $n}from"./zeni-epic-state-DrcliB1J.js";import{m as me,z as V,j as Ie,_ as We,N as le,f as y,aN as xe,B as re,o as x,s as Pe,c as D,be as Ln,p as z,a2 as qe,n as E,K as we,bf as rt,bg as ct,bh as _n,ak as Un,y as Gn,aH as Mn,w as Zt,D as Je,F as Ke,bi as On,at as Ht,bj as Nn,Y as zn,e as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Yn,br as Xn,bs as ei,R as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-Det3Ki3b.js";import{n as _,S as si}from"./mui-BSDa87ap.js";import{A as dt}from"./AddressScreen-BdkkfpOD.js";import{g as ie,a as je,i as qt,V as Qe,b as Ye,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-BgEqXJEl.js";import{a as f}from"./sentry-B2TzMFx9.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-BXGcqvyl.js";import{u as Jt}from"./useInitialThreadRequest-D9NRPlO5.js";import Ee from"./NotFoundScreen-_JeeXwwE.js";import{D as ui}from"./DrawerScreen-_1RQlY4y.js";import{M as Kt}from"./MobileAppDrawer-D6Fu3M_x.js";import{F as Qt}from"./FeaturePreviewScreen-CeZNu_Vi.js";import{S as Te}from"./SetupPagesScreen-Djxd17id.js";import{B as pi}from"./BillPayApprovalRoutes-C9K9cwdL.js";import{FallBackRoute as mi}from"./ScreenRoutes-BVYp-4m8.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./analyticsHelper-DaDCazpC.js";import"./routePaths-CbGdb8gZ.js";import"./BusinessVerificationPageScreen-BvxrLE03.js";import"./ReimbursementApprovalRuleDetailScreen-DGivgXWQ.js";import"./getLocaleForTenant-yX1iEbj2.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]="0fd46690-9789-4556-a5eb-42671d2e7889",e._sentryDebugIdIdentifier="sentry-dbid-0fd46690-9789-4556-a5eb-42671d2e7889")}catch{}})();const bi=Y(function(e,t){const l=Ue(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(ke({}))},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=Q(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(O=>Z(O)),s=v(O=>Ue(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,k]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=U(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"||(k(!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=Y(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=Q(),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:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[B,G]=f.useState(!1),[j,U]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=v(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=v(F=>Ue(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?U(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(U(!0),t($e(!1,h,P,b,n)))),u&&!j&&(U(!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(ke({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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const 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(Un,{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(Yt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-GsPfxkQ7.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as Y,l as na,o as ia,p as S}from"./core-wjM80qIn.js";import{eW as Z,OT as Ue,bt as It,JR as oa,bo as wt,bJ as pe,OU as At,yu as Bt,zJ as $e,z5 as la,bn as De,OV as sa,OW as ra,c7 as ca,OX as da,ks as Ct,OY as xt,OZ as Et,Ai as Ge,yJ as Ce,O_ as ua,yi as tt,O$ as pa,Ed as ma,ym as ba,ys as Dt,P0 as ke,P1 as Me,zK as Oe,P2 as ha,P3 as ga,zN as Ne,P4 as ya,z_ as Sa,P5 as Pt,zu as at,zz as fa,P6 as ka,P7 as ue,P8 as jt,P9 as Tt,Pa as Ft,gn as va,yO as Le,cB as Rt,Pb as Ia,hF as wa,Pc as Aa,Pd as Ba,fd as Vt,fb as $t,Pe as ze,Pf as Ca,Pg as xa,MD as Ze,Ph as Ea,ME as oe,MF as He,Pi as Da,Pj as Pa,Pk as ja,zB as nt,zy as Ta,Pl as Fa,Pm as Ra,Pn as Va,zk as $a,Po as La,Pp as _a,Pq as Ua,cp as Lt,cR as _t,kD as Ga,bP as Ma,bq as Ut,bQ as Gt,xA as Oa,Pr as Na,E0 as za,E6 as Za,t_ as Ha,zL as Wa,Ap as qa,kQ as fe,Ps as Ja,Pt as Mt,li as Ka,kK as Ot,l3 as Nt,l2 as it,bE as be,bO as Qa,Pu as Ya,Pv as ve,jn as Xa,Pw as ot,Px as en,jr as tn,jM as an,AD as nn,Py as on,lb as ln,At as sn,Pz as lt,Ax as rn,AC as cn,Az as dn,Ar as un,PA as zt,yD as pn,PB as mn,PC as bn,gf as hn,ge as gn,gd as yn,kT as Sn,l9 as st,lk as fn,ry as kn,l0 as vn,Av as In,jx as wn,lp as An,PD as Bn,jp as Cn,rp as xn,PE as En,zq as Dn,bK as Pn,bs as jn,Lz as Tn,cT as Fn,cS as Rn,cA as Vn,cH as $n}from"./zeni-epic-state-DrcliB1J.js";import{m as me,z as V,j as Ie,_ as We,N as le,f as y,aN as xe,B as re,o as x,s as Pe,c as D,be as Ln,p as z,a2 as qe,n as E,K as we,bf as rt,bg as ct,bh as _n,ak as Un,y as Gn,aH as Mn,w as Zt,D as Je,F as Ke,bi as On,at as Ht,bj as Nn,Y as zn,e as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Yn,br as Xn,bs as ei,R as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-CVCyRaz2.js";import{n as _,S as si}from"./mui-BSDa87ap.js";import{A as dt}from"./AddressScreen-CnWN_Byu.js";import{g as ie,a as je,i as qt,V as Qe,b as Ye,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-B4-ngaAr.js";import{a as f}from"./sentry-B2TzMFx9.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-DdDNWlhJ.js";import{u as Jt}from"./useInitialThreadRequest-CCHKjkJV.js";import Ee from"./NotFoundScreen-BzCRT55X.js";import{D as ui}from"./DrawerScreen-CCOxeY1b.js";import{M as Kt}from"./MobileAppDrawer-Co1JEy80.js";import{F as Qt}from"./FeaturePreviewScreen-DJsA6G2u.js";import{S as Te}from"./SetupPagesScreen-CYV12QsA.js";import{B as pi}from"./BillPayApprovalRoutes-fwQ-KbdW.js";import{FallBackRoute as mi}from"./ScreenRoutes-Q9t_VXud.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./analyticsHelper-CakEIbyY.js";import"./routePaths-BYsH7YxB.js";import"./BusinessVerificationPageScreen-CQCM86dl.js";import"./ReimbursementApprovalRuleDetailScreen-DTKjwmY6.js";import"./getLocaleForTenant-ePVFO9y0.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]="0fd46690-9789-4556-a5eb-42671d2e7889",e._sentryDebugIdIdentifier="sentry-dbid-0fd46690-9789-4556-a5eb-42671d2e7889")}catch{}})();const bi=Y(function(e,t){const l=Ue(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(ke({}))},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=Q(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(O=>Z(O)),s=v(O=>Ue(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,k]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=U(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"||(k(!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=Y(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=Q(),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:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[B,G]=f.useState(!1),[j,U]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=v(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=v(F=>Ue(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?U(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(U(!0),t($e(!1,h,P,b,n)))),u&&!j&&(U(!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(ke({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(Yt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(_n,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const 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(Un,{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(Yt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{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=_.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as k}from"./liveblocks-GsPfxkQ7.js";import{a as V}from"./sentry-B2TzMFx9.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-wjM80qIn.js";import{j as ce,N as ue,aN as de,z,s as pe,c as E,af as P,e as x,bE as le,at as me,n as B,au as M}from"./index-Det3Ki3b.js";import{Pp as fe,eW as G,tp as ye,JU as Se,zk as ge,CK as Ie,Fm as be,F$ as he,G$ as Oe,PM as Te,PN as De,PO as ke,PP as Ce,PQ as Ve,Ml as we,OO as Ne,Mw as Ae,l8 as Fe,gf as _e,ge as ve,gd as Pe,ry as xe,rp as ze,rm as Ee,l0 as Be,ty as Me,tw as R,bE as U,tK as j,cz as Re}from"./zeni-epic-state-DrcliB1J.js";import{n as Ue}from"./mui-BSDa87ap.js";import{d as L}from"./routePaths-CbGdb8gZ.js";import{M as je}from"./MobileAppDrawer-D6Fu3M_x.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]="7faa90b7-136b-49d1-90b5-0965c757acd1",e._sentryDebugIdIdentifier="sentry-dbid-7faa90b7-136b-49d1-90b5-0965c757acd1")}catch{}})();const Le=Ue.div`
1
+ import{j as k}from"./liveblocks-GsPfxkQ7.js";import{a as V}from"./sentry-B2TzMFx9.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-wjM80qIn.js";import{j as ce,N as ue,aN as de,z,s as pe,c as E,af as P,e as x,bE as le,at as me,n as B,au as M}from"./index-CVCyRaz2.js";import{Pp as fe,eW as G,tp as ye,JU as Se,zk as ge,CK as Ie,Fm as be,F$ as he,G$ as Oe,PM as Te,PN as De,PO as ke,PP as Ce,PQ as Ve,Ml as we,OO as Ne,Mw as Ae,l8 as Fe,gf as _e,ge as ve,gd as Pe,ry as xe,rp as ze,rm as Ee,l0 as Be,ty as Me,tw as R,bE as U,tK as j,cz as Re}from"./zeni-epic-state-DrcliB1J.js";import{n as Ue}from"./mui-BSDa87ap.js";import{d as L}from"./routePaths-BYsH7YxB.js";import{M as je}from"./MobileAppDrawer-Co1JEy80.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]="7faa90b7-136b-49d1-90b5-0965c757acd1",e._sentryDebugIdIdentifier="sentry-dbid-7faa90b7-136b-49d1-90b5-0965c757acd1")}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 b}from"./liveblocks-GsPfxkQ7.js";import{a as i}from"./sentry-B2TzMFx9.js";import{n as W}from"./utils-BwzhiOdE.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as ve}from"./core-wjM80qIn.js";import{X as Ae,N as Te,f as z,z as Fe,d9 as Oe,db as Ue,b5 as ee,s as _e,c as V,dc as G,dj as xe,D as Qe,e as De,a7 as Le,df as $e,a2 as Ve,dk as je,b1 as Re,di as Me}from"./index-Det3Ki3b.js";import{gj as Ne,g4 as Be,g5 as X,g6 as He,fP as te,g7 as qe,g8 as We,eV as se,eW as ze,g9 as Ge,f0 as Xe,iF as Ye,iB as Je,eX as Y,fI as Ke,fJ as Ze,fK as et,fL as tt,fM as st,fN as at,fO as ot,fQ as nt,fR as it,fS as J,bE as K,fT as rt,fU as lt,fV as dt,fW as ct,fX as ut,fY as mt,fB as ft,fF as Z,fZ as pt,f_ as ht,f$ as Ct,g0 as St,g1 as gt,g2 as bt,g3 as Pt}from"./zeni-epic-state-DrcliB1J.js";import{D as yt,n as R,P as It,S as wt}from"./mui-BSDa87ap.js";import{d as Et}from"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ccb93b31-9dc2-4d6a-bf5e-8b978f201291",e._sentryDebugIdIdentifier="sentry-dbid-ccb93b31-9dc2-4d6a-bf5e-8b978f201291")}catch{}})();const kt=e=>Pt(e,!1),vt=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function j(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const At=ve(function(e,r){const s=se(e),h=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Ze(c),C=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:h,isNewChatSession:r.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,allUsers:r.allUsers,cardPolicyCategorySearchOptions:m.map(kt),cardPolicyVendorSearchOptions:d.map(vt),cardPolicyIsVendorSearchLoading:C==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:h,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:E,isCardPolicyEnabled:P,cardPolicyPageContext:k}=r,f=h.tenantEmailDomain,O=s.state?.referrer,u=O===ne?ie(f):j(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=ht(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:v,currentQuestionAnswerSummary:y}=ee(C,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,v?.question.questionText??"",t.text,p,Me(y,U),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,v?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,Ct(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(St({chatSessionId:t.metadata.chat_session_id,responseType:n,fetchState:{fetchState:"Completed",error:void 0}})),e(gt({chatSessionId:t.metadata.chat_session_id,answerPayload:t,userId:c}))}},onSubmit:(a,l,t,n)=>{a&&Re(e,a,l,d,C,c,n,t,k)},updateCurrentInput:a=>{e(Z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(Z(""))},togglePageView:()=>{m(u,{state:{...s.state}}),r.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{d!=null&&e(ft()),m(function(a){return`/${a}/${oe}`}(f),{state:{...s.state}})},onToggleCotCollapsed:(a,l)=>{e(mt({questionAnswerId:a,isCollapsed:l}))},onCardsCreationFormChange:E?a=>{e(ut(a))}:void 0,onCardsCreationFormSubmit:E?(a,l)=>{const t=lt(a);t.length!==0&&(e(dt(t)),e(ct({sourceChatSessionId:d??void 0})),d!=null&&e(J({chatSessionId:d,id:W(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(j(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:P?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:P?(a,l)=>{const t=je({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:W(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:P?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:P?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),F=re.pageTitle,Tt=le.pageTitle,Ft=re.chatHeaderSubtitle,Ot=le.chatHeaderSubtitle,Xt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=Ae(),s=Ie(),h=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:C}=Te(),{isFeatureEnabled:E}=C(z.isAiCardCreationEnabled),{isFeatureEnabled:P}=C(z.isCardPolicyEnabled);i.useEffect(()=>{s(Ne())},[s]),i.useEffect(()=>(s(Be()),s(X()),s(He("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>qe(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(We(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(X(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const O=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Fe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>ze(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:U,isUploadPromoVisible:v}=Oe({isFileUploadEnabled:e,tenantEmailDomain:p}),y=c.state,S=y?.aiCfoInitialQuestion??null,_=!!y?.aiCfoShouldSubmit,I=y?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:F,subtitle:I?Ot:Ft}),[I]),[ue,x]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||S==null||S===""||(x(S),Q(_),D.current=!0)},[S,_]);const fe=i.useCallback(()=>{x(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,A=i.useRef(null);i.useEffect(()=>{if(g&&A.current!=null){const{question:o,shouldSubmit:w}=A.current;A.current=null,x(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=Ue(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,N=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",B=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),H=u.allSessionsWithOrderedQuestionAnswers,q=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,he=i.useMemo(()=>q.map(o=>o.user).filter(o=>o!=null),[q]),{currentSessionQuestionAnswers:Ce}=ee(H,n),Se=Ce.length===0;i.useEffect(()=>{n!=null&&l!==n&&h(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,h,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Xe({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,ye)=>ye.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ye())},[L,$,s]),i.useEffect(()=>{n!=null&&N!=="In-Progress"&&B&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[N,B,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",Pe=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(_t,{children:[b.jsx(_e,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(At,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:H,allUsers:he,isAiCardCreationEnabled:E,isCardPolicyEnabled:P,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:h,sessionFromUrl:be,location:c,isSubmitting:Pe,isEmptyChatWithSession:Se,customPageTitle:F,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:v,onUploadPromoClose:U,onCardPolicyVendorSearchTextChange:O,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:F,onCloseClick:()=>{h(I?ie(p):j(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(S!=null&&S!==""&&(A.current={question:S,shouldSubmit:_}),s(Y(t.userRoleId)))}}),b.jsx(yt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:xt,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(Ut,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:F,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Y(t.userRoleId)),d(!1)}})})})]})},Ut=R(wt)`
1
+ import{j as b}from"./liveblocks-GsPfxkQ7.js";import{a as i}from"./sentry-B2TzMFx9.js";import{n as W}from"./utils-BwzhiOdE.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as ve}from"./core-wjM80qIn.js";import{X as Ae,N as Te,f as z,z as Fe,d9 as Oe,db as Ue,b5 as ee,s as _e,c as V,dc as G,dj as xe,D as Qe,e as De,a7 as Le,df as $e,a2 as Ve,dk as je,b1 as Re,di as Me}from"./index-CVCyRaz2.js";import{gj as Ne,g4 as Be,g5 as X,g6 as He,fP as te,g7 as qe,g8 as We,eV as se,eW as ze,g9 as Ge,f0 as Xe,iF as Ye,iB as Je,eX as Y,fI as Ke,fJ as Ze,fK as et,fL as tt,fM as st,fN as at,fO as ot,fQ as nt,fR as it,fS as J,bE as K,fT as rt,fU as lt,fV as dt,fW as ct,fX as ut,fY as mt,fB as ft,fF as Z,fZ as pt,f_ as ht,f$ as Ct,g0 as St,g1 as gt,g2 as bt,g3 as Pt}from"./zeni-epic-state-DrcliB1J.js";import{D as yt,n as R,P as It,S as wt}from"./mui-BSDa87ap.js";import{d as Et}from"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ccb93b31-9dc2-4d6a-bf5e-8b978f201291",e._sentryDebugIdIdentifier="sentry-dbid-ccb93b31-9dc2-4d6a-bf5e-8b978f201291")}catch{}})();const kt=e=>Pt(e,!1),vt=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function j(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const At=ve(function(e,r){const s=se(e),h=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Ze(c),C=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:h,isNewChatSession:r.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,allUsers:r.allUsers,cardPolicyCategorySearchOptions:m.map(kt),cardPolicyVendorSearchOptions:d.map(vt),cardPolicyIsVendorSearchLoading:C==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:h,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:C,isAiCardCreationEnabled:E,isCardPolicyEnabled:P,cardPolicyPageContext:k}=r,f=h.tenantEmailDomain,O=s.state?.referrer,u=O===ne?ie(f):j(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=ht(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:U,currentQuestionAnswer:v,currentQuestionAnswerSummary:y}=ee(C,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,v?.question.questionText??"",t.text,p,Me(y,U),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,v?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,Ct(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(St({chatSessionId:t.metadata.chat_session_id,responseType:n,fetchState:{fetchState:"Completed",error:void 0}})),e(gt({chatSessionId:t.metadata.chat_session_id,answerPayload:t,userId:c}))}},onSubmit:(a,l,t,n)=>{a&&Re(e,a,l,d,C,c,n,t,k)},updateCurrentInput:a=>{e(Z(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(Z(""))},togglePageView:()=>{m(u,{state:{...s.state}}),r.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{d!=null&&e(ft()),m(function(a){return`/${a}/${oe}`}(f),{state:{...s.state}})},onToggleCotCollapsed:(a,l)=>{e(mt({questionAnswerId:a,isCollapsed:l}))},onCardsCreationFormChange:E?a=>{e(ut(a))}:void 0,onCardsCreationFormSubmit:E?(a,l)=>{const t=lt(a);t.length!==0&&(e(dt(t)),e(ct({sourceChatSessionId:d??void 0})),d!=null&&e(J({chatSessionId:d,id:W(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(j(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:P?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:P?(a,l)=>{const t=je({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:W(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:P?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:P?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),F=re.pageTitle,Tt=le.pageTitle,Ft=re.chatHeaderSubtitle,Ot=le.chatHeaderSubtitle,Xt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=Ae(),s=Ie(),h=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:C}=Te(),{isFeatureEnabled:E}=C(z.isAiCardCreationEnabled),{isFeatureEnabled:P}=C(z.isCardPolicyEnabled);i.useEffect(()=>{s(Ne())},[s]),i.useEffect(()=>(s(Be()),s(X()),s(He("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>qe(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(We(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(X(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const O=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Fe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>ze(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:U,isUploadPromoVisible:v}=Oe({isFileUploadEnabled:e,tenantEmailDomain:p}),y=c.state,S=y?.aiCfoInitialQuestion??null,_=!!y?.aiCfoShouldSubmit,I=y?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:F,subtitle:I?Ot:Ft}),[I]),[ue,x]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||S==null||S===""||(x(S),Q(_),D.current=!0)},[S,_]);const fe=i.useCallback(()=>{x(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,A=i.useRef(null);i.useEffect(()=>{if(g&&A.current!=null){const{question:o,shouldSubmit:w}=A.current;A.current=null,x(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=Ue(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,N=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",B=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),H=u.allSessionsWithOrderedQuestionAnswers,q=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,he=i.useMemo(()=>q.map(o=>o.user).filter(o=>o!=null),[q]),{currentSessionQuestionAnswers:Ce}=ee(H,n),Se=Ce.length===0;i.useEffect(()=>{n!=null&&l!==n&&h(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,h,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Xe({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,ye)=>ye.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ye())},[L,$,s]),i.useEffect(()=>{n!=null&&N!=="In-Progress"&&B&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[N,B,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",Pe=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(_t,{children:[b.jsx(_e,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(At,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:H,allUsers:he,isAiCardCreationEnabled:E,isCardPolicyEnabled:P,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:h,sessionFromUrl:be,location:c,isSubmitting:Pe,isEmptyChatWithSession:Se,customPageTitle:F,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:v,onUploadPromoClose:U,onCardPolicyVendorSearchTextChange:O,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:F,onCloseClick:()=>{h(I?ie(p):j(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(S!=null&&S!==""&&(A.current={question:S,shouldSubmit:_}),s(Y(t.userRoleId)))}}),b.jsx(yt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:xt,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(Ut,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:F,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Y(t.userRoleId)),d(!1)}})})})]})},Ut=R(wt)`
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-GsPfxkQ7.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as At,n as De,t as yn,o as as,p as se}from"./core-wjM80qIn.js";import{bs as Pe,Rp as ts,Rq as ns,fP as ln,Rr as In,fI as kn,Rs as En,Rt as An,Ru as Dn,Rv as _n,fJ as Pn,fK as wn,Rw as vn,g4 as Tn,g5 as $a,Rx as Fn,Ry as rs,fO as ss,fN as cs,Rz as os,g7 as Rn,g8 as sa,RA as is,RB as ds,fR as ls,fQ as us,RC as xn,hF as Qe,g3 as Bn,g2 as Ln,RD as ms,eY as Cs,Bl as ps,Bk as hs,Bo as fs,Bq as gs,f2 as bs,eV as On,RE as Ss,RF as ys,f7 as Un,RG as Is,f8 as jn,Bw as ks,Bt as Es,eW as fe,RH as Qa,fb as we,fc as ve,fd as Te,gu as ca,cw as oa,RI as ia,RJ as Dt,uD as za,kA as Ya,RK as Za,C2 as ka,C4 as qe,C5 as _t,kq as Mn,RL as da,BS as _a,RM as As,RN as Ds,BV as Ja,RO as _s,PJ as Xa,e_ as Nn,B$ as ga,hQ as Ps,RP as Vn,RQ as la,bq as ws,RR as vs,gf as et,ge as at,Cz as Ts,gd as tt,Pp as Fs,RS as Hn,cp as Gn,cR as Rs,PI as wa,D8 as $n,RT as un,CK as Pa,RU as zn,D9 as xs,Q9 as Bs,Da as Ls,E6 as Os,t_ as Us,E0 as js,RV as Ms,C3 as na,RW as Ns,RX as Vs,RY as Hs,RZ as Gs,R_ as $s,R$ as Pt,S0 as zs,Ck as Yn,Cd as Ys,S1 as Zs,gw as Ks,Ct as Zn,Cx as Kn,gv as Ws,S2 as qs,CW as Wn,S3 as Qs,S4 as Js,S5 as Xs,Cv as qn,Cg as Qn,BY as Jn,Cp as Xn,Cn as er,Cr as ec,S6 as ar,S7 as ac,f4 as tc,f5 as nc,f6 as rc,S8 as nt,g9 as tr,cS as wt,S9 as sc,Sa as cc,Sb as oc,Sc as ic,CF as St,D1 as dc,CZ as lc,CB as uc,C$ as mc,CR as Cc,CT as pc,Sd as nr,D7 as Ga,JR as hc,Se as fc,Sf as gc,Sg as bc,Sh as rr,Si as Sc,Du as yc,CJ as sr,CE as je,CI as Ic,Sj as kc,Sk as Ec,BP as Ac,Sl as cr,eZ as or,Sm as Dc,BR as _c,BQ as mn,Sn as Pc,So as wc,Sp as vc,Mm as Tc,Sq as vt,Sr as Fc,xD as ir,l8 as Rc,hG as xc,Dz as Bc,Ss as dr,fV as Lc,fW as Oc,St as Uc,di as jc,g6 as Mc,Dp as Nc,Dj as We,bt as Vc,bJ as Hc,cB as Gc,bK as $c,Lz as zc}from"./zeni-epic-state-DrcliB1J.js";import{j as Fe,cm as lr,p as _e,cn as ur,co as mr,cp as Yc,D as ua,_ as Tt,cq as Zc,cr as Kc,X as Cr,a as pr,Z as hr,n as ye,N as le,f as K,aq as ya,cs as fr,ct as Wc,cu as qc,z as re,B as va,cb as rt,cv as Qc,cw as Jc,cx as Xc,cy as eo,cz as ao,K as Ta,aN as ze,bo as Ft,cA as to,w as Fa,h as st,m as Rt,c as J,a7 as ct,cB as no,bB as ba,cC as yt,cD as ro,s as xt,cE as so,at as gr,a2 as It,cF as co,Y as br,e as Sr,cG as oo,cH as io,cI as lo,cJ as uo,cK as mo,cL as Co,o as Ka,cM as po,cN as ho,cO as pt,R as fo,cP as go,cQ as bo,cR as So,cS as yo,cT as Io,a9 as ko}from"./index-Det3Ki3b.js";import{n as Ne,D as yr,S as Eo}from"./mui-BSDa87ap.js";import{a as r}from"./sentry-B2TzMFx9.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-BXGcqvyl.js";import{M as Ie}from"./MobileAppDrawer-D6Fu3M_x.js";import{d as Bt}from"./recharts-D4VpFd5q.js";import{g as Ae,a as xa,b as Ir,c as Re,d as xe,e as Je,f as Xe,h as ea,A as Ao,i as Lt,P as Do,j as Ot,s as Ia,k as kr,l as ra,m as Er,n as _o,o as Ar,p as Po,S as Cn}from"./SetupPagesScreen-Djxd17id.js";import{u as Dr}from"./useInitialThreadRequest-D9NRPlO5.js";import ot from"./NotFoundScreen-_JeeXwwE.js";import{n as pn}from"./utils-BwzhiOdE.js";import{t as wo}from"./AddressScreen-BdkkfpOD.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./analyticsHelper-DaDCazpC.js";import"./routePaths-CbGdb8gZ.js";import"./BusinessVerificationPageScreen-BvxrLE03.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]="fecaac05-5193-44ba-8ae6-6ccce39eeb7c",e._sentryDebugIdIdentifier="sentry-dbid-fecaac05-5193-44ba-8ae6-6ccce39eeb7c")}catch{}})();const vo=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}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:hn}}}=ua.getLocalizedStrings(),To=e=>Bn(e,!1),Fo=e=>Ln(e.name,!1);function Ro(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(v=>{g(v)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=Ra({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(ln())},[a]);const D=o(v=>In(v.cardPolicyState)),d=o(v=>kn(v.cardPolicyState)),j=o(v=>En(v.cardPolicyState)),P=o(v=>An(v.cardPolicyState)),B=o(v=>Dn(v.cardPolicyState)),p=o(v=>_n(v.cardPolicyState)),h=o(v=>Pn(v.cardPolicyState)),w=o(v=>wn(v.cardPolicyState)),u=o(v=>vn(v.cardPolicyState)),T=o(v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(v=>v.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Tn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(v=>Fn(v.createCardPolicyState)),A=o(v=>rs(v.createCardPolicyState)),y=o(v=>ss(v.cardPolicyState)),L=o(v=>cs(v.cardPolicyState)),l=o(v=>os(v.createCardPolicyState)),C=o(v=>Rn(v));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(sa(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>d.map(To),[d]),G=r.useMemo(()=>h.map(Fo),[h]),O=r.useMemo(()=>C.cards.filter(v=>!lr(v.status.code)).map(_r),[C.cards]),U=D==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(is({cardsMasterList:O,defaultRequireReceiptAmount:T,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,l,O,T,j,P,B,p]);const z=r.useMemo(()=>Bt(v=>{a($a(v))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Y=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Z=r.useCallback(()=>{const v=_e(n.state?.pathnameStackToGoBack),ee=v.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:v.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(v=>{a(ds(v))},[a]),V=r.useCallback(v=>{const ee=ur(v);a(ls({templates:[ee]}))},[a]),Q=r.useCallback(v=>{v.length!==0&&a(us(v))},[a]),X=r.useCallback(()=>{a(ln())},[a]),S=r.useRef(I);r.useEffect(()=>{const v=S.current;S.current=I,I==="Completed"&&v!=="Completed"&&A!=null&&(a(xn()),a(Qe({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,I,A,e,x]);const F=I==="Error"?M.error?.message??hn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:hn.createPageTitle,onBackClick:Z,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Yc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Y,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Z,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=ua.getLocalizedStrings(),Bo=e=>Bn(e,!1),Lo=e=>Ln(e.name,!1);function Oo(){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(F=>{_(F)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:D}=Ra({mobileExploreReferrer:"Card Policy"}),d=o(F=>ms(F)),j=o(F=>In(F.cardPolicyState)),P=o(F=>kn(F.cardPolicyState)),B=o(F=>En(F.cardPolicyState)),p=o(F=>An(F.cardPolicyState)),h=o(F=>Dn(F.cardPolicyState)),w=o(F=>_n(F.cardPolicyState)),u=o(F=>Pn(F.cardPolicyState)),T=o(F=>wn(F.cardPolicyState)),k=o(F=>vn(F.cardPolicyState)),M=o(F=>Rn(F)),A=o(F=>a!=null?Cs(F.cardPolicyState,a):void 0),y=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?ps(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=d.detailFetchState.fetchState;d.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(hs(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),r.useEffect(()=>{T==="Completed"&&k===""||T==="In-Progress"||s($a())},[s,T,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(sa(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Bo),[P]),C=r.useMemo(()=>u.map(Lo),[u]),N=r.useMemo(()=>M.cards.filter(F=>!lr(F.status.code)).map(_r),[M.cards]);Tt({isDataReady:y!=null});const G=r.useMemo(()=>{if(y!=null)return Zc({draft:y,cardRows:N,categorySearchOptions:l,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:w})},[y,N,l,C,L,B,p,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 Y=r.useCallback(F=>{U(F)},[]),I=r.useMemo(()=>Bt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{I.cancel()},[I]);const x=r.useCallback(F=>{I(F)},[I]),Z=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),v=F.poppedPathname??q;e(v,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const v=ur(F);s(fs(v)),s(gs(a))},[s,a]),X=r.useRef(Z);r.useEffect(()=>{const F=X.current;X.current=Z,Z==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Z,e,q]);const S=Z==="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(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Z,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Y,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:D})]})}function Pr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function wr(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}}(bs(n,e)),At)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=ua.getLocalizedStrings(),No=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 Vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(I=>{g(I)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=Ra({mobileExploreReferrer:"Card Policy"}),P=o(I=>Ss(I)),B=o(I=>Fn(I.createCardPolicyState)),p=o(I=>ys(I.createCardPolicyState)),h=o(I=>p==null?[]:Un(I.aiCfoState,p).filter(x=>x.kind==="creating_policy"),At),w=B.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(I=>Is(I.createCardPolicyState)),T=ya(B.fetchState);r.useEffect(()=>{T==="In-Progress"&&B.fetchState==="Completed"&&p!=null&&(a(xn()),h.forEach(I=>{a(jn({chatSessionId:p,id:I.id,entityIds:u,kind:"created_policy"}))}))},[B.fetchState,a,p,u,h,T]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ks())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(Qe({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const y=r.useMemo(()=>P.templates.map(No),[P.templates]);Tt({isDataReady:P.fetchState.fetchState==="Completed"});const L=y.length>0||w>0,l=function(I){const{hasAnyPolicies:x,isChargeCardAdmin:Z,isFileUploadEnabled:q}=I,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=Cr(),F=pr(),v=hr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=wr("card_policy"),be=r.useMemo(()=>Pr(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=v&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/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,Q]),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)},[]),Ze=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Z)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ze,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Z,q,ee,ne,Be,Ze,te,Ee,Ye,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:R}),C=D&&l!=null?c.jsx(fr,{...l}):null,N=d&&C==null,G=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),x=I.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),Y=P.fetchState.fetchState;return!L&&Y!=="Completed"&&Y!=="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(qc,{policies:y,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Ho(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),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(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),B=ve(s),p=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Re({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=xe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:B,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>ca(W,s.companyId)),M=oa(k.controllers),{creditAccount:A,creditAccountRepayment:y}=o(W=>ia(W)),L=o(W=>W.classListState.fetchState),l=!R&&u&&d,C=o(W=>Dt(W,n,l,u)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(W=>U!=null?za(W.userRoleState,U):void 0),Y=z?.accountingClassIDs[0],I=o(W=>Y!=null?Ya(W.classState,{classId:Y,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Z=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Z?.accountingClassIDs[0],E=o(W=>q!=null?Ya(W.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Za()),Q&&t(Qe({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.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 W=Ae(s.tenantEmailDomain,n,a,O,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&u&&d&&f&&t(_t()),L!=="Completed"&&L!=="In-Progress"&&t(Mn())},[A.fetchState,y.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Za());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(u,w,T,d),v=xa(u,d,f,A,y),ee=Ir(S,C);return C.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:T,isChargeCardSetupEnabled:d,productInformation:F,creditAccountInformation:v,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Z?.userRoles,cardHolderDepartmentName:E?.className})]})}const Ut=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,R=()=>{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]=Xc(D);if(j==="")return;const P=s.channel(d),B=h=>{b.current(j,h)};let p;if(P?.subscribed===!0)p=P,p.bind(j,B),m.has(d)||(m.add(d),R()),i.push(()=>{P.unbind(j,B)});else{if(p=P??s.subscribe(d),p.bind(j,B),!m.has(d)){m.add(d);const h=()=>{R()};p.bind("pusher:subscription_succeeded",h),i.push(()=>{p.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{p.unbind(j,B)})}}),()=>{i.forEach(D=>D())}},[s,_])},vr="charge-card-transaction-update",Tr="charge-card-transaction-created",Fr="charge-card-transaction-declined",Rr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",jt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Mt="charge-card-limit-updated",Nt="charge-card-limit-reset",Vt="charge-card-renamed",Go="charge-card-department-updated",Br="charge-card-repayment-completed",Lr="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}`),$o=[La,Ba],zo=De(function(e){const n=da(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Yo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>da(j)),m=Dr(s.companyId,{clearParams:i.fetchState==="Completed"}),R=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=Xe(s);if(Ut({events:Ca(D,$o),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(zo,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(eo,{onBackClick:R})}const Zo=e=>`/${e}/cards`,Ko={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),[R,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 B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,w=o(E=>Ds(E,s)),u=w.chargeCard,T=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),y=Te(A,B),L=Re({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:y}),l=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=xe({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&l;r.useEffect(()=>{g===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,T]);const Y=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Y===!1||Y&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,R,w.isRefreshingViewInBackground]);const I=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Nn(E.userState,P.userId)),Z=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Z,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(T!=="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(qo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:Ft(),chargeCardDetailState:w,signedInUserToken:I,navigate:a,currentTenant:B,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=Ps(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Vn(e,s),g=n.updateStatus,_=la(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(ws())||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(Ts(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(vs({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?ea(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(to),Qo=Ne.div`
1
+ import{j as c}from"./liveblocks-GsPfxkQ7.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as At,n as De,t as yn,o as as,p as se}from"./core-wjM80qIn.js";import{bs as Pe,Rp as ts,Rq as ns,fP as ln,Rr as In,fI as kn,Rs as En,Rt as An,Ru as Dn,Rv as _n,fJ as Pn,fK as wn,Rw as vn,g4 as Tn,g5 as $a,Rx as Fn,Ry as rs,fO as ss,fN as cs,Rz as os,g7 as Rn,g8 as sa,RA as is,RB as ds,fR as ls,fQ as us,RC as xn,hF as Qe,g3 as Bn,g2 as Ln,RD as ms,eY as Cs,Bl as ps,Bk as hs,Bo as fs,Bq as gs,f2 as bs,eV as On,RE as Ss,RF as ys,f7 as Un,RG as Is,f8 as jn,Bw as ks,Bt as Es,eW as fe,RH as Qa,fb as we,fc as ve,fd as Te,gu as ca,cw as oa,RI as ia,RJ as Dt,uD as za,kA as Ya,RK as Za,C2 as ka,C4 as qe,C5 as _t,kq as Mn,RL as da,BS as _a,RM as As,RN as Ds,BV as Ja,RO as _s,PJ as Xa,e_ as Nn,B$ as ga,hQ as Ps,RP as Vn,RQ as la,bq as ws,RR as vs,gf as et,ge as at,Cz as Ts,gd as tt,Pp as Fs,RS as Hn,cp as Gn,cR as Rs,PI as wa,D8 as $n,RT as un,CK as Pa,RU as zn,D9 as xs,Q9 as Bs,Da as Ls,E6 as Os,t_ as Us,E0 as js,RV as Ms,C3 as na,RW as Ns,RX as Vs,RY as Hs,RZ as Gs,R_ as $s,R$ as Pt,S0 as zs,Ck as Yn,Cd as Ys,S1 as Zs,gw as Ks,Ct as Zn,Cx as Kn,gv as Ws,S2 as qs,CW as Wn,S3 as Qs,S4 as Js,S5 as Xs,Cv as qn,Cg as Qn,BY as Jn,Cp as Xn,Cn as er,Cr as ec,S6 as ar,S7 as ac,f4 as tc,f5 as nc,f6 as rc,S8 as nt,g9 as tr,cS as wt,S9 as sc,Sa as cc,Sb as oc,Sc as ic,CF as St,D1 as dc,CZ as lc,CB as uc,C$ as mc,CR as Cc,CT as pc,Sd as nr,D7 as Ga,JR as hc,Se as fc,Sf as gc,Sg as bc,Sh as rr,Si as Sc,Du as yc,CJ as sr,CE as je,CI as Ic,Sj as kc,Sk as Ec,BP as Ac,Sl as cr,eZ as or,Sm as Dc,BR as _c,BQ as mn,Sn as Pc,So as wc,Sp as vc,Mm as Tc,Sq as vt,Sr as Fc,xD as ir,l8 as Rc,hG as xc,Dz as Bc,Ss as dr,fV as Lc,fW as Oc,St as Uc,di as jc,g6 as Mc,Dp as Nc,Dj as We,bt as Vc,bJ as Hc,cB as Gc,bK as $c,Lz as zc}from"./zeni-epic-state-DrcliB1J.js";import{j as Fe,cm as lr,p as _e,cn as ur,co as mr,cp as Yc,D as ua,_ as Tt,cq as Zc,cr as Kc,X as Cr,a as pr,Z as hr,n as ye,N as le,f as K,aq as ya,cs as fr,ct as Wc,cu as qc,z as re,B as va,cb as rt,cv as Qc,cw as Jc,cx as Xc,cy as eo,cz as ao,K as Ta,aN as ze,bo as Ft,cA as to,w as Fa,h as st,m as Rt,c as J,a7 as ct,cB as no,bB as ba,cC as yt,cD as ro,s as xt,cE as so,at as gr,a2 as It,cF as co,Y as br,e as Sr,cG as oo,cH as io,cI as lo,cJ as uo,cK as mo,cL as Co,o as Ka,cM as po,cN as ho,cO as pt,R as fo,cP as go,cQ as bo,cR as So,cS as yo,cT as Io,a9 as ko}from"./index-CVCyRaz2.js";import{n as Ne,D as yr,S as Eo}from"./mui-BSDa87ap.js";import{a as r}from"./sentry-B2TzMFx9.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-DdDNWlhJ.js";import{M as Ie}from"./MobileAppDrawer-Co1JEy80.js";import{d as Bt}from"./recharts-D4VpFd5q.js";import{g as Ae,a as xa,b as Ir,c as Re,d as xe,e as Je,f as Xe,h as ea,A as Ao,i as Lt,P as Do,j as Ot,s as Ia,k as kr,l as ra,m as Er,n as _o,o as Ar,p as Po,S as Cn}from"./SetupPagesScreen-CYV12QsA.js";import{u as Dr}from"./useInitialThreadRequest-CCHKjkJV.js";import ot from"./NotFoundScreen-BzCRT55X.js";import{n as pn}from"./utils-BwzhiOdE.js";import{t as wo}from"./AddressScreen-CnWN_Byu.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./analyticsHelper-CakEIbyY.js";import"./routePaths-BYsH7YxB.js";import"./BusinessVerificationPageScreen-CQCM86dl.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]="fecaac05-5193-44ba-8ae6-6ccce39eeb7c",e._sentryDebugIdIdentifier="sentry-dbid-fecaac05-5193-44ba-8ae6-6ccce39eeb7c")}catch{}})();const vo=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}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:hn}}}=ua.getLocalizedStrings(),To=e=>Bn(e,!1),Fo=e=>Ln(e.name,!1);function Ro(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(v=>{g(v)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=Ra({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(ln())},[a]);const D=o(v=>In(v.cardPolicyState)),d=o(v=>kn(v.cardPolicyState)),j=o(v=>En(v.cardPolicyState)),P=o(v=>An(v.cardPolicyState)),B=o(v=>Dn(v.cardPolicyState)),p=o(v=>_n(v.cardPolicyState)),h=o(v=>Pn(v.cardPolicyState)),w=o(v=>wn(v.cardPolicyState)),u=o(v=>vn(v.cardPolicyState)),T=o(v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(v=>v.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Tn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(v=>Fn(v.createCardPolicyState)),A=o(v=>rs(v.createCardPolicyState)),y=o(v=>ss(v.cardPolicyState)),L=o(v=>cs(v.cardPolicyState)),l=o(v=>os(v.createCardPolicyState)),C=o(v=>Rn(v));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(sa(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>d.map(To),[d]),G=r.useMemo(()=>h.map(Fo),[h]),O=r.useMemo(()=>C.cards.filter(v=>!lr(v.status.code)).map(_r),[C.cards]),U=D==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(is({cardsMasterList:O,defaultRequireReceiptAmount:T,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,l,O,T,j,P,B,p]);const z=r.useMemo(()=>Bt(v=>{a($a(v))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Y=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Z=r.useCallback(()=>{const v=_e(n.state?.pathnameStackToGoBack),ee=v.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:v.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(v=>{a(ds(v))},[a]),V=r.useCallback(v=>{const ee=ur(v);a(ls({templates:[ee]}))},[a]),Q=r.useCallback(v=>{v.length!==0&&a(us(v))},[a]),X=r.useCallback(()=>{a(ln())},[a]),S=r.useRef(I);r.useEffect(()=>{const v=S.current;S.current=I,I==="Completed"&&v!=="Completed"&&A!=null&&(a(xn()),a(Qe({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,I,A,e,x]);const F=I==="Error"?M.error?.message??hn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:hn.createPageTitle,onBackClick:Z,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Yc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Y,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Z,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=ua.getLocalizedStrings(),Bo=e=>Bn(e,!1),Lo=e=>Ln(e.name,!1);function Oo(){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(F=>{_(F)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:D}=Ra({mobileExploreReferrer:"Card Policy"}),d=o(F=>ms(F)),j=o(F=>In(F.cardPolicyState)),P=o(F=>kn(F.cardPolicyState)),B=o(F=>En(F.cardPolicyState)),p=o(F=>An(F.cardPolicyState)),h=o(F=>Dn(F.cardPolicyState)),w=o(F=>_n(F.cardPolicyState)),u=o(F=>Pn(F.cardPolicyState)),T=o(F=>wn(F.cardPolicyState)),k=o(F=>vn(F.cardPolicyState)),M=o(F=>Rn(F)),A=o(F=>a!=null?Cs(F.cardPolicyState,a):void 0),y=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?ps(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=d.detailFetchState.fetchState;d.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(hs(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),r.useEffect(()=>{T==="Completed"&&k===""||T==="In-Progress"||s($a())},[s,T,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(sa(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Bo),[P]),C=r.useMemo(()=>u.map(Lo),[u]),N=r.useMemo(()=>M.cards.filter(F=>!lr(F.status.code)).map(_r),[M.cards]);Tt({isDataReady:y!=null});const G=r.useMemo(()=>{if(y!=null)return Zc({draft:y,cardRows:N,categorySearchOptions:l,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:w})},[y,N,l,C,L,B,p,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 Y=r.useCallback(F=>{U(F)},[]),I=r.useMemo(()=>Bt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{I.cancel()},[I]);const x=r.useCallback(F=>{I(F)},[I]),Z=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),v=F.poppedPathname??q;e(v,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const v=ur(F);s(fs(v)),s(gs(a))},[s,a]),X=r.useRef(Z);r.useEffect(()=>{const F=X.current;X.current=Z,Z==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Z,e,q]);const S=Z==="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(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Z,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Y,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:D})]})}function Pr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function wr(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}}(bs(n,e)),At)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=ua.getLocalizedStrings(),No=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 Vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(I=>{g(I)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=Ra({mobileExploreReferrer:"Card Policy"}),P=o(I=>Ss(I)),B=o(I=>Fn(I.createCardPolicyState)),p=o(I=>ys(I.createCardPolicyState)),h=o(I=>p==null?[]:Un(I.aiCfoState,p).filter(x=>x.kind==="creating_policy"),At),w=B.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(I=>Is(I.createCardPolicyState)),T=ya(B.fetchState);r.useEffect(()=>{T==="In-Progress"&&B.fetchState==="Completed"&&p!=null&&(a(xn()),h.forEach(I=>{a(jn({chatSessionId:p,id:I.id,entityIds:u,kind:"created_policy"}))}))},[B.fetchState,a,p,u,h,T]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ks())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(Qe({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const y=r.useMemo(()=>P.templates.map(No),[P.templates]);Tt({isDataReady:P.fetchState.fetchState==="Completed"});const L=y.length>0||w>0,l=function(I){const{hasAnyPolicies:x,isChargeCardAdmin:Z,isFileUploadEnabled:q}=I,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=Cr(),F=pr(),v=hr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=wr("card_policy"),be=r.useMemo(()=>Pr(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=v&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/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,Q]),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)},[]),Ze=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Z)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ze,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Z,q,ee,ne,Be,Ze,te,Ee,Ye,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:R}),C=D&&l!=null?c.jsx(fr,{...l}):null,N=d&&C==null,G=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),x=I.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),Y=P.fetchState.fetchState;return!L&&Y!=="Completed"&&Y!=="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(qc,{policies:y,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Ho(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),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(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),B=ve(s),p=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Re({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=xe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:B,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>ca(W,s.companyId)),M=oa(k.controllers),{creditAccount:A,creditAccountRepayment:y}=o(W=>ia(W)),L=o(W=>W.classListState.fetchState),l=!R&&u&&d,C=o(W=>Dt(W,n,l,u)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(W=>U!=null?za(W.userRoleState,U):void 0),Y=z?.accountingClassIDs[0],I=o(W=>Y!=null?Ya(W.classState,{classId:Y,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Z=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Z?.accountingClassIDs[0],E=o(W=>q!=null?Ya(W.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Za()),Q&&t(Qe({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.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 W=Ae(s.tenantEmailDomain,n,a,O,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&u&&d&&f&&t(_t()),L!=="Completed"&&L!=="In-Progress"&&t(Mn())},[A.fetchState,y.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Za());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(u,w,T,d),v=xa(u,d,f,A,y),ee=Ir(S,C);return C.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:T,isChargeCardSetupEnabled:d,productInformation:F,creditAccountInformation:v,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Z?.userRoles,cardHolderDepartmentName:E?.className})]})}const Ut=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,R=()=>{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]=Xc(D);if(j==="")return;const P=s.channel(d),B=h=>{b.current(j,h)};let p;if(P?.subscribed===!0)p=P,p.bind(j,B),m.has(d)||(m.add(d),R()),i.push(()=>{P.unbind(j,B)});else{if(p=P??s.subscribe(d),p.bind(j,B),!m.has(d)){m.add(d);const h=()=>{R()};p.bind("pusher:subscription_succeeded",h),i.push(()=>{p.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{p.unbind(j,B)})}}),()=>{i.forEach(D=>D())}},[s,_])},vr="charge-card-transaction-update",Tr="charge-card-transaction-created",Fr="charge-card-transaction-declined",Rr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",jt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Mt="charge-card-limit-updated",Nt="charge-card-limit-reset",Vt="charge-card-renamed",Go="charge-card-department-updated",Br="charge-card-repayment-completed",Lr="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}`),$o=[La,Ba],zo=De(function(e){const n=da(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Yo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>da(j)),m=Dr(s.companyId,{clearParams:i.fetchState==="Completed"}),R=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=Xe(s);if(Ut({events:Ca(D,$o),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(zo,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(eo,{onBackClick:R})}const Zo=e=>`/${e}/cards`,Ko={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),[R,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 B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,w=o(E=>Ds(E,s)),u=w.chargeCard,T=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),y=Te(A,B),L=Re({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:y}),l=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=xe({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&l;r.useEffect(()=>{g===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,T]);const Y=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Y===!1||Y&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,R,w.isRefreshingViewInBackground]);const I=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Nn(E.userState,P.userId)),Z=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Z,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(T!=="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(qo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:Ft(),chargeCardDetailState:w,signedInUserToken:I,navigate:a,currentTenant:B,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=Ps(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Vn(e,s),g=n.updateStatus,_=la(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(ws())||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(Ts(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(vs({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?ea(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(to),Qo=Ne.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${Ko.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-GsPfxkQ7.js";import{a as g}from"./sentry-B2TzMFx9.js";import{h as w,u as x,g as T,i as k,j as S,n as E}from"./core-wjM80qIn.js";import{z as C,b9 as P,s as F,c as V,e as L,af as b,ba as j,at as A,au as U,n as B}from"./index-Det3Ki3b.js";import{eW as h,gh as M,tp as _,gc as z,c7 as R,OO as G,bn as Y,ry as H,rm as W,l0 as Z,mB as O,OP as $,bE as q,cz as N,mL as J,mO as K}from"./zeni-epic-state-DrcliB1J.js";import"./mui-BSDa87ap.js";import{d as Q}from"./routePaths-CbGdb8gZ.js";import{M as X}from"./MobileAppDrawer-D6Fu3M_x.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]="230f0e1b-b0c5-42c3-92ba-f87dc0782174",t._sentryDebugIdIdentifier="sentry-dbid-230f0e1b-b0c5-42c3-92ba-f87dc0782174")}catch{}})();const ee=E(function(t){const a=z(t),i=C.getSignedInUser(),p=h(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:`${A.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(O({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(O({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(O({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t($(e))},onCompanyOfficerUpdated:e=>{t(O({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Z({files:e}))},onDeleteFile:e=>{t(W(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}})(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=S(s=>s.companyViewState.passportView.fetchState),o=S(s=>s.companyConfigState.fetchState),r=S(s=>h(s)),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(L.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-GsPfxkQ7.js";import{a as g}from"./sentry-B2TzMFx9.js";import{h as w,u as x,g as T,i as k,j as S,n as E}from"./core-wjM80qIn.js";import{z as C,b9 as P,s as F,c as V,e as L,af as b,ba as j,at as A,au as U,n as B}from"./index-CVCyRaz2.js";import{eW as h,gh as M,tp as _,gc as z,c7 as R,OO as G,bn as Y,ry as H,rm as W,l0 as Z,mB as O,OP as $,bE as q,cz as N,mL as J,mO as K}from"./zeni-epic-state-DrcliB1J.js";import"./mui-BSDa87ap.js";import{d as Q}from"./routePaths-BYsH7YxB.js";import{M as X}from"./MobileAppDrawer-Co1JEy80.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]="230f0e1b-b0c5-42c3-92ba-f87dc0782174",t._sentryDebugIdIdentifier="sentry-dbid-230f0e1b-b0c5-42c3-92ba-f87dc0782174")}catch{}})();const ee=E(function(t){const a=z(t),i=C.getSignedInUser(),p=h(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:`${A.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(O({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(O({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(O({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{t($(e))},onCompanyOfficerUpdated:e=>{t(O({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{t(Z({files:e}))},onDeleteFile:e=>{t(W(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}})(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=S(s=>s.companyViewState.passportView.fetchState),o=S(s=>s.companyConfigState.fetchState),r=S(s=>h(s)),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(L.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as I}from"./liveblocks-GsPfxkQ7.js";import{a}from"./sentry-B2TzMFx9.js";import{u as D,g as v,j as c,N as w}from"./core-wjM80qIn.js";import{Lv as A,eW as L,fD as O,o5 as _,gq as E,fC as j,f9 as U,LC as F}from"./zeni-epic-state-DrcliB1J.js";import{u as $,z as m,L as g,D as k,o as H}from"./index-Det3Ki3b.js";import{n as z}from"./mui-BSDa87ap.js";import{t as R}from"./getLocaleForTenant-yX1iEbj2.js";import{g as P,Q as q}from"./QBOConnectionScreen-CL_uJ9x0.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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]="851e4cbe-bb9d-4279-b313-c553cdbdea90",t._sentryDebugIdIdentifier="sentry-dbid-851e4cbe-bb9d-4279-b313-c553cdbdea90")}catch{}})();const G=z.div`
1
+ import{j as I}from"./liveblocks-GsPfxkQ7.js";import{a}from"./sentry-B2TzMFx9.js";import{u as D,g as v,j as c,N as w}from"./core-wjM80qIn.js";import{Lv as A,eW as L,fD as O,o5 as _,gq as E,fC as j,f9 as U,LC as F}from"./zeni-epic-state-DrcliB1J.js";import{u as $,z as m,L as g,D as k,o as H}from"./index-CVCyRaz2.js";import{n as z}from"./mui-BSDa87ap.js";import{t as R}from"./getLocaleForTenant-ePVFO9y0.js";import{g as P,Q as q}from"./QBOConnectionScreen-BQDAvDNh.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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]="851e4cbe-bb9d-4279-b313-c553cdbdea90",t._sentryDebugIdIdentifier="sentry-dbid-851e4cbe-bb9d-4279-b313-c553cdbdea90")}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-GsPfxkQ7.js";import{z as n}from"./index-Det3Ki3b.js";import{g as d}from"./QBOConnectionScreen-CL_uJ9x0.js";import"./sentry-B2TzMFx9.js";import{g as p,N as s}from"./core-wjM80qIn.js";import"./zeni-epic-state-DrcliB1J.js";import"./recharts-D4VpFd5q.js";import"./mui-BSDa87ap.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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-GsPfxkQ7.js";import{z as n}from"./index-CVCyRaz2.js";import{g as d}from"./QBOConnectionScreen-BQDAvDNh.js";import"./sentry-B2TzMFx9.js";import{g as p,N as s}from"./core-wjM80qIn.js";import"./zeni-epic-state-DrcliB1J.js";import"./recharts-D4VpFd5q.js";import"./mui-BSDa87ap.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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-GsPfxkQ7.js";import{t as Me,A as Ce}from"./AddressScreen-BdkkfpOD.js";import $e from"./NotFoundScreen-_JeeXwwE.js";import{a as g}from"./sentry-B2TzMFx9.js";import{h as oe,g as se,u as ie,i as re,j as A,N as E,n as ce,l as ze,o as qe,p as z}from"./core-wjM80qIn.js";import{R as de,j as le,z as B,N as ue,m as Qe,f as _,n as V,s as Y,c as N,B as ve,e as J,ap as Ke,K as Ze,aq as ke,h as te,ar as We,as as Ie,o as Ye,at as He,au as Ee,av as Je}from"./index-Det3Ki3b.js";import{bn as Xe,eW as ee,fv as et,fd as pe,fb as me,bt as tt,o3 as at,fr as nt,bS as ot,k4 as ae,k7 as je,L$ as st,bY as it,c7 as ge,tD as fe,to as rt,Mu as X,tE as _e,JU as ct,l8 as Ue,Mv as Ve,Mw as dt,Mx as lt,My as ut,k2 as pt,k5 as mt,tq as Be,tC as gt,bE as xe,cz as ft,tQ as Te,ry as ht,rm as yt,l0 as bt,gf as St,ge as Ct,gd as kt,Mz as It,ti as Et,tR as xt,tU as Tt,tX as Ot,u1 as Pt,cY as Dt}from"./zeni-epic-state-DrcliB1J.js";import{n as he}from"./mui-BSDa87ap.js";import{g as At,h as Ft,q as ne}from"./QBOConnectionScreen-CL_uJ9x0.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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]="8510e3f9-4e94-4f6e-b75a-fb22d0bd4515",t._sentryDebugIdIdentifier="sentry-dbid-8510e3f9-4e94-4f6e-b75a-fb22d0bd4515")}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,b]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),f=Xe(i),{useFeatureGate:m}=ue(),I=Qe(),{isFeatureEnabled:x}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:k}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),M=C||U&&f,c=A(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=A(l=>l.onboardingCustomerViewState.fetchState),S=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),D=[],K=S?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=S?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=S?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=S?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&D.push("top_expenses"),$===!1&&D.push("task_card"),j===!1&&D.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&D.push("reimbursement_card","reimbursement_promo_card"),k===!1&&D.push("zeni_accounts_promo_card"),h===!1&&D.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,D)))},[d,O,v,P,i,c.tenantId,s]),g.useEffect(()=>{(v||P)&&setTimeout(()=>{b(!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(Y,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(J.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard:h,isExpenseAutomationEnabledForUser:M,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(ve,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Oe=he.div`
1
+ import{j as a}from"./liveblocks-GsPfxkQ7.js";import{t as Me,A as Ce}from"./AddressScreen-CnWN_Byu.js";import $e from"./NotFoundScreen-BzCRT55X.js";import{a as g}from"./sentry-B2TzMFx9.js";import{h as oe,g as se,u as ie,i as re,j as A,N as E,n as ce,l as ze,o as qe,p as z}from"./core-wjM80qIn.js";import{R as de,j as le,z as B,N as ue,m as Qe,f as _,n as V,s as Y,c as N,B as ve,e as J,ap as Ke,K as Ze,aq as ke,h as te,ar as We,as as Ie,o as Ye,at as He,au as Ee,av as Je}from"./index-CVCyRaz2.js";import{bn as Xe,eW as ee,fv as et,fd as pe,fb as me,bt as tt,o3 as at,fr as nt,bS as ot,k4 as ae,k7 as je,L$ as st,bY as it,c7 as ge,tD as fe,to as rt,Mu as X,tE as _e,JU as ct,l8 as Ue,Mv as Ve,Mw as dt,Mx as lt,My as ut,k2 as pt,k5 as mt,tq as Be,tC as gt,bE as xe,cz as ft,tQ as Te,ry as ht,rm as yt,l0 as bt,gf as St,ge as Ct,gd as kt,Mz as It,ti as Et,tR as xt,tU as Tt,tX as Ot,u1 as Pt,cY as Dt}from"./zeni-epic-state-DrcliB1J.js";import{n as he}from"./mui-BSDa87ap.js";import{g as At,h as Ft,q as ne}from"./QBOConnectionScreen-BQDAvDNh.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./empty-CUF5cU17.js";import"./pdf-lib-BR9HrRu8.js";import"./index-D3VvkPFN.js";import"./url-CcjxrMLZ.js";import"./index-DypTJFR1.js";import"./decodeURIComponentSafe-4aj60Fs2.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]="8510e3f9-4e94-4f6e-b75a-fb22d0bd4515",t._sentryDebugIdIdentifier="sentry-dbid-8510e3f9-4e94-4f6e-b75a-fb22d0bd4515")}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,b]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),f=Xe(i),{useFeatureGate:m}=ue(),I=Qe(),{isFeatureEnabled:x}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:k}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),M=C||U&&f,c=A(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=A(l=>l.onboardingCustomerViewState.fetchState),S=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),D=[],K=S?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=S?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=S?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=S?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&D.push("top_expenses"),$===!1&&D.push("task_card"),j===!1&&D.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&D.push("reimbursement_card","reimbursement_promo_card"),k===!1&&D.push("zeni_accounts_promo_card"),h===!1&&D.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,D)))},[d,O,v,P,i,c.tenantId,s]),g.useEffect(()=>{(v||P)&&setTimeout(()=>{b(!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(Y,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(J.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard:h,isExpenseAutomationEnabledForUser:M,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(ve,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Oe=he.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-GsPfxkQ7.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-wjM80qIn.js";import{eW as U,MP as Xe,bE as la,bq as Oe,O0 as Pn,iW as Fn,O1 as Zt,O2 as Rn,iZ as kt,O3 as Qe,O4 as Bn,j2 as jn,O5 as Qt,O6 as Mn,j6 as St,O7 as He,O8 as Ln,cp as At,O9 as Un,Oa as Gn,N7 as Vn,j_ as Yn,Ob as Nn,bn as Ge,Oc as da,MD as ie,bc as ua,kc as ma,od as pa,jX as ha,MF as ce,ME as ee,eV as fa,f2 as $n,fF as _t,Od as zn,Oe as Kn,Of as ga,Og as Be,vC as Ve,vD as Ye,v_ as De,vU as le,vH as Ne,Oh as qn,Oi as Zn,Oj as Qn,Ok as ba,Ol as je,Om as Hn,dJ as Je,s6 as Ca,On as Wn,Oo as Xn,Op as Jn,Oq as vt,M1 as It,ks as xe,w6 as Et,se as eo,Or as to,vE as Ht,s9 as Ee,s5 as ka,Os as ge,Ot as ao,Ou as Tt,M0 as Ot,u5 as Sa,Ov as no,Ow as oo,Ox as so,Oy as Dt,ui as ro,Oz as io,vG as Wt,u4 as _a,OA as be,OB as co,bt as ya,wa as Aa,OC as lo,OD as uo,OE as mo,OF as xt,w5 as po,OG as ho,vF as Xt,w9 as va,OH as Ce,OI as fo,OJ as go,OK as Ia,kh as Ea,oa as Ta,km as Oa,o8 as Da,o7 as xa,o6 as wa,tt as bo,fv as Co,cS as ko,cT as So,o3 as _o,fr as yo,ok as Ao,Gd as ut,G5 as vo,G9 as Io,OL as Eo,OM as To,ON as Oo,b5 as et,fj as Do,hD as xo,gh as wo,oe as Po,jQ as Fo,ob as Ro,o9 as Bo,fd as jo,fb as Mo}from"./zeni-epic-state-DrcliB1J.js";import{z as M,a2 as ae,n as D,c as O,D as q,aV as Lo,_ as $e,s as ze,aW as Pa,e as N,aX as Uo,j as Se,aY as Fa,N as _e,f as R,m as Go,aZ as Vo,a_ as Yo,X as Ra,K as Ba,a as ja,Z as No,a$ as $o,V 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,p as Qo,Y as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-Det3Ki3b.js";import{n as wt}from"./mui-BSDa87ap.js";import{a as b}from"./sentry-B2TzMFx9.js";import{w as Va}from"./withTransactionSidePanel-D8vEjelm.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-CbGdb8gZ.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-BXGcqvyl.js";import Ue from"./NotFoundScreen-_JeeXwwE.js";import{u as Ft}from"./useInitialThreadRequest-D9NRPlO5.js";import{t as Na}from"./analyticsHelper-DaDCazpC.js";import{C as as}from"./CompanyPassportScreen-CuQ-1lmT.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-D8RjKLM8.js";import{F as os}from"./FeaturePreviewScreen-CeZNu_Vi.js";import{R as ss}from"./ReferralListScreen-Cb-o7kTE.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./TransactionDetailScreen-s_jEo2WG.js";import"./decodeURIComponentSafe-4aj60Fs2.js";import"./MobileAppDrawer-D6Fu3M_x.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]="58900896-acf4-4052-b02b-3e4ebc247bcf",e._sentryDebugIdIdentifier="sentry-dbid-58900896-acf4-4052-b02b-3e4ebc247bcf")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(A=>A.tenantState.currentTenantId),c=S(A=>U(A)),{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(),v=S(A=>Pn(A,h,o)),I=b.useCallback(()=>{o!=null&&v.fetchState!=="In-Progress"&&v.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((A,B)=>{p(Zt({sortKey:A,sortOrder:B}))},[]),E=b.useCallback(A=>{p(Zt({downloadState:A}))},[]),L=b.useCallback(A=>{if(e)e(A.transactionId,A.transactionType);else if(m!=null){const B=Ya({id:A.transactionId,type:A.transactionType},m);f(B);const X=D(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{v.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),v.vendor.id,v.vendor.name)},[v.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{v.fetchState==="Completed"&&k()},[k,v.fetchState]),d.jsx(Lo,{apAgingDetail:v,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]),v=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:v,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)),v=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,A)=>{h(Qt({sortKey:k,sortOrder:A}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const A=Ya({id:k.transactionId,type:k.transactionType},c);p(A);const B=D(m.state?.pathnameStackToGoBack,m.pathname);p(A,{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(()=>{v()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:v,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:_}))},[]),v=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:v,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=At(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=At(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-GsPfxkQ7.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-wjM80qIn.js";import{eW as U,MP as Xe,bE as la,bq as Oe,O0 as Pn,iW as Fn,O1 as Zt,O2 as Rn,iZ as kt,O3 as Qe,O4 as Bn,j2 as jn,O5 as Qt,O6 as Mn,j6 as St,O7 as He,O8 as Ln,cp as At,O9 as Un,Oa as Gn,N7 as Vn,j_ as Yn,Ob as Nn,bn as Ge,Oc as da,MD as ie,bc as ua,kc as ma,od as pa,jX as ha,MF as ce,ME as ee,eV as fa,f2 as $n,fF as _t,Od as zn,Oe as Kn,Of as ga,Og as Be,vC as Ve,vD as Ye,v_ as De,vU as le,vH as Ne,Oh as qn,Oi as Zn,Oj as Qn,Ok as ba,Ol as je,Om as Hn,dJ as Je,s6 as Ca,On as Wn,Oo as Xn,Op as Jn,Oq as vt,M1 as It,ks as xe,w6 as Et,se as eo,Or as to,vE as Ht,s9 as Ee,s5 as ka,Os as ge,Ot as ao,Ou as Tt,M0 as Ot,u5 as Sa,Ov as no,Ow as oo,Ox as so,Oy as Dt,ui as ro,Oz as io,vG as Wt,u4 as _a,OA as be,OB as co,bt as ya,wa as Aa,OC as lo,OD as uo,OE as mo,OF as xt,w5 as po,OG as ho,vF as Xt,w9 as va,OH as Ce,OI as fo,OJ as go,OK as Ia,kh as Ea,oa as Ta,km as Oa,o8 as Da,o7 as xa,o6 as wa,tt as bo,fv as Co,cS as ko,cT as So,o3 as _o,fr as yo,ok as Ao,Gd as ut,G5 as vo,G9 as Io,OL as Eo,OM as To,ON as Oo,b5 as et,fj as Do,hD as xo,gh as wo,oe as Po,jQ as Fo,ob as Ro,o9 as Bo,fd as jo,fb as Mo}from"./zeni-epic-state-DrcliB1J.js";import{z as M,a2 as ae,n as D,c as O,D as q,aV as Lo,_ as $e,s as ze,aW as Pa,e as N,aX as Uo,j as Se,aY as Fa,N as _e,f as R,m as Go,aZ as Vo,a_ as Yo,X as Ra,K as Ba,a as ja,Z as No,a$ as $o,V 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,p as Qo,Y as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-CVCyRaz2.js";import{n as wt}from"./mui-BSDa87ap.js";import{a as b}from"./sentry-B2TzMFx9.js";import{w as Va}from"./withTransactionSidePanel-CYQhrzsL.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-BYsH7YxB.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-DdDNWlhJ.js";import Ue from"./NotFoundScreen-BzCRT55X.js";import{u as Ft}from"./useInitialThreadRequest-CCHKjkJV.js";import{t as Na}from"./analyticsHelper-CakEIbyY.js";import{C as as}from"./CompanyPassportScreen-C21kd0sW.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-DIXV_4D6.js";import{F as os}from"./FeaturePreviewScreen-DJsA6G2u.js";import{R as ss}from"./ReferralListScreen-dGvD_TyP.js";import"./recharts-D4VpFd5q.js";import"./analytics-BUvTITrb.js";import"./plaid-50YvjniW.js";import"./dnd-BK3JI-SF.js";import"./stripe-DMRn4zHo.js";import"./lottie-C5rIATv6.js";import"./lexical-DcicQSkI.js";import"./pdf-BLNuomMl.js";import"./utils-BwzhiOdE.js";import"./TransactionDetailScreen-Bpr92k5W.js";import"./decodeURIComponentSafe-4aj60Fs2.js";import"./MobileAppDrawer-Co1JEy80.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]="58900896-acf4-4052-b02b-3e4ebc247bcf",e._sentryDebugIdIdentifier="sentry-dbid-58900896-acf4-4052-b02b-3e4ebc247bcf")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(A=>A.tenantState.currentTenantId),c=S(A=>U(A)),{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(),v=S(A=>Pn(A,h,o)),I=b.useCallback(()=>{o!=null&&v.fetchState!=="In-Progress"&&v.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((A,B)=>{p(Zt({sortKey:A,sortOrder:B}))},[]),E=b.useCallback(A=>{p(Zt({downloadState:A}))},[]),L=b.useCallback(A=>{if(e)e(A.transactionId,A.transactionType);else if(m!=null){const B=Ya({id:A.transactionId,type:A.transactionType},m);f(B);const X=D(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{v.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),v.vendor.id,v.vendor.name)},[v.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{v.fetchState==="Completed"&&k()},[k,v.fetchState]),d.jsx(Lo,{apAgingDetail:v,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]),v=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:v,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)),v=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,A)=>{h(Qt({sortKey:k,sortOrder:A}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const A=Ya({id:k.transactionId,type:k.transactionType},c);p(A);const B=D(m.state?.pathnameStackToGoBack,m.pathname);p(A,{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(()=>{v()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:v,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:_}))},[]),v=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:v,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=At(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=At(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%;