@zeniai/web-app-ui 5.1.44-dev → 5.1.44-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 (61) hide show
  1. package/dist/assets/{AddressRoutes-8gRhHPlq.js → AddressRoutes-B61fN_Ku.js} +1 -1
  2. package/dist/assets/{AddressScreen-DPs7jKyd.js → AddressScreen-BF-3RAYM.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-Bp7iBQCF.js → AiCfoScreen-BPdC66wo.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-DwElFGIC.js → BillPayApprovalRoutes-QJ1EpW6M.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CcQHQh3Z.js → BillPayRoutes-Bna0uGqV.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-CRI_zbAG.js → BusinessVerificationPageScreen-0dmMGz8A.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen-Cn4K24os.js → CardsAiCfoScreen-BtSV6YdK.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-D8Tom0l5.js → ChargeCardRoutes-DKr2nu1e.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-DPJK2btv.js → CompanyPassportScreen-BOxFkTz6.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-DDGywryh.js → ConnectionAuthScreen-BYP_nDK9.js} +1 -1
  11. package/dist/assets/{CustomerOnboardingAuthScreen-DnJWeWwh.js → CustomerOnboardingAuthScreen-4HAF86rh.js} +1 -1
  12. package/dist/assets/{CustomerOnboardingRoutes-CAThwW9P.js → CustomerOnboardingRoutes-CxS9lLTl.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-CafL1C3x.js → DashboardRoutes-D2v4ZF_E.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-BDsIXAxj.js → DefaultTenantHome-Dbi3Jzbe.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-DdvB-Hbh.js → DomesticWireDetailScreen-BHpce-fZ.js} +1 -1
  16. package/dist/assets/{DrawerScreen-BMmlRoqi.js → DrawerScreen-QceXJJGv.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-CnMM1wvf.js → EntityDetailRoutes-cFyrvi31.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-V-R3AFJQ.js → ExpenseAutomationRoutes-CUBrIS6y.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-CBC6jNb-.js → FeaturePreviewScreen-AUOPnl37.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-CPP6O7Kt.js → HubSpotOAuthCallbackScreen-IFaSwoId.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-BVmPAQoY.js → MagicLinkRoutes-BIAaZldq.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-COv9DoLZ.js → MagicLinkSignInScreen-BVEM6zNA.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-BpbByRGV.js → MobileAppDrawer-CLztF99b.js} +1 -1
  24. package/dist/assets/{NotFoundScreen-CiwLb5Sm.js → NotFoundScreen-BVW1mHQl.js} +1 -1
  25. package/dist/assets/{NotificationRoutes-DeCoRUH5.js → NotificationRoutes-Bt0oSYPF.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-C5rnSpaM.js → OAuthConsentScreen-86UCYr7M.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-CgREv28H.js → PandLWithForecastRoutes-DDpGKk3b.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-Cvh7SESL.js → PeopleRoutes-Dj-CT0eD.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-DZB5u4lB.js → PerformanceRoutes-DsWM-lYk.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-L9petFDu.js → QBOConnectionScreen-eD76plFQ.js} +1 -1
  31. package/dist/assets/{ReferralListScreen-Cz3Ll36o.js → ReferralListScreen-DxoomfXt.js} +1 -1
  32. package/dist/assets/{ReimbursementApprovalRoutes-DcR9SJt8.js → ReimbursementApprovalRoutes-B7uUwiM0.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BdjIgOOJ.js → ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-BOGqzYA3.js → ReimbursementRoutes-Dh1G5yct.js} +1 -1
  35. package/dist/assets/{ReportsRoutes-tKvN7scu.js → ReportsRoutes-y7MnzGll.js} +1 -1
  36. package/dist/assets/{RewardsRoutes-DUkSJAe0.js → RewardsRoutes-Fh9U07tc.js} +1 -1
  37. package/dist/assets/{ScreenRoutes-DvorYiQN.js → ScreenRoutes-B-k_ZyHL.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-BdrupBKM.js → SettingsRoutes-X4MKf4TH.js} +1 -1
  39. package/dist/assets/{SetupPagesScreen-C1DrVmba.js → SetupPagesScreen-Uer5YsTX.js} +1 -1
  40. package/dist/assets/{SignInScreen-BcivZgMD.js → SignInScreen-BpX_mdSj.js} +1 -1
  41. package/dist/assets/{SignOutScreen-x33X8VDG.js → SignOutScreen-gWOZtfBm.js} +1 -1
  42. package/dist/assets/{TaskListScreen-CKfjqqhC.js → TaskListScreen-CoC_5M60.js} +1 -1
  43. package/dist/assets/{TaskRoutes-BNGauwWr.js → TaskRoutes-DEDS1cCa.js} +1 -1
  44. package/dist/assets/{TransactionDetailRoutes-DoEO9RhU.js → TransactionDetailRoutes-BMVLeepD.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-BabZW4yC.js → TransactionDetailScreen-BOsA-UF4.js} +1 -1
  46. package/dist/assets/{TransactionListRoutes-73dX3i3x.js → TransactionListRoutes-D-o7gV2V.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-BXTQGc91.js → TreasuryRoutes-CzaTrrCq.js} +1 -1
  48. package/dist/assets/{VendorsRoutes-CgVxrKP3.js → VendorsRoutes-CA2szW0j.js} +1 -1
  49. package/dist/assets/{WiseConfirmationScreen-egcHJS2j.js → WiseConfirmationScreen-BcU-8yI5.js} +1 -1
  50. package/dist/assets/{ZeniAccountRoutes-CtmM7uy-.js → ZeniAccountRoutes-B92jFFWR.js} +1 -1
  51. package/dist/assets/{ZeniAccountStatementScreen-BiD6-8br.js → ZeniAccountStatementScreen-Czxe84tm.js} +1 -1
  52. package/dist/assets/{analyticsHelper-BLGte-6z.js → analyticsHelper-DO0i_Ozz.js} +1 -1
  53. package/dist/assets/{getLocaleForTenant-D-xlVXss.js → getLocaleForTenant-B-mnTkE0.js} +1 -1
  54. package/dist/assets/{index-CWDdvACz.js → index-aKhhTDIh.js} +5 -5
  55. package/dist/assets/{routePaths-BrOGk8hR.js → routePaths-DQbleX1q.js} +1 -1
  56. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CRuBS_0m.js → useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js} +1 -1
  57. package/dist/assets/{useAskAiCfoHostNavButtonProps-0ZlblxUj.js → useAskAiCfoHostNavButtonProps-BY9akMo_.js} +1 -1
  58. package/dist/assets/{useInitialThreadRequest-DE3A7e2N.js → useInitialThreadRequest-ClxKOF2S.js} +1 -1
  59. package/dist/assets/{withTransactionSidePanel-3L4TkBmm.js → withTransactionSidePanel-CCFVon-p.js} +1 -1
  60. package/dist/index.html +1 -1
  61. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"./liveblocks-PtDFv95_.js";import{A as d}from"./AddressScreen-DPs7jKyd.js";import i from"./NotFoundScreen-CiwLb5Sm.js";import"./sentry-mCXLUbmc.js";import{o as s,p as r}from"./core-BZimyUuM.js";import"./zeni-epic-state-D1RAQ_Ab.js";import"./recharts-Nefi66IQ.js";import"./index-CWDdvACz.js";import"./mui-BcLZDyi8.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.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-PtDFv95_.js";import{A as d}from"./AddressScreen-BF-3RAYM.js";import i from"./NotFoundScreen-BVW1mHQl.js";import"./sentry-mCXLUbmc.js";import{o as s,p as r}from"./core-BZimyUuM.js";import"./zeni-epic-state-D1RAQ_Ab.js";import"./recharts-Nefi66IQ.js";import"./index-aKhhTDIh.js";import"./mui-BcLZDyi8.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-PtDFv95_.js";import{a as h}from"./sentry-mCXLUbmc.js";import{h as P,u as _,g as j,i as E,j as L,n as B}from"./core-BZimyUuM.js";import{J as M,m as $,z as D,A as K,B as R,v as z,d as C,f as S,$ as F,i as b,p as N}from"./index-CWDdvACz.js";import{LX as w,hM as U,eT as G,LY as O,c3 as V,LZ as q,l5 as H}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as J}from"./mui-BcLZDyi8.js";import X from"./NotFoundScreen-CiwLb5Sm.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]="6ac385b6-b7b6-4107-93e9-4670fc476da3",e._sentryDebugIdIdentifier="sentry-dbid-6ac385b6-b7b6-4107-93e9-4670fc476da3")}catch{}})();const Y=J.div`
