@zeniai/web-app-ui 5.1.62-dev → 5.1.62-qa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/assets/{AddressRoutes-DvuqFlm5.js → AddressRoutes-CZL5IIDj.js} +1 -1
  2. package/dist/assets/{AddressScreen-D7DCNUGo.js → AddressScreen-CxOVTdB3.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-Bv6DgXwH.js → AiCfoScreen-Ufyr17L2.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-DxIJLeU6.js → BillPayApprovalRoutes-COMjZNBM.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CxAjptk9.js → BillPayRoutes-ycYrxG7k.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-HLhTZBjl.js → BusinessVerificationPageScreen-BSOfMkHj.js} +1 -1
  7. package/dist/assets/{CardsAiCfoScreen-BQXIEsXX.js → CardsAiCfoScreen-BofarOgC.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-CF9hoDo5.js → ChargeCardRoutes-iiwF-L1o.js} +1 -1
  9. package/dist/assets/{CompanyPassportScreen-Dd-P8T6z.js → CompanyPassportScreen-N6HtNLO2.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-BWQPD0qS.js → ConnectionAuthScreen-GiDrTcJ9.js} +1 -1
  11. package/dist/assets/{CustomerOnboardingAuthScreen-BycVZ7K6.js → CustomerOnboardingAuthScreen-CIo2QvBW.js} +1 -1
  12. package/dist/assets/{CustomerOnboardingRoutes-B4tFhrDj.js → CustomerOnboardingRoutes-C39jSTCn.js} +1 -1
  13. package/dist/assets/{DashboardRoutes-uPgpLI1W.js → DashboardRoutes-dFcQ-Udv.js} +1 -1
  14. package/dist/assets/{DefaultTenantHome-Bhp_uriR.js → DefaultTenantHome-CiIQC--y.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-YZRErnfJ.js → DomesticWireDetailScreen-Cv3GFhdJ.js} +1 -1
  16. package/dist/assets/{DrawerScreen-BqYmVuny.js → DrawerScreen-Dz_Ifi-A.js} +1 -1
  17. package/dist/assets/{EntityDetailRoutes-DbpAgwXS.js → EntityDetailRoutes-CGqc-n2O.js} +1 -1
  18. package/dist/assets/{ExpenseAutomationRoutes-ChVJkArc.js → ExpenseAutomationRoutes-iUGrHrmT.js} +1 -1
  19. package/dist/assets/{FeaturePreviewScreen-kp5WtNsg.js → FeaturePreviewScreen-CdQFs282.js} +1 -1
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-BAfTUuIq.js → HubSpotOAuthCallbackScreen-Crp8q0ZQ.js} +1 -1
  21. package/dist/assets/{MagicLinkRoutes-CGh8IMWW.js → MagicLinkRoutes-BPzX2NJX.js} +1 -1
  22. package/dist/assets/{MagicLinkSignInScreen-BFMyglUM.js → MagicLinkSignInScreen-BoA-7inn.js} +1 -1
  23. package/dist/assets/{MobileAppDrawer-BuakBUGx.js → MobileAppDrawer-cGG4tefr.js} +1 -1
  24. package/dist/assets/{NotFoundScreen-AsC21qGx.js → NotFoundScreen-DmxmtGfC.js} +1 -1
  25. package/dist/assets/{NotificationRoutes-B06j6V42.js → NotificationRoutes-DRjXwQc4.js} +1 -1
  26. package/dist/assets/{OAuthConsentScreen-B6euKfvQ.js → OAuthConsentScreen-HR6-AToH.js} +1 -1
  27. package/dist/assets/{PandLWithForecastRoutes-DfEV7guz.js → PandLWithForecastRoutes-COEiLMeU.js} +1 -1
  28. package/dist/assets/{PeopleRoutes-qz_hXV4C.js → PeopleRoutes-CQ7KgSTF.js} +1 -1
  29. package/dist/assets/{PerformanceRoutes-v5FcQW2N.js → PerformanceRoutes-CUptxU2M.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-Cx74YOuE.js → QBOConnectionScreen-MiEEvzBf.js} +1 -1
  31. package/dist/assets/{ReferralListScreen-G8WgDfU8.js → ReferralListScreen-BqOgHlgl.js} +1 -1
  32. package/dist/assets/{ReimbursementApprovalRoutes-yvcY1FyR.js → ReimbursementApprovalRoutes-CuEZag2r.js} +1 -1
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-s9Cc-PAW.js → ReimbursementApprovalRuleDetailScreen-DSLe2MhL.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-vHQ3hpWm.js → ReimbursementRoutes--RsJPCEP.js} +1 -1
  35. package/dist/assets/{ReportsRoutes-DIUc8s5q.js → ReportsRoutes-uT5eAJf1.js} +1 -1
  36. package/dist/assets/{RewardsRoutes-lnm6cAkX.js → RewardsRoutes-DNPQGfAV.js} +1 -1
  37. package/dist/assets/{ScreenRoutes-CAtz09zv.js → ScreenRoutes-BEMAKpuY.js} +2 -2
  38. package/dist/assets/{SettingsRoutes-B4g8CJnG.js → SettingsRoutes-DqieIzNx.js} +1 -1
  39. package/dist/assets/{SetupPagesScreen-BkPb95y9.js → SetupPagesScreen-Pz567UQO.js} +1 -1
  40. package/dist/assets/{SignInScreen-Dhh5qz65.js → SignInScreen-DPJ9eMik.js} +1 -1
  41. package/dist/assets/{SignOutScreen-3sXSL_QM.js → SignOutScreen-BmbWt3Pd.js} +1 -1
  42. package/dist/assets/{TaskListScreen-DGOHeeuZ.js → TaskListScreen-Chd2rxBe.js} +1 -1
  43. package/dist/assets/{TaskRoutes-CDomkVrp.js → TaskRoutes-DXfXoaYF.js} +1 -1
  44. package/dist/assets/{TransactionDetailRoutes-BXwhj2nX.js → TransactionDetailRoutes-Dko7BvP2.js} +1 -1
  45. package/dist/assets/{TransactionDetailScreen-DUZV5JDK.js → TransactionDetailScreen-B7KMTXiT.js} +1 -1
  46. package/dist/assets/{TransactionListRoutes-CDDcflri.js → TransactionListRoutes-MalhqO-o.js} +1 -1
  47. package/dist/assets/{TreasuryRoutes-CZyF8G2k.js → TreasuryRoutes-BJIzvR2Q.js} +1 -1
  48. package/dist/assets/{VendorsRoutes-B0mGOZoL.js → VendorsRoutes-45nX3W2c.js} +1 -1
  49. package/dist/assets/{WiseConfirmationScreen-B3-wTx7l.js → WiseConfirmationScreen-CWe-skzP.js} +1 -1
  50. package/dist/assets/{ZeniAccountRoutes-BeZsG6M5.js → ZeniAccountRoutes-DWsFxkzK.js} +1 -1
  51. package/dist/assets/{ZeniAccountStatementScreen-CU5lpB3Y.js → ZeniAccountStatementScreen-BqtUjZCP.js} +1 -1
  52. package/dist/assets/{analyticsHelper-CQXeRvKo.js → analyticsHelper-MomIUc09.js} +1 -1
  53. package/dist/assets/{getLocaleForTenant-C55KVru2.js → getLocaleForTenant-DBZLLRpQ.js} +1 -1
  54. package/dist/assets/{index-DsVH62ZK.js → index-BsmcHa9A.js} +5 -5
  55. package/dist/assets/{routePaths-Dq5U7lhs.js → routePaths-ieN8hn7m.js} +1 -1
  56. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BzB3gTK8.js → useAiCfoDashboardSuggestedQuestionsChips-Ber5T8-o.js} +1 -1
  57. package/dist/assets/{useAskAiCfoHostNavButtonProps-uVGdd0zj.js → useAskAiCfoHostNavButtonProps-5Ek-t3F9.js} +1 -1
  58. package/dist/assets/{useCashManagementBanner-BB3WgTJ-.js → useCashManagementBanner-B0ma2Yzx.js} +1 -1
  59. package/dist/assets/{useChargeCardPusherEvents-BOkZNaGv.js → useChargeCardPusherEvents-RkbvNufi.js} +1 -1
  60. package/dist/assets/{useEmailConnectResultRefresh-FRZ2xd4V.js → useEmailConnectResultRefresh-CiHOFzmr.js} +1 -1
  61. package/dist/assets/{useInitialThreadRequest-D9ebiXdA.js → useInitialThreadRequest-Dr9FuJUY.js} +1 -1
  62. package/dist/assets/{withTransactionSidePanel-iGXE6khP.js → withTransactionSidePanel-C15NQsNY.js} +1 -1
  63. package/dist/index.html +1 -1
  64. package/package.json +1 -1
