@zeniai/web-app-ui 5.3.48-next → 5.3.48-qa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-1SU95X1g.js → AccountMappingScreen-amEuzz3m.js} +1 -1
- package/dist/assets/AddressRoutes-BvCvEc0i.js +1 -0
- package/dist/assets/{AddressScreen-Cdr2j35I.js → AddressScreen-SjU2U0ZR.js} +1 -1
- package/dist/assets/{AiCfoScreen-C1eHEeeP.js → AiCfoScreen-DRk81N96.js} +1 -1
- package/dist/assets/{AppDrawer-BfXOcVEt.js → AppDrawer-CbgUVaEs.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-C7TITJQ6.js → BillPayApprovalRoutes-CRw5sS5w.js} +1 -1
- package/dist/assets/{BillPayRoutes-CHaqaYck.js → BillPayRoutes-gLnnTINY.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-BVwrIVJv.js → BusinessVerificationPageScreen-OrLH3WzL.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-DsJn0glf.js → CardsAiCfoScreen-CK5nzziY.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-RNz9qxOv.js → ChargeCardRoutes-VxC6xP7p.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-DmzRkUq5.js → CompanyPassportScreen-CMquye6T.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-C3vG4r21.js → ConnectionAuthScreen-D-MaPmF7.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-Cd284ksv.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-BmY616w2.js → CustomerOnboardingRoutes-BEKgaiHU.js} +1 -1
- package/dist/assets/{DashboardRoutes-2DTr4aUf.js → DashboardRoutes-DOtnRGit.js} +1 -1
- package/dist/assets/{DefaultTenantHome-C8wEik5q.js → DefaultTenantHome-BgVy6pXM.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-BeAYwvC9.js → DomesticWireDetailScreen-ojJdskB-.js} +1 -1
- package/dist/assets/{DrawerScreen-DXPlivfx.js → DrawerScreen-DaPp3vfO.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-CrqgSMlQ.js → EntityDetailRoutes-CeZQKYjJ.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-DLgzaZBu.js → ExpenseAutomationRoutes-D8dyN9JX.js} +1 -1
- package/dist/assets/{FeaturePreviewScreen-B11vFkOV.js → FeaturePreviewScreen-bhcVTnED.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-BQ4MRYuh.js → HubSpotOAuthCallbackScreen-BycOX9mL.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-BY8P-Ihr.js → InboxNotificationsProvider-ICcfArFM.js} +1 -1
- package/dist/assets/{InvoicingRoutes-CNNRUv3E.js → InvoicingRoutes-BkdZK7i6.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-DINiJQI8.js → MagicLinkRoutes-BIEFcYv2.js} +1 -1
- package/dist/assets/{MagicLinkSignInScreen-CVGSZaKv.js → MagicLinkSignInScreen-ufbtyKlL.js} +1 -1
- package/dist/assets/{MobileAppDrawer-D8KSGZ8t.js → MobileAppDrawer-DjEeoE6u.js} +1 -1
- package/dist/assets/NotFoundScreen-BDRAfL_x.js +1 -0
- package/dist/assets/{NotificationRoutes-M_Lup9qB.js → NotificationRoutes-DJF3aH5n.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BuReFHDV.js → OAuthConsentScreen-Bl7eWr3R.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-BAkRFF5q.js → PandLWithForecastRoutes-CUZT8XbC.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-BIPFJD1g.js → PaymentLinkScreen-D5UCUG0s.js} +1 -1
- package/dist/assets/{PeopleRoutes-DADu3Zhb.js → PeopleRoutes-DopLFED_.js} +1 -1
- package/dist/assets/{PerformanceRoutes-CX8yTPzt.js → PerformanceRoutes-CoR3XZpX.js} +1 -1
- package/dist/assets/{Preview-Cafq3h7X.js → Preview-DFfstF1G.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DXBj5LWG.js → QBOConnectionScreen-0bGr42Ku.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-CPaJiiXV.js → ReimbursementApprovalRoutes-4Gmx-MuW.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-zx_YxbPw.js → ReimbursementApprovalRuleDetailScreen-DiBNgDsy.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-B1ZeqUVg.js → ReimbursementRoutes-DjQJfMVY.js} +1 -1
- package/dist/assets/{ReportsRoutes-zdmkyXCJ.js → ReportsRoutes-BtqrHuz-.js} +1 -1
- package/dist/assets/{RewardsRoutes-Blcm9sjt.js → RewardsRoutes-Dq5pKyO9.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CDQYjn75.js → ScheduleDetailsPrepaidExpensesScreen-DtayUdWa.js} +1 -1
- package/dist/assets/{ScreenRoutes-BnBOn0fY.js → ScreenRoutes-BAM6ERJQ.js} +2 -2
- package/dist/assets/{SettingsRoutes-C-hSgwDw.js → SettingsRoutes-C1_iqx7p.js} +1 -1
- package/dist/assets/{SetupPagesScreen-CEG9qkFk.js → SetupPagesScreen-K06f0ggy.js} +1 -1
- package/dist/assets/{SignInScreen-Dh3vWk5H.js → SignInScreen-BvLUs9_l.js} +1 -1
- package/dist/assets/{SignOutScreen-DiaROWN6.js → SignOutScreen-qMNwfRFa.js} +1 -1
- package/dist/assets/{TaskListScreen-Qo2CFMii.js → TaskListScreen-BorAtbzN.js} +1 -1
- package/dist/assets/{TaskRoutes-CJ89fi5N.js → TaskRoutes-DJI1lloU.js} +1 -1
- package/dist/assets/TransactionDetailRoutes-DCWaZrOs.js +1 -0
- package/dist/assets/{TransactionDetailScreen-CLcV-jRc.js → TransactionDetailScreen-B2Yk34kC.js} +1 -1
- package/dist/assets/{TransactionListRoutes-BPNmT8kF.js → TransactionListRoutes-eMDqkeHP.js} +1 -1
- package/dist/assets/{TreasuryRoutes-DvD-DWnN.js → TreasuryRoutes-sgwJOYI2.js} +1 -1
- package/dist/assets/{VendorsRoutes-DbSolQnQ.js → VendorsRoutes-CPto0F4-.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-i6t2NQeo.js → WiseConfirmationScreen-DS88ccTN.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-BAzrGiFl.js → ZeniAccountRoutes-DbQRgRMK.js} +1 -1
- package/dist/assets/{ZeniAccountStatementScreen-CILP6MbP.js → ZeniAccountStatementScreen-B7vN9Y4_.js} +1 -1
- package/dist/assets/{accountMappingHelper-DCRT8uBQ.js → accountMappingHelper-Dc3TCyrX.js} +1 -1
- package/dist/assets/{analytics-DCG-BJ2B.js → analytics-DP3hAmgL.js} +1 -1
- package/dist/assets/{analyticsHelper-DFvWpT7U.js → analyticsHelper-Bfs4R3aB.js} +1 -1
- package/dist/assets/{core-BomyDm3r.js → core-C_3BcvPm.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BrV-0DZb.js → decodeURIComponentSafe-CMkyCq70.js} +1 -1
- package/dist/assets/{dnd-I9CGHlPV.js → dnd-BXrho-40.js} +1 -1
- package/dist/assets/{empty-CgcXQukc.js → empty-5gw21cFQ.js} +1 -1
- package/dist/assets/{empty-DZpTY4GY.js → empty-BqX05B9x.js} +1 -1
- package/dist/assets/{emptyVideoElement-CXDZcpYA.js → emptyVideoElement-Cko-_QcE.js} +1 -1
- package/dist/assets/{epic-CaRC9CI2.js → epic-DMvtePZM.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-Bla5A-j_.js → expenseAutomationHelper-dMv6Xo4s.js} +1 -1
- package/dist/assets/{getLocaleForTenant-CdcSWjO0.js → getLocaleForTenant-CK0bI6xd.js} +1 -1
- package/dist/assets/{index-Bo4EoZt1.js → index-B7fi9F1i.js} +1 -1
- package/dist/assets/{index-IJef17q5.js → index-BG-FYGvC.js} +1 -1
- package/dist/assets/{index-D0WIHul0.js → index-DIN19WtR.js} +1 -1
- package/dist/assets/{index-B9ZeVIAQ.js → index-DfdR1P4V.js} +8 -8
- package/dist/assets/{index-DXY4DpFj.js → index-SmhLh3Eo.js} +1 -1
- package/dist/assets/{index-ByxVb88B.js → index-knjfFBPr.js} +1 -1
- package/dist/assets/{index-Dtcx6iOp.js → index-m_4D8W9h.js} +2 -2
- package/dist/assets/{index-7l3psPwp.js → index-qXuXknhd.js} +1 -1
- package/dist/assets/{lexical-CYgmazu1.js → lexical-DY18TAnZ.js} +1 -1
- package/dist/assets/{liveblocks-D9xsLz4C.js → liveblocks-BHA40K9j.js} +1 -1
- package/dist/assets/{lottie-DZ7H5U6k.js → lottie-DHD1nzoa.js} +1 -1
- package/dist/assets/{mui-CsJ_uybP.js → mui-DsxbZgLG.js} +1 -1
- package/dist/assets/{pathToGoBack-Bk1syfU7.js → pathToGoBack-D0yBSaLk.js} +1 -1
- package/dist/assets/{pdf-BcamkVED.js → pdf-BmQFuRIG.js} +3 -3
- package/dist/assets/{pdf-lib-H_eegAHa.js → pdf-lib-BgeYbcJF.js} +1 -1
- package/dist/assets/{plaid-Bs9WL7ZA.js → plaid-ewZxuvzf.js} +1 -1
- package/dist/assets/{pusher-BiXDawCL.js → pusher-DAk6660-.js} +1 -1
- package/dist/assets/{react-CnZloJMh.js → react-B55QK8Y2.js} +1 -1
- package/dist/assets/{react-Dn9xz1wp.js → react-BDRsWZYP.js} +1 -1
- package/dist/assets/{react-BszTkffz.js → react-BGUqUuxn.js} +1 -1
- package/dist/assets/{react-Di6q_3ld.js → react-C1aI4U0L.js} +1 -1
- package/dist/assets/{react-D0IREB0P.js → react-CPspBxzV.js} +1 -1
- package/dist/assets/{react-Cp_3CHK0.js → react-DSfrP2G8.js} +1 -1
- package/dist/assets/{recharts-CkiZYv6b.js → recharts-CmYjG1zt.js} +1 -1
- package/dist/assets/{routePaths-B7kYeIqd.js → routePaths-Cca1tWJp.js} +1 -1
- package/dist/assets/{sentry-BMvyJSqc.js → sentry-CFLt6SLf.js} +1 -1
- package/dist/assets/{url-BfDVlhyh.js → url-D-ZtJ2kF.js} +1 -1
- package/dist/assets/{url-CmcLvJyo.js → url-DKuONDiE.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BSgtWLpu.js → useAiCfoDashboardSuggestedQuestionsChips-BujA6eyw.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-DkXoRZ45.js → useAskAiCfoHostNavButtonProps-CnAY_u1k.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-B9vV64BE.js → useChargeCardPusherEvents-7mxw_gTB.js} +1 -1
- package/dist/assets/{useDeviceId-CpSKwPZ4.js → useDeviceId-CZr7CPDW.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-CAYfUMY-.js → useEmailConnectResultRefresh-DL08zR5x.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-Pe6lvpTh.js → useInitialThreadRequest-C8Pdei5-.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-fnX1J0jB.js → useTaskManagerAccess-DJ8lZv1E.js} +1 -1
- package/dist/assets/{utils-CZJ3iF9S.js → utils-D1gULS4n.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-mCp4nNUj.js → withTransactionSidePanel-D2Vk8NEW.js} +1 -1
- package/dist/assets/{zeni-epic-state-C6RT9e71.js → zeni-epic-state-BK-HD5IA.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AddressRoutes-BzeJ2Hf7.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-Br9ARp7V.js +0 -1
- package/dist/assets/NotFoundScreen-DbwVF9lB.js +0 -1
- package/dist/assets/TransactionDetailRoutes-CdcbF-DT.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as U}from"./liveblocks-
|
|
1
|
+
import{j as U}from"./liveblocks-BHA40K9j.js";import{a as o}from"./sentry-CFLt6SLf.js";import{h as Y,g as Z,u as H,j as m,s as $,l as K}from"./core-C_3BcvPm.js";import{ai as W,M as ee,y as q,z as te,n as G,aj as ne,h as ae,S as ce}from"./index-DfdR1P4V.js";import{bn as se,fE as oe,gU as ie,oA as Q,TX as re,i7 as J,gg as le,or as ue,TY as de,TZ as pe,tA as ge,l_ as me,op as be,ol as Ae,ow as ye,i9 as Ie,T_ as fe,T$ as Se}from"./zeni-epic-state-BK-HD5IA.js";import{n as he}from"./mui-DsxbZgLG.js";import{M as Ee}from"./MobileAppDrawer-DjEeoE6u.js";import{q as R}from"./QBOConnectionScreen-0bGr42Ku.js";import{g as h,a as E,m as ze}from"./accountMappingHelper-Dc3TCyrX.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="b9b3ab58-3665-4b5c-b349-7f8485b1741a",a._sentryDebugIdIdentifier="sentry-dbid-b9b3ab58-3665-4b5c-b349-7f8485b1741a")}catch{}})();const l="zeni_pending_projects_enable",u={pending:"pending",ready:"ready"},we=he.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-BHA40K9j.js";import{A as o}from"./AddressScreen-SjU2U0ZR.js";import i from"./NotFoundScreen-BDRAfL_x.js";import"./sentry-CFLt6SLf.js";import{n as s,o as r}from"./core-C_3BcvPm.js";import"./zeni-epic-state-BK-HD5IA.js";import"./recharts-CmYjG1zt.js";import"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="31d0e0e8-dcf1-419d-b2be-6dc359df28c9",t._sentryDebugIdIdentifier="sentry-dbid-31d0e0e8-dcf1-419d-b2be-6dc359df28c9")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(o,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(o,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./liveblocks-
|
|
1
|
+
import{j as n}from"./liveblocks-BHA40K9j.js";import{a as b}from"./sentry-CFLt6SLf.js";import{h as T,u as P,g as E,i as j,j as B,l as D}from"./core-C_3BcvPm.js";import{a1 as M,E as U,z as $,V as L,a7 as K,a8 as z,h as C,S,a3 as F,Y as h,a4 as G}from"./index-DfdR1P4V.js";import{UC as _,io as R,fE as V,UD as N,c8 as O,UE as q,mG as H}from"./zeni-epic-state-BK-HD5IA.js";import{n as Y}from"./mui-DsxbZgLG.js";import J from"./NotFoundScreen-BDRAfL_x.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="607a4d98-0bcb-4c82-ad1b-2d5264cac02d",e._sentryDebugIdIdentifier="sentry-dbid-607a4d98-0bcb-4c82-ad1b-2d5264cac02d")}catch{}})();const Q=Y.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as S}from"./liveblocks-D9xsLz4C.js";import{a}from"./sentry-BMvyJSqc.js";import{u as Tt,h as Rt,i as jt,g as Ot,j as b,l as At}from"./core-BomyDm3r.js";import{a as Qt,g as Dt,e5 as Lt,z as Ut,a1 as _t,e6 as Ft,e7 as Bt,e8 as Mt,bo as Ae,e9 as Ne,ea as $t,bn as qe,a4 as me,a8 as re,h as F,eb as le,ec as Vt,ed as Nt,au as qt,S as Gt,w as Ht,ee as zt,ef as Wt,av as Jt,eg as Yt,eh as Kt,ei as Xt,ej as Zt,p as es,bk as Qe,ek as ts}from"./index-B9ZeVIAQ.js";import{fD as _,gs as y,Tl as ss,a1o as as,a1p as ns,jL as os,a1q as is,jI as rs,a1r as ue,jC as de,jS as z,jk as Se,jA as De,jy as ls,jP as us,jt as Ge,Tu as Le,gu as B,gJ as ds,Tt as cs,Te as Ue,fE as ms,j2 as Ss,a1s as hs,g7 as ps,jg as fs,jc as gs,fF as ce,ge as Cs,a1t as Is,a1u as ks,a1v as bs,gt as vs,gn as _e,k3 as Fe,gp as Be,gv as Es,a1w as Me,jU as Ps,j9 as ws,jn as ys,jQ as $e,jq as xs,gw as Ts,gx as Rs,gy as js,gz as Os}from"./zeni-epic-state-C6RT9e71.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-CsJ_uybP.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-BSgtWLpu.js";import{p as Us}from"./pathToGoBack-Bk1syfU7.js";import{j as _s}from"./routePaths-B7kYeIqd.js";import"./recharts-CkiZYv6b.js";import"./analytics-DCG-BJ2B.js";import"./plaid-Bs9WL7ZA.js";import"./dnd-I9CGHlPV.js";import"./stripe-cKAAJElX.js";import"./lottie-DZ7H5U6k.js";import"./lexical-CYgmazu1.js";import"./pdf-BcamkVED.js";import"./utils-CZJ3iF9S.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="c987ed89-121e-4a25-95c9-2b6f489734bf",s._sentryDebugIdIdentifier="sentry-dbid-c987ed89-121e-4a25-95c9-2b6f489734bf")}catch{}})();const He="chat-response-generated";function Fs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Bs=At((function(s,r){const t=_(s),l=r.isSubmitting,d=t.uiState?.currentChatSessionId,i=d!=null?Cs(s.aiCfoState,d):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),R=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:y(s).skills,skillSaveState:Fs(s,R),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:R.fetchState==="In-Progress",skillSaveError:R.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Yt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:d,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:R,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Ts(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=qe(p,v);E!=="answer"?F.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Rs(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,d,E,c,void 0,v)},onFetchSkills:()=>{s(Ge())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s($e({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s($e({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(B()),s(_e()),Qe(s,o,"user_input",void 0,p,d,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Be(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Be(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(B()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:R,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Tt(),l=Rt(),{session_id:d}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),R=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ye=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?de({scheduleId:j}):ue())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??d,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(de({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(de({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(us({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),Y=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(Ge()),t(Le())}),[t]),ot=a.useCallback((()=>{t(B())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:ut}=Lt();a.useEffect((()=>{t(ds())}),[t]);const g=b((e=>_(e))),T=Ut.getSignedInUser();a.useEffect((()=>d==="routines"?(t(B()),void t(cs())):d==="skills"?(t(ue()),t(Ue()),void t(Le())):(U==null&&t(ue()),t(Ue()),void t(B()))),[t,U,f,d]);const dt=_t(),O=qt(dt),k=b((e=>ms(e))),u=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Ft(I),skillName:I.isAdHoc===!0?void 0:Y.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,Y]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Bt({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),$=i.state,V=$?.aiCfoInitialQuestion,ke=!!$?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&V!=null&&V!==""){const e=i.state;se(V),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[V,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??$?.aiCfoRef,ie=ve.get("emailRefId")??$?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||u!=null||T==null||(t(Ss("controller",T.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,u,t,T]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&u!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,u,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=$t(u),q=g.fetchState,G=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",xe=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Te=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=qe(Te,u),Et=vt.length===0;a.useEffect((()=>{w||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Re=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=d!==Re.current,h=u!==je.current;Re.current=d,je.current=u,d!==u&&(!e||d==null||_s(d)?h&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(ps({sessionId:d,agentId:"controller"})))}),[u,d]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[we]);a.useEffect((()=>{q!=="In-Progress"&&G&&t(fs())}),[q,G,t]),a.useEffect((()=>{u!=null&&ye!=="In-Progress"&&xe&&T!=null&&(d===u||q==="Completed"&&!G)&&t(gs(u,T.userId))}),[ye,q,xe,G,u,T,d,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(T==null||d==null)throw Error("Can't access AI Controller page without signing in...");const yt=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!w&&O)return S.jsxs($s,{children:[S.jsx(re,{analytics:F,onLoad:Oe}),te.drawerElement,S.jsx(Vs,{children:S.jsx(Ve,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:F,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:F,onLoad:e=>e.trackPageLoaded(Gt.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx(Bs,{...wt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Te,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:T.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:d,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:ut,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:R,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:Y,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ye,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx(Ve,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx(Vt,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},Ve=M(Qs)`
|
|
1
|
+
import{j as S}from"./liveblocks-BHA40K9j.js";import{a}from"./sentry-CFLt6SLf.js";import{u as Tt,h as Rt,i as jt,g as Ot,j as b,l as At}from"./core-C_3BcvPm.js";import{a as Qt,g as Dt,e5 as Lt,z as Ut,a1 as _t,e6 as Ft,e7 as Bt,e8 as Mt,bo as Ae,e9 as Ne,ea as $t,bn as qe,a4 as me,a8 as re,h as F,eb as le,ec as Vt,ed as Nt,au as qt,S as Gt,w as Ht,ee as zt,ef as Wt,av as Jt,eg as Yt,eh as Kt,ei as Xt,ej as Zt,p as es,bk as Qe,ek as ts}from"./index-DfdR1P4V.js";import{fD as _,gs as y,Tl as ss,a1o as as,a1p as ns,jL as os,a1q as is,jI as rs,a1r as ue,jC as de,jS as z,jk as Se,jA as De,jy as ls,jP as us,jt as Ge,Tu as Le,gu as B,gJ as ds,Tt as cs,Te as Ue,fE as ms,j2 as Ss,a1s as hs,g7 as ps,jg as fs,jc as gs,fF as ce,ge as Cs,a1t as Is,a1u as ks,a1v as bs,gt as vs,gn as _e,k3 as Fe,gp as Be,gv as Es,a1w as Me,jU as Ps,j9 as ws,jn as ys,jQ as $e,jq as xs,gw as Ts,gx as Rs,gy as js,gz as Os}from"./zeni-epic-state-BK-HD5IA.js";import{D as As,n as M,S as Qs,P as Ds}from"./mui-DsxbZgLG.js";import{u as Ls}from"./useAiCfoDashboardSuggestedQuestionsChips-BujA6eyw.js";import{p as Us}from"./pathToGoBack-D0yBSaLk.js";import{j as _s}from"./routePaths-Cca1tWJp.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new s.Error().stack;r&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[r]="c987ed89-121e-4a25-95c9-2b6f489734bf",s._sentryDebugIdIdentifier="sentry-dbid-c987ed89-121e-4a25-95c9-2b6f489734bf")}catch{}})();const He="chat-response-generated";function Fs(s,r){if(r.kind!=="save")return;if(r.fetchState==="In-Progress")return{status:"saving"};if(r.fetchState==="Error")return{status:"failed"};if(r.fetchState!=="Completed")return;const t=y(s).skills.find((l=>l.macroId===r.savedMacroId));return t==null?void 0:{status:"saved",command:t.name}}const Bs=At((function(s,r){const t=_(s),l=r.isSubmitting,d=t.uiState?.currentChatSessionId,i=d!=null?Cs(s.aiCfoState,d):[],f=Wt(s,{allUsers:r.allUsers,onCardPolicyVendorSearchTextChange:r.onCardPolicyVendorSearchTextChange}),p=Is(s),m=ks(s),R=bs(s);return{showSampleQuestions:r.sessionFromUrl==="explore"&&t.uiState.currentChatSessionId==null,aiCfoView:t,isSubmitting:l,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${Jt}/tableDownload`,exportDownloadEndPoint:Xt(),emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,skills:y(s).skills,skillSaveState:Fs(s,R),skillsEnabled:y(s).skillsEnabled,skillsList:y(s).skills,skillsListError:y(s).fetchState==="Error",skillsListLoading:y(s).fetchState==="In-Progress",skillsCanPublish:y(s).canPublish,skillSaving:R.fetchState==="In-Progress",skillSaveError:R.fetchState==="Error",skillVersionHistory:p.macroId!=null?{macroId:p.macroId,versions:p.versions,error:p.fetchState==="Error",loading:p.fetchState==="In-Progress"}:void 0,skillRestoreBody:m.macroId!=null&&m.version!=null?{macroId:m.macroId,version:m.version,instructions:m.instructions,error:m.fetchState==="Error",loading:m.fetchState==="In-Progress"}:void 0,skillDetail:z(s).detail,skillDetailError:z(s).fetchState==="Error",skillDetailLoading:z(s).fetchState==="In-Progress",syntheticAnswers:i,resolveSyntheticAnswerCardTile:Kt(s),resolveSyntheticAnswerPolicyTile:Yt(s),...f}}),(function(s,r){const{location:t,currentTenant:l,userId:d,navigate:i,currentChatSessionId:f,allSessionsWithOrderedQuestionAnswers:p,isAiCardCreationEnabled:m,isCardPolicyEnabled:R,setIsAiCfoOpen:A}=r,Q=l.tenantEmailDomain;return{onEventReceived:(n,o)=>{if(n===He&&typeof o.text=="string"&&typeof o.metadata=="object"){const c=o,E=Ts(c.type),v=c.metadata.chat_session_id??null,{currentChatSession:W,currentQuestionAnswer:x,currentQuestionAnswerSummary:J}=qe(p,v);E!=="answer"?F.trackAICFOChatResponseGenerated(E,x?.question.questionText??"",c.text,v,ts(J,W),c.metadata.message_id??null):F.trackAICFOChatAnswerGenerated(c.text,x?.question.questionText??"",(c.follow_up_questions?.length??0)>0,!!c.assumptions,!!c.insights,c.visualization!=null,Rs(c.visualization?.type??"")??null,v,c.summarized_title,c.metadata.message_id??null),s(js({chatSessionId:c.metadata.chat_session_id,responseType:E,fetchState:{fetchState:"Completed",error:void 0}})),s(Os({chatSessionId:c.metadata.chat_session_id,answerPayload:c,userId:d}))}},onSubmit:(n,o,c,E,v)=>{n&&Qe(s,n,o,f,p,d,E,c,void 0,v)},onFetchSkills:()=>{s(Ge())},onOpenSkill:n=>{s(Se({macroId:n})),s(xs({macroId:n}))},onSaveSkill:(n,o)=>{s($e({draft:n,macroId:o}))},onSaveSkillDraft:n=>{const o=n.displayName?.trim()??"",c=n.name?.trim()??"";s($e({draft:{name:o.length>0?o:c,description:n.description?.trim()??null,instructions:n.instructions,visibility:"private"}}))},onFetchSkillVersionBody:(n,o)=>{s(ys({macroId:n,version:o}))},onDeleteSkill:n=>{s(ws({macroId:n}))},onSetSkillVisibility:(n,o)=>{s(Ps({macroId:n,visibility:o}))},onCloseSkillDetail:()=>{s(Me())},onRunSkill:(n,o)=>{s(B()),s(_e()),Qe(s,o,"user_input",void 0,p,d,void 0,void 0,void 0,n),s(Me())},updateCurrentInput:n=>{s(Be(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{s(Es(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{i(-1)},onCloseClick:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??Us(1);i(o,{state:{...t.state,pathnameStackToGoBack:n.newStack}}),s(Be(""))},togglePageView:()=>{const n=me(t.state?.pathnameStackToGoBack),o=n.poppedPathname??`/${l.tenantEmailDomain}/dashboard`;i(o,{state:{...Ne(t.state),pathnameStackToGoBack:n.newStack,message:"open_ai_cfo_drawer"}}),A(!0)},onCopy:()=>{},onThumbsUp:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"positive",o.questionText,o.answerText))},onThumbsDown:(n,o)=>{f!=null&&o?.messageId!=null&&s(Fe(f,o.messageId,"negative",o.questionText,o.answerText))},onTogglePageView:()=>{i(-1)},onNewChatClick:()=>{s(B()),f!=null&&s(_e());const n=es(t.state?.pathnameStackToGoBack,t.pathname);i(`/${l.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:n.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(n,o)=>{s(vs({questionAnswerId:n,isCollapsed:o}))},onMenuClick:r.onMenuClick,...Zt(s,{isAiCardCreationEnabled:m,isCardPolicyEnabled:R,currentChatSessionId:f,onAfterCardsCreationSubmit:()=>{A(!0),i(`/${Q}/cards`,{state:{...t.state}})},onAfterCardPolicySubmit:()=>{A(!0),i(`/${Q}/cards/policy`,{state:{...t.state}})}})}}))(Ht(zt)),la=({isFileUploadEnabled:s})=>{const{setIsAiCfoOpen:r}=Qt(),t=Tt(),l=Rt(),{session_id:d}=jt(),i=Ot(),f=new URLSearchParams(i.search).get("routine")??void 0,[p,m]=a.useState(!1),R=b((e=>_(e).uiState.isSkillsBrowserOpen===!0)),A=b((e=>y(e).skillsEnabled)),Q=b((e=>_(e).uiState.isRoutinesBrowserOpen===!0)),n=b((e=>ss(e))),o=b((e=>as(e))),c=b((e=>ns(e))),[E,v]=a.useState(void 0),[W,x]=a.useState(!1),[J,he]=a.useState(void 0),ze=a.useCallback((()=>{he(void 0),v(void 0),x(!0)}),[]),We=a.useCallback((e=>{v(e),x(!0)}),[]),Je=a.useCallback((()=>{v(void 0),x(!1)}),[]),Ye=a.useCallback((e=>{t(os({draft:e,...E!=null&&{scheduleId:E.scheduleId}})),v(void 0),x(!1)}),[t,E]),j=f,pe=n.routines.find((e=>e.scheduleId===j)),C=b((e=>is(e))),Ke=a.useCallback((e=>{t(rs({scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{t(j!=null?de({scheduleId:j}):ue())}),[t,j]);const L=pe?.macroId,Xe=b((e=>z(e))),fe=L!=null&&L!==""&&Xe.fetchState==="Not-Started";a.useEffect((()=>{fe&&L!=null&&t(Se({macroId:L}))}),[t,fe,L]);const Ze=b((e=>_(e).uiState.currentChatSessionId))??d,I=n.routines.find((e=>e.scheduleId===f))??n.routines.find((e=>e.scheduleId===Dt(Ze))),U=I?.scheduleId??null,[ge,et]=a.useState(!0);a.useEffect((()=>{U!=null&&t(de({scheduleId:U}))}),[t,U]);const Ce=C.runs.some((e=>e.status==="claimed"||e.status==="running"))===!0;a.useEffect((()=>{if(j==null||Ce!==!0)return;const e=window.setInterval((()=>{t(de({scheduleId:j})),t(De())}),5e3);return()=>window.clearInterval(e)}),[t,Ce,j]);const tt=a.useCallback((e=>{he(e),v(void 0),x(!0)}),[]),st=a.useCallback((e=>{t(ls({scheduleId:e.scheduleId}))}),[t]),at=a.useCallback(((e,h)=>{t(us({enabled:h,scheduleId:e.scheduleId}))}),[t]);a.useEffect((()=>{Q&&t(De())}),[t,Q]);const Ie=b((e=>y(e).skills)),Y=a.useMemo((()=>Ie.map((e=>({macroId:e.macroId,name:e.displayName??e.name})))),[Ie]),nt=a.useCallback((e=>{t(Se({macroId:e}))}),[t]),K=a.useCallback((()=>{t(Ge()),t(Le())}),[t]),ot=a.useCallback((()=>{t(B())}),[t]),{allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,onCardPolicyVendorSearchTextChange:ut}=Lt();a.useEffect((()=>{t(ds())}),[t]);const g=b((e=>_(e))),T=Ut.getSignedInUser();a.useEffect((()=>d==="routines"?(t(B()),void t(cs())):d==="skills"?(t(ue()),t(Ue()),void t(Le())):(U==null&&t(ue()),t(Ue()),void t(B()))),[t,U,f,d]);const dt=_t(),O=qt(dt),k=b((e=>ms(e))),u=g.uiState.currentChatSessionId,P=k.tenantEmailDomain,D=P!=null&&P!=="",X=a.useCallback((e=>{D&&l(`/${P}/ai-cfo/routines?routine=${encodeURIComponent(e.scheduleId)}`)}),[D,l,P]),Z=a.useCallback((()=>{D&&l(`/${P}/ai-cfo/routines`)}),[D,l,P]),ee=a.useCallback(((e,h)=>{const H=e.sessionId??C.sessionId;H!=null&&D&&l(`/${P}/ai-cfo/${H}?routine=${encodeURIComponent(h)}`)}),[D,l,C.sessionId,P]),ct=a.useMemo((()=>I==null?void 0:{error:C.fetchState==="Error",kind:"routineRuns",loading:C.fetchState==="In-Progress"||C.fetchState==="Not-Started",routineName:I.name,schedule:Ft(I),skillName:I.isAdHoc===!0?void 0:Y.find((e=>e.macroId===I.macroId))?.name,onOpenSkill:I.isAdHoc===!0?void 0:K,runs:C.runs,tzName:I.tzName,unreadCount:I.unreadRuns,open:ge,onToggle:()=>et((e=>!e)),onOpenRun:e=>ee(e,I.scheduleId),onOpenRoutine:()=>X(I),onOpenRoutines:Z}),[K,Z,X,ee,ge,I,C.fetchState,C.runs,Y]),{handleUploadPromoClose:mt,isUploadPromoVisible:St}=Bt({isFileUploadEnabled:s,tenantEmailDomain:P}),te=Mt({currentTenant:k,currentChatSessionId:u,aiCfoView:g,skillsEnabled:A,onCloseSkills:ot,onOpenSkills:K}),{isSuggestedQuestionsLoading:ht,suggestedPromptQuestions:pt}=Ls(),$=i.state,V=$?.aiCfoInitialQuestion,ke=!!$?.aiCfoShouldSubmit;a.useEffect((()=>{const e=i.state;if(e?.[Ae]!==!0)return;m(!0);const h={...e};delete h[Ae],l(i,{replace:!0,state:h})}),[i.pathname,i.search,i.state,l]);const[ft,se]=a.useState(null),[gt,ae]=a.useState(!1),[Ct,ne]=a.useState(void 0),[It,oe]=a.useState(void 0),be=a.useRef(!1);a.useEffect((()=>{if(!be.current&&V!=null&&V!==""){const e=i.state;se(V),ae(ke),ne(e?.aiCfoInitialSubmissionSource!=null?e.aiCfoInitialSubmissionSource:void 0);const h=e?.aiCfoSuggestionIndex;oe(typeof h=="number"?h:void 0),be.current=!0}}),[V,ke,i.state]);const kt=a.useCallback((()=>{se(null),ae(!1),ne(void 0),oe(void 0),l(i.pathname,{replace:!0,state:Ne(i.state)})}),[i.pathname,i.state,l]),ve=a.useMemo((()=>new URLSearchParams(i.search)),[i.search]),Ee=ve.get("ref")??$?.aiCfoRef,ie=ve.get("emailRefId")??$?.aiCfoEmailRefId,Pe=a.useRef(!1);a.useEffect((()=>{Pe.current||Ee!=="month-end-email"||ie==null||u!=null||T==null||(t(Ss("controller",T.userId,ie,"MONTH_END_EMAIL")),Pe.current=!0)}),[Ee,ie,u,t,T]);const N=g.uiState.lastContextMessage;a.useEffect((()=>{N!=null&&N!==""&&u!=null&&(se(N),ae(!0),ne(void 0),oe(void 0),t(hs()))}),[N,u,t]);const bt=k.masterTOSInfo,w=bt?.isMasterTOSAccepted??!1,{visitedSessions:we}=$t(u),q=g.fetchState,G=g.uiState.chatSessionsNextPageToken.hasMore||!g.uiState.chatSessionsFirstPageFetched,ye=u!=null?g.fetchChatSessionHistoryByChatSessionId?.[u]?.fetchState??"Not-Started":"Not-Started",xe=u==null||(g.uiState.chatHistoryNextPageToken[u]?.hasMore??!0),Te=g.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:vt}=qe(Te,u),Et=vt.length===0;a.useEffect((()=>{w||O||l("../dashboard",{state:{...i.state,message:"open_ai_cfo_drawer"}})}),[w,O,l,i.state]);const Pt=a.useCallback((()=>{const e=me(i.state?.pathnameStackToGoBack),h=k.tenantEmailDomain;l(e.poppedPathname??(h!=null?`/${h}/dashboard`:".."),{state:{...i.state,pathnameStackToGoBack:e.newStack}})}),[k.tenantEmailDomain,i.state,l]),Re=a.useRef(void 0),je=a.useRef(void 0);a.useEffect((()=>{const e=d!==Re.current,h=u!==je.current;Re.current=d,je.current=u,d!==u&&(!e||d==null||_s(d)?h&&u!=null&&l(`../ai-cfo/${u}`,{state:{...i.state}}):t(ps({sessionId:d,agentId:"controller"})))}),[u,d]);const wt=a.useMemo((()=>({events:we.map((e=>`private-encrypted-chat-${e}.${He}`)),eventCallback:(e,h,H)=>H.onEventReceived(e,h)})),[we]);a.useEffect((()=>{q!=="In-Progress"&&G&&t(fs())}),[q,G,t]),a.useEffect((()=>{u!=null&&ye!=="In-Progress"&&xe&&T!=null&&(d===u||q==="Completed"&&!G)&&t(gs(u,T.userId))}),[ye,q,xe,G,u,T,d,t]);const Oe=e=>e.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(T==null||d==null)throw Error("Can't access AI Controller page without signing in...");const yt=u!=null&&g.responseStateByChatSessionId?.[u]?.answer?.fetchState==="In-Progress";if(!w&&O)return S.jsxs($s,{children:[S.jsx(re,{analytics:F,onLoad:Oe}),te.drawerElement,S.jsx(Vs,{children:S.jsx(Ve,{children:S.jsx(le,{isTOSAccepted:!1,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:Pt,onCompleteClick:()=>{k.userRoleId!=null&&t(ce(k.userRoleId))}})})})]});const xt=S.jsxs(S.Fragment,{children:[p&&!w?S.jsx(re,{analytics:F,onLoad:Oe}):null,S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,showHeader:!1,togglePageView:w?()=>m(!1):void 0,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})]});return S.jsxs(S.Fragment,{children:[S.jsxs(Ms,{children:[S.jsx(re,{analytics:F,onLoad:e=>e.trackPageLoaded(Gt.Event.aiCFOPage)}),O&&te.drawerElement,S.jsx(Bs,{...wt,currentChatSessionId:u,allSessionsWithOrderedQuestionAnswers:Te,allUsers:it,isAiCardCreationEnabled:rt,isCardPolicyEnabled:lt,openOnboardingPage:()=>m(!0),userId:T.userId,setIsAiCfoOpen:r,navigate:l,sessionFromUrl:d,location:i,isSubmitting:yt,isEmptyChatWithSession:Et,currentTenant:k,emailLinkQuestion:ft??void 0,autoSubmitEmailLinkQuestion:gt,onEmailLinkQuestionProcessed:kt,routedInitialQuestionSource:Ct,routedInitialQuestionSuggestionIndex:It,onCardPolicyVendorSearchTextChange:ut,onMenuClick:O?te.open:void 0,isFileUploadEnabled:s,isUploadPromoVisible:St,onUploadPromoClose:mt,exploreSuggestedPromptQuestions:pt,exploreSuggestedPromptQuestionsLoading:ht,isSkillsOpen:R,isRoutinesOpen:Q,routineCanCreate:c,routineEditing:E,routineEditorOpen:W,routineListError:n.fetchState==="Error",routineListLoading:n.fetchState==="In-Progress",routineMaxRoutines:n.maxRoutines,routineSaveError:o.fetchState==="Error",routineSaving:o.fetchState==="In-Progress",routineSchedulableSkills:Y,routines:n.routines,onRoutineCreate:ze,onRoutineDelete:st,routineHistoryError:C.fetchState==="Error",routineHistoryLoading:C.fetchState==="In-Progress",chatSidePanel:ct,routineDetail:pe,routineRunningScheduleId:o.runningScheduleId,routineRuns:C.runs,onRoutineEdit:We,onRoutineOpenRun:(e,h)=>ee(h,e.scheduleId),onRoutineRun:Ke,onRoutineCloseDetail:Z,onRoutineDraft:tt,routineDraftPrompt:J,onRoutineOpenDetail:X,onRoutineEditorCancel:Je,onRoutineLoadSkillInstructions:nt,onRoutineSave:Ye,onRoutineSetEnabled:at,isCreateSkillEnabled:A,promoDismissalScope:P}),p&&O?S.jsx(As,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:Ns,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>m(!1),children:S.jsx(Ve,{onClick:e=>e.stopPropagation(),children:S.jsx(le,{isTOSAccepted:w,acceptMasterTOSState:g.masterTOSAcceptanceState,onCloseClick:()=>m(!1),onCompleteClick:()=>{w||k.userRoleId==null||t(ce(k.userRoleId)),m(!1)}})})}):null]}),p&&!O?S.jsx(Vt,{open:p,onClose:()=>m(!1),children:S.jsx(Nt,{children:xt})}):null]})},Ve=M(Qs)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-D9xsLz4C.js";import{a as o,R as va}from"./sentry-BMvyJSqc.js";import{u as Me,j as r,g as ya,h as $a,q as R}from"./core-BomyDm3r.js";import{fE as Fe,Tc as Ba,Td as Ze,g8 as Aa,gu as K,Te as W,jt as Te,jA as Ie,Tf as xa,Tg as Da,gN as _a,p_ as Ma,Th as Fa,Ti as ve,gl as Za,Tj as $,fD as Ga,gs as Ra,Tk as ja,Tl as Ha,Tm as Va,Tn as ye,To as La,Tp as $e,Tq as Na,Dt as Pa,gm as Ua,h0 as Oa,cV as za,Tr as qa,Ts as Ya,qB as Ja,g7 as Ka,j5 as Wa,Tt as Qa,Tu as Xa,vU as et,gn as at}from"./zeni-epic-state-C6RT9e71.js";import{w as tt,i as nt,a as ot,r as st,E as rt,M as it,y as m,c as lt,u as dt,d as ct,T as ut,e as mt,f as Ct,x as pt,g as ht,l as ft,z as gt,h as j,p,m as Be,j as bt,$ as St,k as Ae,n as kt,C as xe,o as Et,q as wt,s as X,v as Q,A as Tt,B as It,D as vt,L as yt,F as $t,H as Bt,I as ee,J as At,K as xt}from"./index-B9ZeVIAQ.js";import{A as Dt,b as _t,I as Mt,a as De,d as Ft,D as _e}from"./mui-CsJ_uybP.js";import{u as Zt}from"./InboxNotificationsProvider-BY8P-Ihr.js";import{u as Gt}from"./useTaskManagerAccess-fnX1J0jB.js";import{u as Rt}from"./expenseAutomationHelper-Bla5A-j_.js";import"./recharts-CkiZYv6b.js";import"./analytics-DCG-BJ2B.js";import"./plaid-Bs9WL7ZA.js";import"./dnd-I9CGHlPV.js";import"./stripe-cKAAJElX.js";import"./lottie-DZ7H5U6k.js";import"./lexical-CYgmazu1.js";import"./pdf-BcamkVED.js";import"./utils-CZJ3iF9S.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="f6989c2c-9285-4a63-990c-27a3637388c9",a._sentryDebugIdIdentifier="sentry-dbid-f6989c2c-9285-4a63-990c-27a3637388c9")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},jt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[H,x]=va.useState(!1),[S,Ge]=o.useState(!1),t=ya(),s=$a(),ae=Aa(),te=st(),n=Me(),[Re,je]=o.useState(!1),V=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),L=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:He}=dt(),E=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Ve}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Te()),n(Ie()))}),[n,w,i.tenantId,E]);const[N,Le]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Pe,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:_}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>xa(e)));o.useEffect((()=>{const e=()=>{je(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>Da(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>_a(e))),{monthEndCloseChecksView:T}=f,qe=R("/signout")!==null,M=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&_&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,_,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const Ye=qe||g,U=r((e=>e.tenantState)),Je=r((e=>U.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>ja(e))),ce=r((e=>Ha(e).routines)),la=o.useMemo((()=>ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[ce]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(Va),[I,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=I!=null?O.deleteChatSessionStateByChatSessionId[I]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Zt(),Z=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(I!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:I})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:I})),z(void 0)))}),[n,t.state,s,F,I,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;Le(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&D&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(La("task_manager","dashboard"))}),[w,D,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Ke===!1&&v.push("accounts_payable_aging"),We===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>Na(e,v).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{x(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,D),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(T.monthEndCloseChecks?.auditSummary!=null&&j.trackMonthCloseAuditPage(e.month,e.year,T.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",T.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const A=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:A,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,T.monthEndCloseChecks?.auditSummary,T.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:U.currentTenantId??"",tenants:U.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:_,isRewardsAnimated:ga,rewardsPlan:P.rewardsPlan},selectedMenu:C===!0?xe("ai_cfo"):Ae(t)&&ue!=="completed"?xe("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:Ae(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=Ve?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{He(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&j.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return L?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return L?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&Tt(e.type)&&b(!1),e.type==="ai_cfo"){if(j.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!L)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const A=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=xt(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||j.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})}const Ia=It(e.type);vt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:A.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ia}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),q===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:T,onPeriodChange:Sa,onCalendarOpen:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${V.colors.grey2}`:""},children:d.jsxs(_t,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),d.jsx(Lt,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=De((e=>e.breakpoints.up("md"))),Ta=De((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(jt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(_e,{container:window.document.body,variant:"temporary",open:H,onClose:()=>y(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ta?null:d.jsx(_e,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((x=>Fe(x))),H={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(x,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ze({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...H})},Vt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
1
|
+
import{j as d}from"./liveblocks-BHA40K9j.js";import{a as o,R as va}from"./sentry-CFLt6SLf.js";import{u as Me,j as r,g as ya,h as $a,q as R}from"./core-C_3BcvPm.js";import{fE as Fe,Tc as Ba,Td as Ze,g8 as Aa,gu as K,Te as W,jt as Te,jA as Ie,Tf as xa,Tg as Da,gN as _a,p_ as Ma,Th as Fa,Ti as ve,gl as Za,Tj as $,fD as Ga,gs as Ra,Tk as ja,Tl as Ha,Tm as Va,Tn as ye,To as La,Tp as $e,Tq as Na,Dt as Pa,gm as Ua,h0 as Oa,cV as za,Tr as qa,Ts as Ya,qB as Ja,g7 as Ka,j5 as Wa,Tt as Qa,Tu as Xa,vU as et,gn as at}from"./zeni-epic-state-BK-HD5IA.js";import{w as tt,i as nt,a as ot,r as st,E as rt,M as it,y as m,c as lt,u as dt,d as ct,T as ut,e as mt,f as Ct,x as pt,g as ht,l as ft,z as gt,h as j,p,m as Be,j as bt,$ as St,k as Ae,n as kt,C as xe,o as Et,q as wt,s as X,v as Q,A as Tt,B as It,D as vt,L as yt,F as $t,H as Bt,I as ee,J as At,K as xt}from"./index-DfdR1P4V.js";import{A as Dt,b as _t,I as Mt,a as De,d as Ft,D as _e}from"./mui-DsxbZgLG.js";import{u as Zt}from"./InboxNotificationsProvider-ICcfArFM.js";import{u as Gt}from"./useTaskManagerAccess-DJ8lZv1E.js";import{u as Rt}from"./expenseAutomationHelper-dMv6Xo4s.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},C=new a.Error().stack;C&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[C]="f6989c2c-9285-4a63-990c-27a3637388c9",a._sentryDebugIdIdentifier="sentry-dbid-f6989c2c-9285-4a63-990c-27a3637388c9")}catch{}})();const B="AppDrawer",c={root:`${B}-root`,drawer:`${B}-drawer`,appBar:`${B}-appBar`,menuButton:`${B}-menuButton`,appBarZenilogo:`${B}-appBarZenilogo`,drawerZenilogo:`${B}-drawerZenilogo`},jt=ee("div",{slot:"Root"})((({theme:a})=>({[`&.${c.root}`]:{display:"flex"},[`& .${c.drawer}`]:{[a.breakpoints.up("md")]:{width:X,flexShrink:0,backgroundColor:a.colors.background}},[`& .${c.appBar}`]:{color:a.colors.primary,backgroundColor:a.colors.background,boxShadow:"none"},"& .MuiToolbar-root":{backgroundColor:a.colors.background},[`& .${c.menuButton}`]:{marginRight:a.spacing(2),[a.breakpoints.up("md")]:{display:"none"}},[`& .${c.appBarZenilogo}`]:{fill:a.colors.primary,cursor:"pointer",width:"100%",marginLeft:a.spacing(-6)},[`& .${c.drawerZenilogo}`]:{margin:`${a.spacing(3)} ${a.spacing(3)} ${a.spacing(0)}`,fill:a.colors.primary,cursor:"pointer"}}))),Ht=tt((function({tenantEmailDomain:a}){const{isAiCfoOpen:C,setIsAiCfoOpen:b}=ot(),[H,x]=va.useState(!1),[S,Ge]=o.useState(!1),t=ya(),s=$a(),ae=Aa(),te=st(),n=Me(),[Re,je]=o.useState(!1),V=rt(),ne=t.pathname.includes("/ai-cfo/");o.useEffect((()=>{ne||(n(K()),n(W()))}),[n,ne]),o.useEffect((()=>{n(K()),n(W())}),[n,a]);const{useFeatureGate:u}=it(),{isFeatureEnabled:oe}=u(m.isDebitCardFeatureEnabled),k=lt(),i=r((e=>Fe(e))),L=i.masterTOSInfo?.isMasterTOSAccepted??!1,{setLoading:He}=dt(),E=ct(),{isTaskManagerAccessEnabled:D,isZeniUser:Ve}=Gt(k),se=ut(),w=mt();o.useEffect((()=>{w&&E&&(n(Te()),n(Ie()))}),[n,w,i.tenantId,E]);const[N,Le]=o.useState(void 0),Ne=!!i.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:Pe}=u(m.isChargeCardFeatureEnabled),Ue=Ct(i,Pe,oe),{isFeatureEnabled:Oe}=u(m.isSettingsFeatureEnabled),{isFeatureEnabled:_}=u(m.isReferralFeatureEnabled),ze=i.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",re=r((e=>xa(e)));o.useEffect((()=>{const e=()=>{je(window.scrollY>10)};return window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}}),[]);const P=r((e=>Da(e))),h=r((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),f=r((e=>_a(e))),{monthEndCloseChecksView:T}=f,qe=R("/signout")!==null,M=R("/:tenantEmailDomain/dashboard")!==null,ie=R("/:tenantEmailDomain/reports")!==null,g=R("/:tenantEmailDomain/onboarding/*")!==null,le=Rt();o.useEffect((()=>{w&&_&&!g&&P.fetchState==="Not-Started"&&n(Ma(!0))}),[w,_,P.fetchState,g]),o.useEffect((()=>{if(le){const e=t.state?.origin;if(e!=null){const l=Fa(e);l!=null&&n(ve(l))}}}),[le,t.state]);const Ye=qe||g,U=r((e=>e.tenantState)),Je=r((e=>U.fetchState==="Completed"?Za(e):[])),{isFeatureEnabled:Ke}=u(m.isApAgingFeatureEnabled),{isFeatureEnabled:We}=u(m.isArAgingFeatureEnabled),{isFeatureEnabled:Qe}=u(m.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Xe}=u(m.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ea}=u(m.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:aa}=u(m.isDashboardSidebarNewYearAnimationEnabled),ta=r((e=>$(e).totalUnreadCount)),na=r((e=>$(e).notificationDetailsByTab.tasks.uiState.unreadCount)),oa=r((e=>$(e).notificationDetailsByTab.comments.uiState.unreadCount)),sa=r((e=>$(e).reducedFetchCountState)),de=r((e=>$(e).notificationDetailsByTab.tasks.fetchCountState)),O=r((e=>Ga(e))),ra=r((e=>Ra(e).skillsEnabled)),ia=r((e=>ja(e))),ce=r((e=>Ha(e).routines)),la=o.useMemo((()=>ce.filter((e=>e.sessionId!=null)).map((e=>({cadence:pt(e),name:e.name,scheduleId:e.scheduleId,sessionId:e.sessionId,unreadRuns:e.unreadRuns})))),[ce]),da=new URLSearchParams(t.search).get("routine")??ht(t.pathname.split("/ai-cfo/")[1])??void 0,ca=o.useCallback(((e,l)=>{s(l!=null&&l!==""?`/${a}/ai-cfo/${encodeURIComponent(l)}`:`/${a}/ai-cfo/routines?routine=${encodeURIComponent(e)}`)}),[s,a]),{status:ue}=r(Va),[I,z]=o.useState(void 0),q=O.uiState.currentChatSessionId,F=I!=null?O.deleteChatSessionStateByChatSessionId[I]?.fetchState:void 0,me=ft(F),{inboxNotifications:Y,isLoading:Ce,isFetchingMore:pe,hasFetchedAll:he,fetchMore:ua}=Zt(),Z=r((e=>$(e).notificationDetailsByTab.comments.fetchCountState));o.useEffect((()=>{const e=setTimeout((()=>ua?.()),0);return()=>clearTimeout(e)})),o.useEffect((()=>{if(I!=null)return me==="In-Progress"&&F==="Completed"?(n(ye({chatSessionId:I})),z(void 0),void s(`/${a}/ai-cfo/explore`,{state:{...t.state,referrer:"Sidebar"}})):void(F==="Error"&&(n(ye({chatSessionId:I})),z(void 0)))}),[n,t.state,s,F,I,me,a]),o.useEffect((()=>{if(Ce===!1&&pe===!1&&he===!0&&i?.companyId!=null&&Y!=null){const e=`dashboard_${i.companyId}`;Le(Y.filter((l=>l.roomId===e&&l.readAt==null)).length)}}),[Ce,pe,he,i?.companyId,Y]),o.useEffect((()=>{w&&D&&!g&&de.fetchState==="Not-Started"&&ae.tenantId!=null&&n(La("task_manager","dashboard"))}),[w,D,g,de.fetchState,ae.tenantId,n]),o.useEffect((()=>{g||Z.fetchState!=="Not-Started"||n($e({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[g,Z.fetchState,n]),o.useEffect((()=>{if(N!=null){const{fetchState:e}=Z;e!=="In-Progress"&&e!=="Completed"||(e==="In-Progress"&&n($e({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),n(Ze({unreadCount:N},"comments")))}}),[N,Z.fetchState]);const ma={fetchStatus:sa,count:ta},v=[];Ke===!1&&v.push("accounts_payable_aging"),We===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),_===!1&&v.push("rewards_card"),se===!1&&v.push("expense_automation_card");const fe=r((e=>Na(e,v).fetchState)),ge=r((e=>Pa(e).fetchState)),be=a!=null?gt.getSignedInUserTenant(a):null,Se=r((e=>be?.tenantId!=null?Ua(e,be.tenantId):void 0)),Ca=M&&(fe==="Completed"||fe==="Error")||ie&&(ge==="Completed"||ge==="Error")||!M&&!ie?void 0:"disabled",pa=o.useMemo((()=>Oa(i.userRole)),[i.userRole]),ha=za(pa),y=e=>{x(e)},fa=ze,ga=i?.rewardsLastViewedTime==null,ba=k?.userEmail!=null&&re.fetchState==="Completed"&&qa(re.notificationSettings,k.userEmail,oe,i,D),Sa=o.useCallback((e=>{const l=t.state?.referrer;if(T.monthEndCloseChecks?.auditSummary!=null&&j.trackMonthCloseAuditPage(e.month,e.year,T.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",T.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),n(Ya(i.tenantId,e)),h[i.tenantId]!=null){const A=p(t.state?.pathnameStackToGoBack,t.pathname);s(`/${a}/month_end_close_checks/review/${f.currentSelectedView}/${e.month}-${e.year}`,{state:{pathnameStackToGoBack:A,referrer:f.currentSelectedView}})}n(ve(f.currentSelectedView)),f.reconciliation.selectedAccountId!=null&&n(Ja({selectedAccountId:void 0}))}),[f.reconciliation.selectedAccountId,f.currentSelectedView,i.tenantId,T.monthEndCloseChecks?.auditSummary,T.monthEndCloseChecks?.reportEmailSentDate,h,a,t.state,t.pathname]),ka=o.useMemo((()=>({zIndex:S?12:Be[2]})),[S]),Ea=E&&bt(t),ke=d.jsx(St,{signedInUser:k,currentTenantId:U.currentTenantId??"",tenants:U.fetchState==="Completed"?Je:Se!=null?[Se]:[],rewardsConfiguration:{isRewardsTabVisible:_,isRewardsAnimated:ga,rewardsPlan:P.rewardsPlan},selectedMenu:C===!0?xe("ai_cfo"):Ae(t)&&ue!=="completed"?xe("invoicing"):Et(t),isTenantDropdownDisabled:Ca,isSettings:kt(t),isInvoicing:Ae(t)&&ue==="completed",isSettingsFeatureEnabled:Oe,currentTenant:i,isVendorsTabVisible:ha,isZeniAccountEnabled:Ne,isChargeCardEnabled:Ue,isTreasuryEnabled:fa,isNotificationsTabVisible:ba,notificationCountDetails:ma,isExpenseAutomationEnabledForUser:se,isAiCfoAccessEnabled:E,skillsEnabled:ra&&E,routinesEnabled:ia===!0&&E,routines:la,selectedRoutineId:da,onRoutineSelect:ca,onNotificationIconClick:()=>{y(!1);const e=Ve?na===0&&oa>0?"notifications/comments":"notifications/tasks":"notifications/comments",l=p(t.state?.pathnameStackToGoBack,t.pathname);s(`${a}/${e}`,{state:{pathnameStackToGoBack:l}})},onZeniLogoClick:()=>{te.toggle()},handleTenantSelect:e=>{He(yt.TENANT_SWITCHING),y(!1),$t({dispatch:n,navigate:s,pathToNavigate:Bt(e.tenantEmailDomain,t),selectedTenant:e,signedInUser:k})},handleMenuChange:(e,l)=>{if(k!=null&&j.trackSidePanelClicked(e.type,e.group),y(!1),a==null)return;if(e.type==="routines")return L?(n(Ie()),n(Qa()),void s(`/${a}/ai-cfo/routines`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(e.type==="skills")return L?(n(Te()),n(Xa()),void s(`/${a}/ai-cfo/skills`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}})):void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});if(n(K()),n(W()),e.type==="invoicing")return C&&b(!1),n(et({cacheOverride:!1})),void s(`../${a}/invoicing/overview`,{state:{pathnameStackToGoBack:p(t.state?.pathnameStackToGoBack,t.pathname),referrer:"Sidebar"}});if(C&&Tt(e.type)&&b(!1),e.type==="ai_cfo"){if(j.trackAICFOChatScreenStateChanged("viewed","left_menu",q??null,null),!L)return void Q({location:t,navigate:s,mergeState:{referrer:"Sidebar"}});const G=p(t.state?.pathnameStackToGoBack,t.pathname);return void s(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:G,referrer:"Sidebar"}})}const A=p(t.state?.pathnameStackToGoBack,t.pathname),J=e.type,we=xt(J)&&J!=="command_center";if(J!=="command_center"&&!we||h[i.tenantId]==null||j.trackMonthEndCloseClicked(h[i.tenantId].month,h[i.tenantId].year,"Sidebar"),we&&h[i.tenantId]!=null){const G=h[i.tenantId];return void s(`/${a}/month_end_close_checks/review/${e.type}/${G.month}-${G.year}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})}const Ia=It(e.type);vt(e.type)?(q!=null&&n(at()),s(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:A.slice(0,-1),message:l,referrer:"Sidebar"}})):s(`../${a}/${Ia}`,{state:{pathnameStackToGoBack:A,message:l,referrer:"Sidebar"}})},onDeleteChatSession:e=>{n(Wa(e)),q===e&&z(e)},handleLogOutClick:()=>{y(!1);const e=p(t.state?.pathnameStackToGoBack,t.pathname);s("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMyProfileClick:()=>{s(`${a}/settings/my_profile`)},handleReferralsClick:()=>{s(`${a}/rewards/refer`)},handleBackClick:()=>{s(`${a}/dashboard`)},handleCockpitClick:()=>{window.open("/cockpit")},monthEndCloseChecksView:T,onPeriodChange:Sa,onCalendarOpen:Ge,aiCfoView:O,isAiCfo:Ea,isOnDashboard:M,isTaskManagerAccessEnabled:D,updateCurrentChatSessionId:e=>{n(Ka({sessionId:e,agentId:"controller"})),s(`../${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Qe,thanksGivingAnimationEnabled:Xe,christmasAnimationEnabled:ea,newYearAnimationEnabled:aa}),wa=d.jsx(Dt,{position:"fixed",className:c.appBar,style:{borderBottom:Re?`1px solid ${V.colors.grey2}`:""},children:d.jsxs(_t,{style:{minHeight:wt},children:[d.jsx(Mt,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:()=>y(!0),className:c.menuButton,size:"large",children:d.jsx(Vt,{})}),d.jsx(Lt,{className:c.appBarZenilogo,onClick:()=>{te.toggle()}})]})}),Ee=De((e=>e.breakpoints.up("md"))),Ta=De((e=>e.breakpoints.down("md")));return a==null?null:d.jsxs(jt,{className:c.root,children:[d.jsx(Ft,{}),Ye===!1?d.jsxs(d.Fragment,{children:[Ee||!M?null:wa,d.jsxs("nav",{className:c.drawer,children:[Ee?null:d.jsx(_e,{container:window.document.body,variant:"temporary",open:H,onClose:()=>y(!1),PaperProps:{sx:{width:X,zIndex:Be[2],borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background}},ModalProps:{keepMounted:!0},children:ke}),Ta?null:d.jsx(_e,{PaperProps:{sx:{width:X,borderRight:"none",backgroundImage:"none",backgroundColor:V.colors.background,...ka}},variant:"permanent",open:!0,children:ke})]})]}):null]})})),r1=({tenantEmailDomain:a})=>{const C=Me(),b=r((x=>Fe(x))),H={events:b.userRoleId!=null?[`private-encrypted-${b.userRoleId}.dashboard-user-notification`]:[],eventCallback:(x,S)=>{nt(S)&&Ba(S.mode)==="dashboard"&&C(Ze({unreadCount:S.data.unread},"tasks"))}};return d.jsx(Ht,{tenantEmailDomain:a,...H})},Vt=ee((a=>o.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...a},o.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.604839 4.51889C0.333157 4.57797 0.0879194 4.8318 0.0182541 5.12602C-0.00534674 5.22569 -0.00534674 5.4412 0.0182541 5.54086C0.0523791 5.685 0.117181 5.80198 0.22956 5.92229C0.346814 6.04782 0.459133 6.11627 0.600351 6.14826C0.726193 6.17676 23.2738 6.17676 23.3997 6.14826C23.5409 6.11627 23.6532 6.04782 23.7704 5.92229C23.9348 5.74632 24 5.57908 24 5.33344C24 5.1793 23.9797 5.08352 23.9199 4.95575C23.8455 4.79698 23.6879 4.63709 23.5343 4.56468C23.3857 4.49468 24.2116 4.49926 11.9899 4.50058C2.66632 4.50157 0.669677 4.50479 0.604839 4.51889ZM0.669895 11.1732C0.365117 11.2113 0.0889356 11.4752 0.0182179 11.7958C-0.00468131 11.8996 -0.00469357 12.0996 0.0181935 12.2034C0.0806855 12.4867 0.305734 12.7294 0.581516 12.8108C0.65573 12.8327 1.1761 12.8337 12 12.8337C22.8591 12.8337 23.3441 12.8327 23.4192 12.8106C23.6933 12.7297 23.9196 12.4855 23.9818 12.2034C24.0047 12.0996 24.0047 11.8997 23.9818 11.7959C23.9201 11.516 23.7014 11.2776 23.425 11.1888C23.3558 11.1665 22.8817 11.1655 12.0544 11.164C5.84032 11.1631 0.717278 11.1672 0.669895 11.1732ZM0.594774 17.8516C0.458952 17.8831 0.344939 17.9535 0.22956 18.077C0.0652015 18.253 0 18.4202 0 18.6659C0 18.82 0.0203225 18.9158 0.0801289 19.0435C0.154452 19.2023 0.312097 19.3622 0.465726 19.4346C0.614214 19.5046 -0.209758 19.4999 12 19.4999C21.8294 19.4999 23.3082 19.4975 23.3881 19.4811C23.6596 19.4256 23.9122 19.1669 23.9817 18.8733C24.0053 18.7736 24.0053 18.5581 23.9817 18.4584C23.9476 18.3143 23.8828 18.1973 23.7704 18.077C23.6532 17.9515 23.5409 17.883 23.3997 17.851C23.2779 17.8235 0.713601 17.824 0.594774 17.8516Z",fill:"currentColor"}))))`
|
|
2
2
|
height: 20px;
|
|
3
3
|
width: 20px;
|
|
4
4
|
color: ${a=>a.theme.colors.primary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-D9xsLz4C.js";import{a as d}from"./sentry-BMvyJSqc.js";import{h as U,g as j,u as B,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-BomyDm3r.js";import{fE as P,Yc as w,XV as R,G_ as E,GU as q,GY as A,GN as X,XX as Y,GR as ae,H0 as oe,GQ as H,H3 as K,G$ as C}from"./zeni-epic-state-C6RT9e71.js";import{z as _,w as z,bY as pe,n as O,bS as Q,bZ as le,E as Z,a7 as J,b_ as se,b$ as ne}from"./index-B9ZeVIAQ.js";import"./mui-CsJ_uybP.js";import{u as M,i as re}from"./ReimbursementApprovalRuleDetailScreen-zx_YxbPw.js";import ie from"./NotFoundScreen-DbwVF9lB.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="7a36e862-2f39-45ba-8da6-ef28cc5904e0",e._sentryDebugIdIdentifier="sentry-dbid-7a36e862-2f39-45ba-8da6-ef28cc5904e0")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(z(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},N="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(z(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));M();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${N}`]:[],eventCallback:(i,I,m)=>{i.endsWith(N)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(K(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=_.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(H(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const L=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];L==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):L==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(K(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=_.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(M(),d.useEffect((()=>{p||(f(!0),l(H(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
1
|
+
import{j as u}from"./liveblocks-BHA40K9j.js";import{a as d}from"./sentry-CFLt6SLf.js";import{h as U,g as j,u as B,j as y,N as G,l as V,i as W,n as te,o as x}from"./core-C_3BcvPm.js";import{fE as P,Yc as w,XV as R,G_ as E,GU as q,GY as A,GN as X,XX as Y,GR as ae,H0 as oe,GQ as H,H3 as K,G$ as C}from"./zeni-epic-state-BK-HD5IA.js";import{z as _,w as z,bY as pe,n as O,bS as Q,bZ as le,E as Z,a7 as J,b_ as se,b$ as ne}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import{u as M,i as re}from"./ReimbursementApprovalRuleDetailScreen-DiBNgDsy.js";import ie from"./NotFoundScreen-BDRAfL_x.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="7a36e862-2f39-45ba-8da6-ef28cc5904e0",e._sentryDebugIdIdentifier="sentry-dbid-7a36e862-2f39-45ba-8da6-ef28cc5904e0")}catch{}})();const k="bill-approval-rule-update",ce=V((function(e){return{approvalView:w(e),billPaySetupApproverViewUpdateData:R(e).billPaySetupApproverViewUpdateData}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(k)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!1))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))}}}))(z(pe)),ue=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),p=y((r=>r.billPaySetupApproverViewState.fetchState)),f=y((r=>P(r))),c=y((r=>w(r))),S=y((r=>R(r).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{S?.updateStatus.fetchState==="Completed"&&o(E())}),[S]),d.useEffect((()=>{a||p!=="Not-Started"||e||(n(!0),o(q(!0,!0,!1)))}),[a,p,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{c.allApprovalRules.length===0&&c.fetchState==="Completed"&&(s||(v(!0),o(A())),l("./new"))}),[s,c,o]);const g={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${k}`]:[],eventCallback:(r,h,b)=>{r.endsWith(k)&&b.onApprovalRulesEventReceived(r)}};return f?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(ce,{currentTenant:f,location:t,navigate:l,...g})},N="bill-approval-rule-update",de=V((function(e){const l=w(e),t=R(e).billPaySetupApproverViewUpdateData,o={};for(const n of Object.values(e.vendorState.vendorByID))n?.id!=null&&(o[n.id]=n.name);const a={};for(const n of Object.values(e.classState.classesByKey))n?.classId!=null&&(a[n.classId]=n.className);return{approvalView:l,billPaySetupApproverViewUpdateData:t,vendorNamesById:o,departmentNamesById:a}}),(function(e,l){const{navigate:t,location:o}=l;return{onApprovalRulesEventReceived:a=>{a.endsWith(N)&&e(Y(!1))},onBackClick:()=>{O(o)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(X(a,!0))},onEditRuleClick:a=>{a!=null?(e(A(a)),t(`./${a}/edit`)):(e(A()),t("./new"))},onReorderRules:a=>{e(oe(a,!0))}}}))(z(le)),ve=()=>{const e=y((o=>P(o))),{isApprovalRulesV3Enabled:l,isLoading:t}=Q(e?.tenantId);return l?u.jsx(fe,{isLoading:t}):u.jsx(ue,{isLoading:t})},fe=({isLoading:e})=>{const l=U(),t=j(),o=B(),[a,n]=d.useState(!1),[s,v]=d.useState(!1),[p,f]=d.useState(!1),c=y((i=>i.billPaySetupApproverViewState.fetchState)),S=y((i=>i.billPaySetupApproverViewState.approverListState.fetchStatus.fetchState)),g=y((i=>P(i)));M();const r=y((i=>w(i))),h=y((i=>R(i).billPaySetupApproverViewUpdateData));if(d.useEffect((()=>{h?.updateStatus.fetchState==="Completed"&&o(E())}),[h]),d.useEffect((()=>{a||c!=="Not-Started"||e||(n(!0),o(q(!0,!0,!0)))}),[a,c,e,o]),d.useEffect((()=>{s||S!=="Not-Started"||e||(v(!0),o(ae(!1,!0)))}),[s,S,e,o]),_.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");d.useEffect((()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(p||(f(!0),o(A())),l("./new"))}),[p,r,o]);const b={events:g.companyId!=null?[`private-encrypted-${g.companyId}.${N}`]:[],eventCallback:(i,I,m)=>{i.endsWith(N)&&m.onApprovalRulesEventReceived(i)}};return g?.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?u.jsx(G,{to:"../../promo"}):u.jsx(de,{currentTenant:g,location:t,navigate:l,isLoading:e,...b})},ye=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=o==="approval_create"&&t.allApprovalRules.length!==0;let n=t.allApprovalRules.length===0;return l.approvalRuleId&&(n=t.allApprovalRules.findIndex((s=>s.approvalRuleId===l.approvalRuleId))===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:n,approvalUpdateActionType:o}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=S=>{const g=[];return S.forEach((r=>{const h=r.actors.selectedUsers.map((I=>({type:"user",userId:I.userId,isImplicitActor:!1}))),b=r.actors.selectedNonUsers.map((I=>{const m=!!re(I.value);return{type:m?"attribute":"role",subType:I.value,userId:void 0,idType:void 0,isImplicitActor:!m}})),i=h.concat(b);g.push({action:r.stepType.selectedOption,actors:i,operator:i.length>1?r.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),g},c={amount:{type:"amount",comparator:"range",min:{amount:p.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:p.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(s==="approval_create"){const S={criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}else{const S={approvalRuleId:n,criteria:c,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(S))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(K(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(se);function Se(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=_.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(d.useEffect((()=>{p||(f(!0),l(H(!0)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ye,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t})}const ge=V((function(e,l){const t=R(e),o=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=[],n={};for(const s of Object.values(e.vendorState.vendorByID))s?.id!=null&&(a.push(s.id),n[s.id]=s.name);return{localData:t,approvalUpdateActionType:o,allVendorIds:a,vendorNamesById:n,editingRuleId:o==="approval_update"?l.approvalRuleId:void 0,allApprovalRulesWithUser:w(e).allApprovalRules}}),(function(e,l){const{navigate:t,approvalUpdateDataView:o,approverViewData:a,approvalRuleId:n}=l,s=o.billPaySetupApproverViewUpdateData?.type,v=O(l.location);return{onApprovalRuleDataUpdated:p=>{const f=i=>{const I=[];return i.forEach((m=>{const L=m.actorKind?.selectedOption,ee=m.selectedRole?.selectedNonUsers??[];let D=[];L==="role"?D=ee.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):L==="specific_person"&&(D=(m.persons?.selectedUsers??[]).map((T=>({type:"user",userId:T.userId,isImplicitActor:!1}))));const $=m.action??"require_approval";I.push({action:$,actors:D,operator:D.length>1?$==="require_approval"?"or":"and":"is"})})),I},c=p.amountCriteria,S=p.vendorCriteria,g=p.departmentCriteria,r={};if(c!=null&&c.comparator.selectedOption!=null){const i=c.comparator.selectedOption;r.amount={type:"amount",comparator:i,min:i==="less_than"?void 0:c.min,max:i==="greater_than"?void 0:c.max}}const h=S?.selection.selectedOptions??[];h.length>0&&(r.vendor={type:"vendor",operator:S?.operator.selectedOption??"is",vendorIds:h});const b=g?.selection.selectedOptions??[];if(b.length>0&&(r.department={type:"department",operator:g?.operator.selectedOption??"is",departmentIds:b}),s==="approval_create"){const i={name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}else{const i={approvalRuleId:n,name:p.name,description:p.description,separationOfDuties:p.separationOfDuties,criteria:r,steps:f(p.steps),isApplicableOnPendingApprovalEntity:p.applyToExistingBills.includes("applyToExistingBills")};e(C(i))}},onResetClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(E()),s==="approval_update"||v?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(K(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:p=>{e(A(p)),t(s==="approval_update"?`../../${p}/edit`:`../${p}/edit`)}}}))(ne);function F(){const e=y((t=>P(t))),{isApprovalRulesV3Enabled:l}=Q(e?.tenantId);return l?u.jsx(me,{}):u.jsx(Se,{})}function me(){const e=U(),l=B(),t=j(),{approvalRuleId:o}=W(),a=_.getSignedInUser(),n=Z(),s=y((c=>R(c))),v=y((c=>w(c))),[p,f]=d.useState(!1);if(M(),d.useEffect((()=>{p||(f(!0),l(H(!1)))})),d.useEffect((()=>{v.fetchState==="Not-Started"&&e(o!=null?"../../":"../")}),[v,o]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?u.jsx(J,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:n.colors.grey5}}):u.jsx(ge,{navigate:e,approvalUpdateDataView:s,approvalRuleId:o,approverViewData:v,location:t},o??"new")}function xe(){return u.jsxs(te,{children:[u.jsx(x,{path:"/",element:u.jsx(ve,{})}),u.jsx(x,{path:"/new",element:u.jsx(F,{})}),u.jsx(x,{path:"/:approvalRuleId/edit",element:u.jsx(F,{})}),u.jsx(x,{path:"*",element:u.jsx(ie,{})})]})}export{xe as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-D9xsLz4C.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-BomyDm3r.js";import{fE as Z,Xv as _e,bq as kt,Rx as oa,bo as wt,bJ as de,Xw as Bt,Gi as xt,Hv as Ve,GR as la,bn as Ae,Xx as sa,Xy as ra,c8 as ca,Xz as da,l_ as Ct,XA as At,XB as Et,I4 as Ue,Gx as xe,XC as ua,G6 as at,XD as pa,LV as ma,Ga as ba,Gg as Dt,XE as Se,XF as Me,Hw as Oe,XG as ha,XH as ga,Hz as Ne,XI as Sa,HM as ya,XJ as Tt,Hg as nt,Hl as fa,XK as Ia,XL as ce,XM as jt,XN as Pt,XO as Ft,gU as va,GC as $e,cG as Rt,XP as ka,gg as wa,XQ as Ba,XR as xa,dY as Vt,dX as $t,XS as ze,XT as Ca,XU as Aa,W4 as Xe,XV as Ea,W5 as ie,W6 as He,XW as Da,XX as Ta,XY as ja,Hn as it,Hk as Pa,XZ as Fa,X_ as Ra,X$ as Va,H6 as $a,Y0 as La,Y1 as Ga,cu as Lt,d9 as Gt,m9 as _a,bO as Ua,br as _t,bP as Ut,Fl as Ma,Y2 as Oa,LI as Na,LO as za,Bx as Xa,Hx as Ha,Ib as Za,mm as ge,Y3 as Wa,Y4 as Mt,mQ as Ya,mg as Ot,mB as Nt,mA as ot,bE as pe,bN as qa,Y5 as Ja,Y6 as ye,kM as Ka,Y7 as lt,Y8 as Qa,kQ as en,l9 as tn,Ip as an,Y9 as nn,mJ as on,If as ln,Ya as st,Ij as sn,Io as rn,Im as cn,Id as dn,Yb as zt,Gr as un,Yc as pn,Yd as mn,gF as bn,gE as hn,gD as gn,mp as Sn,mH as rt,mS as yn,ul as fn,my as In,Ih as vn,kW as kn,mX as wn,Ye as Bn,kO as xn,uc as Cn,Yf as An,Hc as En,bK as Dn,bt as Tn,Tw as jn,dc as Pn,db as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-C6RT9e71.js";import{E as ue,z as L,V as fe,as as Ze,M as oe,y as g,bi as We,a7 as se,J as A,a8 as Ee,h as j,bu as $n,a4 as H,av as Ye,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as _n,aS as Un,ab as Xt,G as De,ag as qe,by as Mn,ae as Ht,bz as On,aq as Nn,S as Zt,w as zn,bA as Xn,bB as Hn,bC as Zn,bD as Wn,bE as Yn,bF as qn,bG as Jn,bH as Kn,bI as Qn,r as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,f as li}from"./index-B9ZeVIAQ.js";import{n as _,S as si}from"./mui-CsJ_uybP.js";import{A as ut}from"./AddressScreen-Cdr2j35I.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-BeAYwvC9.js";import{a as f}from"./sentry-BMvyJSqc.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-DkXoRZ45.js";import{u as Yt}from"./useInitialThreadRequest-Pe6lvpTh.js";import{u as ui}from"./BusinessVerificationPageScreen-BVwrIVJv.js";import Ce from"./NotFoundScreen-DbwVF9lB.js";import{D as pi}from"./DrawerScreen-DXPlivfx.js";import{M as qt}from"./MobileAppDrawer-D8KSGZ8t.js";import{F as Jt}from"./FeaturePreviewScreen-B11vFkOV.js";import{S as je}from"./SetupPagesScreen-CEG9qkFk.js";import{B as mi}from"./BillPayApprovalRoutes-C7TITJQ6.js";import{F as bi}from"./ScreenRoutes-BnBOn0fY.js";import"./recharts-CkiZYv6b.js";import"./analytics-DCG-BJ2B.js";import"./plaid-Bs9WL7ZA.js";import"./dnd-I9CGHlPV.js";import"./stripe-cKAAJElX.js";import"./lottie-DZ7H5U6k.js";import"./lexical-CYgmazu1.js";import"./pdf-BcamkVED.js";import"./utils-CZJ3iF9S.js";import"./routePaths-B7kYeIqd.js";import"./InboxNotificationsProvider-BY8P-Ihr.js";import"./useTaskManagerAccess-fnX1J0jB.js";import"./analyticsHelper-DFvWpT7U.js";import"./ReimbursementApprovalRuleDetailScreen-zx_YxbPw.js";import"./getLocaleForTenant-CdcSWjO0.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]="d1c9f551-8186-4fbb-aa4d-1305e92bbef6",e._sentryDebugIdIdentifier="sentry-dbid-d1c9f551-8186-4fbb-aa4d-1305e92bbef6")}catch{}})();const hi=Q((function(e,t){const l=_e(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Ye}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.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(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>_e(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Yt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:Y}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,$,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,q]),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(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Y,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(100,58)},mt=Q((function(e,t){const l=L.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:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.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=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,U]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,$=v.showAutofill;const Y=k((F=>_e(F,n??"")));u===!1&&(z=Y.fetchState,M=Y.transactionDetails?.attachments?.[0],$=!1);const q=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||Y.fetchState==="Error")return a.jsx(Ce,{});if(z!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:q}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,Y,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-BHA40K9j.js";import{h as J,u as le,g as K,i as te,j as k,N as ee,l as Q,q as na,n as ia,o as y}from"./core-C_3BcvPm.js";import{fE as Z,Xv as _e,bq as kt,Rx as oa,bo as wt,bJ as de,Xw as Bt,Gi as xt,Hv as Ve,GR as la,bn as Ae,Xx as sa,Xy as ra,c8 as ca,Xz as da,l_ as Ct,XA as At,XB as Et,I4 as Ue,Gx as xe,XC as ua,G6 as at,XD as pa,LV as ma,Ga as ba,Gg as Dt,XE as Se,XF as Me,Hw as Oe,XG as ha,XH as ga,Hz as Ne,XI as Sa,HM as ya,XJ as Tt,Hg as nt,Hl as fa,XK as Ia,XL as ce,XM as jt,XN as Pt,XO as Ft,gU as va,GC as $e,cG as Rt,XP as ka,gg as wa,XQ as Ba,XR as xa,dY as Vt,dX as $t,XS as ze,XT as Ca,XU as Aa,W4 as Xe,XV as Ea,W5 as ie,W6 as He,XW as Da,XX as Ta,XY as ja,Hn as it,Hk as Pa,XZ as Fa,X_ as Ra,X$ as Va,H6 as $a,Y0 as La,Y1 as Ga,cu as Lt,d9 as Gt,m9 as _a,bO as Ua,br as _t,bP as Ut,Fl as Ma,Y2 as Oa,LI as Na,LO as za,Bx as Xa,Hx as Ha,Ib as Za,mm as ge,Y3 as Wa,Y4 as Mt,mQ as Ya,mg as Ot,mB as Nt,mA as ot,bE as pe,bN as qa,Y5 as Ja,Y6 as ye,kM as Ka,Y7 as lt,Y8 as Qa,kQ as en,l9 as tn,Ip as an,Y9 as nn,mJ as on,If as ln,Ya as st,Ij as sn,Io as rn,Im as cn,Id as dn,Yb as zt,Gr as un,Yc as pn,Yd as mn,gF as bn,gE as hn,gD as gn,mp as Sn,mH as rt,mS as yn,ul as fn,my as In,Ih as vn,kW as kn,mX as wn,Ye as Bn,kO as xn,uc as Cn,Yf as An,Hc as En,bK as Dn,bt as Tn,Tw as jn,dc as Pn,db as Fn,cF as Rn,cM as Vn}from"./zeni-epic-state-BK-HD5IA.js";import{E as ue,z as L,V as fe,as as Ze,M as oe,y as g,bi as We,a7 as se,J as A,a8 as Ee,h as j,bu as $n,a4 as H,av as Ye,p as T,a1 as Ie,bv as ct,bw as dt,bx as Ln,az as Gn,af as _n,aS as Un,ab as Xt,G as De,ag as qe,by as Mn,ae as Ht,bz as On,aq as Nn,S as Zt,w as zn,bA as Xn,bB as Hn,bC as Zn,bD as Wn,bE as Yn,bF as qn,bG as Jn,bH as Kn,bI as Qn,r as ei,bJ as ti,br as ai,bK as ni,ai as ii,bL as oi,f as li}from"./index-DfdR1P4V.js";import{n as _,S as si}from"./mui-DsxbZgLG.js";import{A as ut}from"./AddressScreen-SjU2U0ZR.js";import{g as ne,a as Te,i as Wt,V as Je,b as Ke,c as ri,v as ci,d as di,A as me,D as be}from"./DomesticWireDetailScreen-ojJdskB-.js";import{a as f}from"./sentry-CFLt6SLf.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-CnAY_u1k.js";import{u as Yt}from"./useInitialThreadRequest-C8Pdei5-.js";import{u as ui}from"./BusinessVerificationPageScreen-OrLH3WzL.js";import Ce from"./NotFoundScreen-BDRAfL_x.js";import{D as pi}from"./DrawerScreen-DaPp3vfO.js";import{M as qt}from"./MobileAppDrawer-DjEeoE6u.js";import{F as Jt}from"./FeaturePreviewScreen-bhcVTnED.js";import{S as je}from"./SetupPagesScreen-K06f0ggy.js";import{B as mi}from"./BillPayApprovalRoutes-CRw5sS5w.js";import{F as bi}from"./ScreenRoutes-BAM6ERJQ.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";import"./routePaths-Cca1tWJp.js";import"./InboxNotificationsProvider-ICcfArFM.js";import"./useTaskManagerAccess-DJ8lZv1E.js";import"./analyticsHelper-Bfs4R3aB.js";import"./ReimbursementApprovalRuleDetailScreen-DiBNgDsy.js";import"./getLocaleForTenant-CK0bI6xd.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]="d1c9f551-8186-4fbb-aa4d-1305e92bbef6",e._sentryDebugIdIdentifier="sentry-dbid-d1c9f551-8186-4fbb-aa4d-1305e92bbef6")}catch{}})();const hi=Q((function(e,t){const l=_e(e,t.billId),n=L.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:c??""},u=H(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;Ae(n)||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let i=!1,d=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:S,isMarkAsPaidBtnVisible:h}=sa(l.billActivities,ra(t.currentTenant),n);i=S,d=h}const p=ca(t.currentTenant?.userRole??[]),m=l.transactionDetails!=null&&da(l.transactionDetails,p,n);return{billDetails:l,isAccountingClassesEnabled:Ct(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${Ye}/transaction_attachment`,signedInUser:n,showBackButton:o,isAdmin:p,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:i,showMarkAsPaidButtonToApprover:d,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:j,showMarkAsPaidButtonToCreator:m}}),(function(e,t){const{billId:l,currentTenant:n,location:c,navigate:r}=t,{tenantEmailDomain:u}=n;return{redirectToBillsScreen:()=>{const o=ne(u),s=T(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(Se({}))},deleteBill:o=>{j.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?j.trackBillPayCancelAndDeleteBill(l,o):j.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(at(l,o.type,"")):e(at(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(xe(l,"retry")):e(xe(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const i=Te(u,o,s),d=T(c.state?.pathnameStackToGoBack,c.pathname);r(i,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=H(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ne(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=T(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(xe(t.billId,"refund"))},saveBillDetails:(o,s,i)=>{o&&e(Et({data:i,billId:l})),e(Ue(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(At({billId:l}))}}}))($n);function gi(){const e=J(),t=le(),l=K(),{billId:n}=te(),c=ue(),r=L.getSignedInUser(),u=fe(),o=k((X=>Z(X))),s=k((X=>_e(X,n??""))),i=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Yt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Qe({mobileExploreReferrer:"Bill Details"});Ze({isDataReady:s.fetchState==="Completed"});const S=o?.userRole!=null&&kt(o?.userRole),h=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!S,[b,I]=f.useState(!1),[E,x]=f.useState(!1),[C,U]=f.useState(!1),{useFeatureGate:D,useDynamicConfig:B}=oe(),{isFeatureEnabled:O}=D(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:V}=D(g.isBillPayCommentingEnabled),{isFeatureEnabled:W}=D(g.isBillPayDetectInsufficientFundsEnabled),{configValue:N}=B(We.zeniAssistConfig),v=oa(o),z=wt(o.userRole),M=h&&de(u?.loggedInUserRoleMap),$=N.user_ids!=null&&r?.userId!=null&&N.user_ids.includes(r?.userId),{isFeatureEnabled:Y}=D(g.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:q}=D(g.billPaySetupShowInternationalPaymentByWise);if(f.useEffect((()=>{O&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&v===!1?U(!1):U(s.billActivities[0]?.isRealTimeApprovalEnabled&&(z||M||s.allApprovers.find((X=>X.user.userId===r?.userId))!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))}),[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,z,M,o.isZeni,v,r]),f.useEffect((()=>{n!=null&&t(Bt(n))}),[n]),f.useEffect((()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(I(!0),t(xt(n??"",O,$,!1)))}),[b,s,n,t]),f.useEffect((()=>{E||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(x(!0),t(Ve(!1,O,$,q,n)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))}),[E,s,n,t,O,$,q]),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(ee,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(se,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${A.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(Ee,{analytics:j,onLoad:X=>(G=>{n!=null&&G.trackBillPayBillDetails(n,s.isRecurring)})(X)}),a.jsx(hi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:O,location:l,navigate:e,isBillPayCommentingEnabled:V,isRealTimeApprovalEnabled:C,currentTenant:o,billId:n??"",isInternationalPaymentShaVsOurEnabled:Y,hasZeniAssistAccess:$,isDetectInsufficientFundsEnabled:W,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const Le=De.getLocalizedStrings().spendManagement.billPay.billDetails,pt=De.getLocalizedStrings().common,Si={containerWidth:new Xt(100,58)},mt=Q((function(e,t){const l=L.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:j,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:A.sp10,paddingRight:A.sp3,paddingBottom:"15px",paddingLeft:A.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}}),(function(e,t){const l=L.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=>{j?.trackBillPaySkipAutofill(),e(Oe(n))},onDeleteClick:()=>{e(Sa({billId:t.billId})),j?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}}))(Un);function w({appContent:e}){const t=le(),l=J(),{billId:n}=te(),c=K(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=Ie(),s=ue(),i=L.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=oe(),{isFeatureEnabled:m}=d(g.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:S}=d(g.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:h}=d(g.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(g.billPaySetupShowInternationalPaymentByWise),{configValue:I}=p(We.zeniAssistConfig),E=I.user_ids!=null&&i?.userId!=null&&I.user_ids.includes(i?.userId),x=k((F=>Z(F)));ui();const[C,U]=f.useState(!1),[D,B]=f.useState(!1),[O,V]=f.useState(!1),[W,N]=f.useState(),v=k((F=>Me(F,m,h,n)));let z=v.fetchState,M=v.file,$=v.showAutofill;const Y=k((F=>_e(F,n??"")));u===!1&&(z=Y.fetchState,M=Y.transactionDetails?.attachments?.[0],$=!1);const q=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;f.useEffect((()=>{n==null&&t(Oe(!0))}),[n,t]),f.useEffect((()=>{z==="Not-Started"&&(u&&D?B(!1):!u&&C&&U(!1))}),[n]),f.useEffect((()=>{C||n==null||u||(U(!0),t(xt(n,S,E,!1)),D||(B(!0),t(Ve(!1,S,E,b,n)))),u&&!D&&(B(!0),t(Ve(!1,S,E,b,n)))}),[C,D,u,n,t,S,E,b]);const X={onOkClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:n})),t(Ne(W,m,n))},onCancelClick:()=>{if(V(!1),!W)return;const F=M!=null?"replace":"upload";j?.trackInvoiceActionClick(q??"",F,i?.userEmail??"","no"),t(ha({file:W,billId:n}))}},G=f.useCallback((()=>{const F=H(c.state?.pathnameStackToGoBack),ve=F.poppedPathname??ne(x.tenantEmailDomain);t(Se({billId:n})),l(ve,{state:{pathnameStackToGoBack:F.newStack}})}),[c.state,x.tenantEmailDomain,n,t,l]);if(i==null)throw Error("Can't access address page without signing in...");if(z==="Error"||Y.fetchState==="Error")return a.jsx(Ce,{});if(z!="Completed")return n==null&&o!=="small"?a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[a.jsx(ht,{}),a.jsx(Fe,{}),a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:!0,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:V,setPayload:N,showActionButtons:!1,isInitialEdit:!!v.isInitialEdit,billStage:q}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:!0})})]})}):a.jsxs(Pe,{windowSize:o,children:[o==="small"||$?null:a.jsx(bt,{children:a.jsx(Kt,{onClick:G,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(Ln,{}),a.jsx(Re,{windowSize:o,children:a.jsx(dt,{isNewBill:n==null})})]});{const F=v.billPayInfo!=null&&v.billPayInfo.stage.code==="pending_approval"?v.billPayInfo.billStatus.code:v.billStage;return a.jsx(ct,{fallback:G,children:a.jsxs(Pe,{windowSize:o,children:[$&&o!=="small"?a.jsx(ht,{}):null,O?a.jsx(Gn,{titleComponent:a.jsx(Bi,{children:Le.overwriteTitle}),descriptionComponent:a.jsx(xi,{children:Le.overwriteDescription}),primaryButtonText:pt.yes,secondaryButtonText:pt.no,action:X,isEditPopup:!0}):null,o==="small"||$?null:a.jsx(bt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Fe,{}):null,a.jsx(mt,{backgroundColor:s.colors.grey4,billId:n,file:M,showAutofill:$,uploadStatus:v.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:fi(u,Y,v),setShowConfirmationPopup:V,setPayload:N,showActionButtons:Ii(u,v),isInitialEdit:!!v.isInitialEdit,billStage:F}),a.jsx(Re,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Kt,{onClick:e,"data-testid":"nav-bar-back-click"})}function fi(e,t,l){let n,c;return e?(n=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(n=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(vi,{children:[a.jsx(ki,{children:`${Le.recurringBill.recurringCycle}
|
|
2
2
|
${n}/${c}`}),a.jsx(wi,{})]}):void 0}function Ii(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 bt=_.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as V}from"./sentry-
|
|
1
|
+
import{a as V}from"./sentry-CFLt6SLf.js";import{u as Y,j as b,h as ne,g as se,i as oe,N as ie,l as re}from"./core-C_3BcvPm.js";import{fE as U,GU as ce,Yn as ue,AY as de,RA as pe,H6 as le,Kh as me,N4 as fe,NK as ye,Oz as Se,Yo as ge,Yp as Ie,Yq as he,Yr as be,Ys as Te,UD as De,Xt as Oe,US as Ce,Ll as ke,UT as Ve,Lp as Ae,mG as we,gF as Ne,gE as Fe,gD as _e,ul as ve,uc as Ee,u9 as xe,my as Be,B5 as Ue,B3 as z,bE as R,Bh as L,cE as ze}from"./zeni-epic-state-BK-HD5IA.js";import{bS as Re,V as Le,M as Pe,bi as Me,z as B,a8 as je,h as P,n as E,S as x,bU as Ge,ae as Ye,p as M,aG as j}from"./index-DfdR1P4V.js";import{n as qe}from"./mui-DsxbZgLG.js";import{j as k}from"./liveblocks-BHA40K9j.js";import{d as G}from"./routePaths-Cca1tWJp.js";import{M as Ke}from"./MobileAppDrawer-DjEeoE6u.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="79fbc3e1-fcdd-44c6-88f2-1c8efe719d45",t._sentryDebugIdIdentifier="sentry-dbid-79fbc3e1-fcdd-44c6-88f2-1c8efe719d45")}catch{}})();function nt(){const t=Y(),u=b((r=>U(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Re(n),p=b((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const Ze=qe.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-
|
|
1
|
+
import{j as g}from"./liveblocks-BHA40K9j.js";import{a as l}from"./sentry-CFLt6SLf.js";import{u as me,h as he,g as Ce,j as M,i as fe,l as Se}from"./core-C_3BcvPm.js";import{a as ge,e5 as be,z as ye,e7 as Pe,e9 as N,ea as Ie,bn as W,a8 as we,h as j,eb as H,el as Ee,G as ke,S as xe,w as Ae,ee as Te,ef as Ue,av as _e,ei as ve,ej as Oe,bk as Qe,ek as Fe}from"./index-DfdR1P4V.js";import{gJ as je,fD as G,fE as De,g7 as $e,jg as Le,jc as Ve,fF as z,gt as Re,gn as qe,gp as B,gv as Me,gw as He,gx as ze,gy as Be,gz as Ne}from"./zeni-epic-state-BK-HD5IA.js";import{D as We,n as $,P as Ge,S as Je}from"./mui-DsxbZgLG.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.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]="23e3a6c6-156a-4b9e-8a03-f513b76e497a",e._sentryDebugIdIdentifier="sentry-dbid-23e3a6c6-156a-4b9e-8a03-f513b76e497a")}catch{}})();const J="chat-response-generated",Y="cards/ask",K="card_policy_hero";function D(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Ye=Se((function(e,a){const o=G(e),d=a.isSubmitting,c=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:d,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:ve(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...c}}),(function(e,a){const{location:o,currentTenant:d,userId:c,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,cardPolicyPageContext:U}=a,i=d.tenantEmailDomain,C=o.state?.referrer,m=C===K?X(i):D(i);return{onEventReceived:(n,t)=>{if(n===J&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?j.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):j.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,ze(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:c}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,c,f,s,U)},updateCurrentInput:n=>{e(B(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Me(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{p(m,{state:{...o.state}}),e(B(""))},togglePageView:()=>{p(m,{state:N(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&e(qe()),p((function(n){return`/${n}/${Y}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(Re({questionAnswerId:n,isCollapsed:t}))},...Oe(e,{isAiCardCreationEnabled:A,isCardPolicyEnabled:T,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),p(D(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),p(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Ae(Te)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),x=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,gt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=ge(),o=me(),d=he(),c=Ce(),[p,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o(je())}),[o]);const i=M((r=>G(r))),C=ye.getSignedInUser(),{session_id:m}=fe(),n=M((r=>De(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=c.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:x,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,v]=l.useState(!1),O=l.useRef(!1);l.useEffect((()=>{O.current||u==null||u===""||(_(u),v(P),O.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),v(!1),d(c.pathname,{replace:!0,state:N(c.state)})}),[c.pathname,c.state,d]),ie=n.masterTOSInfo,S=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(S&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),v(w),O.current=!1}}),[S]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=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&&m!==t&&d((function(r,w){return`/${r}/${Y}/${w}`})(s,t),{state:{...c.state},replace:!0})}),[t,m,s,d,c.state]),l.useEffect((()=>{m!=null&&t==null&&m!=="new_chat"&&o($e({sessionId:m,agentId:"controller"}))}),[]);const ce=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${J}`)),eventCallback:(r,w,pe)=>pe.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&R&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,R,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const de=m??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return g.jsxs(tt,{children:[g.jsx(we,{analytics:j,onLoad:r=>r.trackPageLoaded(xe.Event.aiCFOPage)}),S?g.jsx(Ye,{...ce,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:q,allUsers:E,isAiCardCreationEnabled:A,isCardPolicyEnabled:T,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:d,sessionFromUrl:de,location:c,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:x,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>{d(I?X(s):D(s),{state:{...c.state}})},onCompleteClick:()=>{S||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(z(n.userRoleId)))}}),g.jsx(We,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:g.jsx(et,{onClick:r=>r.stopPropagation(),children:g.jsx(H,{isTOSAccepted:S,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:x,onCloseClick:()=>h(!1),onCompleteClick:()=>{S||n.userRoleId==null||o(z(n.userRoleId)),h(!1)}})})})]})},et=$(Je)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-D9xsLz4C.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-BomyDm3r.js";import{fR as Pt,$9 as is,g1 as wt,bt as ve,$a as ds,$b as ls,fG as fn,$c as Pn,fP as wn,$d as Tn,$e as vn,$f as Fn,$g as xn,fQ as Bn,g0 as Ln,$h as Rn,$i as us,fW as ms,fV as Cs,$j as ps,Jm as On,g3 as ia,$k as hs,$l as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$m as Ss,fZ as ys,IU as Is,IT as ks,IX as Es,IZ as As,g9 as Ds,fD as $n,$n as _s,$o as Ps,ge as Mn,$p as ws,gf as yt,J3 as Ts,J0 as vs,fE as fe,$q as qa,dX as Fe,dh as xe,dY as Be,gZ as da,cB as la,$r as ua,$s as Tt,Ch as Ga,m6 as Ka,$t as za,JC as ka,g4 as qe,JE as vt,lY as Nn,$u as ma,Jq as _a,$v as Fs,$w as xs,Jt as Ja,$x as Bs,Yk as Qa,f$ as Vn,Jz as ba,ip as Ls,$y as Hn,fS as Ca,br as Rs,$z as Os,gF as Xa,gE as et,K6 as Us,gD as at,$A as Gn,cu as Kn,d9 as js,Yj as wa,KH as zn,$B as gn,Kh as Pa,$C as Yn,KI as $s,YJ as Ms,KJ as Ns,LO as Vs,Bx as Hs,LI as Gs,$D as Ks,JD as oa,$E as zs,$F as Ys,$G as Ws,$H as Zs,$I as qs,$J as Ft,$K as Js,JT as Wn,JM as Qs,$L as Xs,g$ as eo,$M as Zn,K0 as qn,K4 as Jn,g_ as ao,$N as to,Kt as Qn,$O as no,$P as ro,$Q as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$R as rr,$S as co,gb as io,gc as lo,gd as uo,$T as tt,g5 as sr,db as xt,$U as mo,$V as Co,$W as po,$X as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$Y as or,KG as Ha,Rx as ko,$Z as Eo,$_ as Ao,$$ as Do,a00 as cr,a01 as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,a02 as To,a03 as vo,Jn as Fo,a04 as dr,f_ as lr,a05 as xo,Jp as Bo,Jo as bn,a06 as Lo,a07 as Ro,a08 as Oo,UE as Uo,a09 as Bt,a0a as jo,Fo as ur,mG as $o,id as Mo,L6 as No,a0b as mr,fM as Vo,fN as Ho,a0c as Go,dM as Ko,g2 as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,Tw as Qo}from"./zeni-epic-state-C6RT9e71.js";import{V as Le,dd as Cr,a4 as we,de as pr,df as hr,dg as Xo,G as ea,as as Lt,dh as ec,di as ac,a as fr,d as gr,ar as br,p as ke,M as le,y as W,l as ya,dj as Sr,dk as tc,dl as nc,z as te,a7 as Ta,d2 as nt,dm as rc,dn as sc,dp as oc,a1 as va,bi as Qe,bE as Rt,dq as cc,ab as Fa,Y as rt,E as Ot,h as ae,w as st,dr as ic,bQ as Sa,ds as kt,dt as dc,a8 as Ut,du as lc,ae as yr,av as Et,dv as uc,aq as Ir,P as kr,S as Er,dw as mc,dx as Cc,dy as pc,dz as hc,dA as fc,dB as gc,dC as bc,J as Ya,dD as Sc,dE as yc,m as ht,r as Ic,dF as kc,dG as Ec,dH as Ac,ai as Dc,dI as _c,dJ as Pc,f as wc}from"./index-B9ZeVIAQ.js";import{n as Ne,D as Ar,S as Tc}from"./mui-CsJ_uybP.js";import{a as r}from"./sentry-BMvyJSqc.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-DkXoRZ45.js";import{M as Ee}from"./MobileAppDrawer-D8KSGZ8t.js";import{d as jt}from"./recharts-CkiZYv6b.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-CEG9qkFk.js";import{u as Tr}from"./useInitialThreadRequest-Pe6lvpTh.js";import ot from"./NotFoundScreen-DbwVF9lB.js";import{u as Nt}from"./useChargeCardPusherEvents-B9vV64BE.js";import{n as yn}from"./utils-CZJ3iF9S.js";import{t as Lc}from"./AddressScreen-Cdr2j35I.js";import"./analytics-DCG-BJ2B.js";import"./plaid-Bs9WL7ZA.js";import"./dnd-I9CGHlPV.js";import"./stripe-cKAAJElX.js";import"./lottie-DZ7H5U6k.js";import"./lexical-CYgmazu1.js";import"./pdf-BcamkVED.js";import"./InboxNotificationsProvider-BY8P-Ihr.js";import"./useTaskManagerAccess-fnX1J0jB.js";import"./BusinessVerificationPageScreen-BVwrIVJv.js";import"./routePaths-B7kYeIqd.js";import"./analyticsHelper-DFvWpT7U.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]="df357429-43c0-4b75-8a6c-b789169bf89b",e._sentryDebugIdIdentifier="sentry-dbid-df357429-43c0-4b75-8a6c-b789169bf89b")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=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:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
1
|
+
import{j as o}from"./liveblocks-BHA40K9j.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-C_3BcvPm.js";import{fR as Pt,$9 as is,g1 as wt,bt as ve,$a as ds,$b as ls,fG as fn,$c as Pn,fP as wn,$d as Tn,$e as vn,$f as Fn,$g as xn,fQ as Bn,g0 as Ln,$h as Rn,$i as us,fW as ms,fV as Cs,$j as ps,Jm as On,g3 as ia,$k as hs,$l as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$m as Ss,fZ as ys,IU as Is,IT as ks,IX as Es,IZ as As,g9 as Ds,fD as $n,$n as _s,$o as Ps,ge as Mn,$p as ws,gf as yt,J3 as Ts,J0 as vs,fE as fe,$q as qa,dX as Fe,dh as xe,dY as Be,gZ as da,cB as la,$r as ua,$s as Tt,Ch as Ga,m6 as Ka,$t as za,JC as ka,g4 as qe,JE as vt,lY as Nn,$u as ma,Jq as _a,$v as Fs,$w as xs,Jt as Ja,$x as Bs,Yk as Qa,f$ as Vn,Jz as ba,ip as Ls,$y as Hn,fS as Ca,br as Rs,$z as Os,gF as Xa,gE as et,K6 as Us,gD as at,$A as Gn,cu as Kn,d9 as js,Yj as wa,KH as zn,$B as gn,Kh as Pa,$C as Yn,KI as $s,YJ as Ms,KJ as Ns,LO as Vs,Bx as Hs,LI as Gs,$D as Ks,JD as oa,$E as zs,$F as Ys,$G as Ws,$H as Zs,$I as qs,$J as Ft,$K as Js,JT as Wn,JM as Qs,$L as Xs,g$ as eo,$M as Zn,K0 as qn,K4 as Jn,g_ as ao,$N as to,Kt as Qn,$O as no,$P as ro,$Q as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$R as rr,$S as co,gb as io,gc as lo,gd as uo,$T as tt,g5 as sr,db as xt,$U as mo,$V as Co,$W as po,$X as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$Y as or,KG as Ha,Rx as ko,$Z as Eo,$_ as Ao,$$ as Do,a00 as cr,a01 as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,a02 as To,a03 as vo,Jn as Fo,a04 as dr,f_ as lr,a05 as xo,Jp as Bo,Jo as bn,a06 as Lo,a07 as Ro,a08 as Oo,UE as Uo,a09 as Bt,a0a as jo,Fo as ur,mG as $o,id as Mo,L6 as No,a0b as mr,fM as Vo,fN as Ho,a0c as Go,dM as Ko,g2 as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,Tw as Qo}from"./zeni-epic-state-BK-HD5IA.js";import{V as Le,dd as Cr,a4 as we,de as pr,df as hr,dg as Xo,G as ea,as as Lt,dh as ec,di as ac,a as fr,d as gr,ar as br,p as ke,M as le,y as W,l as ya,dj as Sr,dk as tc,dl as nc,z as te,a7 as Ta,d2 as nt,dm as rc,dn as sc,dp as oc,a1 as va,bi as Qe,bE as Rt,dq as cc,ab as Fa,Y as rt,E as Ot,h as ae,w as st,dr as ic,bQ as Sa,ds as kt,dt as dc,a8 as Ut,du as lc,ae as yr,av as Et,dv as uc,aq as Ir,P as kr,S as Er,dw as mc,dx as Cc,dy as pc,dz as hc,dA as fc,dB as gc,dC as bc,J as Ya,dD as Sc,dE as yc,m as ht,r as Ic,dF as kc,dG as Ec,dH as Ac,ai as Dc,dI as _c,dJ as Pc,f as wc}from"./index-DfdR1P4V.js";import{n as Ne,D as Ar,S as Tc}from"./mui-DsxbZgLG.js";import{a as r}from"./sentry-CFLt6SLf.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CnAY_u1k.js";import{M as Ee}from"./MobileAppDrawer-DjEeoE6u.js";import{d as jt}from"./recharts-CmYjG1zt.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-K06f0ggy.js";import{u as Tr}from"./useInitialThreadRequest-C8Pdei5-.js";import ot from"./NotFoundScreen-BDRAfL_x.js";import{u as Nt}from"./useChargeCardPusherEvents-7mxw_gTB.js";import{n as yn}from"./utils-D1gULS4n.js";import{t as Lc}from"./AddressScreen-SjU2U0ZR.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./InboxNotificationsProvider-ICcfArFM.js";import"./useTaskManagerAccess-DJ8lZv1E.js";import"./BusinessVerificationPageScreen-OrLH3WzL.js";import"./routePaths-Cca1tWJp.js";import"./analyticsHelper-Bfs4R3aB.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]="df357429-43c0-4b75-8a6c-b789169bf89b",e._sentryDebugIdIdentifier="sentry-dbid-df357429-43c0-4b75-8a6c-b789169bf89b")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=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:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-BHA40K9j.js";import{a as g}from"./sentry-CFLt6SLf.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-C_3BcvPm.js";import{z as N,br as F,a8 as P,h as V,S as A,n as b,bs as j,ae as L,aG as U,p as B}from"./index-DfdR1P4V.js";import{fE as h,gH as M,AY as _,gC as G,c8 as R,Xt as z,bn as Y,ul as H,u9 as X,my as Z,o7 as S,Xu as $,bE as q,cE as C,oi as J,os as K}from"./zeni-epic-state-BK-HD5IA.js";import"./mui-DsxbZgLG.js";import{d as Q}from"./routePaths-Cca1tWJp.js";import{M as W}from"./MobileAppDrawer-DjEeoE6u.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="90724aeb-b69c-482e-a90c-3774d1fd9e67",t._sentryDebugIdIdentifier="sentry-dbid-90724aeb-b69c-482e-a90c-3774d1fd9e67")}catch{}})();const ee=E((function(t){const a=G(t),i=N.getSignedInUser(),l=h(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}}),(function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(K())},onAddressClick:e=>{const n=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:D}=r,v={companyInfo:{...n,website:u!=""&&u!=null?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?q(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:D.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(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=>{t($(e))},onCompanyOfficerUpdated:e=>{t(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=>{t(Z({files:e}))},onDeleteFile:e=>{t(X(e))},onEditFileName:(e,n)=>{t(H(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:l}=k(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>h(s))),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))}),[c,n,d,a]),g.useEffect((()=>{o==="Not-Started"&&a(_())}),[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(A.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|