@zeniai/web-app-ui 5.1.54-dev → 5.1.54-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-BnLs6Thq.js → AddressRoutes-B9BoI8Fv.js} +1 -1
- package/dist/assets/{AddressScreen-Bpm1g3GJ.js → AddressScreen-BRdhnUB3.js} +1 -1
- package/dist/assets/{AiCfoScreen-DvB52dzN.js → AiCfoScreen-CuCVJ-9z.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-7UEPLRsP.js → BillPayApprovalRoutes-BrRYqqLJ.js} +1 -1
- package/dist/assets/{BillPayRoutes-CU7_1N_U.js → BillPayRoutes-C-57jjzC.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-UgGxnQyH.js → BusinessVerificationPageScreen-CoxJBcce.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-YZr7g5Lg.js → CardsAiCfoScreen-BXut6M7h.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-BrW_iL7i.js → ChargeCardRoutes-DAakvdza.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-9Rc5mH-z.js → CompanyPassportScreen-DUlm9sdh.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-ClYWnB0t.js → ConnectionAuthScreen-BOHdbzkN.js} +1 -1
- package/dist/assets/{CustomerOnboardingAuthScreen-BQzgR-6K.js → CustomerOnboardingAuthScreen-BQyQByde.js} +1 -1
- package/dist/assets/{CustomerOnboardingRoutes-DwYU0l_J.js → CustomerOnboardingRoutes-Dh6ZowLh.js} +1 -1
- package/dist/assets/{DashboardRoutes-BL2dWKop.js → DashboardRoutes-Cox4nEtE.js} +1 -1
- package/dist/assets/{DefaultTenantHome-BMiXfGQc.js → DefaultTenantHome-DsGlDo8q.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-s5k6zIAu.js → DomesticWireDetailScreen-Dwlu904z.js} +1 -1
- package/dist/assets/{DrawerScreen-CeOHT4ro.js → DrawerScreen-KqrF4Sq7.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-D87R9ysv.js → EntityDetailRoutes-COXR1SAJ.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-D8RvJ_ZB.js → ExpenseAutomationRoutes-CKsYpo_A.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-429nxvjk.js → FeaturePreviewScreen-CNGfajWs.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-Cp6uaYm8.js → HubSpotOAuthCallbackScreen-074s_I3B.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-DXD8ia4D.js → MagicLinkRoutes-Cu1l5Hae.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-u1nu2H0O.js → MagicLinkSignInScreen-iqOI3pqv.js} +1 -1
- package/dist/assets/{MobileAppDrawer-Ck77XJrw.js → MobileAppDrawer-BPYh3fz7.js} +1 -1
- package/dist/assets/{NotFoundScreen-DEN1HuyG.js → NotFoundScreen-ChEBjJeL.js} +1 -1
- package/dist/assets/{NotificationRoutes-CHUbnhGf.js → NotificationRoutes-CM26Uc2-.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-Dvc66gSg.js → OAuthConsentScreen-OutOQhzE.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-BHreu8Q_.js → PandLWithForecastRoutes-B0qogd0A.js} +1 -1
- package/dist/assets/{PeopleRoutes-BDfMDBMJ.js → PeopleRoutes-CUTyVwx1.js} +1 -1
- package/dist/assets/{PerformanceRoutes-C-1wBoYH.js → PerformanceRoutes-12eFPdp_.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DNFuV9_h.js → QBOConnectionScreen-D87ZntTL.js} +1 -1
- package/dist/assets/{ReferralListScreen-ByjwQ5N-.js → ReferralListScreen-BsBo666O.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-D_BWGRLZ.js → ReimbursementApprovalRoutes-ClbZ-O2b.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-Daig4IQ8.js → ReimbursementApprovalRuleDetailScreen-D_Tk1V_u.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-xcHd64qr.js → ReimbursementRoutes-DSyBtaLh.js} +1 -1
- package/dist/assets/{ReportsRoutes-2ShpDZLA.js → ReportsRoutes-CrvdJeby.js} +1 -1
- package/dist/assets/{RewardsRoutes-BZO-KWFq.js → RewardsRoutes-DYWFgTvw.js} +1 -1
- package/dist/assets/{ScreenRoutes-Dti7-Ixh.js → ScreenRoutes-BE5zmBx7.js} +2 -2
- package/dist/assets/{SettingsRoutes-BKVt-eGE.js → SettingsRoutes-D-CGv9n3.js} +1 -1
- package/dist/assets/{SetupPagesScreen-0zvJok5y.js → SetupPagesScreen-Bfb-yG5Q.js} +1 -1
- package/dist/assets/{SignInScreen-CW9vcCuq.js → SignInScreen-DKI-p16g.js} +1 -1
- package/dist/assets/{SignOutScreen-ChTjyX5W.js → SignOutScreen-C2_s3moc.js} +1 -1
- package/dist/assets/{TaskListScreen-DrRytX06.js → TaskListScreen-SFzbbBq2.js} +1 -1
- package/dist/assets/{TaskRoutes-DW3-LBMv.js → TaskRoutes-CgfIdOfE.js} +1 -1
- package/dist/assets/{TransactionDetailRoutes-DHUqssQz.js → TransactionDetailRoutes-BX1iNIyW.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-9-dxedcB.js → TransactionDetailScreen-bJ4okRq5.js} +1 -1
- package/dist/assets/{TransactionListRoutes-DeCDnr6v.js → TransactionListRoutes-C7_m6Yqx.js} +1 -1
- package/dist/assets/{TreasuryRoutes-lJD-IQKP.js → TreasuryRoutes-CueVe1jr.js} +1 -1
- package/dist/assets/{VendorsRoutes-CpiscP-9.js → VendorsRoutes-DrErfdsR.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-CJZ2O9Rr.js → WiseConfirmationScreen-DrQXGVBy.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-BVG6Nofx.js → ZeniAccountRoutes-_K25ghKx.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-BVqdlmkT.js → ZeniAccountStatementScreen-Be29Xc0Q.js} +1 -1
- package/dist/assets/{analyticsHelper-BYRUUvaV.js → analyticsHelper-BsjRdUZX.js} +1 -1
- package/dist/assets/{getLocaleForTenant-CuwnZkK7.js → getLocaleForTenant-C_VQis3o.js} +1 -1
- package/dist/assets/{index-BeMQfmRp.js → index-D_hiFYsE.js} +5 -5
- package/dist/assets/{routePaths-2zRQFXqm.js → routePaths-XSngD1ow.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-iiV0TqB-.js → useAiCfoDashboardSuggestedQuestionsChips-CmgL0oiB.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-k3dV_2QR.js → useAskAiCfoHostNavButtonProps-FETbJUjN.js} +1 -1
- package/dist/assets/{useCashManagementBanner-d2dskVed.js → useCashManagementBanner-Dy5XCSd3.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-CrlDQYJc.js → useInitialThreadRequest-D1F5GLCG.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-D1EjZ31L.js → withTransactionSidePanel-kr0tYyxP.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-B6jAIe9x.js";import{A as d}from"./AddressScreen-
|
|
1
|
+
import{j as e}from"./liveblocks-B6jAIe9x.js";import{A as d}from"./AddressScreen-BRdhnUB3.js";import i from"./NotFoundScreen-ChEBjJeL.js";import"./sentry-95bdnR3R.js";import{o as s,p as r}from"./core-CLKYLs-8.js";import"./zeni-epic-state-CjQblqOQ.js";import"./recharts-CyaYjFwn.js";import"./index-D_hiFYsE.js";import"./mui-AZmtqUsi.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.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 n}from"./liveblocks-B6jAIe9x.js";import{a as h}from"./sentry-95bdnR3R.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-CLKYLs-8.js";import{K as $,m as D,z as K,j as L,B as O,A as z,c as C,e as S,k as F,h as b,n as N}from"./index-
|
|
1
|
+
import{j as n}from"./liveblocks-B6jAIe9x.js";import{a as h}from"./sentry-95bdnR3R.js";import{h as T,u as _,g as j,i as M,j as E,n as B}from"./core-CLKYLs-8.js";import{K as $,m as D,z as K,j as L,B as O,A as z,c as C,e as S,k as F,h as b,n as N}from"./index-D_hiFYsE.js";import{Ml as k,hO as R,eW as U,Mm as G,c7 as V,Mn as q,l7 as H}from"./zeni-epic-state-CjQblqOQ.js";import{n as W}from"./mui-AZmtqUsi.js";import J from"./NotFoundScreen-ChEBjJeL.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]="3faab922-bc8a-4136-9280-2fe1c145ee1f",e._sentryDebugIdIdentifier="sentry-dbid-3faab922-bc8a-4136-9280-2fe1c145ee1f")}catch{}})();const Q=W.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-B6jAIe9x.js";import{a as r}from"./sentry-95bdnR3R.js";import{u as xe,h as Pe,g as we,j as Z,i as ye,n as Ee}from"./core-CLKYLs-8.js";import{W as Te,d9 as ve,z as Ae,K as Qe,da as _e,db as Oe,b6 as J,dc as ae,dd as Ue,b5 as se,n as M,A as B,c as I,de as R,df as je,dg as Le,a1 as Fe,e as De,a7 as Be,dh as Re,di as Ve,a2 as Me,dj as $e,dk as Ge,dl as Ne,r as qe,b1 as We,dm as ze}from"./index-BeMQfmRp.js";import{gj as He,eV as oe,eW as Ke,iu as Xe,Ts as Ye,fn as Ze,iE as Je,iA as et,eX as V,fu as tt,g4 as at,fZ as st,g1 as ee,g5 as ot,g6 as nt,g7 as it,g8 as rt,g9 as lt}from"./zeni-epic-state-CjQblqOQ.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-AZmtqUsi.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-iiV0TqB-.js";import{p as pt}from"./pathToGoBack-ogdURlZM.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.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]="bd5602a6-0c70-44ea-a3c6-709b9b1feb14",e._sentryDebugIdIdentifier="sentry-dbid-bd5602a6-0c70-44ea-a3c6-709b9b1feb14")}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=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&We(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=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}})}})}})(Be(Re)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Z(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=Z(i=>Ke(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[J]!==!0)return;S(!0);const f={...i};delete f[J],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(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")??w?.aiCfoRef,L=N.get("emailRefId")??w?.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),O(!0),U(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",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(Ze({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(Je())},[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(B,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:Y}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId: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(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(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-B6jAIe9x.js";import{a as r}from"./sentry-95bdnR3R.js";import{u as xe,h as Pe,g as we,j as Z,i as ye,n as Ee}from"./core-CLKYLs-8.js";import{W as Te,d9 as ve,z as Ae,K as Qe,da as _e,db as Oe,b6 as J,dc as ae,dd as Ue,b5 as se,n as M,A as B,c as I,de as R,df as je,dg as Le,a1 as Fe,e as De,a7 as Be,dh as Re,di as Ve,a2 as Me,dj as $e,dk as Ge,dl as Ne,r as qe,b1 as We,dm as ze}from"./index-D_hiFYsE.js";import{gj as He,eV as oe,eW as Ke,iu as Xe,Ts as Ye,fn as Ze,iE as Je,iA as et,eX as V,fu as tt,g4 as at,fZ as st,g1 as ee,g5 as ot,g6 as nt,g7 as it,g8 as rt,g9 as lt}from"./zeni-epic-state-CjQblqOQ.js";import{D as dt,n as k,S as ct,P as ut}from"./mui-AZmtqUsi.js";import{u as mt}from"./useAiCfoDashboardSuggestedQuestionsChips-CmgL0oiB.js";import{p as pt}from"./pathToGoBack-ogdURlZM.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.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]="bd5602a6-0c70-44ea-a3c6-709b9b1feb14",e._sentryDebugIdIdentifier="sentry-dbid-bd5602a6-0c70-44ea-a3c6-709b9b1feb14")}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=Ve(e,{allUsers:o.allUsers,onCardPolicyVendorSearchTextChange:o.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:o.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:u,isNewChatSession:o.sessionFromUrl==="new_chat"||o.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Me}/tableDownload`,emailLinkQuestion:o.emailLinkQuestion,autoSubmitEmailLinkQuestion:o.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:o.onEmailLinkQuestionProcessed,routedInitialQuestionSource:o.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:o.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:o.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:o.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:o.isFileUploadEnabled,isUploadPromoVisible:o.isUploadPromoVisible,onUploadPromoClose:o.onUploadPromoClose,syntheticAnswers:h,resolveSyntheticAnswerCardTile:Ge(e),resolveSyntheticAnswerPolicyTile:$e(e),...S}},function(e,o){const{location:t,currentTenant:u,userId:a,navigate:h,currentChatSessionId:S,allSessionsWithOrderedQuestionAnswers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,setIsAiCfoOpen:b}=o,m=u.tenantEmailDomain;return{onEventReceived:(s,l)=>{if(s===ne&&typeof l.text=="string"&&typeof l.metadata=="object"){const d=l,g=nt(d.type),p=d.metadata.chat_session_id??null,{currentChatSession:n,currentQuestionAnswer:P,currentQuestionAnswerSummary:A}=se(x,p);g!=="answer"?I.trackAICFOChatResponseGenerated(g,P?.question.questionText??"",d.text,p,ze(A,n),d.metadata.message_id??null):I.trackAICFOChatAnswerGenerated(d.text,P?.question.questionText??"",(d.follow_up_questions?.length??0)>0,!!d.assumptions,!!d.insights,d.visualization!=null,it(d.visualization?.type??"")??null,p,d.summarized_title,d.metadata.message_id??null),e(rt({chatSessionId:d.metadata.chat_session_id,responseType:g,fetchState:{fetchState:"Completed",error:void 0}})),e(lt({chatSessionId:d.metadata.chat_session_id,answerPayload:d,userId:a}))}},onSubmit:(s,l,d,g)=>{s&&We(e,s,l,S,x,a,g,d)},updateCurrentInput:s=>{e(ee(s))},onStopSubmit:()=>{},onUpdateScrollYOffset:s=>{e(ot(s))},onSelectSampleQuestion:()=>{},onBackClick:()=>{h(-1)},onCloseClick:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??pt(1);h(l,{state:{...t.state,pathnameStackToGoBack:s.newStack}}),e(ee(""))},togglePageView:()=>{const s=M(t.state?.pathnameStackToGoBack),l=s.poppedPathname??`/${u.tenantEmailDomain}/dashboard`;h(l,{state:{...ae(t.state),pathnameStackToGoBack:s.newStack,message:"open_ai_cfo_drawer"}}),b(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{h(-1)},onNewChatClick:()=>{S!=null&&e(st());const s=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}})}})}})(Be(Re)),Ft=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:o}=Te(),t=xe(),u=Pe(),a=we(),[h,S]=r.useState(!1),{allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,onCardPolicyVendorSearchTextChange:b}=ve();r.useEffect(()=>{t(He())},[t]);const m=Z(i=>oe(i)),s=Ae.getSignedInUser(),{session_id:l}=ye(),d=Qe(),g=Fe(d),p=Z(i=>Ke(i)),n=m.uiState.currentChatSessionId,P=p.tenantEmailDomain,{handleUploadPromoClose:A,isUploadPromoVisible:ie}=_e({isFileUploadEnabled:e,tenantEmailDomain:P}),Q=Oe({currentTenant:p,currentChatSessionId:n,aiCfoView:m}),{isSuggestedQuestionsLoading:re,suggestedPromptQuestions:le}=mt(),w=a.state,y=w?.aiCfoInitialQuestion,$=!!w?.aiCfoShouldSubmit;r.useEffect(()=>{const i=a.state;if(i?.[J]!==!0)return;S(!0);const f={...i};delete f[J],u(a,{replace:!0,state:f})},[a.pathname,a.search,a.state,u]);const[de,_]=r.useState(null),[ce,O]=r.useState(!1),[ue,U]=r.useState(void 0),[me,j]=r.useState(void 0),G=r.useRef(!1);r.useEffect(()=>{if(!G.current&&y!=null&&y!==""){const i=a.state;_(y),O($),U(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const f=i?.aiCfoSuggestionIndex;j(typeof f=="number"?f:void 0),G.current=!0}},[y,$,a.state]);const pe=r.useCallback(()=>{_(null),O(!1),U(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")??w?.aiCfoRef,L=N.get("emailRefId")??w?.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),O(!0),U(void 0),j(void 0),t(Ye()))},[E,n,t]);const he=p.masterTOSInfo,C=he?.isMasterTOSAccepted??!1,{visitedSessions:z}=Ue(n),F=m.fetchState,D=m.uiState.chatSessionsNextPageToken.hasMore||!m.uiState.chatSessionsFirstPageFetched,H=n!=null?m.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",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(Ze({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(Je())},[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(B,{analytics:I,onLoad:Y}),Q.drawerElement,c.jsx(ft,{children:c.jsx(te,{children:c.jsx(R,{isTOSAccepted:!1,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:fe,onCompleteClick:()=>{p.userRoleId!=null&&t(V(p.userRoleId))}})})})]});const Ie=c.jsxs(c.Fragment,{children:[h&&!C?c.jsx(B,{analytics:I,onLoad:Y}):null,c.jsx(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>S(!1):void 0,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(p.userRoleId)),S(!1)}})]});return c.jsxs(c.Fragment,{children:[c.jsxs(St,{children:[c.jsx(B,{analytics:I,onLoad:i=>i.trackPageLoaded(De.Event.aiCFOPage)}),g&&Q.drawerElement,c.jsx(ht,{...Ce,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:X,allUsers:x,isAiCardCreationEnabled:T,isCardPolicyEnabled:v,openOnboardingPage:()=>S(!0),userId: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(R,{isTOSAccepted:C,acceptMasterTOSState:m.masterTOSAcceptanceState,onCloseClick:()=>S(!1),onCompleteClick:()=>{C||p.userRoleId==null||t(V(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-B6jAIe9x.js";import{a as v}from"./sentry-95bdnR3R.js";import{h as B,g as j,u as P,j as y,N as q,n as U,i as K,o as ee,p as C}from"./core-CLKYLs-8.js";import{eW as k,PD as A,Pj as h,zb as E,z3 as J,z7 as R,yY as Y,Pl as G,zd as te,y$ as H,zg as M,zc as D}from"./zeni-epic-state-CjQblqOQ.js";import{m as O,z as V,B as T,a7 as Q,bI as ae,af as _,bz as X,bJ as oe,bK as le,bL as pe}from"./index-BeMQfmRp.js";import"./mui-AZmtqUsi.js";import{i as se}from"./ReimbursementApprovalRuleDetailScreen-Daig4IQ8.js";import re from"./NotFoundScreen-DEN1HuyG.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]="7c48ec75-9009-4344-9391-03f73337cef4",e._sentryDebugIdIdentifier="sentry-dbid-7c48ec75-9009-4344-9391-03f73337cef4")}catch{}})();const N="bill-approval-rule-update",ne=U(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(Q(ae)),ie=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>h(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!1)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${N}`]:[],eventCallback:(l,w,g)=>{l.endsWith(N)&&g.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ne,{currentTenant:u,location:p,navigate:e,...m})},F="bill-approval-rule-update",ce=U(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,s={};for(const i of Object.values(e.contactState.contactById))i?.id!=null&&(s[i.id]=i.fullName);const a={};for(const i of Object.values(e.classState.classesByKey))i?.classId!=null&&(a[i.classId]=i.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:s,departmentNamesById:a}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(F)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(te(a,!0))}}})(Q(oe)),ue=()=>{const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(de,{}):c.jsx(ie,{})},de=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>h(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!0)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${F}`]:[],eventCallback:(l,w,g)=>{l.endsWith(F)&&g.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ce,{currentTenant:u,location:p,navigate:e,...m})},ve=U(function(e,p){const t=h(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=s==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return p.approvalRuleId&&(i=t.allApprovalRules.findIndex(r=>r.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:i,approvalUpdateActionType:s}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=f=>{const m=[];return f.forEach(l=>{const w=l.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),g=l.actors.selectedNonUsers.map(b=>{const I=!!se(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),S=w.concat(g);m.push({action:l.stepType.selectedOption,actors:S,operator:S.length>1?l.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},n={amount:{type:"amount",comparator:"range",min:{amount:o.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:o.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const f={criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}else{const f={approvalRuleId:i,criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!1))},onSaveRuleSuccess:()=>{t("../")}}})(le);function fe(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>h(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ve,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t})}const ye=U(function(e,p){const t=h(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],i={};for(const r of Object.values(e.contactState.contactById))r?.id!=null&&(a.push(r.id),i[r.id]=r.fullName);return{localData:t,approvalUpdateActionType:s,allVendorIds:a,vendorNamesById:i,editingRuleId:s==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=S=>{const b=[];return S.forEach(I=>{const $=I.actorKind?.selectedOption,z=I.selectedRole?.selectedOption;let x=[];$==="role"&&z!=null?x=[{type:"attribute",subType:z,userId:void 0,idType:void 0,isImplicitActor:!1}]:$==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(Z=>({type:"user",userId:Z.userId,isImplicitActor:!1})));const L=I.action??"require_approval";b.push({action:L,actors:x,operator:x.length>1?L==="require_approval"?"or":"and":"is"})}),b},n=o.amountCriteria,f=o.vendorCriteria,m=o.departmentCriteria,l={};if(n!=null&&n.comparator.selectedOption!=null){const S=n.comparator.selectedOption;l.amount={type:"amount",comparator:S,min:S==="less_than"?void 0:n.min,max:S==="greater_than"?void 0:n.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(l.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const g=m?.selection.selectedOptions??[];if(g.length>0&&(l.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:g}),r==="approval_create"){const S={name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}else{const S={approvalRuleId:i,name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:o=>{e(R(o)),t(r==="approval_update"?`../../${o}/edit`:`../${o}/edit`)}}})(pe);function W(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(Se,{}):c.jsx(fe,{})}function Se(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>h(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ye,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t},s??"new")}function Ee(){return c.jsxs(ee,{children:[c.jsx(C,{path:"/",element:c.jsx(ue,{})}),c.jsx(C,{path:"/new",element:c.jsx(W,{})}),c.jsx(C,{path:"/:approvalRuleId/edit",element:c.jsx(W,{})}),c.jsx(C,{path:"*",element:c.jsx(re,{})})]})}export{Ee as B};
|
|
1
|
+
import{j as c}from"./liveblocks-B6jAIe9x.js";import{a as v}from"./sentry-95bdnR3R.js";import{h as B,g as j,u as P,j as y,N as q,n as U,i as K,o as ee,p as C}from"./core-CLKYLs-8.js";import{eW as k,PD as A,Pj as h,zb as E,z3 as J,z7 as R,yY as Y,Pl as G,zd as te,y$ as H,zg as M,zc as D}from"./zeni-epic-state-CjQblqOQ.js";import{m as O,z as V,B as T,a7 as Q,bI as ae,af as _,bz as X,bJ as oe,bK as le,bL as pe}from"./index-D_hiFYsE.js";import"./mui-AZmtqUsi.js";import{i as se}from"./ReimbursementApprovalRuleDetailScreen-D_Tk1V_u.js";import re from"./NotFoundScreen-ChEBjJeL.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]="7c48ec75-9009-4344-9391-03f73337cef4",e._sentryDebugIdIdentifier="sentry-dbid-7c48ec75-9009-4344-9391-03f73337cef4")}catch{}})();const N="bill-approval-rule-update",ne=U(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:h(e).billPaySetupApproverViewUpdateData}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!1))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))}}})(Q(ae)),ie=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>h(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!1)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${N}`]:[],eventCallback:(l,w,g)=>{l.endsWith(N)&&g.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ne,{currentTenant:u,location:p,navigate:e,...m})},F="bill-approval-rule-update",ce=U(function(e){const p=A(e),t=h(e).billPaySetupApproverViewUpdateData,s={};for(const i of Object.values(e.contactState.contactById))i?.id!=null&&(s[i.id]=i.fullName);const a={};for(const i of Object.values(e.classState.classesByKey))i?.classId!=null&&(a[i.classId]=i.className);return{approvalView:p,billPaySetupApproverViewUpdateData:t,vendorNamesById:s,departmentNamesById:a}},function(e,p){const{navigate:t,location:s}=p;return{onApprovalRulesEventReceived:a=>{a.endsWith(F)&&e(G(!1))},onBackClick:()=>{_(s)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(Y(a,!0))},onEditRuleClick:a=>{a!=null?(e(R(a)),t(`./${a}/edit`)):(e(R()),t("./new"))},onReorderRules:a=>{e(te(a,!0))}}})(Q(oe)),ue=()=>{const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(de,{}):c.jsx(ie,{})},de=()=>{const e=B(),p=j(),t=P(),[s,a]=v.useState(!1),[i,r]=v.useState(!1),d=O(),o=y(l=>l.billPaySetupApproverViewState.fetchState),u=y(l=>k(l)),n=y(l=>A(l)),f=y(l=>h(l).billPaySetupApproverViewUpdateData);if(v.useEffect(()=>{f?.updateStatus.fetchState==="Completed"&&t(E())},[f]),v.useEffect(()=>{s||o!=="Not-Started"||(a(!0),t(J(!0,!0,!0)))},[s,o,t]),V.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");v.useEffect(()=>{n.allApprovalRules.length===0&&n.fetchState==="Completed"&&(i||(r(!0),t(R())),e("./new"))},[i,n,t]);const m={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${F}`]:[],eventCallback:(l,w,g)=>{l.endsWith(F)&&g.onApprovalRulesEventReceived(l)}};return u.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?c.jsx(q,{to:"../../promo"}):u.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||n.fetchState!=="Completed"&&n.fetchState!=="Error"?c.jsx(T,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):c.jsx(ce,{currentTenant:u,location:p,navigate:e,...m})},ve=U(function(e,p){const t=h(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=s==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return p.approvalRuleId&&(i=t.allApprovalRules.findIndex(r=>r.approvalRuleId===p.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:i,approvalUpdateActionType:s}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=f=>{const m=[];return f.forEach(l=>{const w=l.actors.selectedUsers.map(b=>({type:"user",userId:b.userId,isImplicitActor:!1})),g=l.actors.selectedNonUsers.map(b=>{const I=!!se(b.value);return{type:I?"attribute":"role",subType:b.value,userId:void 0,idType:void 0,isImplicitActor:!I}}),S=w.concat(g);m.push({action:l.stepType.selectedOption,actors:S,operator:S.length>1?l.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),m},n={amount:{type:"amount",comparator:"range",min:{amount:o.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:o.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const f={criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}else{const f={approvalRuleId:i,criteria:n,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(f))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!1))},onSaveRuleSuccess:()=>{t("../")}}})(le);function fe(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>h(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ve,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t})}const ye=U(function(e,p){const t=h(e),s=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],i={};for(const r of Object.values(e.contactState.contactById))r?.id!=null&&(a.push(r.id),i[r.id]=r.fullName);return{localData:t,approvalUpdateActionType:s,allVendorIds:a,vendorNamesById:i,editingRuleId:s==="approval_update"?p.approvalRuleId:void 0,allApprovalRulesWithUser:A(e).allApprovalRules}},function(e,p){const{navigate:t,approvalUpdateDataView:s,approverViewData:a,approvalRuleId:i}=p,r=s.billPaySetupApproverViewUpdateData?.type,d=_(p.location);return{onApprovalRuleDataUpdated:o=>{const u=S=>{const b=[];return S.forEach(I=>{const $=I.actorKind?.selectedOption,z=I.selectedRole?.selectedOption;let x=[];$==="role"&&z!=null?x=[{type:"attribute",subType:z,userId:void 0,idType:void 0,isImplicitActor:!1}]:$==="specific_person"&&(x=(I.persons?.selectedUsers??[]).map(Z=>({type:"user",userId:Z.userId,isImplicitActor:!1})));const L=I.action??"require_approval";b.push({action:L,actors:x,operator:x.length>1?L==="require_approval"?"or":"and":"is"})}),b},n=o.amountCriteria,f=o.vendorCriteria,m=o.departmentCriteria,l={};if(n!=null&&n.comparator.selectedOption!=null){const S=n.comparator.selectedOption;l.amount={type:"amount",comparator:S,min:S==="less_than"?void 0:n.min,max:S==="greater_than"?void 0:n.max}}const w=f?.selection.selectedOptions??[];w.length>0&&(l.vendor={type:"vendor",operator:f?.operator.selectedOption??"is",vendorIds:w});const g=m?.selection.selectedOptions??[];if(g.length>0&&(l.department={type:"department",operator:m?.operator.selectedOption??"is",departmentIds:g}),r==="approval_create"){const S={name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}else{const S={approvalRuleId:i,name:o.name,description:o.description,separationOfDuties:o.separationOfDuties,isFallback:o.isFallback,criteria:l,steps:u(o.steps),isApplicableOnPendingApprovalEntity:o.applyToExistingBills.includes("applyToExistingBills")};e(D(S))}},onResetClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),r==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(M(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:o=>{e(R(o)),t(r==="approval_update"?`../../${o}/edit`:`../${o}/edit`)}}})(pe);function W(){const e=y(t=>k(t)),{isApprovalRulesV3Enabled:p}=X(e?.tenantId);return p?c.jsx(Se,{}):c.jsx(fe,{})}function Se(){const e=B(),p=P(),t=j(),{approvalRuleId:s}=K(),a=V.getSignedInUser(),i=O(),r=y(n=>h(n)),d=y(n=>A(n)),[o,u]=v.useState(!1);if(v.useEffect(()=>{o||(u(!0),p(H(!0)))}),v.useEffect(()=>{d.fetchState==="Not-Started"&&e(s!=null?"../../":"../")},[d,s]),a==null)throw Error("Can't access address page without signing in...");return r.approverListFetchStatus.fetchState=="Not-Started"||r.approverListFetchStatus.fetchState==="In-Progress"?c.jsx(T,{fetchState:r.approverListFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):c.jsx(ye,{navigate:e,approvalUpdateDataView:r,approvalRuleId:s,approverViewData:d,location:t},s??"new")}function Ee(){return c.jsxs(ee,{children:[c.jsx(C,{path:"/",element:c.jsx(ue,{})}),c.jsx(C,{path:"/new",element:c.jsx(W,{})}),c.jsx(C,{path:"/:approvalRuleId/edit",element:c.jsx(W,{})}),c.jsx(C,{path:"*",element:c.jsx(re,{})})]})}export{Ee as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-B6jAIe9x.js";import{h as K,u as se,g as X,i as ae,j as v,N as te,n as Q,l as na,o as ia,p as y}from"./core-CLKYLs-8.js";import{eW as Z,OV as _e,bt as It,JS as oa,bo as wt,bJ as pe,OW as At,yt as Bt,zI as $e,z0 as la,bn as De,OX as sa,OY as ra,c7 as ca,OZ as da,kr as Ct,O_ as xt,O$ as Et,Ah as Ge,yI as Ce,P0 as ua,yh as tt,P1 as pa,Ee as ma,yl as ba,yr as Dt,P2 as ke,P3 as Me,zJ as Oe,P4 as ha,P5 as ga,zM as Ne,P6 as Sa,zZ as ya,P7 as Pt,zt as at,zy as fa,P8 as ka,P9 as ue,Pa as jt,Pb as Tt,Pc as Ft,gn as va,yN as Le,cB as Rt,Pd as Ia,fw as wa,Pe as Aa,Pf as Ba,fB as Vt,fz as $t,Pg as ze,Ph as Ca,Pi as xa,ME as Ze,Pj as Ea,MF as oe,MG as He,Pk as Da,Pl as Pa,Pm as ja,zA as nt,zx as Ta,Pn as Fa,Po as Ra,Pp as Va,zj as $a,Pq as La,Pr as Ua,Ps as _a,cp as Lt,cR as Ut,kC as Ga,bP as Ma,bq as _t,bQ as Gt,xz as Oa,Pt as Na,E1 as za,E7 as Za,tZ as Ha,zK as Wa,Ao as qa,kP as fe,Pu as Ja,Pv as Mt,lh as Ka,kJ as Ot,l2 as Nt,l1 as it,bE as be,bO as Xa,Pw as Qa,Px as ve,jm as Ya,Py as ot,Pz as en,jq as tn,jL as an,AC as nn,PA as on,la as ln,As as sn,PB as lt,Aw as rn,AB as cn,Ay as dn,Aq as un,PC as zt,yC as pn,PD as mn,PE as bn,gf as hn,ge as gn,gd as Sn,kS as yn,l8 as st,lj as fn,rx as kn,k$ as vn,Au as In,jw as wn,lo as An,PF as Bn,jo as Cn,ro as xn,PG as En,zp as Dn,bK as Pn,bs as jn,LA as Tn,cT as Fn,cS as Rn,cA as Vn,cH as $n}from"./zeni-epic-state-CjQblqOQ.js";import{m as me,z as V,j as Ie,_ as We,F as le,x as S,aN as xe,B as re,o as x,A as Pe,c as D,be as Ln,n as z,a2 as qe,r as E,K as we,bf as rt,bg as ct,bh as Un,ak as _n,I as Gn,aH as Mn,E as Zt,D as Je,N as Ke,bi as On,at as Ht,bj as Nn,X as zn,e as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Xn,bq as Qn,br as Yn,bs as ei,w as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-BeMQfmRp.js";import{n as U,S as si}from"./mui-AZmtqUsi.js";import{A as dt}from"./AddressScreen-Bpm1g3GJ.js";import{g as ie,a as je,i as qt,V as Xe,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-s5k6zIAu.js";import{a as f}from"./sentry-95bdnR3R.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-k3dV_2QR.js";import{u as Jt}from"./useInitialThreadRequest-CrlDQYJc.js";import Ee from"./NotFoundScreen-DEN1HuyG.js";import{D as ui}from"./DrawerScreen-CeOHT4ro.js";import{M as Kt}from"./MobileAppDrawer-Ck77XJrw.js";import{F as Xt}from"./FeaturePreviewScreen-429nxvjk.js";import{S as Te}from"./SetupPagesScreen-0zvJok5y.js";import{B as pi}from"./BillPayApprovalRoutes-7UEPLRsP.js";import{FallBackRoute as mi}from"./ScreenRoutes-Dti7-Ixh.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./analyticsHelper-BYRUUvaV.js";import"./routePaths-2zRQFXqm.js";import"./BusinessVerificationPageScreen-UgGxnQyH.js";import"./ReimbursementApprovalRuleDetailScreen-Daig4IQ8.js";import"./getLocaleForTenant-CuwnZkK7.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]="43b28e90-f4ec-4e73-85a2-a1dde5a5416e",e._sentryDebugIdIdentifier="sentry-dbid-43b28e90-f4ec-4e73-85a2-a1dde5a5416e")}catch{}})();const bi=Q(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=X(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(O=>Z(O)),s=v(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(S.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:J}=j(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Se=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({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=X(),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(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=v(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=v(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(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(ke({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage: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(Qt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:Se.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Se.overwriteDescription}),primaryButtonText:Se.buttons.yes,secondaryButtonText:Se.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=On();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${Se.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-B6jAIe9x.js";import{h as K,u as se,g as X,i as ae,j as v,N as te,n as Q,l as na,o as ia,p as y}from"./core-CLKYLs-8.js";import{eW as Z,OV as _e,bt as It,JS as oa,bo as wt,bJ as pe,OW as At,yt as Bt,zI as $e,z0 as la,bn as De,OX as sa,OY as ra,c7 as ca,OZ as da,kr as Ct,O_ as xt,O$ as Et,Ah as Ge,yI as Ce,P0 as ua,yh as tt,P1 as pa,Ee as ma,yl as ba,yr as Dt,P2 as ke,P3 as Me,zJ as Oe,P4 as ha,P5 as ga,zM as Ne,P6 as Sa,zZ as ya,P7 as Pt,zt as at,zy as fa,P8 as ka,P9 as ue,Pa as jt,Pb as Tt,Pc as Ft,gn as va,yN as Le,cB as Rt,Pd as Ia,fw as wa,Pe as Aa,Pf as Ba,fB as Vt,fz as $t,Pg as ze,Ph as Ca,Pi as xa,ME as Ze,Pj as Ea,MF as oe,MG as He,Pk as Da,Pl as Pa,Pm as ja,zA as nt,zx as Ta,Pn as Fa,Po as Ra,Pp as Va,zj as $a,Pq as La,Pr as Ua,Ps as _a,cp as Lt,cR as Ut,kC as Ga,bP as Ma,bq as _t,bQ as Gt,xz as Oa,Pt as Na,E1 as za,E7 as Za,tZ as Ha,zK as Wa,Ao as qa,kP as fe,Pu as Ja,Pv as Mt,lh as Ka,kJ as Ot,l2 as Nt,l1 as it,bE as be,bO as Xa,Pw as Qa,Px as ve,jm as Ya,Py as ot,Pz as en,jq as tn,jL as an,AC as nn,PA as on,la as ln,As as sn,PB as lt,Aw as rn,AB as cn,Ay as dn,Aq as un,PC as zt,yC as pn,PD as mn,PE as bn,gf as hn,ge as gn,gd as Sn,kS as yn,l8 as st,lj as fn,rx as kn,k$ as vn,Au as In,jw as wn,lo as An,PF as Bn,jo as Cn,ro as xn,PG as En,zp as Dn,bK as Pn,bs as jn,LA as Tn,cT as Fn,cS as Rn,cA as Vn,cH as $n}from"./zeni-epic-state-CjQblqOQ.js";import{m as me,z as V,j as Ie,_ as We,F as le,x as S,aN as xe,B as re,o as x,A as Pe,c as D,be as Ln,n as z,a2 as qe,r as E,K as we,bf as rt,bg as ct,bh as Un,ak as _n,I as Gn,aH as Mn,E as Zt,D as Je,N as Ke,bi as On,at as Ht,bj as Nn,X as zn,e as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Xn,bq as Qn,br as Yn,bs as ei,w as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-D_hiFYsE.js";import{n as U,S as si}from"./mui-AZmtqUsi.js";import{A as dt}from"./AddressScreen-BRdhnUB3.js";import{g as ie,a as je,i as qt,V as Xe,b as Qe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-Dwlu904z.js";import{a as f}from"./sentry-95bdnR3R.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-FETbJUjN.js";import{u as Jt}from"./useInitialThreadRequest-D1F5GLCG.js";import Ee from"./NotFoundScreen-ChEBjJeL.js";import{D as ui}from"./DrawerScreen-KqrF4Sq7.js";import{M as Kt}from"./MobileAppDrawer-BPYh3fz7.js";import{F as Xt}from"./FeaturePreviewScreen-CNGfajWs.js";import{S as Te}from"./SetupPagesScreen-Bfb-yG5Q.js";import{B as pi}from"./BillPayApprovalRoutes-BrRYqqLJ.js";import{FallBackRoute as mi}from"./ScreenRoutes-BE5zmBx7.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./analyticsHelper-BsjRdUZX.js";import"./routePaths-XSngD1ow.js";import"./BusinessVerificationPageScreen-CoxJBcce.js";import"./ReimbursementApprovalRuleDetailScreen-D_Tk1V_u.js";import"./getLocaleForTenant-C_VQis3o.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]="43b28e90-f4ec-4e73-85a2-a1dde5a5416e",e._sentryDebugIdIdentifier="sentry-dbid-43b28e90-f4ec-4e73-85a2-a1dde5a5416e")}catch{}})();const bi=Q(function(e,t){const l=_e(e,t.billId),n=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const i=De(n);i||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),n);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:i}},function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Ce(l,"retry")):e(Ce(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=je(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Ce(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ge(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=X(),{billId:n}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(O=>Z(O)),s=v(O=>_e(O,n??"")),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[P,A]=f.useState(!1),[B,G]=f.useState(!1),{useFeatureGate:j,useDynamicConfig:_}=le(),{isFeatureEnabled:$}=j(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=j(S.isBillPayCommentingEnabled),{isFeatureEnabled:H}=j(S.isBillPayDetectInsufficientFundsEnabled),{configValue:M}=_(xe.zeniAssistConfig),C=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=M.user_ids!=null&&r?.userId!=null&&M.user_ids.includes(r?.userId),{isFeatureEnabled:J}=j(S.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=j(S.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&C===!1?G(!1):G(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(O=>O.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,C,r]),f.useEffect(()=>{n!=null&&t(At(n))},[n]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Bt(n??"",$,L,!1)))},[b,s,n,t]),f.useEffect(()=>{P||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[P,s,n,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Pe,{analytics:D,onLoad:O=>(ee=>{n!=null&&ee.trackBillPayBillDetails(n,s.isRecurring)})(O)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:B,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Se=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=Q(function(e,t){const l=V.getSignedInUser(),n=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:n??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:n=>{n!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(n),t.setShowConfirmationPopup(!0)):e(Ne(n,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:n=>{e(ya({fetchState:{fetchState:n,error:void 0},billId:t.billId}))},onSkipAutofill:n=>{D?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({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=X(),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(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(S.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(S.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(S.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),P=k.user_ids!=null&&i?.userId!=null&&k.user_ids.includes(i?.userId),A=v(F=>Z(F)),[B,G]=f.useState(!1),[j,_]=f.useState(!1),[$,I]=f.useState(!1),[H,M]=f.useState(),C=v(F=>Me(F,m,g,n));let q=C.fetchState,W=C.file,L=C.showAutofill;const J=v(F=>_e(F,n??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;f.useEffect(()=>{n==null&&t(Oe(!0))},[n,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&j?_(!1):!u&&B&&G(!1))},[n]),f.useEffect(()=>{B||n==null||u||(G(!0),t(Bt(n,h,P,!1)),j||(_(!0),t($e(!1,h,P,b,n)))),u&&!j&&(_(!0),t($e(!1,h,P,b,n)))},[B,j,u,n,t]);const O={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(H,m,n))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(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(ke({billId:n})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return n==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:!0,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:M,showActionButtons:!1,isInitialEdit:!!C.isInitialEdit,billStage: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(Qt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(Un,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:n==null})})]});{const F=C.billPayInfo!=null&&C.billPayInfo.stage.code==="pending_approval"?C.billPayInfo.billStatus.code:C.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(_n,{titleComponent:a.jsx(wi,{children:Se.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:Se.overwriteDescription}),primaryButtonText:Se.buttons.yes,secondaryButtonText:Se.buttons.no,action:O,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(Si,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:n,file:W,showAutofill:L,uploadStatus:C.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:yi(u,J,C),setShowConfirmationPopup:I,setPayload:M,showActionButtons:fi(u,C),isInitialEdit:!!C.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function Si(){const{triggerBack:e}=On();return a.jsx(Qt,{onClick:e,"data-testid":"nav-bar-back-click"})}function yi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${Se.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],n=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||n)}const pt=U.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as k}from"./liveblocks-B6jAIe9x.js";import{a as V}from"./sentry-95bdnR3R.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-CLKYLs-8.js";import{j as ce,F as ue,aN as de,z,A as pe,c as E,af as x,e as P,bE as le,at as me,r as B,au as R}from"./index-
|
|
1
|
+
import{j as k}from"./liveblocks-B6jAIe9x.js";import{a as V}from"./sentry-95bdnR3R.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-CLKYLs-8.js";import{j as ce,F as ue,aN as de,z,A as pe,c as E,af as x,e as P,bE as le,at as me,r as B,au as R}from"./index-D_hiFYsE.js";import{Pr as fe,eW as G,to as ye,JV as Se,zj as ge,CL as Ie,Fn as be,G0 as he,H0 as Oe,PO as Te,PP as De,PQ as ke,PR as Ce,PS as Ve,Mm as we,OQ as Ae,Mx as Ne,l7 as _e,gf as Fe,ge as ve,gd as xe,rx as Pe,ro as ze,rl as Ee,k$ as Be,tx as Re,tv as M,bE as L,tJ as j,cz as Me}from"./zeni-epic-state-CjQblqOQ.js";import{n as Le}from"./mui-AZmtqUsi.js";import{d as U}from"./routePaths-XSngD1ow.js";import{M as je}from"./MobileAppDrawer-BPYh3fz7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="a57a3244-0f09-4b2d-b851-c96edb8e5dbf",e._sentryDebugIdIdentifier="sentry-dbid-a57a3244-0f09-4b2d-b851-c96edb8e5dbf")}catch{}})();const Ue=Le.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-B6jAIe9x.js";import{a as l}from"./sentry-95bdnR3R.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-CLKYLs-8.js";import{W as ge,d9 as be,z as ye,da as Pe,dc as z,dd as Ie,b5 as W,A as we,c as $,de as H,dn as Ee,D as Ae,e as ke,a7 as Te,dh as xe,di as Ue,a2 as _e,dl as Oe,b1 as ve,dm as Qe}from"./index-
|
|
1
|
+
import{j as g}from"./liveblocks-B6jAIe9x.js";import{a as l}from"./sentry-95bdnR3R.js";import{u as pe,h as he,g as Ce,j as M,i as fe,n as Se}from"./core-CLKYLs-8.js";import{W as ge,d9 as be,z as ye,da as Pe,dc as z,dd as Ie,b5 as W,A as we,c as $,de as H,dn as Ee,D as Ae,e as ke,a7 as Te,dh as xe,di as Ue,a2 as _e,dl as Oe,b1 as ve,dm as Qe}from"./index-D_hiFYsE.js";import{gj as Fe,eV as G,eW as $e,fn as De,iE as Ve,iA as Le,eX as B,g4 as je,fZ as Re,g1 as N,g5 as qe,g6 as Me,g7 as He,g8 as Be,g9 as Ne}from"./zeni-epic-state-CjQblqOQ.js";import{D as ze,n as V,P as We,S as Ge}from"./mui-AZmtqUsi.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.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]="72bf2741-487a-4f10-be39-a17351c79bc6",e._sentryDebugIdIdentifier="sentry-dbid-72bf2741-487a-4f10-be39-a17351c79bc6")}catch{}})();const K="chat-response-generated",X="cards/ask",Y="card_policy_hero";function D(e){return`/${e}/cards`}function Z(e){return`/${e}/cards/policy`}const Ke=Se(function(e,a){const n=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&n.uiState.currentChatSessionId==null,aiCfoView:n,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_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:n,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=n.state?.referrer,p=C===Y?Z(i):D(i);return{onEventReceived:(o,t)=>{if(o===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:(o,t,s,f)=>{o&&ve(e,o,t,h,E,d,f,s,U)},updateCurrentInput:o=>{e(N(o))},onStopSubmit:()=>{},onUpdateScrollYOffset:o=>{e(qe(o))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...n.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(n.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m(function(o){return`/${o}/${X}`}(i),{state:{...n.state}})},onToggleCotCollapsed:(o,t)=>{e(je({questionAnswerId:o,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(D(i),{state:{...n.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...n.state}})}})}})(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:J,cardPolicyAiCfoHero:ee}}}=Ae.getLocalizedStrings(),k=J.pageTitle,Xe=ee.pageTitle,Ye=J.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),n=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect(()=>{n(Fe())},[n]);const i=M(r=>G(r)),C=ye.getSignedInUser(),{session_id:p}=fe(),o=M(r=>$e(r)),t=i.uiState.currentChatSessionId,s=o.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:k,subtitle:I?Ze:Ye}),[I]),[ae,_]=l.useState(null),[ne,O]=l.useState(!1),v=l.useRef(!1);l.useEffect(()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)},[u,P]);const oe=l.useCallback(()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})},[d.pathname,d.state,c]),ie=o.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,A=l.useRef(null);l.useEffect(()=>{if(S&&A.current!=null){const{question:r,shouldSubmit:w}=A.current;A.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"&&n(De({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&&n(Ve())},[Q,F,n]),l.useEffect(()=>{t!=null&&j!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&n(Le(t,C.userId))},[j,R,t,C,n]),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(ke.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:k,chatHeader:se,currentTenant:o,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:oe,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>{c(I?Z(s):D(s),{state:{...d.state}})},onCompleteClick:()=>{S||o.userRoleId==null||(u!=null&&u!==""&&(A.current={question:u,shouldSubmit:P}),n(B(o.userRoleId)))}}),g.jsx(ze,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:tt,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(Je,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:k,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||o.userRoleId==null||n(B(o.userRoleId)),h(!1)}})})})]})},Je=V(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-B6jAIe9x.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-CLKYLs-8.js";import{bs as Pe,Rq as as,Rr as ts,eY as un,Rs as kn,f5 as En,Rt as An,Ru as Dn,Rv as _n,Rw as Pn,f6 as wn,f7 as vn,Rx as Tn,fh as Fn,fi as $a,Ry as xn,Rz as ns,fb as rs,fa as ss,RA as cs,BP as Rn,fk as ca,RB as os,RC as is,e_ as ds,eZ as ls,fw as ze,fd as Bn,fc as Ln,RD as us,fe as ms,Bk as Cs,Bj as ps,Bn as hs,Bp as fs,fp as gs,eV as On,RE as bs,RF as Ss,fu as Un,RG as ys,fv as St,Bv as Is,Bs as ks,eW as fe,RH as Qa,fz as we,fA as ve,fB as Te,gu as oa,cw as ia,RI as da,RJ as _t,uC as za,kz as Za,RK as Wa,C3 as ka,C5 as Qe,C6 as Pt,kp as jn,RL as la,BT as _a,RM as Es,RN as As,BW as Ja,RO as Ds,PL as Xa,fg as Mn,C0 as ga,hP as _s,RP as Nn,RQ as ua,bq as Ps,RR as ws,gf as et,ge as at,CA as vs,gd as tt,Pr as Ts,RS as Vn,cp as Hn,cR as Fs,PK as wa,D9 as Gn,RT as mn,CL as Pa,RU as $n,Da as xs,Qa as Rs,Db as Bs,E7 as Ls,tZ as Os,E1 as Us,RV as js,C4 as ra,RW as Ms,RX as Ns,RY as Vs,RZ as Hs,R_ as Gs,R$ as wt,S0 as $s,Cl as zn,Ce as zs,S1 as Zs,gw as Ws,Cu as Zn,Cy as Wn,gv as Ks,S2 as Ys,CX as Kn,S3 as qs,S4 as Qs,S5 as Js,Cw as Yn,Ch as qn,BZ as Qn,Cq as Jn,Co as Xn,Cs as Xs,S6 as er,S7 as ec,fr as ac,fs as tc,ft as nc,S8 as nt,fl as ar,cS as vt,S9 as rc,Sa as sc,Sb as cc,Sc as oc,CG as yt,D2 as ic,C_ as dc,CC as lc,D0 as uc,CS as mc,CU as Cc,Sd as tr,D8 as Ga,JS as pc,Se as hc,Sf as fc,Sg as gc,Sh as nr,Si as bc,Dv as Sc,CK as rr,CF as je,CJ as yc,Sj as Ic,Sk as kc,BQ as Ec,Sl as sr,ff as cr,Sm as Ac,BS as Dc,BR as Cn,Sn as _c,So as Pc,Sp as wc,Mn as vc,Sq as Tt,Sr as Tc,xC as or,l7 as Fc,hF as xc,DA as Rc,Ss as ir,f2 as Bc,f3 as Lc,St as Oc,di as Uc,fj as jc,Dq as Mc,Dk as qe,bt as Nc,bJ as Vc,cB as Hc,bK as Gc,LA as $c}from"./zeni-epic-state-CjQblqOQ.js";import{j as Fe,cm as dr,n as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Wc,W as mr,a as Cr,Z as pr,r as ye,F as le,x as K,aq as ya,cs as hr,ct as Kc,cu as Yc,z as re,B as va,cb as rt,cv as qc,cw as Qc,cx as Jc,cy as Xc,cz as eo,K as Ta,aN as Ze,bo as xt,cA as ao,E as Fa,h as st,m as Rt,c as J,a7 as ct,cB as to,bB as ba,cC as It,cD as no,A as Bt,cE as ro,at as fr,a2 as kt,cF as so,X as gr,e as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Ka,cM as Co,cN as po,cO as pt,w as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-BeMQfmRp.js";import{n as Ne,D as Sr,S as ko}from"./mui-AZmtqUsi.js";import{a as r}from"./sentry-95bdnR3R.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-k3dV_2QR.js";import{M as Ie}from"./MobileAppDrawer-Ck77XJrw.js";import{d as Lt}from"./recharts-CyaYjFwn.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Je,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-0zvJok5y.js";import{u as Ar}from"./useInitialThreadRequest-CrlDQYJc.js";import ot from"./NotFoundScreen-DEN1HuyG.js";import{n as hn}from"./utils-CDpOkGne.js";import{t as Po}from"./AddressScreen-Bpm1g3GJ.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./analyticsHelper-BYRUUvaV.js";import"./routePaths-2zRQFXqm.js";import"./BusinessVerificationPageScreen-UgGxnQyH.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]="786f2162-5803-49e9-b9a7-9a0f283f117b",e._sentryDebugIdIdentifier="sentry-dbid-786f2162-5803-49e9-b9a7-9a0f283f117b")}catch{}})();const wo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",W=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:W,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:W,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),W=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(W);r.useEffect(()=>{const R=X.current;X.current=W,W==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,W,e,q]);const S=W==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Wc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:W,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:W,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Y,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(Y,ke,3),[Y,ke]),[ge,ae]=r.useState(""),ue=T&&R&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ke=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&W)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:We,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ke,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,W,q,ee,ne,Be,Ke,te,Ee,We,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Yc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(Y=>fe(Y)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(Y=>Qa(Y).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(Y=>oa(Y,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(Y=>da(Y)),L=o(Y=>Y.classListState.fetchState),l=!B&&u&&d,p=o(Y=>_t(Y,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(Y=>U!=null?za(Y.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(Y=>Z!=null?Za(Y.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,W=o(Y=>x!=null?za(Y.userRoleState,x):void 0),q=W?.accountingClassIDs[0],E=o(Y=>q!=null?Za(Y.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Wa()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const Y=Ae(s.tenantEmailDomain,n,a,O,m);e(Y)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Wa());const Y=Ae(s.tenantEmailDomain,n,a);e(Y)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Je(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Qc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Jc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Wo={containerWidth:new Fa(100,58)},Ko=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),W=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(W,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=Ne.div`
|
|
1
|
+
import{j as c}from"./liveblocks-B6jAIe9x.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as Dt,n as De,t as In,o as es,p as se}from"./core-CLKYLs-8.js";import{bs as Pe,Rq as as,Rr as ts,eY as un,Rs as kn,f5 as En,Rt as An,Ru as Dn,Rv as _n,Rw as Pn,f6 as wn,f7 as vn,Rx as Tn,fh as Fn,fi as $a,Ry as xn,Rz as ns,fb as rs,fa as ss,RA as cs,BP as Rn,fk as ca,RB as os,RC as is,e_ as ds,eZ as ls,fw as ze,fd as Bn,fc as Ln,RD as us,fe as ms,Bk as Cs,Bj as ps,Bn as hs,Bp as fs,fp as gs,eV as On,RE as bs,RF as Ss,fu as Un,RG as ys,fv as St,Bv as Is,Bs as ks,eW as fe,RH as Qa,fz as we,fA as ve,fB as Te,gu as oa,cw as ia,RI as da,RJ as _t,uC as za,kz as Za,RK as Wa,C3 as ka,C5 as Qe,C6 as Pt,kp as jn,RL as la,BT as _a,RM as Es,RN as As,BW as Ja,RO as Ds,PL as Xa,fg as Mn,C0 as ga,hP as _s,RP as Nn,RQ as ua,bq as Ps,RR as ws,gf as et,ge as at,CA as vs,gd as tt,Pr as Ts,RS as Vn,cp as Hn,cR as Fs,PK as wa,D9 as Gn,RT as mn,CL as Pa,RU as $n,Da as xs,Qa as Rs,Db as Bs,E7 as Ls,tZ as Os,E1 as Us,RV as js,C4 as ra,RW as Ms,RX as Ns,RY as Vs,RZ as Hs,R_ as Gs,R$ as wt,S0 as $s,Cl as zn,Ce as zs,S1 as Zs,gw as Ws,Cu as Zn,Cy as Wn,gv as Ks,S2 as Ys,CX as Kn,S3 as qs,S4 as Qs,S5 as Js,Cw as Yn,Ch as qn,BZ as Qn,Cq as Jn,Co as Xn,Cs as Xs,S6 as er,S7 as ec,fr as ac,fs as tc,ft as nc,S8 as nt,fl as ar,cS as vt,S9 as rc,Sa as sc,Sb as cc,Sc as oc,CG as yt,D2 as ic,C_ as dc,CC as lc,D0 as uc,CS as mc,CU as Cc,Sd as tr,D8 as Ga,JS as pc,Se as hc,Sf as fc,Sg as gc,Sh as nr,Si as bc,Dv as Sc,CK as rr,CF as je,CJ as yc,Sj as Ic,Sk as kc,BQ as Ec,Sl as sr,ff as cr,Sm as Ac,BS as Dc,BR as Cn,Sn as _c,So as Pc,Sp as wc,Mn as vc,Sq as Tt,Sr as Tc,xC as or,l7 as Fc,hF as xc,DA as Rc,Ss as ir,f2 as Bc,f3 as Lc,St as Oc,di as Uc,fj as jc,Dq as Mc,Dk as qe,bt as Nc,bJ as Vc,cB as Hc,bK as Gc,LA as $c}from"./zeni-epic-state-CjQblqOQ.js";import{j as Fe,cm as dr,n as _e,cn as lr,co as ur,cp as zc,D as Xe,_ as Ft,cq as Zc,cr as Wc,W as mr,a as Cr,Z as pr,r as ye,F as le,x as K,aq as ya,cs as hr,ct as Kc,cu as Yc,z as re,B as va,cb as rt,cv as qc,cw as Qc,cx as Jc,cy as Xc,cz as eo,K as Ta,aN as Ze,bo as xt,cA as ao,E as Fa,h as st,m as Rt,c as J,a7 as ct,cB as to,bB as ba,cC as It,cD as no,A as Bt,cE as ro,at as fr,a2 as kt,cF as so,X as gr,e as br,cG as co,cH as oo,cI as io,cJ as lo,cK as uo,cL as mo,o as Ka,cM as Co,cN as po,cO as pt,w as ho,cP as fo,cQ as go,cR as bo,cS as So,cT as yo,a9 as Io}from"./index-D_hiFYsE.js";import{n as Ne,D as Sr,S as ko}from"./mui-AZmtqUsi.js";import{a as r}from"./sentry-95bdnR3R.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-FETbJUjN.js";import{M as Ie}from"./MobileAppDrawer-BPYh3fz7.js";import{d as Lt}from"./recharts-CyaYjFwn.js";import{g as Ae,a as Ra,b as yr,c as xe,d as Re,e as Je,f as ea,h as aa,A as Eo,i as Ot,P as Ao,j as Ut,s as Ia,k as Ir,l as sa,m as kr,n as Do,o as Er,p as _o,S as pn}from"./SetupPagesScreen-Bfb-yG5Q.js";import{u as Ar}from"./useInitialThreadRequest-D1F5GLCG.js";import ot from"./NotFoundScreen-ChEBjJeL.js";import{n as hn}from"./utils-CDpOkGne.js";import{t as Po}from"./AddressScreen-BRdhnUB3.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./analyticsHelper-BsjRdUZX.js";import"./routePaths-XSngD1ow.js";import"./BusinessVerificationPageScreen-CoxJBcce.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]="786f2162-5803-49e9-b9a7-9a0f283f117b",e._sentryDebugIdIdentifier="sentry-dbid-786f2162-5803-49e9-b9a7-9a0f283f117b")}catch{}})();const wo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},Dr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:wo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:fn}}}=Xe.getLocalizedStrings(),vo=e=>Bn(e,!1),To=e=>Ln(e.name,!1);function Fo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(T=>{g(T)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(as()),a(ts()),a(un())},[a]);const D=o(T=>kn(T.cardPolicyState)),d=o(T=>En(T.cardPolicyState)),j=o(T=>An(T.cardPolicyState)),P=o(T=>Dn(T.cardPolicyState)),F=o(T=>_n(T.cardPolicyState)),C=o(T=>Pn(T.cardPolicyState)),h=o(T=>wn(T.cardPolicyState)),w=o(T=>vn(T.cardPolicyState)),u=o(T=>Tn(T.cardPolicyState)),v=o(T=>T.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(T=>T.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Fn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(T=>xn(T.createCardPolicyState)),A=o(T=>ns(T.createCardPolicyState)),I=o(T=>rs(T.cardPolicyState)),L=o(T=>ss(T.cardPolicyState)),l=o(T=>cs(T.createCardPolicyState)),p=o(T=>Rn(T));r.useEffect(()=>{p.fetchState==="Not-Started"&&a(ca(!1,!1,!1))},[p.fetchState,a]);const N=r.useMemo(()=>d.map(vo),[d]),G=r.useMemo(()=>h.map(To),[h]),O=r.useMemo(()=>p.cards.filter(T=>!dr(T.status.code)).map(Dr),[p.cards]),U=D==="Completed"&&p.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(os({cardsMasterList:O,defaultRequireReceiptAmount:v,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:F,suggestedBlockCategories:C}))},[k,a,U,l,O,v,j,P,F,C]);const z=r.useMemo(()=>Lt(T=>{a($a(T))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(T=>{z(T)},[z]),y=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",W=r.useCallback(()=>{const T=_e(n.state?.pathnameStackToGoBack),ee=T.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:T.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(T=>{a(is(T))},[a]),V=r.useCallback(T=>{const ee=lr(T);a(ds({templates:[ee]}))},[a]),Q=r.useCallback(T=>{T.length!==0&&a(ls(T))},[a]),X=r.useCallback(()=>{a(un())},[a]),S=r.useRef(y);r.useEffect(()=>{const T=S.current;S.current=y,y==="Completed"&&T!=="Completed"&&A!=null&&(a(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,y,A,e,x]);const R=y==="Error"?M.error?.message??fn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(ur,{showUploadDocumentSection:!0,navBarTitle:fn.createPageTitle,onBackClick:W,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:B})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:y,submitErrorMessage:R,documentUploadState:I,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:B,onBackClick:W,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=Xe.getLocalizedStrings(),Ro=e=>Bn(e,!1),Bo=e=>Ln(e.name,!1);function Lo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(R=>{_(R)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:B,onAskAiCfoClick:D}=xa({mobileExploreReferrer:"Card Policy"}),d=o(R=>us(R)),j=o(R=>kn(R.cardPolicyState)),P=o(R=>En(R.cardPolicyState)),F=o(R=>An(R.cardPolicyState)),C=o(R=>Dn(R.cardPolicyState)),h=o(R=>_n(R.cardPolicyState)),w=o(R=>Pn(R.cardPolicyState)),u=o(R=>wn(R.cardPolicyState)),v=o(R=>vn(R.cardPolicyState)),k=o(R=>Tn(R.cardPolicyState)),M=o(R=>Rn(R)),A=o(R=>a!=null?ms(R.cardPolicyState,a):void 0),I=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?Cs(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const R=d.detailFetchState.fetchState;d.templateId===a&&(R==="Completed"||R==="In-Progress")||A!=null||s(ps(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Fn())},[s,j]),r.useEffect(()=>{v==="Completed"&&k===""||v==="In-Progress"||s($a())},[s,v,k]);const L=o(R=>R.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(ca(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Ro),[P]),p=r.useMemo(()=>u.map(Bo),[u]),N=r.useMemo(()=>M.cards.filter(R=>!dr(R.status.code)).map(Dr),[M.cards]);Ft({isDataReady:I!=null});const G=r.useMemo(()=>{if(I!=null)return Zc({draft:I,cardRows:N,categorySearchOptions:l,vendorSearchOptions:p,defaultRequireReceiptAmount:L,suggestedAllowMerchants:F,suggestedBlockMerchants:C,suggestedAllowCategories:h,suggestedBlockCategories:w})},[I,N,l,p,L,F,C,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(R=>{U(R)},[]),y=r.useMemo(()=>Lt(R=>{s($a(R))},250),[s]);r.useEffect(()=>()=>{y.cancel()},[y]);const x=r.useCallback(R=>{y(R)},[y]),W=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const R=_e(n.state?.pathnameStackToGoBack),T=R.poppedPathname??q;e(T,{state:{pathnameStackToGoBack:R.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(R=>{if(a==null)return;const T=lr(R);s(hs(T)),s(fs(a))},[s,a]),X=r.useRef(W);r.useEffect(()=>{const R=X.current;X.current=W,W==="Completed"&&R!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,W,e,q]);const S=W==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Wc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:p,categorySearchOptions:l,isVendorSearchLoading:v==="In-Progress",onVendorSearchTextChange:x,submitState:W,submitErrorMessage:S,isAiCfoAccessEnabled:B,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(ur,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:B,onAskAiCfoClick:D})]})}function _r(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function Pr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(gs(n,e)),Dt)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Oo,subheadline:Uo,pageTitle:jo}}}}=Xe.getLocalizedStrings(),Mo=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function No(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(y=>{g(y)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:B}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=xa({mobileExploreReferrer:"Card Policy"}),P=o(y=>bs(y)),F=o(y=>xn(y.createCardPolicyState)),C=o(y=>Ss(y.createCardPolicyState)),h=o(y=>C==null?[]:Un(y.aiCfoState,C).filter(x=>x.kind==="creating_policy"),Dt),w=F.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(y=>ys(y.createCardPolicyState)),v=ya(F.fetchState);r.useEffect(()=>{if(v==="In-Progress"&&F.fetchState==="Completed"&&C!=null)h.forEach(y=>{a(St({chatSessionId:C,id:y.id,entityIds:u,kind:"created_policy"}))});else if(v==="In-Progress"&&F.fetchState==="Error"&&C!=null){h.forEach(x=>{a(St({chatSessionId:C,id:x.id,kind:"errored_policy"}))});const y=F.error?.message!=null&&F.error.message.length>0?F.error.message:Xe.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:y}]}))}},[F.error?.message,F.fetchState,a,C,u,h,v]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(Is())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const I=r.useMemo(()=>P.templates.map(Mo),[P.templates]);Ft({isDataReady:P.fetchState.fetchState==="Completed"});const L=I.length>0||w>0,l=function(y){const{hasAnyPolicies:x,isChargeCardAdmin:W,isFileUploadEnabled:q}=y,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=mr(),R=Cr(),T=pr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Y,isResolved:ke}=Pr("card_policy"),be=r.useMemo(()=>_r(Y,ke,3),[Y,ke]),[ge,ae]=r.useState(""),ue=T&&R&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),We=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ke=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&W)return{aiAgentName:jo,headline:Oo,subheadline:Uo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:We,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ke,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,W,q,ee,ne,Be,Ke,te,Ee,We,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:B}),p=D&&l!=null?c.jsx(hr,{...l}):null,N=d&&p==null,G=r.useCallback(()=>{const y=_e(n.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(y=>{t!=null&&e(`/${t}/cards/policy/${y}/edit`)},[e,t]),z=r.useCallback(y=>{a(ks(y))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Kc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Yc,{policies:I,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:p,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Vo(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(Y=>fe(Y)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(Y=>Qa(Y).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const B=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),F=ve(s),C=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=xe({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:C}),u=Re({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:F,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),v=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(Y=>oa(Y,s.companyId)),M=ia(k.controllers),{creditAccount:A,creditAccountRepayment:I}=o(Y=>da(Y)),L=o(Y=>Y.classListState.fetchState),l=!B&&u&&d,p=o(Y=>_t(Y,n,l,u)),[N,G]=r.useState(!1),O=p.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(Y=>U!=null?za(Y.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],y=o(Y=>Z!=null?Za(Y.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,W=o(Y=>x!=null?za(Y.userRoleState,x):void 0),q=W?.accountingClassIDs[0],E=o(Y=>q!=null?Za(Y.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Wa()),Q&&t(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||p.fetchState==="Completed"||p.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,p,n,t]),r.useEffect(()=>{if(p.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const Y=Ae(s.tenantEmailDomain,n,a,O,m);e(Y)}},[p.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(Qe()),I.fetchState!=="Completed"&&I.fetchState!=="In-Progress"&&u&&d&&f&&t(Pt()),L!=="Completed"&&L!=="In-Progress"&&t(jn())},[A.fetchState,I.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Wa());const Y=Ae(s.tenantEmailDomain,n,a);e(Y)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",R=Je(u,w,v,d),T=Ra(u,d,f,A,I),ee=yr(S,p);return p.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:d,productInformation:R,creditAccountInformation:T,debitAccountInformation:ee,chargeCardDetailView:p,creditAccount:A,classListFetchState:L,creditAccountRepayment:I,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:y?.className,cardHolderRoles:W?.userRoles,cardHolderDepartmentName:E?.className})]})}const jt=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Qc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,B=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Jc(D);if(j==="")return;const P=s.channel(d),F=h=>{b.current(j,h)};let C;if(P?.subscribed===!0)C=P,C.bind(j,F),m.has(d)||(m.add(d),B()),i.push(()=>{P.unbind(j,F)});else{if(C=P??s.subscribe(d),C.bind(j,F),!m.has(d)){m.add(d);const h=()=>{B()};C.bind("pusher:subscription_succeeded",h),i.push(()=>{C.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{C.unbind(j,F)})}}),()=>{i.forEach(D=>D())}},[s,_])},wr="charge-card-transaction-update",vr="charge-card-transaction-created",Tr="charge-card-transaction-declined",Fr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",Mt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Nt="charge-card-limit-updated",Vt="charge-card-limit-reset",Ht="charge-card-renamed",Ho="charge-card-department-updated",Rr="charge-card-repayment-completed",Br="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),Go=[La,Ba],$o=De(function(e){const n=la(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(Es({uiState:{sortKey:n,sortOrder:t}}))}}})(eo);function zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>la(j)),m=Ar(s.companyId,{clearParams:i.fetchState==="Completed"}),B=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Zo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=ea(s);if(jt({events:Ca(D,Go),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx($o,{onBackClick:B,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(Xc,{onBackClick:B})}const Zo=e=>`/${e}/cards`,Wo={containerWidth:new Fa(100,58)},Ko=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[B,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const F=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=f(Ze.zeniCardsConfig),h=C.max_charge_card_activation_attempts_by_card_id,w=o(E=>As(E,s)),u=w.chargeCard,v=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),I=Te(A,F),L=xe({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:I}),l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,p=F.userRole.includes("charge_card_user"),N=we(F),G=ve(F),O=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Re({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!p&&U&&l;r.useEffect(()=>{g===!1&&v!=="In-Progress"&&v!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,v]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(B===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(B&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(Ds({chargeCardId:s}));const E=Ae(F.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,B,w.isRefreshingViewInBackground]);const y=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Mn(E.userState,P.userId)),W=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&B===!1&&(setTimeout(W,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(v!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Qo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(Yo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:xt(),chargeCardDetailState:w,signedInUserToken:y,navigate:a,currentTenant:F,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:C.default_max_charge_card_activation_attempts!=null?C.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(qo,{windowSize:n,children:e}):null]})},Yo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=_s(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Nn(e,s),g=n.updateStatus,_=ua(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ps())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(vs(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(ws({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?aa(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(ao),qo=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Wo.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-B6jAIe9x.js";import{a as g}from"./sentry-95bdnR3R.js";import{h as w,u as x,g as k,i as T,j as O,n as E}from"./core-CLKYLs-8.js";import{z as C,b9 as F,A as P,c as A,e as V,af as N,ba as j,at as L,au as U,r as B}from"./index-
|
|
1
|
+
import{j as m}from"./liveblocks-B6jAIe9x.js";import{a as g}from"./sentry-95bdnR3R.js";import{h as w,u as x,g as k,i as T,j as O,n as E}from"./core-CLKYLs-8.js";import{z as C,b9 as F,A as P,c as A,e as V,af as N,ba as j,at as L,au as U,r as B}from"./index-D_hiFYsE.js";import{eW as h,gh as M,to as R,gc as _,c7 as z,OQ as G,bn as Y,rx as $,rl as H,k$ as K,mA as S,OR as Q,bE as W,cz as b,mK as Z,mN as q}from"./zeni-epic-state-CjQblqOQ.js";import"./mui-AZmtqUsi.js";import{d as J}from"./routePaths-XSngD1ow.js";import{M as X}from"./MobileAppDrawer-BPYh3fz7.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]="50fe66e7-3a02-4f81-aacd-332fb289d76a",n._sentryDebugIdIdentifier="sentry-dbid-50fe66e7-3a02-4f81-aacd-332fb289d76a")}catch{}})();const ee=E(function(n){const t=_(n),i=C.getSignedInUser(),l=h(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(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(q())},onAddressClick:e=>{const a=J(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(Z({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:D}=r,v={companyInfo:{...a,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?W(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};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(Q(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(K({files:e}))},onDeleteFile:e=>{n(H(e))},onEditFileName:(e,a)=>{n($(e,a.split(".")[0]))}}})(j);function de(){const n=w(),t=x(),i=k(),{tenantEmailDomain:l}=T(),[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=>h(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(R())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:N(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-B6jAIe9x.js";import{a}from"./sentry-95bdnR3R.js";import{u as D,g as w,j as m,N as v}from"./core-CLKYLs-8.js";import{Lw as _,eW as A,f$ as L,o4 as O,gq as E,f_ as j,fx as U,LD as $}from"./zeni-epic-state-CjQblqOQ.js";import{u as F,z as c,L as g,D as k,o as H}from"./index-
|
|
1
|
+
import{j as C}from"./liveblocks-B6jAIe9x.js";import{a}from"./sentry-95bdnR3R.js";import{u as D,g as w,j as m,N as v}from"./core-CLKYLs-8.js";import{Lw as _,eW as A,f$ as L,o4 as O,gq as E,f_ as j,fx as U,LD as $}from"./zeni-epic-state-CjQblqOQ.js";import{u as F,z as c,L as g,D as k,o as H}from"./index-D_hiFYsE.js";import{n as z}from"./mui-AZmtqUsi.js";import{t as R}from"./getLocaleForTenant-C_VQis3o.js";import{g as P,Q as q}from"./QBOConnectionScreen-D87ZntTL.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./empty-DdtYEopm.js";import"./pdf-lib-0dW_LSbG.js";import"./index-CtRgwYlG.js";import"./url-Br2V-Pa5.js";import"./index-UrW8im9e.js";import"./decodeURIComponentSafe-Bm32N7cj.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]="a98b9efb-d494-4ccb-8a90-62466d009eb4",t._sentryDebugIdIdentifier="sentry-dbid-a98b9efb-d494-4ccb-8a90-62466d009eb4")}catch{}})();const G=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-B6jAIe9x.js";import{z as n}from"./index-
|
|
1
|
+
import{j as i}from"./liveblocks-B6jAIe9x.js";import{z as n}from"./index-D_hiFYsE.js";import{g as d}from"./QBOConnectionScreen-D87ZntTL.js";import"./sentry-95bdnR3R.js";import{g as p,N as s}from"./core-CLKYLs-8.js";import"./zeni-epic-state-CjQblqOQ.js";import"./recharts-CyaYjFwn.js";import"./mui-AZmtqUsi.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./empty-DdtYEopm.js";import"./pdf-lib-0dW_LSbG.js";import"./index-CtRgwYlG.js";import"./url-Br2V-Pa5.js";import"./index-UrW8im9e.js";import"./decodeURIComponentSafe-Bm32N7cj.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-DwYU0l_J.js → CustomerOnboardingRoutes-Dh6ZowLh.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-B6jAIe9x.js";import{t as Me,A as Ce}from"./AddressScreen-
|
|
1
|
+
import{j as a}from"./liveblocks-B6jAIe9x.js";import{t as Me,A as Ce}from"./AddressScreen-BRdhnUB3.js";import $e from"./NotFoundScreen-ChEBjJeL.js";import{a as g}from"./sentry-95bdnR3R.js";import{h as oe,g as se,u as ie,i as re,j as D,N as x,n as ce,l as ze,o as Qe,p as z}from"./core-CLKYLs-8.js";import{w as de,j as le,z as B,F as ue,m as qe,x as _,r as V,A as Y,c as N,B as je,e as J,ap as Ke,K as Ze,aq as ke,h as te,ar as We,as as Ie,o as Ye,at as He,au as xe,av as Je}from"./index-D_hiFYsE.js";import{bn as Xe,eW as ee,fT as et,fB as pe,fz as me,bt as tt,o2 as at,fP as nt,bS as ot,k3 as ae,k6 as ve,M0 as st,bY as it,c7 as ge,tC as he,tn as rt,Mv as X,tD as _e,JV as ct,l7 as Ue,Mw as Ve,Mx as dt,My as lt,Mz as ut,k1 as pt,k4 as mt,tp as Be,tB as gt,bE as Ee,cz as ht,tP as Te,rx as ft,rl as yt,k$ as St,gf as bt,ge as Ct,gd as kt,MA as It,th as xt,tQ as Et,tT as Tt,tW as Ot,u0 as Pt,cY as At}from"./zeni-epic-state-CjQblqOQ.js";import{n as fe}from"./mui-AZmtqUsi.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-D87ZntTL.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./empty-DdtYEopm.js";import"./pdf-lib-0dW_LSbG.js";import"./index-CtRgwYlG.js";import"./url-Br2V-Pa5.js";import"./index-UrW8im9e.js";import"./decodeURIComponentSafe-Bm32N7cj.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]="d1246502-dcdd-4cd0-809c-a5cf74f9ef24",t._sentryDebugIdIdentifier="sentry-dbid-d1246502-dcdd-4cd0-809c-a5cf74f9ef24")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),jt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),h=Xe(i),{useFeatureGate:m}=ue(),I=qe(),{isFeatureEnabled:E}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:k}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:f}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),M=C||U&&h,c=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const j=pe(F,c),P=me(c),A=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,$=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,Q=c?.userRole!=null&&tt(c?.userRole),v=b?.resources?.find(l=>l.resource==="/bills")==null&&!Q,q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&A.push("top_expenses"),$===!1&&A.push("task_card"),v===!1&&A.push("bill_pay_card","bill_pay_promo_card"),q===!1&&A.push("reimbursement_card","reimbursement_promo_card"),k===!1&&A.push("zeni_accounts_promo_card"),f===!1&&A.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||j||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,A)))},[d,O,j,P,i,c.tenantId,s]),g.useEffect(()=>{(j||P)&&setTimeout(()=>{S(!0)},5e3)},[j,P]),O!=="Completed")return a.jsx(x,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(j)return a.jsx(x,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(x,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(Y,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(J.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:E,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:k,shouldFetchRewardsPlanCard:f,isExpenseAutomationEnabledForUser:M,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(je,{fetchState:"In-Progress",style:{backgroundColor:I.colors.grey5}})},Oe=fe.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
background-color: ${t=>t.theme.colors.grey4};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-B6jAIe9x.js";import{i as K,j as S,g as H,u as z,h as W,n as te,k as ca,o as Ct,p as w}from"./core-CLKYLs-8.js";import{eW as U,MQ as Xe,bE as la,bq as Oe,O2 as Pn,iV as Fn,O3 as Zt,O4 as Rn,iY as kt,O5 as Qe,O6 as Bn,j1 as jn,O7 as Qt,O8 as Mn,j5 as St,O9 as He,Oa as Ln,cp as vt,Ob as Un,Oc as Gn,N8 as Vn,jZ as Yn,Od as Nn,bn as Ge,Oe as da,ME as ie,bc as ua,kb as ma,oc as pa,jW as ha,MG as ce,MF as ee,eV as fa,fp as $n,g1 as _t,Of as zn,Og as Kn,Oh as ga,Oi as Be,vB as Ve,vC as Ye,vZ as xe,vT as le,vG as Ne,Oj as qn,Ok as Zn,Ol as Qn,Om as ba,On as je,Oo as Hn,dJ as Je,s5 as Ca,Op as Wn,Oq as Xn,Or as Jn,Os as At,M2 as It,kr as De,w5 as Et,sd as eo,Ot as to,vD as Ht,s8 as Ee,s4 as ka,Ou as ge,Ov as ao,Ow as Tt,M1 as Ot,u4 as Sa,Ox as no,Oy as oo,Oz as so,OA as xt,uh as ro,OB as io,vF as Wt,u3 as _a,OC as be,OD as co,bt as ya,w9 as va,OE as lo,OF as uo,OG as mo,OH as Dt,w4 as po,OI as ho,vE as Xt,w8 as Aa,OJ as Ce,OK as fo,OL as go,OM as Ia,kg as Ea,o9 as Ta,kl as Oa,o7 as xa,o6 as Da,o5 as wa,ts as bo,fT as Co,cS as ko,cT as So,o2 as _o,fP as yo,oj as vo,Ge as ut,G6 as Ao,Ga as Io,ON as Eo,OO as To,OP as Oo,b5 as et,fH as xo,hD as Do,gh as wo,od as Po,jP as Fo,oa as Ro,o8 as Bo,fB as jo,fz as Mo}from"./zeni-epic-state-CjQblqOQ.js";import{z as M,a2 as ae,r as x,c as O,D as q,aV as Lo,_ as $e,A as ze,aW as Pa,e as N,aX as Uo,j as Se,aY as Fa,F as _e,x as R,m as Go,aZ as Vo,a_ as Yo,W as Ra,K as Ba,a as ja,Z as No,a$ as $o,U as zo,aN as Ma,$ as oe,b0 as La,b1 as Ua,a1 as Ga,b2 as Ko,b3 as qo,aq as Zo,n as Qo,X as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-BeMQfmRp.js";import{n as wt}from"./mui-AZmtqUsi.js";import{a as b}from"./sentry-95bdnR3R.js";import{w as Va}from"./withTransactionSidePanel-D1EjZ31L.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-2zRQFXqm.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-k3dV_2QR.js";import Ue from"./NotFoundScreen-DEN1HuyG.js";import{u as Ft}from"./useInitialThreadRequest-CrlDQYJc.js";import{t as Na}from"./analyticsHelper-BYRUUvaV.js";import{C as as}from"./CompanyPassportScreen-9Rc5mH-z.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-iiV0TqB-.js";import{F as os}from"./FeaturePreviewScreen-429nxvjk.js";import{R as ss}from"./ReferralListScreen-ByjwQ5N-.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./TransactionDetailScreen-9-dxedcB.js";import"./decodeURIComponentSafe-Bm32N7cj.js";import"./MobileAppDrawer-Ck77XJrw.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]="ed8f03a8-f335-421e-8b96-bdb9a245366a",e._sentryDebugIdIdentifier="sentry-dbid-ed8f03a8-f335-421e-8b96-bdb9a245366a")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>U(v)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):Oe(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Ya({id:v.transactionId,type:v.transactionType},m);f(B);const X=x(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:O,onTransactionClick:L,onReload:I,onBackClick:_,onColumnSortConfigChanged:T,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=S(T=>Rn(T)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AP Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(T=>T.tenantState.currentTenantId),i=S(T=>U(T)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),C=t.apAgingUIState.selectedDate??Oe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:T=>T.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:O,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>U(k)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),l=b.useMemo(()=>r!=null?la(r):Oe(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Ya({id:k.transactionId,type:k.transactionType},c);p(v);const B=x(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&O.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>U(_)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),g=t.arAgingUIState.selectedDate??Oe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:O,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=we(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Yn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?O.trackZeniAccountsCashBalancePromoClicked("Move Money"):(O.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else O.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Un(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:O}},za)(Fa),us=te(function(e){const a=Nn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ge(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:O}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
|
|
1
|
+
import{j as d}from"./liveblocks-B6jAIe9x.js";import{i as K,j as S,g as H,u as z,h as W,n as te,k as ca,o as Ct,p as w}from"./core-CLKYLs-8.js";import{eW as U,MQ as Xe,bE as la,bq as Oe,O2 as Pn,iV as Fn,O3 as Zt,O4 as Rn,iY as kt,O5 as Qe,O6 as Bn,j1 as jn,O7 as Qt,O8 as Mn,j5 as St,O9 as He,Oa as Ln,cp as vt,Ob as Un,Oc as Gn,N8 as Vn,jZ as Yn,Od as Nn,bn as Ge,Oe as da,ME as ie,bc as ua,kb as ma,oc as pa,jW as ha,MG as ce,MF as ee,eV as fa,fp as $n,g1 as _t,Of as zn,Og as Kn,Oh as ga,Oi as Be,vB as Ve,vC as Ye,vZ as xe,vT as le,vG as Ne,Oj as qn,Ok as Zn,Ol as Qn,Om as ba,On as je,Oo as Hn,dJ as Je,s5 as Ca,Op as Wn,Oq as Xn,Or as Jn,Os as At,M2 as It,kr as De,w5 as Et,sd as eo,Ot as to,vD as Ht,s8 as Ee,s4 as ka,Ou as ge,Ov as ao,Ow as Tt,M1 as Ot,u4 as Sa,Ox as no,Oy as oo,Oz as so,OA as xt,uh as ro,OB as io,vF as Wt,u3 as _a,OC as be,OD as co,bt as ya,w9 as va,OE as lo,OF as uo,OG as mo,OH as Dt,w4 as po,OI as ho,vE as Xt,w8 as Aa,OJ as Ce,OK as fo,OL as go,OM as Ia,kg as Ea,o9 as Ta,kl as Oa,o7 as xa,o6 as Da,o5 as wa,ts as bo,fT as Co,cS as ko,cT as So,o2 as _o,fP as yo,oj as vo,Ge as ut,G6 as Ao,Ga as Io,ON as Eo,OO as To,OP as Oo,b5 as et,fH as xo,hD as Do,gh as wo,od as Po,jP as Fo,oa as Ro,o8 as Bo,fB as jo,fz as Mo}from"./zeni-epic-state-CjQblqOQ.js";import{z as M,a2 as ae,r as x,c as O,D as q,aV as Lo,_ as $e,A as ze,aW as Pa,e as N,aX as Uo,j as Se,aY as Fa,F as _e,x as R,m as Go,aZ as Vo,a_ as Yo,W as Ra,K as Ba,a as ja,Z as No,a$ as $o,U as zo,aN as Ma,$ as oe,b0 as La,b1 as Ua,a1 as Ga,b2 as Ko,b3 as qo,aq as Zo,n as Qo,X as Ho,b4 as Wo,b5 as Xo,b6 as Jo,b7 as es,b8 as ke}from"./index-D_hiFYsE.js";import{n as wt}from"./mui-AZmtqUsi.js";import{a as b}from"./sentry-95bdnR3R.js";import{w as Va}from"./withTransactionSidePanel-kr0tYyxP.js";import{c as Ya,t as we,f as de,a as Pt,v as ts}from"./routePaths-XSngD1ow.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-FETbJUjN.js";import Ue from"./NotFoundScreen-ChEBjJeL.js";import{u as Ft}from"./useInitialThreadRequest-D1F5GLCG.js";import{t as Na}from"./analyticsHelper-BsjRdUZX.js";import{C as as}from"./CompanyPassportScreen-DUlm9sdh.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CmgL0oiB.js";import{F as os}from"./FeaturePreviewScreen-CNGfajWs.js";import{R as ss}from"./ReferralListScreen-BsBo666O.js";import"./recharts-CyaYjFwn.js";import"./analytics-BHHyMpuV.js";import"./plaid-2Q72y6JT.js";import"./dnd-BgEYAbRi.js";import"./stripe-DMRn4zHo.js";import"./lottie-C38Bn-X6.js";import"./lexical-DN4b_Twn.js";import"./pdf-BzNDzZ8_.js";import"./utils-CDpOkGne.js";import"./TransactionDetailScreen-bJ4okRq5.js";import"./decodeURIComponentSafe-Bm32N7cj.js";import"./MobileAppDrawer-BPYh3fz7.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]="ed8f03a8-f335-421e-8b96-bdb9a245366a",e._sentryDebugIdIdentifier="sentry-dbid-ed8f03a8-f335-421e-8b96-bdb9a245366a")}catch{}})();const rs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(v=>v.tenantState.currentTenantId),c=S(v=>U(v)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?la(r):Oe(),[r]),p=z(),f=W(),A=S(v=>Pn(v,h,o)),I=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Fn(o,h))},[h]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),T=b.useCallback((v,B)=>{p(Zt({sortKey:v,sortOrder:B}))},[]),E=b.useCallback(v=>{p(Zt({downloadState:v}))},[]),L=b.useCallback(v=>{if(e)e(v.transactionId,v.transactionType);else if(m!=null){const B=Ya({id:v.transactionId,type:v.transactionType},m);f(B);const X=x(g.state?.pathnameStackToGoBack,g.pathname);f(B,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&O.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{I()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Lo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:O,onTransactionClick:L,onReload:I,onBackClick:_,onColumnSortConfigChanged:T,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=S(T=>Rn(T)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AP Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(T=>T.tenantState.currentTenantId),i=S(T=>U(T)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),C=t.apAgingUIState.selectedDate??Oe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(T=>{e(Qe({searchString:T}))},[]),p=b.useCallback((T,E)=>{e(Qe({sortKey:E,sortOrder:T}))},[]),f=b.useCallback(T=>{a(`./${T}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(T=>{e(Qe({downloadState:T}))},[]),I=b.useCallback((T,E)=>{},[]),_=b.useCallback((T,E)=>{e(Qe({selectedDate:T,agingDateSelectionType:E})),e(kt(T))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:T=>T.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Pa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:O,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:_,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Va(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=S(k=>U(k)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),l=b.useMemo(()=>r!=null?la(r):Oe(),[r]),h=z(),p=W(),f=S(k=>Bn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))},[l]),I=b.useCallback(()=>{p("../../",{relative:"path"})},[]),_=b.useCallback((k,v)=>{h(Qt({sortKey:k,sortOrder:v}))},[]),T=b.useCallback(k=>{h(Qt({downloadState:k}))},[]),E=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const v=Ya({id:k.transactionId,type:k.transactionType},c);p(v);const B=x(m.state?.pathnameStackToGoBack,m.pathname);p(v,{state:{pathnameStackToGoBack:B}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&O.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:O,onTransactionClick:E,onReload:A,onBackClick:I,onColumnSortConfigChanged:_,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=S(_=>Mn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=S(_=>U(_)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),g=t.arAgingUIState.selectedDate??Oe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(St(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(_=>{e(He({searchString:_}))},[]),h=b.useCallback((_,T)=>{e(He({sortKey:T,sortOrder:_}))},[]),p=b.useCallback(_=>{a(`./${_}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(_=>{e(He({downloadState:_}))},[]),A=b.useCallback((_,T)=>{e(He({selectedDate:_,agingDateSelectionType:T})),e(St(_))},[]),I=b.useCallback((_,T)=>{e(Ln({nodeId:_,isCollapsed:T}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:O,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Pa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:O,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},$a=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function za(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=we(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Yn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?O.trackZeniAccountsCashBalancePromoClicked("Move Money"):(O.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else O.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=te(function(e){const a=Un(e).accountsInOrder.map((n,o)=>$a(n,o)),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:O}},za)(Fa),us=te(function(e){const a=Nn(e).accountsInOrder.map((o,r)=>$a(o,r)),t=M.getSignedInUser(),n=Ge(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:O}},za)(Fa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=Se(),o=vt(n?.loggedInUserRoleMap),r=S(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=wt.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|