@zeniai/web-app-ui 5.1.66-dev → 5.1.66-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.
- package/dist/assets/{AddressRoutes-DEXYkqV1.js → AddressRoutes-CokxYMz7.js} +1 -1
- package/dist/assets/{AddressScreen-D8kv1hF_.js → AddressScreen-CUjGRrDO.js} +1 -1
- package/dist/assets/{AiCfoScreen-BrNLceCE.js → AiCfoScreen-Bj3wXYWo.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-CvKgF8Ok.js → BillPayApprovalRoutes-sQQt1ym6.js} +1 -1
- package/dist/assets/{BillPayRoutes-DYswIHAT.js → BillPayRoutes-Cz4MhUrc.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-YVk91Fzz.js → BusinessVerificationPageScreen-DoJw9h9m.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-BO5V838O.js → CardsAiCfoScreen-1cCrf6uj.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-BZOF502-.js → ChargeCardRoutes-n-hcaove.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-CPKfXmmb.js → CompanyPassportScreen-CA3eoZ2w.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-Cv-HiaYb.js → ConnectionAuthScreen-FQS_lTfA.js} +1 -1
- package/dist/assets/{CustomerOnboardingAuthScreen-DdX8BaLn.js → CustomerOnboardingAuthScreen-CZybU74A.js} +1 -1
- package/dist/assets/{CustomerOnboardingRoutes-CKdlHWlk.js → CustomerOnboardingRoutes-Dh2ji4Ib.js} +1 -1
- package/dist/assets/{DashboardRoutes-CopaUmWi.js → DashboardRoutes-DYh34QWe.js} +1 -1
- package/dist/assets/{DefaultTenantHome-eT4t7R06.js → DefaultTenantHome-W15wNhHv.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-Cbmuyang.js → DomesticWireDetailScreen-DIHmD-T9.js} +1 -1
- package/dist/assets/{DrawerScreen-CCxq1yzF.js → DrawerScreen-l4bgWPF0.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-DK7l7FnA.js → EntityDetailRoutes-D_4M1i6-.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-C3RWrFV-.js → ExpenseAutomationRoutes-D_tUJVpQ.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-BuXd4W0P.js → FeaturePreviewScreen-bdq3UTfq.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-D1enkInm.js → HubSpotOAuthCallbackScreen-BiptMZ2v.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-BSRFSffK.js → MagicLinkRoutes-D9L5ixx1.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-BSh1nXKM.js → MagicLinkSignInScreen-COSHfZPw.js} +1 -1
- package/dist/assets/{MobileAppDrawer-BIP1MEKX.js → MobileAppDrawer-Dun-P89d.js} +1 -1
- package/dist/assets/{NotFoundScreen-DY1Wwus4.js → NotFoundScreen-CJOPcpwO.js} +1 -1
- package/dist/assets/{NotificationRoutes-6rN7RQjW.js → NotificationRoutes-BsMblVx4.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BqL6PD1E.js → OAuthConsentScreen-ChMO7Sn2.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-AcF3aqCk.js → PandLWithForecastRoutes-DtUWky96.js} +1 -1
- package/dist/assets/{PeopleRoutes-DPUTbQp_.js → PeopleRoutes-Bqk8AEBI.js} +1 -1
- package/dist/assets/{PerformanceRoutes-Cn4Ovnir.js → PerformanceRoutes-Yjr-NhGS.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BEQPddK1.js → QBOConnectionScreen-CEsTlTj_.js} +1 -1
- package/dist/assets/{ReferralListScreen-CQycV-0F.js → ReferralListScreen-DM7LN1h1.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-Ch3sYOOh.js → ReimbursementApprovalRoutes-CvztO8p6.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BJZRYRum.js → ReimbursementApprovalRuleDetailScreen-Buh9WwCp.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-CgQPRNMh.js → ReimbursementRoutes-CPQJS69Z.js} +1 -1
- package/dist/assets/{ReportsRoutes-CQztdl9E.js → ReportsRoutes-ByQCq-V7.js} +1 -1
- package/dist/assets/{RewardsRoutes-B0jOOo8W.js → RewardsRoutes-DcexvwE7.js} +1 -1
- package/dist/assets/{ScreenRoutes-D7kpFxVk.js → ScreenRoutes-Hfrkc2Mi.js} +2 -2
- package/dist/assets/{SettingsRoutes-CdvEgvyN.js → SettingsRoutes-Dwjn6yiJ.js} +1 -1
- package/dist/assets/{SetupPagesScreen-Dh6d6vu-.js → SetupPagesScreen-Dnm5sccr.js} +1 -1
- package/dist/assets/{SignInScreen-FuVo71JP.js → SignInScreen-Ed4IpkrH.js} +1 -1
- package/dist/assets/{SignOutScreen-DJh4f2Aj.js → SignOutScreen-DqyDFgZP.js} +1 -1
- package/dist/assets/{TaskListScreen-CnT3FhwB.js → TaskListScreen-CpyZd3qR.js} +1 -1
- package/dist/assets/{TaskRoutes-BlDolQ3c.js → TaskRoutes-Dp2ngbX6.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-C2XNyTUH.js → TransactionDetailRoutes-Ci_NeqmW.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-Ch_kEoMB.js → TransactionDetailScreen-CsoYHiYS.js} +1 -1
- package/dist/assets/{TransactionListRoutes-CAZZrQj-.js → TransactionListRoutes-BEUFTqmF.js} +1 -1
- package/dist/assets/{TreasuryRoutes-BQCtQUx_.js → TreasuryRoutes-Cdxg8mbK.js} +1 -1
- package/dist/assets/{VendorsRoutes-BGB3F2EZ.js → VendorsRoutes-Cq-Iy0rX.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-BSryCvdh.js → WiseConfirmationScreen-DuXEdOHj.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-D-szpn5h.js → ZeniAccountRoutes-CY5eCxJd.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-BORtLhU4.js → ZeniAccountStatementScreen-0gnO9ODP.js} +1 -1
- package/dist/assets/{analyticsHelper-BsiU5y2K.js → analyticsHelper-CsGwj-FA.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DiFaMSxg.js → getLocaleForTenant-e8sE0WQV.js} +1 -1
- package/dist/assets/{index-CJknvk0s.js → index-BLRtUSpL.js} +5 -5
- package/dist/assets/{routePaths-jWP9zfXs.js → routePaths-DPA1vVZP.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CgykUI65.js → useAiCfoDashboardSuggestedQuestionsChips-YJwtjlAT.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-BAtYgUWq.js → useAskAiCfoHostNavButtonProps-Cpb6UCmb.js} +1 -1
- package/dist/assets/{useCashManagementBanner-CRbG3Xtj.js → useCashManagementBanner-C3EqNZA6.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-Dq1SGHUY.js → useChargeCardPusherEvents-uB8sjNP3.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-CiGW-Jar.js → useEmailConnectResultRefresh-CgBbGn6X.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-DZr1J4rc.js → useInitialThreadRequest-DVPS_iNz.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DKnep6Xn.js → withTransactionSidePanel-CPTD79Uy.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-B5ZW-VBI.js";import{A as d}from"./AddressScreen-
|
|
1
|
+
import{j as e}from"./liveblocks-B5ZW-VBI.js";import{A as d}from"./AddressScreen-CUjGRrDO.js";import i from"./NotFoundScreen-CJOPcpwO.js";import"./sentry-BxWyF9h9.js";import{o as s,p as r}from"./core-Crl6eqZl.js";import"./zeni-epic-state-DTyrT1Ga.js";import"./recharts-e5u-LCPv.js";import"./index-BLRtUSpL.js";import"./mui-U77PQnc2.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-B5ZW-VBI.js";import{a as h}from"./sentry-BxWyF9h9.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-Crl6eqZl.js";import{j as $,m as D,z as L,I as K,B as U,V as z,c as C,e as S,n as F,f as b,r as N}from"./index-
|
|
1
|
+
import{j as r}from"./liveblocks-B5ZW-VBI.js";import{a as h}from"./sentry-BxWyF9h9.js";import{h as P,u as _,g as j,i as M,j as E,n as B}from"./core-Crl6eqZl.js";import{j as $,m as D,z as L,I as K,B as U,V as z,c as C,e as S,n as F,f as b,r as N}from"./index-BLRtUSpL.js";import{MH as I,hU as R,eW as V,MI as G,c6 as H,MJ as O,ld as q}from"./zeni-epic-state-DTyrT1Ga.js";import{n as J}from"./mui-U77PQnc2.js";import W from"./NotFoundScreen-CJOPcpwO.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]="ce430108-189f-49f7-a8c9-f2de56e9de7c",e._sentryDebugIdIdentifier="sentry-dbid-ce430108-189f-49f7-a8c9-f2de56e9de7c")}catch{}})();const Q=J.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{a as r}from"./sentry-BxWyF9h9.js";import{u as we,h as xe,g as Pe,j as J,i as ye,n as Ee}from"./core-Crl6eqZl.js";import{U as Te,da as ve,z as Ae,j as Qe,db as _e,dc as Ue,b9 as Z,dd as ae,de as Oe,b8 as se,r as M,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 Ne,s as qe,b4 as We,dn as ze}from"./index-CJknvk0s.js";import{gl as He,eV as oe,eW as Ke,iA as Xe,TT as Ye,fp as Je,iK as Ze,iG as et,eX as R,fw as tt,g6 as at,f$ as st,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-DTyrT1Ga.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-U77PQnc2.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-CgykUI65.js";import{p as pt}from"./pathToGoBack-BWWNiH76.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.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]="2f912968-7a41-40f4-b5cd-60e78db0f54a",e._sentryDebugIdIdentifier="sentry-dbid-2f912968-7a41-40f4-b5cd-60e78db0f54a")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=se(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&We(e,s,l,S,w,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=we(),u=xe(),a=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=J(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=J(i=>Ke(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=a.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),N=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),q=N.get("ref")??P?.aiCfoRef,L=N.get("emailRefId")??P?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||q!=="month-end-email"||L==null||n!=null||s==null||(t(Xe("controller",s.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[q,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Oe(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",K=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(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(Ze())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&K&&s!=null&&F==="Completed"&&!D&&t(et(n,s.userId))},[H,K,n,s,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad: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:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
1
|
+
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{a as r}from"./sentry-BxWyF9h9.js";import{u as we,h as xe,g as Pe,j as J,i as ye,n as Ee}from"./core-Crl6eqZl.js";import{U as Te,da as ve,z as Ae,j as Qe,db as _e,dc as Ue,b9 as Z,dd as ae,de as Oe,b8 as se,r as M,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 Ne,s as qe,b4 as We,dn as ze}from"./index-BLRtUSpL.js";import{gl as He,eV as oe,eW as Ke,iA as Xe,TT as Ye,fp as Je,iK as Ze,iG as et,eX as R,fw as tt,g6 as at,f$ as st,g3 as ee,g7 as ot,g8 as nt,g9 as it,ga as rt,gb as lt}from"./zeni-epic-state-DTyrT1Ga.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-U77PQnc2.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-YJwtjlAT.js";import{p as pt}from"./pathToGoBack-BWWNiH76.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.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]="2f912968-7a41-40f4-b5cd-60e78db0f54a",e._sentryDebugIdIdentifier="sentry-dbid-2f912968-7a41-40f4-b5cd-60e78db0f54a")}catch{}})();const ne="chat-response-generated",ht=Ee(function(e,o){const t=oe(e),u=o.isSubmitting,a=t.uiState?.currentChatSessionId,h=a!=null?tt(e.aiCfoState,a):[],S=Re(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:x,currentQuestionAnswerSummary:A}=se(w,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,x?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,x?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&We(e,s,l,S,w,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=qe(t.state?.pathnameStackToGoBack,t.pathname);h(`/${u.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:s.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(s,l)=>{e(at({questionAnswerId:s,isCollapsed:l}))},onMenuClick:o.onMenuClick,...Ne(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:v,currentChatSessionId:S,onAfterCardsCreationSubmit:()=>{b(!0),h(`/${m}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{b(!0),h(`/${m}/cards/policy`,{state:{...t.state}})}})}})(Ve(Be)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=we(),u=xe(),a=Pe(),[h,S]=r.useState(!1),{allUsers:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=J(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=J(i=>Ke(i)),n=m.uiState.currentChatSessionId,x=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:x}),Q=Ue({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),P=a.state,y=P?.aiCfoInitialQuestion,$=!!P?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[Z]!==!0)return;S(!0);const f={...i};delete f[Z],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,U]=r.useState(!1),[ue,O]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),U($),O(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),U(!1),O(void 0),j(void 0),u(a.pathname,{replace:!0,state:ae(a.state)})},[a.pathname,a.state,u]),N=r.useMemo(()=>new URLSearchParams(a.search),[a.search]),q=N.get("ref")??P?.aiCfoRef,L=N.get("emailRefId")??P?.aiCfoEmailRefId,W=r.useRef(!1);r.useEffect(()=>{W.current||q!=="month-end-email"||L==null||n!=null||s==null||(t(Xe("controller",s.userId,L,"MONTH_END_EMAIL")),W.current=!0)},[q,L,n,t,s]);const E=m.uiState.lastContextMessage;r.useEffect(()=>{E!=null&&E!==""&&n!=null&&(_(E),U(!0),O(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Oe(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",K=n==null||(m.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),X=m.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:Se}=se(X,n),ge=Se.length===0;r.useEffect(()=>{C||g||u("../dashboard",{state:{...a.state,message:"open_ai_cfo_drawer"}})},[C,g,u,a.state]);const fe=r.useCallback(()=>{const i=M(a.state?.pathnameStackToGoBack),f=p.tenantEmailDomain;u(i.poppedPathname??(f!=null?`/${f}/dashboard`:".."),{state:{...a.state,pathnameStackToGoBack:i.newStack}})},[p.tenantEmailDomain,a.state,u]);r.useEffect(()=>{n!=null&&l!==n&&u(`../ai-cfo/${n}`,{state:{...a.state}})},[n,l]),r.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&l!=="explore"&&t(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(Ze())},[F,D,t]),r.useEffect(()=>{n!=null&&H!=="In-Progress"&&K&&s!=null&&F==="Completed"&&!D&&t(et(n,s.userId))},[H,K,n,s,t]);const Y=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(s==null||l==null)throw Error("Can't access AI Controller page without signing in...");const be=n!=null&&m.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";if(!C&&g)return c.jsxs(gt,{children:[c.jsx(V,{analytics:I,onLoad: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:w,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId:s.userId,setIsAiCfoOpen:o,navigate:u,sessionFromUrl:l,location:a,isSubmitting:be,isEmptyChatWithSession:ge,currentTenant:p,emailLinkQuestion:de??void 0,autoSubmitEmailLinkQuestion:ce,onEmailLinkQuestionProcessed:pe,routedInitialQuestionSource:ue,routedInitialQuestionSuggestionIndex:me,onCardPolicyVendorSearchTextChange:b,onMenuClick:g?Q.open:void 0,isFileUploadEnabled:e,isUploadPromoVisible:ie,onUploadPromoClose:A,exploreSuggestedPromptQuestions:le,exploreSuggestedPromptQuestionsLoading:re}),h&&g?c.jsx(dt,{anchor:"right",open:h,transitionDuration:250,PaperProps:{component:Ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>S(!1),children:c.jsx(te,{onClick:i=>i.stopPropagation(),children:c.jsx(B,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(R(p.userRoleId)),S(!1)}})})}):null]}),h&&!g?c.jsx(je,{open:h,onClose:()=>S(!1),children:c.jsx(Le,{children:Ie})}):null]})},te=k(ct)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{a as v}from"./sentry-BxWyF9h9.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-Crl6eqZl.js";import{eW as P,Q5 as A,PN as h,zp as E,zh as q,zl as R,za as K,PP as M,zr as ae,zd as Q,zu as G,zq as C}from"./zeni-epic-state-DTyrT1Ga.js";import{z as V,a7 as H,bL as oe,af as O,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-CJknvk0s.js";import"./mui-U77PQnc2.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-BJZRYRum.js";import re from"./NotFoundScreen-DY1Wwus4.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="2604ea1c-0791-41d5-8a53-bac75ebe34f1",e._sentryDebugIdIdentifier="sentry-dbid-2604ea1c-0791-41d5-8a53-bac75ebe34f1")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>P(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>P(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
1
|
+
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{a as v}from"./sentry-BxWyF9h9.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-Crl6eqZl.js";import{eW as P,Q5 as A,PN as h,zp as E,zh as q,zl as R,za as K,PP as M,zr as ae,zd as Q,zu as G,zq as C}from"./zeni-epic-state-DTyrT1Ga.js";import{z as V,a7 as H,bL as oe,af as O,bC as J,bM as le,m as X,B as Y,bN as pe,bO as se}from"./index-BLRtUSpL.js";import"./mui-U77PQnc2.js";import{u as Z,i as ne}from"./ReimbursementApprovalRuleDetailScreen-Buh9WwCp.js";import re from"./NotFoundScreen-CJOPcpwO.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},p=new e.Error().stack;p&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[p]="2604ea1c-0791-41d5-8a53-bac75ebe34f1",e._sentryDebugIdIdentifier="sentry-dbid-2604ea1c-0791-41d5-8a53-bac75ebe34f1")}catch{}})();const T="bill-approval-rule-update",ie=k(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(T)&&e(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(H(oe)),ce=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s)),i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!1)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${T}`]:[],eventCallback:(s,w,S)=>{s.endsWith(T)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ie,{currentTenant:u,location:t,navigate:p,...m})},_="bill-approval-rule-update",ue=k(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,o={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o[r.id]=r.name);const a={};for(const r of Object.values(e.classState.classesByKey))r?.classId!=null&&(a[r.classId]=r.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}},function(e,p){const{navigate:t,location:o}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(_)&&e(M(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(K(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(ae(a,!0))}}})(H(le)),de=()=>{const e=y(o=>P(o)),{isApprovalRulesV3Enabled:p,isLoading:t}=J(e?.tenantId);return p?c.jsx(ve,{isLoading:t}):c.jsx(ce,{isLoading:t})},ve=({isLoading:e})=>{const p=U(),t=B(),o=j(),[a,r]=v.useState(!1),[n,d]=v.useState(!1),l=y(s=>s.billPaySetupApproverViewState.fetchState),u=y(s=>P(s));Z();const i=y(s=>A(s)),f=y(s=>h(s).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&o(E())},[f]),v.useEffect(()=>{a||l!=="Not-Started"||e||(r(!0),o(q(!0,!0,!0)))},[a,l,e,o]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{i.allApprovalRules.length===0&&i.fetchState==="Completed"&&(n||(d(!0),o(R())),p("./new"))},[n,i,o]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${_}`]:[],eventCallback:(s,w,S)=>{s.endsWith(_)&&S.onApprovalRulesEventReceived(s)}};return u?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(z,{to:"../../promo"}):c.jsx(ue,{currentTenant:u,location:t,navigate:p,isLoading:e,...m})},fe=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let r=t.allApprovalRules.length===0;return p.approvalRuleId&&(r=t.allApprovalRules.findIndex(n=>n.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:r,approvalUpdateActionType:o}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=f=>{const m=[];return f.forEach(s=>{const w=s.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),S=s.actors.selectedNonUsers.map(b=>{const I=!!ne(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),g=w.concat(S);m.push({action:s.stepType.selectedOption,actors:g,operator:g.length>1?s.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},i={amount:{type:"amount",comparator:"range",min:{amount:l.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:l.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(n==="approval_create"){const f={criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}else{const f={approvalRuleId:r,criteria:i,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(f))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!1))},onSaveRuleSuccess:()=>{t("../")}}})(pe);function ye(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(fe,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t})}const ge=k(function(e,p){const t=h(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],r={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(a.push(n.id),r[n.id]=n.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:r,editingRuleId:o==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:r}=p,n=o.billPaySetupApproverViewUpdateData?.type,d=O(p.location);return{onApprovalRuleDataUpdated:l=>{const u=g=>{const b=[];return g.forEach(I=>{const L=I.actorKind?.selectedOption,N=I.selectedRole?.selectedOption;let x=[];L==="role"&&N!=null?x=[{type:"attribute",subType:N,userId:void 0,idType:void 0,isImplicitActor:!1}]:L==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(ee=>({type:"user",userId:ee.userId,isImplicitActor:!1})));const F=I.action??"require_approval";b.push({action:F,actors:x,operator:x.length>1?F==="require_approval"?"or":"and":"is"})}),b},i=l.amountCriteria,f=l.vendorCriteria,m=l.departmentCriteria,s={};if(i!=null&&i.comparator.selectedOption!=null){const g=i.comparator.selectedOption;s.amount={type:"amount",comparator:g,min:g==="less_than"?void 0:i.min,max:g==="greater_than"?void 0:i.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(s.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const S=m?.selection.selectedOptions??[];if(S.length>0&&(s.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:S}),n==="approval_create"){const g={name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}else{const g={approvalRuleId:r,name:l.name,description:l.description,separationOfDuties:l.separationOfDuties,isFallback:l.isFallback,criteria:s,steps:u(l.steps),isApplicableOnPendingApprovalEntity:l.applyToExistingBills.includes("applyToExistingBills")};e(C(g))}},onResetClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),n==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(G(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:l=>{e(R(l)),t(n==="approval_update"?`../../${l}/edit`:`../${l}/edit`)}}})(se);function $(){const e=y(t=>P(t)),{isApprovalRulesV3Enabled:p}=J(e?.tenantId);return p?c.jsx(me,{}):c.jsx(ye,{})}function me(){const e=U(),p=j(),t=B(),{approvalRuleId:o}=W(),a=V.getSignedInUser(),r=X(),n=y(i=>h(i)),d=y(i=>A(i)),[l,u]=v.useState(!1);if(Z(),v.useEffect(()=>{l||(u(!0),p(Q(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(o!=null?"../../":"../")},[d,o]),a==null)throw Error("Can't access address page without signing in...");return n.approverListFetchStatus.fetchState=="Not-Started"||n.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(Y,{fetchState:n.approverListFetchStatus.fetchState,style:{backgroundColor:r.colors.grey5}}):c.jsx(ge,{navigate:e,approvalUpdateDataView:n,approvalRuleId:o,approverViewData:d,location:t},o??"new")}function xe(){return c.jsxs(te,{children:[c.jsx(D,{path:"/",element:c.jsx(de,{})}),c.jsx(D,{path:"/new",element:c.jsx($,{})}),c.jsx(D,{path:"/:approvalRuleId/edit",element:c.jsx($,{})}),c.jsx(D,{path:"*",element:c.jsx(re,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-B5ZW-VBI.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as na,o as ia,p as S}from"./core-Crl6eqZl.js";import{eW as Z,Pn as _e,bs as kt,Kc as oa,bq as wt,bJ as pe,Po as At,yH as Ct,zW as $e,ze as la,bn as De,Pp as sa,Pq as ra,c6 as ca,Pr as da,kx as Bt,Ps as xt,Pt as Et,Av as Ge,yW as Be,Pu as ua,yv as tt,Pv as pa,EA as ma,yz as ba,yF as Dt,Pw as ve,Px as Me,zX as Ne,Py as ha,Pz as ga,z_ as Oe,PA as ya,Ab as Sa,PB as Pt,zH as at,zM as fa,PC as va,PD as ue,PE as jt,PF as Tt,PG as Ft,gp as Ia,y$ as Le,cA as Rt,PH as ka,fy as wa,PI as Aa,PJ as Ca,fD as Vt,fB as $t,PK as ze,PL as Ba,PM as xa,N6 as Ze,PN as Ea,N7 as oe,N8 as He,PO as Da,PP as Pa,PQ as ja,zO as nt,zL as Ta,PR as Fa,PS as Ra,PT as Va,zx as $a,PU as La,PV as Ua,PW as _a,co as Lt,cQ as Ut,kI as Ga,bP as Ma,bo as _t,bQ as Gt,xN as Na,PX as Oa,En as za,Et as Za,ub as Ha,zY as Wa,AC as Qa,kV as fe,PY as qa,PZ as Mt,ln as Ka,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ja,P_ as Xa,P$ as Ie,js as Ya,Q0 as ot,Q1 as en,jw as tn,jR as an,AQ as nn,Q2 as on,lg as ln,AG as sn,Q3 as lt,AK as rn,AP as cn,AM as dn,AE as un,Q4 as zt,yQ as pn,Q5 as mn,Q6 as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as vn,l5 as In,AI as kn,jC as wn,lu as An,Q7 as Cn,ju as Bn,rt as xn,Q8 as En,zD as Dn,bK as Pn,bt as jn,LW as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-DTyrT1Ga.js";import{m as me,z as V,I as ke,Z as We,W as le,Q as y,aQ as xe,B as re,o as x,V as Pe,c as D,bh as Ln,r as z,a2 as Qe,s as E,j as we,bi as rt,bj as ct,bk as Un,ak as _n,A as Gn,aK as Mn,x as Zt,F as qe,y as Ke,bl as Nn,at as Ht,bm as On,X as zn,e as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as Qn,bq as qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,$ as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-CJknvk0s.js";import{n as U,S as si}from"./mui-U77PQnc2.js";import{A as dt}from"./AddressScreen-D8kv1hF_.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-Cbmuyang.js";import{a as f}from"./sentry-BxWyF9h9.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BAtYgUWq.js";import{u as qt}from"./useInitialThreadRequest-DZr1J4rc.js";import Ee from"./NotFoundScreen-DY1Wwus4.js";import{D as ui}from"./DrawerScreen-CCxq1yzF.js";import{M as Kt}from"./MobileAppDrawer-BIP1MEKX.js";import{F as Jt}from"./FeaturePreviewScreen-BuXd4W0P.js";import{S as Te}from"./SetupPagesScreen-Dh6d6vu-.js";import{B as pi}from"./BillPayApprovalRoutes-CvKgF8Ok.js";import{FallBackRoute as mi}from"./ScreenRoutes-D7kpFxVk.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./analyticsHelper-BsiU5y2K.js";import"./routePaths-jWP9zfXs.js";import"./BusinessVerificationPageScreen-YVk91Fzz.js";import"./ReimbursementApprovalRuleDetailScreen-BJZRYRum.js";import"./getLocaleForTenant-DiFaMSxg.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]="f14180e1-d5f7-4dc0-9b04-f29ada3cdc21",e._sentryDebugIdIdentifier="sentry-dbid-f14180e1-d5f7-4dc0-9b04-f29ada3cdc21")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=ke(),o=I(N=>Z(N)),s=I(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),Q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,k]=f.useState(!1),[H,M]=f.useState(),B=I(F=>Me(F,m,g,n));let Q=B.fetchState,W=B.file,L=B.showAutofill;const q=I(F=>_e(F,n??""));u===!1&&(Q=q.fetchState,W=q.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{Q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Q==="Error"||q.fetchState==="Error")return a.jsx(Ee,{});if(Q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,q,B),setShowConfirmationPopup:k,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-B5ZW-VBI.js";import{h as K,u as se,g as J,i as ae,j as I,N as te,n as X,l as na,o as ia,p as S}from"./core-Crl6eqZl.js";import{eW as Z,Pn as _e,bs as kt,Kc as oa,bq as wt,bJ as pe,Po as At,yH as Ct,zW as $e,ze as la,bn as De,Pp as sa,Pq as ra,c6 as ca,Pr as da,kx as Bt,Ps as xt,Pt as Et,Av as Ge,yW as Be,Pu as ua,yv as tt,Pv as pa,EA as ma,yz as ba,yF as Dt,Pw as ve,Px as Me,zX as Ne,Py as ha,Pz as ga,z_ as Oe,PA as ya,Ab as Sa,PB as Pt,zH as at,zM as fa,PC as va,PD as ue,PE as jt,PF as Tt,PG as Ft,gp as Ia,y$ as Le,cA as Rt,PH as ka,fy as wa,PI as Aa,PJ as Ca,fD as Vt,fB as $t,PK as ze,PL as Ba,PM as xa,N6 as Ze,PN as Ea,N7 as oe,N8 as He,PO as Da,PP as Pa,PQ as ja,zO as nt,zL as Ta,PR as Fa,PS as Ra,PT as Va,zx as $a,PU as La,PV as Ua,PW as _a,co as Lt,cQ as Ut,kI as Ga,bP as Ma,bo as _t,bQ as Gt,xN as Na,PX as Oa,En as za,Et as Za,ub as Ha,zY as Wa,AC as Qa,kV as fe,PY as qa,PZ as Mt,ln as Ka,kP as Nt,l8 as Ot,l7 as it,bE as be,bO as Ja,P_ as Xa,P$ as Ie,js as Ya,Q0 as ot,Q1 as en,jw as tn,jR as an,AQ as nn,Q2 as on,lg as ln,AG as sn,Q3 as lt,AK as rn,AP as cn,AM as dn,AE as un,Q4 as zt,yQ as pn,Q5 as mn,Q6 as bn,gh as hn,gg as gn,gf as yn,kY as Sn,le as st,lp as fn,rC as vn,l5 as In,AI as kn,jC as wn,lu as An,Q7 as Cn,ju as Bn,rt as xn,Q8 as En,zD as Dn,bK as Pn,bt as jn,LW as Tn,cS as Fn,cR as Rn,cz as Vn,cG as $n}from"./zeni-epic-state-DTyrT1Ga.js";import{m as me,z as V,I as ke,Z as We,W as le,Q as y,aQ as xe,B as re,o as x,V as Pe,c as D,bh as Ln,r as z,a2 as Qe,s as E,j as we,bi as rt,bj as ct,bk as Un,ak as _n,A as Gn,aK as Mn,x as Zt,F as qe,y as Ke,bl as Nn,at as Ht,bm as On,X as zn,e as Wt,a7 as Zn,bn as Hn,bo as Wn,bp as Qn,bq as qn,br as Kn,bs as Jn,bt as Xn,bu as Yn,bv as ei,$ as ti,bw as ai,bc as ni,bx as ii,by as oi,a9 as li}from"./index-BLRtUSpL.js";import{n as U,S as si}from"./mui-U77PQnc2.js";import{A as dt}from"./AddressScreen-CUjGRrDO.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-DIHmD-T9.js";import{a as f}from"./sentry-BxWyF9h9.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Cpb6UCmb.js";import{u as qt}from"./useInitialThreadRequest-DVPS_iNz.js";import Ee from"./NotFoundScreen-CJOPcpwO.js";import{D as ui}from"./DrawerScreen-l4bgWPF0.js";import{M as Kt}from"./MobileAppDrawer-Dun-P89d.js";import{F as Jt}from"./FeaturePreviewScreen-bdq3UTfq.js";import{S as Te}from"./SetupPagesScreen-Dnm5sccr.js";import{B as pi}from"./BillPayApprovalRoutes-sQQt1ym6.js";import{FallBackRoute as mi}from"./ScreenRoutes-Hfrkc2Mi.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./analyticsHelper-CsGwj-FA.js";import"./routePaths-DPA1vVZP.js";import"./BusinessVerificationPageScreen-DoJw9h9m.js";import"./ReimbursementApprovalRuleDetailScreen-Buh9WwCp.js";import"./getLocaleForTenant-e8sE0WQV.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]="f14180e1-d5f7-4dc0-9b04-f29ada3cdc21",e._sentryDebugIdIdentifier="sentry-dbid-f14180e1-d5f7-4dc0-9b04-f29ada3cdc21")}catch{}})();const bi=X(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ve({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=J(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=ke(),o=I(N=>Z(N)),s=I(N=>_e(N,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=qt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&kt(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,v]=f.useState(!1),[P,A]=f.useState(!1),[C,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:k}=j(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(y.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),B=oa(o),Q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:q}=j(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(Q||W||s.allApprovers.find(N=>N.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,Q,W,o.isZeni,B,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(v(!0),t(Ct(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:N=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(N)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:k,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:q,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=qe.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Oe(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(Sa({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Ne(n))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Mn);function w({appContent:e}){const t=se(),l=K(),{billId:n}=ae(),c=J(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),i=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:v}=p(xe.zeniAssistConfig),P=v.user_ids!=null&&i?.userId!=null&&v.user_ids.includes(i?.userId),A=I(F=>Z(F)),[C,G]=f.useState(!1),[j,_]=f.useState(!1),[$,k]=f.useState(!1),[H,M]=f.useState(),B=I(F=>Me(F,m,g,n));let Q=B.fetchState,W=B.file,L=B.showAutofill;const q=I(F=>_e(F,n??""));u===!1&&(Q=q.fetchState,W=q.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{n==null&&t(Ne(!0))},[n,t]),f.useEffect(()=>{Q==="Not-Started"&&(u&&j?_(!1):!u&&C&&G(!1))},[n]),f.useEffect(()=>{C||n==null||u||(G(!0),t(Ct(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[C,j,u,n,t]);const N={onOkClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Oe(H,m,n))},onCancelClick:()=>{if(k(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","no"),t(ha({file:H,billId:n}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ve({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(Q==="Error"||q.fetchState==="Error")return a.jsx(Ee,{});if(Q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:k,setPayload:M,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:N,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,q,B),setShowConfirmationPopup:k,setPayload:M,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Nn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(Ii,{children:`${ye.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(ki,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-B5ZW-VBI.js";import{a as V}from"./sentry-BxWyF9h9.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-Crl6eqZl.js";import{I as ce,W as ue,aQ as de,z,V as pe,c as B,af as x,e as E,bH as le,at as me,s as P,au as M}from"./index-
|
|
1
|
+
import{j as C}from"./liveblocks-B5ZW-VBI.js";import{a as V}from"./sentry-BxWyF9h9.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-Crl6eqZl.js";import{I as ce,W as ue,aQ as de,z,V as pe,c as B,af as x,e as E,bH as le,at as me,s as P,au as M}from"./index-BLRtUSpL.js";import{PV as fe,eW as G,tC as ye,Kf as Se,zx as ge,CY as Ie,FJ as be,Gm as he,Hm as Te,Qg as De,Qh as Oe,Qi as Ce,Qj as ke,Qk as Ve,MI as we,Pi as Ae,MZ as Ne,E0 as Fe,M_ as _e,E4 as ve,ld as xe,gh as Ee,gg as ze,gf as Be,rC as Pe,rt as Me,rq as Re,l5 as Ue,tL as Le,tJ as R,bE as U,tX as L,cy as je}from"./zeni-epic-state-DTyrT1Ga.js";import{n as Ge}from"./mui-U77PQnc2.js";import{d as j}from"./routePaths-DPA1vVZP.js";import{M as Qe}from"./MobileAppDrawer-Dun-P89d.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]="f27b2e23-5d74-4b0f-9ef0-0b52f6757c3b",t._sentryDebugIdIdentifier="sentry-dbid-f27b2e23-5d74-4b0f-9ef0-0b52f6757c3b")}catch{}})();const qe=Ge.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-B5ZW-VBI.js";import{a as l}from"./sentry-BxWyF9h9.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Crl6eqZl.js";import{U as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,V as we,c as $,df as H,dp as Ee,F as ke,e as Ae,a7 as Te,di as xe,dj as Ue,a2 as _e,dm as Oe,b4 as ve,dn as Qe}from"./index-
|
|
1
|
+
import{j as g}from"./liveblocks-B5ZW-VBI.js";import{a as l}from"./sentry-BxWyF9h9.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-Crl6eqZl.js";import{U as ge,da as be,z as ye,db as Pe,dd as z,de as Ie,b8 as W,V as we,c as $,df as H,dp as Ee,F as ke,e as Ae,a7 as Te,di as xe,dj as Ue,a2 as _e,dm as Oe,b4 as ve,dn as Qe}from"./index-BLRtUSpL.js";import{gl as Fe,eV as G,eW as $e,fp as Ve,iK as De,iG as Le,eX as B,g6 as je,f$ as Re,g3 as N,g7 as qe,g8 as Me,g9 as He,ga as Be,gb as Ne}from"./zeni-epic-state-DTyrT1Ga.js";import{D as ze,n as D,P as We,S as Ge}from"./mui-U77PQnc2.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.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]="deeac0bb-2601-4678-8d99-af8b60b01a45",e._sentryDebugIdIdentifier="sentry-dbid-deeac0bb-2601-4678-8d99-af8b60b01a45")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function V(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}},function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===Y?Z(i):V(i);return{onEventReceived:(n,t)=>{if(n===K&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=Me(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Qe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,He(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Be({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(Ne({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&ve(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(qe(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(n){return`/${n}/${X}`}(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(je({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(V(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=J.pageTitle,Xe=ee.pageTitle,Ye=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{o(Fe())},[o]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),n=M(r=>$e(r)),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===Y,te=I?"card_policy":void 0,se=l.useMemo(()=>({title:I?Xe:A,subtitle:I?Ze:Ye}),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const ne=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect(()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}},[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,j=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",R=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),q=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(q,t),le=re.length===0;l.useEffect(()=>{t!=null&&p!==t&&c(function(r,w){return`/${r}/${X}/${w}`}(s,t),{state:{...d.state},replace:!0})},[t,p,s,c,d.state]),l.useEffect(()=>{p!=null&&t==null&&p!=="new_chat"&&o(Ve({sessionId:p,agentId:"controller"}))},[]);const de=l.useMemo(()=>({events:L.map(r=>`private-encrypted-chat-${r}.${K}`),eventCallback:(r,w,me)=>me.onEventReceived(r,w)}),[L]);if(l.useEffect(()=>{Q!=="In-Progress"&&F&&o(De())},[Q,F,o]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Le(t,C.userId))},[j,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(et,{children:[g.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),S?g.jsx(Ke,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?Z(s):V(s),{state:{...d.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(B(n.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(B(n.userRoleId)),h(!1)}})})})]})},Je=D(Ge)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{u as ue,j as i,h as de,g as pe,i as Me,N as ba,s as At,n as De,t as kn,o as es,p as se}from"./core-Crl6eqZl.js";import{f7 as Dt,RS as as,fj as _t,bt as Pe,RT as ts,RU as ns,eY as mn,RV as En,f5 as An,RW as Dn,RX as _n,RY as Pn,RZ as wn,f6 as vn,fi as Tn,R_ as Fn,R$ as rs,fc as ss,fb as cs,S0 as os,C1 as xn,fl as ca,S1 as is,S2 as ds,e_ as ls,eZ as us,fy as ze,fe as Bn,fd as Rn,S3 as ms,ff as Cs,By as ps,Bx as hs,BB as fs,BD as gs,fr as Ss,eV as Ln,S4 as bs,S5 as ys,fw as Un,S6 as Is,fx as St,BJ as ks,BG as Es,eW as fe,S7 as qa,fB as we,fC as ve,fD as Te,gw as oa,cv as ia,S8 as da,S9 as Pt,uQ as $a,kF as za,Sa as Wa,Ch as ka,fm as Qe,Cj as wt,kv as On,Sb as la,C5 as _a,Sc as As,Sd as Ds,C8 as Qa,Se as _s,Qd as Ja,fh as jn,Ce as ga,hV as Ps,Sf as Mn,f8 as ua,bo as ws,Sg as vs,gh as Xa,gg as et,CN as Ts,gf as at,PV as Fs,Sh as Nn,co as Vn,cQ as xs,Qc as wa,Dm as Hn,Si as Cn,CY as Pa,Sj as Gn,Dn as Bs,QC as Rs,Do as Ls,Et as Us,ub as Os,En as js,Sk as Ms,Ci as ra,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as $s,Sq as vt,Sr as zs,Cy as $n,Cr as Ws,Ss as Ys,gy as Zs,CH as zn,CL as Wn,gx as Ks,St as qs,D8 as Yn,Su as Qs,Sv as Js,Sw as Xs,CJ as Zn,Cu as Kn,Cb as qn,CD as Qn,CB as Jn,CF as ec,Sx as Xn,Sy as ac,ft as tc,fu as nc,fv as rc,Sz as tt,fn as er,cR as Tt,SA as sc,SB as cc,SC as oc,SD as ic,CT as bt,Df as dc,Db as lc,CP as uc,Dd as mc,D3 as Cc,D5 as pc,SE as ar,Dl as Ga,Kc as hc,SF as fc,SG as gc,SH as Sc,SI as tr,SJ as bc,DI as yc,CX as nr,CS as je,CW as Ic,SK as kc,SL as Ec,C2 as Ac,SM as rr,fg as sr,SN as Dc,C4 as _c,C3 as pn,SO as Pc,SP as wc,SQ as vc,MJ as Tc,SR as Ft,SS as Fc,xQ as cr,ld as xc,hL as Bc,DN as Rc,ST as or,f2 as Lc,f3 as Uc,SU as Oc,di as jc,fk as Mc,DD as Nc,Dx as qe,bs as Vc,bJ as Hc,cA as Gc,bK as $c,LW as zc}from"./zeni-epic-state-DTyrT1Ga.js";import{I as Fe,cp as ir,r as _e,cq as dr,cr as lr,cs as Wc,F as Xe,Z as xt,ct as Yc,cu as Zc,U as ur,a as mr,Y as Cr,s as ye,W as le,Q as Y,aq as ya,cv as pr,cw as Kc,cx as qc,z as ne,B as va,ce as nt,cy as Qc,cz as Jc,cA as Xc,j as Ta,aQ as We,br as Bt,cB as eo,x as Fa,f as rt,m as Rt,c as J,a7 as st,cC as ao,bE as Sa,cD as yt,cE as to,V as Lt,cF as no,at as hr,a2 as It,cG as ro,X as fr,e as gr,cH as so,cI as co,cJ as oo,cK as io,cL as lo,cM as uo,o as Ya,cN as mo,cO as Co,cP as Ct,$ as po,cQ as ho,cR as fo,cS as go,cT as So,cU as bo,a9 as yo}from"./index-CJknvk0s.js";import{n as Ne,D as Sr,S as Io}from"./mui-U77PQnc2.js";import{a as r}from"./sentry-BxWyF9h9.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BAtYgUWq.js";import{M as Ie}from"./MobileAppDrawer-BIP1MEKX.js";import{d as Ut}from"./recharts-e5u-LCPv.js";import{g as Ae,a as Ba,b as br,c as xe,d as Be,e as Je,f as ea,h as aa,A as ko,i as Ot,P as Eo,j as jt,s as Ia,k as yr,l as sa,m as Ir,n as Ao,o as kr,p as Do,S as hn}from"./SetupPagesScreen-Dh6d6vu-.js";import{u as Er}from"./useInitialThreadRequest-DZr1J4rc.js";import ct from"./NotFoundScreen-DY1Wwus4.js";import{u as Mt}from"./useChargeCardPusherEvents-Dq1SGHUY.js";import{n as fn}from"./utils-BjvWDnmB.js";import{t as _o}from"./AddressScreen-D8kv1hF_.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./analyticsHelper-BsiU5y2K.js";import"./routePaths-jWP9zfXs.js";import"./BusinessVerificationPageScreen-YVk91Fzz.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]="2b780a0b-d665-484d-ad3e-a563a1c002d4",e._sentryDebugIdIdentifier="sentry-dbid-2b780a0b-d665-484d-ad3e-a563a1c002d4")}catch{}})();const Po=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Ar=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Po(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Dr(){const e=ue(),n=i(a=>Dt(a.cardPolicyState)),t=i(a=>as(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(_t())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:gn}}}=Xe.getLocalizedStrings(),wo=e=>Bn(e,!1),vo=e=>Rn(e.name,!1);function To(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(mn())},[a]);const w=i(A=>En(A.cardPolicyState)),m=i(A=>An(A.cardPolicyState)),j=i(A=>Dn(A.cardPolicyState)),F=i(A=>_n(A.cardPolicyState)),x=i(A=>Pn(A.cardPolicyState)),h=i(A=>wn(A.cardPolicyState)),f=i(A=>vn(A.cardPolicyState)),v=i(A=>Dt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),T=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Tn())},[a,w]),Dr();const b=i(A=>Fn(A.createCardPolicyState)),O=i(A=>rs(A.createCardPolicyState)),D=i(A=>ss(A.cardPolicyState)),k=i(A=>cs(A.cardPolicyState)),R=i(A=>os(A.createCardPolicyState)),d=i(A=>xn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[d.fetchState,a]);const p=r.useMemo(()=>m.map(wo),[m]),M=r.useMemo(()=>f.map(vo),[f]),V=r.useMemo(()=>d.cards.filter(A=>!ir(A.status.code)).map(Ar),[d.cards]),U=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect(()=>{U&&R==null&&a(is({cardsMasterList:V,defaultRequireReceiptAmount:l,suggestedAllowMerchants:j,suggestedBlockMerchants:F,suggestedAllowCategories:x,suggestedBlockCategories:h}))},[T,a,U,R,V,l,j,F,x,h]);const L=r.useMemo(()=>Ut(A=>{a(_t(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),H=b.fetchState,I=t!=null?`/${t}/cards/policy`:"..",P=r.useCallback(()=>{const A=_e(n.state?.pathnameStackToGoBack),K=A.poppedPathname??I;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,I]),W=r.useCallback(()=>{e(I)},[e,I]),Q=r.useCallback(A=>{a(ds(A))},[a]),E=r.useCallback(A=>{const K=dr(A);a(ls({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(us(A))},[a]),Z=r.useCallback(()=>{a(mn())},[a]),X=r.useRef(H);r.useEffect(()=>{const A=X.current;X.current=H,H==="Completed"&&A!=="Completed"&&O!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(I))},[a,H,O,e,I]);const o=H==="Error"?b.error?.message??gn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?R==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(lr,{showUploadDocumentSection:!0,navBarTitle:gn.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Wc,{formDraft:R,vendorSearchOptions:M,categorySearchOptions:p,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:o,documentUploadState:D,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:B,onBackClick:P,onCancelClick:W,onClickMenuIcon:u,onFormChange:Q,onSubmit:E,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Fo}}}=Xe.getLocalizedStrings(),xo=e=>Bn(e,!1),Bo=e=>Rn(e.name,!1);function Ro(){const e=de(),n=pe(),{tenantEmailDomain:t,templateId:a}=Me(),s=ue(),y=Fe(),g=Pe(y?.loggedInUserRoleMap),[S,_]=r.useState(!1),u=r.useCallback(o=>{_(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ms(o)),j=i(o=>En(o.cardPolicyState)),F=i(o=>An(o.cardPolicyState)),x=i(o=>Dn(o.cardPolicyState)),h=i(o=>_n(o.cardPolicyState)),f=i(o=>Pn(o.cardPolicyState)),v=i(o=>wn(o.cardPolicyState)),l=i(o=>vn(o.cardPolicyState)),T=i(o=>Dt(o.cardPolicyState)),b=i(o=>xn(o)),O=i(o=>a!=null?Cs(o.cardPolicyState,a):void 0),D=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:O!=null?ps(O):void 0,[m.templateId,m.formDraft,O,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||O!=null||s(hs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,O]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),Dr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{b.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[b.fetchState,s]);const R=r.useMemo(()=>F.map(xo),[F]),d=r.useMemo(()=>l.map(Bo),[l]),p=r.useMemo(()=>b.cards.filter(o=>!ir(o.status.code)).map(Ar),[b.cards]);xt({isDataReady:D!=null});const M=r.useMemo(()=>{if(D!=null)return Yc({draft:D,cardRows:p,categorySearchOptions:R,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:x,suggestedBlockMerchants:h,suggestedAllowCategories:f,suggestedBlockCategories:v})},[D,p,R,d,k,x,h,f,v]),[V,U]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.current=!0,U(M))},[V,M]);const z=r.useCallback(o=>{U(o)},[]),H=r.useMemo(()=>Ut(o=>{s(_t(o))},250),[s]);r.useEffect(()=>()=>{H.cancel()},[H]);const I=r.useCallback(o=>{H(o)},[H]),P=m.updateFetchState.fetchState,W=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=_e(n.state?.pathnameStackToGoBack),A=o.poppedPathname??W;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,W]),E=r.useCallback(()=>{e(W)},[e,W]),N=r.useCallback(o=>{if(a==null)return;const A=dr(o);s(fs(A)),s(gs(a))},[s,a]),Z=r.useRef(P);r.useEffect(()=>{const o=Z.current;Z.current=P,P==="Completed"&&o!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))},[s,P,e,W]);const X=P==="Error"?m.updateFetchState.error?.message??Fo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):V!=null&&j==="Completed"&&b.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(Zc,{templateName:m.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:R,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:I,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:B,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:E,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(lr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:B,onAskAiCfoClick:w})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return i(n=>e==null||e===""?{chips:pt,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??pt:pt,isResolved:s}}(Ss(n,e)),At)}const pt=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Lo,subheadline:Uo,pageTitle:Oo}}}}=Xe.getLocalizedStrings(),jo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Mo(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(I=>{S(I)},[]),u=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Y.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),F=i(I=>bs(I)),x=i(I=>Fn(I.createCardPolicyState)),h=i(I=>ys(I.createCardPolicyState)),f=i(I=>h==null?[]:Un(I.aiCfoState,h).filter(P=>P.kind==="creating_policy"),At),v=x.fetchState==="In-Progress"?Math.max(f.length,1):0,l=i(I=>Is(I.createCardPolicyState)),T=ya(x.fetchState);r.useEffect(()=>{if(T==="In-Progress"&&x.fetchState==="Completed"&&h!=null)f.forEach(I=>{a(St({chatSessionId:h,id:I.id,entityIds:l,kind:"created_policy"}))});else if(T==="In-Progress"&&x.fetchState==="Error"&&h!=null){f.forEach(P=>{a(St({chatSessionId:h,id:P.id,kind:"errored_policy"}))});const I=x.error?.message!=null&&x.error.message.length>0?x.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:I}]}))}},[x.error?.message,x.fetchState,a,h,l,f,T]);const b=F.fetchState.fetchState;r.useEffect(()=>{b!=="Not-Started"&&b!=="Error"||a(ks())},[a,b]);const O=F.archiveFetchState.fetchState,D=ya(O);r.useEffect(()=>{D==="In-Progress"&&O==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[O,a,D]);const k=r.useMemo(()=>F.templates.map(jo),[F.templates]);xt({isDataReady:F.fetchState.fetchState==="Completed"});const R=k.length>0||v>0,d=function(I){const{hasAnyPolicies:P,isChargeCardAdmin:W,isFileUploadEnabled:Q}=I,E=de(),N=pe(),{tenantEmailDomain:Z}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=ur(),A=mr(),K=Cr(),re=i(ce=>Ln(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(q,ke,3),[q,ke]),[ge,ee]=r.useState(""),me=K&&A&&Z!=null&&!X,oe=r.useCallback(ce=>{if(Z==null)return;const Ea=ye(N.state?.pathnameStackToGoBack,N.pathname);E(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[N.pathname,N.state,E,Z]),ae=r.useCallback(ce=>{ce.trim().length!==0&&(ee(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ee(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),te=r.useCallback(ce=>{ee(ce)},[]),Ze=r.useCallback(()=>{o(!0)},[o]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(me&&!P&&W)return{aiAgentName:Oo,headline:Lo,subheadline:Uo,promptChips:Se,composer:{currentInput:ge,isSubmitting:re,isFileUploadEnabled:Q,onInputChange:te,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:ae,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,P,me,W,Q,re,te,Re,Ze,ae,Ee,Ye,Se])}({hasAnyPolicies:R,isChargeCardAdmin:y,isFileUploadEnabled:B}),p=w&&d!=null?c.jsx(pr,{...d}):null,M=m&&p==null,V=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),P=I.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),U=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),H=F.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:V,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(qc,{policies:k,archivingTemplateId:F.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:U,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:p,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function No(){const e=de(),{cardId:n}=Me(),t=ue(),a=ne.getSignedInUser(),s=i(q=>fe(q)),y=Fe(),g=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Y.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Y.isDebitCardFeatureEnabled),F=we(s),x=ve(s),h=Te(j,s),f=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),l=Be({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:w,isBookKeepingTenant:x,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:f}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(q=>oa(q,s.companyId)),O=ia(b.controllers),{creditAccount:D,creditAccountRepayment:k}=i(q=>da(q)),R=i(q=>q.classListState.fetchState),d=!B&&l&&m,p=i(q=>Pt(q,n,d,l)),[M,V]=r.useState(!1),U=p.chargeCard,L=U?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),H=z?.accountingClassIDs[0],I=i(q=>H!=null?za(q.classState,{classId:H,reportId:"class_list"}):void 0),P=U?.cardHolderUser?.userId,W=i(q=>P!=null?$a(q.userRoleState,P):void 0),Q=W?.accountingClassIDs[0],E=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",Z=U?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&_===!1&&N&&(u(!0),setTimeout(()=>{t(Wa()),Z&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,_,N,Z]),r.useEffect(()=>{M||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==a.userId||C===!1&&_===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const q=Ae(s.tenantEmailDomain,n,a,U,C);e(q)}},[p.fetchState,C,N]),r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(wt()),R!=="Completed"&&R!=="In-Progress"&&t(On())},[D.fetchState,k.fetchState,t,l,m,g,R]);const X=()=>{if(a!=null&&n!=null){t(Wa());const q=Ae(s.tenantEmailDomain,n,a);e(q)}},o=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",A=Je(l,v,T,m),K=Ba(l,m,g,D,k),re=br(o,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Qc,{onGotItClick:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:O,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:re,chargeCardDetailView:p,creditAccount:D,classListFetchState:R,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Nt="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Vt="charge-card-limit-updated",Ht="charge-card-limit-reset",Gt="charge-card-renamed",Vo="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ho=[La,Ra],Go=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(Xc);function $o(){const e=de(),n=ue(),t=pe(),a=ne.getSignedInUser(),s=i(j=>fe(j)),{useFeatureGate:y}=le(),{isFeatureEnabled:g}=y(Y.isCardsCommentingEnabled),[S,_]=r.useState(!1),u=i(j=>la(j)),C=Er(s.companyId,{clearParams:u.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),F=j.poppedPathname??zo(s.tenantEmailDomain);e(F,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=ea(s);if(Mt({events:Ca(w,Ho),onEvent:j=>{switch(j){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(_(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(Go,{onBackClick:B,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(Jc,{onBackClick:B})}const zo=e=>`/${e}/cards`,Wo={containerWidth:new Fa(100,58)},Yo=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g}=le(),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(!1),F=ne.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const x=i(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(We.zeniCardsConfig),f=h.max_charge_card_activation_attempts_by_card_id,v=i(E=>Ds(E,s)),l=v.chargeCard,T=i(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:b}=le(),{isFeatureEnabled:O}=b(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=b(Y.isDebitCardFeatureEnabled),k=Te(D,x),R=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:k}),d=!!x.companyChargeCardInfo?.info?.isChargeCardEnabled,p=x.userRole.includes("charge_card_user"),M=we(x),V=ve(x),U=x.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:O,isBookKeepingTenant:V,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!p&&L&&d;r.useEffect(()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),_(!0)),u===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,v.fetchState,S,T]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(B===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==F.userId)){const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:N}})}else if(B&&v.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(E,{state:{pathnameStackToGoBack:N}})}}},[v.fetchState,l?.type.code,B,v.isRefreshingViewInBackground]);const I=ne.getZeniOtpTokenForCardHolder(s),P=i(E=>jn(E.userState,F.userId)),W=()=>{l?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(W,3e3),w(!0))},[v.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=E=>{j(E)};if(T!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(Zo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:P.phone,signedInUser:F,isSandboxEnv:Bt(),chargeCardDetailState:v,signedInUserToken:I,navigate:a,currentTenant:x,location:y,maxChargeCardActivationAttempts:f[s]!=null?f[s]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Ps(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Mn(e,s),S=n.updateStatus,_=ua(e,!1,!1,!1);let u=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||C,showMenuIcon:u,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(Ts(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(eo),Ko=Ne.div`
|
|
1
|
+
import{j as c}from"./liveblocks-B5ZW-VBI.js";import{u as ue,j as i,h as de,g as pe,i as Me,N as ba,s as At,n as De,t as kn,o as es,p as se}from"./core-Crl6eqZl.js";import{f7 as Dt,RS as as,fj as _t,bt as Pe,RT as ts,RU as ns,eY as mn,RV as En,f5 as An,RW as Dn,RX as _n,RY as Pn,RZ as wn,f6 as vn,fi as Tn,R_ as Fn,R$ as rs,fc as ss,fb as cs,S0 as os,C1 as xn,fl as ca,S1 as is,S2 as ds,e_ as ls,eZ as us,fy as ze,fe as Bn,fd as Rn,S3 as ms,ff as Cs,By as ps,Bx as hs,BB as fs,BD as gs,fr as Ss,eV as Ln,S4 as bs,S5 as ys,fw as Un,S6 as Is,fx as St,BJ as ks,BG as Es,eW as fe,S7 as qa,fB as we,fC as ve,fD as Te,gw as oa,cv as ia,S8 as da,S9 as Pt,uQ as $a,kF as za,Sa as Wa,Ch as ka,fm as Qe,Cj as wt,kv as On,Sb as la,C5 as _a,Sc as As,Sd as Ds,C8 as Qa,Se as _s,Qd as Ja,fh as jn,Ce as ga,hV as Ps,Sf as Mn,f8 as ua,bo as ws,Sg as vs,gh as Xa,gg as et,CN as Ts,gf as at,PV as Fs,Sh as Nn,co as Vn,cQ as xs,Qc as wa,Dm as Hn,Si as Cn,CY as Pa,Sj as Gn,Dn as Bs,QC as Rs,Do as Ls,Et as Us,ub as Os,En as js,Sk as Ms,Ci as ra,Sl as Ns,Sm as Vs,Sn as Hs,So as Gs,Sp as $s,Sq as vt,Sr as zs,Cy as $n,Cr as Ws,Ss as Ys,gy as Zs,CH as zn,CL as Wn,gx as Ks,St as qs,D8 as Yn,Su as Qs,Sv as Js,Sw as Xs,CJ as Zn,Cu as Kn,Cb as qn,CD as Qn,CB as Jn,CF as ec,Sx as Xn,Sy as ac,ft as tc,fu as nc,fv as rc,Sz as tt,fn as er,cR as Tt,SA as sc,SB as cc,SC as oc,SD as ic,CT as bt,Df as dc,Db as lc,CP as uc,Dd as mc,D3 as Cc,D5 as pc,SE as ar,Dl as Ga,Kc as hc,SF as fc,SG as gc,SH as Sc,SI as tr,SJ as bc,DI as yc,CX as nr,CS as je,CW as Ic,SK as kc,SL as Ec,C2 as Ac,SM as rr,fg as sr,SN as Dc,C4 as _c,C3 as pn,SO as Pc,SP as wc,SQ as vc,MJ as Tc,SR as Ft,SS as Fc,xQ as cr,ld as xc,hL as Bc,DN as Rc,ST as or,f2 as Lc,f3 as Uc,SU as Oc,di as jc,fk as Mc,DD as Nc,Dx as qe,bs as Vc,bJ as Hc,cA as Gc,bK as $c,LW as zc}from"./zeni-epic-state-DTyrT1Ga.js";import{I as Fe,cp as ir,r as _e,cq as dr,cr as lr,cs as Wc,F as Xe,Z as xt,ct as Yc,cu as Zc,U as ur,a as mr,Y as Cr,s as ye,W as le,Q as Y,aq as ya,cv as pr,cw as Kc,cx as qc,z as ne,B as va,ce as nt,cy as Qc,cz as Jc,cA as Xc,j as Ta,aQ as We,br as Bt,cB as eo,x as Fa,f as rt,m as Rt,c as J,a7 as st,cC as ao,bE as Sa,cD as yt,cE as to,V as Lt,cF as no,at as hr,a2 as It,cG as ro,X as fr,e as gr,cH as so,cI as co,cJ as oo,cK as io,cL as lo,cM as uo,o as Ya,cN as mo,cO as Co,cP as Ct,$ as po,cQ as ho,cR as fo,cS as go,cT as So,cU as bo,a9 as yo}from"./index-BLRtUSpL.js";import{n as Ne,D as Sr,S as Io}from"./mui-U77PQnc2.js";import{a as r}from"./sentry-BxWyF9h9.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Cpb6UCmb.js";import{M as Ie}from"./MobileAppDrawer-Dun-P89d.js";import{d as Ut}from"./recharts-e5u-LCPv.js";import{g as Ae,a as Ba,b as br,c as xe,d as Be,e as Je,f as ea,h as aa,A as ko,i as Ot,P as Eo,j as jt,s as Ia,k as yr,l as sa,m as Ir,n as Ao,o as kr,p as Do,S as hn}from"./SetupPagesScreen-Dnm5sccr.js";import{u as Er}from"./useInitialThreadRequest-DVPS_iNz.js";import ct from"./NotFoundScreen-CJOPcpwO.js";import{u as Mt}from"./useChargeCardPusherEvents-uB8sjNP3.js";import{n as fn}from"./utils-BjvWDnmB.js";import{t as _o}from"./AddressScreen-CUjGRrDO.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./analyticsHelper-CsGwj-FA.js";import"./routePaths-DPA1vVZP.js";import"./BusinessVerificationPageScreen-DoJw9h9m.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]="2b780a0b-d665-484d-ad3e-a563a1c002d4",e._sentryDebugIdIdentifier="sentry-dbid-2b780a0b-d665-484d-ad3e-a563a1c002d4")}catch{}})();const Po=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Ar=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Po(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Dr(){const e=ue(),n=i(a=>Dt(a.cardPolicyState)),t=i(a=>as(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(_t())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:gn}}}=Xe.getLocalizedStrings(),wo=e=>Bn(e,!1),vo=e=>Rn(e.name,!1);function To(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(mn())},[a]);const w=i(A=>En(A.cardPolicyState)),m=i(A=>An(A.cardPolicyState)),j=i(A=>Dn(A.cardPolicyState)),F=i(A=>_n(A.cardPolicyState)),x=i(A=>Pn(A.cardPolicyState)),h=i(A=>wn(A.cardPolicyState)),f=i(A=>vn(A.cardPolicyState)),v=i(A=>Dt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),T=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{w!=="Completed"&&w!=="In-Progress"&&a(Tn())},[a,w]),Dr();const b=i(A=>Fn(A.createCardPolicyState)),O=i(A=>rs(A.createCardPolicyState)),D=i(A=>ss(A.cardPolicyState)),k=i(A=>cs(A.cardPolicyState)),R=i(A=>os(A.createCardPolicyState)),d=i(A=>xn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[d.fetchState,a]);const p=r.useMemo(()=>m.map(wo),[m]),M=r.useMemo(()=>f.map(vo),[f]),V=r.useMemo(()=>d.cards.filter(A=>!ir(A.status.code)).map(Ar),[d.cards]),U=w==="Completed"&&d.fetchState==="Completed"&&T==="Completed";r.useEffect(()=>{U&&R==null&&a(is({cardsMasterList:V,defaultRequireReceiptAmount:l,suggestedAllowMerchants:j,suggestedBlockMerchants:F,suggestedAllowCategories:x,suggestedBlockCategories:h}))},[T,a,U,R,V,l,j,F,x,h]);const L=r.useMemo(()=>Ut(A=>{a(_t(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),H=b.fetchState,I=t!=null?`/${t}/cards/policy`:"..",P=r.useCallback(()=>{const A=_e(n.state?.pathnameStackToGoBack),K=A.poppedPathname??I;e(K,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,I]),W=r.useCallback(()=>{e(I)},[e,I]),Q=r.useCallback(A=>{a(ds(A))},[a]),E=r.useCallback(A=>{const K=dr(A);a(ls({templates:[K]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(us(A))},[a]),Z=r.useCallback(()=>{a(mn())},[a]),X=r.useRef(H);r.useEffect(()=>{const A=X.current;X.current=H,H==="Completed"&&A!=="Completed"&&O!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(I))},[a,H,O,e,I]);const o=H==="Error"?b.error?.message??gn.createPolicyGenericErrorMessage:void 0;return y&&t!=null?R==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(lr,{showUploadDocumentSection:!0,navBarTitle:gn.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Wc,{formDraft:R,vendorSearchOptions:M,categorySearchOptions:p,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:z,submitState:H,submitErrorMessage:o,documentUploadState:D,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:B,onBackClick:P,onCancelClick:W,onClickMenuIcon:u,onFormChange:Q,onSubmit:E,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(ba,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Fo}}}=Xe.getLocalizedStrings(),xo=e=>Bn(e,!1),Bo=e=>Rn(e.name,!1);function Ro(){const e=de(),n=pe(),{tenantEmailDomain:t,templateId:a}=Me(),s=ue(),y=Fe(),g=Pe(y?.loggedInUserRoleMap),[S,_]=r.useState(!1),u=r.useCallback(o=>{_(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ms(o)),j=i(o=>En(o.cardPolicyState)),F=i(o=>An(o.cardPolicyState)),x=i(o=>Dn(o.cardPolicyState)),h=i(o=>_n(o.cardPolicyState)),f=i(o=>Pn(o.cardPolicyState)),v=i(o=>wn(o.cardPolicyState)),l=i(o=>vn(o.cardPolicyState)),T=i(o=>Dt(o.cardPolicyState)),b=i(o=>xn(o)),O=i(o=>a!=null?Cs(o.cardPolicyState,a):void 0),D=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:O!=null?ps(O):void 0,[m.templateId,m.formDraft,O,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||O!=null||s(hs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,O]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),Dr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{b.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[b.fetchState,s]);const R=r.useMemo(()=>F.map(xo),[F]),d=r.useMemo(()=>l.map(Bo),[l]),p=r.useMemo(()=>b.cards.filter(o=>!ir(o.status.code)).map(Ar),[b.cards]);xt({isDataReady:D!=null});const M=r.useMemo(()=>{if(D!=null)return Yc({draft:D,cardRows:p,categorySearchOptions:R,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:x,suggestedBlockMerchants:h,suggestedAllowCategories:f,suggestedBlockCategories:v})},[D,p,R,d,k,x,h,f,v]),[V,U]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||V!=null||M==null||(L.current=!0,U(M))},[V,M]);const z=r.useCallback(o=>{U(o)},[]),H=r.useMemo(()=>Ut(o=>{s(_t(o))},250),[s]);r.useEffect(()=>()=>{H.cancel()},[H]);const I=r.useCallback(o=>{H(o)},[H]),P=m.updateFetchState.fetchState,W=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=_e(n.state?.pathnameStackToGoBack),A=o.poppedPathname??W;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,W]),E=r.useCallback(()=>{e(W)},[e,W]),N=r.useCallback(o=>{if(a==null)return;const A=dr(o);s(fs(A)),s(gs(a))},[s,a]),Z=r.useRef(P);r.useEffect(()=>{const o=Z.current;Z.current=P,P==="Completed"&&o!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(W))},[s,P,e,W]);const X=P==="Error"?m.updateFetchState.error?.message??Fo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(ba,{to:"..",replace:!0}):V!=null&&j==="Completed"&&b.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(Zc,{templateName:m.template?.name??"",formDraft:V,vendorSearchOptions:d,categorySearchOptions:R,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:I,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:B,onAskAiCfoClick:w,onBackClick:Q,onCancelClick:E,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(lr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:B,onAskAiCfoClick:w})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return i(n=>e==null||e===""?{chips:pt,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??pt:pt,isResolved:s}}(Ss(n,e)),At)}const pt=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Lo,subheadline:Uo,pageTitle:Oo}}}}=Xe.getLocalizedStrings(),jo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Mo(){const e=de(),n=pe(),{tenantEmailDomain:t}=Me(),a=ue(),s=Fe(),y=Pe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),_=r.useCallback(I=>{S(I)},[]),u=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:C}=le(),{isFeatureEnabled:B}=C(Y.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=C(Y.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),F=i(I=>bs(I)),x=i(I=>Fn(I.createCardPolicyState)),h=i(I=>ys(I.createCardPolicyState)),f=i(I=>h==null?[]:Un(I.aiCfoState,h).filter(P=>P.kind==="creating_policy"),At),v=x.fetchState==="In-Progress"?Math.max(f.length,1):0,l=i(I=>Is(I.createCardPolicyState)),T=ya(x.fetchState);r.useEffect(()=>{if(T==="In-Progress"&&x.fetchState==="Completed"&&h!=null)f.forEach(I=>{a(St({chatSessionId:h,id:I.id,entityIds:l,kind:"created_policy"}))});else if(T==="In-Progress"&&x.fetchState==="Error"&&h!=null){f.forEach(P=>{a(St({chatSessionId:h,id:P.id,kind:"errored_policy"}))});const I=x.error?.message!=null&&x.error.message.length>0?x.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:I}]}))}},[x.error?.message,x.fetchState,a,h,l,f,T]);const b=F.fetchState.fetchState;r.useEffect(()=>{b!=="Not-Started"&&b!=="Error"||a(ks())},[a,b]);const O=F.archiveFetchState.fetchState,D=ya(O);r.useEffect(()=>{D==="In-Progress"&&O==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[O,a,D]);const k=r.useMemo(()=>F.templates.map(jo),[F.templates]);xt({isDataReady:F.fetchState.fetchState==="Completed"});const R=k.length>0||v>0,d=function(I){const{hasAnyPolicies:P,isChargeCardAdmin:W,isFileUploadEnabled:Q}=I,E=de(),N=pe(),{tenantEmailDomain:Z}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=ur(),A=mr(),K=Cr(),re=i(ce=>Ln(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=Pr("card_policy"),Se=r.useMemo(()=>_r(q,ke,3),[q,ke]),[ge,ee]=r.useState(""),me=K&&A&&Z!=null&&!X,oe=r.useCallback(ce=>{if(Z==null)return;const Ea=ye(N.state?.pathnameStackToGoBack,N.pathname);E(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[N.pathname,N.state,E,Z]),ae=r.useCallback(ce=>{ce.trim().length!==0&&(ee(""),oe(ce))},[oe]),Ye=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ee(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),te=r.useCallback(ce=>{ee(ce)},[]),Ze=r.useCallback(()=>{o(!0)},[o]),Re=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(me&&!P&&W)return{aiAgentName:Oo,headline:Lo,subheadline:Uo,promptChips:Se,composer:{currentInput:ge,isSubmitting:re,isFileUploadEnabled:Q,onInputChange:te,onSubmit:Ye,onStopSubmit:Ee},onPromptClick:ae,onOpenSidePanel:Ze,onOpenFullView:Re,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,P,me,W,Q,re,te,Re,Ze,ae,Ee,Ye,Se])}({hasAnyPolicies:R,isChargeCardAdmin:y,isFileUploadEnabled:B}),p=w&&d!=null?c.jsx(pr,{...d}):null,M=m&&p==null,V=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),P=I.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),U=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),H=F.fetchState.fetchState;return!R&&H!=="Completed"&&H!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:V,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:_}),c.jsx(qc,{policies:k,archivingTemplateId:F.archiveTargetTemplateId,pendingCreationCount:v,onBackClick:V,onNewPolicyClick:U,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:p,isAiCfoAccessEnabled:M,onAskAiCfoClick:j})]})}function No(){const e=de(),{cardId:n}=Me(),t=ue(),a=ne.getSignedInUser(),s=i(q=>fe(q)),y=Fe(),g=Pe(y?.loggedInUserRoleMap),{useFeatureGate:S}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=S(Y.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=S(Y.isDebitCardFeatureEnabled),F=we(s),x=ve(s),h=Te(j,s),f=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,v=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:h}),l=Be({isCardsOnlyTenant:F,isChargeCardFeatureEnabled:w,isBookKeepingTenant:x,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:f}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,b=i(q=>oa(q,s.companyId)),O=ia(b.controllers),{creditAccount:D,creditAccountRepayment:k}=i(q=>da(q)),R=i(q=>q.classListState.fetchState),d=!B&&l&&m,p=i(q=>Pt(q,n,d,l)),[M,V]=r.useState(!1),U=p.chargeCard,L=U?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),H=z?.accountingClassIDs[0],I=i(q=>H!=null?za(q.classState,{classId:H,reportId:"class_list"}):void 0),P=U?.cardHolderUser?.userId,W=i(q=>P!=null?$a(q.userRoleState,P):void 0),Q=W?.accountingClassIDs[0],E=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",Z=U?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&_===!1&&N&&(u(!0),setTimeout(()=>{t(Wa()),Z&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,_,N,Z]),r.useEffect(()=>{M||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(V(!0),t(ka(n,d,!1)))},[M,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(N===!1||N&&U?.status?.code!=="active"||U?.cardHolderUserId!==a.userId||C===!1&&_===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const q=Ae(s.tenantEmailDomain,n,a,U,C);e(q)}},[p.fetchState,C,N]),r.useEffect(()=>{D.fetchState!=="Completed"&&D.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(wt()),R!=="Completed"&&R!=="In-Progress"&&t(On())},[D.fetchState,k.fetchState,t,l,m,g,R]);const X=()=>{if(a!=null&&n!=null){t(Wa());const q=Ae(s.tenantEmailDomain,n,a);e(q)}},o=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",A=Je(l,v,T,m),K=Ba(l,m,g,D,k),re=br(o,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Qc,{onGotItClick:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:O,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:K,debitAccountInformation:re,chargeCardDetailView:p,creditAccount:D,classListFetchState:R,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:E?.className})]})}const wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Nt="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Vt="charge-card-limit-updated",Ht="charge-card-limit-reset",Gt="charge-card-renamed",Vo="charge-card-department-updated",Br="charge-card-repayment-completed",Rr="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Ho=[La,Ra],Go=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(Xc);function $o(){const e=de(),n=ue(),t=pe(),a=ne.getSignedInUser(),s=i(j=>fe(j)),{useFeatureGate:y}=le(),{isFeatureEnabled:g}=y(Y.isCardsCommentingEnabled),[S,_]=r.useState(!1),u=i(j=>la(j)),C=Er(s.companyId,{clearParams:u.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),F=j.poppedPathname??zo(s.tenantEmailDomain);e(F,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),w=ea(s);if(Mt({events:Ca(w,Ho),onEvent:j=>{switch(j){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(_(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(Go,{onBackClick:B,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(Jc,{onBackClick:B})}const zo=e=>`/${e}/cards`,Wo={containerWidth:new Fa(100,58)},Yo=({appContent:e})=>{const n=Ta(),t=ue(),a=de(),{cardId:s}=Me(),y=pe(),{useDynamicConfig:g}=le(),[S,_]=r.useState(!1),[u,C]=r.useState(!1),[B,w]=r.useState(!1),[m,j]=r.useState(!1),F=ne.getSignedInUser();if(F==null)throw Error("Can't access onboarding card page without signing in...");const x=i(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(We.zeniCardsConfig),f=h.max_charge_card_activation_attempts_by_card_id,v=i(E=>Ds(E,s)),l=v.chargeCard,T=i(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:b}=le(),{isFeatureEnabled:O}=b(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:D}=b(Y.isDebitCardFeatureEnabled),k=Te(D,x),R=xe({isDebitCardFeatureEnabled:D,isBankingOnlyTenant:k}),d=!!x.companyChargeCardInfo?.info?.isChargeCardEnabled,p=x.userRole.includes("charge_card_user"),M=we(x),V=ve(x),U=x.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Be({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:O,isBookKeepingTenant:V,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!p&&L&&d;r.useEffect(()=>{S===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Qa()),_(!0)),u===!1&&v.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,v.fetchState,S,T]);const H=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(v.fetchState==="Completed"){if(B===!1&&(H===!1||H&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==F.userId)){const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);a(E,{state:{pathnameStackToGoBack:N}})}else if(B&&v.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(x.tenantEmailDomain,s,F,l,!0),N=ye(y.state?.pathnameStackToGoBack,y.pathname);t(Ja()),a(E,{state:{pathnameStackToGoBack:N}})}}},[v.fetchState,l?.type.code,B,v.isRefreshingViewInBackground]);const I=ne.getZeniOtpTokenForCardHolder(s),P=i(E=>jn(E.userState,F.userId)),W=()=>{l?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{v.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(W,3e3),w(!0))},[v.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=E=>{j(E)};if(T!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(Zo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:P.phone,signedInUser:F,isSandboxEnv:Bt(),chargeCardDetailState:v,signedInUserToken:I,navigate:a,currentTenant:x,location:y,maxChargeCardActivationAttempts:f[s]!=null?f[s]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Ko,{windowSize:n,children:e}):null]})},Zo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const y=Ps(e.addressState,t);if(y==null)throw Error("Can't access shippingAddress.");const g=Mn(e,s),S=n.updateStatus,_=ua(e,!1,!1,!1);let u=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||C,showMenuIcon:u,shippingAddress:y,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:y,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:_}=y;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(Ts(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Xa(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&ne.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const u=_e(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(_):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(eo),Ko=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Wo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-B5ZW-VBI.js";import{a as g}from"./sentry-BxWyF9h9.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-Crl6eqZl.js";import{z as C,bc as P,V as F,c as V,e as j,af as b,bd as A,at as L,au as U,s as B}from"./index-
|
|
1
|
+
import{j as m}from"./liveblocks-B5ZW-VBI.js";import{a as g}from"./sentry-BxWyF9h9.js";import{h as w,u as T,g as x,i as k,j as O,n as E}from"./core-Crl6eqZl.js";import{z as C,bc as P,V as F,c as V,e as j,af as b,bd as A,at as L,au as U,s as B}from"./index-BLRtUSpL.js";import{eW as D,gj as M,tC as _,ge as G,c6 as R,Pi as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Pj as W,bE as Z,cy as N,mQ as $,mT as J}from"./zeni-epic-state-DTyrT1Ga.js";import"./mui-U77PQnc2.js";import{d as K}from"./routePaths-DPA1vVZP.js";import{M as X}from"./MobileAppDrawer-Dun-P89d.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="7bcbab9a-a803-4e8b-a7ef-4f9fd2432ffe",n._sentryDebugIdIdentifier="sentry-dbid-7bcbab9a-a803-4e8b-a7ef-4f9fd2432ffe")}catch{}})();const ee=E(function(n){const t=G(n),i=C.getSignedInUser(),l=D(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(n,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(J())},onAddressClick:e=>{const a=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n(W(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(Q({files:e}))},onDeleteFile:e=>{n(H(e))},onEditFileName:(e,a)=>{n(q(e,a.split(".")[0]))}}})(A);function de(){const n=w(),t=T(),i=x(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),a=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||a!=="Not-Started"||d==null||(p(!0),t(M(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(_())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(P,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-B5ZW-VBI.js";import{a}from"./sentry-BxWyF9h9.js";import{u as D,g as v,j as u,N as w}from"./core-Crl6eqZl.js";import{LS as A,eW as L,g1 as O,o9 as _,gs as h,g0 as j,fz as U,LZ as F}from"./zeni-epic-state-DTyrT1Ga.js";import{u as $,z as m,L as C,F as k,o as z}from"./index-
|
|
1
|
+
import{j as g}from"./liveblocks-B5ZW-VBI.js";import{a}from"./sentry-BxWyF9h9.js";import{u as D,g as v,j as u,N as w}from"./core-Crl6eqZl.js";import{LS as A,eW as L,g1 as O,o9 as _,gs as h,g0 as j,fz as U,LZ as F}from"./zeni-epic-state-DTyrT1Ga.js";import{u as $,z as m,L as C,F as k,o as z}from"./index-BLRtUSpL.js";import{n as H}from"./mui-U77PQnc2.js";import{t as R}from"./getLocaleForTenant-e8sE0WQV.js";import{g as P,Q as G}from"./QBOConnectionScreen-CEsTlTj_.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./empty-BpRPQOis.js";import"./pdf-lib-ImawEH2S.js";import"./index-D5ItYKRr.js";import"./url-jBDeguac.js";import"./index-CZNTdKXM.js";import"./decodeURIComponentSafe-DwYiSzjo.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]="b0dd3392-fe42-4425-9cb7-aec8a3e1ecc0",t._sentryDebugIdIdentifier="sentry-dbid-b0dd3392-fe42-4425-9cb7-aec8a3e1ecc0")}catch{}})();const Q=H.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-B5ZW-VBI.js";import{z as n}from"./index-
|
|
1
|
+
import{j as i}from"./liveblocks-B5ZW-VBI.js";import{z as n}from"./index-BLRtUSpL.js";import{g as d}from"./QBOConnectionScreen-CEsTlTj_.js";import"./sentry-BxWyF9h9.js";import{g as p,N as s}from"./core-Crl6eqZl.js";import"./zeni-epic-state-DTyrT1Ga.js";import"./recharts-e5u-LCPv.js";import"./mui-U77PQnc2.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./empty-BpRPQOis.js";import"./pdf-lib-ImawEH2S.js";import"./index-D5ItYKRr.js";import"./url-jBDeguac.js";import"./index-CZNTdKXM.js";import"./decodeURIComponentSafe-DwYiSzjo.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};
|
package/dist/assets/{CustomerOnboardingRoutes-CKdlHWlk.js → CustomerOnboardingRoutes-Dh2ji4Ib.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-B5ZW-VBI.js";import{t as yt,A as Ve}from"./AddressScreen-
|
|
1
|
+
import{j as a}from"./liveblocks-B5ZW-VBI.js";import{t as yt,A as Ve}from"./AddressScreen-CUjGRrDO.js";import ht from"./NotFoundScreen-CJOPcpwO.js";import{a as r}from"./sentry-BxWyF9h9.js";import{h as Ce,g as ke,u as Y,i as Ie,j as _,N as V,l as St,n as et,o as bt,p as W}from"./core-Crl6eqZl.js";import{z as N,W as _e,Q as L,E as Ct,s as z,V as se,c as Q,e as ue,ap as kt,j as It,$ as tt,I as nt,aq as Re,f as Se,ar as _t,o as Le,as as Ne,at as vt,au as Me,av as xt,aw as Et}from"./index-BLRtUSpL.js";import{eW as J,fV as Ot,fD as ve,fB as xe,bs as Tt,fR as wt,bS as At,o7 as Pt,tm as Dt,tp as jt,MR as Ft,MS as Bt,MT as Ut,xK as Vt,Et as Rt,ub as Lt,MU as Nt,k9 as be,kc as at,Mm as Mt,bY as $t,c6 as pe,tQ as Ee,tB as Gt,MV as le,tR as ot,Kf as zt,ld as st,MW as Qt,MX as Kt,rj as qt,hq as Ht,Me as ge,hn as Wt,Mf as Zt,xZ as Xt,rn as Yt,hf as Jt,hi as $e,MY as it,MZ as en,E0 as tn,M_ as nn,E4 as an,ts as on,M$ as sn,N0 as rn,k7 as cn,ka as dn,u1 as un,tD as rt,tP as ln,bE as Ge,cy as pn,u0 as ze,rC as mn,rq as gn,l5 as fn,gh as yn,gg as hn,gf as Sn,N1 as bn,tv as Cn,u2 as kn,u5 as In,u8 as _n,ue as vn,cX as xn}from"./zeni-epic-state-DTyrT1Ga.js";import{n as Oe}from"./mui-U77PQnc2.js";import{g as En,h as On,q as ie}from"./QBOConnectionScreen-CEsTlTj_.js";import{u as Tn}from"./useEmailConnectResultRefresh-CgBbGn6X.js";import{u as wn}from"./useChargeCardPusherEvents-uB8sjNP3.js";import{u as An}from"./plaid-TCRHScH1.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./empty-BpRPQOis.js";import"./pdf-lib-ImawEH2S.js";import"./index-D5ItYKRr.js";import"./url-jBDeguac.js";import"./index-CZNTdKXM.js";import"./decodeURIComponentSafe-DwYiSzjo.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="b762b1d7-5567-4510-ab80-2f5d27f29fef",t._sentryDebugIdIdentifier="sentry-dbid-b762b1d7-5567-4510-ab80-2f5d27f29fef")}catch{}})();const Pn=()=>{const t=Ce(),l=ke(),s=Y(),[o,p]=r.useState(!1),[d,h]=r.useState(!1),{tenantEmailDomain:b}=Ie(),e=N.getSignedInUser(),{useFeatureGate:n}=_e(),{isFeatureEnabled:u}=n(L.isApAgingFeatureEnabled),{isFeatureEnabled:f}=n(L.isArAgingFeatureEnabled),{isFeatureEnabled:x}=n(L.isDepositAccountsFeatureEnabled),{isFeatureEnabled:i}=n(L.isReferralFeatureEnabled),{isFeatureEnabled:y}=n(L.isExpenseAutomationEnabledV2),{isFeatureEnabled:E}=n(L.isDebitCardFeatureEnabled),I=Ct(),c=_(S=>J(S)),{isFeatureEnabled:U}=n(L.isTreasuryEnabled),T=c.company!=null&&Ot(c.company),j=U&&T,B=_(S=>S.onboardingCustomerViewState.fetchState),m=c.excludedResources,C=c.companyId??N.getSignedInUserTenant(b)?.companyId;if(e==null)throw Error("Can't access onboarding flow without signing in...");const v=ve(E,c),w=xe(c),D=[],F=m?.resources?.find(S=>S.resource==="/reports/top_expenses")==null,M=m?.resources?.find(S=>S.resource==="/reports/task_card")==null,Z=c?.userRole!=null&&Tt(c?.userRole),K=m?.resources?.find(S=>S.resource==="/bills")==null&&!Z,ee=m?.resources?.find(S=>S.resource==="/reimbursements")==null;F===!1&&D.push("top_expenses"),M===!1&&D.push("task_card"),K===!1&&D.push("bill_pay_card","bill_pay_promo_card"),ee===!1&&D.push("reimbursement_card","reimbursement_promo_card"),x===!1&&D.push("zeni_accounts_promo_card"),i===!1&&D.push("rewards_card");const q=_(S=>{const O=[];u===!1&&O.push("accounts_payable_aging"),f===!1&&O.push("accounts_receivable_aging"),x===!1&&O.push("zeni_accounts_promo_card"),i===!1&&O.push("rewards_card"),I===!1&&O.push("expense_automation_card");const te=wt(S,O,e,y,I,j);return At(te.reportsInOrder.map(G=>({fetchState:G.fetchState,error:G.error}))).fetchState});r.useEffect(()=>{B!=="Completed"||o||v||w||(p(!0),s(Pt(e.userId,C,c.tenantId,!0,!1,D)))},[o,B,v,w,e,c.tenantId,s]);const $=r.useRef(!1),H=r.useCallback(()=>{const S={pathnameStackToGoBack:z(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};t(v?"../../checking":w?"../../cards":"../../dashboard",{state:S})},[t,l,v,w]),A=r.useCallback(()=>{$.current||($.current=!0,H())},[H]);return r.useEffect(()=>{const S=setTimeout(()=>h(!0),3e3);return()=>clearTimeout(S)},[]),r.useEffect(()=>{const S=setTimeout(A,6e3);return()=>clearTimeout(S)},[A]),r.useEffect(()=>{v||w||!d||q!=="Completed"&&q!=="Error"||A()},[d,q,v,w,A]),B!=="Completed"?a.jsx(V,{to:"../"}):a.jsxs(a.Fragment,{children:[a.jsx(se,{analytics:Q,onLoad:S=>S.trackPageLoaded(ue.Event.onboardingDashboardActivation)}),a.jsx(kt,{show:!0,onComplete:A})]})},fe=["reading_books","finance_graph","reconciliation","cfo_foundation"],ye=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Qe=(t,l)=>{const s=new Map(t.map(o=>[o.key,o]));return l.map(o=>{return p=s.get(o)?.status,p==="starting"||p==="building"?p:"idle";var p})},Ke=(t,l)=>{if(t.length===0)return!1;const s=new Map(t.map(o=>[o.key,o]));return l.every(o=>s.get(o)?.status==="ready")},Dn=new Set(Nt),qe=Oe.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-B5ZW-VBI.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Crl6eqZl.js";import{eW as L,Ni as We,bE as ca,bo as xe,Ow as On,i$ as Pn,Ox as Zt,Oy as Fn,j2 as _t,Oz as qe,OA as Rn,j7 as Bn,OB as qt,OC as jn,jb as kt,OD as Qe,OE as Mn,co as vt,OF as Un,OG as Ln,NC as Gn,k3 as Vn,OH as Yn,bn as Je,OI as la,N6 as ce,bc as da,kh as ua,oh as ma,k0 as pa,N8 as le,N7 as X,eV as ha,fr as Nn,g3 as St,OJ as $n,OK as zn,OL as fa,OM as Fe,vP as Ue,vQ as Le,wb as De,w5 as de,vU as Ge,ON as Kn,OO as Zn,OP as qn,OQ as ga,OR as Re,OS as Qn,dJ as Xe,sa as ba,OT as Hn,OU as Wn,OV as Jn,OW as At,Mo as It,kx as we,wj as Et,si as Xn,OX as eo,vR as Qt,sd as Ee,s9 as Ca,OY as ge,OZ as to,O_ as Tt,Mn as xt,ui as _a,O$ as ao,P0 as no,P1 as oo,P2 as Dt,uv as so,P3 as ro,vT as Ht,uh as ka,P4 as be,P5 as io,bs as Sa,wn as ya,P6 as co,P7 as lo,P8 as uo,P9 as wt,wi as mo,Pa as po,vS as Wt,wm as va,Pb as Ce,Pc as ho,Pd as fo,Pe as Aa,km as Ia,oe as Ea,kr as Ta,oc as xa,ob as Da,oa as wa,tG as go,fV as bo,cR as Co,cS as _o,o7 as ko,fR as So,oo as yo,GA as ut,Gs as vo,Gw as Ao,Pf as Io,Pg as Eo,Ph as To,b5 as et,fJ as xo,hJ as Do,gj as wo,oi as Oo,jV as Po,of as Fo,od as Ro,fD as Bo,fB as jo}from"./zeni-epic-state-DTyrT1Ga.js";import{z as M,a2 as te,s as D,c as T,F as Z,aY as Mo,Z as Ve,V as Ye,aZ as Oa,e as N,a_ as Uo,I as ke,a$ as Pa,W as Se,Q as B,m as Lo,b0 as Go,b1 as Vo,U as Fa,j as Ra,a as Ba,Y as Yo,b2 as No,O as $o,aQ as ja,_ as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,E as Zo,aq as qo,r as Qo,X as Ho,b7 as Wo,b8 as Jo,b9 as Xo,ba as es,bb as _e}from"./index-CJknvk0s.js";import{n as Ot}from"./mui-U77PQnc2.js";import{a as b}from"./sentry-BxWyF9h9.js";import{w as Ga}from"./withTransactionSidePanel-DKnep6Xn.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-jWP9zfXs.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-BAtYgUWq.js";import Me from"./NotFoundScreen-DY1Wwus4.js";import{u as Ft}from"./useInitialThreadRequest-DZr1J4rc.js";import{t as Ya}from"./analyticsHelper-BsiU5y2K.js";import{C as as}from"./CompanyPassportScreen-CPKfXmmb.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CgykUI65.js";import{F as os}from"./FeaturePreviewScreen-BuXd4W0P.js";import{R as ss}from"./ReferralListScreen-CQycV-0F.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./TransactionDetailScreen-Ch_kEoMB.js";import"./decodeURIComponentSafe-DwYiSzjo.js";import"./MobileAppDrawer-BIP1MEKX.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]="73d9847a-40b2-4393-8254-a1176c7cb9c6",e._sentryDebugIdIdentifier="sentry-dbid-73d9847a-40b2-4393-8254-a1176c7cb9c6")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),v=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),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 U=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[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(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=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=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Je(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
|
|
1
|
+
import{j as d}from"./liveblocks-B5ZW-VBI.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Crl6eqZl.js";import{eW as L,Ni as We,bE as ca,bo as xe,Ow as On,i$ as Pn,Ox as Zt,Oy as Fn,j2 as _t,Oz as qe,OA as Rn,j7 as Bn,OB as qt,OC as jn,jb as kt,OD as Qe,OE as Mn,co as vt,OF as Un,OG as Ln,NC as Gn,k3 as Vn,OH as Yn,bn as Je,OI as la,N6 as ce,bc as da,kh as ua,oh as ma,k0 as pa,N8 as le,N7 as X,eV as ha,fr as Nn,g3 as St,OJ as $n,OK as zn,OL as fa,OM as Fe,vP as Ue,vQ as Le,wb as De,w5 as de,vU as Ge,ON as Kn,OO as Zn,OP as qn,OQ as ga,OR as Re,OS as Qn,dJ as Xe,sa as ba,OT as Hn,OU as Wn,OV as Jn,OW as At,Mo as It,kx as we,wj as Et,si as Xn,OX as eo,vR as Qt,sd as Ee,s9 as Ca,OY as ge,OZ as to,O_ as Tt,Mn as xt,ui as _a,O$ as ao,P0 as no,P1 as oo,P2 as Dt,uv as so,P3 as ro,vT as Ht,uh as ka,P4 as be,P5 as io,bs as Sa,wn as ya,P6 as co,P7 as lo,P8 as uo,P9 as wt,wi as mo,Pa as po,vS as Wt,wm as va,Pb as Ce,Pc as ho,Pd as fo,Pe as Aa,km as Ia,oe as Ea,kr as Ta,oc as xa,ob as Da,oa as wa,tG as go,fV as bo,cR as Co,cS as _o,o7 as ko,fR as So,oo as yo,GA as ut,Gs as vo,Gw as Ao,Pf as Io,Pg as Eo,Ph as To,b5 as et,fJ as xo,hJ as Do,gj as wo,oi as Oo,jV as Po,of as Fo,od as Ro,fD as Bo,fB as jo}from"./zeni-epic-state-DTyrT1Ga.js";import{z as M,a2 as te,s as D,c as T,F as Z,aY as Mo,Z as Ve,V as Ye,aZ as Oa,e as N,a_ as Uo,I as ke,a$ as Pa,W as Se,Q as B,m as Lo,b0 as Go,b1 as Vo,U as Fa,j as Ra,a as Ba,Y as Yo,b2 as No,O as $o,aQ as ja,_ as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,E as Zo,aq as qo,r as Qo,X as Ho,b7 as Wo,b8 as Jo,b9 as Xo,ba as es,bb as _e}from"./index-BLRtUSpL.js";import{n as Ot}from"./mui-U77PQnc2.js";import{a as b}from"./sentry-BxWyF9h9.js";import{w as Ga}from"./withTransactionSidePanel-CPTD79Uy.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-DPA1vVZP.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-Cpb6UCmb.js";import Me from"./NotFoundScreen-CJOPcpwO.js";import{u as Ft}from"./useInitialThreadRequest-DVPS_iNz.js";import{t as Ya}from"./analyticsHelper-CsGwj-FA.js";import{C as as}from"./CompanyPassportScreen-CA3eoZ2w.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-YJwtjlAT.js";import{F as os}from"./FeaturePreviewScreen-bdq3UTfq.js";import{R as ss}from"./ReferralListScreen-DM7LN1h1.js";import"./recharts-e5u-LCPv.js";import"./analytics-CkLW7NeW.js";import"./plaid-TCRHScH1.js";import"./dnd-tE28jHT7.js";import"./stripe-DMRn4zHo.js";import"./lottie-hSeCd_VX.js";import"./lexical-Bm_vZOjC.js";import"./pdf-DDcPh2pm.js";import"./utils-BjvWDnmB.js";import"./TransactionDetailScreen-CsoYHiYS.js";import"./decodeURIComponentSafe-DwYiSzjo.js";import"./MobileAppDrawer-Dun-P89d.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]="73d9847a-40b2-4393-8254-a1176c7cb9c6",e._sentryDebugIdIdentifier="sentry-dbid-73d9847a-40b2-4393-8254-a1176c7cb9c6")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,x)=>{e(qe({sortKey:x,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,x)=>{},[]),v=b.useCallback((_,x)=>{e(qe({selectedDate:_,agingDateSelectionType:x})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),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 U=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[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(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=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=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Je(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|