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
4 changes: 0 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ const ROUTES = {
route: 'settings/exit-survey/reason',
getRoute: (backTo?: string) => getUrlWithBackToParam('settings/exit-survey/reason', backTo),
},
SETTINGS_EXIT_SURVERY_BOOK_CALL: {
route: 'settings/exit-survey/book-call',
getRoute: (backTo?: string) => getUrlWithBackToParam('settings/exit-survey/book-call', backTo),
},
SETTINGS_EXIT_SURVEY_RESPONSE: {
route: 'settings/exit-survey/response',
getRoute: (reason?: ExitReason, backTo?: string) => getUrlWithBackToParam(`settings/exit-survey/response${reason ? `?reason=${encodeURIComponent(reason)}` : ''}`, backTo),
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ const SCREENS = {
},

EXIT_SURVEY: {
BOOK_CALL: 'Settings_ExitSurvey_Book_Call',
REASON: 'Settings_ExitSurvey_Reason',
RESPONSE: 'Settings_ExitSurvey_Response',
CONFIRM: 'Settings_ExitSurvey_Confirm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require<ReactComponentModule>('../../../../pages/settings/Wallet/ReportCardLostPage').default,
[SCREENS.KEYBOARD_SHORTCUTS]: () => require<ReactComponentModule>('../../../../pages/KeyboardShortcutsPage').default,
[SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require<ReactComponentModule>('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default,
[SCREENS.SETTINGS.EXIT_SURVEY.BOOK_CALL]: () => require<ReactComponentModule>('../../../../pages/settings/ExitSurvey/ExitSurveyBookCall').default,
[SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require<ReactComponentModule>('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default,
[SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require<ReactComponentModule>('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default,
Expand Down
3 changes: 0 additions & 3 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,9 +924,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
[SCREENS.SETTINGS.EXIT_SURVEY.REASON]: {
path: ROUTES.SETTINGS_EXIT_SURVEY_REASON.route,
},
[SCREENS.SETTINGS.EXIT_SURVEY.BOOK_CALL]: {
path: ROUTES.SETTINGS_EXIT_SURVERY_BOOK_CALL.route,
},
[SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: {
path: ROUTES.SETTINGS_EXIT_SURVEY_RESPONSE.route,
},
Expand Down
1 change: 0 additions & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,6 @@ type SettingsNavigatorParamList = {
};
[SCREENS.KEYBOARD_SHORTCUTS]: undefined;
[SCREENS.SETTINGS.EXIT_SURVEY.REASON]: undefined;
[SCREENS.SETTINGS.EXIT_SURVEY.BOOK_CALL]: undefined;
[SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: {
[EXIT_SURVEY_REASON_FORM_INPUT_IDS.REASON]: ValueOf<typeof CONST.EXIT_SURVEY.REASONS>;
backTo: Routes;
Expand Down
83 changes: 0 additions & 83 deletions src/pages/settings/ExitSurvey/ExitSurveyBookCall.tsx

This file was deleted.

9 changes: 6 additions & 3 deletions src/pages/settings/ExitSurvey/ExitSurveyConfirmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ function ExitSurveyConfirmPage({route, navigation}: ExitSurveyConfirmPageProps)
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const styles = useThemeStyles();
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT);
const [exitReason] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM, {selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[EXIT_SURVEY_REASON_INPUT_IDS.REASON] ?? null});
const [tryNewDot] = useOnyx(ONYXKEYS.NVP_TRY_NEW_DOT, {canBeMissing: true});
const [exitReason] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM, {
selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[EXIT_SURVEY_REASON_INPUT_IDS.REASON] ?? null,
canBeMissing: true,
});
const shouldShowQuickTips =
isEmptyObject(tryNewDot) || tryNewDot?.classicRedirect?.dismissed === true || (!isEmptyObject(tryNewDot) && tryNewDot?.classicRedirect?.dismissed === undefined);

Expand Down Expand Up @@ -62,7 +65,7 @@ function ExitSurveyConfirmPage({route, navigation}: ExitSurveyConfirmPageProps)
<ScreenWrapper testID={ExitSurveyConfirmPage.displayName}>
<HeaderWithBackButton
title={translate(shouldShowQuickTips ? 'exitSurvey.goToExpensifyClassic' : 'exitSurvey.header')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={() => Navigation.goBack(backTo)}
/>
<View style={[styles.flex1, styles.justifyContentCenter, styles.alignItemsCenter, styles.mh5]}>
{isOffline && <ExitSurveyOffline />}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/settings/ExitSurvey/ExitSurveyReasonPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ function ExitSurveyReasonPage() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isOffline} = useNetwork();
const [draftReason] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM_DRAFT, {selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[INPUT_IDS.REASON] ?? null});
const [draftReason] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_REASON_FORM_DRAFT, {
selector: (value: OnyxEntry<ExitSurveyReasonForm>) => value?.[INPUT_IDS.REASON] ?? null,
canBeMissing: true,
});

const [reason, setReason] = useState<ExitReason | null>(draftReason ?? null);
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/settings/ExitSurvey/ExitSurveyResponsePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import ExitSurveyOffline from './ExitSurveyOffline';
type ExitSurveyResponsePageProps = PlatformStackScreenProps<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE>;

function ExitSurveyResponsePage({route, navigation}: ExitSurveyResponsePageProps) {
const [draftResponse = ''] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM_DRAFT, {selector: (value) => value?.[INPUT_IDS.RESPONSE]});
const [draftResponse = ''] = useOnyx(ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM_DRAFT, {selector: (value) => value?.[INPUT_IDS.RESPONSE], canBeMissing: true});
const {translate} = useLocalize();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down Expand Up @@ -88,7 +88,7 @@ function ExitSurveyResponsePage({route, navigation}: ExitSurveyResponsePageProps
>
<HeaderWithBackButton
title={translate('exitSurvey.header')}
onBackButtonPress={() => Navigation.goBack()}
onBackButtonPress={() => Navigation.goBack(backTo)}
/>
<FormProvider
formID={ONYXKEYS.FORMS.EXIT_SURVEY_RESPONSE_FORM}
Expand Down
8 changes: 4 additions & 4 deletions src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
const [shouldShowSignoutConfirmModal, setShouldShowSignoutConfirmModal] = useState(false);

const freeTrialText = getFreeTrialText(policies);
const shouldOpenBookACall = tryNewDot?.classicRedirect?.dismissed === false;
const shouldOpenSurveyReasonPage = tryNewDot?.classicRedirect?.dismissed === false;

const isScreenFocused = useIsAccountSettingsRouteActive(shouldUseNarrowLayout);

Expand Down Expand Up @@ -262,8 +262,8 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
: {
action() {
resetExitSurveyForm(() => {
if (shouldOpenBookACall) {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVERY_BOOK_CALL.route);
if (shouldOpenSurveyReasonPage) {
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_REASON.route);
return;
}
Navigation.navigate(ROUTES.SETTINGS_EXIT_SURVEY_CONFIRM.route);
Expand Down Expand Up @@ -298,7 +298,7 @@ function InitialSettingsPage({currentUserPersonalDetails}: InitialSettingsPagePr
},
],
};
}, [styles.pt4, setRootStatusBarEnabled, shouldOpenBookACall, signOut]);
}, [styles.pt4, setRootStatusBarEnabled, shouldOpenSurveyReasonPage, signOut]);

/**
* Retuns JSX.Element with menu items
Expand Down
18 changes: 6 additions & 12 deletions tests/ui/SwitchToExpensifyClassicTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as NativeNavigation from '@react-navigation/native';
import {fireEvent, render, screen} from '@testing-library/react-native';
import Onyx from 'react-native-onyx';
import {act} from 'react-test-renderer';
import * as Localize from '@libs/Localize';
import {translateLocal} from '@libs/Localize';
import App from '@src/App';
import ONYXKEYS from '@src/ONYXKEYS';
import type {NativeNavigationMock} from '../../__mocks__/@react-navigation/native';
Expand All @@ -23,7 +23,7 @@ TestHelper.setupApp();
TestHelper.setupGlobalFetchMock();

function navigateToSetting() {
const hintText = Localize.translateLocal('sidebarScreen.buttonMySettings');
const hintText = translateLocal('sidebarScreen.buttonMySettings');
const mySettingButton = screen.queryByAccessibilityHint(hintText);
if (mySettingButton) {
fireEvent(mySettingButton, 'press');
Expand All @@ -32,7 +32,7 @@ function navigateToSetting() {
}

function navigateToExpensifyClassicFlow() {
const hintText = Localize.translateLocal('exitSurvey.goToExpensifyClassic');
const hintText = translateLocal('exitSurvey.goToExpensifyClassic');
const switchToExpensifyClassicBtn = screen.queryByAccessibilityHint(hintText);
if (switchToExpensifyClassicBtn) {
fireEvent(switchToExpensifyClassicBtn, 'press');
Expand All @@ -45,7 +45,7 @@ function signInAppAndEnterTestFlow(dismissedValue?: boolean): Promise<void> {
return waitForBatchedUpdatesWithAct()
.then(async () => {
await waitForBatchedUpdatesWithAct();
const hintText = Localize.translateLocal('loginForm.loginForm');
const hintText = translateLocal('loginForm.loginForm');
const loginForm = screen.queryAllByLabelText(hintText);
expect(loginForm).toHaveLength(1);

Expand Down Expand Up @@ -75,15 +75,9 @@ describe('Switch to Expensify Classic flow', () => {
PusherHelper.teardown();
});

test('Should navigate to BookACall when dismissed is false', () => {
signInAppAndEnterTestFlow(false).then(() => {
expect(screen.getAllByText(Localize.translateLocal('exitSurvey.bookACallTitle')).at(0)).toBeOnTheScreen();
});
});

test('Should navigate to ConfirmPage when dismissed is true', () => {
test('Should navigate to exit survey reason page', () => {
signInAppAndEnterTestFlow(true).then(() => {
expect(screen.getAllByText(Localize.translateLocal('exitSurvey.goToExpensifyClassic')).at(0)).toBeOnTheScreen();
expect(screen.getAllByText(translateLocal('exitSurvey.reasonPage.subtitle')).at(0)).toBeOnTheScreen();
});
});
});