Skip to content

Commit 27c45fb

Browse files
authored
Merge pull request #87668 from Expensify/revert-87624-and-86645
Revert 87624 and 86645
2 parents 7f504fc + d3e1c54 commit 27c45fb

57 files changed

Lines changed: 504 additions & 818 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
@@ -608,65 +608,7 @@ const CONST = {
608608
VALIDATION: 'ValidationStep',
609609
ENABLE: 'EnableStep',
610610
},
611-
PAGE_NAMES: {
612-
COUNTRY: 'currency-and-country',
613-
BANK_ACCOUNT: 'bank-info',
614-
REQUESTOR: 'personal-info',
615-
VERIFY_IDENTITY: 'verify-identity',
616-
COMPANY: 'company',
617-
BENEFICIAL_OWNERS: 'business-owner',
618-
ACH_CONTRACT: 'ach-contract',
619-
VALIDATION: 'validation',
620-
ENABLE: 'enable',
621-
},
622611
STEP_NAMES: ['1', '2', '3', '4', '5', '6'],
623-
BANK_INFO_STEP: {
624-
SUB_PAGE_NAMES: {
625-
MANUAL: 'manual',
626-
PLAID: 'plaid',
627-
},
628-
},
629-
PERSONAL_INFO_STEP: {
630-
SUB_PAGE_NAMES: {
631-
FULL_NAME: 'full-name',
632-
DATE_OF_BIRTH: 'date-of-birth',
633-
SSN: 'ssn',
634-
ADDRESS: 'address',
635-
CONFIRMATION: 'confirmation',
636-
},
637-
},
638-
BUSINESS_INFO_STEP: {
639-
SUB_PAGE_NAMES: {
640-
NAME: 'name',
641-
TAX_ID: 'tax-id',
642-
WEBSITE: 'website',
643-
PHONE: 'phone',
644-
ADDRESS: 'address',
645-
TYPE: 'type',
646-
INCORPORATION_DATE: 'start-date',
647-
INCORPORATION_STATE: 'state',
648-
INCORPORATION_CODE: 'code',
649-
CONFIRMATION: 'confirmation',
650-
},
651-
},
652-
BENEFICIAL_OWNERS_STEP: {
653-
SUB_PAGE_NAMES: {
654-
IS_USER_UBO: 'is-user-ubo',
655-
IS_ANYONE_ELSE_UBO: 'is-anyone-else-ubo',
656-
ARE_THERE_MORE_UBOS: 'are-there-more-ubos',
657-
UBOS_LIST: 'ubos-list',
658-
LEGAL_NAME: 'legal-name',
659-
DATE_OF_BIRTH: 'date-of-birth',
660-
SSN: 'ssn',
661-
ADDRESS: 'address',
662-
CONFIRMATION: 'confirmation',
663-
},
664-
},
665-
COMPLETE_VERIFICATION_STEP: {
666-
SUB_PAGE_NAMES: {
667-
CONFIRM_AGREEMENTS: 'confirm-agreements',
668-
},
669-
},
670612
SUBSTEP: {
671613
MANUAL: 'manual',
672614
PLAID: 'plaid',

src/ROUTES.ts

Lines changed: 19 additions & 19 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';
@@ -408,24 +409,36 @@ const ROUTES = {
408409
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
409410
getRoute: (policyID?: string, backTo?: string) => getUrlWithBackToParam(`bank-account/${VERIFY_ACCOUNT}?policyID=${policyID}`, backTo),
410411
},
412+
BANK_ACCOUNT_NEW: 'bank-account/new',
411413
BANK_ACCOUNT_PERSONAL: 'bank-account/personal',
412-
// TODO: rename the route as no longer accepts step
413414
BANK_ACCOUNT_WITH_STEP_TO_OPEN: {
414-
route: 'bank-account/new',
415-
getRoute: ({policyID, bankAccountID, backTo}: {policyID: string | undefined; bankAccountID?: number; backTo?: string}) => {
415+
route: 'bank-account/:stepToOpen?',
416+
getRoute: ({
417+
policyID,
418+
stepToOpen = '',
419+
bankAccountID,
420+
backTo,
421+
subStepToOpen,
422+
}: {
423+
policyID: string | undefined;
424+
stepToOpen?: ReimbursementAccountStepToOpen;
425+
bankAccountID?: number;
426+
backTo?: string;
427+
subStepToOpen?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
428+
}) => {
416429
if (!policyID && !bankAccountID) {
417430
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
418-
return getUrlWithBackToParam(`bank-account/new`, backTo);
431+
return getUrlWithBackToParam(`bank-account/${stepToOpen}`, backTo);
419432
}
420433

421434
if (bankAccountID) {
422435
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
423-
return getUrlWithBackToParam(`bank-account/new?bankAccountID=${bankAccountID}`, backTo);
436+
return getUrlWithBackToParam(`bank-account/${stepToOpen}?bankAccountID=${bankAccountID}`, backTo);
424437
}
425438
// TODO this backTo comes from drilling it through bank account form screens
426439
// should be removed once https://github.com/Expensify/App/pull/72219 is resolved
427440
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
428-
return getUrlWithBackToParam(`bank-account/new?policyID=${policyID}`, backTo);
441+
return getUrlWithBackToParam(`bank-account/${stepToOpen}?policyID=${policyID}${subStepToOpen ? `&subStep=${subStepToOpen}` : ''}`, backTo);
429442
},
430443
},
431444
BANK_ACCOUNT_ENTER_SIGNER_INFO: {
@@ -457,19 +470,6 @@ const ROUTES = {
457470
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
458471
},
459472
},
460-
BANK_ACCOUNT_USD_SETUP: {
461-
route: 'bank-account/new/us/:page?/:subPage?/:action?',
462-
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
463-
getRoute: ({policyID, page, subPage, action, backTo}: {policyID?: string; page?: string; subPage?: string; action?: 'edit'; backTo?: string}) => {
464-
const base = 'bank-account/new/us';
465-
const pagePart = page ? `/${page}` : '';
466-
const subPagePart = subPage ? `/${subPage}` : '';
467-
const actionPart = action ? `/${action}` : '';
468-
const queryString = policyID ? `?policyID=${policyID}` : '';
469-
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
470-
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
471-
},
472-
},
473473
SETTINGS: 'settings',
474474
SETTINGS_PROFILE: {
475475
route: 'settings/profile',

src/SCREENS.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,6 @@ const SCREENS = {
937937
},
938938
DYNAMIC_FLAG_COMMENT: 'Dynamic_Flag_Comment',
939939
REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount',
940-
REIMBURSEMENT_ACCOUNT_USD: 'Reimbursement_Account_USD',
941940
REIMBURSEMENT_ACCOUNT_NON_USD: 'Reimbursement_Account_Non_USD',
942941
REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO: 'Reimbursement_Account_Signer_Info',
943942
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
637637
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_ITEMS]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopItemsPage').default,
638638
[SCREENS.CONNECT_EXISTING_BUSINESS_BANK_ACCOUNT_ROOT]: () => require<ReactComponentModule>('@pages/workspace/ConnectExistingBusinessBankAccountPage').default,
639639
[SCREENS.REIMBURSEMENT_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default,
640-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage').default,
641640
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/NonUSD/NonUSDVerifiedBankAccountFlowPage').default,
642641
[SCREENS.REIMBURSEMENT_ACCOUNT_VERIFY_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountVerifyAccountPage').default,
643642
[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
@@ -1169,10 +1169,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
11691169
path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route,
11701170
exact: true,
11711171
},
1172-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
1173-
path: ROUTES.BANK_ACCOUNT_USD_SETUP.route,
1174-
exact: true,
1175-
},
11761172
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
11771173
path: ROUTES.BANK_ACCOUNT_NON_USD_SETUP.route,
11781174
exact: true,

src/libs/Navigation/types.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,14 +2277,6 @@ type ReimbursementAccountNavigatorParamList = {
22772277
bankAccountID?: string;
22782278
subStep?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
22792279
};
2280-
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
2281-
page?: string;
2282-
subPage?: string;
2283-
action?: 'edit';
2284-
policyID?: string;
2285-
// 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
2286-
backTo?: Routes;
2287-
};
22882280
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
22892281
page?: string;
22902282
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, hasInProgressNonUSDVBBA, hasInProgressVBBA, REIMBURSEMENT_ACCOUNT_ROUTE_NAMES};
70+
export {getBankAccountIDAsNumber, getRouteForCurrentStep, hasInProgressUSDVBBA, hasInProgressNonUSDVBBA, 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)