Skip to content

Commit f610e1c

Browse files
roryabrahamOSBotify
authored andcommitted
Merge pull request #60988 from Expensify/stites-preventTravelAgain
[cp stg/prd] Add new modal for travel verification (cherry picked from commit 7070a1f) (cherry-picked to production by roryabraham)
1 parent 8888dfd commit f610e1c

5 files changed

Lines changed: 34 additions & 1 deletion

File tree

src/CONST.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ const CONST = {
798798
WALLET: 'newdotWallet',
799799
GLOBAL_REIMBURSEMENTS_ON_ND: 'globalReimbursementsOnND',
800800
PRIVATE_DOMAIN_ONBOARDING: 'privateDomainOnboarding',
801+
IS_TRAVEL_VERIFIED: 'isTravelVerified',
801802
},
802803
BUTTON_STATES: {
803804
DEFAULT: 'default',

src/components/BookTravelButton.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B
6060
const [sessionEmail] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email, canBeMissing: false});
6161
const primaryContactMethod = primaryLogin ?? sessionEmail ?? '';
6262
const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext);
63-
const {isBlockedFromSpotnanaTravel} = usePermissions();
63+
const {isBlockedFromSpotnanaTravel, isTravelVerified} = usePermissions();
6464
const [isPreventionModalVisible, setPreventionModalVisibility] = useState(false);
65+
const [isVerificationModalVisible, setVerificationModalVisiblity] = useState(false);
6566
const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: false});
6667
const {login: currentUserLogin} = useCurrentUserPersonalDetails();
6768
const activePolicies = getActivePolicies(policies, currentUserLogin);
@@ -71,6 +72,7 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B
7172
const [wasNewDotLaunchedJustForTravel] = useOnyx(ONYXKEYS.IS_SINGLE_NEW_DOT_ENTRY, {canBeMissing: false});
7273

7374
const hidePreventionModal = () => setPreventionModalVisibility(false);
75+
const hideVerificationModal = () => setVerificationModalVisiblity(false);
7476

7577
const bookATrip = useCallback(() => {
7678
setErrorMessage('');
@@ -133,6 +135,8 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B
133135
});
134136
} else if (isPolicyProvisioned) {
135137
navigateToAcceptTerms(CONST.TRAVEL.DEFAULT_DOMAIN);
138+
} else if (!isTravelVerified) {
139+
setVerificationModalVisiblity(true);
136140
}
137141
// Determine the domain to associate with the workspace during provisioning in Spotnana.
138142
// - 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
162166
setRootStatusBarEnabled,
163167
isUserValidated,
164168
groupPaidPolicies.length,
169+
isTravelVerified,
165170
]);
166171

167172
return (
@@ -202,6 +207,20 @@ function BookTravelButton({text, shouldRenderErrorMessageBelowButton = false}: B
202207
confirmText={translate('common.buttonConfirm')}
203208
shouldShowCancelButton={false}
204209
/>
210+
<ConfirmModal
211+
title={translate('travel.verifyCompany.title')}
212+
titleStyles={styles.textHeadlineH1}
213+
titleContainerStyles={styles.mb2}
214+
onConfirm={hideVerificationModal}
215+
onCancel={hideVerificationModal}
216+
image={RocketDude}
217+
imageStyles={StyleUtils.getBackgroundColorStyle(colors.ice600)}
218+
isVisible={isVerificationModalVisible}
219+
prompt={translate('travel.verifyCompany.message')}
220+
promptStyles={styles.mb2}
221+
confirmText={translate('common.buttonConfirm')}
222+
shouldShowCancelButton={false}
223+
/>
205224
</>
206225
);
207226
}

src/languages/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,10 @@ const translations = {
28742874
title: 'Expensify Travel has been disabled',
28752875
message: `Your admin has turned off Expensify Travel. Please follow your company's booking policy for travel arrangements.`,
28762876
},
2877+
verifyCompany: {
2878+
title: 'Get started with travel today!',
2879+
message: `Please contact your Account manager or salesteam@expensify.com to get a demo of travel and have it enabled for your company.`,
2880+
},
28772881
},
28782882
workspace: {
28792883
common: {

src/languages/es.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2899,6 +2899,10 @@ const translations = {
28992899
title: 'Expensify Travel ha sido deshabilitado',
29002900
message: 'Tu administrador ha desactivado Expensify Travel. Por favor, sigue la política de reservas de tu empresa para organizar tus viajes.',
29012901
},
2902+
verifyCompany: {
2903+
title: '¡Empieza a viajar hoy mismo!',
2904+
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.`,
2905+
},
29022906
},
29032907
workspace: {
29042908
common: {

src/libs/Permissions.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ function isBlockedFromSpotnanaTravel(betas: OnyxEntry<Beta[]>): boolean {
1919
return !!betas?.includes(CONST.BETAS.PREVENT_SPOTNANA_TRAVEL);
2020
}
2121

22+
function isTravelVerified(betas: OnyxEntry<Beta[]>): boolean {
23+
return !!betas?.includes(CONST.BETAS.IS_TRAVEL_VERIFIED) || canUseAllBetas(betas);
24+
}
25+
2226
function canUseNetSuiteUSATax(betas: OnyxEntry<Beta[]>): boolean {
2327
return !!betas?.includes(CONST.BETAS.NETSUITE_USA_TAX) || canUseAllBetas(betas);
2428
}
@@ -79,6 +83,7 @@ export default {
7983
canUseLinkPreviews,
8084
canUseSpotnanaTravel,
8185
isBlockedFromSpotnanaTravel,
86+
isTravelVerified,
8287
canUseNetSuiteUSATax,
8388
canUsePDFExport,
8489
canUseMergeAccounts,

0 commit comments

Comments
 (0)