From b825ac969d3505143250c7e260d31bbbca10ee6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 14:09:45 +0200 Subject: [PATCH 01/28] enable no-member-access rule --- .eslintrc.js | 1 - .../categories/newComponentCategory.ts | 12 ++++++++++- .../createOrUpdateStagingDeploy.ts | 8 ++++++-- .../Environment/betaChecker/index.android.ts | 7 ++++++- src/libs/Middleware/RecheckConnection.ts | 2 +- src/libs/Navigation/linkTo/index.ts | 20 +++++++++++++------ 6 files changed, 38 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 380ab89cad72..e43acb098440 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -100,7 +100,6 @@ module.exports = { __DEV__: 'readonly', }, rules: { - '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-assignment': 'off', // TypeScript specific rules diff --git a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts index 042d91a5b956..3a5912cf3da7 100644 --- a/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts +++ b/.github/actions/javascript/authorChecklist/categories/newComponentCategory.ts @@ -1,4 +1,5 @@ import * as github from '@actions/github'; +import type {WebhookPayload} from '@actions/github/lib/interfaces'; import {parse} from '@babel/parser'; import traverse from '@babel/traverse'; import CONST from '@github/libs/CONST'; @@ -8,6 +9,15 @@ import type Category from './Category'; type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string}; +type GithubPaylod = WebhookPayload & { + // eslint-disable-next-line @typescript-eslint/naming-convention + pull_request?: { + head: { + ref?: string; + }; + }; +}; + const items = [ "I verified that similar component doesn't exist in the codebase", 'I verified that all props are defined accurately and each prop has a `/** comment above it */`', @@ -77,7 +87,7 @@ async function detectReactComponentInFile(filename: string): Promise>['data']; +type PackageJSON = { + version: string; +}; + async function run(): Promise { // Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time - const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')); - const newVersionTag: string = packageJson.version; + const packageJson: PackageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8')); + const newVersionTag = packageJson.version; try { // Start by fetching the list of recent StagingDeployCash issues, along with the list of open deploy blockers diff --git a/src/libs/Environment/betaChecker/index.android.ts b/src/libs/Environment/betaChecker/index.android.ts index 975cddf210c9..2412a6d50167 100644 --- a/src/libs/Environment/betaChecker/index.android.ts +++ b/src/libs/Environment/betaChecker/index.android.ts @@ -6,6 +6,11 @@ import ONYXKEYS from '@src/ONYXKEYS'; import pkg from '../../../../package.json'; import type {IsBetaBuild} from './types'; +type GithubReleaseJSON = { + // eslint-disable-next-line @typescript-eslint/naming-convention + tag_name: string | semver.SemVer; +}; + let isLastSavedBeta = false; Onyx.connect({ key: ONYXKEYS.IS_BETA, @@ -21,7 +26,7 @@ function isBetaBuild(): IsBetaBuild { return new Promise((resolve) => { fetch(CONST.GITHUB_RELEASE_URL) .then((res) => res.json()) - .then((json) => { + .then((json: GithubReleaseJSON) => { const productionVersion: string | semver.SemVer = json.tag_name; if (!productionVersion) { AppUpdate.setIsAppInBeta(false); diff --git a/src/libs/Middleware/RecheckConnection.ts b/src/libs/Middleware/RecheckConnection.ts index f3f7d2e7b688..e62c716013cd 100644 --- a/src/libs/Middleware/RecheckConnection.ts +++ b/src/libs/Middleware/RecheckConnection.ts @@ -15,7 +15,7 @@ const RecheckConnection: Middleware = (response) => { // When the request goes past a certain amount of time we trigger a re-check of the connection const cancelRequestTimeoutTimer = startRecheckTimeoutTimer(); return response - .catch((error) => { + .catch((error: Error) => { if (error.name !== CONST.ERROR.REQUEST_CANCELLED) { // Because we ran into an error we assume we might be offline and do a "connection" health test NetworkConnection.recheckNetworkConnection(); diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index b9839483a056..859a4964d43c 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -29,6 +29,13 @@ import SCREENS from '@src/SCREENS'; import getActionForBottomTabNavigator from './getActionForBottomTabNavigator'; import getMinimalAction from './getMinimalAction'; +type ActionParams = { + screen: string; + params?: { + policyIDs?: string; + }; +}; + export default function linkTo(navigation: NavigationContainerRef | null, path: Route, type?: string, isActiveRoute?: boolean) { if (!navigation) { throw new Error("Couldn't find a navigation object. Is your component inside a screen in a navigator?"); @@ -68,16 +75,17 @@ export default function linkTo(navigation: NavigationContainerRef | undefined, (value) => value === undefined), - omitBy(action.payload.params?.params as Record | undefined, (value) => value === undefined), + omitBy(actionParams?.params as Record | undefined, (value) => value === undefined), ); // If the type is UP, we deeplinked into one of the RHP flows and we want to replace the current screen with the previous one in the flow @@ -103,8 +111,8 @@ export default function linkTo(navigation: NavigationContainerRef Date: Thu, 6 Jun 2024 14:34:22 +0200 Subject: [PATCH 02/28] add draft solution for require errors --- desktop/main.ts | 2 +- src/libs/EmojiUtils.ts | 4 ++-- .../Navigation/AppNavigator/ModalStackNavigators/index.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop/main.ts b/desktop/main.ts index c4338e7d49b3..2b3a6b642dd6 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -21,7 +21,7 @@ type CreateDownloadQueue = () => { dequeueDownloadItem: () => DownloadItem | undefined; }; -const createDownloadQueue: CreateDownloadQueue = require('./createDownloadQueue').default; +const createDownloadQueue = (require('./createDownloadQueue') as {default: CreateDownloadQueue}).default; const port = process.env.PORT ?? 8082; const {DESKTOP_SHORTCUT_ACCELERATOR, LOCALES} = CONST; diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index 0be7e76a0aa9..8755e5c749fb 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -314,7 +314,7 @@ function getAddedEmojis(currentEmojis: Emoji[], formerEmojis: Emoji[]): Emoji[] */ function replaceEmojis(text: string, preferredSkinTone: OnyxEntry = CONST.EMOJI_DEFAULT_SKIN_TONE, lang: Locale = CONST.LOCALES.DEFAULT): ReplacedEmoji { // emojisTrie is importing the emoji JSON file on the app starting and we want to avoid it - const emojisTrie: typeof EmojiTrie = require('./EmojiTrie').default; + const emojisTrie: typeof EmojiTrie = (require('./EmojiTrie') as {default: typeof EmojiTrie}).default; const trie = emojisTrie[lang as SupportedLanguage]; if (!trie) { @@ -392,7 +392,7 @@ function replaceAndExtractEmojis(text: string, preferredSkinTone: OnyxEntry(screens: } const MoneyRequestModalStackNavigator = createModalStackNavigator({ - [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default as React.ComponentType, + [SCREENS.MONEY_REQUEST.START]: () => (require('../../../../pages/iou/request/IOURequestRedirectToStartPage') as {default: React.ComponentType}).default, [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default as React.ComponentType, [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default as React.ComponentType, [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default as React.ComponentType, From b60e0bae4a6aec594731ae7e7ed6efa05105dd82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 15:20:15 +0200 Subject: [PATCH 03/28] override node require interface --- src/types/global.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 03446e813949..9cf3e29dd701 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -31,3 +31,9 @@ declare module '*.lottie' { interface Window { setSupportToken: (token: string, email: string, accountID: number) => void; } + +// eslint-disable-next-line @typescript-eslint/consistent-type-definitions +interface NodeRequire { + // eslint-disable-next-line @typescript-eslint/prefer-function-type, @typescript-eslint/no-explicit-any + (id: string): T; +} From 372319f7fb91bf250780af875b21fc571071301b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 15:44:39 +0200 Subject: [PATCH 04/28] fix no member access error in navigation files --- .../ModalStackNavigators/index.tsx | 403 +++++++++--------- .../Navigators/FullScreenNavigator.tsx | 31 +- src/types/utils/RequireReactComponent.ts | 3 + 3 files changed, 221 insertions(+), 216 deletions(-) create mode 100644 src/types/utils/RequireReactComponent.ts diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 3f246ac29971..2248c76aaafc 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -33,6 +33,7 @@ import type { import type {ThemeStyles} from '@styles/index'; import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; +import type RequireReactComponent from '@src/types/utils/RequireReactComponent'; import useModalScreenOptions from './useModalScreenOptions'; type Screens = Partial React.ComponentType>>; @@ -68,313 +69,313 @@ function createModalStackNavigator(screens: } const MoneyRequestModalStackNavigator = createModalStackNavigator({ - [SCREENS.MONEY_REQUEST.START]: () => (require('../../../../pages/iou/request/IOURequestRedirectToStartPage') as {default: React.ComponentType}).default, - [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, - [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, - [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default as React.ComponentType, + [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default, + [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default, + [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default, + [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default, + [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default, + [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default, + [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default, + [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default, + [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default, + [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default, + [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default, + [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default, + [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default, + [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default, + [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default, + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, }); const TravelModalStackNavigator = createModalStackNavigator({ - [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default as React.ComponentType, - [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default as React.ComponentType, + [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default, + [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default, }); const SplitDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default as React.ComponentType, + [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default, }); const DetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.DETAILS_ROOT]: () => require('../../../../pages/DetailsPage').default as React.ComponentType, + [SCREENS.DETAILS_ROOT]: () => require('../../../../pages/DetailsPage').default, }); const ProfileModalStackNavigator = createModalStackNavigator({ - [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default as React.ComponentType, + [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default, }); const ReportDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default as React.ComponentType, - [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default as React.ComponentType, + [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default, + [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default, }); const ReportSettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default as React.ComponentType, - [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default as React.ComponentType, + [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default, + [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default, + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default, + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default, + [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default, }); const TaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default as React.ComponentType, - [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default as React.ComponentType, + [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default, + [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, }); const ReportDescriptionModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default as React.ComponentType, + [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default, }); const CategoriesModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default as React.ComponentType, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default as React.ComponentType, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, }); const ReportParticipantsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default as React.ComponentType, - [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default as React.ComponentType, + [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default, + [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default, }); const RoomMembersModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default as React.ComponentType, + [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default, }); const RoomInviteModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default as React.ComponentType, + [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default, }); const NewChatModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default as React.ComponentType, - [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default as React.ComponentType, - [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default as React.ComponentType, + [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default, }); const NewTaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default as React.ComponentType, - [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default as React.ComponentType, - [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default as React.ComponentType, - [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default as React.ComponentType, - [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default as React.ComponentType, - [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default as React.ComponentType, + [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default, + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default, + [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default, + [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default, + [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default, }); const NewTeachersUniteNavigator = createModalStackNavigator({ - [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, - [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default as React.ComponentType, - [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default as React.ComponentType, - [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default as React.ComponentType, + [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default, + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, }); const SettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default as React.ComponentType, - [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default as React.ComponentType, - [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default as React.ComponentType, - [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, + [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default, + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default, + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default, + [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, + [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default, + [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default, + [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default, + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default, + [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default, + [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default, + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default, + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default, + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default, + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, // TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648 - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: () => require('../../../../pages/EnablePayments/PersonalInfo/PersonalInfo').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: () => require('../../../../pages/EnablePayments/PersonalInfo/PersonalInfo').default, // TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648 - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: () => require('../../../../pages/EnablePayments/FeesAndTerms/FeesAndTerms').default as React.ComponentType, - [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default as React.ComponentType, - [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, - [SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: () => require('../../../../pages/EnablePayments/AddBankAccount/AddBankAccount').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize/SubscriptionSizePage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default as React.ComponentType, - [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default as React.ComponentType, - [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default as React.ComponentType, - [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default as React.ComponentType, - [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default as React.ComponentType, - [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default as React.ComponentType, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: () => require('../../../../pages/EnablePayments/FeesAndTerms/FeesAndTerms').default, + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: () => require('../../../../pages/EnablePayments/AddBankAccount/AddBankAccount').default, + [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize/SubscriptionSizePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default, + [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default, + [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default, + [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default, + [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default, + [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default, + [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default, + [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, + [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default, + [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default, + [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default, + [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default, + [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default, + [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default, + [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default, + [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default, + [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_NON_REIMBURSABLE_DEFAULT_VENDOR_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default as React.ComponentType, + require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_COMPANY_CARD_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default as React.ComponentType, - [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, - [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default as React.ComponentType, - [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default as React.ComponentType, - [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default as React.ComponentType, - [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default as React.ComponentType, - [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default, + [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS]: () => - require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default as React.ComponentType, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_TRACKING_CATEGORIES]: () => - require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_MAP_TRACKING_CATEGORY]: () => - require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PURCHASE_BILL_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default as React.ComponentType, + require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default, + [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default, [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => - require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default as React.ComponentType, - [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, + require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default, + [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default, + [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default, + [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default, + [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default, + [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, }); const EnablePaymentsStackNavigator = createModalStackNavigator({ - [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default as React.ComponentType, + [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, }); const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default as React.ComponentType, + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, }); const ReimbursementAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default as React.ComponentType, + [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, }); const WalletStatementStackNavigator = createModalStackNavigator({ - [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default as React.ComponentType, + [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default, }); const FlagCommentStackNavigator = createModalStackNavigator({ - [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default as React.ComponentType, + [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default, }); const EditRequestStackNavigator = createModalStackNavigator({ - [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default as React.ComponentType, + [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default, }); const PrivateNotesModalStackNavigator = createModalStackNavigator({ - [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default as React.ComponentType, - [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default as React.ComponentType, + [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default, + [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default, }); const SignInModalStackNavigator = createModalStackNavigator({ - [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default as React.ComponentType, + [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default, }); const ReferralModalStackNavigator = createModalStackNavigator({ - [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default as React.ComponentType, + [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default, }); const ProcessMoneyRequestHoldStackNavigator = createModalStackNavigator({ - [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default as React.ComponentType, + [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default, }); const SearchReportModalStackNavigator = createModalStackNavigator({ - [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default as React.ComponentType, + [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default, }); export { diff --git a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx index 1745e350c62d..cf6dbdb717e0 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx @@ -7,28 +7,29 @@ import createCustomFullScreenNavigator from '@libs/Navigation/AppNavigator/creat import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import SCREENS from '@src/SCREENS'; +import type RequireReactComponent from '@src/types/utils/RequireReactComponent'; -const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default as React.ComponentType; +const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default; const RootStack = createCustomFullScreenNavigator(); type Screens = Partial React.ComponentType>>; const centralPaneWorkspaceScreens = { - [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default as React.ComponentType, - [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default as React.ComponentType, - [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default as React.ComponentType, - [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default as React.ComponentType, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default as React.ComponentType, - [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default as React.ComponentType, - [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default as React.ComponentType, - [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default as React.ComponentType, + [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, + [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default, + [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, + [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, + [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default, + [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, + [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default, + [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default, + [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default, + [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default, } satisfies Screens; function FullScreenNavigator() { diff --git a/src/types/utils/RequireReactComponent.ts b/src/types/utils/RequireReactComponent.ts new file mode 100644 index 000000000000..02b0198b66f4 --- /dev/null +++ b/src/types/utils/RequireReactComponent.ts @@ -0,0 +1,3 @@ +type RequireReactComponent = {default: React.ComponentType}; + +export default RequireReactComponent; From f4730ca1c9f169d5f6714819e9d04f4585ceba0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 16:33:25 +0200 Subject: [PATCH 05/28] fix no member access error in require usages --- .storybook/webpack.config.ts | 2 +- desktop/main.ts | 2 +- src/libs/E2E/reactNativeLaunchingTest.ts | 14 +- src/libs/EmojiUtils.ts | 5 +- .../Navigation/AppNavigator/AuthScreens.tsx | 19 +- .../ModalStackNavigators/index.tsx | 408 +++++++++--------- .../Navigators/BottomTabNavigator.tsx | 4 +- .../BaseCentralPaneNavigator.tsx | 19 +- .../Navigators/FullScreenNavigator.tsx | 32 +- .../Navigators/LeftModalNavigator.tsx | 5 +- .../Navigation/AppNavigator/index.native.tsx | 5 +- src/types/utils/ReactComponentModule.ts | 3 + src/types/utils/RequireReactComponent.ts | 3 - 13 files changed, 263 insertions(+), 258 deletions(-) create mode 100644 src/types/utils/ReactComponentModule.ts delete mode 100644 src/types/utils/RequireReactComponent.ts diff --git a/.storybook/webpack.config.ts b/.storybook/webpack.config.ts index 09d881846b1e..0fc3005a3fd7 100644 --- a/.storybook/webpack.config.ts +++ b/.storybook/webpack.config.ts @@ -34,7 +34,7 @@ switch (process.env.ENV) { } const env = dotenv.config({path: path.resolve(__dirname, `../${envFile}`)}); -const customFunction: CustomWebpackFunction = require('../config/webpack/webpack.common').default; +const customFunction = require<{default: CustomWebpackFunction}>('../config/webpack/webpack.common').default; const custom: CustomWebpackConfig = customFunction({file: envFile}); diff --git a/desktop/main.ts b/desktop/main.ts index 2b3a6b642dd6..1190abaa2a1d 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -21,7 +21,7 @@ type CreateDownloadQueue = () => { dequeueDownloadItem: () => DownloadItem | undefined; }; -const createDownloadQueue = (require('./createDownloadQueue') as {default: CreateDownloadQueue}).default; +const createDownloadQueue = require<{default: CreateDownloadQueue}>('./createDownloadQueue').default; const port = process.env.PORT ?? 8082; const {DESKTOP_SHORTCUT_ACCELERATOR, LOCALES} = CONST; diff --git a/src/libs/E2E/reactNativeLaunchingTest.ts b/src/libs/E2E/reactNativeLaunchingTest.ts index f23508987268..b022d8da6dc3 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.ts +++ b/src/libs/E2E/reactNativeLaunchingTest.ts @@ -15,7 +15,9 @@ import installNetworkInterceptor from './utils/NetworkInterceptor'; import LaunchArgs from './utils/LaunchArgs'; import type { TestConfig } from './types'; -type Tests = Record, (config: TestConfig) => void>; +type Test = (config: TestConfig) => void; +type TestModule = { default: Test} +type Tests = Record, Test>; console.debug('=========================='); console.debug('==== Running e2e test ===='); @@ -34,11 +36,11 @@ if (!appInstanceId) { // import your test here, define its name and config first in e2e/config.js const tests: Tests = { - [E2EConfig.TEST_NAMES.AppStartTime]: require('./tests/appStartTimeTest.e2e').default, - [E2EConfig.TEST_NAMES.OpenChatFinderPage]: require('./tests/openChatFinderPageTest.e2e').default, - [E2EConfig.TEST_NAMES.ChatOpening]: require('./tests/chatOpeningTest.e2e').default, - [E2EConfig.TEST_NAMES.ReportTyping]: require('./tests/reportTypingTest.e2e').default, - [E2EConfig.TEST_NAMES.Linking]: require('./tests/linkingTest.e2e').default, + [E2EConfig.TEST_NAMES.AppStartTime]: require('./tests/appStartTimeTest.e2e').default, + [E2EConfig.TEST_NAMES.OpenChatFinderPage]: require('./tests/openChatFinderPageTest.e2e').default, + [E2EConfig.TEST_NAMES.ChatOpening]: require('./tests/chatOpeningTest.e2e').default, + [E2EConfig.TEST_NAMES.ReportTyping]: require('./tests/reportTypingTest.e2e').default, + [E2EConfig.TEST_NAMES.Linking]: require('./tests/linkingTest.e2e').default, }; // Once we receive the TII measurement we know that the app is initialized and ready to be used: diff --git a/src/libs/EmojiUtils.ts b/src/libs/EmojiUtils.ts index 8755e5c749fb..2f8d65133bae 100644 --- a/src/libs/EmojiUtils.ts +++ b/src/libs/EmojiUtils.ts @@ -18,6 +18,7 @@ type EmojiSpacer = {code: string; spacer: boolean}; type EmojiPickerListItem = EmojiSpacer | Emoji | HeaderEmoji; type EmojiPickerList = EmojiPickerListItem[]; type ReplacedEmoji = {text: string; emojis: Emoji[]; cursorPosition?: number}; +type EmojiTrieModule = {default: typeof EmojiTrie}; let frequentlyUsedEmojis: FrequentlyUsedEmoji[] = []; Onyx.connect({ @@ -314,7 +315,7 @@ function getAddedEmojis(currentEmojis: Emoji[], formerEmojis: Emoji[]): Emoji[] */ function replaceEmojis(text: string, preferredSkinTone: OnyxEntry = CONST.EMOJI_DEFAULT_SKIN_TONE, lang: Locale = CONST.LOCALES.DEFAULT): ReplacedEmoji { // emojisTrie is importing the emoji JSON file on the app starting and we want to avoid it - const emojisTrie: typeof EmojiTrie = (require('./EmojiTrie') as {default: typeof EmojiTrie}).default; + const emojisTrie = require('./EmojiTrie').default; const trie = emojisTrie[lang as SupportedLanguage]; if (!trie) { @@ -392,7 +393,7 @@ function replaceAndExtractEmojis(text: string, preferredSkinTone: OnyxEntry('./EmojiTrie').default; const trie = emojisTrie[lang as SupportedLanguage]; if (!trie) { diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index a160b6765f87..8aba229f63cc 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -40,6 +40,7 @@ import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import type * as OnyxTypes from '@src/types/onyx'; import type {SelectedTimezone, Timezone} from '@src/types/onyx/PersonalDetails'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import createCustomStackNavigator from './createCustomStackNavigator'; import defaultScreenOptions from './defaultScreenOptions'; import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions'; @@ -63,15 +64,15 @@ type AuthScreensProps = { initialLastUpdateIDAppliedToClient: OnyxEntry; }; -const loadReportAttachments = () => require('../../../pages/home/report/ReportAttachments').default as React.ComponentType; -const loadValidateLoginPage = () => require('../../../pages/ValidateLoginPage').default as React.ComponentType; -const loadLogOutPreviousUserPage = () => require('../../../pages/LogOutPreviousUserPage').default as React.ComponentType; -const loadConciergePage = () => require('../../../pages/ConciergePage').default as React.ComponentType; -const loadProfileAvatar = () => require('../../../pages/settings/Profile/ProfileAvatar').default as React.ComponentType; -const loadWorkspaceAvatar = () => require('../../../pages/workspace/WorkspaceAvatar').default as React.ComponentType; -const loadReportAvatar = () => require('../../../pages/ReportAvatar').default as React.ComponentType; -const loadReceiptView = () => require('../../../pages/TransactionReceiptPage').default as React.ComponentType; -const loadWorkspaceJoinUser = () => require('@pages/workspace/WorkspaceJoinUserPage').default as React.ComponentType; +const loadReportAttachments = () => require('../../../pages/home/report/ReportAttachments').default; +const loadValidateLoginPage = () => require('../../../pages/ValidateLoginPage').default; +const loadLogOutPreviousUserPage = () => require('../../../pages/LogOutPreviousUserPage').default; +const loadConciergePage = () => require('../../../pages/ConciergePage').default; +const loadProfileAvatar = () => require('../../../pages/settings/Profile/ProfileAvatar').default; +const loadWorkspaceAvatar = () => require('../../../pages/workspace/WorkspaceAvatar').default; +const loadReportAvatar = () => require('../../../pages/ReportAvatar').default; +const loadReceiptView = () => require('../../../pages/TransactionReceiptPage').default; +const loadWorkspaceJoinUser = () => require('@pages/workspace/WorkspaceJoinUserPage').default; let timezone: Timezone | null; let currentAccountID = -1; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 2248c76aaafc..2353f56e38f6 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -33,7 +33,7 @@ import type { import type {ThemeStyles} from '@styles/index'; import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; -import type RequireReactComponent from '@src/types/utils/RequireReactComponent'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import useModalScreenOptions from './useModalScreenOptions'; type Screens = Partial React.ComponentType>>; @@ -69,313 +69,311 @@ function createModalStackNavigator(screens: } const MoneyRequestModalStackNavigator = createModalStackNavigator({ - [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default, - [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default, - [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default, - [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default, - [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default, - [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default, - [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default, - [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default, - [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default, - [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default, - [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default, - [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default, - [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, - [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default, - [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default, - [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default, - [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default, - [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default, - [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default, - [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, - [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, - [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, - [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, + [SCREENS.MONEY_REQUEST.START]: () => require('../../../../pages/iou/request/IOURequestRedirectToStartPage').default, + [SCREENS.MONEY_REQUEST.CREATE]: () => require('../../../../pages/iou/request/IOURequestStartPage').default, + [SCREENS.MONEY_REQUEST.STEP_CONFIRMATION]: () => require('../../../../pages/iou/request/step/IOURequestStepConfirmation').default, + [SCREENS.MONEY_REQUEST.STEP_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepAmount').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_AMOUNT]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxAmountPage').default, + [SCREENS.MONEY_REQUEST.STEP_TAX_RATE]: () => require('../../../../pages/iou/request/step/IOURequestStepTaxRatePage').default, + [SCREENS.MONEY_REQUEST.STEP_CATEGORY]: () => require('../../../../pages/iou/request/step/IOURequestStepCategory').default, + [SCREENS.MONEY_REQUEST.STEP_CURRENCY]: () => require('../../../../pages/iou/request/step/IOURequestStepCurrency').default, + [SCREENS.MONEY_REQUEST.STEP_DATE]: () => require('../../../../pages/iou/request/step/IOURequestStepDate').default, + [SCREENS.MONEY_REQUEST.STEP_DESCRIPTION]: () => require('../../../../pages/iou/request/step/IOURequestStepDescription').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE]: () => require('../../../../pages/iou/request/step/IOURequestStepDistance').default, + [SCREENS.MONEY_REQUEST.STEP_DISTANCE_RATE]: () => require('@pages/iou/request/step/IOURequestStepDistanceRate').default, + [SCREENS.MONEY_REQUEST.STEP_MERCHANT]: () => require('../../../../pages/iou/request/step/IOURequestStepMerchant').default, + [SCREENS.MONEY_REQUEST.STEP_PARTICIPANTS]: () => require('../../../../pages/iou/request/step/IOURequestStepParticipants').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_ROOT]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.MONEY_REQUEST.STEP_SCAN]: () => require('../../../../pages/iou/request/step/IOURequestStepScan').default, + [SCREENS.MONEY_REQUEST.STEP_TAG]: () => require('../../../../pages/iou/request/step/IOURequestStepTag').default, + [SCREENS.MONEY_REQUEST.STEP_WAYPOINT]: () => require('../../../../pages/iou/request/step/IOURequestStepWaypoint').default, + [SCREENS.MONEY_REQUEST.STEP_SPLIT_PAYER]: () => require('../../../../pages/iou/request/step/IOURequestStepSplitPayer').default, + [SCREENS.MONEY_REQUEST.STEP_SEND_FROM]: () => require('../../../../pages/iou/request/step/IOURequestStepSendFrom').default, + [SCREENS.MONEY_REQUEST.HOLD]: () => require('../../../../pages/iou/HoldReasonPage').default, + [SCREENS.IOU_SEND.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.IOU_SEND.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.IOU_SEND.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.MONEY_REQUEST.STATE_SELECTOR]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, }); const TravelModalStackNavigator = createModalStackNavigator({ - [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default, - [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default, + [SCREENS.TRAVEL.MY_TRIPS]: () => require('../../../../pages/Travel/MyTripsPage').default, + [SCREENS.TRAVEL.TCS]: () => require('../../../../pages/Travel/TravelTerms').default, }); const SplitDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default, + [SCREENS.SPLIT_DETAILS.ROOT]: () => require('../../../../pages/iou/SplitBillDetailsPage').default, }); const DetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.DETAILS_ROOT]: () => require('../../../../pages/DetailsPage').default, + [SCREENS.DETAILS_ROOT]: () => require('../../../../pages/DetailsPage').default, }); const ProfileModalStackNavigator = createModalStackNavigator({ - [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default, + [SCREENS.PROFILE_ROOT]: () => require('../../../../pages/ProfilePage').default, }); const ReportDetailsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default, - [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default, + [SCREENS.REPORT_DETAILS.ROOT]: () => require('../../../../pages/ReportDetailsPage').default, + [SCREENS.REPORT_DETAILS.SHARE_CODE]: () => require('../../../../pages/home/report/ReportDetailsShareCodePage').default, }); const ReportSettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default, - [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default, - [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default, - [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default, - [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default, + [SCREENS.REPORT_SETTINGS.ROOT]: () => require('../../../../pages/settings/Report/ReportSettingsPage').default, + [SCREENS.REPORT_SETTINGS.NAME]: () => require('../../../../pages/settings/Report/NamePage').default, + [SCREENS.REPORT_SETTINGS.NOTIFICATION_PREFERENCES]: () => require('../../../../pages/settings/Report/NotificationPreferencePage').default, + [SCREENS.REPORT_SETTINGS.WRITE_CAPABILITY]: () => require('../../../../pages/settings/Report/WriteCapabilityPage').default, + [SCREENS.REPORT_SETTINGS.VISIBILITY]: () => require('../../../../pages/settings/Report/VisibilityPage').default, }); const TaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default, - [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.TASK.TITLE]: () => require('../../../../pages/tasks/TaskTitlePage').default, + [SCREENS.TASK.ASSIGNEE]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, }); const ReportDescriptionModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default, + [SCREENS.REPORT_DESCRIPTION_ROOT]: () => require('../../../../pages/ReportDescriptionPage').default, }); const CategoriesModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, - [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.SETTINGS_CATEGORIES.SETTINGS_CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, }); const ReportParticipantsModalStackNavigator = createModalStackNavigator({ - [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default, - [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default, - [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default, - [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default, + [SCREENS.REPORT_PARTICIPANTS.ROOT]: () => require('../../../../pages/ReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.INVITE]: () => require('../../../../pages/InviteReportParticipantsPage').default, + [SCREENS.REPORT_PARTICIPANTS.DETAILS]: () => require('../../../../pages/ReportParticipantDetailsPage').default, + [SCREENS.REPORT_PARTICIPANTS.ROLE]: () => require('../../../../pages/ReportParticipantRoleSelectionPage').default, }); const RoomMembersModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default, + [SCREENS.ROOM_MEMBERS_ROOT]: () => require('../../../../pages/RoomMembersPage').default, }); const RoomInviteModalStackNavigator = createModalStackNavigator({ - [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default, + [SCREENS.ROOM_INVITE_ROOT]: () => require('../../../../pages/RoomInvitePage').default, }); const NewChatModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default, - [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default, - [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default, + [SCREENS.NEW_CHAT.ROOT]: () => require('../../../../pages/NewChatSelectorPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_CONFIRM]: () => require('../../../../pages/NewChatConfirmPage').default, + [SCREENS.NEW_CHAT.NEW_CHAT_EDIT_NAME]: () => require('../../../../pages/GroupChatNameEditPage').default, }); const NewTaskModalStackNavigator = createModalStackNavigator({ - [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default, - [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, - [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default, - [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default, - [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default, - [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default, + [SCREENS.NEW_TASK.ROOT]: () => require('../../../../pages/tasks/NewTaskPage').default, + [SCREENS.NEW_TASK.TASK_ASSIGNEE_SELECTOR]: () => require('../../../../pages/tasks/TaskAssigneeSelectorModal').default, + [SCREENS.NEW_TASK.TASK_SHARE_DESTINATION_SELECTOR]: () => require('../../../../pages/tasks/TaskShareDestinationSelectorModal').default, + [SCREENS.NEW_TASK.DETAILS]: () => require('../../../../pages/tasks/NewTaskDetailsPage').default, + [SCREENS.NEW_TASK.TITLE]: () => require('../../../../pages/tasks/NewTaskTitlePage').default, + [SCREENS.NEW_TASK.DESCRIPTION]: () => require('../../../../pages/tasks/NewTaskDescriptionPage').default, }); const NewTeachersUniteNavigator = createModalStackNavigator({ - [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, - [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default, - [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, - [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.SAVE_THE_WORLD.ROOT]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.I_KNOW_A_TEACHER]: () => require('../../../../pages/TeachersUnite/KnowATeacherPage').default, + [SCREENS.INTRO_SCHOOL_PRINCIPAL]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, + [SCREENS.I_AM_A_TEACHER]: () => require('../../../../pages/TeachersUnite/ImTeacherPage').default, }); const SettingsModalStackNavigator = createModalStackNavigator({ - [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default, - [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default, - [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default, - [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default, - [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default, - [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, - [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, - [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, - [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, - [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, - [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, - [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, - [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, - [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default, - [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default, - [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default, - [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default, - [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default, - [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default, - [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, - [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default, - [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, - [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default, - [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default, - [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default, - [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default, - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.SETTINGS.SHARE_CODE]: () => require('../../../../pages/ShareCodePage').default, + [SCREENS.SETTINGS.PROFILE.PRONOUNS]: () => require('../../../../pages/settings/Profile/PronounsPage').default, + [SCREENS.SETTINGS.PROFILE.DISPLAY_NAME]: () => require('../../../../pages/settings/Profile/DisplayNamePage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE]: () => require('../../../../pages/settings/Profile/TimezoneInitialPage').default, + [SCREENS.SETTINGS.PROFILE.TIMEZONE_SELECT]: () => require('../../../../pages/settings/Profile/TimezoneSelectPage').default, + [SCREENS.SETTINGS.PROFILE.LEGAL_NAME]: () => require('../../../../pages/settings/Profile/PersonalDetails/LegalNamePage').default, + [SCREENS.SETTINGS.PROFILE.DATE_OF_BIRTH]: () => require('../../../../pages/settings/Profile/PersonalDetails/DateOfBirthPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_COUNTRY]: () => require('../../../../pages/settings/Profile/PersonalDetails/CountrySelectionPage').default, + [SCREENS.SETTINGS.PROFILE.ADDRESS_STATE]: () => require('../../../../pages/settings/Profile/PersonalDetails/StateSelectionPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHODS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodsPage').default, + [SCREENS.SETTINGS.PROFILE.CONTACT_METHOD_DETAILS]: () => require('../../../../pages/settings/Profile/Contacts/ContactMethodDetailsPage').default, + [SCREENS.SETTINGS.PROFILE.NEW_CONTACT_METHOD]: () => require('../../../../pages/settings/Profile/Contacts/NewContactMethodPage').default, + [SCREENS.SETTINGS.PREFERENCES.PRIORITY_MODE]: () => require('../../../../pages/settings/Preferences/PriorityModePage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.SETTINGS.PREFERENCES.LANGUAGE]: () => require('../../../../pages/settings/Preferences/LanguagePage').default, + [SCREENS.SETTINGS.PREFERENCES.THEME]: () => require('../../../../pages/settings/Preferences/ThemePage').default, + [SCREENS.SETTINGS.CLOSE]: () => require('../../../../pages/settings/Security/CloseAccountPage').default, + [SCREENS.SETTINGS.APP_DOWNLOAD_LINKS]: () => require('../../../../pages/settings/AppDownloadLinks').default, + [SCREENS.SETTINGS.CONSOLE]: () => require('../../../../pages/settings/AboutPage/ConsolePage').default, + [SCREENS.SETTINGS.SHARE_LOG]: () => require('../../../../pages/settings/AboutPage/ShareLogPage').default, + [SCREENS.SETTINGS.WALLET.CARDS_DIGITAL_DETAILS_UPDATE_ADDRESS]: () => require('../../../../pages/settings/Profile/PersonalDetails/AddressPage').default, + [SCREENS.SETTINGS.WALLET.DOMAIN_CARD]: () => require('../../../../pages/settings/Wallet/ExpensifyCardPage').default, + [SCREENS.SETTINGS.WALLET.REPORT_VIRTUAL_CARD_FRAUD]: () => require('../../../../pages/settings/Wallet/ReportVirtualCardFraudPage').default, + [SCREENS.SETTINGS.WALLET.CARD_ACTIVATE]: () => require('../../../../pages/settings/Wallet/ActivatePhysicalCardPage').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.NAME]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardName').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.PHONE]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardPhone').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.ADDRESS]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardAddress').default, + [SCREENS.SETTINGS.WALLET.CARD_GET_PHYSICAL.CONFIRM]: () => require('../../../../pages/settings/Wallet/Card/GetPhysicalCardConfirm').default, + [SCREENS.SETTINGS.WALLET.TRANSFER_BALANCE]: () => require('../../../../pages/settings/Wallet/TransferBalancePage').default, + [SCREENS.SETTINGS.WALLET.CHOOSE_TRANSFER_ACCOUNT]: () => require('../../../../pages/settings/Wallet/ChooseTransferAccountPage').default, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, // TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648 - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: () => require('../../../../pages/EnablePayments/PersonalInfo/PersonalInfo').default, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_REFACTOR]: () => require('../../../../pages/EnablePayments/PersonalInfo/PersonalInfo').default, // TODO: Added temporarily for testing purposes, remove after refactor - https://github.com/Expensify/App/issues/36648 - [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: () => require('../../../../pages/EnablePayments/FeesAndTerms/FeesAndTerms').default, - [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, - [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, - [SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: () => require('../../../../pages/EnablePayments/AddBankAccount/AddBankAccount').default, - [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default, - [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default, - [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize/SubscriptionSizePage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default, - [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default, - [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default, - [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default, - [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default, - [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default, - [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default, - [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default, - [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default, - [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default, - [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, - [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default, - [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, - [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default, - [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default, - [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default, - [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default, - [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, - [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, - [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default, - [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default, - [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default, - [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default, - [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default, - [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default, - [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default, - [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default, - [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default, - [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default, - [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default, - [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default, - [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default, - [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default, + [SCREENS.SETTINGS.WALLET.ENABLE_PAYMENTS_TEMPORARY_TERMS]: () => require('../../../../pages/EnablePayments/FeesAndTerms/FeesAndTerms').default, + [SCREENS.SETTINGS.ADD_DEBIT_CARD]: () => require('../../../../pages/settings/Wallet/AddDebitCardPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.SETTINGS.ADD_BANK_ACCOUNT_REFACTOR]: () => require('../../../../pages/EnablePayments/AddBankAccount/AddBankAccount').default, + [SCREENS.SETTINGS.PROFILE.STATUS]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER]: () => require('../../../../pages/settings/Profile/CustomStatus/StatusClearAfterPage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_DATE]: () => require('../../../../pages/settings/Profile/CustomStatus/SetDatePage').default, + [SCREENS.SETTINGS.PROFILE.STATUS_CLEAR_AFTER_TIME]: () => require('../../../../pages/settings/Profile/CustomStatus/SetTimePage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.SIZE]: () => require('../../../../pages/settings/Subscription/SubscriptionSize/SubscriptionSizePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/InitialPage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_RATE]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/RatePage').default, + [SCREENS.WORKSPACE.RATE_AND_UNIT_UNIT]: () => require('../../../../pages/workspace/reimburse/WorkspaceRateAndUnitPage/UnitPage').default, + [SCREENS.WORKSPACE.INVITE]: () => require('../../../../pages/workspace/WorkspaceInvitePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_APPROVER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsApproverPage').default, + [SCREENS.WORKSPACE.INVITE_MESSAGE]: () => require('../../../../pages/workspace/WorkspaceInviteMessagePage').default, + [SCREENS.WORKSPACE.WORKFLOWS_PAYER]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPayerPage').default, + [SCREENS.WORKSPACE.NAME]: () => require('../../../../pages/workspace/WorkspaceNamePage').default, + [SCREENS.WORKSPACE.DESCRIPTION]: () => require('../../../../pages/workspace/WorkspaceProfileDescriptionPage').default, + [SCREENS.WORKSPACE.SHARE]: () => require('../../../../pages/workspace/WorkspaceProfileSharePage').default, + [SCREENS.WORKSPACE.CURRENCY]: () => require('../../../../pages/workspace/WorkspaceProfileCurrencyPage').default, + [SCREENS.WORKSPACE.CATEGORY_SETTINGS]: () => require('../../../../pages/workspace/categories/CategorySettingsPage').default, + [SCREENS.WORKSPACE.ADDRESS]: () => require('../../../../pages/workspace/WorkspaceProfileAddressPage').default, + [SCREENS.WORKSPACE.CATEGORIES_SETTINGS]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesSettingsPage').default, + [SCREENS.WORKSPACE.MEMBER_DETAILS]: () => require('../../../../pages/workspace/members/WorkspaceMemberDetailsPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_CHECK]: () => require('@pages/workspace/members/WorkspaceOwnerChangeWrapperPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_SUCCESS]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeSuccessPage').default, + [SCREENS.WORKSPACE.OWNER_CHANGE_ERROR]: () => require('../../../../pages/workspace/members/WorkspaceOwnerChangeErrorPage').default, + [SCREENS.WORKSPACE.CATEGORY_CREATE]: () => require('../../../../pages/workspace/categories/CreateCategoryPage').default, + [SCREENS.WORKSPACE.CATEGORY_EDIT]: () => require('../../../../pages/workspace/categories/EditCategoryPage').default, + [SCREENS.WORKSPACE.CREATE_DISTANCE_RATE]: () => require('../../../../pages/workspace/distanceRates/CreateDistanceRatePage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES_SETTINGS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesSettingsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_DETAILS]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateDetailsPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATE_EDIT]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRateEditPage').default, + [SCREENS.WORKSPACE.TAGS_SETTINGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsSettingsPage').default, + [SCREENS.WORKSPACE.TAG_SETTINGS]: () => require('../../../../pages/workspace/tags/TagSettingsPage').default, + [SCREENS.WORKSPACE.TAG_LIST_VIEW]: () => require('../../../../pages/workspace/tags/WorkspaceViewTagsPage').default, + [SCREENS.WORKSPACE.TAGS_EDIT]: () => require('../../../../pages/workspace/tags/WorkspaceEditTagsPage').default, + [SCREENS.WORKSPACE.TAG_CREATE]: () => require('../../../../pages/workspace/tags/WorkspaceCreateTagPage').default, + [SCREENS.WORKSPACE.TAG_EDIT]: () => require('../../../../pages/workspace/tags/EditTagPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsPage').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_CUSTOM_TAX_NAME]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_FOREIGN_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsForeignCurrency').default, + [SCREENS.WORKSPACE.TAXES_SETTINGS_WORKSPACE_CURRENCY_DEFAULT]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesSettingsWorkspaceCurrency').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_INVOICE_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksExportInvoiceAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseEntitySelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_NON_REIMBURSABLE_DEFAULT_VENDOR_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableDefaultVendorSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_SELECT]: () => - require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default, + require('@pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT_COMPANY_CARD_SELECT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountSelectCardPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_COMPANY_CARD_EXPENSE_ACCOUNT]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksCompanyCardExpenseAccountPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_EXPORT_PREFERRED_EXPORTER]: () => - require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, - [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, - [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, - [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, - [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default, - [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default, - [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default, - [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default, - [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default, + require('../../../../pages/workspace/accounting/qbo/export/QuickbooksPreferredExporterConfigurationPage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').default, + [SCREENS.SETTINGS.TWO_FACTOR_AUTH]: () => require('../../../../pages/settings/Security/TwoFactorAuth/TwoFactorAuthPage').default, + [SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require('../../../../pages/settings/Wallet/ReportCardLostPage').default, + [SCREENS.KEYBOARD_SHORTCUTS]: () => require('../../../../pages/KeyboardShortcutsPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.RESPONSE]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyResponsePage').default, + [SCREENS.SETTINGS.EXIT_SURVEY.CONFIRM]: () => require('../../../../pages/settings/ExitSurvey/ExitSurveyConfirmPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_IMPORT]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksImportPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CHART_OF_ACCOUNTS]: () => - require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default, + require('../../../../pages/workspace/accounting/qbo/import/QuickbooksChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CUSTOMERS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksCustomersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_TAXES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksTaxesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_LOCATIONS]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksLocationsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_CLASSES]: () => require('../../../../pages/workspace/accounting/qbo/import/QuickbooksClassesPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ADVANCED]: () => require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksAccountSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_ONLINE_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default, - - [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_TRACKING_CATEGORIES]: () => - require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default, + require('../../../../pages/workspace/accounting/qbo/advanced/QuickbooksInvoiceAccountSelectPage').default, + + [SCREENS.WORKSPACE.ACCOUNTING.XERO_IMPORT]: () => require('../../../../pages/workspace/accounting/xero/XeroImportPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ORGANIZATION]: () => require('../../../../pages/workspace/accounting/xero/XeroOrganizationConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CHART_OF_ACCOUNTS]: () => require('../../../../pages/workspace/accounting/xero/import/XeroChartOfAccountsPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_CUSTOMER]: () => require('../../../../pages/workspace/accounting/xero/import/XeroCustomerConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TAXES]: () => require('../../../../pages/workspace/accounting/xero/XeroTaxesConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_TRACKING_CATEGORIES]: () => require('../../../../pages/workspace/accounting/xero/XeroTrackingCategoryConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_MAP_TRACKING_CATEGORY]: () => - require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default, + require('../../../../pages/workspace/accounting/xero/XeroMapTrackingCategoryConfigurationPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT]: () => require('../../../../pages/workspace/accounting/xero/export/XeroExportConfigurationPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PURCHASE_BILL_DATE_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillDateSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_BANK_ACCOUNT_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default, + require('../../../../pages/workspace/accounting/xero/export/XeroBankAccountSelectPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.XERO_ADVANCED]: () => require('../../../../pages/workspace/accounting/xero/advanced/XeroAdvancedPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_STATUS_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default, + require('../../../../pages/workspace/accounting/xero/export/XeroPurchaseBillStatusSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_INVOICE_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default, + require('../../../../pages/workspace/accounting/xero/advanced/XeroInvoiceAccountSelectorPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_EXPORT_PREFERRED_EXPORTER_SELECT]: () => - require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default, + require('../../../../pages/workspace/accounting/xero/export/XeroPreferredExporterSelectPage').default, [SCREENS.WORKSPACE.ACCOUNTING.XERO_BILL_PAYMENT_ACCOUNT_SELECTOR]: () => - require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default, - [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default, - [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => - require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default, - [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default, - [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default, - [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default, - [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default, - [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, + require('../../../../pages/workspace/accounting/xero/advanced/XeroBillPaymentAccountSelectorPage').default, + [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_FREQUENCY]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingFrequencyPage').default, + [SCREENS.WORKSPACE.WORKFLOWS_AUTO_REPORTING_MONTHLY_OFFSET]: () => require('../../../../pages/workspace/workflows/WorkspaceAutoReportingMonthlyOffsetPage').default, + [SCREENS.WORKSPACE.TAX_EDIT]: () => require('../../../../pages/workspace/taxes/WorkspaceEditTaxPage').default, + [SCREENS.WORKSPACE.TAX_NAME]: () => require('../../../../pages/workspace/taxes/NamePage').default, + [SCREENS.WORKSPACE.TAX_VALUE]: () => require('../../../../pages/workspace/taxes/ValuePage').default, + [SCREENS.WORKSPACE.TAX_CREATE]: () => require('../../../../pages/workspace/taxes/WorkspaceCreateTaxPage').default, + [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../pages/TeachersUnite/SaveTheWorldPage').default, }); const EnablePaymentsStackNavigator = createModalStackNavigator({ - [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, + [SCREENS.ENABLE_PAYMENTS_ROOT]: () => require('../../../../pages/EnablePayments/EnablePaymentsPage').default, }); const AddPersonalBankAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, + [SCREENS.ADD_PERSONAL_BANK_ACCOUNT_ROOT]: () => require('../../../../pages/AddPersonalBankAccountPage').default, }); const ReimbursementAccountModalStackNavigator = createModalStackNavigator({ - [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, + [SCREENS.REIMBURSEMENT_ACCOUNT_ROOT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, }); const WalletStatementStackNavigator = createModalStackNavigator({ - [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default, + [SCREENS.WALLET_STATEMENT_ROOT]: () => require('../../../../pages/wallet/WalletStatementPage').default, }); const FlagCommentStackNavigator = createModalStackNavigator({ - [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default, + [SCREENS.FLAG_COMMENT_ROOT]: () => require('../../../../pages/FlagCommentPage').default, }); const EditRequestStackNavigator = createModalStackNavigator({ - [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default, + [SCREENS.EDIT_REQUEST.REPORT_FIELD]: () => require('../../../../pages/EditReportFieldPage').default, }); const PrivateNotesModalStackNavigator = createModalStackNavigator({ - [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default, - [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default, + [SCREENS.PRIVATE_NOTES.LIST]: () => require('../../../../pages/PrivateNotes/PrivateNotesListPage').default, + [SCREENS.PRIVATE_NOTES.EDIT]: () => require('../../../../pages/PrivateNotes/PrivateNotesEditPage').default, }); const SignInModalStackNavigator = createModalStackNavigator({ - [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default, + [SCREENS.SIGN_IN_ROOT]: () => require('../../../../pages/signin/SignInModal').default, }); const ReferralModalStackNavigator = createModalStackNavigator({ - [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default, + [SCREENS.REFERRAL_DETAILS]: () => require('../../../../pages/ReferralDetailsPage').default, }); const ProcessMoneyRequestHoldStackNavigator = createModalStackNavigator({ - [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default, + [SCREENS.PROCESS_MONEY_REQUEST_HOLD_ROOT]: () => require('../../../../pages/ProcessMoneyRequestHoldPage').default, }); const SearchReportModalStackNavigator = createModalStackNavigator({ - [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default, + [SCREENS.SEARCH.REPORT_RHP]: () => require('../../../../pages/home/ReportScreen').default, }); export { diff --git a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx index 6e1d154ff350..46212f3bc41f 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/BottomTabNavigator.tsx @@ -7,10 +7,10 @@ import type {BottomTabNavigatorParamList, CentralPaneName, NavigationPartialRout import SidebarScreen from '@pages/home/sidebar/SidebarScreen'; import SearchPageBottomTab from '@pages/Search/SearchPageBottomTab'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import ActiveRouteContext from './ActiveRouteContext'; -const loadInitialSettingsPage = () => require('../../../../pages/settings/InitialSettingsPage').default as React.ComponentType; - +const loadInitialSettingsPage = () => require('../../../../pages/settings/InitialSettingsPage').default; const Tab = createCustomBottomTabNavigator(); const screenOptions: StackNavigationOptions = { diff --git a/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx index 22e6c6807ee8..68dc193c3618 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator/BaseCentralPaneNavigator.tsx @@ -7,6 +7,7 @@ import type {CentralPaneNavigatorParamList} from '@navigation/types'; import SearchPage from '@pages/Search/SearchPage'; import CONST from '@src/CONST'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; const Stack = createStackNavigator(); @@ -16,15 +17,15 @@ const openOnAdminRoom = url ? new URL(url).searchParams.get('openOnAdminRoom') : type Screens = Partial React.ComponentType>>; const settingsScreens = { - [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../../../pages/workspace/WorkspacesListPage').default as React.ComponentType, - [SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../../../pages/settings/Preferences/PreferencesPage').default as React.ComponentType, - [SCREENS.SETTINGS.SECURITY]: () => require('../../../../../pages/settings/Security/SecuritySettingsPage').default as React.ComponentType, - [SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../../../pages/settings/Profile/ProfilePage').default as React.ComponentType, - [SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../../../pages/settings/Wallet/WalletPage').default as React.ComponentType, - [SCREENS.SETTINGS.ABOUT]: () => require('../../../../../pages/settings/AboutPage/AboutPage').default as React.ComponentType, - [SCREENS.SETTINGS.TROUBLESHOOT]: () => require('../../../../../pages/settings/Troubleshoot/TroubleshootPage').default as React.ComponentType, - [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../../pages/TeachersUnite/SaveTheWorldPage').default as React.ComponentType, - [SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: () => require('../../../../../pages/settings/Subscription/SubscriptionSettingsPage').default as React.ComponentType, + [SCREENS.SETTINGS.WORKSPACES]: () => require('../../../../../pages/workspace/WorkspacesListPage').default, + [SCREENS.SETTINGS.PREFERENCES.ROOT]: () => require('../../../../../pages/settings/Preferences/PreferencesPage').default, + [SCREENS.SETTINGS.SECURITY]: () => require('../../../../../pages/settings/Security/SecuritySettingsPage').default, + [SCREENS.SETTINGS.PROFILE.ROOT]: () => require('../../../../../pages/settings/Profile/ProfilePage').default, + [SCREENS.SETTINGS.WALLET.ROOT]: () => require('../../../../../pages/settings/Wallet/WalletPage').default, + [SCREENS.SETTINGS.ABOUT]: () => require('../../../../../pages/settings/AboutPage/AboutPage').default, + [SCREENS.SETTINGS.TROUBLESHOOT]: () => require('../../../../../pages/settings/Troubleshoot/TroubleshootPage').default, + [SCREENS.SETTINGS.SAVE_THE_WORLD]: () => require('../../../../../pages/TeachersUnite/SaveTheWorldPage').default, + [SCREENS.SETTINGS.SUBSCRIPTION.ROOT]: () => require('../../../../../pages/settings/Subscription/SubscriptionSettingsPage').default, } satisfies Screens; function BaseCentralPaneNavigator() { diff --git a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx index cf6dbdb717e0..dbfd6e8dddc2 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/FullScreenNavigator.tsx @@ -7,29 +7,29 @@ import createCustomFullScreenNavigator from '@libs/Navigation/AppNavigator/creat import getRootNavigatorScreenOptions from '@libs/Navigation/AppNavigator/getRootNavigatorScreenOptions'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; import SCREENS from '@src/SCREENS'; -import type RequireReactComponent from '@src/types/utils/RequireReactComponent'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; -const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default; +const loadWorkspaceInitialPage = () => require('../../../../pages/workspace/WorkspaceInitialPage').default; const RootStack = createCustomFullScreenNavigator(); type Screens = Partial React.ComponentType>>; const centralPaneWorkspaceScreens = { - [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, - [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default, - [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, - [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, - [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default, - [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, - [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default, - [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, - [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, - [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, - [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default, - [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default, - [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default, - [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default, + [SCREENS.WORKSPACE.PROFILE]: () => require('../../../../pages/workspace/WorkspaceProfilePage').default, + [SCREENS.WORKSPACE.CARD]: () => require('../../../../pages/workspace/card/WorkspaceCardPage').default, + [SCREENS.WORKSPACE.WORKFLOWS]: () => require('../../../../pages/workspace/workflows/WorkspaceWorkflowsPage').default, + [SCREENS.WORKSPACE.REIMBURSE]: () => require('../../../../pages/workspace/reimburse/WorkspaceReimbursePage').default, + [SCREENS.WORKSPACE.BILLS]: () => require('../../../../pages/workspace/bills/WorkspaceBillsPage').default, + [SCREENS.WORKSPACE.INVOICES]: () => require('../../../../pages/workspace/invoices/WorkspaceInvoicesPage').default, + [SCREENS.WORKSPACE.TRAVEL]: () => require('../../../../pages/workspace/travel/WorkspaceTravelPage').default, + [SCREENS.WORKSPACE.MEMBERS]: () => require('../../../../pages/workspace/WorkspaceMembersPage').default, + [SCREENS.WORKSPACE.ACCOUNTING.ROOT]: () => require('../../../../pages/workspace/accounting/PolicyAccountingPage').default, + [SCREENS.WORKSPACE.CATEGORIES]: () => require('../../../../pages/workspace/categories/WorkspaceCategoriesPage').default, + [SCREENS.WORKSPACE.MORE_FEATURES]: () => require('../../../../pages/workspace/WorkspaceMoreFeaturesPage').default, + [SCREENS.WORKSPACE.TAGS]: () => require('../../../../pages/workspace/tags/WorkspaceTagsPage').default, + [SCREENS.WORKSPACE.TAXES]: () => require('../../../../pages/workspace/taxes/WorkspaceTaxesPage').default, + [SCREENS.WORKSPACE.DISTANCE_RATES]: () => require('../../../../pages/workspace/distanceRates/PolicyDistanceRatesPage').default, } satisfies Screens; function FullScreenNavigator() { diff --git a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx index b1cfb8e5d9a1..2aebe9f111f5 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx +++ b/src/libs/Navigation/AppNavigator/Navigators/LeftModalNavigator.tsx @@ -9,12 +9,13 @@ import ModalNavigatorScreenOptions from '@libs/Navigation/AppNavigator/ModalNavi import type {AuthScreensParamList, LeftModalNavigatorParamList} from '@libs/Navigation/types'; import NAVIGATORS from '@src/NAVIGATORS'; import SCREENS from '@src/SCREENS'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; import Overlay from './Overlay'; type LeftModalNavigatorProps = StackScreenProps; -const loadChatFinder = () => require('../../../../pages/ChatFinderPage').default as React.ComponentType; -const loadWorkspaceSwitcherPage = () => require('../../../../pages/WorkspaceSwitcherPage').default as React.ComponentType; +const loadChatFinder = () => require('../../../../pages/ChatFinderPage').default; +const loadWorkspaceSwitcherPage = () => require('../../../../pages/WorkspaceSwitcherPage').default; const Stack = createStackNavigator(); diff --git a/src/libs/Navigation/AppNavigator/index.native.tsx b/src/libs/Navigation/AppNavigator/index.native.tsx index f740f9eb5b94..e848979e6993 100644 --- a/src/libs/Navigation/AppNavigator/index.native.tsx +++ b/src/libs/Navigation/AppNavigator/index.native.tsx @@ -2,6 +2,7 @@ import React, {memo, useContext, useEffect} from 'react'; import {NativeModules} from 'react-native'; import {InitialURLContext} from '@components/InitialURLContextProvider'; import Navigation from '@libs/Navigation/Navigation'; +import type ReactComponentModule from '@src/types/utils/ReactComponentModule'; type AppNavigatorProps = { /** If we have an authToken this is true */ @@ -22,13 +23,13 @@ function AppNavigator({authenticated}: AppNavigatorProps) { }, [initUrl]); if (authenticated) { - const AuthScreens = require('./AuthScreens').default; + const AuthScreens = require('./AuthScreens').default; // These are the protected screens and only accessible when an authToken is present return ; } - const PublicScreens = require('./PublicScreens').default; + const PublicScreens = require('./PublicScreens').default; return ; } diff --git a/src/types/utils/ReactComponentModule.ts b/src/types/utils/ReactComponentModule.ts new file mode 100644 index 000000000000..8b40f2cb5c56 --- /dev/null +++ b/src/types/utils/ReactComponentModule.ts @@ -0,0 +1,3 @@ +type ReactComponentModule = {default: React.ComponentType}; + +export default ReactComponentModule; diff --git a/src/types/utils/RequireReactComponent.ts b/src/types/utils/RequireReactComponent.ts deleted file mode 100644 index 02b0198b66f4..000000000000 --- a/src/types/utils/RequireReactComponent.ts +++ /dev/null @@ -1,3 +0,0 @@ -type RequireReactComponent = {default: React.ComponentType}; - -export default RequireReactComponent; From 4f82ac1297c2890f01650094e6ce2329233c4ee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 16:56:06 +0200 Subject: [PATCH 06/28] use generic type with require --- __mocks__/react-native-webview.ts | 4 ++-- config/webpack/webpack.common.ts | 2 +- src/libs/Performance.tsx | 2 +- wdyr.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__mocks__/react-native-webview.ts b/__mocks__/react-native-webview.ts index 8266c7b1eda0..41713f05bf48 100644 --- a/__mocks__/react-native-webview.ts +++ b/__mocks__/react-native-webview.ts @@ -1,8 +1,8 @@ import type {View as RNView} from 'react-native'; jest.mock('react-native-webview', () => { - const {View} = require('react-native'); + const {View} = require<{View: RNView}>('react-native'); return { - WebView: () => View as RNView, + WebView: () => View, }; }); diff --git a/config/webpack/webpack.common.ts b/config/webpack/webpack.common.ts index bedd7e50ef94..da9e5f8d3291 100644 --- a/config/webpack/webpack.common.ts +++ b/config/webpack/webpack.common.ts @@ -24,7 +24,7 @@ type PreloadWebpackPluginClass = { }; // require is necessary, there are no types for this package and the declaration file can't be seen by the build process which causes an error. -const PreloadWebpackPlugin: PreloadWebpackPluginClass = require('@vue/preload-webpack-plugin'); +const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin'); const includeModules = [ 'react-native-animatable', diff --git a/src/libs/Performance.tsx b/src/libs/Performance.tsx index 5155722786cf..213e62f916e3 100644 --- a/src/libs/Performance.tsx +++ b/src/libs/Performance.tsx @@ -92,7 +92,7 @@ const Performance: PerformanceModule = { }; if (Metrics.canCapturePerformanceMetrics()) { - const perfModule: ReactNativePerformance = require('react-native-performance'); + const perfModule = require('react-native-performance'); perfModule.setResourceLoggingEnabled(true); rnPerformance = perfModule.default; diff --git a/wdyr.ts b/wdyr.ts index 3f49eb4035a0..e5b40bc3b4c7 100644 --- a/wdyr.ts +++ b/wdyr.ts @@ -6,7 +6,7 @@ import Config from 'react-native-config'; const useWDYR = Config?.USE_WDYR === 'true'; if (useWDYR) { - const whyDidYouRender: typeof WhyDidYouRender = require('@welldone-software/why-did-you-render'); + const whyDidYouRender = require('@welldone-software/why-did-you-render'); whyDidYouRender(React, { // Enable tracking in all pure components by default trackAllPureComponents: true, From 7a68f02a5054f9eb96592eb30b2146bef3210ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 6 Jun 2024 17:19:23 +0200 Subject: [PATCH 07/28] fix crashing desktop --- config/webpack/webpack.common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/webpack/webpack.common.ts b/config/webpack/webpack.common.ts index da9e5f8d3291..bedd7e50ef94 100644 --- a/config/webpack/webpack.common.ts +++ b/config/webpack/webpack.common.ts @@ -24,7 +24,7 @@ type PreloadWebpackPluginClass = { }; // require is necessary, there are no types for this package and the declaration file can't be seen by the build process which causes an error. -const PreloadWebpackPlugin = require('@vue/preload-webpack-plugin'); +const PreloadWebpackPlugin: PreloadWebpackPluginClass = require('@vue/preload-webpack-plugin'); const includeModules = [ 'react-native-animatable', From 37a803205f1568a7d8bc78b3f49efdb03638fcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Fri, 7 Jun 2024 14:36:33 +0200 Subject: [PATCH 08/28] fix no member access error for error type --- .../AttachmentPicker/launchCamera/launchCamera.android.ts | 2 +- .../AttachmentPicker/launchCamera/launchCamera.ios.ts | 2 +- src/components/Onfido/BaseOnfidoWeb.tsx | 5 ++--- src/components/Onfido/index.native.tsx | 5 ++--- src/components/Onfido/types.ts | 7 ++++++- .../SignInButtons/GoogleSignIn/index.native.tsx | 7 ++++--- src/components/SignInButtons/GoogleSignIn/types.ts | 5 +++++ src/libs/Network/SequentialQueue.ts | 7 ++++++- src/libs/actions/Report.ts | 8 ++++++-- src/libs/fileDownload/index.ios.ts | 2 +- 10 files changed, 34 insertions(+), 16 deletions(-) create mode 100644 src/components/SignInButtons/GoogleSignIn/types.ts diff --git a/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts b/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts index c4359b06d619..0f551d07019b 100644 --- a/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts +++ b/src/components/AttachmentPicker/launchCamera/launchCamera.android.ts @@ -19,7 +19,7 @@ const launchCamera: LaunchCamera = (options, callback) => { launchCameraImagePicker(options, callback); }) - .catch((error) => { + .catch((error: ErrorLaunchCamera) => { /* Intercept the permission error as well as any other errors and call the callback * follow the same pattern expected for image picker results */ callback({ diff --git a/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts b/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts index 7015d4d9ed13..c4983285b6c6 100644 --- a/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts +++ b/src/components/AttachmentPicker/launchCamera/launchCamera.ios.ts @@ -19,7 +19,7 @@ const launchCamera: LaunchCamera = (options, callback) => { launchCameraImagePicker(options, callback); }) - .catch((error) => { + .catch((error: ErrorLaunchCamera) => { /* Intercept the permission error as well as any other errors and call the callback * follow the same pattern expected for image picker results */ callback({ diff --git a/src/components/Onfido/BaseOnfidoWeb.tsx b/src/components/Onfido/BaseOnfidoWeb.tsx index 94124180bea3..ebb29198bda7 100644 --- a/src/components/Onfido/BaseOnfidoWeb.tsx +++ b/src/components/Onfido/BaseOnfidoWeb.tsx @@ -1,5 +1,4 @@ import {Onfido as OnfidoSDK} from 'onfido-sdk-ui'; -import type {ErrorType} from 'onfido-sdk-ui/types/Types'; import React, {forwardRef, useEffect} from 'react'; import type {ForwardedRef} from 'react'; import type {LocaleContextProps} from '@components/LocaleContextProvider'; @@ -12,7 +11,7 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import './index.css'; -import type {OnfidoElement, OnfidoProps} from './types'; +import type {OnfidoElement, OnfidoError, OnfidoProps} from './types'; type InitializeOnfidoProps = OnfidoProps & Pick & { @@ -93,7 +92,7 @@ function initializeOnfido({sdkToken, onSuccess, onError, onUserExit, preferredLo } onSuccess(data); }, - onError: (error: ErrorType) => { + onError: (error: OnfidoError) => { const errorType = error.type; const errorMessage: string = error.message ?? CONST.ERROR.UNKNOWN_ERROR; Log.hmmm('Onfido error', {errorType, errorMessage}); diff --git a/src/components/Onfido/index.native.tsx b/src/components/Onfido/index.native.tsx index 10badbcec414..fd681e610f86 100644 --- a/src/components/Onfido/index.native.tsx +++ b/src/components/Onfido/index.native.tsx @@ -1,5 +1,4 @@ import {OnfidoCaptureType, OnfidoCountryCode, OnfidoDocumentType, Onfido as OnfidoSDK, OnfidoTheme} from '@onfido/react-native-sdk'; -import type {ErrorType} from 'onfido-sdk-ui/types/Types'; import React, {useEffect} from 'react'; import {Alert, Linking} from 'react-native'; import {checkMultiple, PERMISSIONS, RESULTS} from 'react-native-permissions'; @@ -9,7 +8,7 @@ import getPlatform from '@libs/getPlatform'; import Log from '@libs/Log'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; -import type {OnfidoProps} from './types'; +import type {OnfidoError, OnfidoProps} from './types'; function Onfido({sdkToken, onUserExit, onSuccess, onError}: OnfidoProps) { const {translate} = useLocalize(); @@ -30,7 +29,7 @@ function Onfido({sdkToken, onUserExit, onSuccess, onError}: OnfidoProps) { }, }) .then(onSuccess) - .catch((error: ErrorType) => { + .catch((error: OnfidoError) => { const errorMessage: string = error.message ?? CONST.ERROR.UNKNOWN_ERROR; const errorType = error.type; diff --git a/src/components/Onfido/types.ts b/src/components/Onfido/types.ts index 4005dc2597cb..e3c0819ea287 100644 --- a/src/components/Onfido/types.ts +++ b/src/components/Onfido/types.ts @@ -25,4 +25,9 @@ type OnfidoProps = { onError: (error?: string) => void; }; -export type {OnfidoProps, OnfidoElement, OnfidoData, OnfidoDataWithApplicantID}; +type OnfidoError = Error & { + message?: string; + type?: string; +}; + +export type {OnfidoProps, OnfidoElement, OnfidoData, OnfidoDataWithApplicantID, OnfidoError}; diff --git a/src/components/SignInButtons/GoogleSignIn/index.native.tsx b/src/components/SignInButtons/GoogleSignIn/index.native.tsx index 2744d8958080..1d6a6626fe99 100644 --- a/src/components/SignInButtons/GoogleSignIn/index.native.tsx +++ b/src/components/SignInButtons/GoogleSignIn/index.native.tsx @@ -5,6 +5,7 @@ import Log from '@libs/Log'; import * as Session from '@userActions/Session'; import CONFIG from '@src/CONFIG'; import CONST from '@src/CONST'; +import type GoogleError from './types'; /** * Google Sign In method for iOS and android that returns identityToken. @@ -26,17 +27,17 @@ function googleSignInRequest() { .then((token) => Session.beginGoogleSignIn(token)) .catch((error) => { // Handle unexpected error shape - if (error === undefined || error.code === undefined) { + if (error === undefined || (error as GoogleError).code === undefined) { Log.alert(`[Google Sign In] Google sign in failed: ${error}`); } /** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see: - The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes - The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes */ - if (error.code === statusCodes.SIGN_IN_CANCELLED) { + if ((error as GoogleError).code === statusCodes.SIGN_IN_CANCELLED) { Log.info('[Google Sign In] Google Sign In cancelled'); } else { - Log.alert(`[Google Sign In] Error Code: ${error.code}. ${error.message}`, {}, false); + Log.alert(`[Google Sign In] Error Code: ${(error as GoogleError).code}. ${(error as GoogleError).message}`, {}, false); } }); } diff --git a/src/components/SignInButtons/GoogleSignIn/types.ts b/src/components/SignInButtons/GoogleSignIn/types.ts new file mode 100644 index 000000000000..81694ca06821 --- /dev/null +++ b/src/components/SignInButtons/GoogleSignIn/types.ts @@ -0,0 +1,5 @@ +type GoogleError = Error & { + code?: string; +}; + +export default GoogleError; diff --git a/src/libs/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index b94166c0249d..90ce2ff5cf65 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -9,6 +9,11 @@ import ONYXKEYS from '@src/ONYXKEYS'; import type OnyxRequest from '@src/types/onyx/Request'; import * as NetworkStore from './NetworkStore'; +type RequestError = Error & { + name?: string; + message?: string; +}; + let resolveIsReadyPromise: ((args?: unknown[]) => void) | undefined; let isReadyPromise = new Promise((resolve) => { resolveIsReadyPromise = resolve; @@ -78,7 +83,7 @@ function process(): Promise { RequestThrottle.clear(); return process(); }) - .catch((error) => { + .catch((error: RequestError) => { // On sign out we cancel any in flight requests from the user. Since that user is no longer signed in their requests should not be retried. // Duplicate records don't need to be retried as they just mean the record already exists on the server if (error.name === CONST.ERROR.REQUEST_CANCELLED || error.message === CONST.ERROR.DUPLICATE_RECORD) { diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 40f3c93a0492..018de0b0a427 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -148,6 +148,10 @@ type GuidedSetupData = Array< AddCommentOrAttachementParams) >; +type ReportError = { + type?: string; +}; + let conciergeChatReportID: string | undefined; let currentUserAccountID = -1; let currentUserEmail: string | undefined; @@ -349,7 +353,7 @@ function subscribeToReportTypingEvents(reportID: string) { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, typingStoppedStatus); delete typingWatchTimers[reportUserIdentifier]; }, 1500); - }).catch((error) => { + }).catch((error: ReportError) => { Log.hmmm('[Report] Failed to initially subscribe to Pusher channel', {errorType: error.type, pusherChannelName}); }); } @@ -380,7 +384,7 @@ function subscribeToReportLeavingEvents(reportID: string) { } Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_LEAVING_ROOM}${reportID}`, true); - }).catch((error) => { + }).catch((error: ReportError) => { Log.hmmm('[Report] Failed to initially subscribe to Pusher channel', {errorType: error.type, pusherChannelName}); }); } diff --git a/src/libs/fileDownload/index.ios.ts b/src/libs/fileDownload/index.ios.ts index 45e6a5027994..fa816e7a4704 100644 --- a/src/libs/fileDownload/index.ios.ts +++ b/src/libs/fileDownload/index.ios.ts @@ -97,7 +97,7 @@ const fileDownload: FileDownload = (fileUrl, fileName, successMessage) => .catch((err) => { // iOS shows permission popup only once. Subsequent request will only throw an error. // We catch the error and show a redirection link to the settings screen - if (err.message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { + if ((err as {message?: string}).message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { FileUtils.showPermissionErrorAlert(); } else { FileUtils.showGeneralErrorAlert(); From 933a865f9cefdda7927945b68e53f253a71691a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Fri, 7 Jun 2024 16:25:18 +0200 Subject: [PATCH 09/28] fix more no member access errors --- src/components/AttachmentModal.tsx | 6 +++- src/components/Hoverable/ActiveHoverable.tsx | 30 +++++++++++--------- src/components/Modal/index.tsx | 3 +- src/components/Modal/types.ts | 6 +++- src/components/Tooltip/BaseTooltip/index.tsx | 6 +++- src/libs/DomUtils/index.ts | 6 ++-- src/libs/NetworkConnection.ts | 6 +++- src/libs/OptionsListUtils.ts | 3 +- src/libs/updateMultilineInputRange/index.ts | 4 +-- 9 files changed, 45 insertions(+), 25 deletions(-) diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index d1c027378563..537c0153c028 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -140,6 +140,10 @@ type AttachmentModalProps = AttachmentModalOnyxProps & { canEditReceipt?: boolean; }; +type DataWebkitGetAsEntry = { + isDirectory: boolean; +}; + function AttachmentModal({ source = '', onConfirm, @@ -306,7 +310,7 @@ function AttachmentModal({ }, []); const isDirectoryCheck = useCallback((data: FileObject) => { - if ('webkitGetAsEntry' in data && typeof data.webkitGetAsEntry === 'function' && data.webkitGetAsEntry().isDirectory) { + if ('webkitGetAsEntry' in data && typeof data.webkitGetAsEntry === 'function' && (data.webkitGetAsEntry() as DataWebkitGetAsEntry).isDirectory) { setIsAttachmentInvalid(true); setAttachmentInvalidReasonTitle('attachmentPicker.attachmentError'); setAttachmentInvalidReason('attachmentPicker.folderNotAllowedMessage'); diff --git a/src/components/Hoverable/ActiveHoverable.tsx b/src/components/Hoverable/ActiveHoverable.tsx index 227e4524eb02..07fb826a35e7 100644 --- a/src/components/Hoverable/ActiveHoverable.tsx +++ b/src/components/Hoverable/ActiveHoverable.tsx @@ -8,7 +8,14 @@ import type HoverableProps from './types'; type ActiveHoverableProps = Omit; -type OnMouseEventProps = (e: MouseEvent) => void; +type OnMouseEvent = (e: MouseEvent) => void; + +type MouseEvents = { + onMouseEnter: OnMouseEvent; + onMouseLeave: OnMouseEvent; + onMouseMove: OnMouseEvent; + onBlur: OnMouseEvent; +}; function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreezeCapture, children}: ActiveHoverableProps, outerRef: Ref) { const [isHovered, setIsHovered] = useState(false); @@ -100,26 +107,23 @@ function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreez const child = useMemo(() => getReturnValue(children, !isScrollingRef.current && isHovered), [children, isHovered]); - const childOnMouseEnter: OnMouseEventProps = child.props.onMouseEnter; - const childOnMouseLeave: OnMouseEventProps = child.props.onMouseLeave; - const childOnMouseMove: OnMouseEventProps = child.props.onMouseMove; - const childOnBlur: OnMouseEventProps = child.props.onBlur; + const {onMouseEnter, onMouseLeave, onMouseMove, onBlur}: MouseEvents = child.props; const hoverAndForwardOnMouseEnter = useCallback( (e: MouseEvent) => { isVisibiltyHidden.current = false; updateIsHovered(true); - childOnMouseEnter?.(e); + onMouseEnter?.(e); }, - [updateIsHovered, childOnMouseEnter], + [updateIsHovered, onMouseEnter], ); const unhoverAndForwardOnMouseLeave = useCallback( (e: MouseEvent) => { updateIsHovered(false); - childOnMouseLeave?.(e); + onMouseLeave?.(e); }, - [updateIsHovered, childOnMouseLeave], + [updateIsHovered, onMouseLeave], ); const unhoverAndForwardOnBlur = useCallback( @@ -130,18 +134,18 @@ function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreez setIsHovered(false); } - childOnBlur?.(event); + onBlur?.(event); }, - [childOnBlur], + [onBlur], ); const handleAndForwardOnMouseMove = useCallback( (e: MouseEvent) => { isVisibiltyHidden.current = false; updateIsHovered(true); - childOnMouseMove?.(e); + onMouseMove?.(e); }, - [updateIsHovered, childOnMouseMove], + [updateIsHovered, onMouseMove], ); return cloneElement(child, { diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx index 76f4b251ec83..0567e20467e5 100644 --- a/src/components/Modal/index.tsx +++ b/src/components/Modal/index.tsx @@ -5,6 +5,7 @@ import StatusBar from '@libs/StatusBar'; import CONST from '@src/CONST'; import BaseModal from './BaseModal'; import type BaseModalProps from './types'; +import type {WindowState} from './types'; function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = () => {}, children, shouldHandleNavigationBack, ...rest}: BaseModalProps) { const theme = useTheme(); @@ -22,7 +23,7 @@ function Modal({fullscreen = true, onModalHide = () => {}, type, onModalShow = ( const hideModal = () => { setStatusBarColor(previousStatusBarColor); onModalHide(); - if (window.history.state.shouldGoBack) { + if ((window.history.state as WindowState).shouldGoBack) { window.history.back(); } }; diff --git a/src/components/Modal/types.ts b/src/components/Modal/types.ts index 3621ccd5817b..4971932b69c8 100644 --- a/src/components/Modal/types.ts +++ b/src/components/Modal/types.ts @@ -10,6 +10,10 @@ type PopoverAnchorPosition = { left?: number; }; +type WindowState = { + shouldGoBack: boolean; +}; + type BaseModalProps = Partial & { /** Decides whether the modal should cover fullscreen. FullScreen modal has backdrop */ fullscreen?: boolean; @@ -86,4 +90,4 @@ type BaseModalProps = Partial & { }; export default BaseModalProps; -export type {PopoverAnchorPosition}; +export type {PopoverAnchorPosition, WindowState}; diff --git a/src/components/Tooltip/BaseTooltip/index.tsx b/src/components/Tooltip/BaseTooltip/index.tsx index 656761006d91..ec29faee229d 100644 --- a/src/components/Tooltip/BaseTooltip/index.tsx +++ b/src/components/Tooltip/BaseTooltip/index.tsx @@ -15,6 +15,10 @@ import variables from '@styles/variables'; import CONST from '@src/CONST'; import callOrReturn from '@src/types/utils/callOrReturn'; +type MouseEvents = { + onMouseEnter: (e: MouseEvent) => void | undefined; +}; + const hasHoverSupport = DeviceCapabilities.hasHoverSupport(); /** @@ -188,7 +192,7 @@ function Tooltip( (e: MouseEvent) => { updateTargetAndMousePosition(e); if (React.isValidElement(children)) { - const onMouseEnter: (e: MouseEvent) => void | undefined = children.props.onMouseEnter; + const onMouseEnter = (children.props as MouseEvents).onMouseEnter; onMouseEnter?.(e); } }, diff --git a/src/libs/DomUtils/index.ts b/src/libs/DomUtils/index.ts index 330123833c1f..e6286dce77fc 100644 --- a/src/libs/DomUtils/index.ts +++ b/src/libs/DomUtils/index.ts @@ -8,8 +8,7 @@ const addCSS = (css: string, styleId: string) => { if (existingStyle) { if ('styleSheet' in existingStyle) { // Supports IE8 and below - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (existingStyle.styleSheet as any).cssText = css; + (existingStyle.styleSheet as CSSStyleDeclaration).cssText = css; } else { existingStyle.innerHTML = css; } @@ -20,8 +19,7 @@ const addCSS = (css: string, styleId: string) => { if ('styleSheet' in styleElement) { // Supports IE8 and below - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (styleElement.styleSheet as any).cssText = css; + (styleElement.styleSheet as CSSStyleDeclaration).cssText = css; } else { styleElement.appendChild(document.createTextNode(css)); } diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index b3dd24fcd4ae..9890b149ab2a 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -15,6 +15,10 @@ let isOffline = false; let hasPendingNetworkCheck = false; type NetworkStatus = ValueOf; +type ResponseJSON = { + jsonCode: number; +}; + // Holds all of the callbacks that need to be triggered when the network reconnects let callbackID = 0; const reconnectionCallbacks: Record void> = {}; @@ -113,7 +117,7 @@ function subscribeToBackendAndInternetReachability(): () => void { } return response .json() - .then((json) => Promise.resolve(json.jsonCode === 200)) + .then((json) => Promise.resolve((json as ResponseJSON).jsonCode === 200)) .catch(() => Promise.resolve(false)); }) .then((isBackendReachable: boolean) => { diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index a7c65df7dd03..03b88a0639d8 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -19,6 +19,7 @@ import type { PersonalDetailsList, Policy, PolicyCategories, + PolicyCategory, PolicyTag, PolicyTagList, PolicyTags, @@ -936,7 +937,7 @@ function getSearchValueForPhoneOrEmail(searchTerm: string) { * Verifies that there is at least one enabled option */ function hasEnabledOptions(options: PolicyCategories | PolicyTag[]): boolean { - return Object.values(options).some((option) => option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); + return Object.values(options).some((option: PolicyTag | PolicyCategory) => option.enabled && option.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); } /** diff --git a/src/libs/updateMultilineInputRange/index.ts b/src/libs/updateMultilineInputRange/index.ts index 3ee2ce6bb70c..71b9b0180df0 100644 --- a/src/libs/updateMultilineInputRange/index.ts +++ b/src/libs/updateMultilineInputRange/index.ts @@ -14,8 +14,8 @@ const updateMultilineInputRange: UpdateMultilineInputRange = (input, shouldAutoF return; } - if ('value' in input && input.value && input.setSelectionRange) { - const length = input.value.length as number; + if ('value' in input && typeof input.value === 'string' && input.setSelectionRange) { + const length = input.value.length; if (shouldAutoFocus && 'setSelectionRange' in input) { (input as HTMLInputElement).setSelectionRange(length, length); } From 3a804406b4cfd6e4e234f19c81f95d53838b4a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Mon, 10 Jun 2024 17:40:28 +0200 Subject: [PATCH 10/28] fix no unsafe member access errors in tests --- tests/actions/ReportTest.ts | 2 +- tests/perf-test/ReportActionsList.perf-test.tsx | 7 ++++++- tests/ui/UnreadIndicatorsTest.tsx | 16 ++++++++-------- tests/unit/NetworkTest.ts | 6 +++++- tests/unit/createOrUpdateStagingDeployTest.ts | 13 +++++++++---- tests/unit/sanitizeStringForJSONParseTest.ts | 8 ++++++-- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index cc6ad281e72d..e6ab31334bb1 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -186,7 +186,7 @@ describe('actions/Report', () => { .then(() => { // THEN only ONE call to AddComment will happen const URL_ARGUMENT_INDEX = 0; - const addCommentCalls = (global.fetch as jest.Mock).mock.calls.filter((callArguments) => (callArguments[URL_ARGUMENT_INDEX] as string).includes('AddComment')); + const addCommentCalls = (global.fetch as jest.Mock).mock.calls.filter((callArguments: string[]) => callArguments[URL_ARGUMENT_INDEX].includes('AddComment')); expect(addCommentCalls.length).toBe(1); }); }); diff --git a/tests/perf-test/ReportActionsList.perf-test.tsx b/tests/perf-test/ReportActionsList.perf-test.tsx index 7d45e3e4b45d..64cd6cc4d157 100644 --- a/tests/perf-test/ReportActionsList.perf-test.tsx +++ b/tests/perf-test/ReportActionsList.perf-test.tsx @@ -14,6 +14,7 @@ import ReportActionsList from '@src/pages/home/report/ReportActionsList'; import {ReportAttachmentsProvider} from '@src/pages/home/report/ReportAttachmentsContext'; import {ActionListContext, ReactionListContext} from '@src/pages/home/ReportScreenContext'; import variables from '@src/styles/variables'; +import type {PersonalDetailsList} from '@src/types/onyx'; import createRandomReportAction from '../utils/collections/reportActions'; import * as LHNTestUtilsModule from '../utils/LHNTestUtils'; import PusherHelper from '../utils/PusherHelper'; @@ -21,6 +22,10 @@ import * as ReportTestUtils from '../utils/ReportTestUtils'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; +type LHNTestUtilsProps = { + fakePersonalDetails: PersonalDetailsList; +}; + const mockedNavigate = jest.fn(); jest.mock('@components/withCurrentUserPersonalDetails', () => { @@ -31,7 +36,7 @@ jest.mock('@components/withCurrentUserPersonalDetails', () => { return (Component: ComponentType) => { function WrappedComponent(props: Omit) { const currentUserAccountID = 5; - const LHNTestUtils = lazyLoadLHNTestUtils(); // Load LHNTestUtils here + const LHNTestUtils: LHNTestUtilsProps = lazyLoadLHNTestUtils(); // Load LHNTestUtils here return ( { // And that the text is bold const displayNameHintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameText = screen.queryByLabelText(displayNameHintText); - expect(displayNameText?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameText?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); return navigateToSidebarOption(0); }) @@ -441,11 +441,11 @@ describe('Unread Indicators', () => { const displayNameTexts = screen.queryAllByLabelText(displayNameHintTexts); expect(displayNameTexts).toHaveLength(2); const firstReportOption = displayNameTexts[0]; - expect(firstReportOption?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((firstReportOption?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('C User')).toBeOnTheScreen(); const secondReportOption = displayNameTexts[1]; - expect(secondReportOption?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((secondReportOption?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); // Tap the new report option and navigate back to the sidebar again via the back button @@ -458,9 +458,9 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(2); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(undefined); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(undefined); expect(screen.getAllByText('C User')[0]).toBeOnTheScreen(); - expect(displayNameTexts[1]?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameTexts[1]?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); })); @@ -492,7 +492,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(FontUtils.fontWeight.bold); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold); expect(screen.getByText('B User')).toBeOnTheScreen(); // Navigate to the report again and back to the sidebar @@ -504,7 +504,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(displayNameTexts[0]?.props?.style?.fontWeight).toBe(undefined); + expect((displayNameTexts[0]?.props?.style as TextStyle)?.fontWeight).toBe(undefined); expect(screen.getByText('B User')).toBeOnTheScreen(); // Navigate to the report again and verify the new line indicator is missing diff --git a/tests/unit/NetworkTest.ts b/tests/unit/NetworkTest.ts index 9c48de96d1a2..689d7ad93f15 100644 --- a/tests/unit/NetworkTest.ts +++ b/tests/unit/NetworkTest.ts @@ -16,6 +16,10 @@ import type ReactNativeOnyxMock from '../../__mocks__/react-native-onyx'; import * as TestHelper from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; +type ResponseJSON = { + jsonCode?: string; +}; + const Onyx = MockedOnyx as typeof ReactNativeOnyxMock; jest.mock('@src/libs/Log'); @@ -301,7 +305,7 @@ describe('NetworkTests', () => { return waitForBatchedUpdates(); }) .then(() => { - const response = onResolved.mock.calls[0][0]; + const response: ResponseJSON = onResolved.mock.calls[0][0]; expect(onResolved).toHaveBeenCalled(); expect(response.jsonCode).toBe(CONST.JSON_CODE.UNABLE_TO_RETRY); }); diff --git a/tests/unit/createOrUpdateStagingDeployTest.ts b/tests/unit/createOrUpdateStagingDeployTest.ts index 2adac21bec51..59ebe9d639cf 100644 --- a/tests/unit/createOrUpdateStagingDeployTest.ts +++ b/tests/unit/createOrUpdateStagingDeployTest.ts @@ -12,6 +12,11 @@ import type {InternalOctokit} from '@github/libs/GithubUtils'; import GithubUtils from '@github/libs/GithubUtils'; import GitUtils from '@github/libs/GitUtils'; +type Arguments = { + issue_number?: number; + labels?: string; +}; + const PATH_TO_PACKAGE_JSON = path.resolve(__dirname, '../../package.json'); jest.mock('fs'); @@ -37,7 +42,7 @@ beforeAll(() => { }, }), ), - update: jest.fn().mockImplementation((arg) => + update: jest.fn().mockImplementation((arg: Arguments) => Promise.resolve({ data: { ...arg, @@ -171,7 +176,7 @@ describe('createOrUpdateStagingDeployCash', () => { return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [closedStagingDeployCash]}; } @@ -266,7 +271,7 @@ describe('createOrUpdateStagingDeployCash', () => { return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [openStagingDeployCashBefore, closedStagingDeployCash]}; } @@ -341,7 +346,7 @@ describe('createOrUpdateStagingDeployCash', () => { } return []; }); - mockListIssues.mockImplementation((args) => { + mockListIssues.mockImplementation((args: Arguments) => { if (args.labels === CONST.LABELS.STAGING_DEPLOY) { return {data: [openStagingDeployCashBefore, closedStagingDeployCash]}; } diff --git a/tests/unit/sanitizeStringForJSONParseTest.ts b/tests/unit/sanitizeStringForJSONParseTest.ts index f9e647eb9a2a..e269617d4f24 100644 --- a/tests/unit/sanitizeStringForJSONParseTest.ts +++ b/tests/unit/sanitizeStringForJSONParseTest.ts @@ -1,5 +1,9 @@ import sanitizeStringForJSONParse from '../../.github/libs/sanitizeStringForJSONParse'; +type ParsedJSON = { + key?: string; +}; + // Bad inputs should cause an error to be thrown const badInputs: Array = [null, undefined, 42, true]; @@ -39,14 +43,14 @@ describe('santizeStringForJSONParse', () => { const badJSON = `{"key": "${input}"}`; // eslint-disable-next-line @typescript-eslint/no-unsafe-return -- it's supposed to throw an error expect(() => JSON.parse(badJSON)).toThrow(); - const goodJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); + const goodJSON: ParsedJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); expect(goodJSON.key).toStrictEqual(expectedOutput); }); }); describe.each(validJSONData)('canHandleValidJSON', (input, expectedOutput) => { test('sanitizeStringForJSONParse', () => { - const goodJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); + const goodJSON: ParsedJSON = JSON.parse(`{"key": "${sanitizeStringForJSONParse(input)}"}`); expect(goodJSON.key).toStrictEqual(expectedOutput); }); }); From 73df95f5c38d3c42cb03337a3c3a25a40f66b46f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Tue, 11 Jun 2024 14:05:35 +0200 Subject: [PATCH 11/28] fix no unsafe member access errors in tests 2 --- src/libs/E2E/tests/linkingTest.e2e.ts | 6 +++++- src/setup/addUtilsToWindow.ts | 8 ++++++-- src/types/modules/act.d.ts | 9 ++++++--- tests/e2e/testRunner.ts | 7 ++++++- tests/ui/UnreadIndicatorsTest.tsx | 19 +++++++++---------- tests/unit/MiddlewareTest.ts | 18 ++++++++++++++---- tests/unit/NetworkTest.ts | 8 ++------ workflow_tests/utils/JobMocker.ts | 8 ++++---- workflow_tests/utils/preGenerateTest.ts | 6 +++--- workflow_tests/utils/utils.ts | 12 +++++++++++- 10 files changed, 66 insertions(+), 35 deletions(-) diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index c48ffb5a8057..0e02c4af2a1f 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -11,6 +11,10 @@ import Performance from '@libs/Performance'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; +type Item = { + reportActionID?: string; +}; + const test = (config: NativeConfig) => { console.debug('[E2E] Logging in for comment linking'); @@ -45,7 +49,7 @@ const test = (config: NativeConfig) => { const res = getViewableItems(); console.debug('[E2E] Viewable items retrieved, verifying correct messageā€¦'); - if (!!res && res[0]?.item?.reportActionID === linkedReportActionID) { + if (!!res && (res[0]?.item as Item)?.reportActionID === linkedReportActionID) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, name: 'Comment linking', diff --git a/src/setup/addUtilsToWindow.ts b/src/setup/addUtilsToWindow.ts index eb34d33364eb..ebb8ac31ca13 100644 --- a/src/setup/addUtilsToWindow.ts +++ b/src/setup/addUtilsToWindow.ts @@ -4,6 +4,11 @@ import markAllPolicyReportsAsRead from '@libs/markAllPolicyReportsAsRead'; import * as Session from '@userActions/Session'; import type {OnyxKey} from '@src/ONYXKEYS'; +type UtilsWindow = Window & + typeof globalThis & { + markAllPolicyReportsAsRead: (policyID: string) => void; + }; + /** * This is used to inject development/debugging utilities into the window object on web and desktop. * We do this only on non-production builds - these should not be used in any application code. @@ -45,7 +50,6 @@ export default function addUtilsToWindow() { window.setSupportToken = Session.setSupportAuthToken; // Workaround to give employees the ability to mark reports as read via the JS console - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (window as any).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; + (window as UtilsWindow).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; }); } diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index 5fe00ec479cf..8a52c6fce2f0 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,8 +1,7 @@ import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js'; declare module '@kie/act-js' { - // eslint-disable-next-line rulesdir/no-inline-named-export - export declare type StepIdentifier = { + type StepIdentifierWithoutOmit = { id?: string; name: string; run?: string; @@ -10,5 +9,9 @@ declare module '@kie/act-js' { with?: string; envs?: string[]; inputs?: string[]; - } & Omit; + }; + + type StepIdentifier = StepIdentifierWithoutOmit & Omit; + + export type {StepIdentifier, StepIdentifierWithoutOmit}; } diff --git a/tests/e2e/testRunner.ts b/tests/e2e/testRunner.ts index fcf93d525f8e..5bb7b72a96d3 100644 --- a/tests/e2e/testRunner.ts +++ b/tests/e2e/testRunner.ts @@ -30,6 +30,11 @@ import withFailTimeout from './utils/withFailTimeout'; type Result = Record; +type CustomConfig = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + default: any; +}; + // VARIABLE CONFIGURATION const args = process.argv.slice(2); const getArg = (argName: string): string | undefined => { @@ -46,7 +51,7 @@ const setConfigPath = (configPathParam: string | undefined) => { if (!configPath?.startsWith('.')) { configPath = `./${configPath}`; } - const customConfig = require(configPath).default; + const customConfig = (require(configPath) as CustomConfig).default; config = Object.assign(defaultConfig, customConfig); }; diff --git a/tests/ui/UnreadIndicatorsTest.tsx b/tests/ui/UnreadIndicatorsTest.tsx index 3999ed75497f..45b4d9da10ca 100644 --- a/tests/ui/UnreadIndicatorsTest.tsx +++ b/tests/ui/UnreadIndicatorsTest.tsx @@ -91,19 +91,18 @@ const createAddListenerMock = (): ListenerMock => { }; jest.mock('@react-navigation/native', () => { - const actualNav = jest.requireActual('@react-navigation/native'); + const actualNav: jest.Mocked = jest.requireActual('@react-navigation/native'); const {triggerTransitionEnd, addListener} = createAddListenerMock(); transitionEndCB = triggerTransitionEnd; - const useNavigation = () => - ({ - navigate: jest.fn(), - ...actualNav.useNavigation, - getState: () => ({ - routes: [], - }), - addListener, - } as typeof NativeNavigation.useNavigation); + const useNavigation = () => ({ + ...actualNav.useNavigation(), + navigate: jest.fn(), + getState: () => ({ + routes: [], + }), + addListener, + }); return { ...actualNav, diff --git a/tests/unit/MiddlewareTest.ts b/tests/unit/MiddlewareTest.ts index 6954b22b2706..49a19dd89cd5 100644 --- a/tests/unit/MiddlewareTest.ts +++ b/tests/unit/MiddlewareTest.ts @@ -9,6 +9,8 @@ import ONYXKEYS from '@src/ONYXKEYS'; import * as TestHelper from '../utils/TestHelper'; import waitForNetworkPromises from '../utils/waitForNetworkPromises'; +type FormDataObject = {body: TestHelper.FormData}; + Onyx.init({ keys: ONYXKEYS, }); @@ -49,9 +51,14 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[1][1].body as TestHelper.FormData, {reportID: '1234', reportActionID: '5678'}); + TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[1] as unknown[])[1] as FormDataObject).body, { + reportID: '1234', + reportActionID: '5678', + }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[0][1].body as TestHelper.FormData, {reportID: '1234'}); + TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[0] as unknown[])[1] as FormDataObject).body, { + reportID: '1234', + }); }); test('Request with preexistingReportID', async () => { @@ -93,9 +100,12 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[1][1].body as TestHelper.FormData, {reportID: '5555', reportActionID: '5678'}); + TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[1] as unknown[])[1] as FormDataObject).body, { + reportID: '5555', + reportActionID: '5678', + }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((global.fetch as jest.Mock).mock.calls[0][1].body as TestHelper.FormData, {reportID: '1234'}); + TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[0] as unknown[])[1] as FormDataObject).body, {reportID: '1234'}); }); }); }); diff --git a/tests/unit/NetworkTest.ts b/tests/unit/NetworkTest.ts index 689d7ad93f15..51ed4d0c055b 100644 --- a/tests/unit/NetworkTest.ts +++ b/tests/unit/NetworkTest.ts @@ -16,10 +16,6 @@ import type ReactNativeOnyxMock from '../../__mocks__/react-native-onyx'; import * as TestHelper from '../utils/TestHelper'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; -type ResponseJSON = { - jsonCode?: string; -}; - const Onyx = MockedOnyx as typeof ReactNativeOnyxMock; jest.mock('@src/libs/Log'); @@ -293,7 +289,7 @@ describe('NetworkTests', () => { test('test Failed to fetch error for non-retryable requests resolve with unable to retry jsonCode', () => { // Setup xhr handler that rejects once with a Failed to Fetch global.fetch = jest.fn().mockRejectedValue(new Error(CONST.ERROR.FAILED_TO_FETCH)); - const onResolved = jest.fn(); + const onResolved = jest.fn() as jest.MockedFunction<(params: {jsonCode?: string | number}) => void>; // Given we have a request made while online return Onyx.set(ONYXKEYS.NETWORK, {isOffline: false, isBackendReachable: true}) @@ -305,7 +301,7 @@ describe('NetworkTests', () => { return waitForBatchedUpdates(); }) .then(() => { - const response: ResponseJSON = onResolved.mock.calls[0][0]; + const response = onResolved.mock.calls[0][0]; expect(onResolved).toHaveBeenCalled(); expect(response.jsonCode).toBe(CONST.JSON_CODE.UNABLE_TO_RETRY); }); diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index dadb85014d01..7e0a6ebc1321 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,4 +1,4 @@ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifierWithoutOmit} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -12,7 +12,7 @@ type YamlWorkflow = { }; type MockJob = { - steps: StepIdentifier[]; + steps: StepIdentifierWithoutOmit[]; uses?: string; secrets?: string[]; with?: string; @@ -50,8 +50,8 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step): StepIdentifier => { - const mockStep: StepIdentifier = { + job.steps = mockJob.steps.map((step): StepIdentifierWithoutOmit => { + const mockStep: StepIdentifierWithoutOmit = { name: step.name, run: step.mockWith, }; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index e88f7ffd8ee5..9ccd8cce20eb 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,5 +1,5 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifierWithoutOmit} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -94,7 +94,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: StepIdentifier, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: StepIdentifierWithoutOmit, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -219,7 +219,7 @@ const getMockFileContent = (workflowName: string, jobs: Record { - const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${(step.name as string) + const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${step.name .replaceAll(' ', '_') .replaceAll('-', '_') .replaceAll(',', '') diff --git a/workflow_tests/utils/utils.ts b/workflow_tests/utils/utils.ts index b70a88c24c7a..cac3a1c531d2 100644 --- a/workflow_tests/utils/utils.ts +++ b/workflow_tests/utils/utils.ts @@ -13,6 +13,16 @@ type StepAssertion = { output: string; }; +type Workflow = { + jobs: Record< + string, + { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'runs-on': string; + } + >; +}; + function setUpActParams( act: ExtendedAct, event: string | null = null, @@ -159,7 +169,7 @@ function setJobRunners(act: ExtendedAct, jobs: Record, workflowP return act; } - const workflow = yaml.parse(fs.readFileSync(workflowPath, 'utf8')); + const workflow: Workflow = yaml.parse(fs.readFileSync(workflowPath, 'utf8')); Object.entries(jobs).forEach(([jobId, runner]) => { const job = workflow.jobs[jobId]; job['runs-on'] = runner; From 74c81475fd0888b0e2052df6036157c289a35577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Wed, 12 Jun 2024 14:22:16 +0200 Subject: [PATCH 12/28] simplify types --- src/components/Hoverable/ActiveHoverable.tsx | 11 +++-------- .../SignInButtons/GoogleSignIn/index.native.tsx | 5 +++-- src/libs/E2E/reactNativeLaunchingTest.ts | 7 +------ src/libs/E2E/types.ts | 9 ++++++++- src/libs/Environment/betaChecker/index.android.ts | 2 +- src/libs/Navigation/linkTo/index.ts | 12 +++--------- src/libs/NetworkConnection.ts | 2 +- src/libs/fileDownload/index.ios.ts | 6 +++--- src/libs/fileDownload/types.ts | 5 ++++- tests/e2e/testRunner.ts | 5 ++--- tests/perf-test/ReportActionsList.perf-test.tsx | 7 +++---- tests/unit/NetworkTest.ts | 4 +++- 12 files changed, 35 insertions(+), 40 deletions(-) diff --git a/src/components/Hoverable/ActiveHoverable.tsx b/src/components/Hoverable/ActiveHoverable.tsx index 07fb826a35e7..abd48d432953 100644 --- a/src/components/Hoverable/ActiveHoverable.tsx +++ b/src/components/Hoverable/ActiveHoverable.tsx @@ -8,14 +8,9 @@ import type HoverableProps from './types'; type ActiveHoverableProps = Omit; -type OnMouseEvent = (e: MouseEvent) => void; +type MouseEvents = 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onBlur'; -type MouseEvents = { - onMouseEnter: OnMouseEvent; - onMouseLeave: OnMouseEvent; - onMouseMove: OnMouseEvent; - onBlur: OnMouseEvent; -}; +type OnMouseEvents = Record void>; function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreezeCapture, children}: ActiveHoverableProps, outerRef: Ref) { const [isHovered, setIsHovered] = useState(false); @@ -107,7 +102,7 @@ function ActiveHoverable({onHoverIn, onHoverOut, shouldHandleScroll, shouldFreez const child = useMemo(() => getReturnValue(children, !isScrollingRef.current && isHovered), [children, isHovered]); - const {onMouseEnter, onMouseLeave, onMouseMove, onBlur}: MouseEvents = child.props; + const {onMouseEnter, onMouseLeave, onMouseMove, onBlur}: OnMouseEvents = child.props; const hoverAndForwardOnMouseEnter = useCallback( (e: MouseEvent) => { diff --git a/src/components/SignInButtons/GoogleSignIn/index.native.tsx b/src/components/SignInButtons/GoogleSignIn/index.native.tsx index 1d6a6626fe99..0c868b861b5b 100644 --- a/src/components/SignInButtons/GoogleSignIn/index.native.tsx +++ b/src/components/SignInButtons/GoogleSignIn/index.native.tsx @@ -34,10 +34,11 @@ function googleSignInRequest() { - The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes - The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes */ - if ((error as GoogleError).code === statusCodes.SIGN_IN_CANCELLED) { + const googleError = error as GoogleError; + if (googleError.code === statusCodes.SIGN_IN_CANCELLED) { Log.info('[Google Sign In] Google Sign In cancelled'); } else { - Log.alert(`[Google Sign In] Error Code: ${(error as GoogleError).code}. ${(error as GoogleError).message}`, {}, false); + Log.alert(`[Google Sign In] Error Code: ${googleError.code}. ${googleError.message}`, {}, false); } }); } diff --git a/src/libs/E2E/reactNativeLaunchingTest.ts b/src/libs/E2E/reactNativeLaunchingTest.ts index b022d8da6dc3..450fd14985e4 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.ts +++ b/src/libs/E2E/reactNativeLaunchingTest.ts @@ -5,7 +5,6 @@ * By doing this, we avoid bundling any E2E testing code * into the actual release app. */ -import type {ValueOf} from 'type-fest'; import * as Metrics from '@libs/Metrics'; import Performance from '@libs/Performance'; import Config from 'react-native-config'; @@ -13,11 +12,7 @@ import E2EConfig from '../../../tests/e2e/config'; import E2EClient from './client'; import installNetworkInterceptor from './utils/NetworkInterceptor'; import LaunchArgs from './utils/LaunchArgs'; -import type { TestConfig } from './types'; - -type Test = (config: TestConfig) => void; -type TestModule = { default: Test} -type Tests = Record, Test>; +import type { TestModule, Tests } from './types'; console.debug('=========================='); console.debug('==== Running e2e test ===='); diff --git a/src/libs/E2E/types.ts b/src/libs/E2E/types.ts index 5cd6692c9215..fdbc01872cb3 100644 --- a/src/libs/E2E/types.ts +++ b/src/libs/E2E/types.ts @@ -1,5 +1,6 @@ import type {TEST_NAMES} from 'tests/e2e/config'; import type {ValueOf} from 'type-fest'; +import type E2EConfig from '../../../tests/e2e/config'; type SigninParams = { email?: string; @@ -26,6 +27,12 @@ type TestConfig = { [key: string]: string | {autoFocus: boolean}; }; +type Test = (config: TestConfig) => void; + +type TestModule = {default: Test}; + +type Tests = Record, Test>; + type TestResult = { /** Name of the test */ name: string; @@ -49,4 +56,4 @@ type TestResult = { renderCount?: number; }; -export type {SigninParams, IsE2ETestSession, NetworkCacheMap, NetworkCacheEntry, TestConfig, TestResult}; +export type {SigninParams, IsE2ETestSession, NetworkCacheMap, NetworkCacheEntry, TestConfig, TestResult, TestModule, Tests}; diff --git a/src/libs/Environment/betaChecker/index.android.ts b/src/libs/Environment/betaChecker/index.android.ts index 2412a6d50167..56f7f1fced26 100644 --- a/src/libs/Environment/betaChecker/index.android.ts +++ b/src/libs/Environment/betaChecker/index.android.ts @@ -27,7 +27,7 @@ function isBetaBuild(): IsBetaBuild { fetch(CONST.GITHUB_RELEASE_URL) .then((res) => res.json()) .then((json: GithubReleaseJSON) => { - const productionVersion: string | semver.SemVer = json.tag_name; + const productionVersion = json.tag_name; if (!productionVersion) { AppUpdate.setIsAppInBeta(false); resolve(false); diff --git a/src/libs/Navigation/linkTo/index.ts b/src/libs/Navigation/linkTo/index.ts index 859a4964d43c..b82da9e83b4b 100644 --- a/src/libs/Navigation/linkTo/index.ts +++ b/src/libs/Navigation/linkTo/index.ts @@ -28,13 +28,7 @@ import type {Route} from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import getActionForBottomTabNavigator from './getActionForBottomTabNavigator'; import getMinimalAction from './getMinimalAction'; - -type ActionParams = { - screen: string; - params?: { - policyIDs?: string; - }; -}; +import type {ActionPayloadParams} from './types'; export default function linkTo(navigation: NavigationContainerRef | null, path: Route, type?: string, isActiveRoute?: boolean) { if (!navigation) { @@ -75,7 +69,7 @@ export default function linkTo(navigation: NavigationContainerRef).policyIDs = policyID; } // If this action is navigating to ModalNavigator or FullScreenNavigator and the last route on the root navigator is not already opened Navigator then push diff --git a/src/libs/NetworkConnection.ts b/src/libs/NetworkConnection.ts index 9890b149ab2a..5f57278b0efa 100644 --- a/src/libs/NetworkConnection.ts +++ b/src/libs/NetworkConnection.ts @@ -117,7 +117,7 @@ function subscribeToBackendAndInternetReachability(): () => void { } return response .json() - .then((json) => Promise.resolve((json as ResponseJSON).jsonCode === 200)) + .then((json: ResponseJSON) => Promise.resolve(json.jsonCode === 200)) .catch(() => Promise.resolve(false)); }) .then((isBackendReachable: boolean) => { diff --git a/src/libs/fileDownload/index.ios.ts b/src/libs/fileDownload/index.ios.ts index fa816e7a4704..13af80a0a64b 100644 --- a/src/libs/fileDownload/index.ios.ts +++ b/src/libs/fileDownload/index.ios.ts @@ -3,7 +3,7 @@ import type {PhotoIdentifier} from '@react-native-camera-roll/camera-roll'; import RNFetchBlob from 'react-native-blob-util'; import CONST from '@src/CONST'; import * as FileUtils from './FileUtils'; -import type {FileDownload} from './types'; +import type {FileDownload, FileDownloadError} from './types'; /** * Downloads the file to Documents section in iOS @@ -94,10 +94,10 @@ const fileDownload: FileDownload = (fileUrl, fileName, successMessage) => FileUtils.showSuccessAlert(successMessage); }) - .catch((err) => { + .catch((err: FileDownloadError) => { // iOS shows permission popup only once. Subsequent request will only throw an error. // We catch the error and show a redirection link to the settings screen - if ((err as {message?: string}).message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { + if (err.message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { FileUtils.showPermissionErrorAlert(); } else { FileUtils.showGeneralErrorAlert(); diff --git a/src/libs/fileDownload/types.ts b/src/libs/fileDownload/types.ts index fcc210c1c42f..46ecd27b2bea 100644 --- a/src/libs/fileDownload/types.ts +++ b/src/libs/fileDownload/types.ts @@ -1,6 +1,9 @@ import type {Asset} from 'react-native-image-picker'; type FileDownload = (url: string, fileName?: string, successMessage?: string, shouldOpenExternalLink?: boolean) => Promise; +type FileDownloadError = Error & { + message?: string; +}; type ImageResolution = {width: number; height: number}; type GetImageResolution = (url: File | Asset) => Promise; @@ -17,4 +20,4 @@ type AttachmentDetails = { }; type GetAttachmentDetails = (html: string) => AttachmentDetails; -export type {SplitExtensionFromFileName, GetAttachmentDetails, ReadFileAsync, FileDownload, GetImageResolution}; +export type {SplitExtensionFromFileName, GetAttachmentDetails, ReadFileAsync, FileDownload, FileDownloadError, GetImageResolution}; diff --git a/tests/e2e/testRunner.ts b/tests/e2e/testRunner.ts index 5bb7b72a96d3..206891ec1051 100644 --- a/tests/e2e/testRunner.ts +++ b/tests/e2e/testRunner.ts @@ -31,8 +31,7 @@ import withFailTimeout from './utils/withFailTimeout'; type Result = Record; type CustomConfig = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - default: any; + default: unknown; }; // VARIABLE CONFIGURATION @@ -51,7 +50,7 @@ const setConfigPath = (configPathParam: string | undefined) => { if (!configPath?.startsWith('.')) { configPath = `./${configPath}`; } - const customConfig = (require(configPath) as CustomConfig).default; + const customConfig = require(configPath).default; config = Object.assign(defaultConfig, customConfig); }; diff --git a/tests/perf-test/ReportActionsList.perf-test.tsx b/tests/perf-test/ReportActionsList.perf-test.tsx index 64cd6cc4d157..684b874e4d9c 100644 --- a/tests/perf-test/ReportActionsList.perf-test.tsx +++ b/tests/perf-test/ReportActionsList.perf-test.tsx @@ -22,7 +22,7 @@ import * as ReportTestUtils from '../utils/ReportTestUtils'; import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; -type LHNTestUtilsProps = { +type LazyLoadLHNTestUtils = { fakePersonalDetails: PersonalDetailsList; }; @@ -30,13 +30,12 @@ const mockedNavigate = jest.fn(); jest.mock('@components/withCurrentUserPersonalDetails', () => { // Lazy loading of LHNTestUtils - // eslint-disable-next-line @typescript-eslint/no-unsafe-return - const lazyLoadLHNTestUtils = () => require('../utils/LHNTestUtils'); + const lazyLoadLHNTestUtils = () => require('../utils/LHNTestUtils'); return (Component: ComponentType) => { function WrappedComponent(props: Omit) { const currentUserAccountID = 5; - const LHNTestUtils: LHNTestUtilsProps = lazyLoadLHNTestUtils(); // Load LHNTestUtils here + const LHNTestUtils = lazyLoadLHNTestUtils(); // Load LHNTestUtils here return ( void; + const Onyx = MockedOnyx as typeof ReactNativeOnyxMock; jest.mock('@src/libs/Log'); @@ -289,7 +291,7 @@ describe('NetworkTests', () => { test('test Failed to fetch error for non-retryable requests resolve with unable to retry jsonCode', () => { // Setup xhr handler that rejects once with a Failed to Fetch global.fetch = jest.fn().mockRejectedValue(new Error(CONST.ERROR.FAILED_TO_FETCH)); - const onResolved = jest.fn() as jest.MockedFunction<(params: {jsonCode?: string | number}) => void>; + const onResolved = jest.fn() as jest.MockedFunction; // Given we have a request made while online return Onyx.set(ONYXKEYS.NETWORK, {isOffline: false, isBackendReachable: true}) From a4e6bc6378135d1cee33336cd8a6ed681b181aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Wed, 12 Jun 2024 16:59:16 +0200 Subject: [PATCH 13/28] review adjustments --- src/components/AttachmentModal.tsx | 6 +----- src/components/Onfido/types.ts | 1 - .../SignInButtons/GoogleSignIn/index.native.tsx | 4 ++-- src/libs/E2E/reactNativeLaunchingTest.ts | 2 +- src/setup/addUtilsToWindow.ts | 4 ++-- src/types/global.d.ts | 1 + workflow_tests/utils/utils.ts | 16 +++++++++------- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/components/AttachmentModal.tsx b/src/components/AttachmentModal.tsx index d83d3318a636..9cd91cde3459 100644 --- a/src/components/AttachmentModal.tsx +++ b/src/components/AttachmentModal.tsx @@ -140,10 +140,6 @@ type AttachmentModalProps = AttachmentModalOnyxProps & { canEditReceipt?: boolean; }; -type DataWebkitGetAsEntry = { - isDirectory: boolean; -}; - function AttachmentModal({ source = '', onConfirm, @@ -310,7 +306,7 @@ function AttachmentModal({ }, []); const isDirectoryCheck = useCallback((data: FileObject) => { - if ('webkitGetAsEntry' in data && typeof data.webkitGetAsEntry === 'function' && (data.webkitGetAsEntry() as DataWebkitGetAsEntry).isDirectory) { + if ('webkitGetAsEntry' in data && (data as DataTransferItem).webkitGetAsEntry()?.isDirectory) { setIsAttachmentInvalid(true); setAttachmentInvalidReasonTitle('attachmentPicker.attachmentError'); setAttachmentInvalidReason('attachmentPicker.folderNotAllowedMessage'); diff --git a/src/components/Onfido/types.ts b/src/components/Onfido/types.ts index e3c0819ea287..3e88ce3b2dda 100644 --- a/src/components/Onfido/types.ts +++ b/src/components/Onfido/types.ts @@ -26,7 +26,6 @@ type OnfidoProps = { }; type OnfidoError = Error & { - message?: string; type?: string; }; diff --git a/src/components/SignInButtons/GoogleSignIn/index.native.tsx b/src/components/SignInButtons/GoogleSignIn/index.native.tsx index f013208ed291..c18555b6ecc4 100644 --- a/src/components/SignInButtons/GoogleSignIn/index.native.tsx +++ b/src/components/SignInButtons/GoogleSignIn/index.native.tsx @@ -28,14 +28,14 @@ function googleSignInRequest() { .then((token) => Session.beginGoogleSignIn(token)) .catch((error) => { // Handle unexpected error shape - if (error === undefined || (error as GoogleError).code === undefined) { + const googleError = error as GoogleError; + if (error === undefined || googleError.code === undefined) { Log.alert(`[Google Sign In] Google sign in failed: ${error}`); } /** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see: - The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes - The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes */ - const googleError = error as GoogleError; if (googleError.code === statusCodes.SIGN_IN_CANCELLED) { Log.info('[Google Sign In] Google Sign In cancelled'); } else { diff --git a/src/libs/E2E/reactNativeLaunchingTest.ts b/src/libs/E2E/reactNativeLaunchingTest.ts index 450fd14985e4..46922091497c 100644 --- a/src/libs/E2E/reactNativeLaunchingTest.ts +++ b/src/libs/E2E/reactNativeLaunchingTest.ts @@ -12,7 +12,7 @@ import E2EConfig from '../../../tests/e2e/config'; import E2EClient from './client'; import installNetworkInterceptor from './utils/NetworkInterceptor'; import LaunchArgs from './utils/LaunchArgs'; -import type { TestModule, Tests } from './types'; +import type {TestModule, Tests} from './types'; console.debug('=========================='); console.debug('==== Running e2e test ===='); diff --git a/src/setup/addUtilsToWindow.ts b/src/setup/addUtilsToWindow.ts index ebb8ac31ca13..6945d4223f08 100644 --- a/src/setup/addUtilsToWindow.ts +++ b/src/setup/addUtilsToWindow.ts @@ -4,7 +4,7 @@ import markAllPolicyReportsAsRead from '@libs/markAllPolicyReportsAsRead'; import * as Session from '@userActions/Session'; import type {OnyxKey} from '@src/ONYXKEYS'; -type UtilsWindow = Window & +type WindowWithCustomMethods = Window & typeof globalThis & { markAllPolicyReportsAsRead: (policyID: string) => void; }; @@ -50,6 +50,6 @@ export default function addUtilsToWindow() { window.setSupportToken = Session.setSupportAuthToken; // Workaround to give employees the ability to mark reports as read via the JS console - (window as UtilsWindow).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; + (window as WindowWithCustomMethods).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; }); } diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 9cf3e29dd701..ca9d3a34c14a 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -32,6 +32,7 @@ interface Window { setSupportToken: (token: string, email: string, accountID: number) => void; } +// Allows to add generic type in require // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface NodeRequire { // eslint-disable-next-line @typescript-eslint/prefer-function-type, @typescript-eslint/no-explicit-any diff --git a/workflow_tests/utils/utils.ts b/workflow_tests/utils/utils.ts index cac3a1c531d2..77e15c0602eb 100644 --- a/workflow_tests/utils/utils.ts +++ b/workflow_tests/utils/utils.ts @@ -13,14 +13,16 @@ type StepAssertion = { output: string; }; +type Jobs = Record< + string, + { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'runs-on': string; + } +>; + type Workflow = { - jobs: Record< - string, - { - // eslint-disable-next-line @typescript-eslint/naming-convention - 'runs-on': string; - } - >; + jobs: Jobs; }; function setUpActParams( From d4fbe38c52d47009c81c71b1e3ccdeb1294cf847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 13 Jun 2024 16:45:00 +0200 Subject: [PATCH 14/28] fix kie/act-js types --- src/types/modules/act.d.ts | 10 ++++------ workflow_tests/utils/JobMocker.ts | 8 ++++---- workflow_tests/utils/preGenerateTest.ts | 10 ++++------ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index 8a52c6fce2f0..2e89947c24af 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,7 +1,7 @@ -import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { - type StepIdentifierWithoutOmit = { + type StepIdentifierCustom = { id?: string; name: string; run?: string; @@ -9,9 +9,7 @@ declare module '@kie/act-js' { with?: string; envs?: string[]; inputs?: string[]; - }; + } & Omit; - type StepIdentifier = StepIdentifierWithoutOmit & Omit; - - export type {StepIdentifier, StepIdentifierWithoutOmit}; + export type {StepIdentifier, StepIdentifierCustom}; } diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 7e0a6ebc1321..5fe60d287511 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,4 +1,4 @@ -import type {StepIdentifierWithoutOmit} from '@kie/act-js'; +import type {StepIdentifierCustom} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -12,7 +12,7 @@ type YamlWorkflow = { }; type MockJob = { - steps: StepIdentifierWithoutOmit[]; + steps: StepIdentifierCustom[]; uses?: string; secrets?: string[]; with?: string; @@ -50,8 +50,8 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step): StepIdentifierWithoutOmit => { - const mockStep: StepIdentifierWithoutOmit = { + job.steps = mockJob.steps.map((step): StepIdentifierCustom => { + const mockStep: StepIdentifierCustom = { name: step.name, run: step.mockWith, }; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index 9ccd8cce20eb..37fea0b203b8 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,5 +1,5 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {StepIdentifierWithoutOmit} from '@kie/act-js'; +import type {StepIdentifierCustom} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -7,8 +7,6 @@ import {exit} from 'process'; import yaml from 'yaml'; import type {YamlMockJob, YamlWorkflow} from './JobMocker'; -type Step = {name: string; with?: string; envs?: string[]; inputs?: string[]}; - const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); const workflowTestMocksDirectory = path.join(workflowTestsDirectory, 'mocks'); @@ -94,7 +92,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: StepIdentifierWithoutOmit, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: StepIdentifierCustom, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -201,7 +199,7 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { workflowJobs[jobId] = { steps: [], }; - job.steps.forEach((step: Step) => { + job.steps.forEach((step: StepIdentifierCustom) => { const workflowStep = { name: step.name, inputs: Object.keys(step.with ?? {}), @@ -245,7 +243,7 @@ const getAssertionsFileContent = (jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; - job.steps.forEach((step: Step) => { + job.steps.forEach((step: StepIdentifierCustom) => { stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; From 04fcd4bc001048035dcb52a5b3548e13e6b09a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Thu, 13 Jun 2024 17:15:23 +0200 Subject: [PATCH 15/28] fix kie/act-js types --- .github/actions/javascript/authorChecklist/index.js | 2 +- src/types/modules/act.d.ts | 9 ++++----- workflow_tests/utils/JobMocker.ts | 8 ++++---- workflow_tests/utils/preGenerateTest.ts | 8 ++++---- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 337fe7398fb3..b4a86aab43cb 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -16967,7 +16967,7 @@ async function detectReactComponentInFile(filename) { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, path: filename, - ref: github.context.payload.pull_request?.head.ref, + ref: github.context.payload?.pull_request?.head.ref, }; try { const { data } = await GithubUtils_1.default.octokit.repos.getContent(params); diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index 2e89947c24af..e07c1f5b03bb 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,7 +1,8 @@ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { - type StepIdentifierCustom = { + // eslint-disable-next-line rulesdir/no-inline-named-export + export declare type StepIdentifier = { id?: string; name: string; run?: string; @@ -9,7 +10,5 @@ declare module '@kie/act-js' { with?: string; envs?: string[]; inputs?: string[]; - } & Omit; - - export type {StepIdentifier, StepIdentifierCustom}; + } & Omit; } diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 5fe60d287511..dadb85014d01 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,4 +1,4 @@ -import type {StepIdentifierCustom} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -12,7 +12,7 @@ type YamlWorkflow = { }; type MockJob = { - steps: StepIdentifierCustom[]; + steps: StepIdentifier[]; uses?: string; secrets?: string[]; with?: string; @@ -50,8 +50,8 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step): StepIdentifierCustom => { - const mockStep: StepIdentifierCustom = { + job.steps = mockJob.steps.map((step): StepIdentifier => { + const mockStep: StepIdentifier = { name: step.name, run: step.mockWith, }; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index 37fea0b203b8..ea5f13901b9c 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,5 +1,5 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {StepIdentifierCustom} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -92,7 +92,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: StepIdentifierCustom, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: StepIdentifier, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -199,7 +199,7 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { workflowJobs[jobId] = { steps: [], }; - job.steps.forEach((step: StepIdentifierCustom) => { + job.steps.forEach((step: StepIdentifier) => { const workflowStep = { name: step.name, inputs: Object.keys(step.with ?? {}), @@ -243,7 +243,7 @@ const getAssertionsFileContent = (jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; - job.steps.forEach((step: StepIdentifierCustom) => { + job.steps.forEach((step: StepIdentifier) => { stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; From 852ef29db64a74b2b48589ff1d013647c06d468a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Fri, 14 Jun 2024 12:56:13 +0200 Subject: [PATCH 16/28] wip --- src/types/modules/act.d.ts | 15 ++++++++------ workflow_tests/utils/JobMocker.ts | 14 ++++++------- workflow_tests/utils/preGenerateTest.ts | 27 ++++++++++++++++--------- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index e07c1f5b03bb..316d44517812 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,14 +1,17 @@ -import type {StepIdentifier as ActStepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier as ActStepIdentifier, GithubWorkflowStep, StepIdentifierUsingId, StepIdentifierUsingName} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { - // eslint-disable-next-line rulesdir/no-inline-named-export - export declare type StepIdentifier = { + type CustemStepIdentifier = { id?: string; name: string; - run?: string; - mockWith?: string; + run?: string | GithubWorkflowStep; + mockWith?: string | GithubWorkflowStep; with?: string; envs?: string[]; inputs?: string[]; - } & Omit; + }; + + type StepIdentifier = ActStepIdentifier; + + export type {StepIdentifierUsingId, StepIdentifierUsingName, GithubWorkflowStep, StepIdentifier, CustemStepIdentifier}; } diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index dadb85014d01..d91f41b9aaa6 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,4 +1,4 @@ -import type {StepIdentifier} from '@kie/act-js'; +import type {CustemStepIdentifier, StepIdentifier, StepIdentifierUsingName} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -12,7 +12,7 @@ type YamlWorkflow = { }; type MockJob = { - steps: StepIdentifier[]; + steps: Array; uses?: string; secrets?: string[]; with?: string; @@ -50,13 +50,13 @@ class JobMocker { jobWith = job.with; delete job.with; } - job.steps = mockJob.steps.map((step): StepIdentifier => { - const mockStep: StepIdentifier = { - name: step.name, + job.steps = mockJob.steps.map((step) => { + const mockStep: CustemStepIdentifier = { + name: (step as StepIdentifierUsingName).name, run: step.mockWith, }; - if (step.id) { - mockStep.id = step.id; + if ((step as CustemStepIdentifier).id) { + mockStep.id = (step as CustemStepIdentifier).id; } if (jobWith) { mockStep.with = jobWith; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index ea5f13901b9c..895e345cb92a 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,5 +1,5 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {StepIdentifier} from '@kie/act-js'; +import type {CustemStepIdentifier, StepIdentifier} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -92,7 +92,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: StepIdentifier, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: CustemStepIdentifier, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -199,11 +199,12 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { workflowJobs[jobId] = { steps: [], }; - job.steps.forEach((step: StepIdentifier) => { + job.steps.forEach((step) => { + const step2 = step as CustemStepIdentifier; const workflowStep = { - name: step.name, - inputs: Object.keys(step.with ?? {}), - envs: step.envs ?? [], + name: step2.name ?? '', + inputs: Object.keys(step2.with ?? {}), + envs: step2.envs ?? [], }; workflowJobs[jobId].steps.push(workflowStep); }); @@ -217,7 +218,7 @@ const getMockFileContent = (workflowName: string, jobs: Record { - const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${step.name + const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${(step as CustemStepIdentifier).name .replaceAll(' ', '_') .replaceAll('-', '_') .replaceAll(',', '') @@ -226,7 +227,7 @@ const getMockFileContent = (workflowName: string, jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; - job.steps.forEach((step: StepIdentifier) => { - stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs); + job.steps.forEach((step: CustemStepIdentifier | StepIdentifier) => { + stepAssertionsContent += stepAssertionTemplate( + (step as CustemStepIdentifier).name, + jobId.toUpperCase(), + (step as CustemStepIdentifier).name, + (step as CustemStepIdentifier).inputs, + (step as CustemStepIdentifier).envs, + ); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; jobAssertions.push(jobAssertionName); From d7b053c0b5d7fcd60fb5889a59234f65beb57be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Fri, 14 Jun 2024 15:41:17 +0200 Subject: [PATCH 17/28] improve custom step identifier type --- src/types/modules/act.d.ts | 8 +++----- workflow_tests/utils/JobMocker.ts | 9 +++++---- workflow_tests/utils/preGenerateTest.ts | 14 +++++--------- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index 316d44517812..0d53d171f695 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,4 +1,4 @@ -import type {StepIdentifier as ActStepIdentifier, GithubWorkflowStep, StepIdentifierUsingId, StepIdentifierUsingName} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { type CustemStepIdentifier = { @@ -9,9 +9,7 @@ declare module '@kie/act-js' { with?: string; envs?: string[]; inputs?: string[]; - }; + } & Omit; - type StepIdentifier = ActStepIdentifier; - - export type {StepIdentifierUsingId, StepIdentifierUsingName, GithubWorkflowStep, StepIdentifier, CustemStepIdentifier}; + export type {GithubWorkflowStep, StepIdentifier, CustemStepIdentifier}; } diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index d91f41b9aaa6..83f44331aac9 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,4 +1,4 @@ -import type {CustemStepIdentifier, StepIdentifier, StepIdentifierUsingName} from '@kie/act-js'; +import type {CustemStepIdentifier, StepIdentifier} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; @@ -51,12 +51,13 @@ class JobMocker { delete job.with; } job.steps = mockJob.steps.map((step) => { + const customStep = step as CustemStepIdentifier; const mockStep: CustemStepIdentifier = { - name: (step as StepIdentifierUsingName).name, + name: customStep.name, run: step.mockWith, }; - if ((step as CustemStepIdentifier).id) { - mockStep.id = (step as CustemStepIdentifier).id; + if (customStep.id) { + mockStep.id = customStep.id; } if (jobWith) { mockStep.with = jobWith; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index 895e345cb92a..f358e9308915 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -218,7 +218,8 @@ const getMockFileContent = (workflowName: string, jobs: Record { - const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${(step as CustemStepIdentifier).name + const customStep = step as CustemStepIdentifier; + const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${customStep.name .replaceAll(' ', '_') .replaceAll('-', '_') .replaceAll(',', '') @@ -227,7 +228,7 @@ const getMockFileContent = (workflowName: string, jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; job.steps.forEach((step: CustemStepIdentifier | StepIdentifier) => { - stepAssertionsContent += stepAssertionTemplate( - (step as CustemStepIdentifier).name, - jobId.toUpperCase(), - (step as CustemStepIdentifier).name, - (step as CustemStepIdentifier).inputs, - (step as CustemStepIdentifier).envs, - ); + const customStep = step as CustemStepIdentifier; + stepAssertionsContent += stepAssertionTemplate(customStep.name, jobId.toUpperCase(), customStep.name, customStep.inputs, customStep.envs); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; jobAssertions.push(jobAssertionName); From 0dfd63ccfc0f04988b739c1924ca248d3664773b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Fri, 14 Jun 2024 15:55:00 +0200 Subject: [PATCH 18/28] remove redundant module --- src/types/modules/act.d.ts | 15 --------------- workflow_tests/mocks/createNewVersionMocks.ts | 2 +- workflow_tests/mocks/deployBlockerMocks.ts | 2 +- workflow_tests/mocks/deployMocks.ts | 2 +- workflow_tests/mocks/finishReleaseCycleMocks.ts | 2 +- workflow_tests/mocks/lintMocks.ts | 2 +- workflow_tests/utils/JobMocker.ts | 3 ++- workflow_tests/utils/preGenerateTest.ts | 3 ++- workflow_tests/utils/types.ts | 13 +++++++++++++ 9 files changed, 22 insertions(+), 22 deletions(-) delete mode 100644 src/types/modules/act.d.ts create mode 100644 workflow_tests/utils/types.ts diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts deleted file mode 100644 index 0d53d171f695..000000000000 --- a/src/types/modules/act.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; - -declare module '@kie/act-js' { - type CustemStepIdentifier = { - id?: string; - name: string; - run?: string | GithubWorkflowStep; - mockWith?: string | GithubWorkflowStep; - with?: string; - envs?: string[]; - inputs?: string[]; - } & Omit; - - export type {GithubWorkflowStep, StepIdentifier, CustemStepIdentifier}; -} diff --git a/workflow_tests/mocks/createNewVersionMocks.ts b/workflow_tests/mocks/createNewVersionMocks.ts index dd094e6459e8..4703b13e3779 100644 --- a/workflow_tests/mocks/createNewVersionMocks.ts +++ b/workflow_tests/mocks/createNewVersionMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; // validateactor diff --git a/workflow_tests/mocks/deployBlockerMocks.ts b/workflow_tests/mocks/deployBlockerMocks.ts index b60d41383a1e..a5b26f876103 100644 --- a/workflow_tests/mocks/deployBlockerMocks.ts +++ b/workflow_tests/mocks/deployBlockerMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; // updateChecklist diff --git a/workflow_tests/mocks/deployMocks.ts b/workflow_tests/mocks/deployMocks.ts index 2fda1efe8e78..f7d0c7132f7a 100644 --- a/workflow_tests/mocks/deployMocks.ts +++ b/workflow_tests/mocks/deployMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; const DEPLOY_STAGING__CHECKOUT__STEP_MOCK = createMockStep('Checkout staging branch', 'Checking out staging branch', 'DEPLOY_STAGING', ['ref', 'token']); diff --git a/workflow_tests/mocks/finishReleaseCycleMocks.ts b/workflow_tests/mocks/finishReleaseCycleMocks.ts index 23d81a557705..2c5d84488e3f 100644 --- a/workflow_tests/mocks/finishReleaseCycleMocks.ts +++ b/workflow_tests/mocks/finishReleaseCycleMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; // validate diff --git a/workflow_tests/mocks/lintMocks.ts b/workflow_tests/mocks/lintMocks.ts index 27ce53afc1f4..a3eb2b61cbc5 100644 --- a/workflow_tests/mocks/lintMocks.ts +++ b/workflow_tests/mocks/lintMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import {createMockStep} from '../utils/utils'; // lint diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 83f44331aac9..14e721eb3612 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,8 +1,9 @@ -import type {CustemStepIdentifier, StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; +import type CustemStepIdentifier from './types'; // eslint-disable-next-line @typescript-eslint/naming-convention type YamlMockJob = Omit & {'runs-on'?: string}; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index f358e9308915..ac90e690b72e 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,11 +1,12 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {CustemStepIdentifier, StepIdentifier} from '@kie/act-js'; +import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; import {exit} from 'process'; import yaml from 'yaml'; import type {YamlMockJob, YamlWorkflow} from './JobMocker'; +import type CustemStepIdentifier from './types'; const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); diff --git a/workflow_tests/utils/types.ts b/workflow_tests/utils/types.ts new file mode 100644 index 000000000000..79b2e7756498 --- /dev/null +++ b/workflow_tests/utils/types.ts @@ -0,0 +1,13 @@ +import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; + +type CustemStepIdentifier = { + id?: string; + name: string; + run?: string | GithubWorkflowStep; + mockWith?: string | GithubWorkflowStep; + with?: string; + envs?: string[]; + inputs?: string[]; +} & Omit; + +export default CustemStepIdentifier; From c708fe4e49ff83835519b1daaad1725c67c1e675 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 17 Jun 2024 15:38:28 +0200 Subject: [PATCH 19/28] Fix @kie/act-js types --- src/types/modules/act.d.ts | 17 +++++++++++++ workflow_tests/authorChecklist.test.ts | 2 +- workflow_tests/cherryPick.test.ts | 2 +- workflow_tests/failureNotifier.test.ts | 2 +- workflow_tests/lockDeploys.test.ts | 2 +- workflow_tests/mocks/authorChecklistMocks.ts | 2 +- workflow_tests/mocks/cherryPickMocks.ts | 2 +- workflow_tests/mocks/createNewVersionMocks.ts | 2 +- workflow_tests/mocks/deployBlockerMocks.ts | 2 +- workflow_tests/mocks/deployMocks.ts | 2 +- .../mocks/finishReleaseCycleMocks.ts | 2 +- workflow_tests/mocks/lintMocks.ts | 2 +- workflow_tests/platformDeploy.test.ts | 2 +- workflow_tests/preDeploy.test.ts | 2 +- workflow_tests/reviewerChecklist.test.ts | 2 +- workflow_tests/test.test.ts | 2 +- workflow_tests/utils/JobMocker.ts | 16 ++++++------- workflow_tests/utils/preGenerateTest.ts | 24 ++++++++----------- workflow_tests/utils/types.ts | 13 ---------- workflow_tests/utils/utils.ts | 2 +- 20 files changed, 50 insertions(+), 52 deletions(-) create mode 100644 src/types/modules/act.d.ts delete mode 100644 workflow_tests/utils/types.ts diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts new file mode 100644 index 000000000000..da2041d430b9 --- /dev/null +++ b/src/types/modules/act.d.ts @@ -0,0 +1,17 @@ +import type {MockStep as ActMockStep, StepIdentifier as ActStepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; + +declare module '@kie/act-js' { + type StepIdentifier = ActStepIdentifier & { + id?: string; + name: string; + run?: string; + mockWith?: string; + with?: string; + envs?: string[]; + inputs?: string[]; + }; + + type MockStep = ActMockStep; + + export type {StepIdentifier, MockStep}; +} diff --git a/workflow_tests/authorChecklist.test.ts b/workflow_tests/authorChecklist.test.ts index 84509818ff61..a40b183f6d7a 100644 --- a/workflow_tests/authorChecklist.test.ts +++ b/workflow_tests/authorChecklist.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/cherryPick.test.ts b/workflow_tests/cherryPick.test.ts index 56ce851755b6..964be3ec427d 100644 --- a/workflow_tests/cherryPick.test.ts +++ b/workflow_tests/cherryPick.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/failureNotifier.test.ts b/workflow_tests/failureNotifier.test.ts index 07ebb45517b3..772cd5d28050 100644 --- a/workflow_tests/failureNotifier.test.ts +++ b/workflow_tests/failureNotifier.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/lockDeploys.test.ts b/workflow_tests/lockDeploys.test.ts index c9b083b4d804..7ffb4ed87b7a 100644 --- a/workflow_tests/lockDeploys.test.ts +++ b/workflow_tests/lockDeploys.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/mocks/authorChecklistMocks.ts b/workflow_tests/mocks/authorChecklistMocks.ts index 50e90ddae799..34e6b0984e83 100644 --- a/workflow_tests/mocks/authorChecklistMocks.ts +++ b/workflow_tests/mocks/authorChecklistMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // checklist diff --git a/workflow_tests/mocks/cherryPickMocks.ts b/workflow_tests/mocks/cherryPickMocks.ts index c1a33be868d6..13d7ebf95bfd 100644 --- a/workflow_tests/mocks/cherryPickMocks.ts +++ b/workflow_tests/mocks/cherryPickMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // validateactor diff --git a/workflow_tests/mocks/createNewVersionMocks.ts b/workflow_tests/mocks/createNewVersionMocks.ts index 4703b13e3779..dd094e6459e8 100644 --- a/workflow_tests/mocks/createNewVersionMocks.ts +++ b/workflow_tests/mocks/createNewVersionMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // validateactor diff --git a/workflow_tests/mocks/deployBlockerMocks.ts b/workflow_tests/mocks/deployBlockerMocks.ts index a5b26f876103..b60d41383a1e 100644 --- a/workflow_tests/mocks/deployBlockerMocks.ts +++ b/workflow_tests/mocks/deployBlockerMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // updateChecklist diff --git a/workflow_tests/mocks/deployMocks.ts b/workflow_tests/mocks/deployMocks.ts index f7d0c7132f7a..2fda1efe8e78 100644 --- a/workflow_tests/mocks/deployMocks.ts +++ b/workflow_tests/mocks/deployMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; const DEPLOY_STAGING__CHECKOUT__STEP_MOCK = createMockStep('Checkout staging branch', 'Checking out staging branch', 'DEPLOY_STAGING', ['ref', 'token']); diff --git a/workflow_tests/mocks/finishReleaseCycleMocks.ts b/workflow_tests/mocks/finishReleaseCycleMocks.ts index 2c5d84488e3f..23d81a557705 100644 --- a/workflow_tests/mocks/finishReleaseCycleMocks.ts +++ b/workflow_tests/mocks/finishReleaseCycleMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // validate diff --git a/workflow_tests/mocks/lintMocks.ts b/workflow_tests/mocks/lintMocks.ts index a3eb2b61cbc5..27ce53afc1f4 100644 --- a/workflow_tests/mocks/lintMocks.ts +++ b/workflow_tests/mocks/lintMocks.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import {createMockStep} from '../utils/utils'; // lint diff --git a/workflow_tests/platformDeploy.test.ts b/workflow_tests/platformDeploy.test.ts index 0ac68eb6d55b..f3247acd0d14 100644 --- a/workflow_tests/platformDeploy.test.ts +++ b/workflow_tests/platformDeploy.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/preDeploy.test.ts b/workflow_tests/preDeploy.test.ts index 1739fec13815..a69356f84972 100644 --- a/workflow_tests/preDeploy.test.ts +++ b/workflow_tests/preDeploy.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/reviewerChecklist.test.ts b/workflow_tests/reviewerChecklist.test.ts index d70afd31f115..1fea2b60008c 100644 --- a/workflow_tests/reviewerChecklist.test.ts +++ b/workflow_tests/reviewerChecklist.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/test.test.ts b/workflow_tests/test.test.ts index 085a2b3902d6..fe189f2a8e8a 100644 --- a/workflow_tests/test.test.ts +++ b/workflow_tests/test.test.ts @@ -1,4 +1,4 @@ -import type {MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {MockStep} from '@kie/act-js'; import {MockGithub} from '@kie/mock-github'; import type {CreateRepositoryFile} from '@kie/mock-github'; import path from 'path'; diff --git a/workflow_tests/utils/JobMocker.ts b/workflow_tests/utils/JobMocker.ts index 14e721eb3612..78be5c5861e6 100644 --- a/workflow_tests/utils/JobMocker.ts +++ b/workflow_tests/utils/JobMocker.ts @@ -1,9 +1,8 @@ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import type {PathOrFileDescriptor} from 'fs'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; -import type CustemStepIdentifier from './types'; // eslint-disable-next-line @typescript-eslint/naming-convention type YamlMockJob = Omit & {'runs-on'?: string}; @@ -13,7 +12,7 @@ type YamlWorkflow = { }; type MockJob = { - steps: Array; + steps: StepIdentifier[]; uses?: string; secrets?: string[]; with?: string; @@ -52,13 +51,12 @@ class JobMocker { delete job.with; } job.steps = mockJob.steps.map((step) => { - const customStep = step as CustemStepIdentifier; - const mockStep: CustemStepIdentifier = { - name: customStep.name, + const mockStep = { + name: step.name, run: step.mockWith, - }; - if (customStep.id) { - mockStep.id = customStep.id; + } as StepIdentifier; + if (step.id) { + mockStep.id = step.id; } if (jobWith) { mockStep.with = jobWith; diff --git a/workflow_tests/utils/preGenerateTest.ts b/workflow_tests/utils/preGenerateTest.ts index ac90e690b72e..1fbbd6e3de4c 100644 --- a/workflow_tests/utils/preGenerateTest.ts +++ b/workflow_tests/utils/preGenerateTest.ts @@ -1,12 +1,11 @@ /* eslint no-console: ["error", { allow: ["warn", "log"] }] */ -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {StepIdentifier} from '@kie/act-js'; import type {PathLike} from 'fs'; import fs from 'fs'; import path from 'path'; import {exit} from 'process'; import yaml from 'yaml'; import type {YamlMockJob, YamlWorkflow} from './JobMocker'; -import type CustemStepIdentifier from './types'; const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows'); const workflowTestsDirectory = path.resolve(__dirname, '..'); @@ -93,7 +92,7 @@ describe('test workflow ${workflowName}', () => { }); `; -const mockStepTemplate = (stepMockName: string, step: CustemStepIdentifier, jobId: string | undefined) => ` +const mockStepTemplate = (stepMockName: string, step: StepIdentifier, jobId: string | undefined) => ` const ${stepMockName} = utils.createMockStep( '${step.name ?? ''}', '${step.name ?? ''}', @@ -201,12 +200,11 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => { steps: [], }; job.steps.forEach((step) => { - const step2 = step as CustemStepIdentifier; const workflowStep = { - name: step2.name ?? '', - inputs: Object.keys(step2.with ?? {}), - envs: step2.envs ?? [], - }; + name: step.name ?? '', + inputs: Object.keys(step.with ?? {}), + envs: step.envs ?? [], + } as StepIdentifier; workflowJobs[jobId].steps.push(workflowStep); }); }); @@ -219,8 +217,7 @@ const getMockFileContent = (workflowName: string, jobs: Record { - const customStep = step as CustemStepIdentifier; - const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${customStep.name + const stepMockName = `${workflowName.toUpperCase()}__${jobId.toUpperCase()}__${step.name .replaceAll(' ', '_') .replaceAll('-', '_') .replaceAll(',', '') @@ -229,7 +226,7 @@ const getMockFileContent = (workflowName: string, jobs: Record): string => Object.entries(jobs).forEach(([jobId, job]) => { let stepAssertionsContent = ''; - job.steps.forEach((step: CustemStepIdentifier | StepIdentifier) => { - const customStep = step as CustemStepIdentifier; - stepAssertionsContent += stepAssertionTemplate(customStep.name, jobId.toUpperCase(), customStep.name, customStep.inputs, customStep.envs); + job.steps.forEach((step: StepIdentifier) => { + stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs); }); const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`; jobAssertions.push(jobAssertionName); diff --git a/workflow_tests/utils/types.ts b/workflow_tests/utils/types.ts deleted file mode 100644 index 79b2e7756498..000000000000 --- a/workflow_tests/utils/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type {GithubWorkflowStep, StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; - -type CustemStepIdentifier = { - id?: string; - name: string; - run?: string | GithubWorkflowStep; - mockWith?: string | GithubWorkflowStep; - with?: string; - envs?: string[]; - inputs?: string[]; -} & Omit; - -export default CustemStepIdentifier; diff --git a/workflow_tests/utils/utils.ts b/workflow_tests/utils/utils.ts index 77e15c0602eb..e0ff88a3a5bd 100644 --- a/workflow_tests/utils/utils.ts +++ b/workflow_tests/utils/utils.ts @@ -1,5 +1,5 @@ +import type {StepIdentifier} from '@kie/act-js'; import type {EventJSON} from '@kie/act-js/build/src/action-event/action-event.types'; -import type {StepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; From 98591587bf689b0c61b7aeb8a1c18b2297b069cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Mon, 17 Jun 2024 16:10:26 +0200 Subject: [PATCH 20/28] move EventJSON export to custom module --- src/types/modules/act.d.ts | 7 +++---- workflow_tests/utils/utils.ts | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/types/modules/act.d.ts b/src/types/modules/act.d.ts index da2041d430b9..43b13a47d3f0 100644 --- a/src/types/modules/act.d.ts +++ b/src/types/modules/act.d.ts @@ -1,4 +1,5 @@ -import type {MockStep as ActMockStep, StepIdentifier as ActStepIdentifier} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; +import type {EventJSON} from '@kie/act-js/build/src/action-event/action-event.types'; +import type {StepIdentifier as ActStepIdentifier, MockStep} from '@kie/act-js/build/src/step-mocker/step-mocker.types'; declare module '@kie/act-js' { type StepIdentifier = ActStepIdentifier & { @@ -11,7 +12,5 @@ declare module '@kie/act-js' { inputs?: string[]; }; - type MockStep = ActMockStep; - - export type {StepIdentifier, MockStep}; + export type {StepIdentifier, MockStep, EventJSON}; } diff --git a/workflow_tests/utils/utils.ts b/workflow_tests/utils/utils.ts index e0ff88a3a5bd..494f830fb744 100644 --- a/workflow_tests/utils/utils.ts +++ b/workflow_tests/utils/utils.ts @@ -1,5 +1,4 @@ -import type {StepIdentifier} from '@kie/act-js'; -import type {EventJSON} from '@kie/act-js/build/src/action-event/action-event.types'; +import type {EventJSON, StepIdentifier} from '@kie/act-js'; import fs from 'fs'; import path from 'path'; import yaml from 'yaml'; From 2156f681320b853be5fd904b084b1145e8dcf994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Tue, 18 Jun 2024 11:47:14 +0200 Subject: [PATCH 21/28] review adjustments --- .../SignInButtons/GoogleSignIn/index.native.tsx | 12 ++++++------ src/libs/E2E/tests/linkingTest.e2e.ts | 4 ++-- src/libs/fileDownload/index.ios.ts | 4 ++-- src/libs/fileDownload/types.ts | 5 +---- src/setup/addUtilsToWindow.ts | 7 +------ src/types/global.d.ts | 1 + tests/unit/MiddlewareTest.ts | 8 ++++---- 7 files changed, 17 insertions(+), 24 deletions(-) diff --git a/src/components/SignInButtons/GoogleSignIn/index.native.tsx b/src/components/SignInButtons/GoogleSignIn/index.native.tsx index c18555b6ecc4..4a70a10ef017 100644 --- a/src/components/SignInButtons/GoogleSignIn/index.native.tsx +++ b/src/components/SignInButtons/GoogleSignIn/index.native.tsx @@ -26,20 +26,20 @@ function googleSignInRequest() { GoogleSignin.signIn() .then((response) => response.idToken) .then((token) => Session.beginGoogleSignIn(token)) - .catch((error) => { + .catch((error: GoogleError | undefined) => { // Handle unexpected error shape - const googleError = error as GoogleError; - if (error === undefined || googleError.code === undefined) { - Log.alert(`[Google Sign In] Google sign in failed: ${error}`); + if (error?.code === undefined) { + Log.alert(`[Google Sign In] Google sign in failed: ${JSON.stringify(error)}`); + return; } /** The logged code is useful for debugging any new errors that are not specifically handled. To decode, see: - The common status codes documentation: https://developers.google.com/android/reference/com/google/android/gms/common/api/CommonStatusCodes - The Google Sign In codes documentation: https://developers.google.com/android/reference/com/google/android/gms/auth/api/signin/GoogleSignInStatusCodes */ - if (googleError.code === statusCodes.SIGN_IN_CANCELLED) { + if (error.code === statusCodes.SIGN_IN_CANCELLED) { Log.info('[Google Sign In] Google Sign In cancelled'); } else { - Log.alert(`[Google Sign In] Error Code: ${googleError.code}. ${googleError.message}`, {}, false); + Log.alert(`[Google Sign In] Error Code: ${error.code}. ${error.message}`, {}, false); } }); } diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 0e02c4af2a1f..64b75780795d 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -11,7 +11,7 @@ import Performance from '@libs/Performance'; import CONST from '@src/CONST'; import ROUTES from '@src/ROUTES'; -type Item = { +type ViewableItem = { reportActionID?: string; }; @@ -49,7 +49,7 @@ const test = (config: NativeConfig) => { const res = getViewableItems(); console.debug('[E2E] Viewable items retrieved, verifying correct messageā€¦'); - if (!!res && (res[0]?.item as Item)?.reportActionID === linkedReportActionID) { + if (!!res && (res[0]?.item as ViewableItem)?.reportActionID === linkedReportActionID) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, name: 'Comment linking', diff --git a/src/libs/fileDownload/index.ios.ts b/src/libs/fileDownload/index.ios.ts index 13af80a0a64b..0e6701dbda3a 100644 --- a/src/libs/fileDownload/index.ios.ts +++ b/src/libs/fileDownload/index.ios.ts @@ -3,7 +3,7 @@ import type {PhotoIdentifier} from '@react-native-camera-roll/camera-roll'; import RNFetchBlob from 'react-native-blob-util'; import CONST from '@src/CONST'; import * as FileUtils from './FileUtils'; -import type {FileDownload, FileDownloadError} from './types'; +import type {FileDownload} from './types'; /** * Downloads the file to Documents section in iOS @@ -94,7 +94,7 @@ const fileDownload: FileDownload = (fileUrl, fileName, successMessage) => FileUtils.showSuccessAlert(successMessage); }) - .catch((err: FileDownloadError) => { + .catch((err: Error) => { // iOS shows permission popup only once. Subsequent request will only throw an error. // We catch the error and show a redirection link to the settings screen if (err.message === CONST.IOS_CAMERAROLL_ACCESS_ERROR) { diff --git a/src/libs/fileDownload/types.ts b/src/libs/fileDownload/types.ts index 46ecd27b2bea..fcc210c1c42f 100644 --- a/src/libs/fileDownload/types.ts +++ b/src/libs/fileDownload/types.ts @@ -1,9 +1,6 @@ import type {Asset} from 'react-native-image-picker'; type FileDownload = (url: string, fileName?: string, successMessage?: string, shouldOpenExternalLink?: boolean) => Promise; -type FileDownloadError = Error & { - message?: string; -}; type ImageResolution = {width: number; height: number}; type GetImageResolution = (url: File | Asset) => Promise; @@ -20,4 +17,4 @@ type AttachmentDetails = { }; type GetAttachmentDetails = (html: string) => AttachmentDetails; -export type {SplitExtensionFromFileName, GetAttachmentDetails, ReadFileAsync, FileDownload, FileDownloadError, GetImageResolution}; +export type {SplitExtensionFromFileName, GetAttachmentDetails, ReadFileAsync, FileDownload, GetImageResolution}; diff --git a/src/setup/addUtilsToWindow.ts b/src/setup/addUtilsToWindow.ts index 6945d4223f08..9cdbbac06a65 100644 --- a/src/setup/addUtilsToWindow.ts +++ b/src/setup/addUtilsToWindow.ts @@ -4,11 +4,6 @@ import markAllPolicyReportsAsRead from '@libs/markAllPolicyReportsAsRead'; import * as Session from '@userActions/Session'; import type {OnyxKey} from '@src/ONYXKEYS'; -type WindowWithCustomMethods = Window & - typeof globalThis & { - markAllPolicyReportsAsRead: (policyID: string) => void; - }; - /** * This is used to inject development/debugging utilities into the window object on web and desktop. * We do this only on non-production builds - these should not be used in any application code. @@ -50,6 +45,6 @@ export default function addUtilsToWindow() { window.setSupportToken = Session.setSupportAuthToken; // Workaround to give employees the ability to mark reports as read via the JS console - (window as WindowWithCustomMethods).markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; + window.markAllPolicyReportsAsRead = markAllPolicyReportsAsRead; }); } diff --git a/src/types/global.d.ts b/src/types/global.d.ts index ca9d3a34c14a..cb3cba68cce5 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -30,6 +30,7 @@ declare module '*.lottie' { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions interface Window { setSupportToken: (token: string, email: string, accountID: number) => void; + markAllPolicyReportsAsRead: (policyID: string) => void; } // Allows to add generic type in require diff --git a/tests/unit/MiddlewareTest.ts b/tests/unit/MiddlewareTest.ts index 49a19dd89cd5..be13ded01342 100644 --- a/tests/unit/MiddlewareTest.ts +++ b/tests/unit/MiddlewareTest.ts @@ -51,12 +51,12 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[1] as unknown[])[1] as FormDataObject).body, { + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[1] as FormDataObject[])[1].body, { reportID: '1234', reportActionID: '5678', }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[0] as unknown[])[1] as FormDataObject).body, { + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[0] as FormDataObject[])[1].body, { reportID: '1234', }); }); @@ -100,12 +100,12 @@ describe('Middleware', () => { expect(global.fetch).toHaveBeenCalledTimes(2); expect(global.fetch).toHaveBeenLastCalledWith('https://www.expensify.com.dev/api/AddComment?', expect.anything()); - TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[1] as unknown[])[1] as FormDataObject).body, { + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[1] as FormDataObject[])[1].body, { reportID: '5555', reportActionID: '5678', }); expect(global.fetch).toHaveBeenNthCalledWith(1, 'https://www.expensify.com.dev/api/OpenReport?', expect.anything()); - TestHelper.assertFormDataMatchesObject((((global.fetch as jest.Mock).mock.calls[0] as unknown[])[1] as FormDataObject).body, {reportID: '1234'}); + TestHelper.assertFormDataMatchesObject(((global.fetch as jest.Mock).mock.calls[0] as FormDataObject[])[1].body, {reportID: '1234'}); }); }); }); From c47a90892c8ab7d691cea307937b36b7eedab6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Tue, 18 Jun 2024 12:27:27 +0200 Subject: [PATCH 22/28] review adjustments --- .storybook/webpack.config.ts | 6 +++++- __mocks__/react-native-webview.ts | 4 +++- desktop/createDownloadQueue.ts | 6 +++++- desktop/main.ts | 4 ++-- src/libs/E2E/tests/linkingTest.e2e.ts | 2 +- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.storybook/webpack.config.ts b/.storybook/webpack.config.ts index 0fc3005a3fd7..a7811a5a387d 100644 --- a/.storybook/webpack.config.ts +++ b/.storybook/webpack.config.ts @@ -21,6 +21,10 @@ type CustomWebpackConfig = { type CustomWebpackFunction = ({file, platform}: Environment) => CustomWebpackConfig; +type WebpackModule = { + default: CustomWebpackFunction; +}; + let envFile: string; switch (process.env.ENV) { case 'production': @@ -34,7 +38,7 @@ switch (process.env.ENV) { } const env = dotenv.config({path: path.resolve(__dirname, `../${envFile}`)}); -const customFunction = require<{default: CustomWebpackFunction}>('../config/webpack/webpack.common').default; +const customFunction = require('../config/webpack/webpack.common').default; const custom: CustomWebpackConfig = customFunction({file: envFile}); diff --git a/__mocks__/react-native-webview.ts b/__mocks__/react-native-webview.ts index 41713f05bf48..0b4f07ff98c2 100644 --- a/__mocks__/react-native-webview.ts +++ b/__mocks__/react-native-webview.ts @@ -1,7 +1,9 @@ import type {View as RNView} from 'react-native'; +type ReactNative = {View: RNView}; + jest.mock('react-native-webview', () => { - const {View} = require<{View: RNView}>('react-native'); + const {View} = require('react-native'); return { WebView: () => View, }; diff --git a/desktop/createDownloadQueue.ts b/desktop/createDownloadQueue.ts index 4403f989263c..8cc9fef4bbe2 100644 --- a/desktop/createDownloadQueue.ts +++ b/desktop/createDownloadQueue.ts @@ -22,6 +22,10 @@ type CreateDownloadQueue = () => { dequeueDownloadItem: () => DownloadItem | undefined; }; +type CreateDownloadQueueModule = { + default: CreateDownloadQueue; +}; + /** * Returns the filename with extension based on the given name and MIME type. * @param name - The name of the file. @@ -119,4 +123,4 @@ const createDownloadQueue: CreateDownloadQueue = () => { }; export default createDownloadQueue; -export type {DownloadItem, CreateDownloadQueue}; +export type {DownloadItem, CreateDownloadQueueModule}; diff --git a/desktop/main.ts b/desktop/main.ts index 99aaff4babd9..6ab0bc6579d7 100644 --- a/desktop/main.ts +++ b/desktop/main.ts @@ -13,10 +13,10 @@ import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import type PlatformSpecificUpdater from '@src/setup/platformSetup/types'; import type {Locale} from '@src/types/onyx'; -import type {CreateDownloadQueue, DownloadItem} from './createDownloadQueue'; +import type {CreateDownloadQueueModule, DownloadItem} from './createDownloadQueue'; import ELECTRON_EVENTS from './ELECTRON_EVENTS'; -const createDownloadQueue = require<{default: CreateDownloadQueue}>('./createDownloadQueue').default; +const createDownloadQueue = require('./createDownloadQueue').default; const port = process.env.PORT ?? 8082; const {DESKTOP_SHORTCUT_ACCELERATOR, LOCALES} = CONST; diff --git a/src/libs/E2E/tests/linkingTest.e2e.ts b/src/libs/E2E/tests/linkingTest.e2e.ts index 64b75780795d..ff7ce8e186b3 100644 --- a/src/libs/E2E/tests/linkingTest.e2e.ts +++ b/src/libs/E2E/tests/linkingTest.e2e.ts @@ -49,7 +49,7 @@ const test = (config: NativeConfig) => { const res = getViewableItems(); console.debug('[E2E] Viewable items retrieved, verifying correct messageā€¦'); - if (!!res && (res[0]?.item as ViewableItem)?.reportActionID === linkedReportActionID) { + if (!!res && (res[0]?.item as ViewableItem | undefined)?.reportActionID === linkedReportActionID) { E2EClient.submitTestResults({ branch: Config.E2E_BRANCH, name: 'Comment linking', From c5b93dbf12188484ae9d0d4b58914c2ee7e2d140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Tue, 18 Jun 2024 12:36:48 +0200 Subject: [PATCH 23/28] add error type --- src/libs/isPdfFilePasswordProtected/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/isPdfFilePasswordProtected/index.tsx b/src/libs/isPdfFilePasswordProtected/index.tsx index 19ce44b9b8e3..f62e080a2a8d 100644 --- a/src/libs/isPdfFilePasswordProtected/index.tsx +++ b/src/libs/isPdfFilePasswordProtected/index.tsx @@ -17,7 +17,7 @@ const isPdfFilePasswordProtected = (file: FileObject): Promise => () => { resolve(false); }, - (error) => { + (error: Error) => { if (error.name === 'PasswordException') { resolve(true); return; From f13961867622e5a7ad6d28322063f5357fca68b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barbara=20Gawe=C5=82-Kucab?= Date: Tue, 18 Jun 2024 12:43:58 +0200 Subject: [PATCH 24/28] update RN type --- __mocks__/react-native-webview.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/__mocks__/react-native-webview.ts b/__mocks__/react-native-webview.ts index 0b4f07ff98c2..6acf58101b55 100644 --- a/__mocks__/react-native-webview.ts +++ b/__mocks__/react-native-webview.ts @@ -1,9 +1,7 @@ -import type {View as RNView} from 'react-native'; - -type ReactNative = {View: RNView}; +import type ReactNative from 'react-native'; jest.mock('react-native-webview', () => { - const {View} = require('react-native'); + const {View} = require('react-native'); return { WebView: () => View, }; From e5907c2b15a0760ae850e733f7802f7199fac0e2 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 24 Jun 2024 10:22:27 +0200 Subject: [PATCH 25/28] Fix new lint errors --- .../AppNavigator/ModalStackNavigators/index.tsx | 2 +- tests/unit/CIGitLogicTest.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 5db2d7ada68a..f53f7bd2c9b3 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -369,7 +369,7 @@ const ProcessMoneyRequestHoldStackNavigator = createModalStackNavigator({ }); const TransactionDuplicateStackNavigator = createModalStackNavigator({ - [SCREENS.TRANSACTION_DUPLICATE.REVIEW]: () => require('../../../../pages/TransactionDuplicate/Review').default as React.ComponentType, + [SCREENS.TRANSACTION_DUPLICATE.REVIEW]: () => require('../../../../pages/TransactionDuplicate/Review').default, }); const SearchReportModalStackNavigator = createModalStackNavigator({ diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index cd98891f1f61..83cfb05447b5 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -9,6 +9,7 @@ import {execSync} from 'child_process'; import fs from 'fs'; import os from 'os'; import path from 'path'; +import type {PackageJson} from 'type-fest'; import getPreviousVersion from '@github/actions/javascript/getPreviousVersion/getPreviousVersion'; import CONST from '@github/libs/CONST'; import GitUtils from '@github/libs/GitUtils'; @@ -49,8 +50,14 @@ function setupGitAsOSBotify() { exec('git config --local user.email infra+osbotify@expensify.com'); } -function getVersion() { - return JSON.parse(fs.readFileSync('package.json', {encoding: 'utf-8'})).version as string; +function getVersion(): string { + const packageJson = JSON.parse(fs.readFileSync('package.json', {encoding: 'utf-8'})) as PackageJson; + + if (!packageJson.version) { + throw new Error('package.json does not contain a version field'); + } + + return packageJson.version; } function initGitServer() { From 683e4c0fec16b949460f5d6232bcfe56feb7558c Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 24 Jun 2024 16:17:27 +0200 Subject: [PATCH 26/28] Fix lint error --- tests/perf-test/ReportScreen.perf-test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/perf-test/ReportScreen.perf-test.tsx b/tests/perf-test/ReportScreen.perf-test.tsx index 129fcdcd38d7..6a2708da0bb9 100644 --- a/tests/perf-test/ReportScreen.perf-test.tsx +++ b/tests/perf-test/ReportScreen.perf-test.tsx @@ -2,6 +2,7 @@ import type {StackNavigationProp, StackScreenProps} from '@react-navigation/stac import {screen} from '@testing-library/react-native'; import type {ComponentType} from 'react'; import React from 'react'; +import type ReactNative from 'react-native'; import {Dimensions, InteractionManager} from 'react-native'; import Onyx from 'react-native-onyx'; import type Animated from 'react-native-reanimated'; @@ -50,7 +51,7 @@ jest.mock('react-native/Libraries/Interaction/InteractionManager', () => ({ })); jest.mock('react-native', () => { - const actualReactNative = jest.requireActual('react-native'); + const actualReactNative = jest.requireActual('react-native'); // eslint-disable-next-line @typescript-eslint/no-unsafe-return return { ...actualReactNative, From 15a5db24c9e615723d24221ae474d7a8141a4dd4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 25 Jun 2024 09:39:23 +0200 Subject: [PATCH 27/28] Add generic argument to require --- src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 4a80eb474f6c..a15be716d8e3 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -377,7 +377,7 @@ const SearchReportModalStackNavigator = createModalStackNavigator({ - [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default as React.ComponentType, + [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default as React.ComponentType, }); export { From 0bb01b7d4b0fbe7fab445c3d15e9a41877d6bf22 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 25 Jun 2024 09:57:21 +0200 Subject: [PATCH 28/28] Remove unnecessary assertion --- src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index a15be716d8e3..64f253f7aeea 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -377,7 +377,7 @@ const SearchReportModalStackNavigator = createModalStackNavigator({ - [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default as React.ComponentType, + [SCREENS.RESTRICTED_ACTION_ROOT]: () => require('../../../../pages/RestrictedAction/Workspace/WorkspaceRestrictedActionPage').default, }); export {