From f6eb1bae4cd1a9e1e6a3b8a23d282dd22a173cb3 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 23 Aug 2023 11:37:44 +0200 Subject: [PATCH 1/3] [TS migration] Migrate 'ROUTES.js' constant to TypeScript --- src/{ROUTES.js => ROUTES.ts} | 112 ++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 55 deletions(-) rename src/{ROUTES.js => ROUTES.ts} (59%) diff --git a/src/ROUTES.js b/src/ROUTES.ts similarity index 59% rename from src/ROUTES.js rename to src/ROUTES.ts index 3f96d77d477e..26b12da2f68c 100644 --- a/src/ROUTES.js +++ b/src/ROUTES.ts @@ -1,10 +1,16 @@ -import lodashGet from 'lodash/get'; +import {ValueOf} from 'type-fest'; import * as Url from './libs/Url'; +import CONST from './CONST'; /** * This is a file containing constants for all of the routes we want to be able to go to */ +type ParseReportRouteParams = { + reportID: string; + isSubReportPageRoute: boolean; +}; + const REPORT = 'r'; const IOU_REQUEST = 'request/new'; const IOU_BILL = 'split/new'; @@ -20,7 +26,7 @@ export default { BANK_ACCOUNT_NEW: 'bank-account/new', BANK_ACCOUNT_WITH_STEP_TO_OPEN: 'bank-account/:stepToOpen?', BANK_ACCOUNT_PERSONAL: 'bank-account/personal', - getBankAccountRoute: (stepToOpen = '', policyID = '', backTo = '') => { + getBankAccountRoute: (stepToOpen = '', policyID = '', backTo = ''): string => { const backToParam = backTo ? `&backTo=${encodeURIComponent(backTo)}` : ''; return `bank-account/${stepToOpen}?policyID=${policyID}${backToParam}`; }, @@ -48,7 +54,7 @@ export default { SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card', SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account', SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments', - getSettingsAddLoginRoute: (type) => `settings/addlogin/${type}`, + getSettingsAddLoginRoute: (type: string): string => `settings/addlogin/${type}`, SETTINGS_WALLET_TRANSFER_BALANCE: 'settings/wallet/transfer-balance', SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT: 'settings/wallet/choose-transfer-account', SETTINGS_PERSONAL_DETAILS, @@ -57,7 +63,7 @@ export default { SETTINGS_PERSONAL_DETAILS_ADDRESS: `${SETTINGS_PERSONAL_DETAILS}/address`, SETTINGS_CONTACT_METHODS, SETTINGS_CONTACT_METHOD_DETAILS: `${SETTINGS_CONTACT_METHODS}/:contactMethod/details`, - getEditContactMethodRoute: (contactMethod) => `${SETTINGS_CONTACT_METHODS}/${encodeURIComponent(contactMethod)}/details`, + getEditContactMethodRoute: (contactMethod: string): string => `${SETTINGS_CONTACT_METHODS}/${encodeURIComponent(contactMethod)}/details`, SETTINGS_NEW_CONTACT_METHOD: `${SETTINGS_CONTACT_METHODS}/new`, SETTINGS_2FA: 'settings/security/two-factor-auth', SETTINGS_STATUS, @@ -68,14 +74,14 @@ export default { REPORT, REPORT_WITH_ID: 'r/:reportID?', EDIT_REQUEST: 'r/:threadReportID/edit/:field', - getEditRequestRoute: (threadReportID, field) => `r/${threadReportID}/edit/${field}`, + getEditRequestRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`, EDIT_CURRENCY_REQUEST: 'r/:threadReportID/edit/currency', - getEditRequestCurrencyRoute: (threadReportID, currency, backTo) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`, - getReportRoute: (reportID) => `r/${reportID}`, + getEditRequestCurrencyRoute: (threadReportID: string, currency: string, backTo: string): string => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`, + getReportRoute: (reportID: string): string => `r/${reportID}`, REPORT_WITH_ID_DETAILS_SHARE_CODE: 'r/:reportID/details/shareCode', - getReportShareCodeRoute: (reportID) => `r/${reportID}/details/shareCode`, + getReportShareCodeRoute: (reportID: string): string => `r/${reportID}/details/shareCode`, REPORT_ATTACHMENTS: 'r/:reportID/attachment', - getReportAttachmentRoute: (reportID, source) => `r/${reportID}/attachment?source=${encodeURI(source)}`, + getReportAttachmentRoute: (reportID: string, source: string): string => `r/${reportID}/attachment?source=${encodeURI(source)}`, /** This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated */ CONCIERGE: 'concierge', @@ -100,56 +106,57 @@ export default { IOU_SEND_ADD_BANK_ACCOUNT: `${IOU_SEND}/add-bank-account`, IOU_SEND_ADD_DEBIT_CARD: `${IOU_SEND}/add-debit-card`, IOU_SEND_ENABLE_PAYMENTS: `${IOU_SEND}/enable-payments`, - getMoneyRequestRoute: (iouType, reportID = '') => `${iouType}/new/${reportID}`, - getMoneyRequestAmountRoute: (iouType, reportID = '') => `${iouType}/new/amount/${reportID}`, - getMoneyRequestParticipantsRoute: (iouType, reportID = '') => `${iouType}/new/participants/${reportID}`, - getMoneyRequestConfirmationRoute: (iouType, reportID = '') => `${iouType}/new/confirmation/${reportID}`, - getMoneyRequestCreatedRoute: (iouType, reportID = '') => `${iouType}/new/date/${reportID}`, - getMoneyRequestCurrencyRoute: (iouType, reportID = '', currency, backTo) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, - getMoneyRequestDescriptionRoute: (iouType, reportID = '') => `${iouType}/new/description/${reportID}`, - getMoneyRequestMerchantRoute: (iouType, reportID = '') => `${iouType}/new/merchant/${reportID}`, - getMoneyRequestDistanceTabRoute: (iouType, reportID = '') => `${iouType}/new/${reportID}/distance`, - getMoneyRequestWaypointRoute: (iouType, waypointIndex) => `${iouType}/new/waypoint/${waypointIndex}`, + getMoneyRequestRoute: (iouType: string, reportID = ''): string => `${iouType}/new/${reportID}`, + getMoneyRequestAmountRoute: (iouType: string, reportID = ''): string => `${iouType}/new/amount/${reportID}`, + getMoneyRequestParticipantsRoute: (iouType: string, reportID = ''): string => `${iouType}/new/participants/${reportID}`, + getMoneyRequestConfirmationRoute: (iouType: string, reportID = ''): string => `${iouType}/new/confirmation/${reportID}`, + getMoneyRequestCreatedRoute: (iouType: string, reportID = ''): string => `${iouType}/new/date/${reportID}`, + getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string): string => + `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, + getMoneyRequestDescriptionRoute: (iouType: string, reportID = ''): string => `${iouType}/new/description/${reportID}`, + getMoneyRequestMerchantRoute: (iouType: string, reportID = ''): string => `${iouType}/new/merchant/${reportID}`, + getMoneyRequestDistanceTabRoute: (iouType: string, reportID = ''): string => `${iouType}/new/${reportID}/distance`, + getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number): string => `${iouType}/new/waypoint/${waypointIndex}`, SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`, - getSplitBillDetailsRoute: (reportID, reportActionID) => `r/${reportID}/split/${reportActionID}`, - getNewTaskRoute: (reportID) => `${NEW_TASK}/${reportID}`, + getSplitBillDetailsRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`, + getNewTaskRoute: (reportID: string): string => `${NEW_TASK}/${reportID}`, NEW_TASK_WITH_REPORT_ID: `${NEW_TASK}/:reportID?`, TASK_TITLE: 'r/:reportID/title', TASK_DESCRIPTION: 'r/:reportID/description', TASK_ASSIGNEE: 'r/:reportID/assignee', - getTaskReportTitleRoute: (reportID) => `r/${reportID}/title`, - getTaskReportDescriptionRoute: (reportID) => `r/${reportID}/description`, - getTaskReportAssigneeRoute: (reportID) => `r/${reportID}/assignee`, + getTaskReportTitleRoute: (reportID: string): string => `r/${reportID}/title`, + getTaskReportDescriptionRoute: (reportID: string): string => `r/${reportID}/description`, + getTaskReportAssigneeRoute: (reportID: string): string => `r/${reportID}/assignee`, NEW_TASK_ASSIGNEE: `${NEW_TASK}/assignee`, NEW_TASK_SHARE_DESTINATION: `${NEW_TASK}/share-destination`, NEW_TASK_DETAILS: `${NEW_TASK}/details`, NEW_TASK_TITLE: `${NEW_TASK}/title`, NEW_TASK_DESCRIPTION: `${NEW_TASK}/description`, FLAG_COMMENT: `flag/:reportID/:reportActionID`, - getFlagCommentRoute: (reportID, reportActionID) => `flag/${reportID}/${reportActionID}`, + getFlagCommentRoute: (reportID: string, reportActionID: string): string => `flag/${reportID}/${reportActionID}`, SEARCH: 'search', DETAILS: 'details', - getDetailsRoute: (login) => `details?login=${encodeURIComponent(login)}`, + getDetailsRoute: (login: string) => `details?login=${encodeURIComponent(login)}`, PROFILE: 'a/:accountID', - getProfileRoute: (accountID) => `a/${accountID}`, + getProfileRoute: (accountID: string | number) => `a/${accountID}`, REPORT_PARTICIPANTS: 'r/:reportID/participants', - getReportParticipantsRoute: (reportID) => `r/${reportID}/participants`, + getReportParticipantsRoute: (reportID: string): string => `r/${reportID}/participants`, REPORT_WITH_ID_DETAILS: 'r/:reportID/details', - getReportDetailsRoute: (reportID) => `r/${reportID}/details`, + getReportDetailsRoute: (reportID: string): string => `r/${reportID}/details`, REPORT_SETTINGS: 'r/:reportID/settings', - getReportSettingsRoute: (reportID) => `r/${reportID}/settings`, + getReportSettingsRoute: (reportID: string): string => `r/${reportID}/settings`, REPORT_SETTINGS_ROOM_NAME: 'r/:reportID/settings/room-name', - getReportSettingsRoomNameRoute: (reportID) => `r/${reportID}/settings/room-name`, + getReportSettingsRoomNameRoute: (reportID: string): string => `r/${reportID}/settings/room-name`, REPORT_SETTINGS_NOTIFICATION_PREFERENCES: 'r/:reportID/settings/notification-preferences', - getReportSettingsNotificationPreferencesRoute: (reportID) => `r/${reportID}/settings/notification-preferences`, + getReportSettingsNotificationPreferencesRoute: (reportID: string): string => `r/${reportID}/settings/notification-preferences`, REPORT_WELCOME_MESSAGE: 'r/:reportID/welcomeMessage', - getReportWelcomeMessageRoute: (reportID) => `r/${reportID}/welcomeMessage`, + getReportWelcomeMessageRoute: (reportID: string): string => `r/${reportID}/welcomeMessage`, REPORT_SETTINGS_WRITE_CAPABILITY: 'r/:reportID/settings/who-can-post', - getReportSettingsWriteCapabilityRoute: (reportID) => `r/${reportID}/settings/who-can-post`, + getReportSettingsWriteCapabilityRoute: (reportID: string): string => `r/${reportID}/settings/who-can-post`, TRANSITION_BETWEEN_APPS: 'transition', VALIDATE_LOGIN: 'v/:accountID/:validateCode', GET_ASSISTANCE: 'get-assistance/:taskID', - getGetAssistanceRoute: (taskID) => `get-assistance/${taskID}`, + getGetAssistanceRoute: (taskID: string): string => `get-assistance/${taskID}`, UNLINK_LOGIN: 'u/:accountID/:validateCode', APPLE_SIGN_IN: 'sign-in-with-apple', @@ -160,7 +167,7 @@ export default { // when linking users from e.com in order to share a session in this app. ENABLE_PAYMENTS: 'enable-payments', WALLET_STATEMENT_WITH_DATE: 'statements/:yearMonth', - getWalletStatementWithDateRoute: (yearMonth) => `statements/${yearMonth}`, + getWalletStatementWithDateRoute: (yearMonth: string) => `statements/${yearMonth}`, WORKSPACE_NEW: 'workspace/new', WORKSPACE_INITIAL: 'workspace/:policyID', WORKSPACE_INVITE: 'workspace/:policyID/invite', @@ -174,23 +181,18 @@ export default { WORKSPACE_TRAVEL: 'workspace/:policyID/travel', WORKSPACE_MEMBERS: 'workspace/:policyID/members', WORKSPACE_NEW_ROOM: 'workspace/new-room', - getWorkspaceInitialRoute: (policyID) => `workspace/${policyID}`, - getWorkspaceInviteRoute: (policyID) => `workspace/${policyID}/invite`, - getWorkspaceInviteMessageRoute: (policyID) => `workspace/${policyID}/invite-message`, - getWorkspaceSettingsRoute: (policyID) => `workspace/${policyID}/settings`, - getWorkspaceCardRoute: (policyID) => `workspace/${policyID}/card`, - getWorkspaceReimburseRoute: (policyID) => `workspace/${policyID}/reimburse`, - getWorkspaceRateAndUnitRoute: (policyID) => `workspace/${policyID}/rateandunit`, - getWorkspaceBillsRoute: (policyID) => `workspace/${policyID}/bills`, - getWorkspaceInvoicesRoute: (policyID) => `workspace/${policyID}/invoices`, - getWorkspaceTravelRoute: (policyID) => `workspace/${policyID}/travel`, - getWorkspaceMembersRoute: (policyID) => `workspace/${policyID}/members`, - - /** - * @param {String} route - * @returns {Object} - */ - parseReportRouteParams: (route) => { + getWorkspaceInitialRoute: (policyID: string): string => `workspace/${policyID}`, + getWorkspaceInviteRoute: (policyID: string): string => `workspace/${policyID}/invite`, + getWorkspaceInviteMessageRoute: (policyID: string): string => `workspace/${policyID}/invite-message`, + getWorkspaceSettingsRoute: (policyID: string): string => `workspace/${policyID}/settings`, + getWorkspaceCardRoute: (policyID: string): string => `workspace/${policyID}/card`, + getWorkspaceReimburseRoute: (policyID: string): string => `workspace/${policyID}/reimburse`, + getWorkspaceRateAndUnitRoute: (policyID: string): string => `workspace/${policyID}/rateandunit`, + getWorkspaceBillsRoute: (policyID: string): string => `workspace/${policyID}/bills`, + getWorkspaceInvoicesRoute: (policyID: string): string => `workspace/${policyID}/invoices`, + getWorkspaceTravelRoute: (policyID: string): string => `workspace/${policyID}/travel`, + getWorkspaceMembersRoute: (policyID: string): string => `workspace/${policyID}/members`, + parseReportRouteParams: (route: string): ParseReportRouteParams => { let parsingRoute = route; if (parsingRoute.at(0) === '/') { // remove the first slash @@ -203,9 +205,9 @@ export default { const pathSegments = parsingRoute.split('/'); return { - reportID: lodashGet(pathSegments, 1), + reportID: pathSegments[1], isSubReportPageRoute: pathSegments.length > 2, }; }, SIGN_IN_MODAL: 'sign-in-modal', -}; +} as const; From 2ac26e5ae9fafba27c3f205e8d9cb07c66ffbc7a Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 23 Aug 2023 11:43:02 +0200 Subject: [PATCH 2/3] Remove explicit return types --- src/ROUTES.ts | 80 +++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 26b12da2f68c..8c3f3a7868a7 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -54,7 +54,7 @@ export default { SETTINGS_ADD_DEBIT_CARD: 'settings/wallet/add-debit-card', SETTINGS_ADD_BANK_ACCOUNT: 'settings/wallet/add-bank-account', SETTINGS_ENABLE_PAYMENTS: 'settings/wallet/enable-payments', - getSettingsAddLoginRoute: (type: string): string => `settings/addlogin/${type}`, + getSettingsAddLoginRoute: (type: string) => `settings/addlogin/${type}`, SETTINGS_WALLET_TRANSFER_BALANCE: 'settings/wallet/transfer-balance', SETTINGS_WALLET_CHOOSE_TRANSFER_ACCOUNT: 'settings/wallet/choose-transfer-account', SETTINGS_PERSONAL_DETAILS, @@ -63,7 +63,7 @@ export default { SETTINGS_PERSONAL_DETAILS_ADDRESS: `${SETTINGS_PERSONAL_DETAILS}/address`, SETTINGS_CONTACT_METHODS, SETTINGS_CONTACT_METHOD_DETAILS: `${SETTINGS_CONTACT_METHODS}/:contactMethod/details`, - getEditContactMethodRoute: (contactMethod: string): string => `${SETTINGS_CONTACT_METHODS}/${encodeURIComponent(contactMethod)}/details`, + getEditContactMethodRoute: (contactMethod: string) => `${SETTINGS_CONTACT_METHODS}/${encodeURIComponent(contactMethod)}/details`, SETTINGS_NEW_CONTACT_METHOD: `${SETTINGS_CONTACT_METHODS}/new`, SETTINGS_2FA: 'settings/security/two-factor-auth', SETTINGS_STATUS, @@ -76,12 +76,12 @@ export default { EDIT_REQUEST: 'r/:threadReportID/edit/:field', getEditRequestRoute: (threadReportID: string, field: ValueOf) => `r/${threadReportID}/edit/${field}`, EDIT_CURRENCY_REQUEST: 'r/:threadReportID/edit/currency', - getEditRequestCurrencyRoute: (threadReportID: string, currency: string, backTo: string): string => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`, - getReportRoute: (reportID: string): string => `r/${reportID}`, + getEditRequestCurrencyRoute: (threadReportID: string, currency: string, backTo: string) => `r/${threadReportID}/edit/currency?currency=${currency}&backTo=${backTo}`, + getReportRoute: (reportID: string) => `r/${reportID}`, REPORT_WITH_ID_DETAILS_SHARE_CODE: 'r/:reportID/details/shareCode', - getReportShareCodeRoute: (reportID: string): string => `r/${reportID}/details/shareCode`, + getReportShareCodeRoute: (reportID: string) => `r/${reportID}/details/shareCode`, REPORT_ATTACHMENTS: 'r/:reportID/attachment', - getReportAttachmentRoute: (reportID: string, source: string): string => `r/${reportID}/attachment?source=${encodeURI(source)}`, + getReportAttachmentRoute: (reportID: string, source: string) => `r/${reportID}/attachment?source=${encodeURI(source)}`, /** This is a utility route used to go to the user's concierge chat, or the sign-in page if the user's not authenticated */ CONCIERGE: 'concierge', @@ -106,57 +106,57 @@ export default { IOU_SEND_ADD_BANK_ACCOUNT: `${IOU_SEND}/add-bank-account`, IOU_SEND_ADD_DEBIT_CARD: `${IOU_SEND}/add-debit-card`, IOU_SEND_ENABLE_PAYMENTS: `${IOU_SEND}/enable-payments`, - getMoneyRequestRoute: (iouType: string, reportID = ''): string => `${iouType}/new/${reportID}`, - getMoneyRequestAmountRoute: (iouType: string, reportID = ''): string => `${iouType}/new/amount/${reportID}`, - getMoneyRequestParticipantsRoute: (iouType: string, reportID = ''): string => `${iouType}/new/participants/${reportID}`, - getMoneyRequestConfirmationRoute: (iouType: string, reportID = ''): string => `${iouType}/new/confirmation/${reportID}`, - getMoneyRequestCreatedRoute: (iouType: string, reportID = ''): string => `${iouType}/new/date/${reportID}`, - getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string): string => + getMoneyRequestRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}`, + getMoneyRequestAmountRoute: (iouType: string, reportID = '') => `${iouType}/new/amount/${reportID}`, + getMoneyRequestParticipantsRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`, + getMoneyRequestConfirmationRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`, + getMoneyRequestCreatedRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`, + getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, - getMoneyRequestDescriptionRoute: (iouType: string, reportID = ''): string => `${iouType}/new/description/${reportID}`, - getMoneyRequestMerchantRoute: (iouType: string, reportID = ''): string => `${iouType}/new/merchant/${reportID}`, - getMoneyRequestDistanceTabRoute: (iouType: string, reportID = ''): string => `${iouType}/new/${reportID}/distance`, - getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number): string => `${iouType}/new/waypoint/${waypointIndex}`, + getMoneyRequestDescriptionRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`, + getMoneyRequestMerchantRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`, + getMoneyRequestDistanceTabRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`, + getMoneyRequestWaypointRoute: (iouType: string, waypointIndex: number) => `${iouType}/new/waypoint/${waypointIndex}`, SPLIT_BILL_DETAILS: `r/:reportID/split/:reportActionID`, getSplitBillDetailsRoute: (reportID: string, reportActionID: string) => `r/${reportID}/split/${reportActionID}`, - getNewTaskRoute: (reportID: string): string => `${NEW_TASK}/${reportID}`, + getNewTaskRoute: (reportID: string) => `${NEW_TASK}/${reportID}`, NEW_TASK_WITH_REPORT_ID: `${NEW_TASK}/:reportID?`, TASK_TITLE: 'r/:reportID/title', TASK_DESCRIPTION: 'r/:reportID/description', TASK_ASSIGNEE: 'r/:reportID/assignee', - getTaskReportTitleRoute: (reportID: string): string => `r/${reportID}/title`, - getTaskReportDescriptionRoute: (reportID: string): string => `r/${reportID}/description`, - getTaskReportAssigneeRoute: (reportID: string): string => `r/${reportID}/assignee`, + getTaskReportTitleRoute: (reportID: string) => `r/${reportID}/title`, + getTaskReportDescriptionRoute: (reportID: string) => `r/${reportID}/description`, + getTaskReportAssigneeRoute: (reportID: string) => `r/${reportID}/assignee`, NEW_TASK_ASSIGNEE: `${NEW_TASK}/assignee`, NEW_TASK_SHARE_DESTINATION: `${NEW_TASK}/share-destination`, NEW_TASK_DETAILS: `${NEW_TASK}/details`, NEW_TASK_TITLE: `${NEW_TASK}/title`, NEW_TASK_DESCRIPTION: `${NEW_TASK}/description`, FLAG_COMMENT: `flag/:reportID/:reportActionID`, - getFlagCommentRoute: (reportID: string, reportActionID: string): string => `flag/${reportID}/${reportActionID}`, + getFlagCommentRoute: (reportID: string, reportActionID: string) => `flag/${reportID}/${reportActionID}`, SEARCH: 'search', DETAILS: 'details', getDetailsRoute: (login: string) => `details?login=${encodeURIComponent(login)}`, PROFILE: 'a/:accountID', getProfileRoute: (accountID: string | number) => `a/${accountID}`, REPORT_PARTICIPANTS: 'r/:reportID/participants', - getReportParticipantsRoute: (reportID: string): string => `r/${reportID}/participants`, + getReportParticipantsRoute: (reportID: string) => `r/${reportID}/participants`, REPORT_WITH_ID_DETAILS: 'r/:reportID/details', - getReportDetailsRoute: (reportID: string): string => `r/${reportID}/details`, + getReportDetailsRoute: (reportID: string) => `r/${reportID}/details`, REPORT_SETTINGS: 'r/:reportID/settings', - getReportSettingsRoute: (reportID: string): string => `r/${reportID}/settings`, + getReportSettingsRoute: (reportID: string) => `r/${reportID}/settings`, REPORT_SETTINGS_ROOM_NAME: 'r/:reportID/settings/room-name', - getReportSettingsRoomNameRoute: (reportID: string): string => `r/${reportID}/settings/room-name`, + getReportSettingsRoomNameRoute: (reportID: string) => `r/${reportID}/settings/room-name`, REPORT_SETTINGS_NOTIFICATION_PREFERENCES: 'r/:reportID/settings/notification-preferences', - getReportSettingsNotificationPreferencesRoute: (reportID: string): string => `r/${reportID}/settings/notification-preferences`, + getReportSettingsNotificationPreferencesRoute: (reportID: string) => `r/${reportID}/settings/notification-preferences`, REPORT_WELCOME_MESSAGE: 'r/:reportID/welcomeMessage', - getReportWelcomeMessageRoute: (reportID: string): string => `r/${reportID}/welcomeMessage`, + getReportWelcomeMessageRoute: (reportID: string) => `r/${reportID}/welcomeMessage`, REPORT_SETTINGS_WRITE_CAPABILITY: 'r/:reportID/settings/who-can-post', - getReportSettingsWriteCapabilityRoute: (reportID: string): string => `r/${reportID}/settings/who-can-post`, + getReportSettingsWriteCapabilityRoute: (reportID: string) => `r/${reportID}/settings/who-can-post`, TRANSITION_BETWEEN_APPS: 'transition', VALIDATE_LOGIN: 'v/:accountID/:validateCode', GET_ASSISTANCE: 'get-assistance/:taskID', - getGetAssistanceRoute: (taskID: string): string => `get-assistance/${taskID}`, + getGetAssistanceRoute: (taskID: string) => `get-assistance/${taskID}`, UNLINK_LOGIN: 'u/:accountID/:validateCode', APPLE_SIGN_IN: 'sign-in-with-apple', @@ -181,17 +181,17 @@ export default { WORKSPACE_TRAVEL: 'workspace/:policyID/travel', WORKSPACE_MEMBERS: 'workspace/:policyID/members', WORKSPACE_NEW_ROOM: 'workspace/new-room', - getWorkspaceInitialRoute: (policyID: string): string => `workspace/${policyID}`, - getWorkspaceInviteRoute: (policyID: string): string => `workspace/${policyID}/invite`, - getWorkspaceInviteMessageRoute: (policyID: string): string => `workspace/${policyID}/invite-message`, - getWorkspaceSettingsRoute: (policyID: string): string => `workspace/${policyID}/settings`, - getWorkspaceCardRoute: (policyID: string): string => `workspace/${policyID}/card`, - getWorkspaceReimburseRoute: (policyID: string): string => `workspace/${policyID}/reimburse`, - getWorkspaceRateAndUnitRoute: (policyID: string): string => `workspace/${policyID}/rateandunit`, - getWorkspaceBillsRoute: (policyID: string): string => `workspace/${policyID}/bills`, - getWorkspaceInvoicesRoute: (policyID: string): string => `workspace/${policyID}/invoices`, - getWorkspaceTravelRoute: (policyID: string): string => `workspace/${policyID}/travel`, - getWorkspaceMembersRoute: (policyID: string): string => `workspace/${policyID}/members`, + getWorkspaceInitialRoute: (policyID: string) => `workspace/${policyID}`, + getWorkspaceInviteRoute: (policyID: string) => `workspace/${policyID}/invite`, + getWorkspaceInviteMessageRoute: (policyID: string) => `workspace/${policyID}/invite-message`, + getWorkspaceSettingsRoute: (policyID: string) => `workspace/${policyID}/settings`, + getWorkspaceCardRoute: (policyID: string) => `workspace/${policyID}/card`, + getWorkspaceReimburseRoute: (policyID: string) => `workspace/${policyID}/reimburse`, + getWorkspaceRateAndUnitRoute: (policyID: string) => `workspace/${policyID}/rateandunit`, + getWorkspaceBillsRoute: (policyID: string) => `workspace/${policyID}/bills`, + getWorkspaceInvoicesRoute: (policyID: string) => `workspace/${policyID}/invoices`, + getWorkspaceTravelRoute: (policyID: string) => `workspace/${policyID}/travel`, + getWorkspaceMembersRoute: (policyID: string) => `workspace/${policyID}/members`, parseReportRouteParams: (route: string): ParseReportRouteParams => { let parsingRoute = route; if (parsingRoute.at(0) === '/') { From 1a8ac614aed9a043ddf24991d29566dfcb7ce649 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 23 Aug 2023 12:55:12 +0200 Subject: [PATCH 3/3] Run prettier --- src/ROUTES.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 8c3f3a7868a7..d44e638a1f49 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -111,8 +111,7 @@ export default { getMoneyRequestParticipantsRoute: (iouType: string, reportID = '') => `${iouType}/new/participants/${reportID}`, getMoneyRequestConfirmationRoute: (iouType: string, reportID = '') => `${iouType}/new/confirmation/${reportID}`, getMoneyRequestCreatedRoute: (iouType: string, reportID = '') => `${iouType}/new/date/${reportID}`, - getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string) => - `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, + getMoneyRequestCurrencyRoute: (iouType: string, reportID: string, currency: string, backTo: string) => `${iouType}/new/currency/${reportID}?currency=${currency}&backTo=${backTo}`, getMoneyRequestDescriptionRoute: (iouType: string, reportID = '') => `${iouType}/new/description/${reportID}`, getMoneyRequestMerchantRoute: (iouType: string, reportID = '') => `${iouType}/new/merchant/${reportID}`, getMoneyRequestDistanceTabRoute: (iouType: string, reportID = '') => `${iouType}/new/${reportID}/distance`,