Repository: Expensify/App
Pull request #59911: Merge account feature fixes - Part 1
Author: login: allroundexperts
Created: 2025-04-09T12:23:20Z | Merged: 2025-04-22T12:13:48Z

<!-- If necessary, assign reviewers that know the area or changes well. Feel free to tag any additional reviewers you see fit. -->

### Explanation of Change
<!-- Explain what your change does and how it addresses the linked issue -->

Fixes the following issues:
fixes https://github.com/Expensify/App/issues/59767
fixes https://github.com/Expensify/App/issues/59757
fixes https://github.com/Expensify/App/issues/59759
fixes https://github.com/Expensify/App/issues/59760
fixes https://github.com/Expensify/App/issues/59761
fixes https://github.com/Expensify/App/issues/59772
fixes https://github.com/Expensify/App/issues/59784
fixes https://github.com/Expensify/App/issues/59824

### Fixed Issues
<!---
1. Please postfix `$` with a URL link to the GitHub issue this Pull Request is fixing. For example, `$ https://github.com/Expensify/App/issues/<issueID>`.
2. Please postfix  `PROPOSAL:` with a URL link to your GitHub comment, which contains the approved proposal (i.e. the proposal that was approved by Expensify).  For example, `PROPOSAL: https://github.com/Expensify/App/issues/<issueID>#issuecomment-1369752925`

Do NOT add the special GH keywords like `fixed` etc, we have our own process of managing the flow.
It MUST be an entire link to the github issue and your comment proposal ; otherwise, the linking and its automation will not work as expected.

Make sure this section looks similar to this (you can link multiple issues using the same formatting, just add a new line):

$ https://github.com/Expensify/App/issues/<issueID>
$ https://github.com/Expensify/App/issues/<issueID(comment)>

Do NOT only link the issue number like this: $ #<issueID>
--->

$ https://github.com/Expensify/App/issues/47073
PROPOSAL: N/A
<!--- 
If you want to trigger adhoc build of hybrid app from specific Mobile-Expensify PR please link it like this:

MOBILE-EXPENSIFY: https://github.com/Expensify/Mobile-Expensify/pull/<PR-number>

--->

### Tests
<!---
Add a numbered list of manual tests you performed that validates your changes work on all platforms, and that there are no regressions present.
Add any additional test steps if test steps are unique to a particular platform.
Manual test steps should be written so that your reviewer can repeat and verify one or more expected outcomes in the development environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image
--->

**Test 1**

1. Go to Settings > Security.
2. Tap Merge account.
3. Enter email of another account.
4. Mark "I understand this is not reversible" checkbox.
5. Click Next.
6. Wait 30 seconds.
7. Tap "Didn't receive a magic code?".
8. Tap app back button.

Verify that the app will return to the previous page, which is merge account email page.

**Test 2**
1. Go to Settings > Security
2. Tap Merge account
3. Enter long email
4. Mark "I understand this is not reversible" checkbox
5. Click Next

Verify that the long email will be wrapped into two lines and does not overflow

**Test 3**
1. Go to Settings > Security
2. Click on Merge account
3. Refresh the page

Verify that the background stays in settings

**Test 4**
1. Go to Settings > Security.
2. Tap Merge account.
4. Enter email of another account that has enabled 2FA.
5. Mark "I understand this is not reversible" checkbox.
6. Click Next.
7. Enter magic code.
8. Click "Learn more about merging accounts" link.

Verify that the "Learn more about merging accounts" link will open a valid help site.

**Test 5**
1. Go to Settings > Security.
2. Tap Merge account.
3. Enter the same email as your current account.

Verify that you're shown an error and blocked from proceeding.

**Test 6**
1. Go to Settings > Security.
2. Tap Merge account.
3. Enter any email that has a valid Expensify account.
4. Enter incorrect OTP.

Verify that you're shown an invalid code error and it does not show the error code.

- [x] Verify that no errors appear in the JS console

### Offline tests
<!---
Add any relevant steps that validate your changes work as expected in a variety of network states e.g. "offline", "spotty connection", "slow internet", etc. Manual test steps should be written so that your reviewer and QA testers can repeat and verify one or more expected outcomes. If you are unsure how the behavior should work ask for advice in the `#expensify-open-source` Slack channel.
--->
N/A

### QA Steps
<!---
Add a numbered list of manual tests that can be performed by our QA engineers on the staging environment to validate that your changes work on all platforms, and that there are no regressions present.
Add any additional QA steps if test steps are unique to a particular platform.
Manual test steps should be written so that the QA engineer can repeat and verify one or more expected outcomes in the staging environment.

For example:
1. Click on the text input to bring it into focus
2. Upload an image via copy paste
3. Verify a modal appears displaying a preview of that image

It's acceptable to write "Same as tests" if the QA team is able to run the tests in the above "Tests" section.
--->
// TODO: These must be filled out, or the issue title must include "[No QA]."

Same as above
- [x] Verify that no errors appear in the JS console

### PR Author Checklist
<!--
This is a checklist for PR authors. Please make sure to complete all tasks and check them off once you do, or else your PR will not be merged!
-->

