Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/BookTravelButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -177,6 +180,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false, se
isUserValidated,
groupPaidPolicies.length,
isBetaEnabled,
travelSettings?.lastTravelSignupRequestTime,
]);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down
2 changes: 2 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 = {
Expand Down
15 changes: 14 additions & 1 deletion src/libs/actions/Travel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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};
3 changes: 3 additions & 0 deletions src/types/onyx/TravelSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Loading