Skip to content

Commit d3113fc

Browse files
authored
Merge pull request #90199 from Expensify/revert-88193-refactor/79048-restore-reverted-usd-flow
[CP Staging] Revert "feat: 79048 restore reverted usd flow"
2 parents f0d27d4 + 2a6276e commit d3113fc

58 files changed

Lines changed: 500 additions & 839 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/CONST/index.ts

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -629,65 +629,7 @@ const CONST = {
629629
VALIDATION: 'ValidationStep',
630630
ENABLE: 'EnableStep',
631631
},
632-
PAGE_NAMES: {
633-
COUNTRY: 'currency-and-country',
634-
BANK_ACCOUNT: 'bank-info',
635-
REQUESTOR: 'personal-info',
636-
VERIFY_IDENTITY: 'verify-identity',
637-
COMPANY: 'company',
638-
BENEFICIAL_OWNERS: 'business-owner',
639-
ACH_CONTRACT: 'ach-contract',
640-
VALIDATION: 'validation',
641-
ENABLE: 'enable',
642-
},
643632
STEP_NAMES: ['1', '2', '3', '4', '5', '6'],
644-
BANK_INFO_STEP: {
645-
SUB_PAGE_NAMES: {
646-
MANUAL: 'manual',
647-
PLAID: 'plaid',
648-
},
649-
},
650-
PERSONAL_INFO_STEP: {
651-
SUB_PAGE_NAMES: {
652-
FULL_NAME: 'full-name',
653-
DATE_OF_BIRTH: 'date-of-birth',
654-
SSN: 'ssn',
655-
ADDRESS: 'address',
656-
CONFIRMATION: 'confirmation',
657-
},
658-
},
659-
BUSINESS_INFO_STEP: {
660-
SUB_PAGE_NAMES: {
661-
NAME: 'name',
662-
TAX_ID: 'tax-id',
663-
WEBSITE: 'website',
664-
PHONE: 'phone',
665-
ADDRESS: 'address',
666-
TYPE: 'type',
667-
INCORPORATION_DATE: 'start-date',
668-
INCORPORATION_STATE: 'state',
669-
INCORPORATION_CODE: 'code',
670-
CONFIRMATION: 'confirmation',
671-
},
672-
},
673-
BENEFICIAL_OWNERS_STEP: {
674-
SUB_PAGE_NAMES: {
675-
IS_USER_UBO: 'is-user-ubo',
676-
IS_ANYONE_ELSE_UBO: 'is-anyone-else-ubo',
677-
ARE_THERE_MORE_UBOS: 'are-there-more-ubos',
678-
UBOS_LIST: 'ubos-list',
679-
LEGAL_NAME: 'legal-name',
680-
DATE_OF_BIRTH: 'date-of-birth',
681-
SSN: 'ssn',
682-
ADDRESS: 'address',
683-
CONFIRMATION: 'confirmation',
684-
},
685-
},
686-
COMPLETE_VERIFICATION_STEP: {
687-
SUB_PAGE_NAMES: {
688-
CONFIRM_AGREEMENTS: 'confirm-agreements',
689-
},
690-
},
691633
SUBSTEP: {
692634
MANUAL: 'manual',
693635
PLAID: 'plaid',

src/ROUTES.ts

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type {ReplacementReason} from './libs/actions/Card';
1414
import type {IOURequestType} from './libs/actions/IOU';
1515
import Log from './libs/Log';
1616
import type {RootNavigatorParamList} from './libs/Navigation/types';
17+
import type {ReimbursementAccountStepToOpen} from './libs/ReimbursementAccountUtils';
1718
import StringUtils from './libs/StringUtils';
1819
import {getUrlWithParams} from './libs/Url';
1920
import SCREENS from './SCREENS';
@@ -623,24 +624,36 @@ const ROUTES = {
623624
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
624625
getRoute: (policyID?: string, backTo?: string) => getUrlWithBackToParam(`bank-account/${VERIFY_ACCOUNT}?policyID=${policyID}`, backTo),
625626
},
627+
BANK_ACCOUNT_NEW: 'bank-account/new',
626628
BANK_ACCOUNT_PERSONAL: 'bank-account/personal',
627-
// TODO: rename the route as no longer accepts step
628629
BANK_ACCOUNT_WITH_STEP_TO_OPEN: {
629-
route: 'bank-account/new',
630-
getRoute: ({policyID, bankAccountID, backTo}: {policyID: string | undefined; bankAccountID?: number; backTo?: string}) => {
630+
route: 'bank-account/:stepToOpen?',
631+
getRoute: ({
632+
policyID,
633+
stepToOpen = '',
634+
bankAccountID,
635+
backTo,
636+
subStepToOpen,
637+
}: {
638+
policyID: string | undefined;
639+
stepToOpen?: ReimbursementAccountStepToOpen;
640+
bankAccountID?: number;
641+
backTo?: string;
642+
subStepToOpen?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
643+
}) => {
631644
if (!policyID && !bankAccountID) {
632645
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
633-
return getUrlWithBackToParam(`bank-account/new`, backTo);
646+
return getUrlWithBackToParam(`bank-account/${stepToOpen}`, backTo);
634647
}
635648

636649
if (bankAccountID) {
637650
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
638-
return getUrlWithBackToParam(`bank-account/new?bankAccountID=${bankAccountID}`, backTo);
651+
return getUrlWithBackToParam(`bank-account/${stepToOpen}?bankAccountID=${bankAccountID}`, backTo);
639652
}
640653
// TODO this backTo comes from drilling it through bank account form screens
641654
// should be removed once https://github.com/Expensify/App/pull/72219 is resolved
642655
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
643-
return getUrlWithBackToParam(`bank-account/new?policyID=${policyID}`, backTo);
656+
return getUrlWithBackToParam(`bank-account/${stepToOpen}?policyID=${policyID}${subStepToOpen ? `&subStep=${subStepToOpen}` : ''}`, backTo);
644657
},
645658
},
646659
BANK_ACCOUNT_ENTER_SIGNER_INFO: {
@@ -672,18 +685,6 @@ const ROUTES = {
672685
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
673686
},
674687
},
675-
BANK_ACCOUNT_USD_SETUP: {
676-
route: 'bank-account/new/us/:page?/:subPage?/:action?',
677-
getRoute: ({policyID, page, subPage, action, backTo}: {policyID?: string; page?: string; subPage?: string; action?: 'edit'; backTo?: string}) => {
678-
const base = 'bank-account/new/us';
679-
const pagePart = page ? `/${page}` : '';
680-
const subPagePart = subPage ? `/${subPage}` : '';
681-
const actionPart = action ? `/${action}` : '';
682-
const queryString = policyID ? `?policyID=${policyID}` : '';
683-
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
684-
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
685-
},
686-
},
687688
SETTINGS: 'settings',
688689
SETTINGS_PROFILE: {
689690
route: 'settings/profile',

src/SCREENS.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ const SCREENS = {
970970
},
971971
DYNAMIC_FLAG_COMMENT: 'Dynamic_Flag_Comment',
972972
REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount',
973-
REIMBURSEMENT_ACCOUNT_USD: 'Reimbursement_Account_USD',
974973
REIMBURSEMENT_ACCOUNT_NON_USD: 'Reimbursement_Account_Non_USD',
975974
REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO: 'Reimbursement_Account_Signer_Info',
976975
REFERRAL_DETAILS: 'Referral_Details',

src/components/Navigation/DebugTabView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import useStyleUtils from '@hooks/useStyleUtils';
1515
import useTheme from '@hooks/useTheme';
1616
import useThemeStyles from '@hooks/useThemeStyles';
1717
import Navigation from '@libs/Navigation/Navigation';
18+
import {getRouteForCurrentStep as getReimbursementAccountRouteForCurrentStep} from '@libs/ReimbursementAccountUtils';
1819
import type {BrickRoad} from '@libs/WorkspacesSettingsUtils';
1920
import {getChatTabBrickRoadReportID} from '@libs/WorkspacesSettingsUtils';
2021
import CONST from '@src/CONST';
@@ -81,7 +82,10 @@ function getSettingsRoute(status: IndicatorStatus | undefined, reimbursementAcco
8182
case CONST.INDICATOR_STATUS.HAS_POLICY_ERRORS:
8283
return ROUTES.WORKSPACE_INITIAL.getRoute(policyIDWithErrors);
8384
case CONST.INDICATOR_STATUS.HAS_REIMBURSEMENT_ACCOUNT_ERRORS:
84-
return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: reimbursementAccount?.achData?.policyID});
85+
return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({
86+
policyID: reimbursementAccount?.achData?.policyID,
87+
stepToOpen: getReimbursementAccountRouteForCurrentStep(reimbursementAccount?.achData?.currentStep ?? CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT),
88+
});
8589
case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_ERRORS:
8690
return ROUTES.SETTINGS_SUBSCRIPTION.route;
8791
case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_INFO:

src/hooks/useReimbursementAccountSubmitCallback.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, {useCallback} from 'react';
33
import {View} from 'react-native';
44
import useResponsiveLayout from '@hooks/useResponsiveLayout';
55
import useThemeStyles from '@hooks/useThemeStyles';
6-
import {isMobileChrome} from '@libs/Browser';
76
import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator';
87
import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation';
98
import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';
@@ -63,17 +62,6 @@ const loadAttachmentModalScreen = () => require<ReactComponentModule>('../../../
6362

6463
type Screens = Partial<Record<Screen, () => React.ComponentType>>;
6564

66-
// Reimbursement Account flow animations glitch on low-end Android devices in Chrome mWeb https://github.com/Expensify/App/issues/87658 so we intentionally disable them
67-
const IS_MOBILE_CHROME = isMobileChrome();
68-
69-
const REIMBURSEMENT_ACCOUNT_FLOW_SCREENS: Screen[] = [
70-
SCREENS.REIMBURSEMENT_ACCOUNT,
71-
SCREENS.REIMBURSEMENT_ACCOUNT_USD,
72-
SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD,
73-
SCREENS.REIMBURSEMENT_ACCOUNT_VERIFY_ACCOUNT,
74-
SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO,
75-
];
76-
7765
const OPTIONS_PER_SCREEN: Partial<Record<Screen, PlatformStackNavigationOptions>> = {
7866
[SCREENS.SETTINGS.MERGE_ACCOUNTS.MERGE_RESULT]: {
7967
animationTypeForReplace: 'push',
@@ -126,7 +114,6 @@ const OPTIONS_PER_SCREEN: Partial<Record<Screen, PlatformStackNavigationOptions>
126114
[SCREENS.WORKSPACE.DYNAMIC_CATEGORIES_IMPORTED]: {
127115
animationTypeForReplace: 'push',
128116
},
129-
...(IS_MOBILE_CHROME ? Object.fromEntries(REIMBURSEMENT_ACCOUNT_FLOW_SCREENS.map((screen) => [screen, {animation: Animations.NONE}])) : {}),
130117
};
131118

132119
/**
@@ -684,7 +671,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
684671
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_ITEMS]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopItemsPage').default,
685672
[SCREENS.CONNECT_EXISTING_BUSINESS_BANK_ACCOUNT_ROOT]: () => require<ReactComponentModule>('@pages/workspace/ConnectExistingBusinessBankAccountPage').default,
686673
[SCREENS.REIMBURSEMENT_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default,
687-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage').default,
688674
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/NonUSD/NonUSDVerifiedBankAccountFlowPage').default,
689675
[SCREENS.REIMBURSEMENT_ACCOUNT_VERIFY_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountVerifyAccountPage').default,
690676
[SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/EnterSignerInfo').default,

src/libs/Navigation/linkingConfig/config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,10 +1174,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
11741174
path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route,
11751175
exact: true,
11761176
},
1177-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
1178-
path: ROUTES.BANK_ACCOUNT_USD_SETUP.route,
1179-
exact: true,
1180-
},
11811177
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
11821178
path: ROUTES.BANK_ACCOUNT_NON_USD_SETUP.route,
11831179
exact: true,

src/libs/Navigation/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,14 +2329,6 @@ type ReimbursementAccountNavigatorParamList = {
23292329
bankAccountID?: string;
23302330
subStep?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
23312331
};
2332-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
2333-
page?: string;
2334-
subPage?: string;
2335-
action?: 'edit';
2336-
policyID?: string;
2337-
// eslint-disable-next-line no-restricted-syntax -- backTo is a temporary param will be removed after https://github.com/Expensify/App/issues/73825 is done
2338-
backTo?: Routes;
2339-
};
23402332
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
23412333
page?: string;
23422334
subPage?: string;

src/libs/ReimbursementAccountUtils.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {ValueOf} from 'type-fest';
22
import CONST from '@src/CONST';
3-
import type {ACHDataReimbursementAccount} from '@src/types/onyx/ReimbursementAccount';
3+
import type {ACHDataReimbursementAccount, ReimbursementAccountStep} from '@src/types/onyx/ReimbursementAccount';
44

55
type ReimbursementAccountStepToOpen = ValueOf<typeof REIMBURSEMENT_ACCOUNT_ROUTE_NAMES> | '';
66

@@ -14,6 +14,27 @@ const REIMBURSEMENT_ACCOUNT_ROUTE_NAMES = {
1414
NEW: 'new',
1515
} as const;
1616

17+
function getRouteForCurrentStep(currentStep: ReimbursementAccountStep): ReimbursementAccountStepToOpen {
18+
switch (currentStep) {
19+
case CONST.BANK_ACCOUNT.STEP.COMPANY:
20+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.COMPANY;
21+
case CONST.BANK_ACCOUNT.STEP.REQUESTOR:
22+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.PERSONAL_INFORMATION;
23+
case CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS:
24+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.BENEFICIAL_OWNERS;
25+
case CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT:
26+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.CONTRACT;
27+
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
28+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.VALIDATE;
29+
case CONST.BANK_ACCOUNT.STEP.ENABLE:
30+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.ENABLE;
31+
case CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT:
32+
case CONST.BANK_ACCOUNT.STEP.COUNTRY:
33+
default:
34+
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.NEW;
35+
}
36+
}
37+
1738
/**
1839
* Returns true if a VBBA exists in any state other than OPEN or LOCKED
1940
*/
@@ -46,5 +67,5 @@ const hasInProgressVBBA = (achData?: ACHDataReimbursementAccount, isNonUSDWorksp
4667
return hasInProgressUSDVBBA(achData);
4768
};
4869

49-
export {getBankAccountIDAsNumber, hasInProgressUSDVBBA, hasInProgressVBBA, REIMBURSEMENT_ACCOUNT_ROUTE_NAMES};
70+
export {getBankAccountIDAsNumber, getRouteForCurrentStep, hasInProgressUSDVBBA, hasInProgressVBBA, REIMBURSEMENT_ACCOUNT_ROUTE_NAMES};
5071
export type {ReimbursementAccountStepToOpen};

src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ type ConnectedVerifiedBankAccountProps = {
2727
onBackButtonPress: () => void;
2828

2929
/** Method to set the state of shouldShowConnectedVerifiedBankAccount */
30-
setShouldShowConnectedVerifiedBankAccount?: (shouldShowConnectedVerifiedBankAccount: boolean) => void;
30+
setShouldShowConnectedVerifiedBankAccount: (shouldShowConnectedVerifiedBankAccount: boolean) => void;
3131

3232
/** Method to set the state of USD bank account step */
33-
setUSDBankAccountStep?: (step: string | null) => void;
33+
setUSDBankAccountStep: (step: string | null) => void;
3434

3535
/** Whether the workspace currency is set to non USD currency */
3636
isNonUSDWorkspace: boolean;

0 commit comments

Comments
 (0)