- [x] I linked the correct issue in the `### Fixed Issues` section above
- [x] I wrote clear testing steps that cover the changes made in this PR
    - [x] I added steps for local testing in the `Tests` section
    - [x] I added steps for the expected offline behavior in the `Offline steps` section
    - [x] I added steps for Staging and/or Production testing in the `QA steps` section
    - [x] I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    - [x] I tested this PR with a [High Traffic account](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#high-traffic-accounts) against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I ran the tests on **all platforms** & verified they passed on:
    - [x] Android: Native
    - [x] Android: mWeb Chrome
    - [x] iOS: Native
    - [x] iOS: mWeb Safari
    - [x] MacOS: Chrome / Safari
    - [x] MacOS: Desktop
- [x] I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
- [x] I followed proper code patterns (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`)
    - [x] I verified that comments were added to code that is not self explanatory
    - [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60)
      - [x] If any non-english text was added/modified, I used [JaimeGPT](https://chatgpt.com/g/g-2dgOQl5VM-english-to-spanish-translator-aka-jaimegpt) to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60-L68)
    - [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I followed the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` are working as expected)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
- [x] I verified that if a function's arguments changed that all usages have also been updated correctly
- [x] If any new file was added I verified that:
    - [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
    - [x] A similar style doesn't already exist
    - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/styles/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)`)
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    - [x] I verified that all the inputs inside a form are aligned with each other.
    - [x] I added `Design` label and/or tagged `@Expensify/design` so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] I added [unit tests](https://github.com/Expensify/App/blob/main/tests/README.md) for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.

### Screenshots/Videos
<details>
<summary>Android: Native</summary>

<!-- add screenshots or videos here -->
https://github.com/user-attachments/assets/9daae285-85b7-41d9-8e2d-1af5aa298632

</details>

<details>
<summary>Android: mWeb Chrome</summary>

<!-- add screenshots or videos here -->
https://github.com/user-attachments/assets/230c916b-c418-4262-a1d8-fe0aabbacd91

</details>

<details>
<summary>iOS: Native</summary>

<!-- add screenshots or videos here -->
https://github.com/user-attachments/assets/9e5007c7-5d5f-4456-bb8d-09a833ac14a7

</details>

<details>
<summary>iOS: mWeb Safari</summary>

<!-- add screenshots or videos here -->
https://github.com/user-attachments/assets/559d058c-cc0e-498c-82fe-6e1c66bb303a

</details>

<details>
<summary>MacOS: Chrome / Safari</summary>

<!-- add screenshots or videos here -->

https://github.com/user-attachments/assets/6a9e5923-3d77-4dea-98a1-018a45d9d944

https://github.com/user-attachments/assets/42029ee5-8d82-4008-b11e-a5edb130ce57

https://github.com/user-attachments/assets/b52c7e8d-e359-4779-81fd-8bfc15e715cd

</details>

<details>
<summary>MacOS: Desktop</summary>

<!-- add screenshots or videos here -->
https://github.com/user-attachments/assets/a31a70af-7753-478e-8455-888a93cdb642

</details>



Diff:
diff --git a/src/CONST.ts b/src/CONST.ts
index 9ab5d56de384..e96a3d4f7f48 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -1084,7 +1084,7 @@ const CONST = {
     DELAYED_SUBMISSION_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/reports/Automatically-submit-employee-reports',
     ENCRYPTION_AND_SECURITY_HELP_URL: 'https://help.expensify.com/articles/new-expensify/settings/Encryption-and-Data-Security',
     PLAN_TYPES_AND_PRICING_HELP_URL: 'https://help.expensify.com/articles/new-expensify/billing-and-subscriptions/Plan-types-and-pricing',
-    MERGE_ACCOUNT_HELP_URL: 'https://help.expensify.com/articles/expensify-classic/settings/Merge-accounts',
+    MERGE_ACCOUNT_HELP_URL: 'https://help.expensify.com/articles/new-expensify/settings/Merge-Accounts',
     CONNECT_A_BUSINESS_BANK_ACCOUNT_HELP_URL: 'https://help.expensify.com/articles/new-expensify/expenses-&-payments/Connect-a-Business-Bank-Account',
     TEST_RECEIPT_URL: `${CLOUDFRONT_URL}/images/fake-receipt__tacotodds.png`,
     // Use Environment.getEnvironmentURL to get the complete URL with port number
diff --git a/src/components/ConfirmationPage.tsx b/src/components/ConfirmationPage.tsx
index 80277fcaeb58..d4de46017734 100644
--- a/src/components/ConfirmationPage.tsx
+++ b/src/components/ConfirmationPage.tsx
@@ -106,7 +106,7 @@ function ConfirmationPage({
                     </View>
                 )}
                 <Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2, headingStyle]}>{heading}</Text>
-                <Text style={[styles.textAlignCenter, descriptionStyle]}>{description}</Text>
+                <Text style={[styles.textAlignCenter, descriptionStyle, styles.w100]}>{description}</Text>
                 {cta ? <Text style={[styles.textAlignCenter, ctaStyle]}>{cta}</Text> : null}
             </View>
             {(shouldShowSecondaryButton || shouldShowButton) && (
diff --git a/src/languages/en.ts b/src/languages/en.ts
index a5ade77ef024..4da305d626c8 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -1428,6 +1428,10 @@ const translations = {
             confirmMerge: 'Are you sure you want to merge accounts?',
             lossOfUnsubmittedData: `Merging your accounts is irreversible and will result in the loss of any unsubmitted expenses for `,
             enterMagicCode: `To continue, please enter the magic code sent to `,
+            errors: {
+                incorrect2fa: 'Incorrect two-factor authentication code. Please try again.',
+                fallback: 'Something went wrong. Please try again later.',
+            },
         },
         mergeSuccess: {
             accountsMerged: 'Accounts merged!',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index 93ad6096918b..87e0f09269ac 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -1427,6 +1427,10 @@ const translations = {
             confirmMerge: '¿Estás seguro de que deseas fusionar cuentas?',
             lossOfUnsubmittedData: `Fusionar tus cuentas es irreversible y resultará en la pérdida de cualquier gasto no enviado de `,
             enterMagicCode: `Para continuar, por favor introduce el código mágico enviado a `,
+            errors: {
+                incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo.',
+                fallback: 'Ha ocurrido un error. Por favor, inténtalo mas tarde.',
+            },
         },
         mergeSuccess: {
             accountsMerged: '¡Cuentas fusionadas!',
diff --git a/src/libs/Navigation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts b/src/libs/Navigation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts
index 0794bed68693..1fa5705ab3bc 100755
--- a/src/libs/Navigation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts
+++ b/src/libs/Navigation/linkingConfig/RELATIONS/SETTINGS_TO_RHP.ts
@@ -52,6 +52,9 @@ const CENTRAL_PANE_TO_RHP_MAPPING: Partial<Record<keyof SettingsSplitNavigatorPa
         SCREENS.SETTINGS.DELEGATE.DELEGATE_ROLE,
         SCREENS.SETTINGS.DELEGATE.UPDATE_DELEGATE_ROLE,
         SCREENS.SETTINGS.DELEGATE.DELEGATE_CONFIRM,
+        SCREENS.SETTINGS.MERGE_ACCOUNTS.ACCOUNT_DETAILS,
+        SCREENS.SETTINGS.MERGE_ACCOUNTS.ACCOUNT_VALIDATE,
+        SCREENS.SETTINGS.MERGE_ACCOUNTS.MERGE_RESULT,
     ],
     [SCREENS.SETTINGS.ABOUT]: [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS],
     [SCREENS.SETTINGS.SAVE_THE_WORLD]: [SCREENS.I_KNOW_A_TEACHER, SCREENS.INTRO_SCHOOL_PRINCIPAL, SCREENS.I_AM_A_TEACHER],
diff --git a/src/libs/actions/MergeAccounts.ts b/src/libs/actions/MergeAccounts.ts
index fd270c17eeab..4a9aa6745a62 100644
--- a/src/libs/actions/MergeAccounts.ts
+++ b/src/libs/actions/MergeAccounts.ts
@@ -12,7 +12,7 @@ Onyx.connect({
     callback: (value) => (session = value ?? {}),
 });
 
-function requestValidationCodeForAccountMerge(email: string) {
+function requestValidationCodeForAccountMerge(email: string, validateCodeResent = false) {
     const optimisticData: OnyxUpdate[] = [
         {
             onyxMethod: Onyx.METHOD.MERGE,
@@ -21,6 +21,7 @@ function requestValidationCodeForAccountMerge(email: string) {
                 getValidateCodeForAccountMerge: {
                     isLoading: true,
                     validateCodeSent: false,
+                    validateCodeResent: false,
                     errors: null,
                 },
             },
@@ -34,7 +35,8 @@ function requestValidationCodeForAccountMerge(email: string) {
             value: {
                 getValidateCodeForAccountMerge: {
                     isLoading: false,
-                    validateCodeSent: true,
+                    validateCodeSent: !validateCodeResent,
+                    validateCodeResent,
                     errors: null,
                 },
             },
@@ -49,6 +51,7 @@ function requestValidationCodeForAccountMerge(email: string) {
                 getValidateCodeForAccountMerge: {
                     isLoading: false,
                     validateCodeSent: false,
+                    validateCodeResent: false,
                 },
             },
         },
@@ -67,6 +70,7 @@ function clearGetValidateCodeForAccountMerge() {
         getValidateCodeForAccountMerge: {
             errors: null,
             validateCodeSent: false,
+            validateCodeResent: false,
             isLoading: false,
         },
     });
diff --git a/src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx b/src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
index 68f1b271fbcb..0bc337ca71c7 100644
--- a/src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
+++ b/src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
@@ -1,7 +1,7 @@
-import {useFocusEffect, useRoute} from '@react-navigation/native';
+import {useFocusEffect, useNavigation, useRoute} from '@react-navigation/native';
 import {Str} from 'expensify-common';
-import React, {useCallback, useRef, useState} from 'react';
-import {View} from 'react-native';
+import React, {useCallback, useEffect, useRef, useState} from 'react';
+import {InteractionManager, View} from 'react-native';
 import {useOnyx} from 'react-native-onyx';
 import type {ValueOf} from 'type-fest';
 import CheckboxWithLabel from '@components/CheckboxWithLabel';
@@ -16,11 +16,10 @@ import TextInput from '@components/TextInput';
 import useLocalize from '@hooks/useLocalize';
 import useThemeStyles from '@hooks/useThemeStyles';
 import {addErrorMessage, getLatestErrorMessage} from '@libs/ErrorUtils';
-import {appendCountryCode, getPhoneNumberWithoutSpecialChars} from '@libs/LoginUtils';
+import {getPhoneLogin, validateNumber} from '@libs/LoginUtils';
 import Navigation from '@libs/Navigation/Navigation';
 import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types';
 import type {SettingsNavigatorParamList} from '@libs/Navigation/types';
-import {parsePhoneNumber} from '@libs/PhoneNumber';
 import {isNumericWithSpecialChars} from '@libs/ValidationUtils';
 import {clearGetValidateCodeForAccountMerge, requestValidationCodeForAccountMerge} from '@userActions/MergeAccounts';
 import CONST from '@src/CONST';
@@ -52,6 +51,7 @@ const getValidateCodeErrorKey = (err: string): ValueOf<typeof CONST.MERGE_ACCOUN
 
 function AccountDetailsPage() {
     const formRef = useRef<FormRef>(null);
+    const navigation = useNavigation();
     const [userEmailOrPhone] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email, canBeMissing: true});
     const [getValidateCodeForAccountMerge] = useOnyx(ONYXKEYS.ACCOUNT, {selector: (account) => account?.getValidateCodeForAccountMerge, canBeMissing: true});
     const {params} = useRoute<PlatformStackRouteProp<SettingsNavigatorParamList, typeof SCREENS.SETTINGS.MERGE_ACCOUNTS.ACCOUNT_DETAILS>>();
@@ -67,30 +67,38 @@ function AccountDetailsPage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!validateCodeSent || !email) {
-                return;
-            }
+            const task = InteractionManager.runAfterInteractions(() => {
+                if (!validateCodeSent || !email) {
+                    return;
+                }
+
+                return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            });
 
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            return () => task.cancel();
         }, [validateCodeSent, email]),
     );
 
     useFocusEffect(
         useCallback(() => {
-            if (!errorKey || !email) {
-                return;
-            }
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorKey));
+            const task = InteractionManager.runAfterInteractions(() => {
+                if (!errorKey || !email) {
+                    return;
+                }
+                return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorKey));
+            });
+
+            return () => task.cancel();
         }, [errorKey, email]),
     );
 
-    useFocusEffect(
-        useCallback(() => {
-            return () => {
-                clearGetValidateCodeForAccountMerge();
-            };
-        }, []),
-    );
+    useEffect(() => {
+        const unsubscribe = navigation.addListener('blur', () => {
+            clearGetValidateCodeForAccountMerge();
+        });
+
+        return unsubscribe;
+    }, [navigation]);
 
     const validate = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.MERGE_ACCOUNT_DETAILS_FORM>): Errors => {
         const errors = {};
@@ -99,11 +107,13 @@ function AccountDetailsPage() {
 
         if (!login) {
             addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.pleaseEnterEmailOrPhoneNumber'));
+        } else if (login.trim() === userEmailOrPhone) {
+            addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.email'));
         } else {
-            const phoneLogin = appendCountryCode(getPhoneNumberWithoutSpecialChars(login));
-            const parsedPhoneNumber = parsePhoneNumber(phoneLogin);
+            const phoneLogin = getPhoneLogin(login);
+            const validateIfNumber = validateNumber(phoneLogin);
 
-            if (!Str.isValidEmail(login) && !parsedPhoneNumber.possible) {
+            if (!Str.isValidEmail(login) && !validateIfNumber) {
                 if (isNumericWithSpecialChars(login)) {
                     addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.phoneNumber'));
                 } else {
diff --git a/src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx b/src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
index 5e26a5709e55..0df368c1ac4a 100644
--- a/src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
+++ b/src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
@@ -1,5 +1,5 @@
-import {useFocusEffect, useRoute} from '@react-navigation/native';
-import React, {useCallback, useRef} from 'react';
+import {useFocusEffect, useNavigation, useRoute} from '@react-navigation/native';
+import React, {useCallback, useEffect, useRef} from 'react';
 import {View} from 'react-native';
 import {useOnyx} from 'react-native-onyx';
 import type {ValueOf} from 'type-fest';
@@ -22,11 +22,12 @@ import {
     requestValidationCodeForAccountMerge,
 } from '@userActions/MergeAccounts';
 import CONST from '@src/CONST';
+import type {TranslationPaths} from '@src/languages/types';
 import ONYXKEYS from '@src/ONYXKEYS';
 import ROUTES from '@src/ROUTES';
 import type SCREENS from '@src/SCREENS';
 
-const getMergeErrorKey = (err: string): ValueOf<typeof CONST.MERGE_ACCOUNT_RESULTS> | null => {
+const getMergeErrorPage = (err: string): ValueOf<typeof CONST.MERGE_ACCOUNT_RESULTS> | null => {
     if (err.includes('403')) {
         return CONST.MERGE_ACCOUNT_RESULTS.TOO_MANY_ATTEMPTS;
     }
@@ -58,8 +59,22 @@ const getMergeErrorKey = (err: string): ValueOf<typeof CONST.MERGE_ACCOUNT_RESUL
     return null;
 };
 
+const getAuthenticationErrorKey = (err: string): TranslationPaths | null => {
+    if (!err) {
+        return null;
+    }
+
+    if (err.includes('Invalid validateCode')) {
+        return 'mergeAccountsPage.accountValidate.errors.incorrect2fa';
+    }
+
+    return 'mergeAccountsPage.accountValidate.errors.fallback';
+};
+
 function AccountValidatePage() {
     const validateCodeFormRef = useRef<ValidateCodeFormHandle>(null);
+    const navigation = useNavigation();
+
     const [account] = useOnyx(ONYXKEYS.ACCOUNT, {
         selector: (data) => ({
             mergeWithValidateCode: data?.mergeWithValidateCode,
@@ -78,7 +93,7 @@ function AccountValidatePage() {
     const isAccountMerged = mergeWithValidateCode?.isAccountMerged;
 
     const latestError = getLatestErrorMessage(mergeWithValidateCode);
-    const errorKey = getMergeErrorKey(latestError);
+    const errorPage = getMergeErrorPage(latestError);
 
     const styles = useThemeStyles();
     const {translate} = useLocalize();
@@ -94,21 +109,24 @@ function AccountValidatePage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!errorKey || !email) {
+            if (!errorPage || !email) {
                 return;
             }
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorKey), {forceReplace: true});
-        }, [errorKey, email]),
+            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorPage), {forceReplace: true});
+        }, [errorPage, email]),
     );
 
-    useFocusEffect(
-        useCallback(() => {
-            return () => {
-                clearMergeWithValidateCode();
-                clearGetValidateCodeForAccountMerge();
-            };
-        }, []),
-    );
+    useEffect(() => {
+        const unsubscribe = navigation.addListener('blur', () => {
+            clearGetValidateCodeForAccountMerge();
+            clearMergeWithValidateCode();
+        });
+
+        return unsubscribe;
+    }, [navigation]);
+
+    const authenticationErrorKey = getAuthenticationErrorKey(latestError);
+    const validateCodeError = !errorPage && authenticationErrorKey ? {authError: translate(authenticationErrorKey)} : undefined;
 
     return (
         <ScreenWrapper
@@ -131,7 +149,7 @@ function AccountValidatePage() {
                     descriptionPrimary={translate('mergeAccountsPage.accountValidate.confirmMerge')}
                     descriptionPrimaryStyles={{...styles.mb8, ...styles.textStrong}}
                     descriptionSecondary={
-                        <View>
+                        <View style={[styles.w100]}>
                             <Text style={[styles.mb8]}>
                                 {translate('mergeAccountsPage.accountValidate.lossOfUnsubmittedData')}
                                 <Text style={styles.textStrong}>{email}</Text>.
@@ -147,12 +165,12 @@ function AccountValidatePage() {
                         mergeWithValidateCodeAction(email, code);
                     }}
                     sendValidateCode={() => {
-                        requestValidationCodeForAccountMerge(email);
+                        requestValidationCodeForAccountMerge(email, true);
                     }}
                     shouldSkipInitialValidation
                     clearError={() => clearMergeWithValidateCode()}
-                    validateError={!errorKey ? mergeWithValidateCode?.errors : undefined}
-                    hasMagicCodeBeenSent={getValidateCodeForAccountMerge?.validateCodeSent}
+                    validateError={validateCodeError}
+                    hasMagicCodeBeenSent={getValidateCodeForAccountMerge?.validateCodeResent}
                     submitButtonText={translate('mergeAccountsPage.mergeAccount')}
                     forwardedRef={validateCodeFormRef}
                     isLoading={mergeWithValidateCode?.isLoading}
diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts
index 8415e2b825b4..db83f4719793 100644
--- a/src/types/onyx/Account.ts
+++ b/src/types/onyx/Account.ts
@@ -183,6 +183,9 @@ type Account = {
         /** Whether the user validation code was sent */
         validateCodeSent?: boolean;
 
+        /** Whether the user validation code was re-sent */
+        validateCodeResent?: boolean;
+
         /** Errors while requesting the validation code */
         errors: OnyxCommon.Errors;
     };


Reviews:
user: login: parasharrajat
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-04-10T08:32:11Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T23:57:42Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T23:58:09Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T23:59:20Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T00:20:01Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T00:20:09Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T00:20:16Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T00:20:28Z
user: login: arosiclair
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T20:19:02Z
user: login: allroundexperts
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-17T20:54:53Z
user: login: arosiclair
body: Code LGTM. Waiting on your review @parasharrajat 
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-18T13:35:55Z
user: login: arosiclair
body: Looks good, but there are conflicts @allroundexperts 
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T13:53:21Z
user: login: arosiclair
state: DISMISSED
author_association: CONTRIBUTOR
submitted_at: 2025-04-21T17:43:37Z
user: login: parasharrajat
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-21T18:18:49Z
user: login: parasharrajat
body: ## Reviewer Checklist

- [x] I have verified the author checklist is complete (all boxes are checked off).
- [x] I verified the correct issue is linked in the `### Fixed Issues` section above
- [x] I verified testing steps are clear and they cover the changes made in this PR
    - [x] I verified the steps for local testing are in the `Tests` section
    - [x] I verified the steps for Staging and/or Production testing are in the `QA steps` section
    - [x] I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    - [x] I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- [x] I checked that screenshots or videos are included for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I included screenshots or videos for tests on [all platforms](https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md#make-sure-you-can-test-on-all-platforms)
- [x] I verified tests pass on **all platforms** & I tested again on:
    - [x] Android: Native
    - [x] Android: mWeb Chrome
    - [x] iOS: Native
    - [x] iOS: mWeb Safari
    - [x] MacOS: Chrome / Safari
    - [x] MacOS: Desktop
- [x] If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- [x] I verified proper code patterns were followed (see [Reviewing the code](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md#reviewing-the-code))
    - [x] I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. `toggleReport` and not `onIconClick`).
    - [x] I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. `myBool && <MyComponent />`.
    - [x] I verified that comments were added to code that is not self explanatory
    - [x] I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    - [x] I verified any copy / text shown in the product is localized by adding it to `src/languages/*` files and using the [translation method](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60)
    - [x] I verified all numbers, amounts, dates and phone numbers shown in the product are using the [localization methods](https://github.com/Expensify/App/blob/4bd99402cebdf4d7394e0d1f260879ea238197eb/src/components/withLocalize.js#L60-L68)
    - [x] I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the `Waiting for Copy` label for a copy review on the original GH to get the correct copy.
    - [x] I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    - [x] I verified the JSDocs style guidelines (in [`STYLE.md`](https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#jsdocs)) were followed
- [x] If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- [x] I verified that this PR follows the guidelines as stated in the [Review Guidelines](https://github.com/Expensify/App/blob/main/contributingGuides/PR_REVIEW_GUIDELINES.md)
- [x] I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like `Avatar`, I verified the components using `Avatar` have been tested & I retested again)
- [x] I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- [x] I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- [x] If a new component is created I verified that:
    - [x] A similar component doesn't exist in the codebase
    - [x] All props are defined accurately and each prop has a `/** comment above it */`
    - [x] The file is named correctly
    - [x] The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    - [x] The only data being stored in the state is data necessary for rendering and nothing else
    - [x] For Class Components, any internal methods passed to components event handlers are bound to `this` properly so there are no scoping issues (i.e. for `onClick={this.submit}` the method `this.submit` should be bound to `this` in the constructor)
    - [x] Any internal methods bound to `this` are necessary to be bound (i.e. avoid `this.submit = this.submit.bind(this);` if `this.submit` is never passed to a component event handler like `onClick`)
    - [x] All JSX used for rendering exists in the render method
    - [x] The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- [x] If any new file was added I verified that:
    - [x] The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- [x] If a new CSS style is added I verified that:
    - [x] A similar style doesn't already exist
    - [x] The style can't be created with an existing [StyleUtils](https://github.com/Expensify/App/blob/main/src/utils/index.ts) function (i.e. `StyleUtils.getBackgroundAndBorderStyle(theme.componentBG`)
- [x] If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- [x] If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like `Avatar` is modified, I verified that `Avatar` is working as expected in all cases)
- [x] If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- [x] If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- [x] If the PR modifies the form input styles:
    - [x] I verified that all the inputs inside a form are aligned with each other.
    - [x] I added `Design` label so the design team can review the changes.
- [x] If a new page is added, I verified it's using the `ScrollView` component to make it scrollable when more elements are added to the page.
- [x] If the `main` branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the `Test` steps.
- [x] I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.


:ribbon: :eyes: :ribbon:  C+ reviewed
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-21T18:18:56Z
user: login: parasharrajat
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-21T18:19:15Z
user: login: arosiclair
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-22T12:13:21Z
user: login: ZhenjaHorbach
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-08-05T08:31:35Z

Review comments:
diff_hunk: @@ -106,7 +106,7 @@ function ConfirmationPage({
                     </View>
                 )}
                 <Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2, headingStyle]}>{heading}</Text>
-                <Text style={[styles.textAlignCenter, descriptionStyle]}>{description}</Text>
+                <Text style={[styles.textAlignCenter, descriptionStyle, styles.w100]}>{description}</Text>
path: src/components/ConfirmationPage.tsx
user: login: parasharrajat
body: It should be `max-width :100%`.. Or better would be to modify containerStyle as this is Text element. 
created_at: 2025-04-10T08:05:27Z
author_association: MEMBER
diff_hunk: @@ -67,30 +68,38 @@ function AccountDetailsPage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!validateCodeSent || !email) {
-                return;
-            }
+            const task = InteractionManager.runAfterInteractions(() => {
+                if (!validateCodeSent || !email) {
+                    return;
+                }
+
+                return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            });
 
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            return () => task.cancel();
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: parasharrajat
body: Which issue are we solving with this part?
created_at: 2025-04-10T08:08:35Z
author_association: MEMBER
diff_hunk: @@ -99,6 +108,8 @@ function AccountDetailsPage() {
 
         if (!login) {
             addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.pleaseEnterEmailOrPhoneNumber'));
+        } else if (login.trim() === userEmailOrPhone) {
+            addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.email'));
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: parasharrajat
body: We can use `getPhoneLogin` & `validateNumber` to validate phone number. This will replace line 114, 115, and refactor line 117
created_at: 2025-04-10T08:14:01Z
author_association: MEMBER
diff_hunk: @@ -99,6 +108,8 @@ function AccountDetailsPage() {
 
         if (!login) {
             addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.pleaseEnterEmailOrPhoneNumber'));
+        } else if (login.trim() === userEmailOrPhone) {
+            addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.email'));
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: parasharrajat
body: This message is not correct. IMO, It should say something like `you can't merge your own email`. Can we get this confirmed?
created_at: 2025-04-10T08:15:05Z
author_association: MEMBER
diff_hunk: @@ -57,8 +58,22 @@ const getMergeErrorKey = (err: string): ValueOf<typeof CONST.MERGE_ACCOUNT_RESUL
     return null;
 };
 
+const getAuthenticationErrorKey = (err: string): TranslationPaths | null => {
+    if (!err) {
+        return null;
+    }
+
+    if (err.includes('Invalid validateCode')) {
+        return 'passwordForm.error.incorrect2fa';
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: parasharrajat
body: We should either create new keys for this flow or refactor this key to a generic location in the translation file. Using keys from other flows is error-prone. 
created_at: 2025-04-10T08:20:23Z
author_association: MEMBER
diff_hunk: @@ -77,6 +92,7 @@ function AccountValidatePage() {
 
     const latestError = getLatestErrorMessage(mergeWithValidateCode);
     const errorKey = getMergeErrorKey(latestError);
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: parasharrajat
body: Let's rename the error key to `errorPage` so that we are clear that this key is trying to find the matching error page. Otherwise, It become confusing on why we are processing  latestError in two functions.

Rename `getMergeErrorKey` to `getMergeErrorPage`
created_at: 2025-04-10T08:23:29Z
author_association: MEMBER
diff_hunk: @@ -142,7 +158,7 @@ function AccountValidatePage() {
                 }}
                 shouldSkipInitialValidation
                 clearError={() => clearMergeWithValidateCode()}
-                validateError={!errorKey ? mergeWithValidateCode?.errors : undefined}
+                validateError={!errorKey && authenticationErrorKey ? {authError: translate(authenticationErrorKey)} : undefined}
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: parasharrajat
body: let's move this to a callback for clarity. 

```js
const validateCodeError = useMemo(() => {
   const authenticationErrorKey = getAuthenticationErrorKey(latestError);
  // If there's a matching error page OR no specific auth error key, return early.
  if (errorKey || !authenticationErrorKey) {
    return;
  }

  return { authError: translate(authenticationErrorKey) };
}, [errorKey, latestError, translate]);

```

created_at: 2025-04-10T08:31:25Z
author_association: MEMBER
diff_hunk: @@ -106,7 +106,7 @@ function ConfirmationPage({
                     </View>
                 )}
                 <Text style={[styles.textHeadline, styles.textAlignCenter, styles.mv2, headingStyle]}>{heading}</Text>
-                <Text style={[styles.textAlignCenter, descriptionStyle]}>{description}</Text>
+                <Text style={[styles.textAlignCenter, descriptionStyle, styles.w100]}>{description}</Text>
path: src/components/ConfirmationPage.tsx
user: login: allroundexperts
body: `max-width: 100%` is not available on native. The issue here is of overflowing text which does not get resolved by adding a 100% width to parent.
created_at: 2025-04-10T23:57:42Z
author_association: CONTRIBUTOR
diff_hunk: @@ -67,30 +68,38 @@ function AccountDetailsPage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!validateCodeSent || !email) {
-                return;
-            }
+            const task = InteractionManager.runAfterInteractions(() => {
+                if (!validateCodeSent || !email) {
+                    return;
+                }
+
+                return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            });
 
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
+            return () => task.cancel();
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: allroundexperts
body: https://github.com/Expensify/App/issues/59767
created_at: 2025-04-10T23:58:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,6 +108,8 @@ function AccountDetailsPage() {
 
         if (!login) {
             addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.pleaseEnterEmailOrPhoneNumber'));
+        } else if (login.trim() === userEmailOrPhone) {
+            addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.email'));
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: allroundexperts
body: It's correct. Confirmed [here](https://github.com/Expensify/App/issues/59761#issuecomment-2789639805)
created_at: 2025-04-10T23:59:20Z
author_association: CONTRIBUTOR
diff_hunk: @@ -57,8 +58,22 @@ const getMergeErrorKey = (err: string): ValueOf<typeof CONST.MERGE_ACCOUNT_RESUL
     return null;
 };
 
+const getAuthenticationErrorKey = (err: string): TranslationPaths | null => {
+    if (!err) {
+        return null;
+    }
+
+    if (err.includes('Invalid validateCode')) {
+        return 'passwordForm.error.incorrect2fa';
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: allroundexperts
body: Handled.
created_at: 2025-04-11T00:20:01Z
author_association: CONTRIBUTOR
diff_hunk: @@ -77,6 +92,7 @@ function AccountValidatePage() {
 
     const latestError = getLatestErrorMessage(mergeWithValidateCode);
     const errorKey = getMergeErrorKey(latestError);
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: allroundexperts
body: Done
created_at: 2025-04-11T00:20:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -142,7 +158,7 @@ function AccountValidatePage() {
                 }}
                 shouldSkipInitialValidation
                 clearError={() => clearMergeWithValidateCode()}
-                validateError={!errorKey ? mergeWithValidateCode?.errors : undefined}
+                validateError={!errorKey && authenticationErrorKey ? {authError: translate(authenticationErrorKey)} : undefined}
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: allroundexperts
body: Done
created_at: 2025-04-11T00:20:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -99,6 +108,8 @@ function AccountDetailsPage() {
 
         if (!login) {
             addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.pleaseEnterEmailOrPhoneNumber'));
+        } else if (login.trim() === userEmailOrPhone) {
+            addErrorMessage(errors, INPUT_IDS.PHONE_OR_EMAIL, translate('common.error.email'));
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: allroundexperts
body: Done
created_at: 2025-04-11T00:20:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -92,21 +107,36 @@ function AccountValidatePage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!errorKey || !email) {
+            if (!errorPage || !email) {
                 return;
             }
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorKey), {forceReplace: true});
-        }, [errorKey, email]),
+            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorPage), {forceReplace: true});
+        }, [errorPage, email]),
     );
 
-    useFocusEffect(
-        useCallback(() => {
-            return () => {
-                clearMergeWithValidateCode();
-                clearGetValidateCodeForAccountMerge();
-            };
-        }, []),
-    );
+    useEffect(() => {
+        const unsubscribe = navigation.addListener('blur', () => {
+            clearGetValidateCodeForAccountMerge();
+            clearMergeWithValidateCode();
+        });
+
+        return unsubscribe;
+    }, [navigation]);
+
+    const validateCodeError = useMemo(() => {
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: arosiclair
body: There's no slow code in this function so let's remove `useMemo` please.
created_at: 2025-04-15T20:17:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -92,21 +107,36 @@ function AccountValidatePage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!errorKey || !email) {
+            if (!errorPage || !email) {
                 return;
             }
-            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorKey), {forceReplace: true});
-        }, [errorKey, email]),
+            return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_RESULT.getRoute(email, errorPage), {forceReplace: true});
+        }, [errorPage, email]),
     );
 
