diff --git a/src/CONST.ts b/src/CONST.ts index 2ee90902475f..9a47c63c1cb4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -809,6 +809,7 @@ const CONST = { WALLET: 'newdotWallet', GLOBAL_REIMBURSEMENTS_ON_ND: 'globalReimbursementsOnND', PRIVATE_DOMAIN_ONBOARDING: 'privateDomainOnboarding', + IS_TRAVEL_VERIFIED: 'isTravelVerified', }, BUTTON_STATES: { DEFAULT: 'default', diff --git a/src/components/BookTravelButton.tsx b/src/components/BookTravelButton.tsx index 25a8c0f850cd..a415b43e1b5f 100644 --- a/src/components/BookTravelButton.tsx +++ b/src/components/BookTravelButton.tsx @@ -60,8 +60,9 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email, canBeMissing: false}); const primaryContactMethod = primaryLogin ?? sessionEmail ?? ''; const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext); - const {isBlockedFromSpotnanaTravel} = usePermissions(); + const {isBlockedFromSpotnanaTravel, isTravelVerified} = usePermissions(); const [isPreventionModalVisible, setPreventionModalVisibility] = useState(false); + const [isVerificationModalVisible, setVerificationModalVisiblity] = useState(false); const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false}); const {login: currentUserLogin} = useCurrentUserPersonalDetails(); const activePolicies = getActivePolicies(policies, currentUserLogin); @@ -71,6 +72,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B const [wasNewDotLaunchedJustForTravel] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY, {canBeMissing: false}); const hidePreventionModal = () => setPreventionModalVisibility(false); + const hideVerificationModal = () => setVerificationModalVisiblity(false); const bookATrip = useCallback(() => { setErrorMessage(''); @@ -133,6 +135,8 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B }); } else if (isPolicyProvisioned) { navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN); + } else if (!isTravelVerified) { + setVerificationModalVisiblity(true); } // 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. @@ -162,6 +166,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B setRootStatusBarEnabled, isUserValidated, groupPaidPolicies.length, + isTravelVerified, ]); return ( @@ -202,6 +207,20 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B confirmText={translate('common.buttonConfirm')} shouldShowCancelButton={false} /> + ); } diff --git a/src/languages/en.ts b/src/languages/en.ts index 3c46a445ba31..40e92704e484 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2880,6 +2880,10 @@ const translations = { title: 'Expensify Travel has been disabled', 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.`, + }, }, workspace: { common: { diff --git a/src/languages/es.ts b/src/languages/es.ts index fa2207ac7a86..879155ee32ad 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2907,6 +2907,10 @@ const translations = { title: 'Expensify Travel ha sido deshabilitado', 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.`, + }, }, workspace: { common: { diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index cbbf1e37dad0..973344b63173 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -19,6 +19,10 @@ function isBlockedFromSpotnanaTravel(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.PREVENT_SPOTNANA_TRAVEL); } +function isTravelVerified(betas: OnyxEntry): boolean { + return !!betas?.includes(CONST.BETAS.IS_TRAVEL_VERIFIED) || canUseAllBetas(betas); +} + function canUseNetSuiteUSATax(betas: OnyxEntry): boolean { return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas); } @@ -75,6 +79,7 @@ export default { canUseLinkPreviews, canUseSpotnanaTravel, isBlockedFromSpotnanaTravel, + isTravelVerified, canUseNetSuiteUSATax, canUseMergeAccounts, canUseManagerMcTest,