diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 15927fda953e..8551e67aea6b 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -10,7 +10,7 @@ import usePolicy from '@hooks/usePolicy'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import {openTravelDotLink} from '@libs/actions/Link'; -import {cleanupTravelProvisioningSession} from '@libs/actions/Travel'; +import {cleanupTravelProvisioningSession, requestTravelAccess} from '@libs/actions/Travel'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import {getActivePolicies, getAdminsPrivateEmailDomains, isPaidGroupPolicy} from '@libs/PolicyUtils'; @@ -147,6 +147,9 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN); } else if (!isBetaEnabled(CONST.BETAS.IS_TRAVEL_VERIFIED)) { setVerificationModalVisibility(true); + if (!travelSettings?.lastTravelSignupRequestTime) { + requestTravelAccess(); + } } // Determine the domain to associate with the workspace during provisioning in Spotnana. // - If all admins share the same private domain, the workspace is tied to it automatically. @@ -177,6 +180,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se isUserValidated, groupPaidPolicies.length, isBetaEnabled, + travelSettings?.lastTravelSignupRequestTime, ]); return ( diff --git a/src/languages/en.ts b/src/languages/en.ts index 25cddeaaf6b8..7c85fc4d4505 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3300,8 +3300,8 @@ const translations = { message: `Your admin has turned off Expensify Travel. Please follow your company's booking policy for travel arrangements.`, }, verifyCompany: { - title: 'Get started with travel today!', - message: `Please contact your Account manager or salesteam@expensify.com to get a demo of travel and have it enabled for your company.`, + title: "We're reviewing your request...", + message: `We're running a few checks on our end to verify your account is ready for Expensify Travel. We'll be in touch shortly!`, }, updates: { bookingTicketed: ({airlineCode, origin, destination, startDate, confirmationID = ''}: FlightParams) => diff --git a/src/languages/es.ts b/src/languages/es.ts index 87f10ee3d78c..37a33045da75 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3292,8 +3292,8 @@ const translations = { message: 'Tu administrador ha desactivado Expensify Travel. Por favor, sigue la política de reservas de tu empresa para organizar tus viajes.', }, verifyCompany: { - title: '¡Empieza a viajar hoy mismo!', - message: `Por favor, contacta a tu gestor de cuenta o a salesteam@expensify.com para solicitar una demostración de Travel y habilitarlo para tu empresa.`, + title: 'Estamos revisando tu solicitud...', + message: `Estamos realizando algunas comprobaciones para verificar que tu cuenta esté lista para Expensify Travel. ¡Nos pondremos en contacto contigo en breve!`, }, updates: { bookingTicketed: ({airlineCode, origin, destination, startDate, confirmationID = ''}: FlightParams) => diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index f35981808c92..68d1504d5c75 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -486,6 +486,7 @@ const WRITE_COMMANDS = { COMPLETE_CONCIERGE_CALL: 'CompleteConciergeCall', FINISH_CORPAY_BANK_ACCOUNT_ONBOARDING: 'FinishCorpayBankAccountOnboarding', REOPEN_REPORT: 'ReopenReport', + TRAVEL_SIGNUP_REQUEST: 'RequestTravelAccess', IMPORT_PLAID_ACCOUNTS: 'ImportPlaidAccounts', } as const; @@ -993,6 +994,7 @@ type WriteCommandParameters = { // Change transaction report [WRITE_COMMANDS.CHANGE_TRANSACTIONS_REPORT]: Parameters.ChangeTransactionsReportParams; + [WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST]: null; }; const READ_COMMANDS = { diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index b3a892c99ab6..f915f0505380 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -54,8 +54,21 @@ function acceptSpotnanaTerms(domain?: string) { API.write(WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS, params, {optimisticData, successData, failureData}); } +function requestTravelAccess() { + const optimisticData: OnyxUpdate[] = [ + { + onyxMethod: 'merge', + key: ONYXKEYS.NVP_TRAVEL_SETTINGS, + value: { + lastTravelSignupRequestTime: Date.now(), + }, + }, + ]; + API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, null, {optimisticData}); +} + function cleanupTravelProvisioningSession() { Onyx.merge(ONYXKEYS.TRAVEL_PROVISIONING, null); } -export {acceptSpotnanaTerms, cleanupTravelProvisioningSession}; +export {acceptSpotnanaTerms, cleanupTravelProvisioningSession, requestTravelAccess}; diff --git a/src/types/onyx/TravelSettings.ts b/src/types/onyx/TravelSettings.ts index bd6f6016fd89..0cffb077c9da 100644 --- a/src/types/onyx/TravelSettings.ts +++ b/src/types/onyx/TravelSettings.ts @@ -8,6 +8,9 @@ type TravelSettings = { /** Whether the user is setup for staging travelDot */ testAccount?: boolean; + + /** The last travel signup request time */ + lastTravelSignupRequestTime?: string; }; /** Model of workspace travel information to connect with Spotnana */