From a1acadc15ce9f0459aa044037f95b872de74110c Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Fri, 30 May 2025 18:30:58 -0400 Subject: [PATCH 01/12] Create an automated GH when users want to enable travel --- src/components/BookTravelButton.tsx | 4 ++-- src/libs/API/types.ts | 1 + src/libs/actions/Travel.ts | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 76b7555cfac1..9a15874ed9e9 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -10,8 +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 Log from '@libs/Log'; +import {cleanupTravelProvisioningSession, travelSignupRequest} from '@libs/actions/Travel';import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import {getActivePolicies, getAdminsPrivateEmailDomains, isPaidGroupPolicy} from '@libs/PolicyUtils'; import colors from '@styles/theme/colors'; @@ -137,6 +136,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN); } else if (!isTravelVerified) { setVerificationModalVisibility(true); + travelSignupRequest(); } // 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. diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 56199380b62c..ba6f771b7aeb 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -484,6 +484,7 @@ const WRITE_COMMANDS = { FINISH_CORPAY_BANK_ACCOUNT_ONBOARDING: 'FinishCorpayBankAccountOnboarding', REOPEN_REPORT: 'ReopenReport', GET_GUIDE_CALL_AVAILABILITY_SCHEDULE: 'GetGuideCallAvailabilitySchedule', + TRAVEL_SIGNUP_REQUEST: 'TravelSignupRequest', } as const; type WriteCommand = ValueOf; diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index b3a892c99ab6..8357816923d4 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -54,8 +54,12 @@ function acceptSpotnanaTerms(domain?: string) { API.write(WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS, params, {optimisticData, successData, failureData}); } +function travelSignupRequest() { + API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, {}); +} + function cleanupTravelProvisioningSession() { Onyx.merge(ONYXKEYS.TRAVEL_PROVISIONING, null); } -export {acceptSpotnanaTerms, cleanupTravelProvisioningSession}; +export {acceptSpotnanaTerms, cleanupTravelProvisioningSession, travelSignupRequest}; From e5d9936ea280bbd1cf0f4f5a7405aa4492324879 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Fri, 30 May 2025 18:31:55 -0400 Subject: [PATCH 02/12] update copy --- src/languages/en.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index ef7a7c83c42c..2b9bd17f50e4 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2941,8 +2941,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!`, }, }, workspace: { From f88b0d57c7f65d06d6259fde32cae7975d818701 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 17:32:54 -0400 Subject: [PATCH 03/12] Fix style --- src/components/BookTravelButton.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 4567ab57087d..b705404ff583 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -10,7 +10,8 @@ import usePolicy from '@hooks/usePolicy'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import {openTravelDotLink} from '@libs/actions/Link'; -import {cleanupTravelProvisioningSession, travelSignupRequest} from '@libs/actions/Travel';import Log from '@libs/Log'; +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'; import colors from '@styles/theme/colors'; From 3f35c6ad06723209a12e9dc0dafa3db87ad37c21 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 17:34:15 -0400 Subject: [PATCH 04/12] Rename function to match web-e --- src/components/BookTravelButton.tsx | 4 ++-- src/libs/API/types.ts | 2 +- src/libs/actions/Travel.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index b705404ff583..2a8051104de9 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, RequestTravelAccess} 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'; @@ -137,7 +137,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN); } else if (!isBetaEnabled(CONST.BETAS.IS_TRAVEL_VERIFIED)) { setVerificationModalVisibility(true); - travelSignupRequest(); + 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. diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index ba6f771b7aeb..51eace90644c 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -484,7 +484,7 @@ const WRITE_COMMANDS = { FINISH_CORPAY_BANK_ACCOUNT_ONBOARDING: 'FinishCorpayBankAccountOnboarding', REOPEN_REPORT: 'ReopenReport', GET_GUIDE_CALL_AVAILABILITY_SCHEDULE: 'GetGuideCallAvailabilitySchedule', - TRAVEL_SIGNUP_REQUEST: 'TravelSignupRequest', + TRAVEL_SIGNUP_REQUEST: 'RequestTravelAccess', } as const; type WriteCommand = ValueOf; diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index 8357816923d4..61a0eb09e70e 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -54,7 +54,7 @@ function acceptSpotnanaTerms(domain?: string) { API.write(WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS, params, {optimisticData, successData, failureData}); } -function travelSignupRequest() { +function requestTravelAccess() { API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, {}); } @@ -62,4 +62,4 @@ function cleanupTravelProvisioningSession() { Onyx.merge(ONYXKEYS.TRAVEL_PROVISIONING, null); } -export {acceptSpotnanaTerms, cleanupTravelProvisioningSession, travelSignupRequest}; +export {acceptSpotnanaTerms, cleanupTravelProvisioningSession, requestTravelAccess}; From 00a57c6f0271bf132f3507017b93bd67a3a10fd3 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 17:35:43 -0400 Subject: [PATCH 05/12] Add spanish translations --- src/languages/es.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index c27e94e46977..6888c6c70de1 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2965,8 +2965,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!`, }, }, workspace: { From 62b89449a7e6b8dd5c388d259244b3ab15f9a1d7 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 18:09:25 -0400 Subject: [PATCH 06/12] Prettier --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 749701a4746a..720bd7d43f14 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2941,7 +2941,7 @@ const translations = { message: `Your admin has turned off Expensify Travel. Please follow your company's booking policy for travel arrangements.`, }, verifyCompany: { - title: 'We\'re reviewing your request...', + 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!`, }, }, From da21d775cd6396b40649735e50a99db606ee11ff Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 18:32:48 -0400 Subject: [PATCH 07/12] Add new command type --- src/libs/API/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 51eace90644c..ad1a7361ba2b 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -989,6 +989,7 @@ type WriteCommandParameters = { [WRITE_COMMANDS.CHANGE_TRANSACTIONS_REPORT]: Parameters.ChangeTransactionsReportParams; [WRITE_COMMANDS.GET_GUIDE_CALL_AVAILABILITY_SCHEDULE]: Parameters.GetGuideCallAvailabilityScheduleParams; + [WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST]: null; }; const READ_COMMANDS = { From f26101620418eb794c442f721532e09509146335 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 3 Jun 2025 18:37:00 -0400 Subject: [PATCH 08/12] typescript error --- src/libs/actions/Travel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index 61a0eb09e70e..66fd69b782a3 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -55,7 +55,7 @@ function acceptSpotnanaTerms(domain?: string) { } function requestTravelAccess() { - API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, {}); + API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, null); } function cleanupTravelProvisioningSession() { From 8658d62282ccfe3dfab2aa5a932eed47c88ae6d8 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Thu, 26 Jun 2025 18:30:01 -0400 Subject: [PATCH 09/12] Remove bad merge --- src/libs/API/types.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index 3bb51fa989b1..eacf43e89467 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -486,11 +486,7 @@ const WRITE_COMMANDS = { COMPLETE_CONCIERGE_CALL: 'CompleteConciergeCall', FINISH_CORPAY_BANK_ACCOUNT_ONBOARDING: 'FinishCorpayBankAccountOnboarding', REOPEN_REPORT: 'ReopenReport', -<<<<<<< HEAD - GET_GUIDE_CALL_AVAILABILITY_SCHEDULE: 'GetGuideCallAvailabilitySchedule', TRAVEL_SIGNUP_REQUEST: 'RequestTravelAccess', -======= ->>>>>>> 93a63a6d19645feef8cc440d967de0435ce86a5b } as const; type WriteCommand = ValueOf; From f421fa79123813e9ec4b225588e6869fa5475675 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Mon, 30 Jun 2025 14:22:21 -0400 Subject: [PATCH 10/12] Add check for lastTravelSignupRequestTime and add to type --- src/components/BookTravelButton.tsx | 4 +++- src/types/onyx/TravelSettings.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 92031da9f9dd..17a91c36cbda 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -147,7 +147,9 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN); } else if (!isBetaEnabled(CONST.BETAS.IS_TRAVEL_VERIFIED)) { setVerificationModalVisibility(true); - requestTravelAccess(); + 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. 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 */ From 04c20a5f0366eab485f23f289e9e230d2bc4a177 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 1 Jul 2025 11:28:26 -0400 Subject: [PATCH 11/12] Add optimisticData --- src/libs/actions/Travel.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Travel.ts b/src/libs/actions/Travel.ts index 66fd69b782a3..f915f0505380 100644 --- a/src/libs/actions/Travel.ts +++ b/src/libs/actions/Travel.ts @@ -55,7 +55,16 @@ function acceptSpotnanaTerms(domain?: string) { } function requestTravelAccess() { - API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, null); + 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() { From fe180fc20ba6b54bb4de827fe5277015b7f4d7f9 Mon Sep 17 00:00:00 2001 From: Brandon Stites Date: Tue, 1 Jul 2025 16:29:07 -0400 Subject: [PATCH 12/12] Update based on onyx key --- src/components/BookTravelButton.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 17a91c36cbda..8551e67aea6b 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -180,6 +180,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se isUserValidated, groupPaidPolicies.length, isBetaEnabled, + travelSettings?.lastTravelSignupRequestTime, ]); return (