Skip to content

Commit 9ade950

Browse files
authored
Merge pull request Expensify#60724 from callstack-internal/pac-guerreiro/feature/60583-update-translations-to-take-a-test-drive
Update admin case so global create and reports empty state say take a test drive
2 parents 931b590 + 6058ad1 commit 9ade950

5 files changed

Lines changed: 57 additions & 55 deletions

File tree

src/languages/en.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5187,12 +5187,12 @@ const translations = {
51875187
},
51885188
emptyExpenseResults: {
51895189
title: "You haven't created any expenses yet",
5190-
subtitle: 'Create an expense or take a tour of Expensify to learn more.',
5190+
subtitle: 'Create an expense or take a test drive of Expensify to learn more.',
51915191
subtitleWithOnlyCreateButton: 'Use the green button below to create an expense.',
51925192
},
51935193
emptyInvoiceResults: {
51945194
title: "You haven't created any \ninvoices yet",
5195-
subtitle: 'Send an invoice or take a tour of Expensify to learn more.',
5195+
subtitle: 'Send an invoice or take a test drive of Expensify to learn more.',
51965196
subtitleWithOnlyCreateButton: 'Use the green button below to send an invoice.',
51975197
},
51985198
emptyTripResults: {
@@ -6187,11 +6187,7 @@ const translations = {
61876187
},
61886188
},
61896189
emptySearchView: {
6190-
takeATour: 'Take a tour',
6191-
},
6192-
tour: {
6193-
takeATwoMinuteTour: 'Take a 2-minute tour',
6194-
exploreExpensify: 'Explore everything Expensify has to offer',
6190+
takeATestDrive: 'Take a test drive',
61956191
},
61966192
migratedUserWelcomeModal: {
61976193
title: 'Travel and expense, at the speed of chat',
@@ -6260,6 +6256,10 @@ const translations = {
62606256
hangUp: 'Hang up',
62616257
},
62626258
testDrive: {
6259+
quickAction: {
6260+
takeATwoMinuteTestDrive: 'Take a 2-minute test drive',
6261+
exploreExpensify: 'Explore everything Expensify has to offer',
6262+
},
62636263
modal: {
62646264
title: 'Take us for a test drive',
62656265
description: 'Take a quick product tour to get up to speed fast. No pit stops required!',

src/languages/es.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5244,12 +5244,12 @@ const translations = {
52445244
},
52455245
emptyExpenseResults: {
52465246
title: 'Aún no has creado ningún gasto',
5247-
subtitle: 'Crea un gasto o haz un tour por Expensify para aprender más.',
5247+
subtitle: 'Crea un gasto o haz una proba por Expensify para aprender más.',
52485248
subtitleWithOnlyCreateButton: 'Usa el botón verde de abajo para crear un gasto.',
52495249
},
52505250
emptyInvoiceResults: {
52515251
title: 'Aún no has creado \nninguna factura',
5252-
subtitle: 'Envía una factura o haz un tour por Expensify para aprender más.',
5252+
subtitle: 'Envía una factura o haz una proba por Expensify para aprender más.',
52535253
subtitleWithOnlyCreateButton: 'Usa el botón verde de abajo para enviar una factura.',
52545254
},
52555255
emptyTripResults: {
@@ -6712,11 +6712,7 @@ const translations = {
67126712
},
67136713
},
67146714
emptySearchView: {
6715-
takeATour: 'Haz un tour',
6716-
},
6717-
tour: {
6718-
takeATwoMinuteTour: 'Haz un tour de 2 minutos',
6719-
exploreExpensify: 'Explora todo lo que Expensify tiene para ofrecer',
6715+
takeATestDrive: 'Haz una proba',
67206716
},
67216717
migratedUserWelcomeModal: {
67226718
title: 'Viajes y gastos, a la velocidad del chat',
@@ -6785,6 +6781,10 @@ const translations = {
67856781
hangUp: 'Colgar',
67866782
},
67876783
testDrive: {
6784+
quickAction: {
6785+
takeATwoMinuteTestDrive: 'Haz una proba de 2 minutos',
6786+
exploreExpensify: 'Explora todo lo que Expensify tiene para ofrecer',
6787+
},
67886788
modal: {
67896789
title: 'Haz una prueba con nosotros',
67906790
description: 'Haz un recorrido rápido por el producto para ponerte al día rápidamente. ¡No se requieren paradas!',

src/pages/Search/EmptySearchView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) {
137137
...(!hasSeenTour
138138
? [
139139
{
140-
buttonText: translate('emptySearchView.takeATour'),
140+
buttonText: translate('emptySearchView.takeATestDrive'),
141141
buttonAction: () => {
142142
openExternalLink(navatticURL);
143143
setSelfTourViewed();
@@ -177,7 +177,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) {
177177
...(!hasSeenTour
178178
? [
179179
{
180-
buttonText: translate('emptySearchView.takeATour'),
180+
buttonText: translate('emptySearchView.takeATestDrive'),
181181
buttonAction: () => {
182182
openExternalLink(navatticURL);
183183
setSelfTourViewed();

src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,24 +177,24 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
177177
const styles = useThemeStyles();
178178
const theme = useTheme();
179179
const {translate} = useLocalize();
180-
const [isLoading = false] = useOnyx(ONYXKEYS.IS_LOADING_APP);
181-
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
182-
const [session] = useOnyx(ONYXKEYS.SESSION);
183-
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
184-
const [quickActionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${quickAction?.chatReportID}`);
185-
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${quickActionReport?.reportID}`);
186-
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
187-
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
188-
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`);
180+
const [isLoading = false] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: false});
181+
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false});
182+
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
183+
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
184+
const [quickActionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${quickAction?.chatReportID}`, {canBeMissing: true});
185+
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${quickActionReport?.reportID}`, {canBeMissing: true});
186+
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false});
187+
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
188+
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: false});
189189
const policyChatForActivePolicy = useMemo(() => {
190190
if (isEmptyObject(activePolicy) || !activePolicy?.isPolicyExpenseChatEnabled) {
191191
return {} as OnyxTypes.Report;
192192
}
193193
const policyChatsForActivePolicy = getWorkspaceChats(`${activePolicyID ?? CONST.DEFAULT_NUMBER_ID}`, [session?.accountID ?? CONST.DEFAULT_NUMBER_ID], allReports);
194194
return policyChatsForActivePolicy.length > 0 ? policyChatsForActivePolicy.at(0) : ({} as OnyxTypes.Report);
195195
}, [activePolicy, activePolicyID, session?.accountID, allReports]);
196-
const [quickActionPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`);
197-
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector)});
196+
const [quickActionPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`, {canBeMissing: true});
197+
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector), canBeMissing: false});
198198
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
199199
const {canUseLeftHandBar} = usePermissions();
200200

@@ -207,18 +207,19 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
207207
const prevIsFocused = usePrevious(isFocused);
208208
const {isOffline} = useNetwork();
209209
const {isBlockedFromSpotnanaTravel} = usePermissions();
210-
const [primaryLogin] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.primaryLogin});
210+
const [primaryLogin] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.primaryLogin, canBeMissing: false});
211211
const primaryContactMethod = primaryLogin ?? session?.email ?? '';
212-
const [travelSettings] = useOnyx(ONYXKEYS.NVP_TRAVEL_SETTINGS);
212+
const [travelSettings] = useOnyx(ONYXKEYS.NVP_TRAVEL_SETTINGS, {canBeMissing: true});
213213

214214
const {canUseSpotnanaTravel, canUseTableReportView} = usePermissions();
215215
const canSendInvoice = useMemo(() => canSendInvoicePolicyUtils(allPolicies as OnyxCollection<OnyxTypes.Policy>, session?.email), [allPolicies, session?.email]);
216216
const isValidReport = !(isEmptyObject(quickActionReport) || isArchivedReport(reportNameValuePairs));
217217
const {environment} = useEnvironment();
218-
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
218+
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: false});
219219
const navatticURL = getNavatticURL(environment, introSelected?.choice);
220220
const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
221221
selector: hasSeenTourSelector,
222+
canBeMissing: false,
222223
});
223224

224225
const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext);
@@ -470,7 +471,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
470471
]);
471472

472473
const viewTourTaskReportID = introSelected?.viewTour;
473-
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${viewTourTaskReportID}`);
474+
const [viewTourTaskReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${viewTourTaskReportID}`, {canBeMissing: false});
474475

475476
const canModifyTask = canModifyTaskUtils(viewTourTaskReport, currentUserPersonalDetails.accountID);
476477
const canActionTask = canActionTaskUtils(viewTourTaskReport, currentUserPersonalDetails.accountID);
@@ -581,8 +582,8 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
581582
icon: Expensicons.Binoculars,
582583
iconStyles: styles.popoverIconCircle,
583584
iconFill: theme.icon,
584-
text: translate('tour.takeATwoMinuteTour'),
585-
description: translate('tour.exploreExpensify'),
585+
text: translate('testDrive.quickAction.takeATwoMinuteTestDrive'),
586+
description: translate('testDrive.quickAction.exploreExpensify'),
586587
onSelected: () => {
587588
openExternalLink(navatticURL);
588589
setSelfTourViewed(isAnonymousUser());

tests/ui/components/EmptySearchViewTest.tsx

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from 'react';
33
import Onyx from 'react-native-onyx';
44
import {LocaleContextProvider} from '@components/LocaleContextProvider';
55
import OnyxProvider from '@components/OnyxProvider';
6+
import {translateLocal} from '@libs/Localize';
67
import EmptySearchView from '@pages/Search/EmptySearchView';
78
import CONST from '@src/CONST';
89
import ONYXKEYS from '@src/ONYXKEYS';
@@ -30,8 +31,8 @@ describe('EmptySearchView', () => {
3031
describe('type is Expense', () => {
3132
const dataType = CONST.SEARCH.DATA_TYPES.EXPENSE;
3233

33-
it('should display correct buttons and subtitle when user has not clicked on "Take a tour"', async () => {
34-
// Given user hasn't clicked on "Take a tour" yet
34+
it('should display correct buttons and subtitle when user has not clicked on "Take a test drive"', async () => {
35+
// Given user hasn't clicked on "Take a test drive" yet
3536
await Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: false});
3637

3738
// Render component
@@ -44,16 +45,16 @@ describe('EmptySearchView', () => {
4445
</Wrapper>,
4546
);
4647

47-
// Then it should display create expenses and take a tour buttons
48-
expect(await screen.findByText('Create expense')).toBeVisible();
49-
expect(await screen.findByText('Take a tour')).toBeVisible();
48+
// Then it should display create expenses and take a test drive buttons
49+
expect(await screen.findByText(translateLocal('iou.createExpense'))).toBeVisible();
50+
expect(await screen.findByText(translateLocal('emptySearchView.takeATestDrive'))).toBeVisible();
5051

5152
// And correct modal subtitle
52-
expect(screen.getByText('Create an expense or take a tour of Expensify to learn more.')).toBeVisible();
53+
expect(screen.getByText(translateLocal('search.searchResults.emptyExpenseResults.subtitle'))).toBeVisible();
5354
});
5455

55-
it('should display correct buttons and subtitle when user already did "Take a tour"', async () => {
56-
// Given user clicked on "Take a tour"
56+
it('should display correct buttons and subtitle when user already did "Take a test drive"', async () => {
57+
// Given user clicked on "Take a test drive"
5758
await Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: true});
5859

5960
// Render component
@@ -67,19 +68,19 @@ describe('EmptySearchView', () => {
6768
);
6869

6970
// Then it should display create expenses button
70-
expect(await screen.findByText('Create expense')).toBeVisible();
71-
expect(screen.queryByText('Take a tour')).not.toBeOnTheScreen();
71+
expect(await screen.findByText(translateLocal('iou.createExpense'))).toBeVisible();
72+
expect(screen.queryByText(translateLocal('emptySearchView.takeATestDrive'))).not.toBeOnTheScreen();
7273

7374
// And correct modal subtitle
74-
expect(screen.getByText('Use the green button below to create an expense.')).toBeVisible();
75+
expect(screen.getByText(translateLocal('search.searchResults.emptyExpenseResults.subtitleWithOnlyCreateButton'))).toBeVisible();
7576
});
7677
});
7778

7879
describe('type is Invoice', () => {
7980
const dataType = CONST.SEARCH.DATA_TYPES.INVOICE;
8081

81-
it('should display correct buttons and subtitle when user has not clicked on "Take a tour"', async () => {
82-
// Given user hasn't clicked on "Take a tour" yet
82+
it('should display correct buttons and subtitle when user has not clicked on "Take a test drive"', async () => {
83+
// Given user hasn't clicked on "Take a test drive" yet
8384
await Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: false});
8485

8586
// Render component
@@ -92,16 +93,16 @@ describe('EmptySearchView', () => {
9293
</Wrapper>,
9394
);
9495

95-
// Then it should display send invoice and take a tour buttons
96-
expect(await screen.findByText('Send invoice')).toBeVisible();
97-
expect(await screen.findByText('Take a tour')).toBeVisible();
96+
// Then it should display send invoice and take a test drive buttons
97+
expect(await screen.findByText(translateLocal('workspace.invoices.sendInvoice'))).toBeVisible();
98+
expect(await screen.findByText(translateLocal('emptySearchView.takeATestDrive'))).toBeVisible();
9899

99100
// And correct modal subtitle
100-
expect(screen.getByText('Send an invoice or take a tour of Expensify to learn more.')).toBeVisible();
101+
expect(screen.getByText(translateLocal('search.searchResults.emptyInvoiceResults.subtitle'))).toBeVisible();
101102
});
102103

103-
it('should display correct buttons and subtitle when user already did "Take a tour"', async () => {
104-
// Given user clicked on "Take a tour"
104+
it('should display correct buttons and subtitle when user already did "Take a test drive"', async () => {
105+
// Given user clicked on "Take a test drive"
105106
await Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: true});
106107

107108
// Render component
@@ -115,11 +116,11 @@ describe('EmptySearchView', () => {
115116
);
116117

117118
// Then it should display Send invoice button
118-
expect(await screen.findByText('Send invoice')).toBeVisible();
119-
expect(screen.queryByText('Take a tour')).not.toBeOnTheScreen();
119+
expect(await screen.findByText(translateLocal('workspace.invoices.sendInvoice'))).toBeVisible();
120+
expect(screen.queryByText(translateLocal('emptySearchView.takeATestDrive'))).not.toBeOnTheScreen();
120121

121122
// And correct modal subtitle
122-
expect(screen.getByText('Use the green button below to send an invoice.')).toBeVisible();
123+
expect(screen.getByText(translateLocal('search.searchResults.emptyInvoiceResults.subtitleWithOnlyCreateButton'))).toBeVisible();
123124
});
124125
});
125126
});

0 commit comments

Comments
 (0)