-    useFocusEffect(
-        useCallback(() => {
-            return () => {
-                clearMergeWithValidateCode();
-                clearGetValidateCodeForAccountMerge();
-            };
-        }, []),
-    );
+    useEffect(() => {
+        const unsubscribe = navigation.addListener('blur', () => {
+            clearGetValidateCodeForAccountMerge();
+            clearMergeWithValidateCode();
+        });
+
+        return unsubscribe;
+    }, [navigation]);
+
+    const validateCodeError = useMemo(() => {
path: src/pages/settings/Security/MergeAccounts/AccountValidatePage.tsx
user: login: allroundexperts
body: Done!
created_at: 2025-04-17T20:54:53Z
author_association: CONTRIBUTOR
path: Mobile-Expensify
user: login: parasharrajat
body: Shouldn't this be reverted back to original.
created_at: 2025-04-21T18:18:49Z
author_association: MEMBER
path: Mobile-Expensify
user: login: parasharrajat
body: @arosiclair @allroundexperts 
created_at: 2025-04-21T18:19:15Z
author_association: MEMBER
diff_hunk: @@ -67,30 +67,38 @@ function AccountDetailsPage() {
 
     useFocusEffect(
         useCallback(() => {
-            if (!validateCodeSent || !email) {
-                return;
-            }
+            const task = InteractionManager.runAfterInteractions(() => {
+                if (!validateCodeSent || !email) {
+                    return;
+                }
+
+                return Navigation.navigate(ROUTES.SETTINGS_MERGE_ACCOUNTS_MAGIC_CODE.getRoute(email));
path: src/pages/settings/Security/MergeAccounts/AccountDetailsPage.tsx
user: login: ZhenjaHorbach
body: Came from [this issue ](https://github.com/Expensify/App/issues/65379)
It is better to trim the email to avoid this issue
created_at: 2025-08-05T08:31:34Z
author_association: CONTRIBUTOR

PR comments:
user: login: melvin-bot[bot]
created_at: 2025-04-09T21:30:27Z
body: @lakchote Please copy/paste the Reviewer Checklist from [here](https://raw.githubusercontent.com/Expensify/App/main/contributingGuides/REVIEWER_CHECKLIST.md) into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]
author_association: NONE
user: login: parasharrajat
created_at: 2025-04-10T07:19:40Z
body: @allroundexperts Can you please use link this PR to the main issue as well via our template?

This way
![image](https://github.com/user-attachments/assets/c33c3072-1021-4d60-acb2-91436f4555fd)


author_association: MEMBER
user: login: lakchote
created_at: 2025-04-10T08:04:43Z
body: @parasharrajat could you please review it? Based on [this](https://github.com/Expensify/App/issues/47073#issuecomment-2791039304) comment from @allroundexperts.
author_association: CONTRIBUTOR
user: login: parasharrajat
created_at: 2025-04-10T08:43:12Z
body: Test List. 

- [x] https://github.com/Expensify/App/issues/59767
- [x] https://github.com/Expensify/App/issues/59757
- [x] https://github.com/Expensify/App/issues/59759
- [x] https://github.com/Expensify/App/issues/59760
- [x] https://github.com/Expensify/App/issues/59761
- [x] https://github.com/Expensify/App/issues/59772
- [x] https://github.com/Expensify/App/issues/59784
- [x] https://github.com/Expensify/App/issues/59824
author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-10T08:46:07Z
body: Please add `fixes` before each issue in the list so that they get auto-closed afterwards, making it easy for all.
author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-17T16:56:04Z
body: I couldn't get access to the internet last 2 days. I will test this asap.
author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-18T14:12:18Z
body: Testing...
author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-20T11:49:56Z
body: WEB: https://github.com/Expensify/App/issues/59757
 
![image](https://github.com/user-attachments/assets/5e55baeb-e07c-4ff7-8993-218d26f9e023)

author_association: MEMBER
user: login: allroundexperts
created_at: 2025-04-20T21:54:22Z
body: > WEB: #59757
> 
> ![image](https://private-user-images.githubusercontent.com/24370807/435462832-5e55baeb-e07c-4ff7-8993-218d26f9e023.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDUxODU3NTMsIm5iZiI6MTc0NTE4NTQ1MywicGF0aCI6Ii8yNDM3MDgwNy80MzU0NjI4MzItNWU1NWJhZWItZTA3Yy00ZmY3LTg5OTMtMjE4ZDI2ZjllMDIzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA0MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNDIwVDIxNDQxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFlZjJkYTdmMmI4ZmJjMDZlYmZjNmYwNWJmY2Y3YjcyNjcxNTkyZGMzZTg1MWViODhmY2ZhMDU0ODQ3N2Y0NzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.VydfWIJZvZB3le1FxJa61gczoPNgzJvrxw3oWlLnkaI)

@parasharrajat Fixed.
author_association: CONTRIBUTOR
user: login: parasharrajat
created_at: 2025-04-21T02:47:36Z
body: BUG: The Result page has the wrong animation, It should be right to left.


https://github.com/user-attachments/assets/68b1373c-3b6c-4d88-9ecb-0e5ec643cd13


author_association: MEMBER
user: login: allroundexperts
created_at: 2025-04-21T10:25:19Z
body: > BUG: The Result page has the wrong animation, It should be right to left.
> 
>  21.04.2025_08.14.18_REC.mp4

Let's solve this in a follow up as its not related to the fixes in this PR.
author_association: CONTRIBUTOR
user: login: parasharrajat
created_at: 2025-04-21T14:24:07Z
body: Please resolve conflicts and I noticing that I am not seeing the private domain flow now. It takes to be purpose screen. Is something wrong from backend?


author_association: MEMBER
user: login: allroundexperts
created_at: 2025-04-21T17:07:21Z
body: > Please resolve conflicts

Done.

> I noticing that I am not seeing the private domain flow now. It takes to be purpose screen. Is something wrong from backend?

The private domain flow is disabled until https://github.com/Expensify/App/pull/54912 is merged.

author_association: CONTRIBUTOR
user: login: arosiclair
created_at: 2025-04-21T17:46:27Z
body: @parasharrajat you still need to fill out the checklist
author_association: CONTRIBUTOR
user: login: parasharrajat
created_at: 2025-04-21T17:53:39Z
body: Lol, my bad. I confused this PR for a wrong issue. Completing the final checks.
author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-21T18:02:02Z
body: ### Screenshots

#### :black_square_button: iOS / native

https://github.com/user-attachments/assets/f1070787-bffc-468a-a55a-80eca3ea62f8


#### :black_square_button: iOS / Safari

https://github.com/user-attachments/assets/3136920e-c9b2-4380-9235-cb8b0c1de806


#### :black_square_button: MacOS / Desktop

https://github.com/user-attachments/assets/246a9c99-85bc-451a-83f4-19c7c98a5be2


#### :black_square_button: MacOS / Chrome

https://github.com/user-attachments/assets/2e295f99-d408-4f3f-a805-d3b188c0c8fa

![image](https://github.com/user-attachments/assets/020f50c1-a7f0-43a4-9fc2-c21a752144f3)

#### :black_square_button: Android / Chrome

https://github.com/user-attachments/assets/340473a2-56fd-4c58-90e2-8eb6ff6ac31b


#### :black_square_button: Android / native

https://github.com/user-attachments/assets/03a07ee3-dbe2-41c5-be18-e1eb95abe491


author_association: MEMBER
user: login: parasharrajat
created_at: 2025-04-21T18:22:37Z
body: Please check this comment before merging https://github.com/Expensify/App/pull/59911#discussion_r2052817486.
author_association: MEMBER
user: login: allroundexperts
created_at: 2025-04-21T18:42:00Z
body: > Please check this comment before merging [#59911 (comment)](https://github.com/Expensify/App/pull/59911#discussion_r2052817486).

Done @parasharrajat 
author_association: CONTRIBUTOR
user: login: allroundexperts
created_at: 2025-04-21T20:34:40Z
body: Waiting on you @arosiclair 😄 
author_association: CONTRIBUTOR
user: login: OSBotify
created_at: 2025-04-22T12:22:21Z
body: :hand: This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-23T18:44:24Z
body: 🚀 [Deployed](https://github.com/Expensify/App/actions/runs/14624879128) to staging by https://github.com/arosiclair in version: 9.1.32-0 🚀

platform | result
---|---
🖥 desktop 🖥|success ✅
🕸 web 🕸|success ✅
🤖 android 🤖|success ✅
🍎 iOS 🍎|success ✅
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-04-28T19:51:16Z
body: 🚀 [Deployed](https://github.com/Expensify/App/actions/runs/14716277562) to production by https://github.com/thienlnam in version: 9.1.32-8 🚀

platform | result
---|---
🖥 desktop 🖥|success ✅
🕸 web 🕸|success ✅
🤖 android 🤖|failure ❌
🍎 iOS 🍎|success ✅
author_association: CONTRIBUTOR