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
58 changes: 0 additions & 58 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,65 +627,7 @@ const CONST = {
VALIDATION: 'ValidationStep',
ENABLE: 'EnableStep',
},
PAGE_NAMES: {
COUNTRY: 'currency-and-country',
BANK_ACCOUNT: 'bank-info',
REQUESTOR: 'personal-info',
VERIFY_IDENTITY: 'verify-identity',
COMPANY: 'company',
BENEFICIAL_OWNERS: 'business-owner',
ACH_CONTRACT: 'ach-contract',
VALIDATION: 'validation',
ENABLE: 'enable',
},
STEP_NAMES: ['1', '2', '3', '4', '5', '6'],
BANK_INFO_STEP: {
SUB_PAGE_NAMES: {
MANUAL: 'manual',
PLAID: 'plaid',
},
},
PERSONAL_INFO_STEP: {
SUB_PAGE_NAMES: {
FULL_NAME: 'full-name',
DATE_OF_BIRTH: 'date-of-birth',
SSN: 'ssn',
ADDRESS: 'address',
CONFIRMATION: 'confirmation',
},
},
BUSINESS_INFO_STEP: {
SUB_PAGE_NAMES: {
NAME: 'name',
TAX_ID: 'tax-id',
WEBSITE: 'website',
PHONE: 'phone',
ADDRESS: 'address',
TYPE: 'type',
INCORPORATION_DATE: 'start-date',
INCORPORATION_STATE: 'state',
INCORPORATION_CODE: 'code',
CONFIRMATION: 'confirmation',
},
},
BENEFICIAL_OWNERS_STEP: {
SUB_PAGE_NAMES: {
IS_USER_UBO: 'is-user-ubo',
IS_ANYONE_ELSE_UBO: 'is-anyone-else-ubo',
ARE_THERE_MORE_UBOS: 'are-there-more-ubos',
UBOS_LIST: 'ubos-list',
LEGAL_NAME: 'legal-name',
DATE_OF_BIRTH: 'date-of-birth',
SSN: 'ssn',
ADDRESS: 'address',
CONFIRMATION: 'confirmation',
},
},
COMPLETE_VERIFICATION_STEP: {
SUB_PAGE_NAMES: {
CONFIRM_AGREEMENTS: 'confirm-agreements',
},
},
SUBSTEP: {
MANUAL: 'manual',
PLAID: 'plaid',
Expand Down
37 changes: 19 additions & 18 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {ReplacementReason} from './libs/actions/Card';
import type {IOURequestType} from './libs/actions/IOU';
import Log from './libs/Log';
import type {RootNavigatorParamList} from './libs/Navigation/types';
import type {ReimbursementAccountStepToOpen} from './libs/ReimbursementAccountUtils';
import StringUtils from './libs/StringUtils';
import {getUrlWithParams} from './libs/Url';
import SCREENS from './SCREENS';
Expand Down Expand Up @@ -623,24 +624,36 @@ const ROUTES = {
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
getRoute: (policyID?: string, backTo?: string) => getUrlWithBackToParam(`bank-account/${VERIFY_ACCOUNT}?policyID=${policyID}`, backTo),
},
BANK_ACCOUNT_NEW: 'bank-account/new',
BANK_ACCOUNT_PERSONAL: 'bank-account/personal',
// TODO: rename the route as no longer accepts step
BANK_ACCOUNT_WITH_STEP_TO_OPEN: {
route: 'bank-account/new',
getRoute: ({policyID, bankAccountID, backTo}: {policyID: string | undefined; bankAccountID?: number; backTo?: string}) => {
route: 'bank-account/:stepToOpen?',
getRoute: ({
policyID,
stepToOpen = '',
bankAccountID,
backTo,
subStepToOpen,
}: {
policyID: string | undefined;
stepToOpen?: ReimbursementAccountStepToOpen;
bankAccountID?: number;
backTo?: string;
subStepToOpen?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
}) => {
if (!policyID && !bankAccountID) {
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(`bank-account/new`, backTo);
return getUrlWithBackToParam(`bank-account/${stepToOpen}`, backTo);
}

if (bankAccountID) {
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(`bank-account/new?bankAccountID=${bankAccountID}`, backTo);
return getUrlWithBackToParam(`bank-account/${stepToOpen}?bankAccountID=${bankAccountID}`, backTo);
}
// TODO this backTo comes from drilling it through bank account form screens
// should be removed once https://github.com/Expensify/App/pull/72219 is resolved
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(`bank-account/new?policyID=${policyID}`, backTo);
return getUrlWithBackToParam(`bank-account/${stepToOpen}?policyID=${policyID}${subStepToOpen ? `&subStep=${subStepToOpen}` : ''}`, backTo);
},
},
BANK_ACCOUNT_ENTER_SIGNER_INFO: {
Expand Down Expand Up @@ -672,18 +685,6 @@ const ROUTES = {
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
},
},
BANK_ACCOUNT_USD_SETUP: {
route: 'bank-account/new/us/:page?/:subPage?/:action?',
getRoute: ({policyID, page, subPage, action, backTo}: {policyID?: string; page?: string; subPage?: string; action?: 'edit'; backTo?: string}) => {
const base = 'bank-account/new/us';
const pagePart = page ? `/${page}` : '';
const subPagePart = subPage ? `/${subPage}` : '';
const actionPart = action ? `/${action}` : '';
const queryString = policyID ? `?policyID=${policyID}` : '';
// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(`${base}${pagePart}${subPagePart}${actionPart}${queryString}`, backTo);
},
},
SETTINGS: 'settings',
SETTINGS_PROFILE: {
route: 'settings/profile',
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,6 @@ const SCREENS = {
},
DYNAMIC_FLAG_COMMENT: 'Dynamic_Flag_Comment',
REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount',
REIMBURSEMENT_ACCOUNT_USD: 'Reimbursement_Account_USD',
REIMBURSEMENT_ACCOUNT_NON_USD: 'Reimbursement_Account_Non_USD',
REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO: 'Reimbursement_Account_Signer_Info',
REFERRAL_DETAILS: 'Referral_Details',
Expand Down
6 changes: 5 additions & 1 deletion src/components/Navigation/DebugTabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import Navigation from '@libs/Navigation/Navigation';
import {getRouteForCurrentStep as getReimbursementAccountRouteForCurrentStep} from '@libs/ReimbursementAccountUtils';
import type {BrickRoad} from '@libs/WorkspacesSettingsUtils';
import {getChatTabBrickRoadReportID} from '@libs/WorkspacesSettingsUtils';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -81,7 +82,10 @@ function getSettingsRoute(status: IndicatorStatus | undefined, reimbursementAcco
case CONST.INDICATOR_STATUS.HAS_POLICY_ERRORS:
return ROUTES.WORKSPACE_INITIAL.getRoute(policyIDWithErrors);
case CONST.INDICATOR_STATUS.HAS_REIMBURSEMENT_ACCOUNT_ERRORS:
return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({policyID: reimbursementAccount?.achData?.policyID});
return ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.getRoute({
policyID: reimbursementAccount?.achData?.policyID,
stepToOpen: getReimbursementAccountRouteForCurrentStep(reimbursementAccount?.achData?.currentStep ?? CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT),
});
case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_ERRORS:
return ROUTES.SETTINGS_SUBSCRIPTION.route;
case CONST.INDICATOR_STATUS.HAS_SUBSCRIPTION_INFO:
Expand Down
28 changes: 0 additions & 28 deletions src/hooks/useReimbursementAccountSubmitCallback.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, {useCallback} from 'react';
import {View} from 'react-native';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';
import {isMobileChrome} from '@libs/Browser';
import createPlatformStackNavigator from '@libs/Navigation/PlatformStackNavigation/createPlatformStackNavigator';
import Animations from '@libs/Navigation/PlatformStackNavigation/navigationOptions/animation';
import type {PlatformStackNavigationOptions} from '@libs/Navigation/PlatformStackNavigation/types';
Expand Down Expand Up @@ -63,17 +62,6 @@ const loadAttachmentModalScreen = () => require<ReactComponentModule>('../../../

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

// 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
const IS_MOBILE_CHROME = isMobileChrome();

const REIMBURSEMENT_ACCOUNT_FLOW_SCREENS: Screen[] = [
SCREENS.REIMBURSEMENT_ACCOUNT,
SCREENS.REIMBURSEMENT_ACCOUNT_USD,
SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD,
SCREENS.REIMBURSEMENT_ACCOUNT_VERIFY_ACCOUNT,
SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO,
];

const OPTIONS_PER_SCREEN: Partial<Record<Screen, PlatformStackNavigationOptions>> = {
[SCREENS.SETTINGS.MERGE_ACCOUNTS.MERGE_RESULT]: {
animationTypeForReplace: 'push',
Expand Down Expand Up @@ -126,7 +114,6 @@ const OPTIONS_PER_SCREEN: Partial<Record<Screen, PlatformStackNavigationOptions>
[SCREENS.WORKSPACE.DYNAMIC_CATEGORIES_IMPORTED]: {
animationTypeForReplace: 'push',
},
...(IS_MOBILE_CHROME ? Object.fromEntries(REIMBURSEMENT_ACCOUNT_FLOW_SCREENS.map((screen) => [screen, {animation: Animations.NONE}])) : {}),
};

/**
Expand Down Expand Up @@ -684,7 +671,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_ITEMS]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopItemsPage').default,
[SCREENS.CONNECT_EXISTING_BUSINESS_BANK_ACCOUNT_ROOT]: () => require<ReactComponentModule>('@pages/workspace/ConnectExistingBusinessBankAccountPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/USD/USDVerifiedBankAccountFlowPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/NonUSD/NonUSDVerifiedBankAccountFlowPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT_VERIFY_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountVerifyAccountPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT_ENTER_SIGNER_INFO]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/EnterSignerInfo').default,
Expand Down
4 changes: 0 additions & 4 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route,
exact: true,
},
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
path: ROUTES.BANK_ACCOUNT_USD_SETUP.route,
exact: true,
},
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
path: ROUTES.BANK_ACCOUNT_NON_USD_SETUP.route,
exact: true,
Expand Down
8 changes: 0 additions & 8 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2329,14 +2329,6 @@ type ReimbursementAccountNavigatorParamList = {
bankAccountID?: string;
subStep?: typeof CONST.BANK_ACCOUNT.STEP.COUNTRY;
};
[SCREENS.REIMBURSEMENT_ACCOUNT_USD]: {
page?: string;
subPage?: string;
action?: 'edit';
policyID?: string;
// 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
backTo?: Routes;
};
[SCREENS.REIMBURSEMENT_ACCOUNT_NON_USD]: {
page?: string;
subPage?: string;
Expand Down
25 changes: 23 additions & 2 deletions src/libs/ReimbursementAccountUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {ValueOf} from 'type-fest';
import CONST from '@src/CONST';
import type {ACHDataReimbursementAccount} from '@src/types/onyx/ReimbursementAccount';
import type {ACHDataReimbursementAccount, ReimbursementAccountStep} from '@src/types/onyx/ReimbursementAccount';

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

Expand All @@ -14,6 +14,27 @@ const REIMBURSEMENT_ACCOUNT_ROUTE_NAMES = {
NEW: 'new',
} as const;

function getRouteForCurrentStep(currentStep: ReimbursementAccountStep): ReimbursementAccountStepToOpen {
switch (currentStep) {
case CONST.BANK_ACCOUNT.STEP.COMPANY:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.COMPANY;
case CONST.BANK_ACCOUNT.STEP.REQUESTOR:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.PERSONAL_INFORMATION;
case CONST.BANK_ACCOUNT.STEP.BENEFICIAL_OWNERS:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.BENEFICIAL_OWNERS;
case CONST.BANK_ACCOUNT.STEP.ACH_CONTRACT:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.CONTRACT;
case CONST.BANK_ACCOUNT.STEP.VALIDATION:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.VALIDATE;
case CONST.BANK_ACCOUNT.STEP.ENABLE:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.ENABLE;
case CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT:
case CONST.BANK_ACCOUNT.STEP.COUNTRY:
default:
return REIMBURSEMENT_ACCOUNT_ROUTE_NAMES.NEW;
}
}

/**
* Returns true if a VBBA exists in any state other than OPEN or LOCKED
*/
Expand Down Expand Up @@ -46,5 +67,5 @@ const hasInProgressVBBA = (achData?: ACHDataReimbursementAccount, isNonUSDWorksp
return hasInProgressUSDVBBA(achData);
};

export {getBankAccountIDAsNumber, hasInProgressUSDVBBA, hasInProgressVBBA, REIMBURSEMENT_ACCOUNT_ROUTE_NAMES};
export {getBankAccountIDAsNumber, getRouteForCurrentStep, hasInProgressUSDVBBA, hasInProgressVBBA, REIMBURSEMENT_ACCOUNT_ROUTE_NAMES};
export type {ReimbursementAccountStepToOpen};
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ type ConnectedVerifiedBankAccountProps = {
onBackButtonPress: () => void;

/** Method to set the state of shouldShowConnectedVerifiedBankAccount */
setShouldShowConnectedVerifiedBankAccount?: (shouldShowConnectedVerifiedBankAccount: boolean) => void;
setShouldShowConnectedVerifiedBankAccount: (shouldShowConnectedVerifiedBankAccount: boolean) => void;

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

/** Whether the workspace currency is set to non USD currency */
isNonUSDWorkspace: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function NonUSDVerifiedBankAccountFlowPage({route}: NonUSDVerifiedBankAccountFlo
}, [backTo, currentPageIndex, pages, policyID]);

return (
<View style={[styles.flex1, styles.appBG]}>
<View style={styles.flex1}>
<CurrentPage
onSubmit={onSubmit}
onBackButtonPress={onBackButtonPress}
Expand Down
Loading
Loading