1
+ import{j as d}from"./liveblocks-PtDFv95_.js";import{a as h}from"./sentry-mCXLUbmc.js";import{h as P,u as _,g as j,i as E,j as L,n as B}from"./core-BZimyUuM.js";import{J as M,m as $,z as D,A as K,B as R,v as z,d as C,f as S,$ as F,i as b,p as N}from"./index-aKhhTDIh.js";import{LX as w,hM as U,eT as G,LY as O,c3 as V,LZ as q,l5 as H}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as J}from"./mui-BcLZDyi8.js";import X from"./NotFoundScreen-BVW1mHQl.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]="6ac385b6-b7b6-4107-93e9-4670fc476da3",e._sentryDebugIdIdentifier="sentry-dbid-6ac385b6-b7b6-4107-93e9-4670fc476da3")}catch{}})();const Y=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-PtDFv95_.js";import{a as l}from"./sentry-mCXLUbmc.js";import{u as ge,h as Ce,g as Ie,j as Y,i as be,n as ke}from"./core-BZimyUuM.js";import{V as we,z as xe,J as Pe,d2 as ye,d3 as Ee,b6 as J,d4 as Te,b5 as K,p as D,v as L,d as I,d5 as F,d6 as ve,d7 as Qe,a1 as _e,f as Ae,a7 as Oe,d8 as Ue,a2 as je,d9 as Le,da as Fe,q as Be,b1 as De,db as Re}from"./index-CWDdvACz.js";import{gg as Me,eS as ee,eT as Ve,is as Ge,S_ as $e,eZ as Ne,iC as qe,iy as We,eU as B,f4 as ze,fV as He,fy as Ye,fC as X,fW as Je,fX as Xe,fY as Ze,fZ as Ke,f_ as et}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as tt,n as b,S as st,P as ot}from"./mui-BcLZDyi8.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-CRuBS_0m.js";import{p as nt}from"./pathToGoBack-Bmk3vSys.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.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]="acc00ddb-6492-46e1-b8f0-5a8615eb2936",t._sentryDebugIdIdentifier="sentry-dbid-acc00ddb-6492-46e1-b8f0-5a8615eb2936")}catch{}})();const te="chat-response-generated",it=ke(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:`${je}/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:Fe(t),resolveSyntheticAnswerPolicyTile:Le(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:c,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,S)=>{if(e===te&&typeof S.text=="string"&&typeof S.metadata=="object"){const a=S,u=Xe(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:k,currentQuestionAnswerSummary:E}=K(c,o);u!=="answer"?I.trackAICFOChatResponseGenerated(u,k?.question.questionText??"",a.text,o,Re(E,y),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,k?.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(Ke({chatSessionId:a.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,S,a,u)=>{e&&De(t,e,S,h,c,n,u,a)},updateCurrentInput:e=>{t(X(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Je(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??nt(1);p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(X(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&t(Ye());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,S)=>{t(He({questionAnswerId:e,isCollapsed:S}))},onMenuClick:r.onMenuClick}})(Oe(Ue)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,h]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const c=Y(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=be(),S=Pe(),a=_e(S),u=Y(i=>Ve(i)),o=c.uiState.currentChatSessionId,y=u.tenantEmailDomain,{handleUploadPromoClose:k,isUploadPromoVisible:E}=ye({isFileUploadEnabled:t,tenantEmailDomain:y}),T=Ee({currentTenant:u,currentChatSessionId:o,aiCfoView:c}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[J]!==!0)return;h(!0);const g={...i};delete g[J],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=c.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=u.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),U=c.fetchState,j=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=o!=null?c.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(c.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ue}=K(z,o),ce=ue.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=u.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[u.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(()=>{U!=="In-Progress"&&j&&s(qe())},[U,j,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&U==="Completed"&&!j&&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 Se=o!=null&&c.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(L,{analytics:I,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(F,{isTOSAccepted:!1,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{u.userRoleId!=null&&s(B(u.userRoleId))}})})})]});const he=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(L,{analytics:I,onLoad:H}):null,d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>h(!1):void 0,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(L,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>h(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:Se,isEmptyChatWithSession:ce,currentTenant:u,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:E,onUploadPromoClose:k,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ut,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>h(!1),children:d.jsx(Qe,{children:he})}):null]})},Z=b(st)`
1
+ import{j as d}from"./liveblocks-PtDFv95_.js";import{a as l}from"./sentry-mCXLUbmc.js";import{u as ge,h as Ce,g as Ie,j as Y,i as be,n as ke}from"./core-BZimyUuM.js";import{V as we,z as xe,J as Pe,d2 as ye,d3 as Ee,b6 as J,d4 as Te,b5 as K,p as D,v as L,d as I,d5 as F,d6 as ve,d7 as Qe,a1 as _e,f as Ae,a7 as Oe,d8 as Ue,a2 as je,d9 as Le,da as Fe,q as Be,b1 as De,db as Re}from"./index-aKhhTDIh.js";import{gg as Me,eS as ee,eT as Ve,is as Ge,S_ as $e,eZ as Ne,iC as qe,iy as We,eU as B,f4 as ze,fV as He,fy as Ye,fC as X,fW as Je,fX as Xe,fY as Ze,fZ as Ke,f_ as et}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as tt,n as b,S as st,P as ot}from"./mui-BcLZDyi8.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js";import{p as nt}from"./pathToGoBack-Bmk3vSys.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.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]="acc00ddb-6492-46e1-b8f0-5a8615eb2936",t._sentryDebugIdIdentifier="sentry-dbid-acc00ddb-6492-46e1-b8f0-5a8615eb2936")}catch{}})();const te="chat-response-generated",it=ke(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:`${je}/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:Fe(t),resolveSyntheticAnswerPolicyTile:Le(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:c,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,S)=>{if(e===te&&typeof S.text=="string"&&typeof S.metadata=="object"){const a=S,u=Xe(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:k,currentQuestionAnswerSummary:E}=K(c,o);u!=="answer"?I.trackAICFOChatResponseGenerated(u,k?.question.questionText??"",a.text,o,Re(E,y),a.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(a.text,k?.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(Ke({chatSessionId:a.metadata.chat_session_id,responseType:u,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,S,a,u)=>{e&&De(t,e,S,h,c,n,u,a)},updateCurrentInput:e=>{t(X(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Je(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??nt(1);p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(X(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&t(Ye());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,S)=>{t(He({questionAnswerId:e,isCollapsed:S}))},onMenuClick:r.onMenuClick}})(Oe(Ue)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=Ie(),[p,h]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const c=Y(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=be(),S=Pe(),a=_e(S),u=Y(i=>Ve(i)),o=c.uiState.currentChatSessionId,y=u.tenantEmailDomain,{handleUploadPromoClose:k,isUploadPromoVisible:E}=ye({isFileUploadEnabled:t,tenantEmailDomain:y}),T=Ee({currentTenant:u,currentChatSessionId:o,aiCfoView:c}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[J]!==!0)return;h(!0);const g={...i};delete g[J],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=c.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=u.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:N}=Te(o),U=c.fetchState,j=c.uiState.chatSessionsNextPageToken.hasMore||!c.uiState.chatSessionsFirstPageFetched,q=o!=null?c.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(c.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=c.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ue}=K(z,o),ce=ue.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=u.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[u.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(()=>{U!=="In-Progress"&&j&&s(qe())},[U,j,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&U==="Completed"&&!j&&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 Se=o!=null&&c.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(L,{analytics:I,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(F,{isTOSAccepted:!1,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{u.userRoleId!=null&&s(B(u.userRoleId))}})})})]});const he=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(L,{analytics:I,onLoad:H}):null,d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>h(!1):void 0,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(L,{analytics:I,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>h(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:Se,isEmptyChatWithSession:ce,currentTenant:u,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:E,onUploadPromoClose:k,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ut,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:c.masterTOSAcceptanceState,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||u.userRoleId==null||s(B(u.userRoleId)),h(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>h(!1),children:d.jsx(Qe,{children:he})}):null]})},Z=b(st)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{j as l}from"./liveblocks-PtDFv95_.js";import{a as f}from"./sentry-mCXLUbmc.js";import{h as U,g as B,u as T,j as v,N as O,n as j,i as $,o as z,p as h}from"./core-BZimyUuM.js";import{eT as N,Pc as A,OU as b,z7 as I,z1 as F,z5 as w,yW as L,OW as W,yZ as q,z9 as H,z8 as C}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as P,z as k,B as V,a7 as Z,bH as G,af as _,bI as J}from"./index-CWDdvACz.js";import"./mui-BcLZDyi8.js";import{i as K}from"./ReimbursementApprovalRuleDetailScreen-BdjIgOOJ.js";import M from"./NotFoundScreen-CiwLb5Sm.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="51b92233-fdc1-4eee-946f-a340810774ff",e._sentryDebugIdIdentifier="sentry-dbid-51b92233-fdc1-4eee-946f-a340810774ff")}catch{}})();const R="bill-approval-rule-update",Q=j(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:t,location:p}=o;return{onApprovalRulesEventReceived:a=>{a.endsWith(R)&&e(W(!1))},onBackClick:()=>{_(p)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(L(a))},onEditRuleClick:a=>{a!=null?(e(w(a)),t(`./${a}/edit`)):(e(w()),t("./new"))}}})(Z(G)),X=()=>{const e=U(),o=B(),t=T(),[p,a]=f.useState(!1),[u,s]=f.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>N(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(f.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&t(I())},[g]),f.useEffect(()=>{p||n!=="Not-Started"||(a(!0),t(F(!0)))},[p,n,t]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");f.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),t(w())),e("./new"))},[u,r,t]);const y={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${R}`]:[],eventCallback:(i,x,m)=>{i.endsWith(R)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx(O,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...y})},Y=j(function(e,o){const t=b(e),p=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=p==="approval_create"&&t.allApprovalRules.length!==0;let u=t.allApprovalRules.length===0;return o.approvalRuleId&&(u=t.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:a,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(y=>{const i=y.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),x=y.actors.selectedNonUsers.map(S=>{const E=!!K(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(x);g.push({action:y.stepType.selectedOption,actors:m,operator:m.length>1?y.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H())},onSaveRuleSuccess:()=>{t("../")}}})(J);function D(){const e=U(),o=T(),t=B(),{approvalRuleId:p}=$(),a=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=f.useState(!1);if(f.useEffect(()=>{n||(c(!0),o(q(!0)))}),f.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Y,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:t})}function se(){return l.jsxs(z,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(M,{})})]})}export{se as B};
1
+ import{j as l}from"./liveblocks-PtDFv95_.js";import{a as f}from"./sentry-mCXLUbmc.js";import{h as U,g as B,u as T,j as v,N as O,n as j,i as $,o as z,p as h}from"./core-BZimyUuM.js";import{eT as N,Pc as A,OU as b,z7 as I,z1 as F,z5 as w,yW as L,OW as W,yZ as q,z9 as H,z8 as C}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as P,z as k,B as V,a7 as Z,bH as G,af as _,bI as J}from"./index-aKhhTDIh.js";import"./mui-BcLZDyi8.js";import{i as K}from"./ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js";import M from"./NotFoundScreen-BVW1mHQl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="51b92233-fdc1-4eee-946f-a340810774ff",e._sentryDebugIdIdentifier="sentry-dbid-51b92233-fdc1-4eee-946f-a340810774ff")}catch{}})();const R="bill-approval-rule-update",Q=j(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:t,location:p}=o;return{onApprovalRulesEventReceived:a=>{a.endsWith(R)&&e(W(!1))},onBackClick:()=>{_(p)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(L(a))},onEditRuleClick:a=>{a!=null?(e(w(a)),t(`./${a}/edit`)):(e(w()),t("./new"))}}})(Z(G)),X=()=>{const e=U(),o=B(),t=T(),[p,a]=f.useState(!1),[u,s]=f.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>N(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(f.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&t(I())},[g]),f.useEffect(()=>{p||n!=="Not-Started"||(a(!0),t(F(!0)))},[p,n,t]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");f.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),t(w())),e("./new"))},[u,r,t]);const y={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${R}`]:[],eventCallback:(i,x,m)=>{i.endsWith(R)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx(O,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...y})},Y=j(function(e,o){const t=b(e),p=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=p==="approval_create"&&t.allApprovalRules.length!==0;let u=t.allApprovalRules.length===0;return o.approvalRuleId&&(u=t.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:a,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(y=>{const i=y.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),x=y.actors.selectedNonUsers.map(S=>{const E=!!K(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(x);g.push({action:y.stepType.selectedOption,actors:m,operator:m.length>1?y.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H())},onSaveRuleSuccess:()=>{t("../")}}})(J);function D(){const e=U(),o=T(),t=B(),{approvalRuleId:p}=$(),a=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=f.useState(!1);if(f.useEffect(()=>{n||(c(!0),o(q(!0)))}),f.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Y,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:t})}function se(){return l.jsxs(z,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(M,{})})]})}export{se as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-BZimyUuM.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as ya,zS as Sa,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Qa,P5 as Xa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as yn,kQ as Sn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as me,z as V,A as Ie,Y as We,a as le,x as y,aN as xe,B as re,o as x,v as je,d as D,be as Ln,p as z,a2 as qe,q as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,D as _n,aH as Gn,y as Zt,O as Je,N as Ke,bi as Mn,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Xn,br as Yn,bs as ei,I as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-CWDdvACz.js";import{n as O,S as si}from"./mui-BcLZDyi8.js";import{A as dt}from"./AddressScreen-DPs7jKyd.js";import{g as ie,a as Te,i as qt,V as Qe,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-DdvB-Hbh.js";import{a as f}from"./sentry-mCXLUbmc.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-0ZlblxUj.js";import{u as Jt}from"./useInitialThreadRequest-DE3A7e2N.js";import Ee from"./NotFoundScreen-CiwLb5Sm.js";import{D as ui}from"./DrawerScreen-BMmlRoqi.js";import{M as Kt}from"./MobileAppDrawer-BpbByRGV.js";import{F as Qt}from"./FeaturePreviewScreen-CBC6jNb-.js";import{S as Pe}from"./SetupPagesScreen-C1DrVmba.js";import{B as pi}from"./BillPayApprovalRoutes-DwElFGIC.js";import{FallBackRoute as mi}from"./ScreenRoutes-DvorYiQN.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./analyticsHelper-BLGte-6z.js";import"./routePaths-BrOGk8hR.js";import"./BusinessVerificationPageScreen-CRI_zbAG.js";import"./ReimbursementApprovalRuleDetailScreen-BdjIgOOJ.js";import"./getLocaleForTenant-D-xlVXss.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]="69127630-aa3a-46ab-a5b2-488789b947ed",e._sentryDebugIdIdentifier="sentry-dbid-69127630-aa3a-46ab-a5b2-488789b947ed")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.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 n=De(i);n||!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),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;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(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({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),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,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(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},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:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(Sa({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=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),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==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 i==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:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:M,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:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=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-PtDFv95_.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-BZimyUuM.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as ya,zS as Sa,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Qa,P5 as Xa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as yn,kQ as Sn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as me,z as V,A as Ie,Y as We,a as le,x as y,aN as xe,B as re,o as x,v as je,d as D,be as Ln,p as z,a2 as qe,q as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,D as _n,aH as Gn,y as Zt,O as Je,N as Ke,bi as Mn,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Xn,br as Yn,bs as ei,I as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-aKhhTDIh.js";import{n as O,S as si}from"./mui-BcLZDyi8.js";import{A as dt}from"./AddressScreen-BF-3RAYM.js";import{g as ie,a as Te,i as qt,V as Qe,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-BHpce-fZ.js";import{a as f}from"./sentry-mCXLUbmc.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import{u as Jt}from"./useInitialThreadRequest-ClxKOF2S.js";import Ee from"./NotFoundScreen-BVW1mHQl.js";import{D as ui}from"./DrawerScreen-QceXJJGv.js";import{M as Kt}from"./MobileAppDrawer-CLztF99b.js";import{F as Qt}from"./FeaturePreviewScreen-AUOPnl37.js";import{S as Pe}from"./SetupPagesScreen-Uer5YsTX.js";import{B as pi}from"./BillPayApprovalRoutes-QJ1EpW6M.js";import{FallBackRoute as mi}from"./ScreenRoutes-B-k_ZyHL.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./analyticsHelper-DO0i_Ozz.js";import"./routePaths-DQbleX1q.js";import"./BusinessVerificationPageScreen-0dmMGz8A.js";import"./ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js";import"./getLocaleForTenant-B-mnTkE0.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]="69127630-aa3a-46ab-a5b2-488789b947ed",e._sentryDebugIdIdentifier="sentry-dbid-69127630-aa3a-46ab-a5b2-488789b947ed")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.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 n=De(i);n||!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),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;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(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({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),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,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(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},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:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(Sa({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=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),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==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 i==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:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:M,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:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
2
2
  ${i}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],i=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||i)}const pt=O.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as k}from"./liveblocks-PtDFv95_.js";import{a as V}from"./sentry-mCXLUbmc.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-BZimyUuM.js";import{A as ce,a as ue,aN as de,z as E,v as pe,d as z,af as x,f as P,bD as le,at as me,q as B,au as R}from"./index-CWDdvACz.js";import{P0 as fe,eT as G,tm as ye,Jv as Se,zc as ge,Cn as Ie,EY as he,FB as be,GC as Oe,Pn as Te,Po as De,Pp as ke,Pq as Ce,Pr as Ve,LY as we,Op as Ae,M7 as Ne,l5 as ve,gc as _e,gb as Fe,ga as xe,rv as Pe,rm as Ee,rj as ze,kZ as Be,tv as Re,tt as L,bE as M,tH as j,cw as Le}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as Me}from"./mui-BcLZDyi8.js";import{d as U}from"./routePaths-BrOGk8hR.js";import{M as je}from"./MobileAppDrawer-BpbByRGV.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]="4a950a91-6c5e-4ed1-9ef7-88fde851bc7a",e._sentryDebugIdIdentifier="sentry-dbid-4a950a91-6c5e-4ed1-9ef7-88fde851bc7a")}catch{}})();const Ue=Me.div`
1
+ import{j as k}from"./liveblocks-PtDFv95_.js";import{a as V}from"./sentry-mCXLUbmc.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-BZimyUuM.js";import{A as ce,a as ue,aN as de,z as E,v as pe,d as z,af as x,f as P,bD as le,at as me,q as B,au as R}from"./index-aKhhTDIh.js";import{P0 as fe,eT as G,tm as ye,Jv as Se,zc as ge,Cn as Ie,EY as he,FB as be,GC as Oe,Pn as Te,Po as De,Pp as ke,Pq as Ce,Pr as Ve,LY as we,Op as Ae,M7 as Ne,l5 as ve,gc as _e,gb as Fe,ga as xe,rv as Pe,rm as Ee,rj as ze,kZ as Be,tv as Re,tt as L,bE as M,tH as j,cw as Le}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as Me}from"./mui-BcLZDyi8.js";import{d as U}from"./routePaths-DQbleX1q.js";import{M as je}from"./MobileAppDrawer-CLztF99b.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]="4a950a91-6c5e-4ed1-9ef7-88fde851bc7a",e._sentryDebugIdIdentifier="sentry-dbid-4a950a91-6c5e-4ed1-9ef7-88fde851bc7a")}catch{}})();const Ue=Me.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-PtDFv95_.js";import{a as i}from"./sentry-mCXLUbmc.js";import{n as z}from"./utils-C9yOAUzR.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as Ae}from"./core-BZimyUuM.js";import{V as ve,a as Te,x as W,z as Oe,d2 as Ue,d4 as xe,b5 as ee,v as Fe,d as V,d5 as G,dc as _e,O as Qe,f as De,a7 as Le,d8 as $e,a2 as Ve,dd as Re,b1 as He,db as Me}from"./index-CWDdvACz.js";import{gg as je,g1 as Ne,g2 as Y,g3 as qe,fM as te,g4 as Be,g5 as ze,eS as se,eT as We,g6 as Ge,eZ as Ye,iC as Ze,iy as Je,eU as Z,fF as Ke,fG as Xe,fH as et,fI as tt,fJ as st,fK as at,fL as ot,fN as nt,fO as it,fP as J,bE as K,fQ as rt,fR as lt,fS as dt,fT as ct,fU as ut,fV as mt,fy as ft,fC as X,fW as pt,fX as Ct,fY as St,fZ as ht,f_ as gt,f$ as bt,g0 as yt}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as Pt,n as H,P as It,S as wt}from"./mui-BcLZDyi8.js";import{d as Et}from"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.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]="b99f67bb-fdb2-4a54-89b9-eea816b71628",e._sentryDebugIdIdentifier="sentry-dbid-b99f67bb-fdb2-4a54-89b9-eea816b71628")}catch{}})();const kt=e=>yt(e,!1),At=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function R(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const vt=Ae(function(e,r){const s=se(e),C=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Xe(c),S=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:C,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(At),cardPolicyIsVendorSearchLoading:S==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:C,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:S,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,cardPolicyPageContext:k}=r,f=C.tenantEmailDomain,U=s.state?.referrer,u=U===ne?ie(f):R(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=Ct(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:x,currentQuestionAnswer:A,currentQuestionAnswerSummary:P}=ee(S,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,A?.question.questionText??"",t.text,p,Me(P,x),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,A?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,St(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(ht({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&&He(e,a,l,d,S,c,n,t,k)},updateCurrentInput:a=>{e(X(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(X(""))},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:z(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(R(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:y?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:y?(a,l)=>{const t=Re({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:y?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:y?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),O=re.pageTitle,Tt=le.pageTitle,Ot=re.chatHeaderSubtitle,Ut=le.chatHeaderSubtitle,Yt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=ve(),s=Ie(),C=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:S}=Te(),{isFeatureEnabled:E}=S(W.isAiCardCreationEnabled),{isFeatureEnabled:y}=S(W.isCardPolicyEnabled);i.useEffect(()=>{s(je())},[s]),i.useEffect(()=>(s(Ne()),s(Y()),s(qe("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>Be(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(ze(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(Y(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const U=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Oe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>We(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:x,isUploadPromoVisible:A}=Ue({isFileUploadEnabled:e,tenantEmailDomain:p}),P=c.state,h=P?.aiCfoInitialQuestion??null,F=!!P?.aiCfoShouldSubmit,I=P?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:O,subtitle:I?Ut:Ot}),[I]),[ue,_]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||h==null||h===""||(_(h),Q(F),D.current=!0)},[h,F]);const fe=i.useCallback(()=>{_(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,v=i.useRef(null);i.useEffect(()=>{if(g&&v.current!=null){const{question:o,shouldSubmit:w}=v.current;v.current=null,_(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=xe(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,j=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",N=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),q=u.allSessionsWithOrderedQuestionAnswers,B=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,Ce=i.useMemo(()=>B.map(o=>o.user).filter(o=>o!=null),[B]),{currentSessionQuestionAnswers:Se}=ee(q,n),he=Se.length===0;i.useEffect(()=>{n!=null&&l!==n&&C(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,C,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Ye({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,Pe)=>Pe.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ze())},[L,$,s]),i.useEffect(()=>{n!=null&&j!=="In-Progress"&&N&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[j,N,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",ye=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(Ft,{children:[b.jsx(Fe,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(vt,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:q,allUsers:Ce,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:C,sessionFromUrl:be,location:c,isSubmitting:ye,isEmptyChatWithSession:he,customPageTitle:O,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:A,onUploadPromoClose:x,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>{C(I?ie(p):R(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(h!=null&&h!==""&&(v.current={question:h,shouldSubmit:F}),s(Z(t.userRoleId)))}}),b.jsx(Pt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:_t,style:{width:`${_e}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(xt,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Z(t.userRoleId)),d(!1)}})})})]})},xt=H(wt)`
1
+ import{j as b}from"./liveblocks-PtDFv95_.js";import{a as i}from"./sentry-mCXLUbmc.js";import{n as z}from"./utils-C9yOAUzR.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as Ae}from"./core-BZimyUuM.js";import{V as ve,a as Te,x as W,z as Oe,d2 as Ue,d4 as xe,b5 as ee,v as Fe,d as V,d5 as G,dc as _e,O as Qe,f as De,a7 as Le,d8 as $e,a2 as Ve,dd as Re,b1 as He,db as Me}from"./index-aKhhTDIh.js";import{gg as je,g1 as Ne,g2 as Y,g3 as qe,fM as te,g4 as Be,g5 as ze,eS as se,eT as We,g6 as Ge,eZ as Ye,iC as Ze,iy as Je,eU as Z,fF as Ke,fG as Xe,fH as et,fI as tt,fJ as st,fK as at,fL as ot,fN as nt,fO as it,fP as J,bE as K,fQ as rt,fR as lt,fS as dt,fT as ct,fU as ut,fV as mt,fy as ft,fC as X,fW as pt,fX as Ct,fY as St,fZ as ht,f_ as gt,f$ as bt,g0 as yt}from"./zeni-epic-state-D1RAQ_Ab.js";import{D as Pt,n as H,P as It,S as wt}from"./mui-BcLZDyi8.js";import{d as Et}from"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.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]="b99f67bb-fdb2-4a54-89b9-eea816b71628",e._sentryDebugIdIdentifier="sentry-dbid-b99f67bb-fdb2-4a54-89b9-eea816b71628")}catch{}})();const kt=e=>yt(e,!1),At=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function R(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const vt=Ae(function(e,r){const s=se(e),C=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Xe(c),S=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:C,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(At),cardPolicyIsVendorSearchLoading:S==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:C,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:S,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,cardPolicyPageContext:k}=r,f=C.tenantEmailDomain,U=s.state?.referrer,u=U===ne?ie(f):R(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=Ct(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:x,currentQuestionAnswer:A,currentQuestionAnswerSummary:P}=ee(S,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,A?.question.questionText??"",t.text,p,Me(P,x),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,A?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,St(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(ht({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&&He(e,a,l,d,S,c,n,t,k)},updateCurrentInput:a=>{e(X(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(X(""))},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:z(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(R(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:y?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:y?(a,l)=>{const t=Re({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:y?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:y?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),O=re.pageTitle,Tt=le.pageTitle,Ot=re.chatHeaderSubtitle,Ut=le.chatHeaderSubtitle,Yt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=ve(),s=Ie(),C=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:S}=Te(),{isFeatureEnabled:E}=S(W.isAiCardCreationEnabled),{isFeatureEnabled:y}=S(W.isCardPolicyEnabled);i.useEffect(()=>{s(je())},[s]),i.useEffect(()=>(s(Ne()),s(Y()),s(qe("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>Be(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(ze(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(Y(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const U=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Oe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>We(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:x,isUploadPromoVisible:A}=Ue({isFileUploadEnabled:e,tenantEmailDomain:p}),P=c.state,h=P?.aiCfoInitialQuestion??null,F=!!P?.aiCfoShouldSubmit,I=P?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:O,subtitle:I?Ut:Ot}),[I]),[ue,_]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||h==null||h===""||(_(h),Q(F),D.current=!0)},[h,F]);const fe=i.useCallback(()=>{_(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,v=i.useRef(null);i.useEffect(()=>{if(g&&v.current!=null){const{question:o,shouldSubmit:w}=v.current;v.current=null,_(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=xe(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,j=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",N=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),q=u.allSessionsWithOrderedQuestionAnswers,B=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,Ce=i.useMemo(()=>B.map(o=>o.user).filter(o=>o!=null),[B]),{currentSessionQuestionAnswers:Se}=ee(q,n),he=Se.length===0;i.useEffect(()=>{n!=null&&l!==n&&C(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,C,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Ye({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,Pe)=>Pe.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ze())},[L,$,s]),i.useEffect(()=>{n!=null&&j!=="In-Progress"&&N&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[j,N,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",ye=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(Ft,{children:[b.jsx(Fe,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(vt,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:q,allUsers:Ce,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:C,sessionFromUrl:be,location:c,isSubmitting:ye,isEmptyChatWithSession:he,customPageTitle:O,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:A,onUploadPromoClose:x,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>{C(I?ie(p):R(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(h!=null&&h!==""&&(v.current={question:h,shouldSubmit:F}),s(Z(t.userRoleId)))}}),b.jsx(Pt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:_t,style:{width:`${_e}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(xt,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Z(t.userRoleId)),d(!1)}})})})]})},xt=H(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-PtDFv95_.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-BZimyUuM.js";import{bs as Pe,QX as ts,QY as ns,fM as ln,QZ as In,fF as kn,Q_ as En,Q$ as An,R0 as Dn,R1 as _n,fG as Pn,fH as wn,R2 as vn,g1 as Tn,g2 as $a,R3 as Fn,R4 as rs,fL as ss,fK as cs,R5 as os,g4 as Rn,g5 as sa,R6 as is,R7 as ds,fO as ls,fN as us,R8 as xn,hC as Qe,g0 as Bn,f$ as Ln,R9 as ms,eV as Cs,A_ as ps,AZ as hs,B1 as fs,B3 as gs,e$ as bs,eS as On,Ra as Ss,Rb as ys,f4 as Un,Rc as Is,f5 as jn,B9 as ks,B6 as Es,eT as fe,Rd as Qa,f8 as we,f9 as ve,fa as Te,gr as ca,ct as oa,Re as ia,Rf as Dt,uA as za,kx as Za,Rg as Ya,BH as ka,BJ as qe,BK as _t,kn as Mn,Rh as da,Bv as _a,Ri as As,Rj as Ds,By as Ja,Rk as _s,Pk as Xa,eX as Nn,BE as ga,hN as Ps,Rl as Vn,Rm as la,bq as ws,Rn as vs,gc as et,gb as at,Cc as Ts,ga as tt,P0 as Fs,Ro as Hn,cm as Gn,cN as Rs,Pj as wa,CN as $n,Rp as un,Cn as Pa,Rq as zn,CO as xs,PM as Bs,CP as Ls,DL as Os,tX as Us,DF as js,Rr as Ms,BI as na,Rs as Ns,Rt as Vs,Ru as Hs,Rv as Gs,Rw as $s,Rx as Pt,Ry as zs,BZ as Zn,BS as Zs,Rz as Ys,gt as Ks,C6 as Yn,Ca as Kn,gs as Ws,RA as qs,Cz as Wn,RB as Qs,RC as Js,RD as Xs,C8 as qn,BV as Qn,BB as Jn,C2 as Xn,C0 as er,C4 as ec,RE as ar,RF as ac,f1 as tc,f2 as nc,f3 as rc,RG as nt,g6 as tr,cO as wt,RH as sc,RI as cc,RJ as oc,RK as ic,Ci as St,CG as dc,CC as lc,Ce as uc,CE as mc,Cu as Cc,Cw as pc,RL as nr,CM as Ga,Js as hc,RM as fc,RN as gc,RO as bc,RP as rr,RQ as Sc,D7 as yc,Cm as sr,Ch as je,Cl as Ic,RR as kc,RS as Ec,Bs as Ac,RT as cr,eW as or,RU as Dc,Bu as _c,Bt as mn,RV as Pc,RW as wc,RX as vc,LZ as Tc,RY as vt,RZ as Fc,xA as ir,l5 as Rc,hD as xc,Dc as Bc,R_ as dr,fS as Lc,fT as Oc,R$ as Uc,df as jc,g3 as Mc,D2 as Nc,CY as We,bt as Vc,bF as Hc,cy as Gc,bG as $c,La as zc}from"./zeni-epic-state-D1RAQ_Ab.js";import{A as Fe,cf as lr,p as _e,cg as ur,ch as mr,ci as Zc,O as ua,Y as Tt,cj as Yc,ck as Kc,V as Cr,c as pr,X as hr,q as ye,a as le,x as K,aq as ya,cl as fr,cm as Wc,cn as qc,z as re,B as va,c4 as rt,co as Qc,cp as Jc,cq as Xc,cr as eo,cs as ao,J as Ta,aN as ze,bo as Ft,ct as to,y as Fa,i as st,m as Rt,d as J,a7 as ct,cu as no,bA as ba,cv as yt,cw as ro,v as xt,cx as so,at as gr,a2 as It,cy as co,W as br,f as Sr,cz as oo,cA as io,cB as lo,cC as uo,cD as mo,cE as Co,o as Ka,cF as po,cG as ho,cH as pt,I as fo,cI as go,cJ as bo,cK as So,cL as yo,cM as Io,a9 as ko}from"./index-CWDdvACz.js";import{n as Ne,D as yr,S as Eo}from"./mui-BcLZDyi8.js";import{a as r}from"./sentry-mCXLUbmc.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-0ZlblxUj.js";import{M as Ie}from"./MobileAppDrawer-BpbByRGV.js";import{d as Bt}from"./recharts-Nefi66IQ.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-C1DrVmba.js";import{u as Dr}from"./useInitialThreadRequest-DE3A7e2N.js";import ot from"./NotFoundScreen-CiwLb5Sm.js";import{n as pn}from"./utils-C9yOAUzR.js";import{t as wo}from"./AddressScreen-DPs7jKyd.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./analyticsHelper-BLGte-6z.js";import"./routePaths-BrOGk8hR.js";import"./BusinessVerificationPageScreen-CRI_zbAG.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]="0dd3f148-e855-4071-866b-fa42db718da1",e._sentryDebugIdIdentifier="sentry-dbid-0dd3f148-e855-4071-866b-fa42db718da1")}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 Z=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=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:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,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 Yc({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 Z=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]),Y=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(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,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:Y,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]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ye=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ye,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,Ye,te,Ee,Ze,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]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(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),Z=z?.accountingClassIDs[0],I=o(W=>Z!=null?Za(W.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(W=>q!=null?Za(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(Ya()),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(Ya());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:Y?.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 Zo(){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??Yo(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 Yo=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 Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Z===!1||Z&&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)),Y=()=>{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(Y,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-PtDFv95_.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-BZimyUuM.js";import{bs as Pe,QX as ts,QY as ns,fM as ln,QZ as In,fF as kn,Q_ as En,Q$ as An,R0 as Dn,R1 as _n,fG as Pn,fH as wn,R2 as vn,g1 as Tn,g2 as $a,R3 as Fn,R4 as rs,fL as ss,fK as cs,R5 as os,g4 as Rn,g5 as sa,R6 as is,R7 as ds,fO as ls,fN as us,R8 as xn,hC as Qe,g0 as Bn,f$ as Ln,R9 as ms,eV as Cs,A_ as ps,AZ as hs,B1 as fs,B3 as gs,e$ as bs,eS as On,Ra as Ss,Rb as ys,f4 as Un,Rc as Is,f5 as jn,B9 as ks,B6 as Es,eT as fe,Rd as Qa,f8 as we,f9 as ve,fa as Te,gr as ca,ct as oa,Re as ia,Rf as Dt,uA as za,kx as Za,Rg as Ya,BH as ka,BJ as qe,BK as _t,kn as Mn,Rh as da,Bv as _a,Ri as As,Rj as Ds,By as Ja,Rk as _s,Pk as Xa,eX as Nn,BE as ga,hN as Ps,Rl as Vn,Rm as la,bq as ws,Rn as vs,gc as et,gb as at,Cc as Ts,ga as tt,P0 as Fs,Ro as Hn,cm as Gn,cN as Rs,Pj as wa,CN as $n,Rp as un,Cn as Pa,Rq as zn,CO as xs,PM as Bs,CP as Ls,DL as Os,tX as Us,DF as js,Rr as Ms,BI as na,Rs as Ns,Rt as Vs,Ru as Hs,Rv as Gs,Rw as $s,Rx as Pt,Ry as zs,BZ as Zn,BS as Zs,Rz as Ys,gt as Ks,C6 as Yn,Ca as Kn,gs as Ws,RA as qs,Cz as Wn,RB as Qs,RC as Js,RD as Xs,C8 as qn,BV as Qn,BB as Jn,C2 as Xn,C0 as er,C4 as ec,RE as ar,RF as ac,f1 as tc,f2 as nc,f3 as rc,RG as nt,g6 as tr,cO as wt,RH as sc,RI as cc,RJ as oc,RK as ic,Ci as St,CG as dc,CC as lc,Ce as uc,CE as mc,Cu as Cc,Cw as pc,RL as nr,CM as Ga,Js as hc,RM as fc,RN as gc,RO as bc,RP as rr,RQ as Sc,D7 as yc,Cm as sr,Ch as je,Cl as Ic,RR as kc,RS as Ec,Bs as Ac,RT as cr,eW as or,RU as Dc,Bu as _c,Bt as mn,RV as Pc,RW as wc,RX as vc,LZ as Tc,RY as vt,RZ as Fc,xA as ir,l5 as Rc,hD as xc,Dc as Bc,R_ as dr,fS as Lc,fT as Oc,R$ as Uc,df as jc,g3 as Mc,D2 as Nc,CY as We,bt as Vc,bF as Hc,cy as Gc,bG as $c,La as zc}from"./zeni-epic-state-D1RAQ_Ab.js";import{A as Fe,cf as lr,p as _e,cg as ur,ch as mr,ci as Zc,O as ua,Y as Tt,cj as Yc,ck as Kc,V as Cr,c as pr,X as hr,q as ye,a as le,x as K,aq as ya,cl as fr,cm as Wc,cn as qc,z as re,B as va,c4 as rt,co as Qc,cp as Jc,cq as Xc,cr as eo,cs as ao,J as Ta,aN as ze,bo as Ft,ct as to,y as Fa,i as st,m as Rt,d as J,a7 as ct,cu as no,bA as ba,cv as yt,cw as ro,v as xt,cx as so,at as gr,a2 as It,cy as co,W as br,f as Sr,cz as oo,cA as io,cB as lo,cC as uo,cD as mo,cE as Co,o as Ka,cF as po,cG as ho,cH as pt,I as fo,cI as go,cJ as bo,cK as So,cL as yo,cM as Io,a9 as ko}from"./index-aKhhTDIh.js";import{n as Ne,D as yr,S as Eo}from"./mui-BcLZDyi8.js";import{a as r}from"./sentry-mCXLUbmc.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import{M as Ie}from"./MobileAppDrawer-CLztF99b.js";import{d as Bt}from"./recharts-Nefi66IQ.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-Uer5YsTX.js";import{u as Dr}from"./useInitialThreadRequest-ClxKOF2S.js";import ot from"./NotFoundScreen-BVW1mHQl.js";import{n as pn}from"./utils-C9yOAUzR.js";import{t as wo}from"./AddressScreen-BF-3RAYM.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./analyticsHelper-DO0i_Ozz.js";import"./routePaths-DQbleX1q.js";import"./BusinessVerificationPageScreen-0dmMGz8A.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]="0dd3f148-e855-4071-866b-fa42db718da1",e._sentryDebugIdIdentifier="sentry-dbid-0dd3f148-e855-4071-866b-fa42db718da1")}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 Z=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=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:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,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 Yc({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 Z=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]),Y=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(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,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:Y,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]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ye=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ye,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,Ye,te,Ee,Ze,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]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(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),Z=z?.accountingClassIDs[0],I=o(W=>Z!=null?Za(W.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(W=>q!=null?Za(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(Ya()),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(Ya());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:Y?.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 Zo(){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??Yo(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 Yo=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 Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Z===!1||Z&&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)),Y=()=>{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(Y,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-PtDFv95_.js";import{a as g}from"./sentry-mCXLUbmc.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-BZimyUuM.js";import{z as N,b9 as F,v as P,d as V,f as j,af as C,ba as L,at as A,au as U,q as B}from"./index-CWDdvACz.js";import{eT as D,ge as M,tm as _,g9 as R,c3 as z,Op as G,bn as q,rv as Y,rj as Z,kZ as H,my as S,Oq as $,bE as J,cw as b,mI as K,mL as Q}from"./zeni-epic-state-D1RAQ_Ab.js";import"./mui-BcLZDyi8.js";import{d as W}from"./routePaths-BrOGk8hR.js";import{M as X}from"./MobileAppDrawer-BpbByRGV.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="6dfc35a8-045e-4040-8211-9ad407a6b554",n._sentryDebugIdIdentifier="sentry-dbid-6dfc35a8-045e-4040-8211-9ad407a6b554")}catch{}})();const ee=E(function(n){const t=R(n),i=N.getSignedInUser(),p=D(n),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}},function(n,t){const{companyId:i,currentTenant:p,navigate:c,location:l}=t,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(Q())},onAddressClick:e=>{const a=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(K({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n($(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(H({files:e}))},onDeleteFile:e=>{n(Z(e))},onEditFileName:(e,a)=>{n(Y(e,a.split(".")[0]))}}})(L);function de(){const n=w(),t=T(),i=k(),{tenantEmailDomain:p}=x(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),a=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||a!=="Not-Started"||d==null||(l(!0),t(M(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(_())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-PtDFv95_.js";import{a as g}from"./sentry-mCXLUbmc.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-BZimyUuM.js";import{z as N,b9 as F,v as P,d as V,f as j,af as C,ba as L,at as A,au as U,q as B}from"./index-aKhhTDIh.js";import{eT as D,ge as M,tm as _,g9 as R,c3 as z,Op as G,bn as q,rv as Y,rj as Z,kZ as H,my as S,Oq as $,bE as J,cw as b,mI as K,mL as Q}from"./zeni-epic-state-D1RAQ_Ab.js";import"./mui-BcLZDyi8.js";import{d as W}from"./routePaths-DQbleX1q.js";import{M as X}from"./MobileAppDrawer-CLztF99b.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="6dfc35a8-045e-4040-8211-9ad407a6b554",n._sentryDebugIdIdentifier="sentry-dbid-6dfc35a8-045e-4040-8211-9ad407a6b554")}catch{}})();const ee=E(function(n){const t=R(n),i=N.getSignedInUser(),p=D(n),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}},function(n,t){const{companyId:i,currentTenant:p,navigate:c,location:l}=t,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(Q())},onAddressClick:e=>{const a=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(K({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n($(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(H({files:e}))},onDeleteFile:e=>{n(Z(e))},onEditFileName:(e,a)=>{n(Y(e,a.split(".")[0]))}}})(L);function de(){const n=w(),t=T(),i=k(),{tenantEmailDomain:p}=x(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),a=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(p)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||a!=="Not-Started"||d==null||(l(!0),t(M(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(_())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-PtDFv95_.js";import{a}from"./sentry-mCXLUbmc.js";import{u as D,g as v,j as m,N as w}from"./core-BZimyUuM.js";import{L6 as A,eT as O,fA as L,o2 as _,gn as h,fz as j,f6 as U,Ld as F}from"./zeni-epic-state-D1RAQ_Ab.js";import{u as $,z as f,L as g,O as k,o as z}from"./index-CWDdvACz.js";import{n as H}from"./mui-BcLZDyi8.js";import{t as R}from"./getLocaleForTenant-D-xlVXss.js";import{g as P,Q as G}from"./QBOConnectionScreen-L9petFDu.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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]="a9a9fb66-2dd1-4fb1-9c31-a159376c72a5",t._sentryDebugIdIdentifier="sentry-dbid-a9a9fb66-2dd1-4fb1-9c31-a159376c72a5")}catch{}})();const Q=H.div`
1
+ import{j as C}from"./liveblocks-PtDFv95_.js";import{a}from"./sentry-mCXLUbmc.js";import{u as D,g as v,j as m,N as w}from"./core-BZimyUuM.js";import{L6 as A,eT as O,fA as L,o2 as _,gn as h,fz as j,f6 as U,Ld as F}from"./zeni-epic-state-D1RAQ_Ab.js";import{u as $,z as f,L as g,O as k,o as z}from"./index-aKhhTDIh.js";import{n as H}from"./mui-BcLZDyi8.js";import{t as R}from"./getLocaleForTenant-B-mnTkE0.js";import{g as P,Q as G}from"./QBOConnectionScreen-eD76plFQ.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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]="a9a9fb66-2dd1-4fb1-9c31-a159376c72a5",t._sentryDebugIdIdentifier="sentry-dbid-a9a9fb66-2dd1-4fb1-9c31-a159376c72a5")}catch{}})();const Q=H.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -1 +1 @@
1
- import{j as i}from"./liveblocks-PtDFv95_.js";import{z as n}from"./index-CWDdvACz.js";import{g as d}from"./QBOConnectionScreen-L9petFDu.js";import"./sentry-mCXLUbmc.js";import{g as p,N as s}from"./core-BZimyUuM.js";import"./zeni-epic-state-D1RAQ_Ab.js";import"./recharts-Nefi66IQ.js";import"./mui-BcLZDyi8.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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-PtDFv95_.js";import{z as n}from"./index-aKhhTDIh.js";import{g as d}from"./QBOConnectionScreen-eD76plFQ.js";import"./sentry-mCXLUbmc.js";import{g as p,N as s}from"./core-BZimyUuM.js";import"./zeni-epic-state-D1RAQ_Ab.js";import"./recharts-Nefi66IQ.js";import"./mui-BcLZDyi8.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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-PtDFv95_.js";import{t as Me,A as Ce}from"./AddressScreen-DPs7jKyd.js";import $e from"./NotFoundScreen-CiwLb5Sm.js";import{a as g}from"./sentry-mCXLUbmc.js";import{h as oe,g as se,u as ie,i as re,j as D,N as E,n as ce,l as ze,o as qe,p as z}from"./core-BZimyUuM.js";import{I as de,A as le,z as B,a as ue,m as Qe,x as _,q as V,v as H,d as N,B as ve,f as X,ap as Ke,J as Ze,aq as ke,i as te,ar as Je,as as Ie,o as He,at as We,au as Ee,av as Xe}from"./index-CWDdvACz.js";import{bn as Ye,eT as ee,fs as et,fa as pe,f8 as me,bt as tt,o0 as at,fo as nt,bO as ot,k1 as ae,k4 as je,LC as st,bU as it,c3 as ge,tA as fe,tl as rt,M5 as Y,tB as _e,Jv as ct,l5 as Ue,M6 as Ve,M7 as dt,M8 as lt,M9 as ut,j$ as pt,k2 as mt,tn as Be,tz as gt,bE as xe,cw as ft,tN as Te,rv as ht,rj as yt,kZ as St,gc as bt,gb as Ct,ga as kt,Ma as It,tf as Et,tO as xt,tR as Tt,tU as Ot,t_ as At,cU as Pt}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as he}from"./mui-BcLZDyi8.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-L9petFDu.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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]="09e19185-e4cb-47f5-8ff6-681dfaa085ae",t._sentryDebugIdIdentifier="sentry-dbid-09e19185-e4cb-47f5-8ff6-681dfaa085ae")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),vt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),f=Ye(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=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const v=pe(F,c),A=me(c),P=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=b?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&P.push("top_expenses"),$===!1&&P.push("task_card"),j===!1&&P.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&P.push("reimbursement_card","reimbursement_promo_card"),k===!1&&P.push("zeni_accounts_promo_card"),h===!1&&P.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||A||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,P)))},[d,O,v,A,i,c.tenantId,s]),g.useEffect(()=>{(v||A)&&setTimeout(()=>{S(!0)},5e3)},[v,A]),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(A)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(H,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(X.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard: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-PtDFv95_.js";import{t as Me,A as Ce}from"./AddressScreen-BF-3RAYM.js";import $e from"./NotFoundScreen-BVW1mHQl.js";import{a as g}from"./sentry-mCXLUbmc.js";import{h as oe,g as se,u as ie,i as re,j as D,N as E,n as ce,l as ze,o as qe,p as z}from"./core-BZimyUuM.js";import{I as de,A as le,z as B,a as ue,m as Qe,x as _,q as V,v as H,d as N,B as ve,f as X,ap as Ke,J as Ze,aq as ke,i as te,ar as Je,as as Ie,o as He,at as We,au as Ee,av as Xe}from"./index-aKhhTDIh.js";import{bn as Ye,eT as ee,fs as et,fa as pe,f8 as me,bt as tt,o0 as at,fo as nt,bO as ot,k1 as ae,k4 as je,LC as st,bU as it,c3 as ge,tA as fe,tl as rt,M5 as Y,tB as _e,Jv as ct,l5 as Ue,M6 as Ve,M7 as dt,M8 as lt,M9 as ut,j$ as pt,k2 as mt,tn as Be,tz as gt,bE as xe,cw as ft,tN as Te,rv as ht,rj as yt,kZ as St,gc as bt,gb as Ct,ga as kt,Ma as It,tf as Et,tO as xt,tR as Tt,tU as Ot,t_ as At,cU as Pt}from"./zeni-epic-state-D1RAQ_Ab.js";import{n as he}from"./mui-BcLZDyi8.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-eD76plFQ.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./empty-B1O8rDIf.js";import"./pdf-lib-DYmF-pgM.js";import"./index-B4buEPtI.js";import"./url-DwL5mRAv.js";import"./index-ky9cAsxd.js";import"./decodeURIComponentSafe-CfH0YvB4.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]="09e19185-e4cb-47f5-8ff6-681dfaa085ae",t._sentryDebugIdIdentifier="sentry-dbid-09e19185-e4cb-47f5-8ff6-681dfaa085ae")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),vt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),f=Ye(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=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const v=pe(F,c),A=me(c),P=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,q=c?.userRole!=null&&tt(c?.userRole),j=b?.resources?.find(l=>l.resource==="/bills")==null&&!q,Q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&P.push("top_expenses"),$===!1&&P.push("task_card"),j===!1&&P.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&P.push("reimbursement_card","reimbursement_promo_card"),k===!1&&P.push("zeni_accounts_promo_card"),h===!1&&P.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||v||A||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,P)))},[d,O,v,A,i,c.tenantId,s]),g.useEffect(()=>{(v||A)&&setTimeout(()=>{S(!0)},5e3)},[v,A]),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(A)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(H,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(X.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:x,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard: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-PtDFv95_.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 O}from"./core-BZimyUuM.js";import{eT as N,Mq as Xe,bE as la,bq as De,ND as Pn,iT as Fn,NE as Zt,NF as Rn,iW as kt,NG as Qe,NH as Bn,i$ as jn,NI as Qt,NJ as Mn,j3 as St,NK as He,NL as Ln,cm as vt,NM as Nn,NN as Un,MK as Gn,jX as Vn,NO as Yn,bn as Ue,NP as da,Me as ie,bc as ua,k9 as ma,oa as pa,jU as ha,Mg as ce,Mf as ee,eS as fa,e$ as $n,fC as _t,NQ as zn,NR as Kn,NS as ga,NT as Be,vz as Ge,vA as Ve,vX as xe,vR as le,vE as Ye,NU as qn,NV as Zn,NW as Qn,NX as ba,NY as je,NZ as Hn,dG as Je,s3 as Ca,N_ as Wn,N$ as Xn,O0 as Jn,O1 as At,LE as It,kp as we,w3 as Et,sb as eo,O2 as to,vB as Ht,s6 as Ee,s2 as ka,O3 as ge,O4 as ao,O5 as Tt,LD as Dt,u2 as Sa,O6 as no,O7 as oo,O8 as so,O9 as xt,uf as ro,Oa as io,vD as Wt,u1 as _a,Ob as be,Oc as co,bt as ya,w7 as va,Od as lo,Oe as uo,Of as mo,Og as wt,w2 as po,Oh as ho,vC as Xt,w6 as Aa,Oi as Ce,Oj as fo,Ok as go,Ol as Ia,ke as Ea,o7 as Ta,kj as Da,o5 as xa,o4 as wa,o3 as Oa,tq as bo,fs as Co,cO as ko,cP as So,o0 as _o,fo as yo,oh as vo,FP as ut,FH as Ao,FL as Io,Om as Eo,On as To,Oo as Do,b5 as et,fg as xo,hA as wo,ge as Oo,ob as Po,jN as Fo,o8 as Ro,o6 as Bo,fa as jo,f8 as Mo}from"./zeni-epic-state-D1RAQ_Ab.js";import{z as M,a2 as ae,q as x,d as D,O as q,aV as Lo,Y as $e,v as ze,aW as Pa,f as Y,aX as No,A as Se,aY as Fa,a as _e,x as R,m as Uo,aZ as Go,a_ as Vo,V as Ra,J as Ba,c as ja,X as Yo,a$ as $o,M as zo,aN as Ma,_ as oe,b0 as La,b1 as Na,a1 as Ua,b2 as Ko,b3 as qo,aq as Zo,p as Qo,W as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-CWDdvACz.js";import{n as Ot}from"./mui-BcLZDyi8.js";import{a as b}from"./sentry-mCXLUbmc.js";import{w as Ga}from"./withTransactionSidePanel-3L4TkBmm.js";import{c as Va,t as Oe,f as de,a as Pt,v as ts}from"./routePaths-BrOGk8hR.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-0ZlblxUj.js";import Ne from"./NotFoundScreen-CiwLb5Sm.js";import{u as Ft}from"./useInitialThreadRequest-DE3A7e2N.js";import{t as Ya}from"./analyticsHelper-BLGte-6z.js";import{C as as}from"./CompanyPassportScreen-DPJK2btv.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CRuBS_0m.js";import{F as os}from"./FeaturePreviewScreen-CBC6jNb-.js";import{R as ss}from"./ReferralListScreen-Cz3Ll36o.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./TransactionDetailScreen-BabZW4yC.js";import"./decodeURIComponentSafe-CfH0YvB4.js";import"./MobileAppDrawer-BpbByRGV.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]="276001d5-2ce7-47d4-9ba3-268f5b2cda9f",e._sentryDebugIdIdentifier="sentry-dbid-276001d5-2ce7-47d4-9ba3-268f5b2cda9f")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>N(v)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):De(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Va({id:v.transactionId,type:v.transactionType},m);f(B);const X=x(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&D.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:D,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=>N(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??De(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:D,onLoad:T=>T.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:D,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>N(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):De(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Va({id:k.transactionId,type:k.transactionType},c);p(v);const B=x(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&D.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(No,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:D,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>N(_)),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??De(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:D,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:D,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?D.trackZeniAccountsCashBalancePromoClicked("Move Money"):(D.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else D.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Nn(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Un(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:D}},za)(Fa),us=te(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ue(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:D}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>N(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ne,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>N(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ne,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
1
+ import{j as d}from"./liveblocks-PtDFv95_.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 O}from"./core-BZimyUuM.js";import{eT as N,Mq as Xe,bE as la,bq as De,ND as Pn,iT as Fn,NE as Zt,NF as Rn,iW as kt,NG as Qe,NH as Bn,i$ as jn,NI as Qt,NJ as Mn,j3 as St,NK as He,NL as Ln,cm as vt,NM as Nn,NN as Un,MK as Gn,jX as Vn,NO as Yn,bn as Ue,NP as da,Me as ie,bc as ua,k9 as ma,oa as pa,jU as ha,Mg as ce,Mf as ee,eS as fa,e$ as $n,fC as _t,NQ as zn,NR as Kn,NS as ga,NT as Be,vz as Ge,vA as Ve,vX as xe,vR as le,vE as Ye,NU as qn,NV as Zn,NW as Qn,NX as ba,NY as je,NZ as Hn,dG as Je,s3 as Ca,N_ as Wn,N$ as Xn,O0 as Jn,O1 as At,LE as It,kp as we,w3 as Et,sb as eo,O2 as to,vB as Ht,s6 as Ee,s2 as ka,O3 as ge,O4 as ao,O5 as Tt,LD as Dt,u2 as Sa,O6 as no,O7 as oo,O8 as so,O9 as xt,uf as ro,Oa as io,vD as Wt,u1 as _a,Ob as be,Oc as co,bt as ya,w7 as va,Od as lo,Oe as uo,Of as mo,Og as wt,w2 as po,Oh as ho,vC as Xt,w6 as Aa,Oi as Ce,Oj as fo,Ok as go,Ol as Ia,ke as Ea,o7 as Ta,kj as Da,o5 as xa,o4 as wa,o3 as Oa,tq as bo,fs as Co,cO as ko,cP as So,o0 as _o,fo as yo,oh as vo,FP as ut,FH as Ao,FL as Io,Om as Eo,On as To,Oo as Do,b5 as et,fg as xo,hA as wo,ge as Oo,ob as Po,jN as Fo,o8 as Ro,o6 as Bo,fa as jo,f8 as Mo}from"./zeni-epic-state-D1RAQ_Ab.js";import{z as M,a2 as ae,q as x,d as D,O as q,aV as Lo,Y as $e,v as ze,aW as Pa,f as Y,aX as No,A as Se,aY as Fa,a as _e,x as R,m as Uo,aZ as Go,a_ as Vo,V as Ra,J as Ba,c as ja,X as Yo,a$ as $o,M as zo,aN as Ma,_ as oe,b0 as La,b1 as Na,a1 as Ua,b2 as Ko,b3 as qo,aq as Zo,p as Qo,W as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-aKhhTDIh.js";import{n as Ot}from"./mui-BcLZDyi8.js";import{a as b}from"./sentry-mCXLUbmc.js";import{w as Ga}from"./withTransactionSidePanel-CCFVon-p.js";import{c as Va,t as Oe,f as de,a as Pt,v as ts}from"./routePaths-DQbleX1q.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import Ne from"./NotFoundScreen-BVW1mHQl.js";import{u as Ft}from"./useInitialThreadRequest-ClxKOF2S.js";import{t as Ya}from"./analyticsHelper-DO0i_Ozz.js";import{C as as}from"./CompanyPassportScreen-BOxFkTz6.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js";import{F as os}from"./FeaturePreviewScreen-AUOPnl37.js";import{R as ss}from"./ReferralListScreen-DxoomfXt.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./TransactionDetailScreen-BOsA-UF4.js";import"./decodeURIComponentSafe-CfH0YvB4.js";import"./MobileAppDrawer-CLztF99b.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]="276001d5-2ce7-47d4-9ba3-268f5b2cda9f",e._sentryDebugIdIdentifier="sentry-dbid-276001d5-2ce7-47d4-9ba3-268f5b2cda9f")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>N(v)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):De(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Va({id:v.transactionId,type:v.transactionType},m);f(B);const X=x(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&D.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:D,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=>N(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??De(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:D,onLoad:T=>T.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:D,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>N(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):De(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Va({id:k.transactionId,type:k.transactionType},c);p(v);const B=x(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&D.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(No,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:D,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>N(_)),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??De(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:D,onLoad:_=>_.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:D,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?D.trackZeniAccountsCashBalancePromoClicked("Move Money"):(D.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else D.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Nn(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Un(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:D}},za)(Fa),us=te(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ue(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:D}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>N(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ne,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>N(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ne,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-PtDFv95_.js";import{a as u}from"./sentry-mCXLUbmc.js";import{u as y,j as b,n as A,g as w,N as L}from"./core-BZimyUuM.js";import{L6 as N,eT as _,fA as U,L7 as k,o2 as R,L8 as z}from"./zeni-epic-state-D1RAQ_Ab.js";import{u as O,z as f,L as T,t as I,O as j,b as $}from"./index-CWDdvACz.js";import"./mui-BcLZDyi8.js";import{t as P}from"./getLocaleForTenant-D-xlVXss.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="ab1db5a0-1f88-4749-8c83-3457072bd43a",t._sentryDebugIdIdentifier="sentry-dbid-ab1db5a0-1f88-4749-8c83-3457072bd43a")}catch{}})();const Q=A(function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}})(function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=w(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map(l=>l.tenantEmailDomain),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce((l,F)=>l||i.split("/").find(D=>D===F)!=null,!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(L,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}});function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=O(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b(e=>N(e)),n=b(e=>e.tenantState.fetchState),i=b(e=>e.tenantState.error),a=b(e=>e.tenantState.activeTenantFetchState.fetchState),c=b(e=>_(e)),d=f.getSignedInUser();return u.useLayoutEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)},[a,n]),u.useEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(U(d.userId,e))))},[n,a,d,t]),u.useEffect(()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!k(i))&&t(R(e.userId)))},[n,a,i,d,t]),u.useEffect(()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())},[m.tenantsCoreDetailsInOrder,n]),u.useEffect(()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(j.updateAppLocaleID(P(c)),o())},[n,a,c]),v.jsx(Q,{})}const q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],G={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of q)if(t.toLocaleLowerCase().includes(s))return G[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-PtDFv95_.js";import{a as u}from"./sentry-mCXLUbmc.js";import{u as y,j as b,n as A,g as w,N as L}from"./core-BZimyUuM.js";import{L6 as N,eT as _,fA as U,L7 as k,o2 as R,L8 as z}from"./zeni-epic-state-D1RAQ_Ab.js";import{u as O,z as f,L as T,t as I,O as j,b as $}from"./index-aKhhTDIh.js";import"./mui-BcLZDyi8.js";import{t as P}from"./getLocaleForTenant-B-mnTkE0.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="ab1db5a0-1f88-4749-8c83-3457072bd43a",t._sentryDebugIdIdentifier="sentry-dbid-ab1db5a0-1f88-4749-8c83-3457072bd43a")}catch{}})();const Q=A(function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}})(function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=w(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map(l=>l.tenantEmailDomain),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce((l,F)=>l||i.split("/").find(D=>D===F)!=null,!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(L,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}});function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=O(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b(e=>N(e)),n=b(e=>e.tenantState.fetchState),i=b(e=>e.tenantState.error),a=b(e=>e.tenantState.activeTenantFetchState.fetchState),c=b(e=>_(e)),d=f.getSignedInUser();return u.useLayoutEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)},[a,n]),u.useEffect(()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(U(d.userId,e))))},[n,a,d,t]),u.useEffect(()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!k(i))&&t(R(e.userId)))},[n,a,i,d,t]),u.useEffect(()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())},[m.tenantsCoreDetailsInOrder,n]),u.useEffect(()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(j.updateAppLocaleID(P(c)),o())},[n,a,c]),v.jsx(Q,{})}const q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],G={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of q)if(t.toLocaleLowerCase().includes(s))return G[s]}export{oe as default};