Skip to content

Commit fedc2e8

Browse files
authored
Merge pull request Expensify#63208 from Expensify/stites-requestTravelEnablement2
Automatically create a GH when users try to enable travel on non-verified domains
2 parents 017e381 + fe180fc commit fedc2e8

6 files changed

Lines changed: 28 additions & 6 deletions

File tree

src/components/BookTravelButton.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import usePolicy from '@hooks/usePolicy';
1010
import useStyleUtils from '@hooks/useStyleUtils';
1111
import useThemeStyles from '@hooks/useThemeStyles';
1212
import {openTravelDotLink} from '@libs/actions/Link';
13-
import {cleanupTravelProvisioningSession} from '@libs/actions/Travel';
13+
import {cleanupTravelProvisioningSession, requestTravelAccess} from '@libs/actions/Travel';
1414
import Log from '@libs/Log';
1515
import Navigation from '@libs/Navigation/Navigation';
1616
import {getActivePolicies, getAdminsPrivateEmailDomains, isPaidGroupPolicy} from '@libs/PolicyUtils';
@@ -147,6 +147,9 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
147147
navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN);
148148
} else if (!isBetaEnabled(CONST.BETAS.IS_TRAVEL_VERIFIED)) {
149149
setVerificationModalVisibility(true);
150+
if (!travelSettings?.lastTravelSignupRequestTime) {
151+
requestTravelAccess();
152+
}
150153
}
151154
// Determine the domain to associate with the workspace during provisioning in Spotnana.
152155
// - 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
177180
isUserValidated,
178181
groupPaidPolicies.length,
179182
isBetaEnabled,
183+
travelSettings?.lastTravelSignupRequestTime,
180184
]);
181185

182186
return (

src/languages/en.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3307,8 +3307,8 @@ const translations = {
33073307
message: `Your admin has turned off Expensify Travel. Please follow your company's booking policy for travel arrangements.`,
33083308
},
33093309
verifyCompany: {
3310-
title: 'Get started with travel today!',
3311-
message: `Please contact your Account manager or salesteam@expensify.com to get a demo of travel and have it enabled for your company.`,
3310+
title: "We're reviewing your request...",
3311+
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!`,
33123312
},
33133313
updates: {
33143314
bookingTicketed: ({airlineCode, origin, destination, startDate, confirmationID = ''}: FlightParams) =>

src/languages/es.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,8 +3299,8 @@ const translations = {
32993299
message: 'Tu administrador ha desactivado Expensify Travel. Por favor, sigue la política de reservas de tu empresa para organizar tus viajes.',
33003300
},
33013301
verifyCompany: {
3302-
title: '¡Empieza a viajar hoy mismo!',
3303-
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.`,
3302+
title: 'Estamos revisando tu solicitud...',
3303+
message: `Estamos realizando algunas comprobaciones para verificar que tu cuenta esté lista para Expensify Travel. ¡Nos pondremos en contacto contigo en breve!`,
33043304
},
33053305
updates: {
33063306
bookingTicketed: ({airlineCode, origin, destination, startDate, confirmationID = ''}: FlightParams) =>

src/libs/API/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ const WRITE_COMMANDS = {
486486
COMPLETE_CONCIERGE_CALL: 'CompleteConciergeCall',
487487
FINISH_CORPAY_BANK_ACCOUNT_ONBOARDING: 'FinishCorpayBankAccountOnboarding',
488488
REOPEN_REPORT: 'ReopenReport',
489+
TRAVEL_SIGNUP_REQUEST: 'RequestTravelAccess',
489490
IMPORT_PLAID_ACCOUNTS: 'ImportPlaidAccounts',
490491
} as const;
491492

@@ -993,6 +994,7 @@ type WriteCommandParameters = {
993994

994995
// Change transaction report
995996
[WRITE_COMMANDS.CHANGE_TRANSACTIONS_REPORT]: Parameters.ChangeTransactionsReportParams;
997+
[WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST]: null;
996998
};
997999

9981000
const READ_COMMANDS = {

src/libs/actions/Travel.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,21 @@ function acceptSpotnanaTerms(domain?: string) {
5454
API.write(WRITE_COMMANDS.ACCEPT_SPOTNANA_TERMS, params, {optimisticData, successData, failureData});
5555
}
5656

57+
function requestTravelAccess() {
58+
const optimisticData: OnyxUpdate[] = [
59+
{
60+
onyxMethod: 'merge',
61+
key: ONYXKEYS.NVP_TRAVEL_SETTINGS,
62+
value: {
63+
lastTravelSignupRequestTime: Date.now(),
64+
},
65+
},
66+
];
67+
API.write(WRITE_COMMANDS.TRAVEL_SIGNUP_REQUEST, null, {optimisticData});
68+
}
69+
5770
function cleanupTravelProvisioningSession() {
5871
Onyx.merge(ONYXKEYS.TRAVEL_PROVISIONING, null);
5972
}
6073

61-
export {acceptSpotnanaTerms, cleanupTravelProvisioningSession};
74+
export {acceptSpotnanaTerms, cleanupTravelProvisioningSession, requestTravelAccess};

src/types/onyx/TravelSettings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ type TravelSettings = {
88

99
/** Whether the user is setup for staging travelDot */
1010
testAccount?: boolean;
11+
12+
/** The last travel signup request time */
13+
lastTravelSignupRequestTime?: string;
1114
};
1215

1316
/** Model of workspace travel information to connect with Spotnana */

0 commit comments

Comments
 (0)