@zeniai/web-app-ui 5.1.44-qa → 5.1.46-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AddressRoutes-Bu1wLdr9.js +1 -0
- package/dist/assets/AddressScreen-DyCQJjNT.js +9 -0
- package/dist/assets/{AiCfoScreen-BPdC66wo.js → AiCfoScreen-DpYulm6L.js} +5 -5
- package/dist/assets/{BillPayApprovalRoutes-QJ1EpW6M.js → BillPayApprovalRoutes-BiuKI-Rl.js} +1 -1
- package/dist/assets/{BillPayRoutes-Bna0uGqV.js → BillPayRoutes-UlCXMjZ_.js} +1 -1
- package/dist/assets/{BusinessVerificationPageScreen-0dmMGz8A.js → BusinessVerificationPageScreen-fLqoQmHN.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-BtSV6YdK.js → CardsAiCfoScreen-D49SttU_.js} +3 -3
- package/dist/assets/{ChargeCardRoutes-DKr2nu1e.js → ChargeCardRoutes-lr8bIl57.js} +1 -1
- package/dist/assets/CompanyPassportScreen-Jd7RmMxP.js +1 -0
- package/dist/assets/{ConnectionAuthScreen-BYP_nDK9.js → ConnectionAuthScreen-JILvaDGY.js} +1 -1
- package/dist/assets/CustomerOnboardingAuthScreen-BM-quSNh.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CxS9lLTl.js → CustomerOnboardingRoutes-BeYw23eY.js} +4 -4
- package/dist/assets/{DashboardRoutes-D2v4ZF_E.js → DashboardRoutes-BKrnUTFX.js} +1 -1
- package/dist/assets/{DefaultTenantHome-Dbi3Jzbe.js → DefaultTenantHome-C4xFfbR_.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DN6hsoHQ.js +18 -0
- package/dist/assets/{DrawerScreen-QceXJJGv.js → DrawerScreen-C3rL34Nr.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-cFyrvi31.js → EntityDetailRoutes-B6x-jsr1.js} +1 -1
- package/dist/assets/ExpenseAutomationRoutes-Cs8BXmkZ.js +25 -0
- package/dist/assets/{FeaturePreviewScreen-AUOPnl37.js → FeaturePreviewScreen-Bq9eSSz9.js} +1 -1
- package/dist/assets/{HubSpotOAuthCallbackScreen-IFaSwoId.js → HubSpotOAuthCallbackScreen-B3oZEnMP.js} +1 -1
- package/dist/assets/MagicLinkRoutes-Bvtkhcw0.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-RvwdSqqO.js +12 -0
- package/dist/assets/{MobileAppDrawer-CLztF99b.js → MobileAppDrawer-D8HOXn7v.js} +1 -1
- package/dist/assets/NotFoundScreen-0h0DiOvj.js +1 -0
- package/dist/assets/{NotificationRoutes-Bt0oSYPF.js → NotificationRoutes-DkowgBJj.js} +1 -1
- package/dist/assets/OAuthConsentScreen-MNbkNl_v.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DXEDmlZd.js +1 -0
- package/dist/assets/{PeopleRoutes-Dj-CT0eD.js → PeopleRoutes-CsAbJBHX.js} +3 -3
- package/dist/assets/PerformanceRoutes-8SJwQoaV.js +1 -0
- package/dist/assets/{Preview-CFdBsxvl.js → Preview-DkidNz3z.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-eD76plFQ.js → QBOConnectionScreen-DwoHkIu2.js} +1 -1
- package/dist/assets/{ReferralListScreen-DxoomfXt.js → ReferralListScreen-DAUAqg4I.js} +2 -2
- package/dist/assets/{ReimbursementApprovalRoutes-B7uUwiM0.js → ReimbursementApprovalRoutes-DxtKouwg.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js → ReimbursementApprovalRuleDetailScreen-BtppAsqY.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-Dh1G5yct.js → ReimbursementRoutes-eiz8xheE.js} +4 -4
- package/dist/assets/{ReportsRoutes-y7MnzGll.js → ReportsRoutes-_Zdg3F2x.js} +1 -1
- package/dist/assets/RewardsRoutes-UFPd_8TA.js +1 -0
- package/dist/assets/{ScreenRoutes-B-k_ZyHL.js → ScreenRoutes-BoQ6iXAM.js} +2 -2
- package/dist/assets/{SettingsRoutes-X4MKf4TH.js → SettingsRoutes-BI4dN7RS.js} +4 -4
- package/dist/assets/{SetupPagesScreen-Uer5YsTX.js → SetupPagesScreen-D-neLjJM.js} +5 -5
- package/dist/assets/SignInScreen-qgS7vG1A.js +1 -0
- package/dist/assets/SignOutScreen-BbyO1zZV.js +9 -0
- package/dist/assets/TaskListScreen-CVeALlL0.js +9 -0
- package/dist/assets/{TaskRoutes-DEDS1cCa.js → TaskRoutes-Gx5x8B3t.js} +2 -2
- package/dist/assets/{TransactionDetailRoutes-BMVLeepD.js → TransactionDetailRoutes-Dngsr6y1.js} +1 -1
- package/dist/assets/{TransactionDetailScreen-BOsA-UF4.js → TransactionDetailScreen-Bshs2g2Z.js} +2 -2
- package/dist/assets/{TransactionListRoutes-D-o7gV2V.js → TransactionListRoutes-Bg_zUk5Q.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CzaTrrCq.js → TreasuryRoutes-CNbtiHFp.js} +5 -5
- package/dist/assets/{VendorsRoutes-CA2szW0j.js → VendorsRoutes-C5KKIVE-.js} +10 -10
- package/dist/assets/WiseConfirmationScreen-Bqy3cyw-.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-B92jFFWR.js → ZeniAccountRoutes-CDeXOkOl.js} +9 -9
- package/dist/assets/{ZeniAccountStatementScreen-Czxe84tm.js → ZeniAccountStatementScreen-DE1cm9kp.js} +1 -1
- package/dist/assets/{accountMappingHelper-CUOH4oaZ.js → accountMappingHelper-cmIw559z.js} +1 -1
- package/dist/assets/{analytics-CVef-z80.js → analytics-DORMe8dT.js} +1 -1
- package/dist/assets/{analyticsHelper-DO0i_Ozz.js → analyticsHelper-aSqJwcvL.js} +1 -1
- package/dist/assets/{core-BZimyUuM.js → core-D95G1COY.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CfH0YvB4.js → decodeURIComponentSafe-BLmfpdcW.js} +1 -1
- package/dist/assets/{dnd-Ck7mLEKI.js → dnd-BXlaBlTc.js} +1 -1
- package/dist/assets/{empty-B1O8rDIf.js → empty-BE68b5E4.js} +1 -1
- package/dist/assets/{empty-CDMj19T8.js → empty-BTAxEJiS.js} +1 -1
- package/dist/assets/{emptyVideoElement-DHeCITuJ.js → emptyVideoElement-NX2rx7EQ.js} +1 -1
- package/dist/assets/{epic-C8TvJLbh.js → epic-K6OBBbJr.js} +1 -1
- package/dist/assets/{getLocaleForTenant-B-mnTkE0.js → getLocaleForTenant-HT8Btw6T.js} +1 -1
- package/dist/assets/{index-BX9FlrZ4.js → index-B_Cirr74.js} +2 -2
- package/dist/assets/{index-CGgy5RAo.js → index-BjNhU8qP.js} +1 -1
- package/dist/assets/{index-aKhhTDIh.js → index-C8tyyalR.js} +14039 -14039
- package/dist/assets/{index-DUwckqJX.js → index-CnP5hpUl.js} +1 -1
- package/dist/assets/{index-B4buEPtI.js → index-CruHx9g6.js} +1 -1
- package/dist/assets/{index-ky9cAsxd.js → index-DLVDaPoM.js} +1 -1
- package/dist/assets/{index-W-rD4OTh.js → index-DMreRMIr.js} +1 -1
- package/dist/assets/{index-BHYDqIxo.js → index-cIfsvMlJ.js} +1 -1
- package/dist/assets/{lexical-D_s6IbSB.js → lexical-D90cNSQE.js} +1 -1
- package/dist/assets/{liveblocks-PtDFv95_.js → liveblocks-8SEYIom7.js} +1 -1
- package/dist/assets/{lottie-D7iBAvwy.js → lottie-DGqwGfHh.js} +1 -1
- package/dist/assets/{mui-BcLZDyi8.js → mui-jqvOLufq.js} +1 -1
- package/dist/assets/{pathToGoBack-Bmk3vSys.js → pathToGoBack-Csr3Iao-.js} +1 -1
- package/dist/assets/{pdf-CPbk6pQ4.js → pdf-CMafEn8a.js} +4 -4
- package/dist/assets/{pdf-lib-DYmF-pgM.js → pdf-lib-C0lYQdSO.js} +1 -1
- package/dist/assets/{plaid-CooQT--5.js → plaid-BvitY7vM.js} +1 -1
- package/dist/assets/{pusher-KpZt7gt8.js → pusher-DVRirJfe.js} +1 -1
- package/dist/assets/{react-CgKzDvVo.js → react-C-4UGOsg.js} +1 -1
- package/dist/assets/{react-BByj9tRX.js → react-CAXdypQs.js} +1 -1
- package/dist/assets/{react-1GR8h5rv.js → react-CVOHOwD-.js} +1 -1
- package/dist/assets/{react-jDouMY6r.js → react-DADgee2G.js} +1 -1
- package/dist/assets/{react-xjRx_xkd.js → react-DJ_69eFR.js} +1 -1
- package/dist/assets/{react-C5ff31Q5.js → react-DOyz-DAB.js} +1 -1
- package/dist/assets/{recharts-Nefi66IQ.js → recharts-B5BD4Kau.js} +1 -1
- package/dist/assets/{routePaths-DQbleX1q.js → routePaths-STLgTv0l.js} +1 -1
- package/dist/assets/{sentry-mCXLUbmc.js → sentry-Bpr6hwv_.js} +1 -1
- package/dist/assets/{url-V8qFg-31.js → url-83NdFFZ3.js} +1 -1
- package/dist/assets/{url-DwL5mRAv.js → url-tRs_qG1D.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-C07ZgQEG.js → useAiCfoDashboardSuggestedQuestionsChips-BfufDhKS.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CE4sjmcs.js +1 -0
- package/dist/assets/{useDeviceId-r7OfXqIX.js → useDeviceId-DNdkDSci.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-ClxKOF2S.js → useInitialThreadRequest-DzF6un_U.js} +1 -1
- package/dist/assets/{utils-C9yOAUzR.js → utils-kj_q6fLI.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-CCFVon-p.js → withTransactionSidePanel-CyTjTf4e.js} +4 -4
- package/dist/assets/{zeni-epic-state-D1RAQ_Ab.js → zeni-epic-state-BnmnEdbj.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-B61fN_Ku.js +0 -1
- package/dist/assets/AddressScreen-BF-3RAYM.js +0 -9
- package/dist/assets/CompanyPassportScreen-BOxFkTz6.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-4HAF86rh.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-BHpce-fZ.js +0 -18
- package/dist/assets/ExpenseAutomationRoutes-CUBrIS6y.js +0 -25
- package/dist/assets/MagicLinkRoutes-BIAaZldq.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-BVEM6zNA.js +0 -12
- package/dist/assets/NotFoundScreen-BVW1mHQl.js +0 -1
- package/dist/assets/OAuthConsentScreen-86UCYr7M.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DDpGKk3b.js +0 -1
- package/dist/assets/PerformanceRoutes-DsWM-lYk.js +0 -1
- package/dist/assets/RewardsRoutes-Fh9U07tc.js +0 -1
- package/dist/assets/SignInScreen-BpX_mdSj.js +0 -1
- package/dist/assets/SignOutScreen-gWOZtfBm.js +0 -9
- package/dist/assets/TaskListScreen-CoC_5M60.js +0 -9
- package/dist/assets/WiseConfirmationScreen-BcU-8yI5.js +0 -12
- package/dist/assets/useAskAiCfoHostNavButtonProps-BY9akMo_.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-8SEYIom7.js";import{A as d}from"./AddressScreen-DyCQJjNT.js";import i from"./NotFoundScreen-0h0DiOvj.js";import"./sentry-Bpr6hwv_.js";import{o as s,p as r}from"./core-D95G1COY.js";import"./zeni-epic-state-BnmnEdbj.js";import"./recharts-B5BD4Kau.js";import"./index-C8tyyalR.js";import"./mui-jqvOLufq.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./utils-kj_q6fLI.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="cd0ff2b4-1e27-4329-addf-f475e5a9db34",t._sentryDebugIdIdentifier="sentry-dbid-cd0ff2b4-1e27-4329-addf-f475e5a9db34")}catch{}})();function _(){return e.jsxs(s,{children:[e.jsx(r,{path:"/edit/:addressType/:addressId",element:e.jsx(d,{})}),e.jsx(r,{path:"/new/:addressType",element:e.jsx(d,{})}),e.jsx(r,{path:"*",element:e.jsx(i,{})})]})}export{_ as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{j as r}from"./liveblocks-8SEYIom7.js";import{a as h}from"./sentry-Bpr6hwv_.js";import{h as P,u as _,g as j,i as E,j as L,n as B}from"./core-D95G1COY.js";import{J as M,m as $,z as D,A as K,B as N,N as R,d as C,g as m,S as z,j as b,p as F}from"./index-C8tyyalR.js";import{LX as w,hM as U,eT as G,LY as O,c3 as V,LZ as q,l5 as H}from"./zeni-epic-state-BnmnEdbj.js";import{n as J}from"./mui-jqvOLufq.js";import X from"./NotFoundScreen-0h0DiOvj.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]="7fd54fc1-493a-4d35-9215-0773e1bb386d",e._sentryDebugIdIdentifier="sentry-dbid-7fd54fc1-493a-4d35-9215-0773e1bb386d")}catch{}})();const Y=J.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex: 1 1 auto;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
align-items: center;
|
|
8
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
+
`,Z=B(function(e,t){const{addressId:o,isSubPage:i,addressType:c}=t,l=G(e),a=t.roleMap!=null&&O(t.roleMap),d=i||c==="user_address"||V(l?.userRole??[])||a?void 0:"readonly";if(o==null){const s=q(c,e);return{addressToEdit:s?.addressToCreate,loadingState:s?.status?.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d,isSubPage:i,dontShowSaveConfirmationPopup:t.dontShowSaveConfirmation}}const n=w(e,o);return{addressToEdit:n.address,loadingState:n.fetchState,googleAPIKey:b.googleMapsAPIKey,isDisabled:d}},function(e,t){const{navigate:o,location:i,addressType:c}=t,l=a=>{if(a==="express-pay")o("../express-pay/add-wire");else{const d=i.state,n=F(d?.pathnameStackToGoBack);let s=n.poppedPathname??A();const u=d?.queryParams;if(u){const g=new URLSearchParams(u).toString();g&&(s=`${s}?${g}`)}o(s,{state:{pathnameStackToGoBack:n.newStack}})}};return{onSubmitHandler:a=>{const d=Q(a);e(H({addressType:c,addressToCreate:d})),C?.trackSaveAddressClicked(m.Event.saveAddressClicked,{street:a.street.addressString,city:a.city,state:a.state,country:a.country.selectedOption??"",postalCode:a.postalCode,suite:a.suite,secondaryInfo:a.secondaryInfo}),l(t.bankAccountContext)},onCancel:()=>{l(t.bankAccountContext)}}})(z);function re({isSubPage:e,hideAddressSubTitle:t=!1,hideAddressBackButton:o=!1,dontShowSaveConfirmation:i,accountContext:c,addressTypeParam:l}){const a=P(),d=_(),n=j(),{addressId:s,addressType:u}=E(),g=M(),I=$(),k=D.getSignedInUser(),[f,v]=h.useState(s==null),p=L(S=>s!=null?w(S,s).fetchState:"Not-Started"),x=K();if(k==null)throw Error("Can't access address page without signing in...");const T=S=>S.trackPageLoaded(s!=null?m.Event.editAddress:m.Event.addAddress),y=l??u;return h.useEffect(()=>{f||s==null||(v(!0),d(U(s,!1)))},[f,s,d]),y==null||y.match(/(user_address|company_address|company_registered_address|vendor_address|officer_([1-9]|10)_address)$/g)?!f&&p==="Not-Started"||f&&p==="In-Progress"?r.jsx(N,{fetchState:p,style:{backgroundColor:I.colors.grey5}}):s!=null&&p==="Error"?(a(`${A(1)}/new`,{replace:!0}),r.jsx(r.Fragment,{})):r.jsxs(r.Fragment,{children:[r.jsx(R,{analytics:C,onLoad:T}),r.jsx(Y,{windowSize:g,children:r.jsx(Z,{location:n,navigate:a,isSubPage:e===!0,hideAddressBackButton:o,hideAddressSubTitle:t,addressId:s,addressType:y,dontShowSaveConfirmation:i,bankAccountContext:c,roleMap:x?.loggedInUserRoleMap})})]}):r.jsx(X,{})}const A=(e=2)=>{let t="../";for(let o=0;o<e;o++)t=`${t}../`;return t},Q=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng});export{re as A,Q as t};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-
|
|
1
|
+
import{j as d}from"./liveblocks-8SEYIom7.js";import{a as l}from"./sentry-Bpr6hwv_.js";import{u as ge,h as Ce,g as be,j as Y,i as Ie,n as ke}from"./core-D95G1COY.js";import{V as we,z as xe,J as Pe,d2 as ye,d3 as Ee,b6 as J,d4 as Te,b5 as K,p as D,N as L,d as b,d5 as F,d6 as ve,d7 as Qe,a1 as _e,g as Ae,a7 as Oe,d8 as Ue,a2 as je,d9 as Le,da as Fe,q as Be,b1 as De,db as Re}from"./index-C8tyyalR.js";import{gg as Me,eS as ee,eT as Ve,is as Ge,S_ as Ne,eZ as $e,iC as qe,iy as We,eU as B,f4 as ze,fV as He,fy as Ye,fC as X,fW as Je,fX as Xe,fY as Ze,fZ as Ke,f_ as et}from"./zeni-epic-state-BnmnEdbj.js";import{D as tt,n as I,S as st,P as ot}from"./mui-jqvOLufq.js";import{u as at}from"./useAiCfoDashboardSuggestedQuestionsChips-BfufDhKS.js";import{p as nt}from"./pathToGoBack-Csr3Iao-.js";import"./recharts-B5BD4Kau.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./utils-kj_q6fLI.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new t.Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="4f245dbb-3c6c-4190-adc1-b3f23cb2f359",t._sentryDebugIdIdentifier="sentry-dbid-4f245dbb-3c6c-4190-adc1-b3f23cb2f359")}catch{}})();const te="chat-response-generated",it=ke(function(t,r){const s=ee(t),m=r.isSubmitting,n=s.uiState?.currentChatSessionId,p=n!=null?ze(t.aiCfoState,n):[];return{showSampleQuestions:r.sessionFromUrl==="explore"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:m,isNewChatSession:r.sessionFromUrl==="new_chat"||r.sessionFromUrl==="explore",isFullView:!0,tableDownloadEndPoint:`${je}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,routedInitialQuestionSource:r.routedInitialQuestionSource,routedInitialQuestionSuggestionIndex:r.routedInitialQuestionSuggestionIndex,exploreSuggestedPromptQuestions:r.exploreSuggestedPromptQuestions,exploreSuggestedPromptQuestionsLoading:r.exploreSuggestedPromptQuestionsLoading,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,syntheticAnswers:p,resolveSyntheticAnswerCardTile:Fe(t),resolveSyntheticAnswerPolicyTile:Le(t)}},function(t,r){const{location:s,currentTenant:m,userId:n,navigate:p,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:u,setIsAiCfoOpen:f}=r;return{onEventReceived:(e,S)=>{if(e===te&&typeof S.text=="string"&&typeof S.metadata=="object"){const a=S,c=Xe(a.type),o=a.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:k,currentQuestionAnswerSummary:E}=K(u,o);c!=="answer"?b.trackAICFOChatResponseGenerated(c,k?.question.questionText??"",a.text,o,Re(E,y),a.metadata.message_id??null):b.trackAICFOChatAnswerGenerated(a.text,k?.question.questionText??"",(a.follow_up_questions?.length??0)>0,!!a.assumptions,!!a.insights,a.visualization!=null,Ze(a.visualization?.type??"")??null,o,a.summarized_title,a.metadata.message_id??null),t(Ke({chatSessionId:a.metadata.chat_session_id,responseType:c,fetchState:{fetchState:"Completed",error:void 0}})),t(et({chatSessionId:a.metadata.chat_session_id,answerPayload:a,userId:n}))}},onSubmit:(e,S,a,c)=>{e&&De(t,e,S,h,u,n,c,a)},updateCurrentInput:e=>{t(X(e))},onStopSubmit:()=>{},onUpdateScrollYOffset:e=>{t(Je(e))},onSelectSampleQuestion:()=>{},onBackClick:()=>{p(-1)},onCloseClick:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??nt(1);p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack}}),t(X(""))},togglePageView:()=>{const e=D(s.state?.pathnameStackToGoBack),S=e.poppedPathname??`/${m.tenantEmailDomain}/dashboard`;p(S,{state:{...s.state,pathnameStackToGoBack:e.newStack,message:"open_ai_cfo_drawer"}}),f(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{p(-1)},onNewChatClick:()=>{h!=null&&t(Ye());const e=Be(s.state?.pathnameStackToGoBack,s.pathname);p(`/${m.tenantEmailDomain}/ai-cfo/new_chat`,{state:{pathnameStackToGoBack:e.slice(0,-1),referrer:"Sidebar"}})},onToggleCotCollapsed:(e,S)=>{t(He({questionAnswerId:e,isCollapsed:S}))},onMenuClick:r.onMenuClick}})(Oe(Ue)),vt=({isFileUploadEnabled:t})=>{const{setIsAiCfoOpen:r}=we(),s=ge(),m=Ce(),n=be(),[p,h]=l.useState(!1);l.useEffect(()=>{s(Me())},[s]);const u=Y(i=>ee(i)),f=xe.getSignedInUser(),{session_id:e}=Ie(),S=Pe(),a=_e(S),c=Y(i=>Ve(i)),o=u.uiState.currentChatSessionId,y=c.tenantEmailDomain,{handleUploadPromoClose:k,isUploadPromoVisible:E}=ye({isFileUploadEnabled:t,tenantEmailDomain:y}),T=Ee({currentTenant:c,currentChatSessionId:o,aiCfoView:u}),{isSuggestedQuestionsLoading:se,suggestedPromptQuestions:oe}=at(),w=n.state,x=w?.aiCfoInitialQuestion,R=!!w?.aiCfoShouldSubmit;l.useEffect(()=>{const i=n.state;if(i?.[J]!==!0)return;h(!0);const g={...i};delete g[J],m(n,{replace:!0,state:g})},[n.pathname,n.search,n.state,m]);const[ae,v]=l.useState(null),[ne,Q]=l.useState(!1),[ie,_]=l.useState(void 0),[re,A]=l.useState(void 0),M=l.useRef(!1);l.useEffect(()=>{if(!M.current&&x!=null&&x!==""){const i=n.state;v(x),Q(R),_(i?.aiCfoInitialSubmissionSource!=null?i.aiCfoInitialSubmissionSource:void 0);const g=i?.aiCfoSuggestionIndex;A(typeof g=="number"?g:void 0),M.current=!0}},[x,R,n.state]);const le=l.useCallback(()=>{v(null),Q(!1),_(void 0),A(void 0)},[]),V=l.useMemo(()=>new URLSearchParams(n.search),[n.search]),G=V.get("ref")??w?.aiCfoRef,O=V.get("emailRefId")??w?.aiCfoEmailRefId,N=l.useRef(!1);l.useEffect(()=>{N.current||G!=="month-end-email"||O==null||o!=null||f==null||(s(Ge("controller",f.userId,O,"MONTH_END_EMAIL")),N.current=!0)},[G,O,o,s,f]);const P=u.uiState.lastContextMessage;l.useEffect(()=>{P!=null&&P!==""&&o!=null&&(v(P),Q(!0),_(void 0),A(void 0),s(Ne()))},[P,o,s]);const de=c.masterTOSInfo,C=de?.isMasterTOSAccepted??!1,{visitedSessions:$}=Te(o),U=u.fetchState,j=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,q=o!=null?u.fetchChatSessionHistoryByChatSessionId?.[o]?.fetchState??"Not-Started":"Not-Started",W=o==null||(u.uiState.chatHistoryNextPageToken[o]?.hasMore??!0),z=u.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:ce}=K(z,o),ue=ce.length===0;l.useEffect(()=>{C||a||m("../dashboard",{state:{...n.state,message:"open_ai_cfo_drawer"}})},[C,a,m,n.state]);const me=l.useCallback(()=>{const i=D(n.state?.pathnameStackToGoBack),g=c.tenantEmailDomain;m(i.poppedPathname??(g!=null?`/${g}/dashboard`:".."),{state:{...n.state,pathnameStackToGoBack:i.newStack}})},[c.tenantEmailDomain,n.state,m]);l.useEffect(()=>{o!=null&&e!==o&&m(`../ai-cfo/${o}`,{state:{...n.state}})},[o,e]),l.useEffect(()=>{e!=null&&o==null&&e!=="new_chat"&&e!=="explore"&&s($e({sessionId:e,agentId:"controller"}))},[]);const pe=l.useMemo(()=>({events:$.map(i=>`private-encrypted-chat-${i}.${te}`),eventCallback:(i,g,fe)=>fe.onEventReceived(i,g)}),[$]);l.useEffect(()=>{U!=="In-Progress"&&j&&s(qe())},[U,j,s]),l.useEffect(()=>{o!=null&&q!=="In-Progress"&&W&&f!=null&&U==="Completed"&&!j&&s(We(o,f.userId))},[q,W,o,f,s]);const H=i=>i.trackAICFOOnboardingScreenStateChanged("open","first_visit");if(f==null||e==null)throw Error("Can't access AI Controller page without signing in...");const Se=o!=null&&u.responseStateByChatSessionId?.[o]?.answer?.fetchState==="In-Progress";if(!C&&a)return d.jsxs(lt,{children:[d.jsx(L,{analytics:b,onLoad:H}),T.drawerElement,d.jsx(dt,{children:d.jsx(Z,{children:d.jsx(F,{isTOSAccepted:!1,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:me,onCompleteClick:()=>{c.userRoleId!=null&&s(B(c.userRoleId))}})})})]});const he=d.jsxs(d.Fragment,{children:[p&&!C?d.jsx(L,{analytics:b,onLoad:H}):null,d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,showHeader:!1,togglePageView:C?()=>h(!1):void 0,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),h(!1)}})]});return d.jsxs(d.Fragment,{children:[d.jsxs(rt,{children:[d.jsx(L,{analytics:b,onLoad:i=>i.trackPageLoaded(Ae.Event.aiCFOPage)}),a&&T.drawerElement,d.jsx(it,{...pe,currentChatSessionId:o,allSessionsWithOrderedQuestionAnswers:z,openOnboardingPage:()=>h(!0),userId:f.userId,setIsAiCfoOpen:r,navigate:m,sessionFromUrl:e,location:n,isSubmitting:Se,isEmptyChatWithSession:ue,currentTenant:c,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:ne,onEmailLinkQuestionProcessed:le,routedInitialQuestionSource:ie,routedInitialQuestionSuggestionIndex:re,onMenuClick:a?T.open:void 0,isFileUploadEnabled:t,isUploadPromoVisible:E,onUploadPromoClose:k,exploreSuggestedPromptQuestions:oe,exploreSuggestedPromptQuestionsLoading:se}),p&&a?d.jsx(tt,{anchor:"right",open:p,transitionDuration:250,PaperProps:{component:ct,style:{width:"100%"}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:d.jsx(Z,{onClick:i=>i.stopPropagation(),children:d.jsx(F,{isTOSAccepted:C,acceptMasterTOSState:u.masterTOSAcceptanceState,onCloseClick:()=>h(!1),onCompleteClick:()=>{C||c.userRoleId==null||s(B(c.userRoleId)),h(!1)}})})}):null]}),p&&!a?d.jsx(ve,{open:p,onClose:()=>h(!1),children:d.jsx(Qe,{children:he})}):null]})},Z=I(st)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
`,rt=
|
|
5
|
+
`,rt=I.div`
|
|
6
6
|
height: 100vh;
|
|
7
7
|
width: 100%;
|
|
8
|
-
`,lt=
|
|
8
|
+
`,lt=I.div`
|
|
9
9
|
height: 100vh;
|
|
10
10
|
width: 100%;
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
min-height: 0;
|
|
14
|
-
`,dt=
|
|
14
|
+
`,dt=I.div`
|
|
15
15
|
flex: 1;
|
|
16
16
|
min-height: 0;
|
|
17
17
|
display: flex;
|
|
18
18
|
flex-direction: column;
|
|
19
|
-
`,
|
|
19
|
+
`,ct=I(ot)`
|
|
20
20
|
box-shadow: ${({theme:t})=>t.colors.elevation2};
|
|
21
21
|
color: ${({theme:t})=>t.colors.grey4};
|
|
22
22
|
`;export{vt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as l}from"./liveblocks-
|
|
1
|
+
import{j as l}from"./liveblocks-8SEYIom7.js";import{a as f}from"./sentry-Bpr6hwv_.js";import{h as U,g as B,u as T,j as v,N as O,n as j,i as $,o as z,p as h}from"./core-D95G1COY.js";import{eT as N,Pc as A,OU as b,z7 as I,z1 as F,z5 as w,yW as L,OW as W,yZ as q,z9 as H,z8 as C}from"./zeni-epic-state-BnmnEdbj.js";import{m as P,z as k,B as V,a7 as Z,bH as G,af as _,bI as J}from"./index-C8tyyalR.js";import"./mui-jqvOLufq.js";import{i as K}from"./ReimbursementApprovalRuleDetailScreen-BtppAsqY.js";import M from"./NotFoundScreen-0h0DiOvj.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="51b92233-fdc1-4eee-946f-a340810774ff",e._sentryDebugIdIdentifier="sentry-dbid-51b92233-fdc1-4eee-946f-a340810774ff")}catch{}})();const R="bill-approval-rule-update",Q=j(function(e){return{approvalView:A(e),billPaySetupApproverViewUpdateData:b(e).billPaySetupApproverViewUpdateData}},function(e,o){const{navigate:t,location:p}=o;return{onApprovalRulesEventReceived:a=>{a.endsWith(R)&&e(W(!1))},onBackClick:()=>{_(p)?t("../../"):t("../../../bills/setup")},onDeleteRuleClick:a=>{e(L(a))},onEditRuleClick:a=>{a!=null?(e(w(a)),t(`./${a}/edit`)):(e(w()),t("./new"))}}})(Z(G)),X=()=>{const e=U(),o=B(),t=T(),[p,a]=f.useState(!1),[u,s]=f.useState(!1),d=P(),n=v(i=>i.billPaySetupApproverViewState.fetchState),c=v(i=>N(i)),r=v(i=>A(i)),g=v(i=>b(i).billPaySetupApproverViewUpdateData);if(f.useEffect(()=>{g?.updateStatus.fetchState==="Completed"&&t(I())},[g]),f.useEffect(()=>{p||n!=="Not-Started"||(a(!0),t(F(!0)))},[p,n,t]),k.getSignedInUser()==null)throw Error("Can't access billpay approval without signing in...");f.useEffect(()=>{r.allApprovalRules.length===0&&r.fetchState==="Completed"&&(u||(s(!0),t(w())),e("./new"))},[u,r,t]);const y={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${R}`]:[],eventCallback:(i,x,m)=>{i.endsWith(R)&&m.onApprovalRulesEventReceived(i)}};return c.companyBillPayInfo?.info?.isBillPayTOSAccepted===!1?l.jsx(O,{to:"../../promo"}):c.companyBillPayInfo?.info?.isBillPayTOSAccepted!==!0||r.fetchState!=="Completed"&&r.fetchState!=="Error"?l.jsx(V,{fetchState:"In-Progress",style:{backgroundColor:d.colors.grey5}}):l.jsx(Q,{currentTenant:c,location:o,navigate:e,...y})},Y=j(function(e,o){const t=b(e),p=t.billPaySetupApproverViewUpdateData?.type??"approval_create",a=p==="approval_create"&&t.allApprovalRules.length!==0;let u=t.allApprovalRules.length===0;return o.approvalRuleId&&(u=t.allApprovalRules.findIndex(s=>s.approvalRuleId===o.approvalRuleId)===0),{localData:t,hideUpperBoundField:a,isLowerBoundDisabled:u,approvalUpdateActionType:p}},function(e,o){const{navigate:t,approvalUpdateDataView:p,approverViewData:a,approvalRuleId:u}=o,s=p.billPaySetupApproverViewUpdateData?.type,d=_(o.location);return{onApprovalRuleDataUpdated:n=>{const c=r=>{const g=[];return r.forEach(y=>{const i=y.actors.selectedUsers.map(S=>({type:"user",userId:S.userId,isImplicitActor:!1})),x=y.actors.selectedNonUsers.map(S=>{const E=!!K(S.value);return{type:E?"attribute":"role",subType:S.value,userId:void 0,idType:void 0,isImplicitActor:!E}}),m=i.concat(x);g.push({action:y.stepType.selectedOption,actors:m,operator:m.length>1?y.stepType.selectedOption==="require_approval"?"or":"and":"is"})}),g};if(s==="approval_create"){const r={criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}else{const r={approvalRuleId:u,criteria:{rangeType:"range",rangeEntity:"currency",range:{min:{amount:n.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:n.upperBound,currencyCode:"USD",currencySymbol:"$"}}},steps:c(n.steps),isApplicableOnPendingApprovalEntity:n.applyToExistingBills.includes("applyToExistingBills")};e(C(r))}},onResetClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(I()),s==="approval_update"||d?t("../"):a.allApprovalRules.length===0&&a.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(H())},onSaveRuleSuccess:()=>{t("../")}}})(J);function D(){const e=U(),o=T(),t=B(),{approvalRuleId:p}=$(),a=k.getSignedInUser(),u=P(),s=v(r=>b(r)),d=v(r=>A(r)),[n,c]=f.useState(!1);if(f.useEffect(()=>{n||(c(!0),o(q(!0)))}),f.useEffect(()=>{d.fetchState==="Not-Started"&&e(p!=null?"../../":"../")},[d,p]),a==null)throw Error("Can't access address page without signing in...");return s.approverListFetchStatus.fetchState=="Not-Started"||s.approverListFetchStatus.fetchState==="In-Progress"?l.jsx(V,{fetchState:s.approverListFetchStatus.fetchState,style:{backgroundColor:u.colors.grey5}}):l.jsx(Y,{navigate:e,approvalUpdateDataView:s,approvalRuleId:p,approverViewData:d,location:t})}function se(){return l.jsxs(z,{children:[l.jsx(h,{path:"/",element:l.jsx(X,{})}),l.jsx(h,{path:"/new",element:l.jsx(D,{})}),l.jsx(h,{path:"/:approvalRuleId/edit",element:l.jsx(D,{})}),l.jsx(h,{path:"*",element:l.jsx(M,{})})]})}export{se as B};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-PtDFv95_.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-BZimyUuM.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as ya,zS as Sa,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Qa,P5 as Xa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as yn,kQ as Sn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-D1RAQ_Ab.js";import{m as me,z as V,A as Ie,Y as We,a as le,x as y,aN as xe,B as re,o as x,v as je,d as D,be as Ln,p as z,a2 as qe,q as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,D as _n,aH as Gn,y as Zt,O as Je,N as Ke,bi as Mn,at as Ht,bj as Nn,W as zn,f as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Xn,br as Yn,bs as ei,I as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-aKhhTDIh.js";import{n as O,S as si}from"./mui-BcLZDyi8.js";import{A as dt}from"./AddressScreen-BF-3RAYM.js";import{g as ie,a as Te,i as qt,V as Qe,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-BHpce-fZ.js";import{a as f}from"./sentry-mCXLUbmc.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import{u as Jt}from"./useInitialThreadRequest-ClxKOF2S.js";import Ee from"./NotFoundScreen-BVW1mHQl.js";import{D as ui}from"./DrawerScreen-QceXJJGv.js";import{M as Kt}from"./MobileAppDrawer-CLztF99b.js";import{F as Qt}from"./FeaturePreviewScreen-AUOPnl37.js";import{S as Pe}from"./SetupPagesScreen-Uer5YsTX.js";import{B as pi}from"./BillPayApprovalRoutes-QJ1EpW6M.js";import{FallBackRoute as mi}from"./ScreenRoutes-B-k_ZyHL.js";import"./recharts-Nefi66IQ.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./utils-C9yOAUzR.js";import"./analyticsHelper-DO0i_Ozz.js";import"./routePaths-DQbleX1q.js";import"./BusinessVerificationPageScreen-0dmMGz8A.js";import"./ReimbursementApprovalRuleDetailScreen-B5p0qX7h.js";import"./getLocaleForTenant-B-mnTkE0.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="69127630-aa3a-46ab-a5b2-488789b947ed",e._sentryDebugIdIdentifier="sentry-dbid-69127630-aa3a-46ab-a5b2-488789b947ed")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const n=De(i);n||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(Sa({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return i==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:M,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
|
|
1
|
+
import{j as a}from"./liveblocks-8SEYIom7.js";import{h as K,u as se,g as Q,i as ae,j as v,N as te,n as X,l as na,o as ia,p as S}from"./core-D95G1COY.js";import{eT as Z,Ou as Ue,bt as It,Js as oa,bo as wt,bF as pe,Ov as At,yr as Ct,zB as $e,y_ as la,bn as De,Ow as sa,Ox as ra,c3 as ca,Oy as da,kp as Bt,Oz as xt,OA as Et,Aa as _e,yG as Be,OB as ua,yf as tt,OC as pa,DS as ma,yj as ba,yp as Dt,OD as ke,OE as Ge,zC as Me,OF as ha,OG as ga,zF as Ne,OH as ya,zS as Sa,OI as jt,zm as at,zr as fa,OJ as ka,OK as ue,OL as Tt,OM as Pt,ON as Ft,gk as va,yL as Le,cy as Rt,OO as Ia,hC as wa,OP as Aa,OQ as Ca,fa as Vt,f8 as $t,OR as ze,OS as Ba,OT as xa,Me as Ze,OU as Ea,Mf as oe,Mg as He,OV as Da,OW as ja,OX as Ta,zt as nt,zq as Pa,OY as Fa,OZ as Ra,O_ as Va,zc as $a,O$ as La,P0 as Oa,P1 as Ua,cm as Lt,cN as Ot,kA as _a,bL as Ga,bq as Ut,bM as _t,xx as Ma,P2 as Na,DF as za,DL as Za,tX as Ha,zD as Wa,Ah as qa,kN as fe,P3 as Ja,P4 as Gt,lf as Ka,kH as Mt,l0 as Nt,k$ as it,bE as be,bK as Qa,P5 as Xa,P6 as ve,jk as Ya,P7 as ot,P8 as en,jo as tn,jJ as an,Av as nn,P9 as on,l8 as ln,Al as sn,Pa as lt,Ap as rn,Au as cn,Ar as dn,Aj as un,Pb as zt,yA as pn,Pc as mn,Pd as bn,gc as hn,gb as gn,ga as yn,kQ as Sn,l6 as st,lh as fn,rv as kn,kZ as vn,An as In,ju as wn,lm as An,Pe as Cn,jm as Bn,rm as xn,Pf as En,zi as Dn,bG as jn,bs as Tn,La as Pn,cP as Fn,cO as Rn,cx as Vn,cD as $n}from"./zeni-epic-state-BnmnEdbj.js";import{m as me,z as V,A as Ie,_ as We,f as le,c as y,aN as xe,B as re,o as x,N as je,d as D,be as Ln,p as z,a2 as qe,q as E,J as we,bf as rt,bg as ct,bh as On,ak as Un,D as _n,aH as Gn,y as Zt,O as Je,Q as Ke,bi as Mn,at as Ht,bj as Nn,X as zn,g as Wt,a7 as Zn,bk as Hn,bl as Wn,bm as qn,bn as Jn,bo as Kn,bp as Qn,bq as Xn,br as Yn,bs as ei,E as ti,bt as ai,b9 as ni,bu as ii,bv as oi,a9 as li}from"./index-C8tyyalR.js";import{n as O,S as si}from"./mui-jqvOLufq.js";import{A as dt}from"./AddressScreen-DyCQJjNT.js";import{g as ie,a as Te,i as qt,V as Qe,b as Xe,c as ri,v as ci,d as di,A as he,D as ge}from"./DomesticWireDetailScreen-DN6hsoHQ.js";import{a as f}from"./sentry-Bpr6hwv_.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-CE4sjmcs.js";import{u as Jt}from"./useInitialThreadRequest-DzF6un_U.js";import Ee from"./NotFoundScreen-0h0DiOvj.js";import{D as ui}from"./DrawerScreen-C3rL34Nr.js";import{M as Kt}from"./MobileAppDrawer-D8HOXn7v.js";import{F as Qt}from"./FeaturePreviewScreen-Bq9eSSz9.js";import{S as Pe}from"./SetupPagesScreen-D-neLjJM.js";import{B as pi}from"./BillPayApprovalRoutes-BiuKI-Rl.js";import{FallBackRoute as mi}from"./ScreenRoutes-BoQ6iXAM.js";import"./recharts-B5BD4Kau.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./utils-kj_q6fLI.js";import"./analyticsHelper-aSqJwcvL.js";import"./routePaths-STLgTv0l.js";import"./BusinessVerificationPageScreen-fLqoQmHN.js";import"./ReimbursementApprovalRuleDetailScreen-BtppAsqY.js";import"./getLocaleForTenant-HT8Btw6T.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]="b13fc008-6d8c-4f50-9f1d-99e1039ed4ad",e._sentryDebugIdIdentifier="sentry-dbid-b13fc008-6d8c-4f50-9f1d-99e1039ed4ad")}catch{}})();const bi=X(function(e,t){const l=Ue(e,t.billId),i=V.getSignedInUser(),c=e.tenantState.currentTenantId,r={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=z(t.location.state?.pathnameStackToGoBack);let o=!0;u.poppedPathname?.includes("bills")===!0&&(o=!1);let s=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`;const n=De(i);n||!l.createdBy?.email?.includes("zeni.ai")||(s="Zeni");let d=!1,p=!1;if(l?.billActivities.length>0){const{isApprovalorRejectBtnVisible:g,isMarkAsPaidBtnVisible:b}=sa(l.billActivities,ra(t.currentTenant),i);d=g,p=b}const m=ca(t.currentTenant?.userRole??[]),h=l.transactionDetails!=null&&da(l.transactionDetails,m,i);return{billDetails:l,isAccountingClassesEnabled:Bt(e),createdBy:s,authParams:r,transactionAttachmentEndpoint:`${qe}/transaction_attachment`,signedInUser:i,showBackButton:o,isAdmin:m,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,showApproveRejectBtns:d,showMarkAsPaidButtonToApprover:p,hasZeniAssistAccess:t.hasZeniAssistAccess,analytics:D,showMarkAsPaidButtonToCreator:h,isZeniUser:n}},function(e,t){const{billId:l,currentTenant:i,location:c,navigate:r}=t,{tenantEmailDomain:u}=i;return{redirectToBillsScreen:()=>{const o=ie(u),s=E(c.state?.pathnameStackToGoBack,c.pathname);r(o,{state:{pathnameStackToGoBack:s}})},redirectToEditableBillScreen:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}})},discardBillDetailsFromLocalStore:()=>{e(ke({}))},deleteBill:o=>{D.trackBillPayDeleteBill(l,o),e(Dt(l))},cancelAndDeleteBill:(o,s)=>{s===!0?D.trackBillPayCancelAndDeleteBill(l,o):D.trackBillPayCancelBill(l),e(ba(l,s))},onSaveRealTimeApprovals:o=>{e(ma(l,"bill_pay",o))},updateEditRealTimeApproverClicked:o=>{e(pa({isEdit:o,entityId:l,entityType:"bill_pay"}))},approveOrRejectBill:o=>{o.type==="approved"?e(tt(l,o.type,"")):e(tt(l,o.type,o.description??""))},retryOrRefundBill:o=>{o.type==="retry"?e(Be(l,"retry")):e(Be(l,"refund"))},onAddNewRule:()=>{r("../../bills/approval-rules")},onAttachmentClick:(o,s)=>{const n=Te(u,o,s),d=E(c.state?.pathnameStackToGoBack,c.pathname);r(n,{state:{pathnameStackToGoBack:d}})},onBackClick:()=>{const o=z(t.location.state?.pathnameStackToGoBack),s=o.poppedPathname??ie(u);r(s,{state:{pathnameStackToGoBack:o.newStack}})},onRetryPaymentClick:()=>{const o=E(c.state?.pathnameStackToGoBack,c.pathname);r("./edit",{state:{pathnameStackToGoBack:o}}),e(ua({billId:t.billId}))},onRefundPaymentClick:()=>{e(Be(t.billId,"refund"))},saveBillDetails:(o,s,n)=>{o&&e(Et({data:n,billId:l})),e(_e(o?"paid":"pending_approval",o,s,l))},discardOutsideZeniPaymentData:()=>{e(xt({billId:l}))}}})(Ln);function hi(){const e=K(),t=se(),l=Q(),{billId:i}=ae(),c=me(),r=V.getSignedInUser(),u=Ie(),o=v(M=>Z(M)),s=v(M=>Ue(M,i??"")),n=s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1,d=Jt(o?.companyId,{clearParams:s.fetchState==="Completed"&&!n}),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=Ye({mobileExploreReferrer:"Bill Details"});We({isDataReady:s.fetchState==="Completed"});const h=o?.userRole!=null&&It(o?.userRole),g=o?.company==null||o.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!h,[b,k]=f.useState(!1),[j,A]=f.useState(!1),[C,_]=f.useState(!1),{useFeatureGate:T,useDynamicConfig:U}=le(),{isFeatureEnabled:$}=T(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:I}=T(y.isBillPayCommentingEnabled),{isFeatureEnabled:H}=T(y.isBillPayDetectInsufficientFundsEnabled),{configValue:G}=U(xe.zeniAssistConfig),B=oa(o),q=wt(o.userRole),W=g&&pe(u?.loggedInUserRoleMap),L=G.user_ids!=null&&r?.userId!=null&&G.user_ids.includes(r?.userId),{isFeatureEnabled:J}=T(y.isInternationalPaymentShaVsOurFeatureEnabled),{isFeatureEnabled:Y}=T(y.billPaySetupShowInternationalPaymentByWise);if(f.useEffect(()=>{$&&s.transactionDetails?.isDeleted===!0||o.isZeni===!0&&r?.userEmailDomain==="zeni.ai"&&B===!1?_(!1):_(s.billActivities[0]?.isRealTimeApprovalEnabled&&(q||W||s.allApprovers.find(M=>M.user.userId===r?.userId)!=null||s.transactionDetails?.lastUpdatedByUserId===r?.userId))},[s.billActivities[0]?.isRealTimeApprovalEnabled,s.allApprovers,s.transactionDetails?.lastUpdatedByUserId,q,W,o.isZeni,B,r]),f.useEffect(()=>{i!=null&&t(At(i))},[i]),f.useEffect(()=>{b||s.fetchState=="Completed"||s.fetchState=="In-Progress"||(k(!0),t(Ct(i??"",$,L,!1)))},[b,s,i,t]),f.useEffect(()=>{j||s.fetchState!="Completed"||s.transactionDetails?.billPayInfo.stage.code=="paid"||(A(!0),t($e(!1,$,L,Y,i)),s.billActivities[0]?.isRealTimeApprovalEnabled===!0&&t(la()))},[j,s,i,t]),r==null)throw Error("Can't access address page without signing in...");return s.transactionDetails?.billPayInfo.stage.code==="draft"&&s.transactionDetails.isDeleted===!1?a.jsx(te,{to:`./edit${l.search}`}):s.deleteStatus.fetchState==="In-Progress"||s.cancelAndDeleteStatus.fetchState==="In-Progress"||s.cancelStatus.fetchState==="In-Progress"?a.jsx(re,{fetchState:s.deleteStatus.fetchState,style:{boxShadow:`0px 2px ${x.sp1} ${c.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[a.jsx(je,{analytics:D,onLoad:M=>(ee=>{i!=null&&ee.trackBillPayBillDetails(i,s.isRecurring)})(M)}),a.jsx(bi,{initialOpenThreadRequest:d??void 0,isShowDeletedBillsEnabled:$,location:l,navigate:e,isBillPayCommentingEnabled:I,isRealTimeApprovalEnabled:C,currentTenant:o,billId:i??"",isInternationalPaymentShaVsOurEnabled:J,hasZeniAssistAccess:L,isDetectInsufficientFundsEnabled:H,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})]})}const ye=Je.getLocalizedStrings().spendManagement.billPay.billDetails,gi={containerWidth:new Zt(100,58)},ut=X(function(e,t){const l=V.getSignedInUser(),i=e.tenantState.currentTenantId,c={userId:l?.userId??"",sessionId:l?.zeniSessionId??"",tenantId:i??""},r=t.showActionButtons,u=r&&t.file==null;return{uploadInvoiceEndPoint:`${Ht.communicationAgentMicroServiceBaseUrl}`,authParams:c,billId:t.billId,file:t.file,showAutofill:t.showAutofill,analytics:D,entityId:t.billId,showTitlebarIcon:r,showTitlebar:r&&t?.file!=null,uploadStatus:t.uploadStatus,shouldNotShowAttachment:u,style:{paddingTop:x.sp10,paddingRight:x.sp3,paddingBottom:"15px",paddingLeft:x.sp5,...t.showAutofill?{}:{backgroundColor:t.backgroundColor,paddingBottom:"128px"}}}},function(e,t){const l=V.getSignedInUser();return{onInvoiceUpload:i=>{i!=null&&(t.file!=null||t.billId!=null||t.isInitialEdit?(t.setPayload(i),t.setShowConfirmationPopup(!0)):e(Ne(i,t.isVendorRecommendationEnabled,t.billId)))},updateInvoiceUploadFetchState:i=>{e(Sa({fetchState:{fetchState:i,error:void 0},billId:t.billId}))},onSkipAutofill:i=>{D?.trackBillPaySkipAutofill(),e(Me(i))},onDeleteClick:()=>{e(ya({billId:t.billId})),D?.trackInvoiceActionClick(t.billStage??"","delete",l?.userEmail??"",null)}}})(Gn);function w({appContent:e}){const t=se(),l=K(),{billId:i}=ae(),c=Q(),r=c.pathname,u=r.includes("bill/new")||r.includes("/edit"),o=we(),s=me(),n=V.getSignedInUser(),{useFeatureGate:d,useDynamicConfig:p}=le(),{isFeatureEnabled:m}=d(y.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:h}=d(y.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:g}=d(y.isDepositAccountsFeatureEnabled),{isFeatureEnabled:b}=d(y.billPaySetupShowInternationalPaymentByWise),{configValue:k}=p(xe.zeniAssistConfig),j=k.user_ids!=null&&n?.userId!=null&&k.user_ids.includes(n?.userId),A=v(F=>Z(F)),[C,_]=f.useState(!1),[T,U]=f.useState(!1),[$,I]=f.useState(!1),[H,G]=f.useState(),B=v(F=>Ge(F,m,g,i));let q=B.fetchState,W=B.file,L=B.showAutofill;const J=v(F=>Ue(F,i??""));u===!1&&(q=J.fetchState,W=J.transactionDetails?.attachments?.[0],L=!1);const Y=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;f.useEffect(()=>{i==null&&t(Me(!0))},[i,t]),f.useEffect(()=>{q==="Not-Started"&&(u&&T?U(!1):!u&&C&&_(!1))},[i]),f.useEffect(()=>{C||i==null||u||(_(!0),t(Ct(i,h,j,!1)),T||(U(!0),t($e(!1,h,j,b,i)))),u&&!T&&(U(!0),t($e(!1,h,j,b,i)))},[C,T,u,i,t]);const M={onOkClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","yes"),t(ga({replaceBillData:!0,billId:i})),t(Ne(H,m,i))},onCancelClick:()=>{if(I(!1),!H)return;const F=W!=null?"replace":"upload";D?.trackInvoiceActionClick(Y??"",F,n?.userEmail??"","no"),t(ha({file:H,billId:i}))}},ee=f.useCallback(()=>{const F=z(c.state?.pathnameStackToGoBack),ce=F.poppedPathname??ie(A.tenantEmailDomain);t(ke({billId:i})),l(ce,{state:{pathnameStackToGoBack:F.newStack}})},[c.state,A.tenantEmailDomain,i,t,l]);if(n==null)throw Error("Can't access address page without signing in...");if(q==="Error"||J.fetchState==="Error")return a.jsx(Ee,{});if(q!="Completed")return i==null&&o!=="small"?a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[a.jsx(mt,{}),a.jsx(Re,{}),a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:!0,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:void 0,setShowConfirmationPopup:I,setPayload:G,showActionButtons:!1,isInitialEdit:!!B.isInitialEdit,billStage:Y}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:!0})})]})}):a.jsxs(Fe,{windowSize:o,children:[o==="small"||L?null:a.jsx(pt,{children:a.jsx(Xt,{onClick:ee,"data-testid":"nav-bar-back-click"})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(On,{}),a.jsx(Ve,{windowSize:o,children:a.jsx(ct,{isNewBill:i==null})})]});{const F=B.billPayInfo!=null&&B.billPayInfo.stage.code==="pending_approval"?B.billPayInfo.billStatus.code:B.billStage;return a.jsx(rt,{fallback:ee,children:a.jsxs(Fe,{windowSize:o,children:[L&&o!=="small"?a.jsx(mt,{}):null,$?a.jsx(Un,{titleComponent:a.jsx(wi,{children:ye.overwriteTitle}),descriptionComponent:a.jsx(Ai,{children:ye.overwriteDescription}),primaryButtonText:ye.buttons.yes,secondaryButtonText:ye.buttons.no,action:M,isEditPopup:!0}):null,o==="small"||L?null:a.jsx(pt,{children:a.jsx(yi,{})}),o!=="small"?a.jsx(Re,{}):null,a.jsx(ut,{backgroundColor:s.colors.grey4,billId:i,file:W,showAutofill:L,uploadStatus:B.uploadStatus,isVendorRecommendationEnabled:m,attachmentTitle:Si(u,J,B),setShowConfirmationPopup:I,setPayload:G,showActionButtons:fi(u,B),isInitialEdit:!!B.isInitialEdit,billStage:F}),a.jsx(Ve,{windowSize:o,children:e})]})})}}function yi(){const{triggerBack:e}=Mn();return a.jsx(Xt,{onClick:e,"data-testid":"nav-bar-back-click"})}function Si(e,t,l){let i,c;return e?(i=l.recurringConfig?.currentInstance,c=l.recurringConfig?.totalPaymentCycles):(i=t.transactionDetails?.recurringBillInstance,c=t.recurringBillConfigDetail?.totalPaymentCycles),t?.isRecurring===!0?a.jsxs(ki,{children:[a.jsx(vi,{children:`${ye.recurringBill.recurringCycle}
|
|
2
2
|
${i}/${c}`}),a.jsx(Ii,{})]}):void 0}function fi(e,t){const l=t.billActivities?.[0],i=t.billStage==="pending_approval"&&l?.areApprovalsSerialized===!0&&l?.currentPendingStepIndex===0;return e&&(t.billStage==="draft"||i)}const pt=O.div`
|
|
3
3
|
margin-bottom: 20px;
|
|
4
4
|
margin-top: 20px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as k}from"./liveblocks-
|
|
1
|
+
import{j as k}from"./liveblocks-8SEYIom7.js";import{a as V}from"./sentry-Bpr6hwv_.js";import{h as ae,g as ne,u as se,i as ie,j as C,N as oe,n as re}from"./core-D95G1COY.js";import{A as ce,f as ue,aN as de,z as E,N as pe,d as z,af as x,g as P,bD as le,at as me,q as B,au as R}from"./index-C8tyyalR.js";import{P0 as fe,eT as G,tm as ye,Jv as Se,zc as ge,Cn as Ie,EY as be,FB as he,GC as Oe,Pn as Te,Po as De,Pp as ke,Pq as Ce,Pr as Ve,LY as we,Op as Ne,M7 as Ae,l5 as ve,gc as _e,gb as Fe,ga as xe,rv as Pe,rm as Ee,rj as ze,kZ as Be,tv as Re,tt as L,bE as M,tH as j,cw as Le}from"./zeni-epic-state-BnmnEdbj.js";import{n as Me}from"./mui-jqvOLufq.js";import{d as U}from"./routePaths-STLgTv0l.js";import{M as je}from"./MobileAppDrawer-D8HOXn7v.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new e.Error().stack;d&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[d]="e25988a6-ca6a-4bd9-8dfa-c22a61735b55",e._sentryDebugIdIdentifier="sentry-dbid-e25988a6-ca6a-4bd9-8dfa-c22a61735b55")}catch{}})();const Ue=Me.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -6,4 +6,4 @@ import{j as k}from"./liveblocks-PtDFv95_.js";import{a as V}from"./sentry-mCXLUbm
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},
|
|
9
|
+
`,Ge=re(function(e,d){const{businessVerificationDetails:i}=d,r=G(e),y=E.getSignedInUser(),S=r.tenantId,l={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},h=we(d.roleMap)&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",t=Ne(e.companyConfigState),s=Ae(e.userRoleConfigState);return{businessVerificationDetails:i,verficationDetailsFetchState:i.fetchState,isRefreshingViewInBackground:i.isRefreshingViewInBackground,allNationalityCountries:i.allNationalityCountries,filesEndPoint:`${me.fileMicroServiceBaseUrl}`,authParams:l,isDisabled:h,allIndustries:t.companyIndustries??[],companyTitles:s.companyTitles}},function(e,d){const{companyId:i,productType:r,currentTenant:y,navigate:S,location:l}=d,{tenantEmailDomain:h}=y;return{onCompanyDetailsChanged:t=>{const{companyDescription:s,companyIndustry:p,companyIndustryType:T,companyLegalName:D,companyTaxId:g,companyWebsite:m,companyPhone:I,primaryContactEmail:c,primaryContactName:n,primaryContactUserId:u,primaryContactSyncToken:O,syncToken:f,fileIds:a,incDate:o,typeOfIncorporation:w,stateOfIncorporation:N,sourceOfFunds:A,companySubIndustry:v,countriesOfOperations:b,companySourceOfFunds:q,companySourceOfFundsDescription:Z,transactionVolume:Y,transactionVolumeDescription:$,purposeOfAccount:H,purposeOfAccountDescription:J,regulatedStatus:W,regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X}=t,_=T?.selectedOption,ee={companyId:i,companyDescription:s,companyIndustry:p.selectedOption,companyIndustryType:_==null||_===""?void 0:_,companyLegalName:D,taxIdOrEIN:g,website:m!=""&&m!=null?Le(m):void 0,phone:I,syncToken:f,fileIds:a,incDate:o!=null?M(o?.toString()):o,typeOfIncorporation:w?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:A?.selectedOption??"",companySubIndustry:v?.selectedOption??"",countriesOfOperations:b?.selectedOptions.map(F=>F.length===2?F:R(F))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:Z,transactionVolume:Y?.selectedOption??"",transactionVolumeDescription:$,purposeOfAccount:H?.selectedOption??"",purposeOfAccountDescription:J,regulatedStatus:W??"",regulatedStatusDescription:K,usNexus:Q,usNexusTypes:X?.selectedOptions??[]},te={userId:u,firstName:n.firstName,lastName:n.lastName,email:c,syncToken:O};e(j({companyDetails:ee,primaryContactDetails:te}))},onCompanyOfficerUpdated:t=>{const s=t.map(p=>{const{officerType:T,userId:D,name:g,email:m,nationalityCountryCode:I,ssn:c,dob:n,phone:u,syncToken:O,selectDocument:f,role:a,ownership:o,isSelectedForVerification:w,userVerificationStatus:N,treasuryUserVerificationStatus:A,fileIds:v}=p;let b;return f.selectDocumentType==="driverLicense"?b="driving_license":f.selectDocumentType==="passport"?b="passport":f.selectDocumentType==="stateId"?b="id_document":f.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:T,userId:D,firstName:g.firstName,lastName:g.lastName,email:m,ssn:c,nationalityCountryCode:I?.selectedOption!=null?R(I.selectedOption):void 0,phone:u,birthday:n!=null?M(n?.toString()):n,syncToken:O,titleAtCompany:a.selectedOption,ownershipInCompany:o,documentTypeSelectedForVerification:b,isSelectedForVerification:w,userVerificationStatus:N,treasuryUserVerificationStatus:A,fileIds:v,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}});e(j({officers:s}))},onSaveDetailsClick:t=>{e(L(i,t,r))},onSendForVerificationClick:t=>{e(L(i,t,r,!0))},onAddressClick:t=>{const s=U(h,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onRegisteredAddressClick:t=>{const s=U(h,t),p=B(l.state?.pathnameStackToGoBack,l.pathname);S(s,{state:{pathnameStackToGoBack:p}})},onBackClick:()=>{e(Re({companyId:i})),S("../setup")},updateFilesEntity:t=>{e(Be({files:t}))},onDeleteFile:t=>{e(ze(t))},onDeleteFileList:t=>{e(Ee(t))},onEditFileName:(t,s)=>{e(Pe(t,s.split(".")[0]))},onGetOtp:t=>{e(xe(t,"SpendManagementSetup"))},onResendOtp:t=>{e(Fe(t,"SpendManagementSetup"))},onVerifyOtp:(t,s)=>{e(_e(t,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(t,s)=>{e(ve({addressType:t,addressToCreate:s}))}}})(le),Qe=({productType:e})=>{const d=ae(),i=ne(),r=se(),[y,S]=V.useState(!1),[l,h]=V.useState(!1),{tenantEmailDomain:t}=ie(),s=ce(),{useDynamicConfig:p}=ue(),{configValue:T}=p(de.zeniAccountsConfig),D=fe(T),g=C(a=>{switch(e){case"zeni_accounts":return a.zeniAccountSetupViewState.fetchState;case"reimbursement":return a.remiSetupViewState.fetchState;case"charge_cards":return a.chargeCardSetupViewState.fetchState;case"zeni_treasury":return a.treasurySetupViewState.fetchState;default:return a.billPaySetupViewState.fetchState}}),m=C(a=>a.companyConfigState.fetchState),I=C(a=>a.userRoleConfigState.fetchState),c=C(a=>G(a)),n=c.companyId??E.getSignedInUserTenant(t)?.companyId;if(V.useEffect(()=>{m==="Not-Started"&&r(ye()),I==="Not-Started"&&r(Se(!0))},[m,I,r]),V.useEffect(()=>{if(!y&&g==="Not-Started"&&n!=null)switch(S(!0),e){case"zeni_accounts":r(Oe(n,!0));break;case"zeni_treasury":r(he(n,!0));break;case"reimbursement":r(be(n,!0));break;case"charge_cards":r(Ie(n,!0));break;default:r(ge(n,!0))}},[y,g,n,r]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let u;switch(e){case"zeni_accounts":u=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":u=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":u=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":u=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:u=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const O=a=>{h(a)},f=C(a=>{let o;switch(e){case"zeni_accounts":o=Ve(a,n);break;case"zeni_treasury":o=Ce(a,n);break;case"charge_cards":o=ke(a,n);break;case"reimbursement":o=De(a,n);break;default:o=Te(a,n)}return o});return u===!1?k.jsx(oe,{to:"../promo"}):k.jsxs(Ue,{children:[k.jsx(pe,{analytics:z,onLoad:a=>(o=>{switch(e){case"zeni_accounts":return o.trackPageLoaded(P.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return o.trackPageLoaded(P.Event.reimbursementBusinessVerification);default:return o.trackPageLoaded(P.Event.billPayBusinessVerification,x(i)?"Settings":void 0)}})(a)}),x(i)?k.jsx(je,{isAppContentDrawerOpen:l,handleDrawerToggle:O}):null,k.jsx(Ge,{businessVerificationDetails:f,navigate:d,location:i,companyId:n,analytics:z,currentTenant:c,productType:e,isSettings:x(i),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{O(!0)},maxInsuredAmount:D.maxInsuredAmount})]})};export{Qe as B};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{j as b}from"./liveblocks-
|
|
1
|
+
import{j as b}from"./liveblocks-8SEYIom7.js";import{a as i}from"./sentry-Bpr6hwv_.js";import{n as z}from"./utils-kj_q6fLI.js";import{u as Ie,h as we,g as Ee,j as T,i as ke,n as ve}from"./core-D95G1COY.js";import{V as Ae,f as Te,c as W,z as Oe,d2 as Ue,d4 as Fe,b5 as ee,N as _e,d as V,d5 as G,dc as xe,O as Qe,g as De,a7 as Le,d8 as $e,a2 as Ve,dd as Re,b1 as He,db as Me}from"./index-C8tyyalR.js";import{gg as je,g1 as Ne,g2 as Y,g3 as qe,fM as te,g4 as Be,g5 as ze,eS as se,eT as We,g6 as Ge,eZ as Ye,iC as Ze,iy as Je,eU as Z,fF as Ke,fG as Xe,fH as et,fI as tt,fJ as st,fK as at,fL as ot,fN as nt,fO as it,fP as J,bE as K,fQ as rt,fR as lt,fS as dt,fT as ct,fU as ut,fV as mt,fy as ft,fC as X,fW as pt,fX as Ct,fY as St,fZ as ht,f_ as gt,f$ as bt,g0 as yt}from"./zeni-epic-state-BnmnEdbj.js";import{D as Pt,n as H,P as It,S as wt}from"./mui-jqvOLufq.js";import{d as Et}from"./recharts-B5BD4Kau.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="63003251-d11e-43bf-8ac1-aa1401556fb0",e._sentryDebugIdIdentifier="sentry-dbid-63003251-d11e-43bf-8ac1-aa1401556fb0")}catch{}})();const kt=e=>yt(e,!1),vt=e=>bt(e.name,!1),ae="chat-response-generated",oe="cards/ask",ne="card_policy_hero";function R(e){return`/${e}/cards`}function ie(e){return`/${e}/cards/policy`}const At=ve(function(e,r){const s=se(e),C=r.isSubmitting,c=e.cardPolicyState,m=Ke(c),d=Xe(c),S=et(c);return{showSampleQuestions:r.sessionFromUrl==="new_chat"&&s.uiState.currentChatSessionId==null,aiCfoView:s,isSubmitting:C,isNewChatSession:r.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${Ve}/tableDownload`,emailLinkQuestion:r.emailLinkQuestion,autoSubmitEmailLinkQuestion:r.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:r.onEmailLinkQuestionProcessed,isFileUploadEnabled:r.isFileUploadEnabled,isUploadPromoVisible:r.isUploadPromoVisible,onUploadPromoClose:r.onUploadPromoClose,allUsers:r.allUsers,cardPolicyCategorySearchOptions:m.map(kt),cardPolicyVendorSearchOptions:d.map(vt),cardPolicyIsVendorSearchLoading:S==="In-Progress",cardPolicyDocumentUploadState:ot(c),cardPolicyUploadedFileName:at(c),cardPolicyFormDraft:st(e.createCardPolicyState),cardsCreationFormDraft:tt(e)}},function(e,r){const{location:s,currentTenant:C,userId:c,navigate:m,currentChatSessionId:d,allSessionsWithOrderedQuestionAnswers:S,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,cardPolicyPageContext:k}=r,f=C.tenantEmailDomain,U=s.state?.referrer,u=U===ne?ie(f):R(f);return{onEventReceived:(a,l)=>{if(a===ae&&typeof l.text=="string"&&typeof l.metadata=="object"){const t=l,n=Ct(t.type),p=t.metadata.chat_session_id??null,{currentChatSession:F,currentQuestionAnswer:v,currentQuestionAnswerSummary:P}=ee(S,p);n!=="answer"?V.trackAICFOChatResponseGenerated(n,v?.question.questionText??"",t.text,p,Me(P,F),t.metadata.message_id??null):V.trackAICFOChatAnswerGenerated(t.text,v?.question.questionText??"",(t.follow_up_questions?.length??0)>0,!!t.assumptions,!!t.insights,t.visualization!=null,St(t.visualization?.type??"")??null,p,t.summarized_title,t.metadata.message_id??null),e(ht({chatSessionId:t.metadata.chat_session_id,responseType:n,fetchState:{fetchState:"Completed",error:void 0}})),e(gt({chatSessionId:t.metadata.chat_session_id,answerPayload:t,userId:c}))}},onSubmit:(a,l,t,n)=>{a&&He(e,a,l,d,S,c,n,t,k)},updateCurrentInput:a=>{e(X(a))},onStopSubmit:()=>{},onUpdateScrollYOffset:a=>{e(pt(a))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(u,{state:{...s.state}}),e(X(""))},togglePageView:()=>{m(u,{state:{...s.state}}),r.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{d!=null&&e(ft()),m(function(a){return`/${a}/${oe}`}(f),{state:{...s.state}})},onToggleCotCollapsed:(a,l)=>{e(mt({questionAnswerId:a,isCollapsed:l}))},onCardsCreationFormChange:E?a=>{e(ut(a))}:void 0,onCardsCreationFormSubmit:E?(a,l)=>{const t=lt(a);t.length!==0&&(e(dt(t)),e(ct({sourceChatSessionId:d??void 0})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_cards",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(R(f),{state:{...s.state}}))}:void 0,onCardPolicyFormChange:y?a=>{e(rt(a))}:void 0,onCardPolicyFormSubmit:y?(a,l)=>{const t=Re({values:a});e(it({templates:[t],sourceChatSessionId:d})),d!=null&&e(J({chatSessionId:d,id:z(),kind:"creating_policy",createdAt:K(""),sourceQuestionAnswerId:l})),r.setIsAiCfoOpen(!0),m(`/${f}/cards/policy`,{state:{...s.state}})}:void 0,onCardPolicyUploadDocument:y?(a,l,t)=>{a.length!==0&&e(nt(a,l,t))}:void 0,onCardPolicyRemoveDocument:y?()=>{e(te())}:void 0}})(Le($e)),{spendManagement:{chargeCard:{cardsAiCfoHero:re,cardPolicyAiCfoHero:le}}}=Qe.getLocalizedStrings(),O=re.pageTitle,Tt=le.pageTitle,Ot=re.chatHeaderSubtitle,Ut=le.chatHeaderSubtitle,Yt=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:r}=Ae(),s=Ie(),C=we(),c=Ee(),[m,d]=i.useState(!1),{useFeatureGate:S}=Te(),{isFeatureEnabled:E}=S(W.isAiCardCreationEnabled),{isFeatureEnabled:y}=S(W.isCardPolicyEnabled);i.useEffect(()=>{s(je())},[s]),i.useEffect(()=>(s(Ne()),s(Y()),s(qe("cardHolderCandidate",!1)),()=>{s(te())}),[s]);const k=T(o=>Be(o).fetchState);i.useEffect(()=>{k==="Not-Started"&&s(ze(!1,!1,!1))},[k,s]);const f=i.useMemo(()=>Et(o=>{s(Y(o))},250),[s]);i.useEffect(()=>()=>{f.cancel()},[f]);const U=i.useCallback(o=>{f(o)},[f]),u=T(o=>se(o)),a=Oe.getSignedInUser(),{session_id:l}=ke(),t=T(o=>We(o)),n=u.uiState.currentChatSessionId,p=t.tenantEmailDomain,{handleUploadPromoClose:F,isUploadPromoVisible:v}=Ue({isFileUploadEnabled:e,tenantEmailDomain:p}),P=c.state,h=P?.aiCfoInitialQuestion??null,_=!!P?.aiCfoShouldSubmit,I=P?.referrer===ne,de=I?"card_policy":void 0,ce=i.useMemo(()=>({title:I?Tt:O,subtitle:I?Ut:Ot}),[I]),[ue,x]=i.useState(null),[me,Q]=i.useState(!1),D=i.useRef(!1);i.useEffect(()=>{D.current||h==null||h===""||(x(h),Q(_),D.current=!0)},[h,_]);const fe=i.useCallback(()=>{x(null),Q(!1)},[]),pe=t.masterTOSInfo,g=pe?.isMasterTOSAccepted??!1,A=i.useRef(null);i.useEffect(()=>{if(g&&A.current!=null){const{question:o,shouldSubmit:w}=A.current;A.current=null,x(o),Q(w),D.current=!1}},[g]);const{visitedSessions:M}=Fe(n),L=u.fetchState,$=u.uiState.chatSessionsNextPageToken.hasMore||!u.uiState.chatSessionsFirstPageFetched,j=n!=null?u.fetchChatSessionHistoryByChatSessionId?.[n]?.fetchState??"Not-Started":"Not-Started",N=n==null||(u.uiState.chatHistoryNextPageToken[n]?.hasMore??!0),q=u.allSessionsWithOrderedQuestionAnswers,B=T(o=>Ge(o.userState,o.userRoleState,o.userListViewState,"cardHolderCandidate")).users,Ce=i.useMemo(()=>B.map(o=>o.user).filter(o=>o!=null),[B]),{currentSessionQuestionAnswers:Se}=ee(q,n),he=Se.length===0;i.useEffect(()=>{n!=null&&l!==n&&C(function(o,w){return`/${o}/${oe}/${w}`}(p,n),{state:{...c.state},replace:!0})},[n,l,p,C,c.state]),i.useEffect(()=>{l!=null&&n==null&&l!=="new_chat"&&s(Ye({sessionId:l,agentId:"controller"}))},[]);const ge=i.useMemo(()=>({events:M.map(o=>`private-encrypted-chat-${o}.${ae}`),eventCallback:(o,w,Pe)=>Pe.onEventReceived(o,w)}),[M]);if(i.useEffect(()=>{L!=="In-Progress"&&$&&s(Ze())},[L,$,s]),i.useEffect(()=>{n!=null&&j!=="In-Progress"&&N&&a!=null&&L==="Completed"&&!$&&s(Je(n,a.userId))},[j,N,n,a,s]),a==null)throw Error("Can't access Cards AI CFO page without signing in...");const be=l??"new_chat",ye=n!=null&&u.responseStateByChatSessionId?.[n]?.answer?.fetchState==="In-Progress";return b.jsxs(_t,{children:[b.jsx(_e,{analytics:V,onLoad:o=>o.trackPageLoaded(De.Event.aiCFOPage)}),g?b.jsx(At,{...ge,currentChatSessionId:n,allSessionsWithOrderedQuestionAnswers:q,allUsers:Ce,isAiCardCreationEnabled:E,isCardPolicyEnabled:y,openOnboardingPage:()=>d(!0),userId:a.userId,setIsAiCfoOpen:r,navigate:C,sessionFromUrl:be,location:c,isSubmitting:ye,isEmptyChatWithSession:he,customPageTitle:O,chatHeader:ce,currentTenant:t,emailLinkQuestion:ue??void 0,autoSubmitEmailLinkQuestion:me,onEmailLinkQuestionProcessed:fe,isFileUploadEnabled:e,isUploadPromoVisible:v,onUploadPromoClose:F,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:de}):b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>{C(I?ie(p):R(p),{state:{...c.state}})},onCompleteClick:()=>{g||t.userRoleId==null||(h!=null&&h!==""&&(A.current={question:h,shouldSubmit:_}),s(Z(t.userRoleId)))}}),b.jsx(Pt,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:xt,style:{width:`${xe}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>d(!1),children:b.jsx(Ft,{onClick:o=>o.stopPropagation(),children:b.jsx(G,{isTOSAccepted:g,acceptMasterTOSState:u.masterTOSAcceptanceState,customPageTitle:O,onCloseClick:()=>d(!1),onCompleteClick:()=>{g||t.userRoleId==null||s(Z(t.userRoleId)),d(!1)}})})})]})},Ft=H(wt)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
`,
|
|
5
|
+
`,_t=H.div`
|
|
6
6
|
flex: 1 1 auto;
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
min-height: 0;
|
|
10
10
|
width: 100%;
|
|
11
|
-
`,
|
|
11
|
+
`,xt=H(It)`
|
|
12
12
|
box-shadow: ${({theme:e})=>e.colors.elevation2};
|
|
13
13
|
color: ${({theme:e})=>e.colors.grey4};
|
|
14
14
|
`;export{Yt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-PtDFv95_.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as At,n as De,t as yn,o as as,p as se}from"./core-BZimyUuM.js";import{bs as Pe,QX as ts,QY as ns,fM as ln,QZ as In,fF as kn,Q_ as En,Q$ as An,R0 as Dn,R1 as _n,fG as Pn,fH as wn,R2 as vn,g1 as Tn,g2 as $a,R3 as Fn,R4 as rs,fL as ss,fK as cs,R5 as os,g4 as Rn,g5 as sa,R6 as is,R7 as ds,fO as ls,fN as us,R8 as xn,hC as Qe,g0 as Bn,f$ as Ln,R9 as ms,eV as Cs,A_ as ps,AZ as hs,B1 as fs,B3 as gs,e$ as bs,eS as On,Ra as Ss,Rb as ys,f4 as Un,Rc as Is,f5 as jn,B9 as ks,B6 as Es,eT as fe,Rd as Qa,f8 as we,f9 as ve,fa as Te,gr as ca,ct as oa,Re as ia,Rf as Dt,uA as za,kx as Za,Rg as Ya,BH as ka,BJ as qe,BK as _t,kn as Mn,Rh as da,Bv as _a,Ri as As,Rj as Ds,By as Ja,Rk as _s,Pk as Xa,eX as Nn,BE as ga,hN as Ps,Rl as Vn,Rm as la,bq as ws,Rn as vs,gc as et,gb as at,Cc as Ts,ga as tt,P0 as Fs,Ro as Hn,cm as Gn,cN as Rs,Pj as wa,CN as $n,Rp as un,Cn as Pa,Rq as zn,CO as xs,PM as Bs,CP as Ls,DL as Os,tX as Us,DF as js,Rr as Ms,BI as na,Rs as Ns,Rt as Vs,Ru as Hs,Rv as Gs,Rw as $s,Rx as Pt,Ry as zs,BZ as Zn,BS as Zs,Rz as Ys,gt as Ks,C6 as Yn,Ca as Kn,gs as Ws,RA as qs,Cz as Wn,RB as Qs,RC as Js,RD as Xs,C8 as qn,BV as Qn,BB as Jn,C2 as Xn,C0 as er,C4 as ec,RE as ar,RF as ac,f1 as tc,f2 as nc,f3 as rc,RG as nt,g6 as tr,cO as wt,RH as sc,RI as cc,RJ as oc,RK as ic,Ci as St,CG as dc,CC as lc,Ce as uc,CE as mc,Cu as Cc,Cw as pc,RL as nr,CM as Ga,Js as hc,RM as fc,RN as gc,RO as bc,RP as rr,RQ as Sc,D7 as yc,Cm as sr,Ch as je,Cl as Ic,RR as kc,RS as Ec,Bs as Ac,RT as cr,eW as or,RU as Dc,Bu as _c,Bt as mn,RV as Pc,RW as wc,RX as vc,LZ as Tc,RY as vt,RZ as Fc,xA as ir,l5 as Rc,hD as xc,Dc as Bc,R_ as dr,fS as Lc,fT as Oc,R$ as Uc,df as jc,g3 as Mc,D2 as Nc,CY as We,bt as Vc,bF as Hc,cy as Gc,bG as $c,La as zc}from"./zeni-epic-state-D1RAQ_Ab.js";import{A as Fe,cf as lr,p as _e,cg as ur,ch as mr,ci as Zc,O as ua,Y as Tt,cj as Yc,ck as Kc,V as Cr,c as pr,X as hr,q as ye,a as le,x as K,aq as ya,cl as fr,cm as Wc,cn as qc,z as re,B as va,c4 as rt,co as Qc,cp as Jc,cq as Xc,cr as eo,cs as ao,J as Ta,aN as ze,bo as Ft,ct as to,y as Fa,i as st,m as Rt,d as J,a7 as ct,cu as no,bA as ba,cv as yt,cw as ro,v as xt,cx as so,at as gr,a2 as It,cy as co,W as br,f as Sr,cz as oo,cA as io,cB as lo,cC as uo,cD as mo,cE as Co,o as Ka,cF as po,cG as ho,cH as pt,I as fo,cI as go,cJ as bo,cK as So,cL as yo,cM as Io,a9 as ko}from"./index-aKhhTDIh.js";import{n as Ne,D as yr,S as Eo}from"./mui-BcLZDyi8.js";import{a as r}from"./sentry-mCXLUbmc.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-BY9akMo_.js";import{M as Ie}from"./MobileAppDrawer-CLztF99b.js";import{d as Bt}from"./recharts-Nefi66IQ.js";import{g as Ae,a as xa,b as Ir,c as Re,d as xe,e as Je,f as Xe,h as ea,A as Ao,i as Lt,P as Do,j as Ot,s as Ia,k as kr,l as ra,m as Er,n as _o,o as Ar,p as Po,S as Cn}from"./SetupPagesScreen-Uer5YsTX.js";import{u as Dr}from"./useInitialThreadRequest-ClxKOF2S.js";import ot from"./NotFoundScreen-BVW1mHQl.js";import{n as pn}from"./utils-C9yOAUzR.js";import{t as wo}from"./AddressScreen-BF-3RAYM.js";import"./analytics-CVef-z80.js";import"./plaid-CooQT--5.js";import"./dnd-Ck7mLEKI.js";import"./stripe-DMRn4zHo.js";import"./lottie-D7iBAvwy.js";import"./lexical-D_s6IbSB.js";import"./pdf-CPbk6pQ4.js";import"./analyticsHelper-DO0i_Ozz.js";import"./routePaths-DQbleX1q.js";import"./BusinessVerificationPageScreen-0dmMGz8A.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0dd3f148-e855-4071-866b-fa42db718da1",e._sentryDebugIdIdentifier="sentry-dbid-0dd3f148-e855-4071-866b-fa42db718da1")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:hn}}}=ua.getLocalizedStrings(),To=e=>Bn(e,!1),Fo=e=>Ln(e.name,!1);function Ro(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(v=>{g(v)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=Ra({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(ln())},[a]);const D=o(v=>In(v.cardPolicyState)),d=o(v=>kn(v.cardPolicyState)),j=o(v=>En(v.cardPolicyState)),P=o(v=>An(v.cardPolicyState)),B=o(v=>Dn(v.cardPolicyState)),p=o(v=>_n(v.cardPolicyState)),h=o(v=>Pn(v.cardPolicyState)),w=o(v=>wn(v.cardPolicyState)),u=o(v=>vn(v.cardPolicyState)),T=o(v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(v=>v.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Tn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(v=>Fn(v.createCardPolicyState)),A=o(v=>rs(v.createCardPolicyState)),y=o(v=>ss(v.cardPolicyState)),L=o(v=>cs(v.cardPolicyState)),l=o(v=>os(v.createCardPolicyState)),C=o(v=>Rn(v));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(sa(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>d.map(To),[d]),G=r.useMemo(()=>h.map(Fo),[h]),O=r.useMemo(()=>C.cards.filter(v=>!lr(v.status.code)).map(_r),[C.cards]),U=D==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(is({cardsMasterList:O,defaultRequireReceiptAmount:T,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,l,O,T,j,P,B,p]);const z=r.useMemo(()=>Bt(v=>{a($a(v))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const v=_e(n.state?.pathnameStackToGoBack),ee=v.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:v.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(v=>{a(ds(v))},[a]),V=r.useCallback(v=>{const ee=ur(v);a(ls({templates:[ee]}))},[a]),Q=r.useCallback(v=>{v.length!==0&&a(us(v))},[a]),X=r.useCallback(()=>{a(ln())},[a]),S=r.useRef(I);r.useEffect(()=>{const v=S.current;S.current=I,I==="Completed"&&v!=="Completed"&&A!=null&&(a(xn()),a(Qe({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,I,A,e,x]);const F=I==="Error"?M.error?.message??hn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:hn.createPageTitle,onBackClick:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=ua.getLocalizedStrings(),Bo=e=>Bn(e,!1),Lo=e=>Ln(e.name,!1);function Oo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(F=>{_(F)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:D}=Ra({mobileExploreReferrer:"Card Policy"}),d=o(F=>ms(F)),j=o(F=>In(F.cardPolicyState)),P=o(F=>kn(F.cardPolicyState)),B=o(F=>En(F.cardPolicyState)),p=o(F=>An(F.cardPolicyState)),h=o(F=>Dn(F.cardPolicyState)),w=o(F=>_n(F.cardPolicyState)),u=o(F=>Pn(F.cardPolicyState)),T=o(F=>wn(F.cardPolicyState)),k=o(F=>vn(F.cardPolicyState)),M=o(F=>Rn(F)),A=o(F=>a!=null?Cs(F.cardPolicyState,a):void 0),y=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?ps(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=d.detailFetchState.fetchState;d.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(hs(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),r.useEffect(()=>{T==="Completed"&&k===""||T==="In-Progress"||s($a())},[s,T,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(sa(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Bo),[P]),C=r.useMemo(()=>u.map(Lo),[u]),N=r.useMemo(()=>M.cards.filter(F=>!lr(F.status.code)).map(_r),[M.cards]);Tt({isDataReady:y!=null});const G=r.useMemo(()=>{if(y!=null)return Yc({draft:y,cardRows:N,categorySearchOptions:l,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:w})},[y,N,l,C,L,B,p,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(F=>{U(F)},[]),I=r.useMemo(()=>Bt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{I.cancel()},[I]);const x=r.useCallback(F=>{I(F)},[I]),Y=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),v=F.poppedPathname??q;e(v,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const v=ur(F);s(fs(v)),s(gs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:D})]})}function Pr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function wr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(bs(n,e)),At)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=ua.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(I=>{g(I)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=Ra({mobileExploreReferrer:"Card Policy"}),P=o(I=>Ss(I)),B=o(I=>Fn(I.createCardPolicyState)),p=o(I=>ys(I.createCardPolicyState)),h=o(I=>p==null?[]:Un(I.aiCfoState,p).filter(x=>x.kind==="creating_policy"),At),w=B.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(I=>Is(I.createCardPolicyState)),T=ya(B.fetchState);r.useEffect(()=>{T==="In-Progress"&&B.fetchState==="Completed"&&p!=null&&(a(xn()),h.forEach(I=>{a(jn({chatSessionId:p,id:I.id,entityIds:u,kind:"created_policy"}))}))},[B.fetchState,a,p,u,h,T]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ks())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(Qe({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const y=r.useMemo(()=>P.templates.map(No),[P.templates]);Tt({isDataReady:P.fetchState.fetchState==="Completed"});const L=y.length>0||w>0,l=function(I){const{hasAnyPolicies:x,isChargeCardAdmin:Y,isFileUploadEnabled:q}=I,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=Cr(),F=pr(),v=hr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=wr("card_policy"),be=r.useMemo(()=>Pr(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=v&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ye=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ye,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,Ye,te,Ee,Ze,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:R}),C=D&&l!=null?c.jsx(fr,{...l}):null,N=d&&C==null,G=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),x=I.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(qc,{policies:y,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Ho(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),B=ve(s),p=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Re({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=xe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:B,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>ca(W,s.companyId)),M=oa(k.controllers),{creditAccount:A,creditAccountRepayment:y}=o(W=>ia(W)),L=o(W=>W.classListState.fetchState),l=!R&&u&&d,C=o(W=>Dt(W,n,l,u)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(W=>U!=null?za(W.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],I=o(W=>Z!=null?Za(W.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(W=>q!=null?Za(W.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Ya()),Q&&t(Qe({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const W=Ae(s.tenantEmailDomain,n,a,O,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&u&&d&&f&&t(_t()),L!=="Completed"&&L!=="In-Progress"&&t(Mn())},[A.fetchState,y.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(u,w,T,d),v=xa(u,d,f,A,y),ee=Ir(S,C);return C.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(Qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:d,productInformation:F,creditAccountInformation:v,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const Ut=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Jc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,R=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Xc(D);if(j==="")return;const P=s.channel(d),B=h=>{b.current(j,h)};let p;if(P?.subscribed===!0)p=P,p.bind(j,B),m.has(d)||(m.add(d),R()),i.push(()=>{P.unbind(j,B)});else{if(p=P??s.subscribe(d),p.bind(j,B),!m.has(d)){m.add(d);const h=()=>{R()};p.bind("pusher:subscription_succeeded",h),i.push(()=>{p.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{p.unbind(j,B)})}}),()=>{i.forEach(D=>D())}},[s,_])},vr="charge-card-transaction-update",Tr="charge-card-transaction-created",Fr="charge-card-transaction-declined",Rr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",jt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Mt="charge-card-limit-updated",Nt="charge-card-limit-reset",Vt="charge-card-renamed",Go="charge-card-department-updated",Br="charge-card-repayment-completed",Lr="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ba],zo=De(function(e){const n=da(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>da(j)),m=Dr(s.companyId,{clearParams:i.fetchState==="Completed"}),R=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Yo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=Xe(s);if(Ut({events:Ca(D,$o),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(zo,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(eo,{onBackClick:R})}const Yo=e=>`/${e}/cards`,Ko={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[R,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,w=o(E=>Ds(E,s)),u=w.chargeCard,T=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),y=Te(A,B),L=Re({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:y}),l=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=xe({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&l;r.useEffect(()=>{g===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,T]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,R,w.isRefreshingViewInBackground]);const I=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Nn(E.userState,P.userId)),Y=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Y,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(T!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(qo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:Ft(),chargeCardDetailState:w,signedInUserToken:I,navigate:a,currentTenant:B,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=Ps(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Vn(e,s),g=n.updateStatus,_=la(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(Ts(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?ea(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(to),Qo=Ne.div`
|
|
1
|
+
import{j as c}from"./liveblocks-8SEYIom7.js";import{h as de,g as Ce,i as Me,u as pe,j as o,N as Sa,s as At,n as De,t as yn,o as as,p as se}from"./core-D95G1COY.js";import{bs as Pe,QX as ts,QY as ns,fM as ln,QZ as In,fF as kn,Q_ as En,Q$ as An,R0 as Dn,R1 as _n,fG as Pn,fH as wn,R2 as vn,g1 as Tn,g2 as $a,R3 as Fn,R4 as rs,fL as ss,fK as cs,R5 as os,g4 as Rn,g5 as sa,R6 as is,R7 as ds,fO as ls,fN as us,R8 as xn,hC as Qe,g0 as Bn,f$ as Ln,R9 as ms,eV as Cs,A_ as ps,AZ as hs,B1 as fs,B3 as gs,e$ as bs,eS as On,Ra as Ss,Rb as ys,f4 as Un,Rc as Is,f5 as jn,B9 as ks,B6 as Es,eT as fe,Rd as Qa,f8 as we,f9 as ve,fa as Te,gr as ca,ct as oa,Re as ia,Rf as Dt,uA as za,kx as Za,Rg as Ya,BH as ka,BJ as qe,BK as _t,kn as Mn,Rh as da,Bv as _a,Ri as As,Rj as Ds,By as Ja,Rk as _s,Pk as Xa,eX as Nn,BE as ga,hN as Ps,Rl as Vn,Rm as la,bq as ws,Rn as vs,gc as et,gb as at,Cc as Ts,ga as tt,P0 as Fs,Ro as Hn,cm as Gn,cN as Rs,Pj as wa,CN as $n,Rp as un,Cn as Pa,Rq as zn,CO as xs,PM as Bs,CP as Ls,DL as Os,tX as Us,DF as js,Rr as Ms,BI as na,Rs as Ns,Rt as Vs,Ru as Hs,Rv as Gs,Rw as $s,Rx as Pt,Ry as zs,BZ as Zn,BS as Zs,Rz as Ys,gt as Ks,C6 as Yn,Ca as Kn,gs as Ws,RA as qs,Cz as Wn,RB as Qs,RC as Js,RD as Xs,C8 as qn,BV as Qn,BB as Jn,C2 as Xn,C0 as er,C4 as ec,RE as ar,RF as ac,f1 as tc,f2 as nc,f3 as rc,RG as nt,g6 as tr,cO as wt,RH as sc,RI as cc,RJ as oc,RK as ic,Ci as St,CG as dc,CC as lc,Ce as uc,CE as mc,Cu as Cc,Cw as pc,RL as nr,CM as Ga,Js as hc,RM as fc,RN as gc,RO as bc,RP as rr,RQ as Sc,D7 as yc,Cm as sr,Ch as je,Cl as Ic,RR as kc,RS as Ec,Bs as Ac,RT as cr,eW as or,RU as Dc,Bu as _c,Bt as mn,RV as Pc,RW as wc,RX as vc,LZ as Tc,RY as vt,RZ as Fc,xA as ir,l5 as Rc,hD as xc,Dc as Bc,R_ as dr,fS as Lc,fT as Oc,R$ as Uc,df as jc,g3 as Mc,D2 as Nc,CY as We,bt as Vc,bF as Hc,cy as Gc,bG as $c,La as zc}from"./zeni-epic-state-BnmnEdbj.js";import{A as Fe,cf as lr,p as _e,cg as ur,ch as mr,ci as Zc,O as ua,_ as Tt,cj as Yc,ck as Kc,V as Cr,a as pr,Y as hr,q as ye,f as le,c as K,aq as ya,cl as fr,cm as Wc,cn as qc,z as re,B as va,c4 as rt,co as Qc,cp as Jc,cq as Xc,cr as eo,cs as ao,J as Ta,aN as ze,bo as Ft,ct as to,y as Fa,j as st,m as Rt,d as J,a7 as ct,cu as no,bA as ba,cv as yt,cw as ro,N as xt,cx as so,at as gr,a2 as It,cy as co,X as br,g as Sr,cz as oo,cA as io,cB as lo,cC as uo,cD as mo,cE as Co,o as Ka,cF as po,cG as ho,cH as pt,E as fo,cI as go,cJ as bo,cK as So,cL as yo,cM as Io,a9 as ko}from"./index-C8tyyalR.js";import{n as Ne,D as yr,S as Eo}from"./mui-jqvOLufq.js";import{a as r}from"./sentry-Bpr6hwv_.js";import{u as Ra}from"./useAskAiCfoHostNavButtonProps-CE4sjmcs.js";import{M as Ie}from"./MobileAppDrawer-D8HOXn7v.js";import{d as Bt}from"./recharts-B5BD4Kau.js";import{g as Ae,a as xa,b as Ir,c as Re,d as xe,e as Je,f as Xe,h as ea,A as Ao,i as Lt,P as Do,j as Ot,s as Ia,k as kr,l as ra,m as Er,n as _o,o as Ar,p as Po,S as Cn}from"./SetupPagesScreen-D-neLjJM.js";import{u as Dr}from"./useInitialThreadRequest-DzF6un_U.js";import ot from"./NotFoundScreen-0h0DiOvj.js";import{n as pn}from"./utils-kj_q6fLI.js";import{t as wo}from"./AddressScreen-DyCQJjNT.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./analyticsHelper-aSqJwcvL.js";import"./routePaths-STLgTv0l.js";import"./BusinessVerificationPageScreen-fLqoQmHN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd29c6c8-0299-42c3-ba6f-8fc3accbf039",e._sentryDebugIdIdentifier="sentry-dbid-bd29c6c8-0299-42c3-ba6f-8fc3accbf039")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)}),{spendManagement:{chargeCard:{cardPolicyPage:hn}}}=ua.getLocalizedStrings(),To=e=>Bn(e,!1),Fo=e=>Ln(e.name,!1);function Ro(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(v=>{g(v)},[]),i=r.useCallback(()=>{_(!0)},[_]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:R}=Ra({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(ts()),a(ns()),a(ln())},[a]);const D=o(v=>In(v.cardPolicyState)),d=o(v=>kn(v.cardPolicyState)),j=o(v=>En(v.cardPolicyState)),P=o(v=>An(v.cardPolicyState)),B=o(v=>Dn(v.cardPolicyState)),p=o(v=>_n(v.cardPolicyState)),h=o(v=>Pn(v.cardPolicyState)),w=o(v=>wn(v.cardPolicyState)),u=o(v=>vn(v.cardPolicyState)),T=o(v=>v.chargeCardConfigState.receiptRequiredAboveAmount.amount),k=o(v=>v.chargeCardConfigState.fetchState);r.useEffect(()=>{D!=="Completed"&&D!=="In-Progress"&&a(Tn())},[a,D]),r.useEffect(()=>{w==="Completed"&&u===""||w==="In-Progress"||a($a())},[a,w,u]);const M=o(v=>Fn(v.createCardPolicyState)),A=o(v=>rs(v.createCardPolicyState)),y=o(v=>ss(v.cardPolicyState)),L=o(v=>cs(v.cardPolicyState)),l=o(v=>os(v.createCardPolicyState)),C=o(v=>Rn(v));r.useEffect(()=>{C.fetchState==="Not-Started"&&a(sa(!1,!1,!1))},[C.fetchState,a]);const N=r.useMemo(()=>d.map(To),[d]),G=r.useMemo(()=>h.map(Fo),[h]),O=r.useMemo(()=>C.cards.filter(v=>!lr(v.status.code)).map(_r),[C.cards]),U=D==="Completed"&&C.fetchState==="Completed"&&k==="Completed";r.useEffect(()=>{U&&l==null&&a(is({cardsMasterList:O,defaultRequireReceiptAmount:T,suggestedAllowMerchants:j,suggestedBlockMerchants:P,suggestedAllowCategories:B,suggestedBlockCategories:p}))},[k,a,U,l,O,T,j,P,B,p]);const z=r.useMemo(()=>Bt(v=>{a($a(v))},250),[a]);r.useEffect(()=>()=>{z.cancel()},[z]);const Z=r.useCallback(v=>{z(v)},[z]),I=M.fetchState,x=t!=null?`/${t}/cards/policy`:"..",Y=r.useCallback(()=>{const v=_e(n.state?.pathnameStackToGoBack),ee=v.poppedPathname??x;e(ee,{state:{pathnameStackToGoBack:v.newStack}})},[n.state,e,x]),q=r.useCallback(()=>{e(x)},[e,x]),E=r.useCallback(v=>{a(ds(v))},[a]),V=r.useCallback(v=>{const ee=ur(v);a(ls({templates:[ee]}))},[a]),Q=r.useCallback(v=>{v.length!==0&&a(us(v))},[a]),X=r.useCallback(()=>{a(ln())},[a]),S=r.useRef(I);r.useEffect(()=>{const v=S.current;S.current=I,I==="Completed"&&v!=="Completed"&&A!=null&&(a(xn()),a(Qe({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(x))},[a,I,A,e,x]);const F=I==="Error"?M.error?.message??hn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?l==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:hn.createPageTitle,onBackClick:Y,onClickMenuIcon:i,isAiCfoAccessEnabled:m,onAskAiCfoClick:R})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Zc,{formDraft:l,vendorSearchOptions:G,categorySearchOptions:N,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:Z,submitState:I,submitErrorMessage:F,documentUploadState:y,uploadedFileName:L,isAiCfoAccessEnabled:m,onAskAiCfoClick:R,onBackClick:Y,onCancelClick:q,onClickMenuIcon:i,onFormChange:E,onSubmit:V,onUploadDocument:Q,onRemoveDocument:X})]}):c.jsx(Sa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:xo}}}=ua.getLocalizedStrings(),Bo=e=>Bn(e,!1),Lo=e=>Ln(e.name,!1);function Oo(){const e=de(),n=Ce(),{tenantEmailDomain:t,templateId:a}=Me(),s=pe(),b=Fe(),f=Pe(b?.loggedInUserRoleMap),[g,_]=r.useState(!1),i=r.useCallback(F=>{_(F)},[]),m=r.useCallback(()=>{i(!0)},[i]),{isAiCfoAccessEnabled:R,onAskAiCfoClick:D}=Ra({mobileExploreReferrer:"Card Policy"}),d=o(F=>ms(F)),j=o(F=>In(F.cardPolicyState)),P=o(F=>kn(F.cardPolicyState)),B=o(F=>En(F.cardPolicyState)),p=o(F=>An(F.cardPolicyState)),h=o(F=>Dn(F.cardPolicyState)),w=o(F=>_n(F.cardPolicyState)),u=o(F=>Pn(F.cardPolicyState)),T=o(F=>wn(F.cardPolicyState)),k=o(F=>vn(F.cardPolicyState)),M=o(F=>Rn(F)),A=o(F=>a!=null?Cs(F.cardPolicyState,a):void 0),y=r.useMemo(()=>d.templateId===a&&d.formDraft!=null?d.formDraft:A!=null?ps(A):void 0,[d.templateId,d.formDraft,A,a]);r.useEffect(()=>{if(a==null)return;const F=d.detailFetchState.fetchState;d.templateId===a&&(F==="Completed"||F==="In-Progress")||A!=null||s(hs(a))},[s,a,d.templateId,d.detailFetchState.fetchState,A]),r.useEffect(()=>{j!=="Completed"&&j!=="In-Progress"&&s(Tn())},[s,j]),r.useEffect(()=>{T==="Completed"&&k===""||T==="In-Progress"||s($a())},[s,T,k]);const L=o(F=>F.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{M.fetchState==="Not-Started"&&s(sa(!1,!1,!1))},[M.fetchState,s]);const l=r.useMemo(()=>P.map(Bo),[P]),C=r.useMemo(()=>u.map(Lo),[u]),N=r.useMemo(()=>M.cards.filter(F=>!lr(F.status.code)).map(_r),[M.cards]);Tt({isDataReady:y!=null});const G=r.useMemo(()=>{if(y!=null)return Yc({draft:y,cardRows:N,categorySearchOptions:l,vendorSearchOptions:C,defaultRequireReceiptAmount:L,suggestedAllowMerchants:B,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:w})},[y,N,l,C,L,B,p,h,w]),[O,U]=r.useState(void 0),z=r.useRef(!1);r.useEffect(()=>{z.current||O!=null||G==null||(z.current=!0,U(G))},[O,G]);const Z=r.useCallback(F=>{U(F)},[]),I=r.useMemo(()=>Bt(F=>{s($a(F))},250),[s]);r.useEffect(()=>()=>{I.cancel()},[I]);const x=r.useCallback(F=>{I(F)},[I]),Y=d.updateFetchState.fetchState,q=t!=null?`/${t}/cards/policy`:"..",E=r.useCallback(()=>{const F=_e(n.state?.pathnameStackToGoBack),v=F.poppedPathname??q;e(v,{state:{pathnameStackToGoBack:F.newStack}})},[n.state,e,q]),V=r.useCallback(()=>{e(q)},[e,q]),Q=r.useCallback(F=>{if(a==null)return;const v=ur(F);s(fs(v)),s(gs(a))},[s,a]),X=r.useRef(Y);r.useEffect(()=>{const F=X.current;X.current=Y,Y==="Completed"&&F!=="Completed"&&(s(Qe({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(q))},[s,Y,e,q]);const S=Y==="Error"?d.updateFetchState.error?.message??xo.updatePolicyGenericErrorMessage:void 0;return!f||t==null||a==null?c.jsx(Sa,{to:"..",replace:!0}):O!=null&&j==="Completed"&&M.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(Kc,{templateName:d.template?.name??"",formDraft:O,vendorSearchOptions:C,categorySearchOptions:l,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:x,submitState:Y,submitErrorMessage:S,isAiCfoAccessEnabled:R,onAskAiCfoClick:D,onBackClick:E,onCancelClick:V,onClickMenuIcon:m,onFormChange:Z,onSubmit:Q})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:i}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:d.template?.name,onBackClick:E,onClickMenuIcon:m,isAiCfoAccessEnabled:R,onAskAiCfoClick:D})]})}function Pr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function wr(e){return o(n=>e==null||e===""?{chips:ht,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ht:ht,isResolved:s}}(bs(n,e)),At)}const ht=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=ua.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=de(),n=Ce(),{tenantEmailDomain:t}=Me(),a=pe(),s=Fe(),b=Pe(s?.loggedInUserRoleMap),[f,g]=r.useState(!1),_=r.useCallback(I=>{g(I)},[]),i=r.useCallback(()=>{_(!0)},[_]),{useFeatureGate:m}=le(),{isFeatureEnabled:R}=m(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:D}=m(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:d,onAskAiCfoClick:j}=Ra({mobileExploreReferrer:"Card Policy"}),P=o(I=>Ss(I)),B=o(I=>Fn(I.createCardPolicyState)),p=o(I=>ys(I.createCardPolicyState)),h=o(I=>p==null?[]:Un(I.aiCfoState,p).filter(x=>x.kind==="creating_policy"),At),w=B.fetchState==="In-Progress"?Math.max(h.length,1):0,u=o(I=>Is(I.createCardPolicyState)),T=ya(B.fetchState);r.useEffect(()=>{T==="In-Progress"&&B.fetchState==="Completed"&&p!=null&&(a(xn()),h.forEach(I=>{a(jn({chatSessionId:p,id:I.id,entityIds:u,kind:"created_policy"}))}))},[B.fetchState,a,p,u,h,T]);const k=P.fetchState.fetchState;r.useEffect(()=>{k!=="Not-Started"&&k!=="Error"||a(ks())},[a,k]);const M=P.archiveFetchState.fetchState,A=ya(M);r.useEffect(()=>{A==="In-Progress"&&M==="Completed"&&a(Qe({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[M,a,A]);const y=r.useMemo(()=>P.templates.map(No),[P.templates]);Tt({isDataReady:P.fetchState.fetchState==="Completed"});const L=y.length>0||w>0,l=function(I){const{hasAnyPolicies:x,isChargeCardAdmin:Y,isFileUploadEnabled:q}=I,E=de(),V=Ce(),{tenantEmailDomain:Q}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:S}=Cr(),F=pr(),v=hr(),ee=o(ce=>On(ce)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:W,isResolved:ke}=wr("card_policy"),be=r.useMemo(()=>Pr(W,ke,3),[W,ke]),[ge,ae]=r.useState(""),ue=v&&F&&Q!=null&&!X,oe=r.useCallback(ce=>{if(Q==null)return;const Ea=ye(V.state?.pathnameStackToGoBack,V.pathname);E(`/${Q}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:Ea,referrer:"card_policy_hero",aiCfoInitialQuestion:ce,aiCfoShouldSubmit:ce!=null&&ce.trim().length>0}})},[V.pathname,V.state,E,Q]),te=r.useCallback(ce=>{ce.trim().length!==0&&(ae(""),oe(ce))},[oe]),Ze=r.useCallback(()=>{const ce=ge.trim();ce.length!==0&&(ae(""),oe(ce))},[ge,oe]),Ee=r.useCallback(()=>{},[]),ne=r.useCallback(ce=>{ae(ce)},[]),Ye=r.useCallback(()=>{S(!0)},[S]),Be=r.useCallback(()=>{oe(void 0)},[oe]);return r.useMemo(()=>{if(ue&&!x&&Y)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:be,composer:{currentInput:ge,isSubmitting:ee,isFileUploadEnabled:q,onInputChange:ne,onSubmit:Ze,onStopSubmit:Ee},onPromptClick:te,onOpenSidePanel:Ye,onOpenFullView:Be,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[ge,x,ue,Y,q,ee,ne,Be,Ye,te,Ee,Ze,be])}({hasAnyPolicies:L,isChargeCardAdmin:b,isFileUploadEnabled:R}),C=D&&l!=null?c.jsx(fr,{...l}):null,N=d&&C==null,G=r.useCallback(()=>{const I=_e(n.state?.pathnameStackToGoBack),x=I.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:I.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),U=r.useCallback(I=>{t!=null&&e(`/${t}/cards/policy/${I}/edit`)},[e,t]),z=r.useCallback(I=>{a(Es(I))},[a]),Z=P.fetchState.fetchState;return!L&&Z!=="Completed"&&Z!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(Wc,{onBackClick:G,onNewPolicyClick:O,onClickMenuIcon:i,isAiCfoAccessEnabled:d,onAskAiCfoClick:j})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:f,handleDrawerToggle:_}),c.jsx(qc,{policies:y,archivingTemplateId:P.archiveTargetTemplateId,pendingCreationCount:w,onBackClick:G,onNewPolicyClick:O,onEditPolicyClick:U,onArchivePolicyClick:z,onClickMenuIcon:i,policyAiCfoHero:C,isAiCfoAccessEnabled:N,onAskAiCfoClick:j})]})}function Ho(){const e=de(),{cardId:n}=Me(),t=pe(),a=re.getSignedInUser(),s=o(W=>fe(W)),b=Fe(),f=Pe(b?.loggedInUserRoleMap),{useFeatureGate:g}=le();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[_,i]=r.useState(!1),m=o(W=>Qa(W).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const R=s.userRole.includes("charge_card_user"),{isFeatureEnabled:D}=g(K.isChargeCardFeatureEnabled),d=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:j}=g(K.isDebitCardFeatureEnabled),P=we(s),B=ve(s),p=Te(j,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Re({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:p}),u=xe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:D,isBookKeepingTenant:B,isDebitCardProductVisible:w,chargeCardsCreditAccountLimit:h}),T=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,k=o(W=>ca(W,s.companyId)),M=oa(k.controllers),{creditAccount:A,creditAccountRepayment:y}=o(W=>ia(W)),L=o(W=>W.classListState.fetchState),l=!R&&u&&d,C=o(W=>Dt(W,n,l,u)),[N,G]=r.useState(!1),O=C.chargeCard,U=O?.cardCreatedByUser?.userId,z=o(W=>U!=null?za(W.userRoleState,U):void 0),Z=z?.accountingClassIDs[0],I=o(W=>Z!=null?Za(W.classState,{classId:Z,reportId:"class_list"}):void 0),x=O?.cardHolderUser?.userId,Y=o(W=>x!=null?za(W.userRoleState,x):void 0),q=Y?.accountingClassIDs[0],E=o(W=>q!=null?Za(W.classState,{classId:q,reportId:"class_list"}):void 0),V=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Q=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{m&&_===!1&&V&&(i(!0),setTimeout(()=>{t(Ya()),Q&&t(Qe({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[m,_,V,Q]),r.useEffect(()=>{N||C.fetchState==="Completed"||C.fetchState==="In-Progress"||n==null||(G(!0),t(ka(n,l,!1)))},[N,C,n,t]),r.useEffect(()=>{if(C.fetchState==="Completed"&&(V===!1||V&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||m===!1&&_===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const W=Ae(s.tenantEmailDomain,n,a,O,m);e(W)}},[C.fetchState,m,V]),r.useEffect(()=>{A.fetchState!=="Completed"&&A.fetchState!=="In-Progress"&&u&&d&&f&&t(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&u&&d&&f&&t(_t()),L!=="Completed"&&L!=="In-Progress"&&t(Mn())},[A.fetchState,y.fetchState,t,u,d,f,L]);const X=()=>{if(a!=null&&n!=null){t(Ya());const W=Ae(s.tenantEmailDomain,n,a);e(W)}},S=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",F=Je(u,w,T,d),v=xa(u,d,f,A,y),ee=Ir(S,C);return C.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(rt,{showConfetti:m}),c.jsx(Qc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:M,isChargeCardFeatureEnabled:u,isDebitCardFeatureEnabled:w,isDebitCardSetupEnabled:T,isChargeCardSetupEnabled:d,productInformation:F,creditAccountInformation:v,debitAccountInformation:ee,chargeCardDetailView:C,creditAccount:A,classListFetchState:L,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:I?.className,cardHolderRoles:Y?.userRoles,cardHolderDepartmentName:E?.className})]})}const Ut=e=>{const{events:n,onEvent:t,onSubscribed:a}=e,s=Jc(),b=r.useRef(t),f=r.useRef(a),g=r.useRef(0);r.useEffect(()=>{b.current=t},[t]),r.useEffect(()=>{f.current=a},[a]);const _=r.useMemo(()=>[...n].sort().join("|"),[n]);r.useEffect(()=>{if(s==null||n.length===0)return;const i=[],m=new Set,R=()=>{if(f.current==null)return;const D=Date.now();D-g.current<5e3||(g.current=D,f.current())};return n.forEach(D=>{const[d,j]=Xc(D);if(j==="")return;const P=s.channel(d),B=h=>{b.current(j,h)};let p;if(P?.subscribed===!0)p=P,p.bind(j,B),m.has(d)||(m.add(d),R()),i.push(()=>{P.unbind(j,B)});else{if(p=P??s.subscribe(d),p.bind(j,B),!m.has(d)){m.add(d);const h=()=>{R()};p.bind("pusher:subscription_succeeded",h),i.push(()=>{p.unbind("pusher:subscription_succeeded",h)})}i.push(()=>{p.unbind(j,B)})}}),()=>{i.forEach(D=>D())}},[s,_])},vr="charge-card-transaction-update",Tr="charge-card-transaction-created",Fr="charge-card-transaction-declined",Rr="charge-card-transaction-updated",xr="charge-card-transaction-receipt-uploaded",ma="charge-card-status-update",jt="charge-card-spending-updated",it="credit-account-balance-updated",dt="charge-card-created",Mt="charge-card-limit-updated",Nt="charge-card-limit-reset",Vt="charge-card-renamed",Go="charge-card-department-updated",Br="charge-card-repayment-completed",Lr="charge-card-payment-date-updated",Ba="charge-card-cashback-redeemed",La="charge-card-cashback-earned",Ca=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ba],zo=De(function(e){const n=da(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(As({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Zo(){const e=de(),n=pe(),t=Ce(),a=re.getSignedInUser(),s=o(j=>fe(j)),{useFeatureGate:b}=le(),{isFeatureEnabled:f}=b(K.isCardsCommentingEnabled),[g,_]=r.useState(!1),i=o(j=>da(j)),m=Dr(s.companyId,{clearParams:i.fetchState==="Completed"}),R=r.useCallback(()=>{const j=_e(t.state?.pathnameStackToGoBack),P=j.poppedPathname??Yo(s.tenantEmailDomain);e(P,{state:{pathnameStackToGoBack:j.newStack}})},[e,t,s.tenantEmailDomain]),D=Xe(s);if(Ut({events:Ca(D,$o),onEvent:j=>{switch(j){case La:case Ba:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{g||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(_(!0),n(_a()))},[g,i,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const d=i.cashbackSummary?.cashbackEarned?.amount!=null&&i.fetchState!=="Not-Started";return i.fetchState!=="In-Progress"||d?(i.cashbackSummary?.cashbackEarned?.amount??0)===0&&i.fetchState==="Completed"?c.jsx(ot,{}):c.jsx(zo,{onBackClick:R,isCardsCommentingEnabled:f,initialOpenThreadRequest:m}):c.jsx(eo,{onBackClick:R})}const Yo=e=>`/${e}/cards`,Ko={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=pe(),a=de(),{cardId:s}=Me(),b=Ce(),{useDynamicConfig:f}=le(),[g,_]=r.useState(!1),[i,m]=r.useState(!1),[R,D]=r.useState(!1),[d,j]=r.useState(!1),P=re.getSignedInUser();if(P==null)throw Error("Can't access onboarding card page without signing in...");const B=o(E=>fe(E));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=f(ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,w=o(E=>Ds(E,s)),u=w.chargeCard,T=o(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:k}=le(),{isFeatureEnabled:M}=k(K.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=k(K.isDebitCardFeatureEnabled),y=Te(A,B),L=Re({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:y}),l=!!B.companyChargeCardInfo?.info?.isChargeCardEnabled,C=B.userRole.includes("charge_card_user"),N=we(B),G=ve(B),O=B.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=xe({isCardsOnlyTenant:N,isChargeCardFeatureEnabled:M,isBookKeepingTenant:G,isDebitCardProductVisible:L,chargeCardsCreditAccountLimit:O}),z=!C&&U&&l;r.useEffect(()=>{g===!1&&T!=="In-Progress"&&T!=="Completed"&&(t(Ja()),_(!0)),i===!1&&w.fetchState==="Not-Started"&&(m(!0),t(ka(s,z,U)))},[i,w.fetchState,g,T]);const Z=u?.type.code==="business_physical_credit_card"||u?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(w.fetchState==="Completed"){if(R===!1&&(Z===!1||Z&&u?.status?.code!=="inactive"||u?.cardHolderUserId!==P.userId)){const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);a(E,{state:{pathnameStackToGoBack:V}})}else if(R&&w.isRefreshingViewInBackground===!1&&u?.status?.code==="active"){t(_s({chargeCardId:s}));const E=Ae(B.tenantEmailDomain,s,P,u,!0),V=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(E,{state:{pathnameStackToGoBack:V}})}}},[w.fetchState,u?.type.code,R,w.isRefreshingViewInBackground]);const I=re.getZeniOtpTokenForCardHolder(s),x=o(E=>Nn(E.userState,P.userId)),Y=()=>{u?.status?.code!=="active"&&t(ga(s,!0))};r.useEffect(()=>{w.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&u?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&R===!1&&(setTimeout(Y,3e3),D(!0))},[w.updatePhysicalChargeCardAttemptFetchState.fetchState,u?.cardActivationAttemptHistory]);const q=E=>{j(E)};if(T!=="Completed"||u==null)return c.jsx(va,{fetchState:"In-Progress"});if(u.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(x?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Jo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:d,handleDrawerToggle:q}),c.jsx(qo,{cardId:s,card:u,shippingAddressId:u.shippingAddressId,phone:x.phone,signedInUser:P,isSandboxEnv:Ft(),chargeCardDetailState:w,signedInUserToken:I,navigate:a,currentTenant:B,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=De(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=Ps(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const f=Vn(e,s),g=n.updateStatus,_=la(e,!1,!1,!1);let i=!1;_.fetchState==="Completed"&&_.cards.length<=1&&(i=!0);const m=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(ws())||m,showMenuIcon:i,shippingAddress:b,vgsVaultId:st.cardVaultId,twoFAView:f,activationWaitStatus:g,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:f}=n,g=f.chargeCard?.cardProviderID,{tenantEmailDomain:_}=b;return{onGetOtp:i=>{g!=null&&e(tt(i,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:i=>{e(Ts(a,i))},onResendOtp:i=>{g!=null&&e(at(i,"ChargeCardHolder",a))},onVerifyOtp:(i,m)=>{g!=null&&e(et(i,m,"ChargeCardHolder",a))},onVerifyOtpSuccess:i=>{i!=null&&re.saveZeniOtpTokenForCardHolder(i,a)},onCVVActivateSuccess:()=>{e(vs({chargeCardId:a}))},onBackClick:()=>{const i=_e(s.state?.pathnameStackToGoBack),m=i.poppedPathname==null||i.poppedPathname.includes("onboard")===!0?ea(_):i.poppedPathname;t(m,{state:{pathnameStackToGoBack:i.newStack}})}}})(to),Qo=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${Ko.containerWidth.value(e.windowSize)}%`};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-8SEYIom7.js";import{a as g}from"./sentry-Bpr6hwv_.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-D95G1COY.js";import{z as C,b9 as F,N as P,d as V,g as j,af as N,ba as L,at as A,au as U,q as B}from"./index-C8tyyalR.js";import{eT as D,ge as M,tm as _,g9 as R,c3 as z,Op as G,bn as q,rv as Y,rj as Z,kZ as H,my as S,Oq as $,bE as J,cw as b,mI as K,mL as Q}from"./zeni-epic-state-BnmnEdbj.js";import"./mui-jqvOLufq.js";import{d as W}from"./routePaths-STLgTv0l.js";import{M as X}from"./MobileAppDrawer-D8HOXn7v.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]="a52c810d-9e14-4edc-93b9-8c430c2a3fcd",t._sentryDebugIdIdentifier="sentry-dbid-a52c810d-9e14-4edc-93b9-8c430c2a3fcd")}catch{}})();const ee=E(function(t){const a=R(t),i=C.getSignedInUser(),p=D(t),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(p?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(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:l,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}},function(t,a){const{companyId:i,currentTenant:p,navigate:c,location:l}=a,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(Q())},onAddressClick:e=>{const n=W(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(K({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:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(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?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};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(H({files:e}))},onDeleteFile:e=>{t(Z(e))},onEditFileName:(e,n)=>{t(Y(e,n.split(".")[0]))}}})(L);function de(){const t=w(),a=T(),i=k(),{tenantEmailDomain:p}=x(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(l(!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(j.Event.companyPassport,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:N(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-
|
|
1
|
+
import{j as C}from"./liveblocks-8SEYIom7.js";import{a}from"./sentry-Bpr6hwv_.js";import{u as D,g as v,j as m,N as w}from"./core-D95G1COY.js";import{L6 as A,eT as O,fA as L,o2 as _,gn as h,fz as j,f6 as U,Ld as F}from"./zeni-epic-state-BnmnEdbj.js";import{u as $,z as f,L as g,O as k,o as z}from"./index-C8tyyalR.js";import{n as H}from"./mui-jqvOLufq.js";import{t as R}from"./getLocaleForTenant-HT8Btw6T.js";import{g as P,Q as G}from"./QBOConnectionScreen-DwoHkIu2.js";import"./recharts-B5BD4Kau.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./utils-kj_q6fLI.js";import"./empty-BE68b5E4.js";import"./pdf-lib-C0lYQdSO.js";import"./index-CruHx9g6.js";import"./url-tRs_qG1D.js";import"./index-DLVDaPoM.js";import"./decodeURIComponentSafe-BLmfpdcW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="a9a9fb66-2dd1-4fb1-9c31-a159376c72a5",t._sentryDebugIdIdentifier="sentry-dbid-a9a9fb66-2dd1-4fb1-9c31-a159376c72a5")}catch{}})();const Q=H.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-8SEYIom7.js";import{z as n}from"./index-C8tyyalR.js";import{g as d}from"./QBOConnectionScreen-DwoHkIu2.js";import"./sentry-Bpr6hwv_.js";import{g as p,N as s}from"./core-D95G1COY.js";import"./zeni-epic-state-BnmnEdbj.js";import"./recharts-B5BD4Kau.js";import"./mui-jqvOLufq.js";import"./analytics-DORMe8dT.js";import"./plaid-BvitY7vM.js";import"./dnd-BXlaBlTc.js";import"./stripe-DMRn4zHo.js";import"./lottie-DGqwGfHh.js";import"./lexical-D90cNSQE.js";import"./pdf-CMafEn8a.js";import"./utils-kj_q6fLI.js";import"./empty-BE68b5E4.js";import"./pdf-lib-C0lYQdSO.js";import"./index-CruHx9g6.js";import"./url-tRs_qG1D.js";import"./index-DLVDaPoM.js";import"./decodeURIComponentSafe-BLmfpdcW.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|