@@ -1 +1 @@
1
- import{j as e}from"./liveblocks-evjZPqs_.js";import{A as d}from"./AddressScreen-D7DCNUGo.js";import i from"./NotFoundScreen-AsC21qGx.js";import"./sentry-CCZGmBkl.js";import{o as s,p as r}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./index-DsVH62ZK.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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-evjZPqs_.js";import{A as d}from"./AddressScreen-CxOVTdB3.js";import i from"./NotFoundScreen-DmxmtGfC.js";import"./sentry-CCZGmBkl.js";import{o as s,p as r}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./index-BsmcHa9A.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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-evjZPqs_.js";import{a as h}from"./sentry-CCZGmBkl.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-DmAftQ4g.js";import{Z as $,m as D,z as L,I as K,B as G,x as z,c as C,e as m,k as F,i as b,p as N}from"./index-DsVH62ZK.js";import{MG as I,hS as R,eW as U,MH as H,c6 as O,MI as V,lb as q}from"./zeni-epic-state-vtQ66nN6.js";import{n as W}from"./mui-PcDpEhsm.js";import Z from"./NotFoundScreen-AsC21qGx.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]="15cd3f96-41ff-4caf-a358-3bc4915bc49c",e._sentryDebugIdIdentifier="sentry-dbid-15cd3f96-41ff-4caf-a358-3bc4915bc49c")}catch{}})();const J=W.div`
1
+ import{j as d}from"./liveblocks-evjZPqs_.js";import{a as h}from"./sentry-CCZGmBkl.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-DmAftQ4g.js";import{Z as $,m as D,z as L,I as K,B as G,x as z,c as C,e as m,k as F,i as b,p as N}from"./index-BsmcHa9A.js";import{MG as I,hS as R,eW as U,MH as H,c6 as O,MI as V,lb as q}from"./zeni-epic-state-vtQ66nN6.js";import{n as W}from"./mui-PcDpEhsm.js";import Z from"./NotFoundScreen-DmxmtGfC.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]="15cd3f96-41ff-4caf-a358-3bc4915bc49c",e._sentryDebugIdIdentifier="sentry-dbid-15cd3f96-41ff-4caf-a358-3bc4915bc49c")}catch{}})();const J=W.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-evjZPqs_.js";import{a as r}from"./sentry-CCZGmBkl.js";import{u as xe,h as Pe,g as we,j as J,i as ye,n as Ee}from"./core-DmAftQ4g.js";import{V as Te,da as ve,z as Ae,Z as Qe,db as _e,dc as Oe,b9 as K,dd as se,de as Ue,b8 as ae,p as M,x as V,c as I,df as B,dg as je,dh as Le,a1 as Fe,e as De,a7 as Ve,di as Be,dj as Re,a2 as Me,dk as $e,dl as Ge,dm as qe,q as Ne,b4 as We,dn as ze}from"./index-DsVH62ZK.js";import{gj as He,eV as oe,eW as Ze,iy as Xe,TT as Ye,fn as Je,iI as Ke,iE as et,eX as R,fu as tt,g4 as st,fZ as at,g1 as ee,g5 as ot,g6 as nt,g7 as it,g8 as rt,g9 as lt}from"./zeni-epic-state-vtQ66nN6.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-PcDpEhsm.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-BzB3gTK8.js";import{p as pt}from"./pathToGoBack-Dt8AwbCr.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="292d948e-d126-44e1-92c1-4df2b52dbd00",e._sentryDebugIdIdentifier="sentry-dbid-292d948e-d126-44e1-92c1-4df2b52dbd00")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=J(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=J(i=>Ze(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[K]!==!0)return;S(!0);const f={...i};delete f[K],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Xe("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Z=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Je({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:z.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[z]);r.useEffect(()=>{F!=="In-Progress"&&D&&t(Ke())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&Z&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,Z,n,a,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(R(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(V,{analytics:I,onLoad:Y}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(V,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
1
+ import{j as c}from"./liveblocks-evjZPqs_.js";import{a as r}from"./sentry-CCZGmBkl.js";import{u as xe,h as Pe,g as we,j as J,i as ye,n as Ee}from"./core-DmAftQ4g.js";import{V as Te,da as ve,z as Ae,Z as Qe,db as _e,dc as Oe,b9 as K,dd as se,de as Ue,b8 as ae,p as M,x as V,c as I,df as B,dg as je,dh as Le,a1 as Fe,e as De,a7 as Ve,di as Be,dj as Re,a2 as Me,dk as $e,dl as Ge,dm as qe,q as Ne,b4 as We,dn as ze}from"./index-BsmcHa9A.js";import{gj as He,eV as oe,eW as Ze,iy as Xe,TT as Ye,fn as Je,iI as Ke,iE as et,eX as R,fu as tt,g4 as st,fZ as at,g1 as ee,g5 as ot,g6 as nt,g7 as it,g8 as rt,g9 as lt}from"./zeni-epic-state-vtQ66nN6.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-PcDpEhsm.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-Ber5T8-o.js";import{p as pt}from"./pathToGoBack-Dt8AwbCr.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="292d948e-d126-44e1-92c1-4df2b52dbd00",e._sentryDebugIdIdentifier="sentry-dbid-292d948e-d126-44e1-92c1-4df2b52dbd00")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,s=t.uiState?.currentChatSessionId,h=s!=null?tt(e.aiCfoState,s):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:s,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(a,l)=>{if(a===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=ae(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:s}))}},onSubmit:(a,l,d,g)=>{a&&We(e,a,l,S,x,s,g,d)},updateCurrentInput:a=>{e(ee(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(ot(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:a.newStack}}),e(ee(""))},togglePageView:()=>{const a=M(t.state?.pathnameStackToGoBack),l=a.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...se(t.state),pathnameStackToGoBack:a.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(at());const a=Ne(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:a.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(a,l)=>{e(st({questionAnswerId:a,isCollapsed:l}))},onMenuClick:o.onMenuClick,...qe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),s=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=J(i=>oe(i)),a=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=J(i=>Ze(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=s.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=s.state;if(i?.[K]!==!0)return;S(!0);const f={...i};delete f[K],u(s,{replace:!0,state:f})},[s.pathname,s.search,s.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=s.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,s.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(void 0),j(void 0),u(s.pathname,{replace:!0,state:se(s.state)})},[s.pathname,s.state,u]),q=r.useMemo(()=>new URLSearchParams(s.search),[s.search]),N=q.get("ref")??w?.aiCfoRef,L=q.get("emailRefId")??w?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||N!=="month-end-email"||L==null||n!=null||a==null||(t(Xe("controller",a.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[N,L,n,t,a]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),O(!0),U(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",Z=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=ae(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...s.state,message:"open_ai_cfo_drawer"}})},[C,g,u,s.state]);const fe=r.useCallback(()=>{const i=M(s.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...s.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,s.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...s.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(Je({sessionId:l,agentId:"controller"}))},[]);const Ce=r.useMemo(()=>({events:z.map(i=>`private-encrypted-chat-${i}.${ne}`),eventCallback:(i,f,ke)=>ke.onEventReceived(i,f)}),[z]);r.useEffect(()=>{F!=="In-Progress"&&D&&t(Ke())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&Z&&a!=null&&F==="Completed"&&!D&&t(et(n,a.userId))},[H,Z,n,a,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(a==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(B,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(R(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(V,{analytics:I,onLoad:Y}):null,c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(V,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:a.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:s,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-evjZPqs_.js";import{a as v}from"./sentry-CCZGmBkl.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-DmAftQ4g.js";import{eW as O,Q4 as A,PM as h,zn as E,zf as q,zj as R,z8 as K,PO as M,zp as ae,zb as Q,zs as G,zo as C}from"./zeni-epic-state-vtQ66nN6.js";import{z as V,a7 as H,bL as oe,af as P,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-DsVH62ZK.js";import"./mui-PcDpEhsm.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-s9Cc-PAW.js";import re from"./NotFoundScreen-AsC21qGx.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="0650b630-6754-4582-b0f0-e416287844f0",e._sentryDebugIdIdentifier="sentry-dbid-0650b630-6754-4582-b0f0-e416287844f0")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>O(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>O(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
1
+ import{j as c}from"./liveblocks-evjZPqs_.js";import{a as v}from"./sentry-CCZGmBkl.js";import{h as U,g as B,u as j,j as y,N as z,n as k,i as W,o as te,p as D}from"./core-DmAftQ4g.js";import{eW as O,Q4 as A,PM as h,zn as E,zf as q,zj as R,z8 as K,PO as M,zp as ae,zb as Q,zs as G,zo as C}from"./zeni-epic-state-vtQ66nN6.js";import{z as V,a7 as H,bL as oe,af as P,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-BsmcHa9A.js";import"./mui-PcDpEhsm.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-DSLe2MhL.js";import re from"./NotFoundScreen-DmxmtGfC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="0650b630-6754-4582-b0f0-e416287844f0",e._sentryDebugIdIdentifier="sentry-dbid-0650b630-6754-4582-b0f0-e416287844f0")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!1))},onBackClick:()=>{P(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>O(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>O(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=P(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>O(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-evjZPqs_.js";import{h as K,u as se,g as J,i as ae,j as k,N as te,n as X,l as na,o as ia,p as S}from"./core-DmAftQ4g.js";import{eW as Z,Pm as _e,bs as It,Kb as oa,bq as wt,bJ as pe,Pn as At,yF as Bt,zU as $e,zc as la,bn as De,Po as sa,Pp as ra,c6 as ca,Pq as da,kv as Ct,Pr as xt,Ps as Et,At as Ge,yU as Ce,Pt as ua,yt as tt,Pu as pa,Ez as ma,yx as ba,yD as Dt,Pv as ve,Pw as Me,zV as Oe,Px as ha,Py as ga,zY as Ne,Pz as ya,A9 as Sa,PA as Pt,zF as at,zK as fa,PB as va,PC as ue,PD as jt,PE as Tt,PF as Ft,gn as ka,yZ as Ue,cA as Rt,PG as Ia,fw as wa,PH as Aa,PI as Ba,fB as Vt,fz as $t,PJ as ze,PK as Ca,PL as xa,N5 as Ze,PM as Ea,N6 as oe,N7 as We,PN as Da,PO as Pa,PP as ja,zM as nt,zJ as Ta,PQ as Fa,PR as Ra,PS as Va,zv as $a,PT as Ua,PU as La,PV as _a,co as Ut,cQ as Lt,kG as Ga,bP as Ma,bo as _t,bQ as Gt,xL as Oa,PW as Na,Em as za,Es as Za,u9 as Wa,zW as Ha,AA as qa,kT as fe,PX as Qa,PY as Mt,ll as Ka,kN as Ot,l6 as Nt,l5 as it,bE as be,bO as Ja,PZ as Xa,P_ as ke,jq as Ya,P$ as ot,Q0 as en,ju as tn,jP as an,AO as nn,Q1 as on,le as ln,AE as sn,Q2 as lt,AI as rn,AN as cn,AK as dn,AC as un,Q3 as zt,yO as pn,Q4 as mn,Q5 as bn,gf as hn,ge as gn,gd as yn,kW as Sn,lc as st,ln as fn,rA as vn,l3 as kn,AG as In,jA as wn,ls as An,Q6 as Bn,js as Cn,rr as xn,Q7 as En,zB as Dn,bK as Pn,bt as jn,LV as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-vtQ66nN6.js";import{m as me,z as V,I as Ie,_ as He,W as le,U as y,aQ as xe,B as re,o as x,x as Pe,c as D,bh as Un,p as z,a2 as qe,q as E,Z as we,bi as rt,bj as ct,bk as Ln,ak as _n,C as Gn,aK as Mn,y as Zt,O as Qe,E as Ke,bl as On,au as Wt,bm as Nn,X as zn,e as Ht,a7 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,v as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-DsVH62ZK.js";import{n as L,S as si}from"./mui-PcDpEhsm.js";import{A as dt}from"./AddressScreen-D7DCNUGo.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-YZRErnfJ.js";import{a as f}from"./sentry-CCZGmBkl.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-uVGdd0zj.js";import{u as Qt}from"./useInitialThreadRequest-D9ebiXdA.js";import Ee from"./NotFoundScreen-AsC21qGx.js";import{D as ui}from"./DrawerScreen-BqYmVuny.js";import{M as Kt}from"./MobileAppDrawer-BuakBUGx.js";import{F as Jt}from"./FeaturePreviewScreen-kp5WtNsg.js";import{S as Te}from"./SetupPagesScreen-BkPb95y9.js";import{B as pi}from"./BillPayApprovalRoutes-DxIJLeU6.js";import{FallBackRoute as mi}from"./ScreenRoutes-CAtz09zv.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./analyticsHelper-CQXeRvKo.js";import"./routePaths-Dq5U7lhs.js";import"./BusinessVerificationPageScreen-HLhTZBjl.js";import"./ReimbursementApprovalRuleDetailScreen-s9Cc-PAW.js";import"./getLocaleForTenant-C55KVru2.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]="e57c17ae-2fbe-4915-a07c-d18cc98333df",e._sentryDebugIdIdentifier="sentry-dbid-e57c17ae-2fbe-4915-a07c-d18cc98333df")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Un);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=k(O=>Z(O)),s=k(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:W}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),H=g&&pe(u?.loggedInUserRoleMap),U=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||H||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,H,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Bt(n??"",$,U,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,U,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:U,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[W,M]=f.useState(),C=k(F=>Me(F,m,g,n));let q=C.fetchState,H=C.file,U=C.showAutofill;const Q=k(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,H=Q.transactionDetails?.attachments?.[0],U=!1);const Y=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!W)return;const F=H!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(I(!1),!W)return;const F=H!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:H,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||U?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Ln,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[U&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||U?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:H,showAutofill:U,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${ye.recurringBill.recurringCycle}
1
+ import{j as a}from"./liveblocks-evjZPqs_.js";import{h as K,u as se,g as J,i as ae,j as k,N as te,n as X,l as na,o as ia,p as S}from"./core-DmAftQ4g.js";import{eW as Z,Pm as _e,bs as It,Kb as oa,bq as wt,bJ as pe,Pn as At,yF as Bt,zU as $e,zc as la,bn as De,Po as sa,Pp as ra,c6 as ca,Pq as da,kv as Ct,Pr as xt,Ps as Et,At as Ge,yU as Ce,Pt as ua,yt as tt,Pu as pa,Ez as ma,yx as ba,yD as Dt,Pv as ve,Pw as Me,zV as Oe,Px as ha,Py as ga,zY as Ne,Pz as ya,A9 as Sa,PA as Pt,zF as at,zK as fa,PB as va,PC as ue,PD as jt,PE as Tt,PF as Ft,gn as ka,yZ as Ue,cA as Rt,PG as Ia,fw as wa,PH as Aa,PI as Ba,fB as Vt,fz as $t,PJ as ze,PK as Ca,PL as xa,N5 as Ze,PM as Ea,N6 as oe,N7 as We,PN as Da,PO as Pa,PP as ja,zM as nt,zJ as Ta,PQ as Fa,PR as Ra,PS as Va,zv as $a,PT as Ua,PU as La,PV as _a,co as Ut,cQ as Lt,kG as Ga,bP as Ma,bo as _t,bQ as Gt,xL as Oa,PW as Na,Em as za,Es as Za,u9 as Wa,zW as Ha,AA as qa,kT as fe,PX as Qa,PY as Mt,ll as Ka,kN as Ot,l6 as Nt,l5 as it,bE as be,bO as Ja,PZ as Xa,P_ as ke,jq as Ya,P$ as ot,Q0 as en,ju as tn,jP as an,AO as nn,Q1 as on,le as ln,AE as sn,Q2 as lt,AI as rn,AN as cn,AK as dn,AC as un,Q3 as zt,yO as pn,Q4 as mn,Q5 as bn,gf as hn,ge as gn,gd as yn,kW as Sn,lc as st,ln as fn,rA as vn,l3 as kn,AG as In,jA as wn,ls as An,Q6 as Bn,js as Cn,rr as xn,Q7 as En,zB as Dn,bK as Pn,bt as jn,LV as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-vtQ66nN6.js";import{m as me,z as V,I as Ie,_ as He,W as le,U as y,aQ as xe,B as re,o as x,x as Pe,c as D,bh as Un,p as z,a2 as qe,q as E,Z as we,bi as rt,bj as ct,bk as Ln,ak as _n,C as Gn,aK as Mn,y as Zt,O as Qe,E as Ke,bl as On,au as Wt,bm as Nn,X as zn,e as Ht,a7 as Zn,bn as Wn,bo as Hn,bp as qn,bq as Qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,v as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-BsmcHa9A.js";import{n as L,S as si}from"./mui-PcDpEhsm.js";import{A as dt}from"./AddressScreen-CxOVTdB3.js";import{g as ie,a as je,i as qt,V as Je,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-Cv3GFhdJ.js";import{a as f}from"./sentry-CCZGmBkl.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-5Ek-t3F9.js";import{u as Qt}from"./useInitialThreadRequest-Dr9FuJUY.js";import Ee from"./NotFoundScreen-DmxmtGfC.js";import{D as ui}from"./DrawerScreen-Dz_Ifi-A.js";import{M as Kt}from"./MobileAppDrawer-cGG4tefr.js";import{F as Jt}from"./FeaturePreviewScreen-CdQFs282.js";import{S as Te}from"./SetupPagesScreen-Pz567UQO.js";import{B as pi}from"./BillPayApprovalRoutes-COMjZNBM.js";import{FallBackRoute as mi}from"./ScreenRoutes-BEMAKpuY.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./analyticsHelper-MomIUc09.js";import"./routePaths-ieN8hn7m.js";import"./BusinessVerificationPageScreen-BSOfMkHj.js";import"./ReimbursementApprovalRuleDetailScreen-DSLe2MhL.js";import"./getLocaleForTenant-DBZLLRpQ.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]="e57c17ae-2fbe-4915-a07c-d18cc98333df",e._sentryDebugIdIdentifier="sentry-dbid-e57c17ae-2fbe-4915-a07c-d18cc98333df")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Un);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=k(O=>Z(O)),s=k(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});He({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:W}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),H=g&&pe(u?.loggedInUserRoleMap),U=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:Q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||H||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,H,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Bt(n??"",$,U,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,U,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Q,hasZeniAssistAccess:U,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Wt.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=k(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[W,M]=f.useState(),C=k(F=>Me(F,m,g,n));let q=C.fetchState,H=C.file,U=C.showAutofill;const Q=k(F=>_e(F,n??""));u===!1&&(q=Q.fetchState,H=Q.transactionDetails?.attachments?.[0],U=!1);const Y=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!W)return;const F=H!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(I(!1),!W)return;const F=H!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||Q.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:H,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||U?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Ln,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[U&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||U?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:H,showAutofill:U,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,Q,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=On();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${ye.recurringBill.recurringCycle}
2
2
  ${n}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=L.div`
3
3
  margin-bottom: 20px;
4
4
  margin-top: 20px;
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-evjZPqs_.js";import{a as V}from"./sentry-CCZGmBkl.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-DmAftQ4g.js";import{I as ce,W as ue,aQ as de,z as E,x as le,c as B,af as x,e as z,bH as pe,au as me,q as P,av as M}from"./index-DsVH62ZK.js";import{PU as fe,eW as G,tA as ye,Ke as Se,zv as ge,CX as Ie,FI as he,Gl as be,Hl as Te,Qf as De,Qg as Oe,Qh as Ce,Qi as ke,Qj as Ve,MH as Ae,Ph as we,MY as Ne,D$ as Fe,MZ as _e,E3 as ve,lb as xe,gf as ze,ge as Ee,gd as Be,rA as Pe,rr as Me,ro as Ue,l3 as Re,tJ as Le,tH as U,bE as R,tV as L,cy as je}from"./zeni-epic-state-vtQ66nN6.js";import{n as Ge}from"./mui-PcDpEhsm.js";import{d as j}from"./routePaths-Dq5U7lhs.js";import{M as Qe}from"./MobileAppDrawer-BuakBUGx.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="d9e4505a-986e-487d-adc4-55c47efac1f2",t._sentryDebugIdIdentifier="sentry-dbid-d9e4505a-986e-487d-adc4-55c47efac1f2")}catch{}})();const He=Ge.div`
1
+ import{j as C}from"./liveblocks-evjZPqs_.js";import{a as V}from"./sentry-CCZGmBkl.js";import{h as ae,g as ne,u as se,i as oe,j as k,N as ie,n as re}from"./core-DmAftQ4g.js";import{I as ce,W as ue,aQ as de,z as E,x as le,c as B,af as x,e as z,bH as pe,au as me,q as P,av as M}from"./index-BsmcHa9A.js";import{PU as fe,eW as G,tA as ye,Ke as Se,zv as ge,CX as Ie,FI as he,Gl as be,Hl as Te,Qf as De,Qg as Oe,Qh as Ce,Qi as ke,Qj as Ve,MH as Ae,Ph as we,MY as Ne,D$ as Fe,MZ as _e,E3 as ve,lb as xe,gf as ze,ge as Ee,gd as Be,rA as Pe,rr as Me,ro as Ue,l3 as Re,tJ as Le,tH as U,bE as R,tV as L,cy as je}from"./zeni-epic-state-vtQ66nN6.js";import{n as Ge}from"./mui-PcDpEhsm.js";import{d as j}from"./routePaths-ieN8hn7m.js";import{M as Qe}from"./MobileAppDrawer-cGG4tefr.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="d9e4505a-986e-487d-adc4-55c47efac1f2",t._sentryDebugIdIdentifier="sentry-dbid-d9e4505a-986e-487d-adc4-55c47efac1f2")}catch{}})();const He=Ge.div`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-evjZPqs_.js";import{a as l}from"./sentry-CCZGmBkl.js";import{u as pe,h as fe,g as he,j as M,i as Ce,n as Se}from"./core-DmAftQ4g.js";import{V as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,x as we,c as V,df as H,dp as Ee,O as ke,e as Ae,a7 as Te,di as xe,dj as Ue,a2 as Oe,dm as _e,b4 as ve,dn as Qe}from"./index-DsVH62ZK.js";import{gj as Fe,eV as G,eW as Ve,fn as $e,iI as je,iE as De,eX as B,g4 as Le,fZ as Re,g1 as N,g5 as qe,g6 as Me,g7 as He,g8 as Be,g9 as Ne}from"./zeni-epic-state-vtQ66nN6.js";import{D as ze,n as j,P as We,S as Ge}from"./mui-PcDpEhsm.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="df46d98c-fdfd-40b9-88da-518b74daf56e",e._sentryDebugIdIdentifier="sentry-dbid-df46d98c-fdfd-40b9-88da-518b74daf56e")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function $(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const n=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&n.uiState.currentChatSessionId==null,aiCfoView:n,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Oe}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:n,currentTenant:c,userId:d,navigate:m,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,h=n.state?.referrer,p=h===Y?Z(i):$(i);return{onEventReceived:(o,t)=>{if(o===K&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,C=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);C!=="answer"?V.trackAICFOChatResponseGenerated(C,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:C,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(o,t,s,C)=>{o&&ve(e,o,t,f,E,d,C,s,U)},updateCurrentInput:o=>{e(N(o))},onStopSubmit:()=>{},onUpdateScrollYOffset:o=>{e(qe(o))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...n.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(n.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{f!=null&&e(Re()),m(function(o){return`/${o}/${X}`}(i),{state:{...n.state}})},onToggleCotCollapsed:(o,t)=>{e(Le({questionAnswerId:o,isCollapsed:t}))},..._e(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m($(i),{state:{...n.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...n.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),n=pe(),c=fe(),d=he(),[m,f]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{n(Fe())},[n]);const i=M(r=>G(r)),h=ye.getSignedInUser(),{session_id:p}=Ce(),o=M(r=>Ve(r)),t=i.uiState.currentChatSessionId,s=o.tenantEmailDomain,{handleUploadPromoClose:C,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,O]=l.useState(null),[ne,_]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(O(u),_(P),v.current=!0)},[u,P]);const oe=l.useCallback(()=>{O(null),_(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=o.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,O(r),_(w),v.current=!1}},[S]);const{visitedSessions:D}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,L=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&n($e({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:D.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[D]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&n(je())},[Q,F,n]),l.useEffect(()=>{t!=null&&L!=="In-Progress"&&R&&h!=null&&Q==="Completed"&&!F&&n(De(t,h.userId))},[L,R,t,h,n]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:V,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>f(!0),userId:h.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:o,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:oe,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:C,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):$(s),{state:{...d.state}})},onCompleteClick:()=>{S||o.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),n(B(o.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>f(!1),onCompleteClick:()=>{S||o.userRoleId==null||n(B(o.userRoleId)),f(!1)}})})})]})},Je=j(Ge)`
1
+ import{j as g}from"./liveblocks-evjZPqs_.js";import{a as l}from"./sentry-CCZGmBkl.js";import{u as pe,h as fe,g as he,j as M,i as Ce,n as Se}from"./core-DmAftQ4g.js";import{V as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,x as we,c as V,df as H,dp as Ee,O as ke,e as Ae,a7 as Te,di as xe,dj as Ue,a2 as Oe,dm as _e,b4 as ve,dn as Qe}from"./index-BsmcHa9A.js";import{gj as Fe,eV as G,eW as Ve,fn as $e,iI as je,iE as De,eX as B,g4 as Le,fZ as Re,g1 as N,g5 as qe,g6 as Me,g7 as He,g8 as Be,g9 as Ne}from"./zeni-epic-state-vtQ66nN6.js";import{D as ze,n as j,P as We,S as Ge}from"./mui-PcDpEhsm.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="df46d98c-fdfd-40b9-88da-518b74daf56e",e._sentryDebugIdIdentifier="sentry-dbid-df46d98c-fdfd-40b9-88da-518b74daf56e")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function $(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const n=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&n.uiState.currentChatSessionId==null,aiCfoView:n,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Oe}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:n,currentTenant:c,userId:d,navigate:m,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,h=n.state?.referrer,p=h===Y?Z(i):$(i);return{onEventReceived:(o,t)=>{if(o===K&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,C=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);C!=="answer"?V.trackAICFOChatResponseGenerated(C,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:C,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(o,t,s,C)=>{o&&ve(e,o,t,f,E,d,C,s,U)},updateCurrentInput:o=>{e(N(o))},onStopSubmit:()=>{},onUpdateScrollYOffset:o=>{e(qe(o))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...n.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(n.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{f!=null&&e(Re()),m(function(o){return`/${o}/${X}`}(i),{state:{...n.state}})},onToggleCotCollapsed:(o,t)=>{e(Le({questionAnswerId:o,isCollapsed:t}))},..._e(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m($(i),{state:{...n.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...n.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),n=pe(),c=fe(),d=he(),[m,f]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{n(Fe())},[n]);const i=M(r=>G(r)),h=ye.getSignedInUser(),{session_id:p}=Ce(),o=M(r=>Ve(r)),t=i.uiState.currentChatSessionId,s=o.tenantEmailDomain,{handleUploadPromoClose:C,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,O]=l.useState(null),[ne,_]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(O(u),_(P),v.current=!0)},[u,P]);const oe=l.useCallback(()=>{O(null),_(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=o.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,O(r),_(w),v.current=!1}},[S]);const{visitedSessions:D}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,L=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&n($e({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:D.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[D]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&n(je())},[Q,F,n]),l.useEffect(()=>{t!=null&&L!=="In-Progress"&&R&&h!=null&&Q==="Completed"&&!F&&n(De(t,h.userId))},[L,R,t,h,n]),h==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:V,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>f(!0),userId:h.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:o,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:oe,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:C,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):$(s),{state:{...d.state}})},onCompleteClick:()=>{S||o.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),n(B(o.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>f(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>f(!1),onCompleteClick:()=>{S||o.userRoleId==null||n(B(o.userRoleId)),f(!1)}})})})]})},Je=j(Ge)`
2
2
  display: flex;
3
3
  min-height: 100%;
4
4
  flex-direction: column;
@@ -1,4 +1,4 @@
1
- import{j as c}from"./liveblocks-evjZPqs_.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as ba,s as Dt,n as De,t as In,o as es,p as se}from"./core-DmAftQ4g.js";import{bt as Pe,RR as as,RS as ts,eY as un,RT as kn,f5 as En,RU as An,RV as Dn,RW as _n,RX as Pn,f6 as wn,f7 as vn,RY as Tn,fh as Fn,fi as $a,RZ as xn,R_ as ns,fb as rs,fa as ss,R$ as cs,B$ as Bn,fk as ca,S0 as os,S1 as is,e_ as ds,eZ as ls,fw as ze,fd as Rn,fc as Ln,S2 as us,fe as ms,Bw as Cs,Bv as ps,Bz as hs,BB as fs,fp as gs,eV as On,S3 as Ss,S4 as bs,fu as Un,S5 as ys,fv as bt,BH as Is,BE as ks,eW as fe,S6 as Qa,fz as we,fA as ve,fB as Te,gu as oa,cv as ia,S7 as da,S8 as _t,uO as za,kD as Wa,S9 as Ya,Cf as ka,Ch as Qe,Ci as Pt,kt as jn,Sa as la,C3 as _a,Sb as Es,Sc as As,C6 as Ja,Sd as Ds,Qc as Xa,fg as Mn,Cc as ga,hT as _s,Se as Nn,Sf as ua,bo as Ps,Sg as ws,gf as et,ge as at,CM as vs,gd as tt,PU as Ts,Sh as Vn,co as Hn,cQ as Fs,Qb as wa,Dl as Gn,Si as mn,CX as Pa,Sj as $n,Dm as xs,QB as Bs,Dn as Rs,Es as Ls,u9 as Os,Em as Us,Sk as js,Cg as ra,Sl as Ms,Sm as Ns,Sn as Vs,So as Hs,Sp as Gs,Sq as wt,Sr as $s,Cx as zn,Cq as zs,Ss as Ws,gw as Ys,CG as Wn,CK as Yn,gv as Zs,St as Ks,D7 as Zn,Su as qs,Sv as Qs,Sw as Js,CI as Kn,Ct as qn,C9 as Qn,CC as Jn,CA as Xn,CE as Xs,Sx as er,Sy as ec,fr as ac,fs as tc,ft as nc,Sz as nt,fl as ar,cR as vt,SA as rc,SB as sc,SC as cc,SD as oc,CS as yt,De as ic,Da as dc,CO as lc,Dc as uc,D2 as mc,D4 as Cc,SE as tr,Dk as Ga,Kb as pc,SF as hc,SG as fc,SH as gc,SI as nr,SJ as Sc,DH as bc,CW as rr,CR as je,CV as yc,SK as Ic,SL as kc,C0 as Ec,SM as sr,ff as cr,SN as Ac,C2 as Dc,C1 as Cn,SO as _c,SP as Pc,SQ as wc,MI as vc,SR as Tt,SS as Tc,xO as or,lb as Fc,hJ as xc,DM as Bc,ST as ir,f2 as Rc,f3 as Lc,SU as Oc,di as Uc,fj as jc,DC as Mc,Dw as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,LV as $c}from"./zeni-epic-state-vtQ66nN6.js";import{I as Fe,cp as dr,p as _e,cq as lr,cr as ur,cs as zc,O as Xe,_ as Ft,ct as Wc,cu as Yc,V as mr,a as Cr,Y as pr,q as ye,W as le,U as Z,ar as ya,cv as hr,cw as Zc,cx as Kc,z as re,B as va,ce as rt,cy as qc,cz as Qc,cA as Jc,Z as Ta,aQ as We,br as xt,cB as Xc,y as Fa,i as st,m as Bt,c as J,a7 as ct,cC as eo,bE as Sa,cD as It,cE as ao,x as Rt,cF as to,au as fr,a2 as kt,cG as no,X as gr,e as Sr,cH as ro,cI as so,cJ as co,cK as oo,cL as io,cM as lo,o as Za,cN as uo,cO as mo,cP as pt,v as Co,cQ as po,cR as ho,cS as fo,cT as go,cU as So,a9 as bo}from"./index-DsVH62ZK.js";import{n as Ne,D as br,S as yo}from"./mui-PcDpEhsm.js";import{a as r}from"./sentry-CCZGmBkl.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-uVGdd0zj.js";import{M as Ie}from"./MobileAppDrawer-BuakBUGx.js";import{d as Lt}from"./recharts-CgEqsrFw.js";import{g as Ae,a as Ba,b as yr,c as xe,d as Be,e as Je,f as ea,h as aa,A as Io,i as Ot,P as ko,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Eo,o as Er,p as Ao,S as pn}from"./SetupPagesScreen-BkPb95y9.js";import{u as Ar}from"./useInitialThreadRequest-D9ebiXdA.js";import ot from"./NotFoundScreen-AsC21qGx.js";import{u as jt}from"./useChargeCardPusherEvents-BOkZNaGv.js";import{n as hn}from"./utils--mWNe9J7.js";import{t as Do}from"./AddressScreen-D7DCNUGo.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./analyticsHelper-CQXeRvKo.js";import"./routePaths-Dq5U7lhs.js";import"./BusinessVerificationPageScreen-HLhTZBjl.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]="93e948dd-5224-4ee3-95b4-acc5a3a0e959",e._sentryDebugIdIdentifier="sentry-dbid-93e948dd-5224-4ee3-95b4-acc5a3a0e959")}catch{}})();const _o=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:_o(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),Po=e=>Rn(e,!1),wo=e=>Ln(e.name,!1);function vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(P=>{S(P)},[]),l=r.useCallback(()=>{w(!0)},[w]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const v=o(P=>kn(P.cardPolicyState)),u=o(P=>En(P.cardPolicyState)),M=o(P=>An(P.cardPolicyState)),x=o(P=>Dn(P.cardPolicyState)),B=o(P=>_n(P.cardPolicyState)),p=o(P=>Pn(P.cardPolicyState)),h=o(P=>wn(P.cardPolicyState)),D=o(P=>vn(P.cardPolicyState)),d=o(P=>Tn(P.cardPolicyState)),_=o(P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(P=>P.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(Fn())},[a,v]),r.useEffect(()=>{D==="Completed"&&d===""||D==="In-Progress"||a($a())},[a,D,d]);const j=o(P=>xn(P.createCardPolicyState)),A=o(P=>ns(P.createCardPolicyState)),I=o(P=>rs(P.cardPolicyState)),L=o(P=>ss(P.cardPolicyState)),i=o(P=>cs(P.createCardPolicyState)),C=o(P=>Bn(P));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>u.map(Po),[u]),G=r.useMemo(()=>h.map(wo),[h]),O=r.useMemo(()=>C.cards.filter(P=>!dr(P.status.code)).map(Dr),[C.cards]),U=v==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&i==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:_,suggestedAllowMerchants:M,suggestedBlockMerchants:x,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,i,O,_,M,x,B,p]);const z=r.useMemo(()=>Lt(P=>{a($a(P))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const W=r.useCallback(P=>{z(P)},[z]),b=j.fetchState,T=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const P=_e(n.state?.pathnameStackToGoBack),ee=P.poppedPathname??T;e(ee,{state:{pathnameStackToGoBack:P.newStack}})},[n.state,e,T]),q=r.useCallback(()=>{e(T)},[e,T]),E=r.useCallback(P=>{a(is(P))},[a]),V=r.useCallback(P=>{const ee=lr(P);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(P=>{P.length!==0&&a(ls(P))},[a]),X=r.useCallback(()=>{a(un())},[a]),g=r.useRef(b);r.useEffect(()=>{const P=g.current;g.current=b,b==="Completed"&&P!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))},[a,b,A,e,T]);const F=b==="Error"?j.error?.message??fn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?i==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:l,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(zc,{formDraft:i,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:D==="In-Progress",onVendorSearchTextChange:W,submitState:b,submitErrorMessage:F,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,onCancelClick:q,onClickMenuIcon:l,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:To}}}=Xe.getLocalizedStrings(),Fo=e=>Rn(e,!1),xo=e=>Ln(e.name,!1);function Bo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),y=Fe(),f=Pe(y?.loggedInUserRoleMap),[S,w]=r.useState(!1),l=r.useCallback(F=>{w(F)},[]),m=r.useCallback(()=>{l(!0)},[l]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),u=o(F=>us(F)),M=o(F=>kn(F.cardPolicyState)),x=o(F=>En(F.cardPolicyState)),B=o(F=>An(F.cardPolicyState)),p=o(F=>Dn(F.cardPolicyState)),h=o(F=>_n(F.cardPolicyState)),D=o(F=>Pn(F.cardPolicyState)),d=o(F=>wn(F.cardPolicyState)),_=o(F=>vn(F.cardPolicyState)),k=o(F=>Tn(F.cardPolicyState)),j=o(F=>Bn(F)),A=o(F=>a!=null?ms(F.cardPolicyState,a):void 0),I=r.useMemo(()=>u.templateId===a&&u.formDraft!=null?u.formDraft:A!=null?Cs(A):void 0,[u.templateId,u.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=u.detailFetchState.fetchState;u.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(ps(a))},[s,a,u.templateId,u.detailFetchState.fetchState,A]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(Fn())},[s,M]),r.useEffect(()=>{_==="Completed"&&k===""||_==="In-Progress"||s($a())},[s,_,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{j.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[j.fetchState,s]);const i=r.useMemo(()=>x.map(Fo),[x]),C=r.useMemo(()=>d.map(xo),[d]),N=r.useMemo(()=>j.cards.filter(F=>!dr(F.status.code)).map(Dr),[j.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Wc({draft:I,cardRows:N,categorySearchOptions:i,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:D})},[I,N,i,C,L,B,p,h,D]),[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 W=r.useCallback(F=>{U(F)},[]),b=r.useMemo(()=>Lt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{b.cancel()},[b]);const T=r.useCallback(F=>{b(F)},[b]),Y=u.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),P=F.poppedPathname??q;e(P,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const P=lr(F);s(hs(P)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const g=Y==="Error"?u.updateFetchState.error?.message??To.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):O!=null&&M==="Completed"&&j.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(Yc,{templateName:u.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:i,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:Y,submitErrorMessage:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:v,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:W,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:u.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:v})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ro,subheadline:Lo,pageTitle:Oo}}}}=Xe.getLocalizedStrings(),Uo=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 jo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(b=>{S(b)},[]),l=r.useCallback(()=>{w(!0)},[w]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=m(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),x=o(b=>Ss(b)),B=o(b=>xn(b.createCardPolicyState)),p=o(b=>bs(b.createCardPolicyState)),h=o(b=>p==null?[]:Un(b.aiCfoState,p).filter(T=>T.kind==="creating_policy"),Dt),D=B.fetchState==="In-Progress"?Math.max(h.length,1):0,d=o(b=>ys(b.createCardPolicyState)),_=ya(B.fetchState);r.useEffect(()=>{if(_==="In-Progress"&&B.fetchState==="Completed"&&p!=null)h.forEach(b=>{a(bt({chatSessionId:p,id:b.id,entityIds:d,kind:"created_policy"}))});else if(_==="In-Progress"&&B.fetchState==="Error"&&p!=null){h.forEach(T=>{a(bt({chatSessionId:p,id:T.id,kind:"errored_policy"}))});const b=B.error?.message!=null&&B.error.message.length>0?B.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b}]}))}},[B.error?.message,B.fetchState,a,p,d,h,_]);const k=x.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const j=x.archiveFetchState.fetchState,A=ya(j);r.useEffect(()=>{A==="In-Progress"&&j==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[j,a,A]);const I=r.useMemo(()=>x.templates.map(Uo),[x.templates]);Ft({isDataReady:x.fetchState.fetchState==="Completed"});const L=I.length>0||D>0,i=function(b){const{hasAnyPolicies:T,isChargeCardAdmin:Y,isFileUploadEnabled:q}=b,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:g}=mr(),F=Cr(),P=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=P&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ze=r.useCallback(()=>{g(!0)},[g]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!T&&Y)return{aiAgentName:Oo,headline:Ro,subheadline:Lo,promptChips:Se,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,T,ue,Y,q,ee,ne,Re,Ze,te,Ee,Ye,Se])}({hasAnyPolicies:L,isChargeCardAdmin:y,isFileUploadEnabled:R}),C=v&&i!=null?c.jsx(hr,{...i}):null,N=u&&C==null,G=r.useCallback(()=>{const b=_e(n.state?.pathnameStackToGoBack),T=b.poppedPathname??"..";e(T,{state:{pathnameStackToGoBack:b.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(b=>{t!=null&&e(`/${t}/cards/policy/${b}/edit`)},[e,t]),z=r.useCallback(b=>{a(ks(b))},[a]),W=x.fetchState.fetchState;return!L&&W!=="Completed"&&W!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Zc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:l,isAiCfoAccessEnabled:u,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Kc,{policies:I,archivingTemplateId:x.archiveTargetTemplateId,pendingCreationCount:D,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:l,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:M})]})}function Mo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),y=Fe(),f=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[w,l]=r.useState(!1),m=o(K=>Qa(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(Z.isChargeCardFeatureEnabled),u=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(Z.isDebitCardFeatureEnabled),x=we(s),B=ve(s),p=Te(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),d=Be({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:v,isBookKeepingTenant:B,isDebitCardProductVisible:D,chargeCardsCreditAccountLimit:h}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),j=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),i=!R&&d&&u,C=o(K=>_t(K,n,i,d)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),W=z?.accountingClassIDs[0],b=o(K=>W!=null?Wa(K.classState,{classId:W,reportId:"class_list"}):void 0),T=O?.cardHolderUser?.userId,Y=o(K=>T!=null?za(K.userRoleState,T):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Wa(K.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&&w===!1&&V&&(l(!0),setTimeout(()=>{t(Ya()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,w,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,i,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&w===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&d&&u&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&d&&u&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,d,u,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},g=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(d,D,_,u),P=Ba(d,u,f,A,I),ee=yr(g,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:j,isChargeCardFeatureEnabled:d,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:u,productInformation:F,creditAccountInformation:P,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:b?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",No="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Vo=[La,Ra],Ho=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(Jc);function Go(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(M=>fe(M)),{useFeatureGate:y}=le(),{isFeatureEnabled:f}=y(Z.isCardsCommentingEnabled),[S,w]=r.useState(!1),l=o(M=>la(M)),m=Ar(s.companyId,{clearParams:l.fetchState==="Completed"}),R=r.useCallback(()=>{const M=_e(t.state?.pathnameStackToGoBack),x=M.poppedPathname??$o(s.tenantEmailDomain);e(x,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(jt({events:Ca(v,Vo),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||l.fetchState==="Completed"||l.fetchState==="In-Progress"||(w(!0),n(_a()))},[S,l,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const u=l.cashbackSummary?.cashbackEarned?.amount!=null&&l.fetchState!=="Not-Started";return l.fetchState!=="In-Progress"||u?(l.cashbackSummary?.cashbackEarned?.amount??0)===0&&l.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(Ho,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Qc,{onBackClick:R})}const $o=e=>`/${e}/cards`,zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f}=le(),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(!1),x=re.getSignedInUser();if(x==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(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,D=o(E=>As(E,s)),d=D.chargeCard,_=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),I=Te(A,B),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),i=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:j,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&i;r.useEffect(()=>{S===!1&&_!=="In-Progress"&&_!=="Completed"&&(t(Ja()),w(!0)),l===!1&&D.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[l,D.fetchState,S,_]);const W=d?.type.code==="business_physical_credit_card"||d?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(R===!1&&(W===!1||W&&d?.status?.code!=="inactive"||d?.cardHolderUserId!==x.userId)){const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&D.isRefreshingViewInBackground===!1&&d?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[D.fetchState,d?.type.code,R,D.isRefreshingViewInBackground]);const b=re.getZeniOtpTokenForCardHolder(s),T=o(E=>Mn(E.userState,x.userId)),Y=()=>{d?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{D.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&d?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Y,3e3),v(!0))},[D.updatePhysicalChargeCardAttemptFetchState.fetchState,d?.cardActivationAttemptHistory]);const q=E=>{M(E)};if(_!=="Completed"||d==null)return c.jsx(va,{fetchState:"In-Progress"});if(d.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(T?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Ko,{children:[c.jsx(Ie,{isAppContentDrawerOpen:u,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:d,shippingAddressId:d.shippingAddressId,phone:T.phone,signedInUser:x,isSandboxEnv:xt(),chargeCardDetailState:D,signedInUserToken:b,navigate:a,currentTenant:B,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Zo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=_s(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),S=n.updateStatus,w=ua(e,!1,!1,!1);let l=!1;w.fetchState==="Completed"&&w.cards.length<=1&&(l=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:l,shippingAddress:y,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:l=>{e(vs(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("onboard")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(Xc),Zo=Ne.div`
1
+ import{j as c}from"./liveblocks-evjZPqs_.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as ba,s as Dt,n as De,t as In,o as es,p as se}from"./core-DmAftQ4g.js";import{bt as Pe,RR as as,RS as ts,eY as un,RT as kn,f5 as En,RU as An,RV as Dn,RW as _n,RX as Pn,f6 as wn,f7 as vn,RY as Tn,fh as Fn,fi as $a,RZ as xn,R_ as ns,fb as rs,fa as ss,R$ as cs,B$ as Bn,fk as ca,S0 as os,S1 as is,e_ as ds,eZ as ls,fw as ze,fd as Rn,fc as Ln,S2 as us,fe as ms,Bw as Cs,Bv as ps,Bz as hs,BB as fs,fp as gs,eV as On,S3 as Ss,S4 as bs,fu as Un,S5 as ys,fv as bt,BH as Is,BE as ks,eW as fe,S6 as Qa,fz as we,fA as ve,fB as Te,gu as oa,cv as ia,S7 as da,S8 as _t,uO as za,kD as Wa,S9 as Ya,Cf as ka,Ch as Qe,Ci as Pt,kt as jn,Sa as la,C3 as _a,Sb as Es,Sc as As,C6 as Ja,Sd as Ds,Qc as Xa,fg as Mn,Cc as ga,hT as _s,Se as Nn,Sf as ua,bo as Ps,Sg as ws,gf as et,ge as at,CM as vs,gd as tt,PU as Ts,Sh as Vn,co as Hn,cQ as Fs,Qb as wa,Dl as Gn,Si as mn,CX as Pa,Sj as $n,Dm as xs,QB as Bs,Dn as Rs,Es as Ls,u9 as Os,Em as Us,Sk as js,Cg as ra,Sl as Ms,Sm as Ns,Sn as Vs,So as Hs,Sp as Gs,Sq as wt,Sr as $s,Cx as zn,Cq as zs,Ss as Ws,gw as Ys,CG as Wn,CK as Yn,gv as Zs,St as Ks,D7 as Zn,Su as qs,Sv as Qs,Sw as Js,CI as Kn,Ct as qn,C9 as Qn,CC as Jn,CA as Xn,CE as Xs,Sx as er,Sy as ec,fr as ac,fs as tc,ft as nc,Sz as nt,fl as ar,cR as vt,SA as rc,SB as sc,SC as cc,SD as oc,CS as yt,De as ic,Da as dc,CO as lc,Dc as uc,D2 as mc,D4 as Cc,SE as tr,Dk as Ga,Kb as pc,SF as hc,SG as fc,SH as gc,SI as nr,SJ as Sc,DH as bc,CW as rr,CR as je,CV as yc,SK as Ic,SL as kc,C0 as Ec,SM as sr,ff as cr,SN as Ac,C2 as Dc,C1 as Cn,SO as _c,SP as Pc,SQ as wc,MI as vc,SR as Tt,SS as Tc,xO as or,lb as Fc,hJ as xc,DM as Bc,ST as ir,f2 as Rc,f3 as Lc,SU as Oc,di as Uc,fj as jc,DC as Mc,Dw as qe,bs as Nc,bJ as Vc,cA as Hc,bK as Gc,LV as $c}from"./zeni-epic-state-vtQ66nN6.js";import{I as Fe,cp as dr,p as _e,cq as lr,cr as ur,cs as zc,O as Xe,_ as Ft,ct as Wc,cu as Yc,V as mr,a as Cr,Y as pr,q as ye,W as le,U as Z,ar as ya,cv as hr,cw as Zc,cx as Kc,z as re,B as va,ce as rt,cy as qc,cz as Qc,cA as Jc,Z as Ta,aQ as We,br as xt,cB as Xc,y as Fa,i as st,m as Bt,c as J,a7 as ct,cC as eo,bE as Sa,cD as It,cE as ao,x as Rt,cF as to,au as fr,a2 as kt,cG as no,X as gr,e as Sr,cH as ro,cI as so,cJ as co,cK as oo,cL as io,cM as lo,o as Za,cN as uo,cO as mo,cP as pt,v as Co,cQ as po,cR as ho,cS as fo,cT as go,cU as So,a9 as bo}from"./index-BsmcHa9A.js";import{n as Ne,D as br,S as yo}from"./mui-PcDpEhsm.js";import{a as r}from"./sentry-CCZGmBkl.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-5Ek-t3F9.js";import{M as Ie}from"./MobileAppDrawer-cGG4tefr.js";import{d as Lt}from"./recharts-CgEqsrFw.js";import{g as Ae,a as Ba,b as yr,c as xe,d as Be,e as Je,f as ea,h as aa,A as Io,i as Ot,P as ko,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Eo,o as Er,p as Ao,S as pn}from"./SetupPagesScreen-Pz567UQO.js";import{u as Ar}from"./useInitialThreadRequest-Dr9FuJUY.js";import ot from"./NotFoundScreen-DmxmtGfC.js";import{u as jt}from"./useChargeCardPusherEvents-RkbvNufi.js";import{n as hn}from"./utils--mWNe9J7.js";import{t as Do}from"./AddressScreen-CxOVTdB3.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./analyticsHelper-MomIUc09.js";import"./routePaths-ieN8hn7m.js";import"./BusinessVerificationPageScreen-BSOfMkHj.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]="93e948dd-5224-4ee3-95b4-acc5a3a0e959",e._sentryDebugIdIdentifier="sentry-dbid-93e948dd-5224-4ee3-95b4-acc5a3a0e959")}catch{}})();const _o=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:_o(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),Po=e=>Rn(e,!1),wo=e=>Ln(e.name,!1);function vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(P=>{S(P)},[]),l=r.useCallback(()=>{w(!0)},[w]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const v=o(P=>kn(P.cardPolicyState)),u=o(P=>En(P.cardPolicyState)),M=o(P=>An(P.cardPolicyState)),x=o(P=>Dn(P.cardPolicyState)),B=o(P=>_n(P.cardPolicyState)),p=o(P=>Pn(P.cardPolicyState)),h=o(P=>wn(P.cardPolicyState)),D=o(P=>vn(P.cardPolicyState)),d=o(P=>Tn(P.cardPolicyState)),_=o(P=>P.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(P=>P.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(Fn())},[a,v]),r.useEffect(()=>{D==="Completed"&&d===""||D==="In-Progress"||a($a())},[a,D,d]);const j=o(P=>xn(P.createCardPolicyState)),A=o(P=>ns(P.createCardPolicyState)),I=o(P=>rs(P.cardPolicyState)),L=o(P=>ss(P.cardPolicyState)),i=o(P=>cs(P.createCardPolicyState)),C=o(P=>Bn(P));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>u.map(Po),[u]),G=r.useMemo(()=>h.map(wo),[h]),O=r.useMemo(()=>C.cards.filter(P=>!dr(P.status.code)).map(Dr),[C.cards]),U=v==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&i==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:_,suggestedAllowMerchants:M,suggestedBlockMerchants:x,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,i,O,_,M,x,B,p]);const z=r.useMemo(()=>Lt(P=>{a($a(P))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const W=r.useCallback(P=>{z(P)},[z]),b=j.fetchState,T=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const P=_e(n.state?.pathnameStackToGoBack),ee=P.poppedPathname??T;e(ee,{state:{pathnameStackToGoBack:P.newStack}})},[n.state,e,T]),q=r.useCallback(()=>{e(T)},[e,T]),E=r.useCallback(P=>{a(is(P))},[a]),V=r.useCallback(P=>{const ee=lr(P);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(P=>{P.length!==0&&a(ls(P))},[a]),X=r.useCallback(()=>{a(un())},[a]),g=r.useRef(b);r.useEffect(()=>{const P=g.current;g.current=b,b==="Completed"&&P!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))},[a,b,A,e,T]);const F=b==="Error"?j.error?.message??fn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?i==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:Y,onClickMenuIcon:l,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(zc,{formDraft:i,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:D==="In-Progress",onVendorSearchTextChange:W,submitState:b,submitErrorMessage:F,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,onCancelClick:q,onClickMenuIcon:l,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:To}}}=Xe.getLocalizedStrings(),Fo=e=>Rn(e,!1),xo=e=>Ln(e.name,!1);function Bo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),y=Fe(),f=Pe(y?.loggedInUserRoleMap),[S,w]=r.useState(!1),l=r.useCallback(F=>{w(F)},[]),m=r.useCallback(()=>{l(!0)},[l]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),u=o(F=>us(F)),M=o(F=>kn(F.cardPolicyState)),x=o(F=>En(F.cardPolicyState)),B=o(F=>An(F.cardPolicyState)),p=o(F=>Dn(F.cardPolicyState)),h=o(F=>_n(F.cardPolicyState)),D=o(F=>Pn(F.cardPolicyState)),d=o(F=>wn(F.cardPolicyState)),_=o(F=>vn(F.cardPolicyState)),k=o(F=>Tn(F.cardPolicyState)),j=o(F=>Bn(F)),A=o(F=>a!=null?ms(F.cardPolicyState,a):void 0),I=r.useMemo(()=>u.templateId===a&&u.formDraft!=null?u.formDraft:A!=null?Cs(A):void 0,[u.templateId,u.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=u.detailFetchState.fetchState;u.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(ps(a))},[s,a,u.templateId,u.detailFetchState.fetchState,A]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(Fn())},[s,M]),r.useEffect(()=>{_==="Completed"&&k===""||_==="In-Progress"||s($a())},[s,_,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{j.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[j.fetchState,s]);const i=r.useMemo(()=>x.map(Fo),[x]),C=r.useMemo(()=>d.map(xo),[d]),N=r.useMemo(()=>j.cards.filter(F=>!dr(F.status.code)).map(Dr),[j.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Wc({draft:I,cardRows:N,categorySearchOptions:i,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:D})},[I,N,i,C,L,B,p,h,D]),[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 W=r.useCallback(F=>{U(F)},[]),b=r.useMemo(()=>Lt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{b.cancel()},[b]);const T=r.useCallback(F=>{b(F)},[b]),Y=u.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),P=F.poppedPathname??q;e(P,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const P=lr(F);s(hs(P)),s(fs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const g=Y==="Error"?u.updateFetchState.error?.message??To.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):O!=null&&M==="Completed"&&j.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(Yc,{templateName:u.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:i,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:Y,submitErrorMessage:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:v,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:W,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:l}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:u.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:v})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Ro,subheadline:Lo,pageTitle:Oo}}}}=Xe.getLocalizedStrings(),Uo=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 jo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[f,S]=r.useState(!1),w=r.useCallback(b=>{S(b)},[]),l=r.useCallback(()=>{w(!0)},[w]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=m(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:u,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),x=o(b=>Ss(b)),B=o(b=>xn(b.createCardPolicyState)),p=o(b=>bs(b.createCardPolicyState)),h=o(b=>p==null?[]:Un(b.aiCfoState,p).filter(T=>T.kind==="creating_policy"),Dt),D=B.fetchState==="In-Progress"?Math.max(h.length,1):0,d=o(b=>ys(b.createCardPolicyState)),_=ya(B.fetchState);r.useEffect(()=>{if(_==="In-Progress"&&B.fetchState==="Completed"&&p!=null)h.forEach(b=>{a(bt({chatSessionId:p,id:b.id,entityIds:d,kind:"created_policy"}))});else if(_==="In-Progress"&&B.fetchState==="Error"&&p!=null){h.forEach(T=>{a(bt({chatSessionId:p,id:T.id,kind:"errored_policy"}))});const b=B.error?.message!=null&&B.error.message.length>0?B.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b}]}))}},[B.error?.message,B.fetchState,a,p,d,h,_]);const k=x.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const j=x.archiveFetchState.fetchState,A=ya(j);r.useEffect(()=>{A==="In-Progress"&&j==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[j,a,A]);const I=r.useMemo(()=>x.templates.map(Uo),[x.templates]);Ft({isDataReady:x.fetchState.fetchState==="Completed"});const L=I.length>0||D>0,i=function(b){const{hasAnyPolicies:T,isChargeCardAdmin:Y,isFileUploadEnabled:q}=b,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:g}=mr(),F=Cr(),P=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:K,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(K,ke,3),[K,ke]),[ge,ae]=r.useState(""),ue=P&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ze=r.useCallback(()=>{g(!0)},[g]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!T&&Y)return{aiAgentName:Oo,headline:Ro,subheadline:Lo,promptChips:Se,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,T,ue,Y,q,ee,ne,Re,Ze,te,Ee,Ye,Se])}({hasAnyPolicies:L,isChargeCardAdmin:y,isFileUploadEnabled:R}),C=v&&i!=null?c.jsx(hr,{...i}):null,N=u&&C==null,G=r.useCallback(()=>{const b=_e(n.state?.pathnameStackToGoBack),T=b.poppedPathname??"..";e(T,{state:{pathnameStackToGoBack:b.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(b=>{t!=null&&e(`/${t}/cards/policy/${b}/edit`)},[e,t]),z=r.useCallback(b=>{a(ks(b))},[a]),W=x.fetchState.fetchState;return!L&&W!=="Completed"&&W!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Zc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:l,isAiCfoAccessEnabled:u,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:w}),c.jsx(Kc,{policies:I,archivingTemplateId:x.archiveTargetTemplateId,pendingCreationCount:D,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:l,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:M})]})}function Mo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(K=>fe(K)),y=Fe(),f=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[w,l]=r.useState(!1),m=o(K=>Qa(K).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(Z.isChargeCardFeatureEnabled),u=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(Z.isDebitCardFeatureEnabled),x=we(s),B=ve(s),p=Te(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=xe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),d=Be({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:v,isBookKeepingTenant:B,isDebitCardProductVisible:D,chargeCardsCreditAccountLimit:h}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(K=>oa(K,s.companyId)),j=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(K=>da(K)),L=o(K=>K.classListState.fetchState),i=!R&&d&&u,C=o(K=>_t(K,n,i,d)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(K=>U!=null?za(K.userRoleState,U):void 0),W=z?.accountingClassIDs[0],b=o(K=>W!=null?Wa(K.classState,{classId:W,reportId:"class_list"}):void 0),T=O?.cardHolderUser?.userId,Y=o(K=>T!=null?za(K.userRoleState,T):void 0),q=Y?.accountingClassIDs[0],E=o(K=>q!=null?Wa(K.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&&w===!1&&V&&(l(!0),setTimeout(()=>{t(Ya()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,w,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,i,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&w===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const K=Ae(s.tenantEmailDomain,n,a,O,m);e(K)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&d&&u&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&d&&u&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,d,u,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const K=Ae(s.tenantEmailDomain,n,a);e(K)}},g=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(d,D,_,u),P=Ba(d,u,f,A,I),ee=yr(g,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:j,isChargeCardFeatureEnabled:d,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:u,productInformation:F,creditAccountInformation:P,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:b?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",No="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Vo=[La,Ra],Ho=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(Jc);function Go(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(M=>fe(M)),{useFeatureGate:y}=le(),{isFeatureEnabled:f}=y(Z.isCardsCommentingEnabled),[S,w]=r.useState(!1),l=o(M=>la(M)),m=Ar(s.companyId,{clearParams:l.fetchState==="Completed"}),R=r.useCallback(()=>{const M=_e(t.state?.pathnameStackToGoBack),x=M.poppedPathname??$o(s.tenantEmailDomain);e(x,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(jt({events:Ca(v,Vo),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||l.fetchState==="Completed"||l.fetchState==="In-Progress"||(w(!0),n(_a()))},[S,l,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const u=l.cashbackSummary?.cashbackEarned?.amount!=null&&l.fetchState!=="Not-Started";return l.fetchState!=="In-Progress"||u?(l.cashbackSummary?.cashbackEarned?.amount??0)===0&&l.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(Ho,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Qc,{onBackClick:R})}const $o=e=>`/${e}/cards`,zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),y=Ce(),{useDynamicConfig:f}=le(),[S,w]=r.useState(!1),[l,m]=r.useState(!1),[R,v]=r.useState(!1),[u,M]=r.useState(!1),x=re.getSignedInUser();if(x==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(We.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,D=o(E=>As(E,s)),d=D.chargeCard,_=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:j}=k(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(Z.isDebitCardFeatureEnabled),I=Te(A,B),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),i=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Be({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:j,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&i;r.useEffect(()=>{S===!1&&_!=="In-Progress"&&_!=="Completed"&&(t(Ja()),w(!0)),l===!1&&D.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[l,D.fetchState,S,_]);const W=d?.type.code==="business_physical_credit_card"||d?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(D.fetchState==="Completed"){if(R===!1&&(W===!1||W&&d?.status?.code!=="inactive"||d?.cardHolderUserId!==x.userId)){const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&D.isRefreshingViewInBackground===!1&&d?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,x,d,!0),V=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[D.fetchState,d?.type.code,R,D.isRefreshingViewInBackground]);const b=re.getZeniOtpTokenForCardHolder(s),T=o(E=>Mn(E.userState,x.userId)),Y=()=>{d?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{D.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&d?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Y,3e3),v(!0))},[D.updatePhysicalChargeCardAttemptFetchState.fetchState,d?.cardActivationAttemptHistory]);const q=E=>{M(E)};if(_!=="Completed"||d==null)return c.jsx(va,{fetchState:"In-Progress"});if(d.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(T?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Ko,{children:[c.jsx(Ie,{isAppContentDrawerOpen:u,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:d,shippingAddressId:d.shippingAddressId,phone:T.phone,signedInUser:x,isSandboxEnv:xt(),chargeCardDetailState:D,signedInUserToken:b,navigate:a,currentTenant:B,location:y,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Zo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=_s(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),S=n.updateStatus,w=ua(e,!1,!1,!1);let l=!1;w.fetchState==="Completed"&&w.cards.length<=1&&(l=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:l,shippingAddress:y,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:f}=n,S=f.chargeCard?.cardProviderID,{tenantEmailDomain:w}=y;return{onGetOtp:l=>{S!=null&&e(tt(l,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:l=>{e(vs(a,l))},onResendOtp:l=>{S!=null&&e(at(l,"ChargeCardHolder",a))},onVerifyOtp:(l,m)=>{S!=null&&e(et(l,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:l=>{l!=null&&re.saveZeniOtpTokenForCardHolder(l,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const l=_e(s.state?.pathnameStackToGoBack),m=l.poppedPathname==null||l.poppedPathname.includes("onboard")===!0?aa(w):l.poppedPathname;t(m,{state:{pathnameStackToGoBack:l.newStack}})}}})(Xc),Zo=Ne.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${zo.containerWidth.value(e.windowSize)}%`};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-evjZPqs_.js";import{a as g}from"./sentry-CCZGmBkl.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-DmAftQ4g.js";import{z as h,bc as P,x as F,c as A,e as V,af as b,bd as j,au as L,av as U,q as B}from"./index-DsVH62ZK.js";import{eW as N,gh as M,tA as R,gc as _,c6 as z,Ph as G,bn as Y,rA as q,ro as H,l3 as W,mE as S,Pi as Z,bE as $,cy as C,mO as J,mR as K}from"./zeni-epic-state-vtQ66nN6.js";import"./mui-PcDpEhsm.js";import{d as Q}from"./routePaths-Dq5U7lhs.js";import{M as X}from"./MobileAppDrawer-BuakBUGx.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="1329db67-3963-4e63-9401-6e55a94abcad",a._sentryDebugIdIdentifier="sentry-dbid-1329db67-3963-4e63-9401-6e55a94abcad")}catch{}})();const ee=E(function(a){const t=_(a),i=h.getSignedInUser(),l=N(a),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(a,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const n=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(W({files:e}))},onDeleteFile:e=>{a(H(e))},onEditFileName:(e,n)=>{a(q(e,n.split(".")[0]))}}})(j);function de(){const a=w(),t=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>N(s)),d=r.companyId??h.getSignedInUserTenant(l)?.companyId;if(h.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),t(M(d)))},[c,n,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(R())},[o,t]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-evjZPqs_.js";import{a as g}from"./sentry-CCZGmBkl.js";import{h as w,u as x,g as T,i as k,j as O,n as E}from"./core-DmAftQ4g.js";import{z as h,bc as P,x as F,c as A,e as V,af as b,bd as j,au as L,av as U,q as B}from"./index-BsmcHa9A.js";import{eW as N,gh as M,tA as R,gc as _,c6 as z,Ph as G,bn as Y,rA as q,ro as H,l3 as W,mE as S,Pi as Z,bE as $,cy as C,mO as J,mR as K}from"./zeni-epic-state-vtQ66nN6.js";import"./mui-PcDpEhsm.js";import{d as Q}from"./routePaths-ieN8hn7m.js";import{M as X}from"./MobileAppDrawer-cGG4tefr.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="1329db67-3963-4e63-9401-6e55a94abcad",a._sentryDebugIdIdentifier="sentry-dbid-1329db67-3963-4e63-9401-6e55a94abcad")}catch{}})();const ee=E(function(a){const t=_(a),i=h.getSignedInUser(),l=N(a),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(a.companyConfigState),n=a.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(a,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{a(K())},onAddressClick:e=>{const n=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{a(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};a(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{a(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{a(Z(e))},onCompanyOfficerUpdated:e=>{a(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{a(W({files:e}))},onDeleteFile:e=>{a(H(e))},onEditFileName:(e,n)=>{a(q(e,n.split(".")[0]))}}})(j);function de(){const a=w(),t=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>N(s)),d=r.companyId??h.getSignedInUserTenant(l)?.companyId;if(h.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),t(M(d)))},[c,n,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(R())},[o,t]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>a("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:a,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-evjZPqs_.js";import{a}from"./sentry-CCZGmBkl.js";import{u as D,g as v,j as u,N as w}from"./core-DmAftQ4g.js";import{LR as O,eW as _,f$ as A,o7 as L,gq as E,f_ as j,fx as U,LY as $}from"./zeni-epic-state-vtQ66nN6.js";import{u as F,z as m,L as g,O as k,o as H}from"./index-DsVH62ZK.js";import{n as R}from"./mui-PcDpEhsm.js";import{t as z}from"./getLocaleForTenant-C55KVru2.js";import{g as P,Q as q}from"./QBOConnectionScreen-Cx74YOuE.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="e4dfbb67-e431-4f5d-a801-dcb24d61b7f6",t._sentryDebugIdIdentifier="sentry-dbid-e4dfbb67-e431-4f5d-a801-dcb24d61b7f6")}catch{}})();const G=R.div`
1
+ import{j as C}from"./liveblocks-evjZPqs_.js";import{a}from"./sentry-CCZGmBkl.js";import{u as D,g as v,j as u,N as w}from"./core-DmAftQ4g.js";import{LR as O,eW as _,f$ as A,o7 as L,gq as E,f_ as j,fx as U,LY as $}from"./zeni-epic-state-vtQ66nN6.js";import{u as F,z as m,L as g,O as k,o as H}from"./index-BsmcHa9A.js";import{n as R}from"./mui-PcDpEhsm.js";import{t as z}from"./getLocaleForTenant-DBZLLRpQ.js";import{g as P,Q as q}from"./QBOConnectionScreen-MiEEvzBf.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="e4dfbb67-e431-4f5d-a801-dcb24d61b7f6",t._sentryDebugIdIdentifier="sentry-dbid-e4dfbb67-e431-4f5d-a801-dcb24d61b7f6")}catch{}})();const G=R.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-evjZPqs_.js";import{z as n}from"./index-DsVH62ZK.js";import{g as d}from"./QBOConnectionScreen-Cx74YOuE.js";import"./sentry-CCZGmBkl.js";import{g as p,N as s}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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-evjZPqs_.js";import{z as n}from"./index-BsmcHa9A.js";import{g as d}from"./QBOConnectionScreen-MiEEvzBf.js";import"./sentry-CCZGmBkl.js";import{g as p,N as s}from"./core-DmAftQ4g.js";import"./zeni-epic-state-vtQ66nN6.js";import"./recharts-CgEqsrFw.js";import"./mui-PcDpEhsm.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,4 +1,4 @@
1
- import{j as o}from"./liveblocks-evjZPqs_.js";import{t as ft,A as Ne}from"./AddressScreen-D7DCNUGo.js";import yt from"./NotFoundScreen-AsC21qGx.js";import{a as d}from"./sentry-CCZGmBkl.js";import{h as Ce,g as ke,u as H,i as Ie,j as _,N as j,n as Ee,l as ht,o as St,p as Q}from"./core-DmAftQ4g.js";import{v as _e,I as xe,z as $,W as Ae,U as M,n as bt,q as N,x as ce,c as K,ap as nt,e as ve,aq as Ct,Z as kt,ar as $e,i as he,as as It,o as Ge,at as ze,au as Et,av as Qe,aw as _t}from"./index-DsVH62ZK.js";import{eW as W,fT as xt,fB as Te,fz as Oe,bs as At,o5 as vt,fP as Tt,bS as Ot,tk as wt,tn as Pt,MQ as Dt,MR as Ft,MS as jt,xI as Ut,Es as Bt,u9 as Vt,MT as Rt,k7 as Se,ka as at,Ml as Lt,bY as Mt,c6 as ue,tO as we,tz as Nt,MU as de,tP as ot,Ke as $t,lb as st,MV as Gt,MW as zt,rh as Qt,ho as Kt,Md as me,hl as Zt,Me as qt,xX as Ht,rl as Wt,hd as Xt,hg as Ke,MX as it,MY as Yt,D$ as Jt,MZ as en,E3 as tn,tq as nn,tB as be,M_ as an,M$ as on,k5 as sn,k8 as rn,t$ as cn,tN as dn,bE as Ze,cy as un,t_ as qe,rA as ln,ro as pn,l3 as mn,gf as gn,ge as fn,gd as yn,N0 as hn,tt as Sn,u0 as bn,u3 as Cn,u6 as kn,uc as In}from"./zeni-epic-state-vtQ66nN6.js";import{n as Pe}from"./mui-PcDpEhsm.js";import{g as En,h as _n,q as ae}from"./QBOConnectionScreen-Cx74YOuE.js";import{u as xn}from"./useEmailConnectResultRefresh-FRZ2xd4V.js";import{u as An}from"./useChargeCardPusherEvents-BOkZNaGv.js";import{u as vn}from"./plaid-DSnXUEUK.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="ae0de6cf-7440-4d4a-9206-faeb1cd500ca",t._sentryDebugIdIdentifier="sentry-dbid-ae0de6cf-7440-4d4a-9206-faeb1cd500ca")}catch{}})();const Tn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const a=Tt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Ot(a.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:a,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const u=N(c.state?.pathnameStackToGoBack,c.pathname);a("../../dashboard",{state:{pathnameStackToGoBack:u,message:"activation"}})}}})(Ct),On=()=>{const t=Ce(),s=ke(),n=H(),a=_e(),[c,u]=d.useState(!1),[h,I]=d.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),l=$.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:T}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:m}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:x}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:g}=p(M.isDebitCardFeatureEnabled),U=bt(),S=_(k=>W(k)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&xt(S.company),y=P&&V,b=_(k=>k.onboardingCustomerViewState.fetchState),A=S.excludedResources,B=S.companyId??$.getSignedInUserTenant(e)?.companyId;if(l==null)throw Error("Can't access onboarding flow without signing in...");const D=Te(g,S),v=Oe(S),w=[],Z=A?.resources?.find(k=>k.resource==="/reports/top_expenses")==null,G=A?.resources?.find(k=>k.resource==="/reports/task_card")==null,X=S?.userRole!=null&&At(S?.userRole),Y=A?.resources?.find(k=>k.resource==="/bills")==null&&!X,z=A?.resources?.find(k=>k.resource==="/reimbursements")==null;if(Z===!1&&w.push("top_expenses"),G===!1&&w.push("task_card"),Y===!1&&w.push("bill_pay_card","bill_pay_promo_card"),z===!1&&w.push("reimbursement_card","reimbursement_promo_card"),m===!1&&w.push("zeni_accounts_promo_card"),x===!1&&w.push("rewards_card"),d.useEffect(()=>{b!=="Completed"||c||D||v||(u(!0),n(vt(l.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,v,l,S.tenantId,n]),d.useEffect(()=>{(D||v)&&setTimeout(()=>{I(!0)},5e3)},[D,v]),b!=="Completed")return o.jsx(j,{to:"../"});if(b==="Completed"&&h){const k=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return o.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}});if(v)return o.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}})}return i?.loggedInUserRoleMap!=null?o.jsxs(o.Fragment,{children:[o.jsx(ce,{analytics:K,onLoad:k=>(F=>F.trackPageLoaded(ve.Event.onboardingDashboardActivation))(k)}),o.jsx(Tn,{navigate:t,location:s,themeState:a,signedInUser:l,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:m,shouldFetchRewardsPlanCard:x,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:y,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):o.jsx(nt,{})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],He=(t,s)=>{const n=new Map(t.map(a=>[a.key,a]));return s.map(a=>{return c=n.get(a)?.status,c==="starting"||c==="building"?c:"idle";var c})},We=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(a=>[a.key,a]));return s.every(a=>n.get(a)?.status==="ready")},wn=new Set(Rt),Xe=Pe.div`
1
+ import{j as o}from"./liveblocks-evjZPqs_.js";import{t as ft,A as Ne}from"./AddressScreen-CxOVTdB3.js";import yt from"./NotFoundScreen-DmxmtGfC.js";import{a as d}from"./sentry-CCZGmBkl.js";import{h as Ce,g as ke,u as H,i as Ie,j as _,N as j,n as Ee,l as ht,o as St,p as Q}from"./core-DmAftQ4g.js";import{v as _e,I as xe,z as $,W as Ae,U as M,n as bt,q as N,x as ce,c as K,ap as nt,e as ve,aq as Ct,Z as kt,ar as $e,i as he,as as It,o as Ge,at as ze,au as Et,av as Qe,aw as _t}from"./index-BsmcHa9A.js";import{eW as W,fT as xt,fB as Te,fz as Oe,bs as At,o5 as vt,fP as Tt,bS as Ot,tk as wt,tn as Pt,MQ as Dt,MR as Ft,MS as jt,xI as Ut,Es as Bt,u9 as Vt,MT as Rt,k7 as Se,ka as at,Ml as Lt,bY as Mt,c6 as ue,tO as we,tz as Nt,MU as de,tP as ot,Ke as $t,lb as st,MV as Gt,MW as zt,rh as Qt,ho as Kt,Md as me,hl as Zt,Me as qt,xX as Ht,rl as Wt,hd as Xt,hg as Ke,MX as it,MY as Yt,D$ as Jt,MZ as en,E3 as tn,tq as nn,tB as be,M_ as an,M$ as on,k5 as sn,k8 as rn,t$ as cn,tN as dn,bE as Ze,cy as un,t_ as qe,rA as ln,ro as pn,l3 as mn,gf as gn,ge as fn,gd as yn,N0 as hn,tt as Sn,u0 as bn,u3 as Cn,u6 as kn,uc as In}from"./zeni-epic-state-vtQ66nN6.js";import{n as Pe}from"./mui-PcDpEhsm.js";import{g as En,h as _n,q as ae}from"./QBOConnectionScreen-MiEEvzBf.js";import{u as xn}from"./useEmailConnectResultRefresh-CiHOFzmr.js";import{u as An}from"./useChargeCardPusherEvents-RkbvNufi.js";import{u as vn}from"./plaid-DSnXUEUK.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./empty-CDCfsLV4.js";import"./pdf-lib-CU5FhbnZ.js";import"./index-EyTFjAAZ.js";import"./url-9kg5cual.js";import"./index-DniSRtks.js";import"./decodeURIComponentSafe-C70tsXnj.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]="ae0de6cf-7440-4d4a-9206-faeb1cd500ca",t._sentryDebugIdIdentifier="sentry-dbid-ae0de6cf-7440-4d4a-9206-faeb1cd500ca")}catch{}})();const Tn=Ee(function(t,s){const n=[];s.isApAgingFeatureEnabled===!1&&n.push("accounts_payable_aging"),s.isArAgingFeatureEnabled===!1&&n.push("accounts_receivable_aging"),s.shouldFetchZeniAccountsPromoCard===!1&&n.push("zeni_accounts_promo_card"),s.shouldFetchRewardsPlanCard===!1&&n.push("rewards_card"),s.isExpenseAutomationEnabledForUser===!1&&n.push("expense_automation_card");const a=Tt(t,n,s.signedInUser,s.isExpenseAutomationFeatureEnabledV2,s.isExpenseAutomationEnabledForUser,s.isTreasuryEnabled);return{dashboardFetchState:Ot(a.reportsInOrder.map(c=>({fetchState:c.fetchState,error:c.error}))).fetchState}},function(t,s){const{themeState:n,navigate:a,location:c}=s;return{onZeniLogoClick:()=>{n.toggle()},onDashboardFetchDone:()=>{const u=N(c.state?.pathnameStackToGoBack,c.pathname);a("../../dashboard",{state:{pathnameStackToGoBack:u,message:"activation"}})}}})(Ct),On=()=>{const t=Ce(),s=ke(),n=H(),a=_e(),[c,u]=d.useState(!1),[h,I]=d.useState(!1),{tenantEmailDomain:e}=Ie(),i=xe(),l=$.getSignedInUser(),{useFeatureGate:p}=Ae(),{isFeatureEnabled:T}=p(M.isApAgingFeatureEnabled),{isFeatureEnabled:r}=p(M.isArAgingFeatureEnabled),{isFeatureEnabled:m}=p(M.isDepositAccountsFeatureEnabled),{isFeatureEnabled:x}=p(M.isReferralFeatureEnabled),{isFeatureEnabled:E}=p(M.isExpenseAutomationEnabledV2),{isFeatureEnabled:g}=p(M.isDebitCardFeatureEnabled),U=bt(),S=_(k=>W(k)),{isFeatureEnabled:P}=p(M.isTreasuryEnabled),V=S.company!=null&&xt(S.company),y=P&&V,b=_(k=>k.onboardingCustomerViewState.fetchState),A=S.excludedResources,B=S.companyId??$.getSignedInUserTenant(e)?.companyId;if(l==null)throw Error("Can't access onboarding flow without signing in...");const D=Te(g,S),v=Oe(S),w=[],Z=A?.resources?.find(k=>k.resource==="/reports/top_expenses")==null,G=A?.resources?.find(k=>k.resource==="/reports/task_card")==null,X=S?.userRole!=null&&At(S?.userRole),Y=A?.resources?.find(k=>k.resource==="/bills")==null&&!X,z=A?.resources?.find(k=>k.resource==="/reimbursements")==null;if(Z===!1&&w.push("top_expenses"),G===!1&&w.push("task_card"),Y===!1&&w.push("bill_pay_card","bill_pay_promo_card"),z===!1&&w.push("reimbursement_card","reimbursement_promo_card"),m===!1&&w.push("zeni_accounts_promo_card"),x===!1&&w.push("rewards_card"),d.useEffect(()=>{b!=="Completed"||c||D||v||(u(!0),n(vt(l.userId,B,S.tenantId,!0,!1,w)))},[c,b,D,v,l,S.tenantId,n]),d.useEffect(()=>{(D||v)&&setTimeout(()=>{I(!0)},5e3)},[D,v]),b!=="Completed")return o.jsx(j,{to:"../"});if(b==="Completed"&&h){const k=N(s.state?.pathnameStackToGoBack,s.pathname);if(D)return o.jsx(j,{to:"../../checking",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}});if(v)return o.jsx(j,{to:"../../cards",state:{...s.state,pathnameStackToGoBack:k,message:"activation"}})}return i?.loggedInUserRoleMap!=null?o.jsxs(o.Fragment,{children:[o.jsx(ce,{analytics:K,onLoad:k=>(F=>F.trackPageLoaded(ve.Event.onboardingDashboardActivation))(k)}),o.jsx(Tn,{navigate:t,location:s,themeState:a,signedInUser:l,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:r,shouldFetchZeniAccountsPromoCard:m,shouldFetchRewardsPlanCard:x,isExpenseAutomationEnabledForUser:U,isExpenseAutomationFeatureEnabledV2:E,isTreasuryEnabled:y,loggedInUserRoleMap:i?.loggedInUserRoleMap})]}):o.jsx(nt,{})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],He=(t,s)=>{const n=new Map(t.map(a=>[a.key,a]));return s.map(a=>{return c=n.get(a)?.status,c==="starting"||c==="building"?c:"idle";var c})},We=(t,s)=>{if(t.length===0)return!1;const n=new Map(t.map(a=>[a.key,a]));return s.every(a=>n.get(a)?.status==="ready")},wn=new Set(Rt),Xe=Pe.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${t=>t.theme.colors.grey4};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-evjZPqs_.js";import{i as K,j as _,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-DmAftQ4g.js";import{eW as U,Nh as We,bE as ca,bo as xe,Ov as On,iZ as Pn,Ow as Zt,Ox as Fn,j0 as kt,Oy as qe,Oz as Rn,j5 as Bn,OA as qt,OB as jn,j9 as _t,OC as Qe,OD as Mn,co as At,OE as Ln,OF as Un,NB as Gn,k1 as Vn,OG as Yn,bn as Xe,OH as la,N5 as ce,bc as da,kf as ua,of as ma,j_ as pa,N7 as le,N6 as J,eV as ha,fp as Nn,g1 as St,OI as $n,OJ as zn,OK as fa,OL as Fe,vN as Le,vO as Ue,w9 as De,w3 as de,vS as Ge,OM as Kn,ON as Zn,OO as qn,OP as ga,OQ as Re,OR as Qn,dJ as Je,s8 as ba,OS as Hn,OT as Wn,OU as Xn,OV as vt,Mn as It,kv as we,wh as Et,sg as Jn,OW as eo,vP as Qt,sb as Ee,s7 as Ca,OX as ge,OY as to,OZ as Tt,Mm as xt,ug as ka,O_ as ao,O$ as no,P0 as oo,P1 as Dt,ut as so,P2 as ro,vR as Ht,uf as _a,P3 as be,P4 as io,bs as Sa,wl as ya,P5 as co,P6 as lo,P7 as uo,P8 as wt,wg as mo,P9 as po,vQ as Wt,wk as Aa,Pa as Ce,Pb as ho,Pc as fo,Pd as va,kk as Ia,oc as Ea,kp as Ta,oa as xa,o9 as Da,o8 as wa,tE as go,fT as bo,cR as Co,cS as ko,o5 as _o,fP as So,om as yo,Gz as ut,Gr as Ao,Gv as vo,Pe as Io,Pf as Eo,Pg as To,b5 as et,fH as xo,hH as Do,gh as wo,og as Oo,jT as Po,od as Fo,ob as Ro,fB as Bo,fz as jo}from"./zeni-epic-state-vtQ66nN6.js";import{z as M,a2 as te,q as D,c as T,O as Z,aY as Mo,_ as Ve,x as Ye,aZ as Oa,e as N,a_ as Lo,I as _e,a$ as Pa,W as Se,U as B,m as Uo,b0 as Go,b1 as Vo,V as Fa,Z as Ra,a as Ba,Y as Yo,b2 as No,Q as $o,aQ as ja,$ as se,b3 as Ma,b4 as La,a1 as Ua,b5 as zo,b6 as Ko,n as Zo,ar as qo,p as Qo,X as Ho,b7 as Wo,b8 as Xo,b9 as Jo,ba as es,bb as ke}from"./index-DsVH62ZK.js";import{n as Ot}from"./mui-PcDpEhsm.js";import{a as b}from"./sentry-CCZGmBkl.js";import{w as Ga}from"./withTransactionSidePanel-iGXE6khP.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-Dq5U7lhs.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-uVGdd0zj.js";import Me from"./NotFoundScreen-AsC21qGx.js";import{u as Ft}from"./useInitialThreadRequest-D9ebiXdA.js";import{t as Ya}from"./analyticsHelper-CQXeRvKo.js";import{C as as}from"./CompanyPassportScreen-Dd-P8T6z.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-BzB3gTK8.js";import{F as os}from"./FeaturePreviewScreen-kp5WtNsg.js";import{R as ss}from"./ReferralListScreen-G8WgDfU8.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./TransactionDetailScreen-DUZV5JDK.js";import"./decodeURIComponentSafe-C70tsXnj.js";import"./MobileAppDrawer-BuakBUGx.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]="44e813f5-1b95-499b-bd53-e1085e304644",e._sentryDebugIdIdentifier="sentry-dbid-44e813f5-1b95-499b-bd53-e1085e304644")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(I=>I.tenantState.currentTenantId),c=_(I=>U(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=_(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),A=b.useCallback(()=>{f("../../",{relative:"path"})},[]),k=b.useCallback((I,L)=>{p(Zt({sortKey:I,sortOrder:L}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Va({id:I.transactionId,type:I.transactionType},m);f(L);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:A,onColumnSortConfigChanged:k,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=_(k=>Fn(k)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(k=>k.tenantState.currentTenantId),i=_(k=>U(k)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(k=>{e(qe({searchString:k}))},[]),p=b.useCallback((k,x)=>{e(qe({sortKey:x,sortOrder:k}))},[]),f=b.useCallback(k=>{a(`./${k}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(k=>{e(qe({downloadState:k}))},[]),E=b.useCallback((k,x)=>{},[]),A=b.useCallback((k,x)=>{e(qe({selectedDate:k,agingDateSelectionType:x})),e(kt(k))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(y=>U(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=_(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),A=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),k=b.useCallback(y=>{h(qt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const L=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:A,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=_(A=>jn(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(A=>U(A)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(A=>{e(Qe({searchString:A}))},[]),h=b.useCallback((A,k)=>{e(Qe({sortKey:k,sortOrder:A}))},[]),p=b.useCallback(A=>{a(`./${A}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(A=>{e(Qe({downloadState:A}))},[]),S=b.useCallback((A,k)=>{e(Qe({selectedDate:A,agingDateSelectionType:k})),e(_t(A))},[]),E=b.useCallback((A,k)=>{e(Mn({nodeId:A,isCollapsed:k}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:A=>A.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Ln(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Un(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=At(n?.loggedInUserRoleMap);return _(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=At(n?.loggedInUserRoleMap),r=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return _(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
1
+ import{j as d}from"./liveblocks-evjZPqs_.js";import{i as K,j as _,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-DmAftQ4g.js";import{eW as U,Nh as We,bE as ca,bo as xe,Ov as On,iZ as Pn,Ow as Zt,Ox as Fn,j0 as kt,Oy as qe,Oz as Rn,j5 as Bn,OA as qt,OB as jn,j9 as _t,OC as Qe,OD as Mn,co as At,OE as Ln,OF as Un,NB as Gn,k1 as Vn,OG as Yn,bn as Xe,OH as la,N5 as ce,bc as da,kf as ua,of as ma,j_ as pa,N7 as le,N6 as J,eV as ha,fp as Nn,g1 as St,OI as $n,OJ as zn,OK as fa,OL as Fe,vN as Le,vO as Ue,w9 as De,w3 as de,vS as Ge,OM as Kn,ON as Zn,OO as qn,OP as ga,OQ as Re,OR as Qn,dJ as Je,s8 as ba,OS as Hn,OT as Wn,OU as Xn,OV as vt,Mn as It,kv as we,wh as Et,sg as Jn,OW as eo,vP as Qt,sb as Ee,s7 as Ca,OX as ge,OY as to,OZ as Tt,Mm as xt,ug as ka,O_ as ao,O$ as no,P0 as oo,P1 as Dt,ut as so,P2 as ro,vR as Ht,uf as _a,P3 as be,P4 as io,bs as Sa,wl as ya,P5 as co,P6 as lo,P7 as uo,P8 as wt,wg as mo,P9 as po,vQ as Wt,wk as Aa,Pa as Ce,Pb as ho,Pc as fo,Pd as va,kk as Ia,oc as Ea,kp as Ta,oa as xa,o9 as Da,o8 as wa,tE as go,fT as bo,cR as Co,cS as ko,o5 as _o,fP as So,om as yo,Gz as ut,Gr as Ao,Gv as vo,Pe as Io,Pf as Eo,Pg as To,b5 as et,fH as xo,hH as Do,gh as wo,og as Oo,jT as Po,od as Fo,ob as Ro,fB as Bo,fz as jo}from"./zeni-epic-state-vtQ66nN6.js";import{z as M,a2 as te,q as D,c as T,O as Z,aY as Mo,_ as Ve,x as Ye,aZ as Oa,e as N,a_ as Lo,I as _e,a$ as Pa,W as Se,U as B,m as Uo,b0 as Go,b1 as Vo,V as Fa,Z as Ra,a as Ba,Y as Yo,b2 as No,Q as $o,aQ as ja,$ as se,b3 as Ma,b4 as La,a1 as Ua,b5 as zo,b6 as Ko,n as Zo,ar as qo,p as Qo,X as Ho,b7 as Wo,b8 as Xo,b9 as Jo,ba as es,bb as ke}from"./index-BsmcHa9A.js";import{n as Ot}from"./mui-PcDpEhsm.js";import{a as b}from"./sentry-CCZGmBkl.js";import{w as Ga}from"./withTransactionSidePanel-C15NQsNY.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-ieN8hn7m.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-5Ek-t3F9.js";import Me from"./NotFoundScreen-DmxmtGfC.js";import{u as Ft}from"./useInitialThreadRequest-Dr9FuJUY.js";import{t as Ya}from"./analyticsHelper-MomIUc09.js";import{C as as}from"./CompanyPassportScreen-N6HtNLO2.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-Ber5T8-o.js";import{F as os}from"./FeaturePreviewScreen-CdQFs282.js";import{R as ss}from"./ReferralListScreen-BqOgHlgl.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./TransactionDetailScreen-B7KMTXiT.js";import"./decodeURIComponentSafe-C70tsXnj.js";import"./MobileAppDrawer-cGG4tefr.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]="44e813f5-1b95-499b-bd53-e1085e304644",e._sentryDebugIdIdentifier="sentry-dbid-44e813f5-1b95-499b-bd53-e1085e304644")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(I=>I.tenantState.currentTenantId),c=_(I=>U(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=_(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),A=b.useCallback(()=>{f("../../",{relative:"path"})},[]),k=b.useCallback((I,L)=>{p(Zt({sortKey:I,sortOrder:L}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Va({id:I.transactionId,type:I.transactionType},m);f(L);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:A,onColumnSortConfigChanged:k,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=_(k=>Fn(k)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(k=>k.tenantState.currentTenantId),i=_(k=>U(k)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(k=>{e(qe({searchString:k}))},[]),p=b.useCallback((k,x)=>{e(qe({sortKey:x,sortOrder:k}))},[]),f=b.useCallback(k=>{a(`./${k}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(k=>{e(qe({downloadState:k}))},[]),E=b.useCallback((k,x)=>{},[]),A=b.useCallback((k,x)=>{e(qe({selectedDate:k,agingDateSelectionType:x})),e(kt(k))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(y=>U(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=_(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),A=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),k=b.useCallback(y=>{h(qt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const L=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:A,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=_(A=>jn(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(A=>U(A)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(A=>{e(Qe({searchString:A}))},[]),h=b.useCallback((A,k)=>{e(Qe({sortKey:k,sortOrder:A}))},[]),p=b.useCallback(A=>{a(`./${A}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(A=>{e(Qe({downloadState:A}))},[]),S=b.useCallback((A,k)=>{e(Qe({selectedDate:A,agingDateSelectionType:k})),e(_t(A))},[]),E=b.useCallback((A,k)=>{e(Mn({nodeId:A,isCollapsed:k}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:A=>A.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Ln(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Un(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=At(n?.loggedInUserRoleMap);return _(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=At(n?.loggedInUserRoleMap),r=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return _(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;