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
14 changes: 7 additions & 7 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5189,12 +5189,12 @@ const translations = {
},
emptyExpenseResults: {
title: "You haven't created any expenses yet",
subtitle: 'Create an expense or take a tour of Expensify to learn more.',
subtitle: 'Create an expense or take a test drive of Expensify to learn more.',
subtitleWithOnlyCreateButton: 'Use the green button below to create an expense.',
},
emptyInvoiceResults: {
title: "You haven't created any \ninvoices yet",
subtitle: 'Send an invoice or take a tour of Expensify to learn more.',
subtitle: 'Send an invoice or take a test drive of Expensify to learn more.',
subtitleWithOnlyCreateButton: 'Use the green button below to send an invoice.',
},
emptyTripResults: {
Expand Down Expand Up @@ -6189,11 +6189,7 @@ const translations = {
},
},
emptySearchView: {
takeATour: 'Take a tour',
},
tour: {
takeATwoMinuteTour: 'Take a 2-minute tour',
exploreExpensify: 'Explore everything Expensify has to offer',
takeATestDrive: 'Take a test drive',
},
migratedUserWelcomeModal: {
title: 'Travel and expense, at the speed of chat',
Expand Down Expand Up @@ -6256,6 +6252,10 @@ const translations = {
hangUp: 'Hang up',
},
testDrive: {
quickAction: {
takeATwoMinuteTestDrive: 'Take a 2-minute test drive',
exploreExpensify: 'Explore everything Expensify has to offer',
},
modal: {
title: 'Take us for a test drive',
description: 'Take a quick product tour to get up to speed fast. No pit stops required!',
Expand Down
14 changes: 7 additions & 7 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5246,12 +5246,12 @@ const translations = {
},
emptyExpenseResults: {
title: 'Aún no has creado ningún gasto',
subtitle: 'Crea un gasto o haz un tour por Expensify para aprender más.',
subtitle: 'Crea un gasto o haz una proba por Expensify para aprender más.',
subtitleWithOnlyCreateButton: 'Usa el botón verde de abajo para crear un gasto.',
},
emptyInvoiceResults: {
title: 'Aún no has creado \nninguna factura',
subtitle: 'Envía una factura o haz un tour por Expensify para aprender más.',
subtitle: 'Envía una factura o haz una proba por Expensify para aprender más.',
subtitleWithOnlyCreateButton: 'Usa el botón verde de abajo para enviar una factura.',
},
emptyTripResults: {
Expand Down Expand Up @@ -6714,11 +6714,7 @@ const translations = {
},
},
emptySearchView: {
takeATour: 'Haz un tour',
},
tour: {
takeATwoMinuteTour: 'Haz un tour de 2 minutos',
exploreExpensify: 'Explora todo lo que Expensify tiene para ofrecer',
takeATestDrive: 'Haz una proba',
},
migratedUserWelcomeModal: {
title: 'Viajes y gastos, a la velocidad del chat',
Expand Down Expand Up @@ -6781,6 +6777,10 @@ const translations = {
hangUp: 'Colgar',
},
testDrive: {
quickAction: {
takeATwoMinuteTestDrive: 'Haz una proba de 2 minutos',
exploreExpensify: 'Explora todo lo que Expensify tiene para ofrecer',
},
modal: {
title: 'Haz una prueba con nosotros',
description: 'Haz un recorrido rápido por el producto para ponerte al día rápidamente. ¡No se requieren paradas!',
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Search/EmptySearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) {
...(!hasSeenTour
? [
{
buttonText: translate('emptySearchView.takeATour'),
buttonText: translate('emptySearchView.takeATestDrive'),
buttonAction: () => {
openExternalLink(navatticURL);
setSelfTourViewed();
Expand Down Expand Up @@ -177,7 +177,7 @@ function EmptySearchView({type, hasResults}: EmptySearchViewProps) {
...(!hasSeenTour
? [
{
buttonText: translate('emptySearchView.takeATour'),
buttonText: translate('emptySearchView.takeATestDrive'),
buttonAction: () => {
openExternalLink(navatticURL);
setSelfTourViewed();
Expand Down
35 changes: 18 additions & 17 deletions src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey I think this PR is generating a canBeMissing error related to changes in this file

Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,24 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();
const [isLoading = false] = useOnyx(ONYXKEYS.IS_LOADING_APP);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [session] = useOnyx(ONYXKEYS.SESSION);
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
const [quickActionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${quickAction?.chatReportID}`);
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${quickActionReport?.reportID}`);
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`);
const [isLoading = false] = useOnyx(ONYXKEYS.IS_LOADING_APP, {canBeMissing: false});
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST, {canBeMissing: false});
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
const [quickActionReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${quickAction?.chatReportID}`, {canBeMissing: true});
const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${quickActionReport?.reportID}`, {canBeMissing: true});
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID, {canBeMissing: false});
const [allReports] = useOnyx(ONYXKEYS.COLLECTION.REPORT, {canBeMissing: false});
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`, {canBeMissing: false});
const policyChatForActivePolicy = useMemo(() => {
if (isEmptyObject(activePolicy) || !activePolicy?.isPolicyExpenseChatEnabled) {
return {} as OnyxTypes.Report;
}
const policyChatsForActivePolicy = getWorkspaceChats(`${activePolicyID ?? CONST.DEFAULT_NUMBER_ID}`, [session?.accountID ?? CONST.DEFAULT_NUMBER_ID], allReports);
return policyChatsForActivePolicy.length > 0 ? policyChatsForActivePolicy.at(0) : ({} as OnyxTypes.Report);
}, [activePolicy, activePolicyID, session?.accountID, allReports]);
const [quickActionPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`);
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector)});
const [quickActionPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`, {canBeMissing: true});
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector), canBeMissing: false});
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {canUseLeftHandBar} = usePermissions();

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

const {canUseSpotnanaTravel, canUseTableReportView} = usePermissions();
const canSendInvoice = useMemo(() => canSendInvoicePolicyUtils(allPolicies as OnyxCollection<OnyxTypes.Policy>, session?.email), [allPolicies, session?.email]);
const isValidReport = !(isEmptyObject(quickActionReport) || isArchivedReport(reportNameValuePairs));
const {environment} = useEnvironment();
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED, {canBeMissing: false});
const navatticURL = getNavatticURL(environment, introSelected?.choice);
const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
selector: hasSeenTourSelector,
canBeMissing: false,
});

const {setRootStatusBarEnabled} = useContext(CustomStatusBarAndBackgroundContext);
Expand Down Expand Up @@ -470,7 +471,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
]);

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think viewTourTaskReport should be optional, since introSelected?.viewTour can be undefined.

viewTour?: string;


const canModifyTask = canModifyTaskUtils(viewTourTaskReport, currentUserPersonalDetails.accountID);
const canActionTask = canActionTaskUtils(viewTourTaskReport, currentUserPersonalDetails.accountID);
Expand Down Expand Up @@ -581,8 +582,8 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
icon: Expensicons.Binoculars,
iconStyles: styles.popoverIconCircle,
iconFill: theme.icon,
text: translate('tour.takeATwoMinuteTour'),
description: translate('tour.exploreExpensify'),
text: translate('testDrive.quickAction.takeATwoMinuteTestDrive'),
description: translate('testDrive.quickAction.exploreExpensify'),
onSelected: () => {
openExternalLink(navatticURL);
setSelfTourViewed(isAnonymousUser());
Expand Down
45 changes: 23 additions & 22 deletions tests/ui/components/EmptySearchViewTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import Onyx from 'react-native-onyx';
import {LocaleContextProvider} from '@components/LocaleContextProvider';
import OnyxProvider from '@components/OnyxProvider';
import {translateLocal} from '@libs/Localize';
import EmptySearchView from '@pages/Search/EmptySearchView';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -30,8 +31,8 @@ describe('EmptySearchView', () => {
describe('type is Expense', () => {
const dataType = CONST.SEARCH.DATA_TYPES.EXPENSE;

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

// Render component
Expand All @@ -44,16 +45,16 @@ describe('EmptySearchView', () => {
</Wrapper>,
);

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

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

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

// Render component
Expand All @@ -67,19 +68,19 @@ describe('EmptySearchView', () => {
);

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

// And correct modal subtitle
expect(screen.getByText('Use the green button below to create an expense.')).toBeVisible();
expect(screen.getByText(translateLocal('search.searchResults.emptyExpenseResults.subtitleWithOnlyCreateButton'))).toBeVisible();
});
});

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

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

// Render component
Expand All @@ -92,16 +93,16 @@ describe('EmptySearchView', () => {
</Wrapper>,
);

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

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

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

// Render component
Expand All @@ -115,11 +116,11 @@ describe('EmptySearchView', () => {
);

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

// And correct modal subtitle
expect(screen.getByText('Use the green button below to send an invoice.')).toBeVisible();
expect(screen.getByText(translateLocal('search.searchResults.emptyInvoiceResults.subtitleWithOnlyCreateButton'))).toBeVisible();
});
});
});