@zeniai/web-app-ui 5.3.30-qa → 5.3.31-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/{AccountMappingScreen-63FlaGuq.js → AccountMappingScreen-UdzIeE_v.js} +2 -2
- package/dist/assets/AddressRoutes-CaXv_Hc-.js +1 -0
- package/dist/assets/AddressScreen-Dmypz8Cm.js +9 -0
- package/dist/assets/AiCfoScreen-DNghBGiO.js +22 -0
- package/dist/assets/AppDrawer-kOTtyyGv.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-BNU4FGHS.js → BillPayApprovalRoutes--ALQ35-1.js} +1 -1
- package/dist/assets/{BillPayRoutes-D9I2VGzJ.js → BillPayRoutes-BcTRlRv8.js} +9 -9
- package/dist/assets/{BusinessVerificationPageScreen-afqV4Atk.js → BusinessVerificationPageScreen-DzWgqXwG.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-C-AqWGUl.js → CardsAiCfoScreen-C_lk15md.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-B5cZ1kQb.js → ChargeCardRoutes-BjIdSbvb.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-BAW40Qn8.js → CompanyPassportScreen-BKrZbZ6U.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-CUZc6Ync.js → ConnectionAuthScreen-Dzixugfp.js} +2 -2
- package/dist/assets/CustomerOnboardingAuthScreen-D31TaCjo.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-3cZyVkRN.js +30 -0
- package/dist/assets/{DashboardRoutes-Booe42V4.js → DashboardRoutes-BruAIMYU.js} +4 -4
- package/dist/assets/{DefaultTenantHome-C5VDGeyO.js → DefaultTenantHome-BtIFl_77.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DhMVIfNi.js +18 -0
- package/dist/assets/DrawerScreen-CbY0_Vl5.js +1 -0
- package/dist/assets/EntityDetailRoutes-DpM6LjT5.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-Dll0r-g6.js +25 -0
- package/dist/assets/FeaturePreviewScreen-DRMNz052.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-CaSUfoGO.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-BIRPulc1.js → InboxNotificationsProvider-55rQDTXA.js} +1 -1
- package/dist/assets/InvoicingRoutes-B8ytNofm.js +2 -0
- package/dist/assets/{MagicLinkRoutes-ghi5jd2V.js → MagicLinkRoutes-DbYU9yxF.js} +19 -19
- package/dist/assets/MagicLinkSignInScreen-DSGkqzLp.js +12 -0
- package/dist/assets/{MobileAppDrawer-BJV6BsMX.js → MobileAppDrawer-BAV0ejOs.js} +1 -1
- package/dist/assets/NotFoundScreen-ButYFiTG.js +1 -0
- package/dist/assets/NotificationRoutes-jy7KSYzl.js +1 -0
- package/dist/assets/OAuthConsentScreen-4W57tKq2.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-Diz_Rn8O.js +1 -0
- package/dist/assets/PaymentLinkScreen-BcSDg2Q0.js +21 -0
- package/dist/assets/PeopleRoutes-BsxSMUvq.js +22 -0
- package/dist/assets/PerformanceRoutes-DFKVpzlk.js +1 -0
- package/dist/assets/{Preview-ByUhhrY0.js → Preview-DNAybQkC.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BVlzA_ks.js → QBOConnectionScreen-BmXy-56M.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-DW0hPEhv.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CGLqqLOn.js → ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-DyJDzvC0.js → ReimbursementRoutes-BQ18gzav.js} +9 -9
- package/dist/assets/ReportsRoutes-iapNY-Ca.js +1 -0
- package/dist/assets/RewardsRoutes-CO35jNo-.js +1 -0
- package/dist/assets/ScreenRoutes-B2fNAm1R.js +2 -0
- package/dist/assets/{SettingsRoutes-DxnIfIbH.js → SettingsRoutes-DU6XdEOY.js} +6 -6
- package/dist/assets/{SetupPagesScreen-C1Oev9K8.js → SetupPagesScreen-CPUD_j1y.js} +5 -5
- package/dist/assets/SignInScreen-DL2bXt_7.js +1 -0
- package/dist/assets/SignOutScreen-DSAHdKNP.js +9 -0
- package/dist/assets/{TaskListScreen-BFlHqYcu.js → TaskListScreen-BH2rdLa7.js} +2 -2
- package/dist/assets/{TaskRoutes-BmnOylhk.js → TaskRoutes-C-JJtR4s.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-CaIXvpDL.js +1 -0
- package/dist/assets/TransactionDetailScreen-srWo_3sK.js +5 -0
- package/dist/assets/TransactionListRoutes-CpBDr1qT.js +1 -0
- package/dist/assets/TreasuryRoutes-Ja8FQwZH.js +37 -0
- package/dist/assets/VendorsRoutes-CoiOEvIl.js +112 -0
- package/dist/assets/WiseConfirmationScreen-Dj7QUTt6.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-CRSCFOIu.js → ZeniAccountRoutes-BjLND6jg.js} +8 -8
- package/dist/assets/ZeniAccountStatementScreen-BgOPM6A3.js +9 -0
- package/dist/assets/{accountMappingHelper-CU6wucuM.js → accountMappingHelper-CAg2qsF3.js} +1 -1
- package/dist/assets/{analytics-BgUj-hR5.js → analytics-CqoRAkB1.js} +1 -1
- package/dist/assets/{analyticsHelper-CqV558Dq.js → analyticsHelper-Cjtujqyf.js} +1 -1
- package/dist/assets/{core-CMivCywN.js → core-CiFsHd3i.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DRefzrWS.js → decodeURIComponentSafe-FYjI-TwW.js} +1 -1
- package/dist/assets/{dnd-B8NpvFCU.js → dnd-jcX4BW0a.js} +1 -1
- package/dist/assets/{empty-CllNfDt1.js → empty-4iGv0vIv.js} +1 -1
- package/dist/assets/{empty-CawgNJEF.js → empty-DSab5moc.js} +1 -1
- package/dist/assets/{emptyVideoElement-DBVZ22o5.js → emptyVideoElement-BSwv6rHf.js} +1 -1
- package/dist/assets/{epic-Cw47VvOB.js → epic-CjiXGW6W.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-BuTA7ucx.js → expenseAutomationHelper-R2jHKv-Z.js} +1 -1
- package/dist/assets/getLocaleForTenant-CRduVQsY.js +1 -0
- package/dist/assets/{index-DCnLtCHg.js → index-0sENwUb_.js} +1 -1
- package/dist/assets/{index-BnHTUbKj.js → index-2FqIUc6q.js} +1 -1
- package/dist/assets/{index-CD-EymjZ.js → index-BJOxGHxN.js} +2 -2
- package/dist/assets/{index-baDCTZK3.js → index-CVbu1_bp.js} +1 -1
- package/dist/assets/{index-Cx55eHdr.js → index-Cz99TrBA.js} +1 -1
- package/dist/assets/{index-XoGDegrx.js → index-D6dzsKZ7.js} +1 -1
- package/dist/assets/{index-Djuwyi3d.js → index-DGRhh-da.js} +1 -1
- package/dist/assets/{index-D90YkzK-.js → index-juRht-9c.js} +11171 -11173
- package/dist/assets/{lexical-Di6ZXkXF.js → lexical-DBiumTDC.js} +1 -1
- package/dist/assets/{liveblocks-mJJR3MsR.js → liveblocks-CkQ2CY6T.js} +1 -1
- package/dist/assets/{lottie-BTBtSLCO.js → lottie-cUBeCDOE.js} +1 -1
- package/dist/assets/{mui-C6XtNCo7.js → mui-FQy08n5j.js} +1 -1
- package/dist/assets/{pathToGoBack-DkQc48Fj.js → pathToGoBack-DWIhT07R.js} +1 -1
- package/dist/assets/{pdf-DSDpdkmb.js → pdf-C6cPvWx8.js} +3 -3
- package/dist/assets/{pdf-lib-BbzL8H1t.js → pdf-lib-C9DR7g8H.js} +1 -1
- package/dist/assets/{plaid-l8YRzpBD.js → plaid-Dw5LGskq.js} +1 -1
- package/dist/assets/{pusher-B8Hm6DMT.js → pusher-Bs1ItrSl.js} +1 -1
- package/dist/assets/{react-BeA4fGXX.js → react-B-yGKA4G.js} +1 -1
- package/dist/assets/{react-TfJbQpIh.js → react-BD9-MMqW.js} +1 -1
- package/dist/assets/{react-FrhNEOT3.js → react-BK8OyR5e.js} +1 -1
- package/dist/assets/{react-CFob_XAv.js → react-BzoedhUW.js} +1 -1
- package/dist/assets/{react-hzw_vRmY.js → react-N2ByZQ0u.js} +1 -1
- package/dist/assets/{react-CexHjl19.js → react-Rj21KKGh.js} +1 -1
- package/dist/assets/{recharts-Co0_Dmc-.js → recharts-CYbL6OhC.js} +1 -1
- package/dist/assets/routePaths-DqksJ4i_.js +1 -0
- package/dist/assets/{sentry-CItQHKpv.js → sentry-Lj2WEO6K.js} +1 -1
- package/dist/assets/{url-MmuF1WQx.js → url-Bk85P8pL.js} +1 -1
- package/dist/assets/{url-xQ9KNY2e.js → url-DhKb0GNI.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B3XyU0Fo.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-Dhoa0fnv.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-YQlWLN09.js +1 -0
- package/dist/assets/{useDeviceId-DJLfe-br.js → useDeviceId-CWOFj37E.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DpIv7GW3.js +1 -0
- package/dist/assets/useInitialThreadRequest-D-SxLs4P.js +1 -0
- package/dist/assets/{useTaskManagerAccess-B60T1gBh.js → useTaskManagerAccess-BrCmQLIc.js} +1 -1
- package/dist/assets/{utils-macSqF2O.js → utils-DsJsAXTJ.js} +1 -1
- package/dist/assets/withTransactionSidePanel-BjLmCRfl.js +25 -0
- package/dist/assets/{zeni-epic-state-CqKBThJ0.js → zeni-epic-state-BdFiPfcm.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-BQZRAaHK.js +0 -1
- package/dist/assets/AddressScreen-_R6CTIVH.js +0 -9
- package/dist/assets/AiCfoScreen-C8gj-uzF.js +0 -22
- package/dist/assets/AppDrawer-BZUmu70o.js +0 -10
- package/dist/assets/CustomerOnboardingAuthScreen-9A7QgVmp.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-DXes1Er6.js +0 -30
- package/dist/assets/DomesticWireDetailScreen-7j7SGnOg.js +0 -18
- package/dist/assets/DrawerScreen-Csh3eD6J.js +0 -1
- package/dist/assets/EntityDetailRoutes-CCnyW919.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-DJxsaOLE.js +0 -38
- package/dist/assets/FeaturePreviewScreen-B6gcAXFm.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CXXQU19P.js +0 -1
- package/dist/assets/InvoicingRoutes-CBapzsSL.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-BqpLWUSF.js +0 -12
- package/dist/assets/NotFoundScreen-BnVyPaPi.js +0 -1
- package/dist/assets/NotificationRoutes-DyI8Xbpv.js +0 -1
- package/dist/assets/OAuthConsentScreen-DBMBI1eP.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-B5U8wcwH.js +0 -1
- package/dist/assets/PaymentLinkScreen-B8Npl8-P.js +0 -21
- package/dist/assets/PeopleRoutes-DtBr-ZhM.js +0 -22
- package/dist/assets/PerformanceRoutes-B2EvteS4.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-6KXXnCKA.js +0 -1
- package/dist/assets/ReportsRoutes-Dgbt88Ii.js +0 -1
- package/dist/assets/RewardsRoutes-DXDaRicq.js +0 -1
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BmkDgkpw.js +0 -25
- package/dist/assets/ScreenRoutes-y2py2Sx-.js +0 -2
- package/dist/assets/SignInScreen-ClZvL2fM.js +0 -1
- package/dist/assets/SignOutScreen-CZbE2s88.js +0 -9
- package/dist/assets/TransactionDetailRoutes-rQlONmP8.js +0 -1
- package/dist/assets/TransactionDetailScreen-DnBKsQvp.js +0 -5
- package/dist/assets/TransactionListRoutes-Sw1sTXcA.js +0 -1
- package/dist/assets/TreasuryRoutes-MfsBOpsN.js +0 -37
- package/dist/assets/VendorsRoutes-_P343ySG.js +0 -88
- package/dist/assets/WiseConfirmationScreen-DKZOBDOL.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-svNdptRn.js +0 -9
- package/dist/assets/getLocaleForTenant-eit0V2sf.js +0 -1
- package/dist/assets/routePaths-BRn4bxlT.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BKbzFDsb.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CywXA9k2.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-93KEXKtp.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-BmofwXI5.js +0 -1
- package/dist/assets/useInitialThreadRequest-ChCTxMqY.js +0 -1
- package/dist/assets/withTransactionSidePanel-CNiAqI18.js +0 -25
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as V}from"./sentry-
|
|
1
|
+
import{a as V}from"./sentry-Lj2WEO6K.js";import{u as Y,j as b,h as ne,g as se,i as oe,N as ie,l as re}from"./core-CiFsHd3i.js";import{fB as z,GS as ce,Yj as ue,AW as de,RA as pe,H6 as le,Kh as me,N4 as fe,NK as ye,Oz as Se,Yk as ge,Yl as Ie,Ym as he,Yn as be,Yo as Te,Uz as De,Xp as Oe,UO as Ce,Ll as ke,UP as Ve,Lp as Ae,mD as Ne,gD as we,gC as ve,gB as Fe,ui as _e,u9 as Be,u6 as xe,mv as Ee,B3 as ze,B1 as U,bE as P,Bf as R,cD as Ue}from"./zeni-epic-state-BdFiPfcm.js";import{bQ as Pe,V as Re,O as Le,bg as je,z as E,a6 as Me,h as L,l as B,N as x,bS as Ge,ac as Ye,p as j,aE as M}from"./index-juRht-9c.js";import{n as qe}from"./mui-FQy08n5j.js";import{j as k}from"./liveblocks-CkQ2CY6T.js";import{d as G}from"./routePaths-DqksJ4i_.js";import{M as Ke}from"./MobileAppDrawer-BAV0ejOs.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new t.Error().stack;u&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[u]="866575fd-7c0f-44cd-aec6-bb52355ae099",t._sentryDebugIdIdentifier="sentry-dbid-866575fd-7c0f-44cd-aec6-bb52355ae099")}catch{}})();function nt(){const t=Y(),u=b((r=>z(r))),n=u?.tenantId,{isApprovalRulesV3Enabled:i,isLoading:d}=Pe(n),p=b((r=>r.billPaySetupApproverViewState.fetchState));V.useEffect((()=>{n==null||d||p==="Not-Started"&&t(ce(!0,!0,i))}),[n,d,i,p,t])}const We=qe.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -6,4 +6,4 @@ import{a as V}from"./sentry-CItQHKpv.js";import{u as Y,j as h,h as ne,g as se,i
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${t=>t.theme.colors.grey4};
|
|
9
|
-
`,Ze=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=E.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ye.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:A,stateOfIncorporation:
|
|
9
|
+
`,Ze=re((function(t,u){const{businessVerificationDetails:n}=u,i=z(t),d=E.getSignedInUser(),p=i.tenantId,r={userId:d?.userId??"",sessionId:d?.zeniSessionId??"",tenantId:p??""},T=De(u.roleMap)&&n.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=Oe(t.companyConfigState),s=Ce(t.userRoleConfigState);return{businessVerificationDetails:n,verficationDetailsFetchState:n.fetchState,isRefreshingViewInBackground:n.isRefreshingViewInBackground,allNationalityCountries:n.allNationalityCountries,filesEndPoint:`${Ye.fileMicroServiceBaseUrl}`,authParams:r,isDisabled:T,allIndustries:e.companyIndustries??[],companyTitles:s.companyTitles}}),(function(t,u){const{companyId:n,productType:i,currentTenant:d,navigate:p,location:r}=u,{tenantEmailDomain:T}=d;return{onCompanyDetailsChanged:e=>{const{companyDescription:s,companyIndustry:m,companyIndustryType:O,companyLegalName:C,companyTaxId:g,companyWebsite:y,companyPhone:I,primaryContactEmail:c,primaryContactName:o,primaryContactUserId:l,primaryContactSyncToken:D,syncToken:S,fileIds:a,incDate:f,typeOfIncorporation:A,stateOfIncorporation:N,sourceOfFunds:w,companySubIndustry:v,countriesOfOperations:h,companySourceOfFunds:q,companySourceOfFundsDescription:K,transactionVolume:W,transactionVolumeDescription:Z,purposeOfAccount:$,purposeOfAccountDescription:H,regulatedStatus:Q,regulatedStatusDescription:X,usNexus:J,usNexusTypes:ee}=e,F=O?.selectedOption,te={companyId:n,companyDescription:s,companyIndustry:m.selectedOption,companyIndustryType:F==null||F===""?void 0:F,companyLegalName:C,taxIdOrEIN:g,website:y!=""&&y!=null?Ue(y):void 0,phone:I,syncToken:S,fileIds:a,incDate:f!=null?P(f?.toString()):f,typeOfIncorporation:A?.selectedOption??"",stateOfIncorporation:N?.selectedOption??"",sourceOfFunds:w?.selectedOption??"",companySubIndustry:v?.selectedOption??"",countriesOfOperations:h?.selectedOptions.map((_=>_.length===2?_:M(_)))??[],companySourceOfFunds:q?.selectedOption??"",companySourceOfFundsDescription:K,transactionVolume:W?.selectedOption??"",transactionVolumeDescription:Z,purposeOfAccount:$?.selectedOption??"",purposeOfAccountDescription:H,regulatedStatus:Q??"",regulatedStatusDescription:X,usNexus:J,usNexusTypes:ee?.selectedOptions??[]},ae={userId:l,firstName:o.firstName,lastName:o.lastName,email:c,syncToken:D};t(R({companyDetails:te,primaryContactDetails:ae}))},onCompanyOfficerUpdated:e=>{const s=e.map((m=>{const{officerType:O,userId:C,name:g,email:y,nationalityCountryCode:I,ssn:c,dob:o,phone:l,syncToken:D,selectDocument:S,role:a,ownership:f,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:v}=m;let h;return S.selectDocumentType==="driverLicense"?h="driving_license":S.selectDocumentType==="passport"?h="passport":S.selectDocumentType==="stateId"?h="id_document":S.selectDocumentType==="ssnCard"&&(h="social_security_card"),{officerType:O,userId:C,firstName:g.firstName,lastName:g.lastName,email:y,ssn:c,nationalityCountryCode:I?.selectedOption!=null?M(I.selectedOption):void 0,phone:l,birthday:o!=null?P(o?.toString()):o,syncToken:D,titleAtCompany:a.selectedOption,ownershipInCompany:f,documentTypeSelectedForVerification:h,isSelectedForVerification:A,userVerificationStatus:N,treasuryUserVerificationStatus:w,fileIds:v,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1}}));t(R({officers:s}))},onSaveDetailsClick:e=>{t(U(n,e,i))},onSendForVerificationClick:e=>{t(U(n,e,i,!0))},onAddressClick:e=>{const s=G(T,e),m=j(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onRegisteredAddressClick:e=>{const s=G(T,e),m=j(r.state?.pathnameStackToGoBack,r.pathname);p(s,{state:{pathnameStackToGoBack:m}})},onBackClick:()=>{t(ze({companyId:n})),p("../setup")},updateFilesEntity:e=>{t(Ee({files:e}))},onDeleteFile:e=>{t(xe(e))},onDeleteFileList:e=>{t(Be(e))},onEditFileName:(e,s)=>{t(_e(e,s.split(".")[0]))},onGetOtp:e=>{t(Fe(e,"SpendManagementSetup"))},onResendOtp:e=>{t(ve(e,"SpendManagementSetup"))},onVerifyOtp:(e,s)=>{t(we(e,s,"SpendManagementSetup"))},saveNewAddressInLocalStore:(e,s)=>{t(Ne({addressType:e,addressToCreate:s}))},onIdentityDocumentUploadedForAutofill:e=>{if(n==null)return;const s=Ve(e.documentType);s!=null&&t(Ae({target:"setup",companyId:n,officerType:e.officerType,fileId:e.fileId,documentType:s}))},onCompanyDocumentUploadedForAutofill:e=>{n!=null&&t(ke({target:"setup",companyId:n,fileId:e.fileId,documentType:e.documentType}))}}}))(Ge),st=({productType:t})=>{const u=ne(),n=se(),i=Y(),[d,p]=V.useState(!1),[r,T]=V.useState(!1),{tenantEmailDomain:e}=oe(),s=Re(),{useDynamicConfig:m}=Le(),{configValue:O}=m(je.zeniAccountsConfig),C=ue(O),g=b((a=>{switch(t){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}})),y=b((a=>a.companyConfigState.fetchState)),I=b((a=>a.userRoleConfigState.fetchState)),c=b((a=>z(a))),o=c.companyId??E.getSignedInUserTenant(e)?.companyId;if(V.useEffect((()=>{y==="Not-Started"&&i(de()),I==="Not-Started"&&i(pe(!0))}),[y,I,i]),V.useEffect((()=>{if(!d&&g==="Not-Started"&&o!=null)switch(p(!0),t){case"zeni_accounts":i(Se(o,!0));break;case"zeni_treasury":i(ye(o,!0));break;case"reimbursement":i(fe(o,!0));break;case"charge_cards":i(me(o,!0));break;default:i(le(o,!0))}}),[d,g,o,i]),E.getSignedInUser()==null)throw Error("Can't access business verification without signing in...");let l;switch(t){case"zeni_accounts":l=c.companyZeniAccountInfo?.info?.isZeniAccountTOSAccepted;break;case"reimbursement":l=c.companyReimbursementInfo?.info?.isReimbursementTOSAccepted;break;case"charge_cards":l=c.companyChargeCardInfo?.info?.isChargeCardTOSAccepted===!0||c.companyDebitCardInfo?.info?.isDebitCardTOSAccepted;break;case"zeni_treasury":l=c.companyTreasuryInfo?.info?.isTreasuryTOSAccepted;break;default:l=c.companyBillPayInfo?.info?.isBillPayTOSAccepted}const D=a=>{T(a)},S=b((a=>{switch(t){case"zeni_accounts":return Te(a,o);case"zeni_treasury":return be(a,o);case"charge_cards":return he(a,o);case"reimbursement":return Ie(a,o);default:return ge(a,o)}}));return l===!1?k.jsx(ie,{to:"../promo"}):k.jsxs(We,{children:[k.jsx(Me,{analytics:L,onLoad:a=>(f=>{switch(t){case"zeni_accounts":return f.trackPageLoaded(x.Event.zeniAccountsBusinessVerification);case"reimbursement":case"charge_cards":return f.trackPageLoaded(x.Event.reimbursementBusinessVerification);default:return f.trackPageLoaded(x.Event.billPayBusinessVerification,B(n)?"Settings":void 0)}})(a)}),B(n)?k.jsx(Ke,{isAppContentDrawerOpen:r,handleDrawerToggle:D}):null,k.jsx(Ze,{businessVerificationDetails:S,navigate:u,location:n,companyId:o,analytics:L,currentTenant:c,productType:t,isSettings:B(n),roleMap:s?.loggedInUserRoleMap??{},onClickMenuIcon:()=>{D(!0)},maxInsuredAmount:C.maxInsuredAmount})]})};export{st as B,nt as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as
|
|
1
|
+
import{j as S}from"./liveblocks-CkQ2CY6T.js";import{a as l}from"./sentry-Lj2WEO6K.js";import{u as pe,h as he,g as Ce,j as B,i as fe,l as ge}from"./core-CiFsHd3i.js";import{a as Se,e2 as be,z as ye,e3 as Pe,e5 as z,e6 as Ie,bl as W,a6 as we,h as $,e7 as H,eh as Ee,G as ke,N as Ae,w as Te,ea as xe,eb as Ue,at as _e,ee as Oe,ef as ve,bi as Qe,eg as Fe}from"./index-juRht-9c.js";import{gH as $e,fA as G,fB as je,g4 as De,je as Le,ja as Ve,fC as M,gq as qe,gk as Re,gm as N,gs as Be,gt as He,gu as Me,gv as Ne,gw as ze}from"./zeni-epic-state-BdFiPfcm.js";import{D as We,n as D,P as Ge,S as Ye}from"./mui-FQy08n5j.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b522840b-d5a2-45f2-930c-66d6d023f74d",e._sentryDebugIdIdentifier="sentry-dbid-b522840b-d5a2-45f2-930c-66d6d023f74d")}catch{}})();const Y="chat-response-generated",J="cards/ask",K="card_policy_hero";function j(e){return`/${e}/cards`}function X(e){return`/${e}/cards/policy`}const Je=ge((function(e,a){const o=G(e),c=a.isSubmitting,d=Ue(e,{allUsers:a.allUsers,onCardPolicyVendorSearchTextChange:a.onCardPolicyVendorSearchTextChange});return{showSampleQuestions:a.sessionFromUrl==="new_chat"&&o.uiState.currentChatSessionId==null,aiCfoView:o,isSubmitting:c,isNewChatSession:a.sessionFromUrl==="new_chat",isFullView:!0,tableDownloadEndPoint:`${_e}/tableDownload`,exportDownloadEndPoint:Oe(),emailLinkQuestion:a.emailLinkQuestion,autoSubmitEmailLinkQuestion:a.autoSubmitEmailLinkQuestion,onEmailLinkQuestionProcessed:a.onEmailLinkQuestionProcessed,isFileUploadEnabled:a.isFileUploadEnabled,isUploadPromoVisible:a.isUploadPromoVisible,onUploadPromoClose:a.onUploadPromoClose,...d}}),(function(e,a){const{location:o,currentTenant:c,userId:d,navigate:m,currentChatSessionId:h,allSessionsWithOrderedQuestionAnswers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,cardPolicyPageContext:U}=a,i=c.tenantEmailDomain,C=o.state?.referrer,p=C===K?X(i):j(i);return{onEventReceived:(n,t)=>{if(n===Y&&typeof t.text=="string"&&typeof t.metadata=="object"){const s=t,f=He(s.type),b=s.metadata.chat_session_id??null,{currentChatSession:y,currentQuestionAnswer:u,currentQuestionAnswerSummary:P}=W(E,b);f!=="answer"?$.trackAICFOChatResponseGenerated(f,u?.question.questionText??"",s.text,b,Fe(P,y),s.metadata.message_id??null):$.trackAICFOChatAnswerGenerated(s.text,u?.question.questionText??"",(s.follow_up_questions?.length??0)>0,!!s.assumptions,!!s.insights,s.visualization!=null,Me(s.visualization?.type??"")??null,b,s.summarized_title,s.metadata.message_id??null),e(Ne({chatSessionId:s.metadata.chat_session_id,responseType:f,fetchState:{fetchState:"Completed",error:void 0}})),e(ze({chatSessionId:s.metadata.chat_session_id,answerPayload:s,userId:d}))}},onSubmit:(n,t,s,f)=>{n&&Qe(e,n,t,h,E,d,f,s,U)},updateCurrentInput:n=>{e(N(n))},onStopSubmit:()=>{},onUpdateScrollYOffset:n=>{e(Be(n))},onSelectSampleQuestion:()=>{},onBackClick:()=>{m(-1)},onCloseClick:()=>{m(p,{state:{...o.state}}),e(N(""))},togglePageView:()=>{m(p,{state:z(o.state)}),a.setIsAiCfoOpen(!0)},onCopy:()=>{},onThumbsUp:()=>{},onThumbsDown:()=>{},onTogglePageView:()=>{m(-1)},onNewChatClick:()=>{h!=null&&e(Re()),m((function(n){return`/${n}/${J}`})(i),{state:{...o.state}})},onToggleCotCollapsed:(n,t)=>{e(qe({questionAnswerId:n,isCollapsed:t}))},...ve(e,{isAiCardCreationEnabled:T,isCardPolicyEnabled:x,currentChatSessionId:h,onAfterCardsCreationSubmit:()=>{a.setIsAiCfoOpen(!0),m(j(i),{state:{...o.state}})},onAfterCardPolicySubmit:()=>{a.setIsAiCfoOpen(!0),m(`/${i}/cards/policy`,{state:{...o.state}})}})}}))(Te(xe)),{spendManagement:{chargeCard:{cardsAiCfoHero:Z,cardPolicyAiCfoHero:ee}}}=ke.getLocalizedStrings(),A=Z.pageTitle,Ke=ee.pageTitle,Xe=Z.chatHeaderSubtitle,Ze=ee.chatHeaderSubtitle,St=({isFileUploadEnabled:e})=>{const{setIsAiCfoOpen:a}=Se(),o=pe(),c=he(),d=Ce(),[m,h]=l.useState(!1),{allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,onCardPolicyVendorSearchTextChange:U}=be();l.useEffect((()=>{o($e())}),[o]);const i=B((r=>G(r))),C=ye.getSignedInUser(),{session_id:p}=fe(),n=B((r=>je(r))),t=i.uiState.currentChatSessionId,s=n.tenantEmailDomain,{handleUploadPromoClose:f,isUploadPromoVisible:b}=Pe({isFileUploadEnabled:e,tenantEmailDomain:s}),y=d.state,u=y?.aiCfoInitialQuestion??null,P=!!y?.aiCfoShouldSubmit,I=y?.referrer===K,te=I?"card_policy":void 0,se=l.useMemo((()=>({title:I?Ke:A,subtitle:I?Ze:Xe})),[I]),[ae,_]=l.useState(null),[oe,O]=l.useState(!1),v=l.useRef(!1);l.useEffect((()=>{v.current||u==null||u===""||(_(u),O(P),v.current=!0)}),[u,P]);const ne=l.useCallback((()=>{_(null),O(!1),c(d.pathname,{replace:!0,state:z(d.state)})}),[d.pathname,d.state,c]),ie=n.masterTOSInfo,g=ie?.isMasterTOSAccepted??!1,k=l.useRef(null);l.useEffect((()=>{if(g&&k.current!=null){const{question:r,shouldSubmit:w}=k.current;k.current=null,_(r),O(w),v.current=!1}}),[g]);const{visitedSessions:L}=Ie(t),Q=i.fetchState,F=i.uiState.chatSessionsNextPageToken.hasMore||!i.uiState.chatSessionsFirstPageFetched,V=t!=null?i.fetchChatSessionHistoryByChatSessionId?.[t]?.fetchState??"Not-Started":"Not-Started",q=t==null||(i.uiState.chatHistoryNextPageToken[t]?.hasMore??!0),R=i.allSessionsWithOrderedQuestionAnswers,{currentSessionQuestionAnswers:re}=W(R,t),le=re.length===0;l.useEffect((()=>{t!=null&&p!==t&&c((function(r,w){return`/${r}/${J}/${w}`})(s,t),{state:{...d.state},replace:!0})}),[t,p,s,c,d.state]),l.useEffect((()=>{p!=null&&t==null&&p!=="new_chat"&&o(De({sessionId:p,agentId:"controller"}))}),[]);const de=l.useMemo((()=>({events:L.map((r=>`private-encrypted-chat-${r}.${Y}`)),eventCallback:(r,w,me)=>me.onEventReceived(r,w)})),[L]);if(l.useEffect((()=>{Q!=="In-Progress"&&F&&o(Le())}),[Q,F,o]),l.useEffect((()=>{t!=null&&V!=="In-Progress"&&q&&C!=null&&Q==="Completed"&&!F&&o(Ve(t,C.userId))}),[V,q,t,C,o]),C==null)throw Error("Can't access Cards AI CFO page without signing in...");const ce=p??"new_chat",ue=t!=null&&i.responseStateByChatSessionId?.[t]?.answer?.fetchState==="In-Progress";return S.jsxs(tt,{children:[S.jsx(we,{analytics:$,onLoad:r=>r.trackPageLoaded(Ae.Event.aiCFOPage)}),g?S.jsx(Je,{...de,currentChatSessionId:t,allSessionsWithOrderedQuestionAnswers:R,allUsers:E,isAiCardCreationEnabled:T,isCardPolicyEnabled:x,openOnboardingPage:()=>h(!0),userId:C.userId,setIsAiCfoOpen:a,navigate:c,sessionFromUrl:ce,location:d,isSubmitting:ue,isEmptyChatWithSession:le,customPageTitle:A,chatHeader:se,currentTenant:n,emailLinkQuestion:ae??void 0,autoSubmitEmailLinkQuestion:oe,onEmailLinkQuestionProcessed:ne,isFileUploadEnabled:e,isUploadPromoVisible:b,onUploadPromoClose:f,onCardPolicyVendorSearchTextChange:U,cardPolicyPageContext:te}):S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>{c(I?X(s):j(s),{state:{...d.state}})},onCompleteClick:()=>{g||n.userRoleId==null||(u!=null&&u!==""&&(k.current={question:u,shouldSubmit:P}),o(M(n.userRoleId)))}}),S.jsx(We,{anchor:"right",open:m,transitionDuration:250,PaperProps:{component:st,style:{width:`${Ee}vw`}},slotProps:{backdrop:{style:{backgroundColor:"transparent",cursor:"pointer"}}},onClose:()=>h(!1),children:S.jsx(et,{onClick:r=>r.stopPropagation(),children:S.jsx(H,{isTOSAccepted:g,acceptMasterTOSState:i.masterTOSAcceptanceState,customPageTitle:A,onCloseClick:()=>h(!1),onCompleteClick:()=>{g||n.userRoleId==null||o(M(n.userRoleId)),h(!1)}})})})]})},et=D(Ye)`
|
|
2
2
|
display: flex;
|
|
3
3
|
min-height: 100%;
|
|
4
4
|
flex-direction: column;
|
|
@@ -11,4 +11,4 @@ import{j as g}from"./liveblocks-mJJR3MsR.js";import{a as l}from"./sentry-CItQHKp
|
|
|
11
11
|
`,st=D(Ge)`
|
|
12
12
|
box-shadow: ${({theme:e})=>e.colors.elevation2};
|
|
13
13
|
color: ${({theme:e})=>e.colors.grey4};
|
|
14
|
-
`;export{
|
|
14
|
+
`;export{St as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-mJJR3MsR.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-CMivCywN.js";import{fO as Pt,$9 as is,f_ as wt,bt as ve,$a as ds,$b as ls,fD as fn,$c as Pn,fM as wn,$d as Tn,$e as vn,$f as Fn,$g as xn,fN as Bn,fZ as Ln,$h as Rn,$i as us,fT as ms,fS as Cs,$j as ps,Jm as On,g0 as ia,$k as hs,$l as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$m as Ss,fW as ys,IU as Is,IT as ks,IX as Es,IZ as As,g6 as Ds,fA as $n,$n as _s,$o as Ps,gb as Mn,$p as ws,gc as yt,J3 as Ts,J0 as vs,fB as fe,$q as qa,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$r as ua,$s as Tt,Cf as Ga,m3 as Ka,$t as za,JC as ka,g1 as qe,JE as vt,lV as Nn,$u as ma,Jq as _a,$v as Fs,$w as xs,Jt as Ja,$x as Bs,Yk as Qa,fY as Vn,Jz as ba,im as Ls,$y as Hn,fP as Ca,br as Rs,$z as Os,gD as Xa,gC as et,K6 as Us,gB as at,$A as Gn,ct as Kn,d6 as js,Yj as wa,KH as zn,$B as gn,Kh as Pa,$C as Yn,KI as $s,YJ as Ms,KJ as Ns,LO as Vs,Bv as Hs,LI as Gs,$D as Ks,JD as oa,$E as zs,$F as Ys,$G as Ws,$H as Zs,$I as qs,$J as Ft,$K as Js,JT as Wn,JM as Qs,$L as Xs,gZ as eo,$M as Zn,K0 as qn,K4 as Jn,gY as ao,$N as to,Kt as Qn,$O as no,$P as ro,$Q as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$R as rr,$S as co,g8 as io,g9 as lo,ga as uo,$T as tt,g2 as sr,d8 as xt,$U as mo,$V as Co,$W as po,$X as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$Y as or,KG as Ha,Rx as ko,$Z as Eo,$_ as Ao,$$ as Do,a00 as cr,a01 as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,a02 as To,a03 as vo,Jn as Fo,a04 as dr,fX as lr,a05 as xo,Jp as Bo,Jo as bn,a06 as Lo,a07 as Ro,a08 as Oo,UE as Uo,a09 as Bt,a0a as jo,Fm as ur,mD as $o,ib as Mo,L6 as No,a0b as mr,fJ as Vo,fK as Ho,a0c as Go,dJ as Ko,f$ as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cF as qo,bK as Jo,Tw as Qo}from"./zeni-epic-state-CqKBThJ0.js";import{J as Le,dd as Cr,a4 as we,de as pr,df as hr,dg as Xo,G as ea,as as Lt,dh as ec,di as ac,a as fr,d as gr,ar as br,p as ke,O as le,y as W,g as ya,dj as Sr,dk as tc,dl as nc,z as te,a7 as Ta,d2 as nt,dm as rc,dn as sc,dp as oc,a1 as va,bi as Qe,bE as Rt,dq as cc,ab as Fa,X as rt,E as Ot,h as ae,w as st,dr as ic,bQ as Sa,ds as kt,dt as dc,a8 as Ut,du as lc,ae as yr,av as Et,dv as uc,aq as Ir,I as kr,Q as Er,dw as mc,dx as Cc,dy as pc,dz as hc,dA as fc,dB as gc,dC as bc,F as Ya,dD as Sc,dE as yc,m as ht,U as Ic,dF as kc,dG as Ec,dH as Ac,ai as Dc,dI as _c,dJ as Pc,f as wc}from"./index-D90YkzK-.js";import{n as Ne,D as Ar,S as Tc}from"./mui-C6XtNCo7.js";import{a as r}from"./sentry-CItQHKpv.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CywXA9k2.js";import{M as Ee}from"./MobileAppDrawer-BJV6BsMX.js";import{d as jt}from"./recharts-Co0_Dmc-.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-C1Oev9K8.js";import{u as Tr}from"./useInitialThreadRequest-ChCTxMqY.js";import ot from"./NotFoundScreen-BnVyPaPi.js";import{u as Nt}from"./useChargeCardPusherEvents-93KEXKtp.js";import{n as yn}from"./utils-macSqF2O.js";import{t as Lc}from"./AddressScreen-_R6CTIVH.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B60T1gBh.js";import"./BusinessVerificationPageScreen-afqV4Atk.js";import"./routePaths-BRn4bxlT.js";import"./analyticsHelper-CqV558Dq.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="52b1301e-2385-451f-820a-7b09473b1092",e._sentryDebugIdIdentifier="sentry-dbid-52b1301e-2385-451f-820a-7b09473b1092")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
1
|
+
import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-CiFsHd3i.js";import{fO as Pt,$5 as is,f_ as wt,bt as ve,$6 as ds,$7 as ls,fD as fn,$8 as Pn,fM as wn,$9 as Tn,$a as vn,$b as Fn,$c as xn,fN as Bn,fZ as Ln,$d as Rn,$e as us,fT as ms,fS as Cs,$f as ps,Jm as On,g0 as ia,$g as hs,$h as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$i as Ss,fW as ys,IU as Is,IT as ks,IX as Es,IZ as As,g6 as Ds,fA as $n,$j as _s,$k as Ps,gb as Mn,$l as ws,gc as yt,J3 as Ts,J0 as vs,fB as fe,$m as qa,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$n as ua,$o as Tt,Cf as Ga,m3 as Ka,$p as za,JC as ka,g1 as qe,JE as vt,lV as Nn,$q as ma,Jq as _a,$r as Fs,$s as xs,Jt as Ja,$t as Bs,Yg as Qa,fY as Vn,Jz as ba,im as Ls,$u as Hn,fP as Ca,br as Rs,$v as Os,gD as Xa,gC as et,K6 as Us,gB as at,$w as Gn,ct as Kn,d6 as js,Yf as wa,KH as zn,$x as gn,Kh as Pa,$y as Yn,KI as $s,YF as Ms,KJ as Ns,LO as Vs,Bv as Hs,LI as Gs,$z as Ks,JD as oa,$A as zs,$B as Ys,$C as Ws,$D as Zs,$E as qs,$F as Ft,$G as Js,JT as Wn,JM as Qs,$H as Xs,gZ as eo,$I as Zn,K0 as qn,K4 as Jn,gY as ao,$J as to,Kt as Qn,$K as no,$L as ro,$M as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$N as rr,$O as co,g8 as io,g9 as lo,ga as uo,$P as tt,g2 as sr,d8 as xt,$Q as mo,$R as Co,$S as po,$T as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$U as or,KG as Ha,Rx as ko,$V as Eo,$W as Ao,$X as Do,$Y as cr,$Z as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,$_ as To,$$ as vo,Jn as Fo,a00 as dr,fX as lr,a01 as xo,Jp as Bo,Jo as bn,a02 as Lo,a03 as Ro,a04 as Oo,UA as Uo,a05 as Bt,a06 as jo,Fm as ur,mD as $o,ib as Mo,L6 as No,a07 as mr,fJ as Vo,fK as Ho,a08 as Go,dJ as Ko,f$ as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cF as qo,bK as Jo,Ts as Qo}from"./zeni-epic-state-BdFiPfcm.js";import{V as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Xo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,d as gr,ap as br,p as ke,O as le,y as W,g as ya,dh as Sr,di as tc,dj as nc,z as te,a5 as Ta,d0 as nt,dk as rc,dl as sc,dm as oc,$ as va,bg as Qe,bC as Rt,dn as cc,a9 as Fa,T as rt,E as Ot,h as ae,w as st,dp as ic,bO as Sa,dq as kt,dr as dc,a6 as Ut,ds as lc,ac as yr,at as Et,dt as uc,ao as Ir,I as kr,N as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,F as Ya,dB as Sc,dC as yc,m as ht,U as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,f as wc}from"./index-juRht-9c.js";import{n as Ne,D as Ar,S as Tc}from"./mui-FQy08n5j.js";import{a as r}from"./sentry-Lj2WEO6K.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Dhoa0fnv.js";import{M as Ee}from"./MobileAppDrawer-BAV0ejOs.js";import{d as jt}from"./recharts-CYbL6OhC.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-CPUD_j1y.js";import{u as Tr}from"./useInitialThreadRequest-D-SxLs4P.js";import ot from"./NotFoundScreen-ButYFiTG.js";import{u as Nt}from"./useChargeCardPusherEvents-YQlWLN09.js";import{n as yn}from"./utils-DsJsAXTJ.js";import{t as Lc}from"./AddressScreen-Dmypz8Cm.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./InboxNotificationsProvider-55rQDTXA.js";import"./useTaskManagerAccess-BrCmQLIc.js";import"./BusinessVerificationPageScreen-DzWgqXwG.js";import"./routePaths-DqksJ4i_.js";import"./analyticsHelper-Cjtujqyf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b4b93283-5558-4471-a603-845e32572659",e._sentryDebugIdIdentifier="sentry-dbid-b4b93283-5558-4471-a603-845e32572659")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-
|
|
1
|
+
import{j as m}from"./liveblocks-CkQ2CY6T.js";import{a as g}from"./sentry-Lj2WEO6K.js";import{h as w,u as x,g as T,i as k,j as O,l as E}from"./core-CiFsHd3i.js";import{z as N,bp as F,a6 as P,h as A,N as V,l as b,bq as j,ac as L,aE as U,p as B}from"./index-juRht-9c.js";import{fB as D,gF as M,AW as _,gA as R,c7 as z,Xp as G,bn as q,ui as X,u6 as Y,mv as H,o4 as S,Xq as W,bE as Z,cD as C,of as $,op as J}from"./zeni-epic-state-BdFiPfcm.js";import"./mui-FQy08n5j.js";import{d as K}from"./routePaths-DqksJ4i_.js";import{M as Q}from"./MobileAppDrawer-BAV0ejOs.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]="d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb",t._sentryDebugIdIdentifier="sentry-dbid-d9ed6a0e-cc8e-4be6-9d29-7922cd7debfb")}catch{}})();const ee=E((function(t){const a=R(t),i=N.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:`${L.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(J())},onAddressClick:e=>{const n=K(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({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?C(u):void 0,meetingLink:y!=""&&y!=null?C(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};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(W(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(Y(e))},onEditFileName:(e,n)=>{t(X(e,n.split(".")[0]))}}}))(j);function de(){const t=w(),a=x(),i=T(),{tenantEmailDomain:p}=k(),[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??N.getSignedInUserTenant(p)?.companyId;if(N.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:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(Q,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as I}from"./liveblocks-
|
|
1
|
+
import{j as I}from"./liveblocks-CkQ2CY6T.js";import{a as o}from"./sentry-Lj2WEO6K.js";import{u as R,h as k,g as H,j as C,N as w}from"./core-CiFsHd3i.js";import{T9 as q,fB as z,gh as G,pO as B,gJ as O,gg as J,ge as Q,Tv as V,gd as A}from"./zeni-epic-state-BdFiPfcm.js";import{u as K,z as E,L as v,G as M,F as W}from"./index-juRht-9c.js";import{n as X}from"./mui-FQy08n5j.js";import{P as h,a as D}from"./AccountMappingScreen-UdzIeE_v.js";import{t as Y}from"./getLocaleForTenant-CRduVQsY.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-BmXy-56M.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";import"./MobileAppDrawer-BAV0ejOs.js";import"./InboxNotificationsProvider-55rQDTXA.js";import"./useTaskManagerAccess-BrCmQLIc.js";import"./accountMappingHelper-CAg2qsF3.js";import"./empty-4iGv0vIv.js";import"./pdf-lib-C9DR7g8H.js";import"./index-CVbu1_bp.js";import"./url-DhKb0GNI.js";import"./index-Cz99TrBA.js";import"./decodeURIComponentSafe-FYjI-TwW.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]="0e6f07f7-cda6-4aff-8d67-bc131e2a1225",t._sentryDebugIdIdentifier="sentry-dbid-0e6f07f7-cda6-4aff-8d67-bc131e2a1225")}catch{}})();const te=X.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
flex-direction: row;
|
|
@@ -8,4 +8,4 @@ import{j as I}from"./liveblocks-mJJR3MsR.js";import{a as o}from"./sentry-CItQHKp
|
|
|
8
8
|
height: 100vh;
|
|
9
9
|
background-color: ${t=>t.theme.colors.background};
|
|
10
10
|
box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
-
`;function we(){const t=R(),i=k(),
|
|
11
|
+
`;function we(){const t=R(),i=k(),_=H(),{setLoading:c,clearAllLoading:m}=K(),S=o.useRef(!1),x=o.useRef(!1),N=o.useRef(!1),f=o.useRef(!1),{code:U,realmId:$,state:F}=Z(_.search),p=U!==""&&$!==""&&F!=="";p&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===D.pending,L=j===D.ready,b=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,d=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{c(v.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(v.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,c]),o.useEffect((()=>{e.tenantId==null&&!x.current&&a!=null&&(x.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(B(a.userId)))}),[x,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(v.CONNECTION_AUTH),t(O(a.userId,e.tenantId)))}),[d]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(J(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),Q(a?.userId,a?.zeniSessionId,e.tenantId),M.updateAppLocaleID(Y(V(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(O(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{b.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(b.tenantsCoreDetailsInOrder)}),[b.tenantsCoreDetailsInOrder.length,n]);const T=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&d==="In-Progress"&&(f.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||T)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return f.current&&d==="Completed"?(sessionStorage.setItem(h,D.ready),m(),void i(s,{replace:!0})):f.current&&d==="Error"?(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(p||N.current||f.current||y!==!0||(sessionStorage.removeItem(h),t(A({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,T,d,p,y,e.tenantEmailDomain,m,t,i]),T)return null;if(p||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const P=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return L?I.jsx(w,{to:P,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-CkQ2CY6T.js";import{z as a}from"./index-juRht-9c.js";import{g as n}from"./QBOConnectionScreen-BmXy-56M.js";import"./sentry-Lj2WEO6K.js";import{g as p,N as s}from"./core-CiFsHd3i.js";import"./zeni-epic-state-BdFiPfcm.js";import"./recharts-CYbL6OhC.js";import"./mui-FQy08n5j.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";import"./empty-4iGv0vIv.js";import"./pdf-lib-C9DR7g8H.js";import"./index-CVbu1_bp.js";import"./url-DhKb0GNI.js";import"./index-Cz99TrBA.js";import"./decodeURIComponentSafe-FYjI-TwW.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]="c18cd95e-770d-4ff7-92bf-3374948ea538",t._sentryDebugIdIdentifier="sentry-dbid-c18cd95e-770d-4ff7-92bf-3374948ea538")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),d=a.getSignedInUser()?.userId??"";if(f(o,r,e,d)===!0){const m=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:m})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-CkQ2CY6T.js";import{t as An,A as Ge}from"./AddressScreen-Dmypz8Cm.js";import wn from"./NotFoundScreen-ButYFiTG.js";import{a as d,t as Me}from"./sentry-Lj2WEO6K.js";import{h as _e,g as Te,u as se,i as xe,j as E,N as Q,q as Pn,l as cn,n as Dn,o as H}from"./core-CiFsHd3i.js";import{fB as Y,dV as Ee,dU as Ae,bq as Bn,Tn as jn,bR as Un,pM as Fn,AG as Vn,AJ as Rn,UI as Ln,UJ as Nn,lq as Oe,lt as dn,TY as $n,b_ as Gn,c7 as fe,B8 as we,AV as Mn,UK as me,B9 as un,RA as Qn,mD as ln,de as pn,UL as Kn,UM as zn,t$ as qn,TM as be,hS as Hn,TL as Ce,hP as Jn,Fy as Zn,u3 as Wn,hH as Xn,hK as Qe,UN as mn,UO as Yn,Ll as et,UP as nt,Lp as tt,AM as at,UQ as ot,UR as st,lo as rt,lr as it,Bl as ct,AX as gn,B7 as dt,bE as Ke,cD as ut,Bk as ze,ui as lt,u6 as pt,mv as mt,gD as gt,gC as ft,gB as yt,US as ht,AP as bt,Bm as Ct,Bp as St,Bs as It,By as kt,df as Ot}from"./zeni-epic-state-BdFiPfcm.js";import{z,O as Pe,y as W,n as vt,p as q,a6 as re,h as g,aC as _t,ag as fn,$ as Tt,U as yn,V as hn,g as X,T as ge,N as ve,aD as xt,F as qe,r as He,ac as Et,aE as Je,aF as At,aG as wt}from"./index-juRht-9c.js";import{n as De}from"./mui-FQy08n5j.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-BmXy-56M.js";import{u as Bt,a as jt}from"./useEmailConnectResultRefresh-DpIv7GW3.js";import{u as Ut}from"./useChargeCardPusherEvents-YQlWLN09.js";import"./recharts-CYbL6OhC.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./utils-DsJsAXTJ.js";import"./empty-4iGv0vIv.js";import"./pdf-lib-C9DR7g8H.js";import"./index-CVbu1_bp.js";import"./url-DhKb0GNI.js";import"./index-Cz99TrBA.js";import"./decodeURIComponentSafe-FYjI-TwW.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="95b9f1bb-e5f1-41eb-a16d-1a08cea986eb",e._sentryDebugIdIdentifier="sentry-dbid-95b9f1bb-e5f1-41eb-a16d-1a08cea986eb")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Ft=()=>{const e=_e(),l=Te(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),n=z.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:b}=t(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(W.isArAgingFeatureEnabled),{isFeatureEnabled:w}=t(W.isReferralFeatureEnabled),{isFeatureEnabled:A}=t(W.isDebitCardFeatureEnabled),k=vt(),O=E((S=>Y(S))),P=E((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,U=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=Ee(A,O),C=Ae(O),D=[],V=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Bn(O?.userRole),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;V===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),T===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&D.push("rewards_card");const f=E((S=>{const F=[];b===!1&&F.push("accounts_payable_aging"),o===!1&&F.push("accounts_receivable_aging"),F.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&F.push("rewards_card"),k===!1&&F.push("expense_automation_card");const J=jn(S,F);return Un(J.reportsInOrder.map((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||C||(p(!0),i(Fn(n.userId,U,O.tenantId,!0,!1,D)))}),[a,P,m,C,n,O.tenantId,i]);const B=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":C?"../../cards":"../../dashboard",{state:S})}),[e,l,m,C]),$=d.useCallback((()=>{B.current||(B.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||C||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,C,$]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:$})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
5
|
+
`,en=De.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
${e=>e.skipLegacyDrawerOffset?`
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding-left: ${qe.sp0};
|
|
15
|
+
`:`
|
|
16
|
+
min-width: calc(100% - ${He}px);
|
|
17
|
+
padding-left: ${He}px;
|
|
18
|
+
`}
|
|
19
|
+
|
|
20
|
+
${e=>e.theme.breakpoints.down("md")} {
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding-left: ${qe.sp0};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
+
`,nn=cn((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=Y(e),b=we(e,i),o=mn(e),w=fe(p?.userRole??[])&&b.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",A=Yn(e.userRoleConfigState);return{onboardingCustomerView:b,analytics:g,isRefreshingViewInBackground:!1,isDisabled:w,companyTitles:A.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Et.fileMicroServiceBaseUrl,authParams:n},signedInUser:z.getSignedInUser(),currentTenant:t,isAdmin:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,b)=>{e(St(n,t,b))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(Ct(!1,n,t))},onEstablishConnectionSuccess:()=>{e(bt(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((b=>{const{officerType:o,userId:w,name:A,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:U,syncToken:m,selectDocument:C,role:D,ownership:V,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,isPhoneVerified:x}=b;let f;return C.selectDocumentType==="driverLicense"?f="driving_license":C.selectDocumentType==="passport"?f="passport":C.selectDocumentType==="stateId"?f="id_document":C.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:o,userId:w,firstName:A.firstName,lastName:A.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Je(P.selectedOption):void 0,phone:U,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:V,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:x}}));e(ze({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(ht({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:b,companyIndustryType:o,companyLegalName:w,companyTaxId:A,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:U,primaryContactSyncToken:m,syncToken:C,fileIds:D,typeOfIncorporation:V,stateOfIncorporation:h,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:B,purposeOfAccount:N,purposeOfAccountDescription:$,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:F,usNexus:J,usNexusTypes:G}=n,M={companyId:i,companyDescription:t,companyIndustry:b.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:w,taxIdOrEIN:A,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:C,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:V?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:x,companySubIndustry:f?.selectedOption??"",countriesOfOperations:B?.selectedOptions.map((R=>R.length===2?R:Je(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:$,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:F,usNexus:J,usNexusTypes:G?.selectedOptions??[]},ce={userId:U,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const b=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(b,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(n,t)=>{const b=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(b,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(n,t,b)=>{e(dt(i,!1,t,b,n))},onAddressEditHandler:n=>{if(n!=null){const t=An(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,b)=>{e(rt(n,t,b))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(xt),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=fn(),p=_e(),u=Te(),c=se(),v=Tt(),n=yn(),[t,b]=d.useState(!1),[o,w]=d.useState(!1),[A,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:U}=_(W.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),C=E((y=>y.onboardingCustomerViewState.fetchState)),D=E((y=>y.onboardingCustomerViewState.currentStep)),V=E((y=>y.onboardingCustomerViewState.uiState)),h=E((y=>Y(y))),r=E((y=>y.userRoleConfigState.fetchState)),T=E((y=>y.cardPaymentViewState)),x=X(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:B,realmId:N,state:$}=Pt(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,F=L?.connectionId??"",J=z.getSignedInUser()?.userId??"",G=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(w(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{A||(dn(["card"]),k(!0))}),[A]),d.useEffect((()=>{x==="In-Progress"&&f==="Completed"&&c(Oe())}),[x,f]),d.useEffect((()=>{Dt(B,N,$,F,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&C==="Completed"&&(c($n(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:B,realm_id:N,connection_id:F,user_id:J},Gn(window.location.origin+"/onboarding/auth"))),G.current={realmId:N,connectionId:F},g.trackOnboardingSaveQBOConnection(N,F),p(u.pathname))}),[B,N,$,u.pathname,C]),d.useEffect((()=>{ie.isInitiated===!1&&C==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[C]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=E((y=>we(y,M)));d.useEffect((()=>{t||C!=="Not-Started"||M==null||(b(!0),c(Mn(M,!0,!m)))}),[t,C,M]);const ne=h.externalConnections?.saveConnectionState,Be=X(ne);d.useEffect((()=>{Be==="In-Progress"&&(ne==="Completed"||ne==="Error")&&V.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess(G.current.realmId,G.current.connectionId):g.trackOnboardingQBOConnectionFailed(G.current.realmId,G.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,Be,V.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{C==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,C]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const bn=X(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&bn==null&&c(ln({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Cn=R.isInterimEmailSent,je=z.getSignedInUser();if(je==null)throw Error("Can't access onboarding flow without signing in...");const Sn=Ee(U,h),In=Ae(h),Ue=h.company?.companyOnboardingInfo.isOnboardingCompleted,Fe=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Ve=Vt({tenantEmailDomain:O??"",signedInUserEmail:je.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=E((j=>j.onboardingCustomerViewState?.aiAgentsActivation)),te=E((j=>Y(j).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vn())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Rn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const j=`private-encrypted-${y}`;return[`${j}.ledger-ingestion.counts-updated`,`${j}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((j,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(j!=="ledger-ingestion.counts-updated"){if(j==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Ln({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Ut({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const j=de?.phases??[],ae=We(j,Se),I=We(j,Ie),ue=Xe(j,Se),Z=Xe(j,Ie),Ne=j.some((En=>En.status!=="idle")),oe=!te&&!Ne,$e=te&&!Ne,Tn=$e?Se.map((()=>"building")):ae,xn=$e?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:Tn,backgroundRowStatuses:oe?void 0:xn,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});if(Ue===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Fe(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Ue===!1&&P?.loggedInUserRoleMap!=null)return Cn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Fe(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ve,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Vt=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=Bt(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=jt({companyId:i}),n=E((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=E((r=>Y(r))),b=E((r=>r.tenantState.fetchState)),o=E((r=>Kn(r,i))),w=E((r=>zn(r,ke))),A=d.useMemo((()=>new Set(w.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[w]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{a(qn(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,U=X(P);d.useEffect((()=>{U==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,U,_]);const m=o.externalConnections?.saveOAuthConnectionState,C=o.externalConnections?.saveOAuthConnectionError?.message,D=X(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",C??""))}),[m,D,C]);const V=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=X(V);return d.useEffect((()=>{const r=V??{},T=h??{},x=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let B;try{B=be(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(B,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(B,"Onboarding","payments",x[f]?.message??"")}))}),[V,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:b==="In-Progress",notifyMeRegisteredSlugs:A,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,T])=>[r,T?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,T)=>{const x=o.externalConnections?.revenue?.find((B=>B.connectionName==="hubspot"))?.connectionId;if(x==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:T,connection_id:x,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,T)=>{const x=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((B=>B.connectionId===r))?.connectionName;let f;try{f=x!=null?be(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),a(Xn(k,r,Ce(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Wn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Zn())},onSaveChargeBeeCredentials:(r,T)=>{const x=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Jn(k,x,Ce("revenue"),be("chargebee"),{api_key:r,site:T})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(Hn(k,Ce("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,o,b,A,p,k,l,e,a,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const on=De.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
30
|
+
`,sn=cn((function(e,l){const{companyId:i,currentTenant:a}=l,p=we(e,i),u=mn(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(a?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:a}}),(function(e,l){const{currentTenant:i,themeState:a,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{a.toggle()},handleLogOutClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:v,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${c}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(wt),Rt=()=>{const e=fn(),l=_e(),i=se(),a=Te(),p=yn(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),n=hn(),[t,b]=d.useState(!1);d.useEffect((()=>{t===!1&&a.state?.message==="OnboardingThankyou"&&b(!0)}),[a.state]);const o=E((m=>Y(m))),w=o.productSettings.isOtherProductsEnabled,A=w===!0&&!pn(o);d.useEffect((()=>{i(gn(k,!1,!A))}),[]);const k=o.companyId??z.getSignedInUserTenant(v)?.companyId;if(n.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Ee(c,o),P=Ae(o),_=E((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),U=o.company?.companyOnboardingInfo.isOnboardingCompleted;if(U!==!0||A)return _==="Completed"&&U===!0&&A&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",Ot(o.productSettings))}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:w,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&U===!1&&n?.loggedInUserRoleMap!=null?s.jsxs(on,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(sn,{navigate:l,showUpdatePaymentDetailButton:w,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:t,meetingUrl:e("onboarding_overview")})]}):s.jsx(At,{});{const m={pathnameStackToGoBack:a.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rn(){return typeof Me=="function"?Me():void 0}let pe=0;function Lt(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const a=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rn();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&a()}),1e3)),()=>{l=!0,a(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rn();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Lt(),s.jsxs(Dn,{children:[s.jsx(H,{path:"/",element:s.jsx(le,{})}),s.jsx(H,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(H,{path:"/thankyou",element:s.jsx(Rt,{})}),s.jsx(H,{path:"/activation",element:s.jsx(Ft,{})}),s.jsx(H,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx(Ge,{})})}),s.jsx(H,{path:"*",element:s.jsx(wn,{})})]})}export{pa as default};
|