From f96aa10b8cda4c29e822f95b15c929907f110a6a Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 7 Mar 2025 10:48:47 +0100 Subject: [PATCH 1/4] Remove help button from workspace switcher --- src/pages/WorkspaceSwitcherPage/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index cd57fb6859f6..e9dc78b56c1f 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -151,6 +151,7 @@ function WorkspaceSwitcherPage() { {shouldShowLoadingIndicator ? ( From c5f180d34d6e937ada7b385fd40fdb52556bae32 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 7 Mar 2025 11:14:46 +0100 Subject: [PATCH 2/4] remove get assistance button --- src/CONST.ts | 15 +-- src/ROUTES.ts | 4 - src/SCREENS.ts | 1 - src/components/HeaderWithBackButton/index.tsx | 19 ---- src/components/HeaderWithBackButton/types.ts | 9 -- src/components/InteractiveStepWrapper.tsx | 5 - .../ModalStackNavigators/index.tsx | 1 - src/libs/Navigation/linkingConfig/config.ts | 3 - src/libs/Navigation/types.ts | 3 - src/pages/GetAssistancePage.tsx | 100 ------------------ .../ConnectedVerifiedBankAccount.tsx | 1 - .../USD/BusinessInfo/BusinessInfo.tsx | 1 - .../VerifiedBankAccountFlowEntryPoint.tsx | 2 - src/pages/ReportParticipantsPage.tsx | 1 - .../workspace/WorkspaceInviteMessagePage.tsx | 2 - src/pages/workspace/WorkspaceInvitePage.tsx | 2 - src/pages/workspace/WorkspaceMembersPage.tsx | 1 - src/pages/workspace/WorkspaceOverviewPage.tsx | 1 - .../workspace/WorkspacePageWithSections.tsx | 5 - .../WorkspaceCompanyCardsPage.tsx | 1 - .../WorkspaceExpensifyCardPageEmptyState.tsx | 1 - .../invoices/WorkspaceInvoicesPage.tsx | 1 - src/pages/workspace/rules/PolicyRulesPage.tsx | 1 - .../workflows/WorkspaceWorkflowsPage.tsx | 1 - 24 files changed, 1 insertion(+), 180 deletions(-) delete mode 100644 src/pages/GetAssistancePage.tsx diff --git a/src/CONST.ts b/src/CONST.ts index 8c8d82aa43f1..204107eed36b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3340,20 +3340,7 @@ const CONST = { PREFIX: '__predefined_', SELF_SELECT: '__predefined_selfSelect', }, - GUIDES_CALL_TASK_IDS: { - CONCIERGE_DM: 'NewExpensifyConciergeDM', - WORKSPACE_INITIAL: 'WorkspaceHome', - WORKSPACE_OVERVIEW: 'WorkspaceOverview', - WORKSPACE_INVOICES: 'WorkspaceSendInvoices', - WORKSPACE_MEMBERS: 'WorkspaceManageMembers', - WORKSPACE_EXPENSIFY_CARD: 'WorkspaceExpensifyCard', - WORKSPACE_WORKFLOWS: 'WorkspaceWorkflows', - WORKSPACE_COMPANY_CARDS: 'WorkspaceCompanyCards', - WORKSPACE_BANK_ACCOUNT: 'WorkspaceBankAccount', - WORKSPACE_SETTINGS: 'WorkspaceSettings', - WORKSPACE_FEATURES: 'WorkspaceFeatures', - WORKSPACE_RULES: 'WorkspaceRules', - }, + EXPENSIFY_EMAILS_OBJECT: Object.entries(EMAIL).reduce((prev, [, email]) => { // eslint-disable-next-line no-param-reassign prev[email] = true; diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 41fd4b830f12..e1bb71dab5d4 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -108,10 +108,6 @@ const ROUTES = { getRoute: (accountID: number) => `a/${accountID}/avatar` as const, }, - GET_ASSISTANCE: { - route: 'get-assistance/:taskID', - getRoute: (taskID: string, backTo: string) => getUrlWithBackToParam(`get-assistance/${taskID}`, backTo), - }, DESKTOP_SIGN_IN_REDIRECT: 'desktop-signin-redirect', // This is a special validation URL that will take the user to /workspace/new after validation. This is used diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 7e09c0277fe4..0825b540244f 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -660,7 +660,6 @@ const SCREENS = { }, FLAG_COMMENT_ROOT: 'FlagComment_Root', REIMBURSEMENT_ACCOUNT: 'ReimbursementAccount', - GET_ASSISTANCE: 'GetAssistance', REFERRAL_DETAILS: 'Referral_Details', KEYBOARD_SHORTCUTS: 'KeyboardShortcuts', TRANSACTION_RECEIPT: 'TransactionReceipt', diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index 184d7b62c054..68b59879d3df 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -29,7 +29,6 @@ function HeaderWithBackButton({ iconWidth, iconHeight, iconStyles, - guidesCallTaskID = '', onBackButtonPress = () => Navigation.goBack(), onCloseButtonPress = () => Navigation.dismissModal(), onDownloadButtonPress = () => {}, @@ -43,8 +42,6 @@ function HeaderWithBackButton({ shouldShowCloseButton = false, shouldShowDownloadButton = false, isDownloading = false, - shouldShowGetAssistanceButton = false, - shouldDisableGetAssistanceButton = false, shouldShowPinButton = false, shouldSetModalVisibility = true, shouldShowThreeDotsButton = false, @@ -232,22 +229,6 @@ function HeaderWithBackButton({ color={theme.spinner} /> ))} - {shouldShowGetAssistanceButton && ( - - Navigation.navigate(ROUTES.GET_ASSISTANCE.getRoute(guidesCallTaskID, Navigation.getActiveRoute()))} - style={[styles.touchableButtonImage]} - role="button" - accessibilityLabel={translate('getAssistancePage.questionMarkButtonTooltip')} - > - - - - )} {shouldShowPinButton && !!report && } {shouldShowThreeDotsButton && ( & { /** Whether we should show a loading indicator replacing the download button */ isDownloading?: boolean; - /** Whether we should show a get assistance (question mark) button */ - shouldShowGetAssistanceButton?: boolean; - - /** Whether we should disable the get assistance button */ - shouldDisableGetAssistanceButton?: boolean; - /** Whether we should show a pin button */ shouldShowPinButton?: boolean; @@ -104,9 +98,6 @@ type HeaderWithBackButtonProps = Partial & { /** Whether we should show a back button */ shouldShowBackButton?: boolean; - /** The guides call taskID to associate with the get assistance button, if we show it */ - guidesCallTaskID?: string; - /** Data to display a step counter in the header */ stepCounter?: StepCounterParams; diff --git a/src/components/InteractiveStepWrapper.tsx b/src/components/InteractiveStepWrapper.tsx index 9d094af0bf26..bb70e37898e7 100644 --- a/src/components/InteractiveStepWrapper.tsx +++ b/src/components/InteractiveStepWrapper.tsx @@ -38,9 +38,6 @@ type InteractiveStepWrapperProps = { // Should enable picker avoiding shouldEnablePickerAvoiding?: boolean; - // Call task ID for the guides - guidesCallTaskID?: string; - // Offline indicator style offlineIndicatorStyle?: StyleProp; }; @@ -57,7 +54,6 @@ function InteractiveStepWrapper( shouldEnableMaxHeight, shouldShowOfflineIndicator, shouldEnablePickerAvoiding = false, - guidesCallTaskID, offlineIndicatorStyle, }: InteractiveStepWrapperProps, ref: React.ForwardedRef, @@ -78,7 +74,6 @@ function InteractiveStepWrapper( title={headerTitle} subtitle={headerSubtitle} onBackButtonPress={handleBackButtonPress} - guidesCallTaskID={guidesCallTaskID} /> {!!stepNames && ( diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 91939c86f07f..dd09c5eb27c3 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -385,7 +385,6 @@ const SettingsModalStackNavigator = createModalStackNavigator('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopCustomersDisplayedAsPage').default, [SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_ITEMS]: () => require('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopItemsPage').default, [SCREENS.REIMBURSEMENT_ACCOUNT]: () => require('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default, - [SCREENS.GET_ASSISTANCE]: () => require('../../../../pages/GetAssistancePage').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, diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index 848c4ed9cdcd..4c5401c12ad0 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -869,9 +869,6 @@ const config: LinkingOptions['config'] = { path: ROUTES.BANK_ACCOUNT_WITH_STEP_TO_OPEN.route, exact: true, }, - [SCREENS.GET_ASSISTANCE]: { - path: ROUTES.GET_ASSISTANCE.route, - }, [SCREENS.KEYBOARD_SHORTCUTS]: { path: ROUTES.KEYBOARD_SHORTCUTS, }, diff --git a/src/libs/Navigation/types.ts b/src/libs/Navigation/types.ts index 45d9119f0a7e..e568582a3437 100644 --- a/src/libs/Navigation/types.ts +++ b/src/libs/Navigation/types.ts @@ -787,9 +787,6 @@ type SettingsNavigatorParamList = { policyID: string; connection: ValueOf; }; - [SCREENS.GET_ASSISTANCE]: { - backTo: Routes; - }; [SCREENS.TWO_FACTOR_AUTH.DISABLED]: undefined; [SCREENS.TWO_FACTOR_AUTH.DISABLE]: undefined; [SCREENS.SETTINGS.DELEGATE.ADD_DELEGATE]: undefined; diff --git a/src/pages/GetAssistancePage.tsx b/src/pages/GetAssistancePage.tsx deleted file mode 100644 index aecb78b76a76..000000000000 --- a/src/pages/GetAssistancePage.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; -import type {OnyxEntry} from 'react-native-onyx'; -import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import * as Expensicons from '@components/Icon/Expensicons'; -import * as Illustrations from '@components/Icon/Illustrations'; -import type {MenuItemWithLink} from '@components/MenuItemList'; -import ScreenWrapper from '@components/ScreenWrapper'; -import ScrollView from '@components/ScrollView'; -import Section from '@components/Section'; -import Text from '@components/Text'; -import useLocalize from '@hooks/useLocalize'; -import useResponsiveLayout from '@hooks/useResponsiveLayout'; -import useThemeStyles from '@hooks/useThemeStyles'; -import Navigation from '@libs/Navigation/Navigation'; -import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; -import type {SettingsNavigatorParamList} from '@libs/Navigation/types'; -import * as Link from '@userActions/Link'; -import * as Report from '@userActions/Report'; -import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; -import ROUTES from '@src/ROUTES'; -import type SCREENS from '@src/SCREENS'; -import type {Account} from '@src/types/onyx'; - -type GetAssistanceOnyxProps = { - /** The details about the account that the user is signing in with */ - account: OnyxEntry; -}; - -type GetAssistancePageProps = GetAssistanceOnyxProps & PlatformStackScreenProps; - -function GetAssistancePage({route, account}: GetAssistancePageProps) { - const styles = useThemeStyles(); - const {translate} = useLocalize(); - const navigateBackTo = route?.params.backTo || ROUTES.SETTINGS_CONTACT_METHODS.getRoute(); - const {isLargeScreenWidth} = useResponsiveLayout(); - const menuItems: MenuItemWithLink[] = [ - { - title: translate('getAssistancePage.chatWithConcierge'), - onPress: () => Report.navigateToConciergeChat(isLargeScreenWidth), - icon: Expensicons.ChatBubble, - shouldShowRightIcon: true, - wrapperStyle: [styles.cardMenuItem], - }, - { - title: translate('getAssistancePage.exploreHelpDocs'), - onPress: () => Link.openExternalLink(CONST.NEWHELP_URL), - icon: Expensicons.QuestionMark, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: CONST.NEWHELP_URL, - }, - ]; - - // If the user is eligible for calls with their Guide, add the 'Schedule a setup call' item at the second position in the list - const guideCalendarLink = account?.guideCalendarLink; - if (guideCalendarLink) { - menuItems.splice(1, 0, { - title: translate('getAssistancePage.scheduleSetupCall'), - onPress: () => Link.openExternalLink(guideCalendarLink), - icon: Expensicons.Phone, - shouldShowRightIcon: true, - iconRight: Expensicons.NewWindow, - wrapperStyle: [styles.cardMenuItem], - link: guideCalendarLink, - }); - } - - return ( - - Navigation.goBack(navigateBackTo)} - /> - -
- - {translate('getAssistancePage.description')} - -
-
-
- ); -} - -GetAssistancePage.displayName = 'GetAssistancePage'; - -export default withOnyx({ - account: { - key: ONYXKEYS.ACCOUNT, - selector: (account) => account && {guideCalendarLink: account.guideCalendarLink}, - }, -})(GetAssistancePage); diff --git a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx index 40e06dcb180d..fccc52f19b2f 100644 --- a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx +++ b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx @@ -56,7 +56,6 @@ function ConnectedVerifiedBankAccount({reimbursementAccount, onBackButtonPress, > diff --git a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx index c2d8adf51c53..5ee339e7d58b 100644 --- a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx +++ b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx @@ -109,7 +109,6 @@ function BusinessInfo({onBackButtonPress}: BusinessInfoProps) { shouldEnablePickerAvoiding={false} shouldEnableMaxHeight headerTitle={translate('businessInfoStep.businessInfo')} - guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} handleBackButtonPress={handleBackButtonPress} startStepIndex={3} stepNames={CONST.BANK_ACCOUNT.STEP_NAMES} diff --git a/src/pages/ReimbursementAccount/VerifiedBankAccountFlowEntryPoint.tsx b/src/pages/ReimbursementAccount/VerifiedBankAccountFlowEntryPoint.tsx index 2d760a1e97dd..dd2000a396a6 100644 --- a/src/pages/ReimbursementAccount/VerifiedBankAccountFlowEntryPoint.tsx +++ b/src/pages/ReimbursementAccount/VerifiedBankAccountFlowEntryPoint.tsx @@ -182,9 +182,7 @@ function VerifiedBankAccountFlowEntryPoint({ diff --git a/src/pages/ReportParticipantsPage.tsx b/src/pages/ReportParticipantsPage.tsx index bda35fc70b1f..db065d9a9380 100755 --- a/src/pages/ReportParticipantsPage.tsx +++ b/src/pages/ReportParticipantsPage.tsx @@ -398,7 +398,6 @@ function ReportParticipantsPage({report, route}: ReportParticipantsPageProps) { Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID, backTo)); } }} - guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_MEMBERS} subtitle={StringUtils.lineBreaksToSpaces(getReportName(report))} /> {headerButtons} diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.tsx b/src/pages/workspace/WorkspaceInviteMessagePage.tsx index 1fef164e158d..3f48e3c7a2f9 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.tsx +++ b/src/pages/workspace/WorkspaceInviteMessagePage.tsx @@ -183,8 +183,6 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}: Navigation.dismissModal()} onBackButtonPress={() => Navigation.goBack(route.params.backTo)} diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index eb81f9cf5d33..f247e32fb64d 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -313,8 +313,6 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { { Policy.clearErrors(route.params.policyID); Navigation.goBack(); diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index daf6d6d972ab..c3745ff65ddb 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -671,7 +671,6 @@ function WorkspaceMembersPage({personalDetails, route, policy, currentUserPerson null, footer = null, icon = undefined, - guidesCallTaskID = '', headerText, policy, policyDraft, @@ -183,7 +179,6 @@ function WorkspacePageWithSections({ > (onBackButtonPress ? onBackButtonPress() : Navigation.goBack(backButtonRoute))} shouldShowBackButton={shouldUseNarrowLayout || shouldShowBackButton} icon={icon ?? undefined} diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx index 67d7e53904c3..2674d399fb2b 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardsPage.tsx @@ -144,7 +144,6 @@ function WorkspaceCompanyCardPage({route}: WorkspaceCompanyCardPageProps) { icon={Illustrations.CompanyCard} headerText={translate('workspace.common.companyCards')} route={route} - guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_COMPANY_CARDS} shouldShowOfflineIndicatorInWideScreen includeSafeAreaPaddingBottom showLoadingAsFirstRender={false} diff --git a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx index 27c037ebaa0e..645847185d93 100644 --- a/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx +++ b/src/pages/workspace/expensifyCard/WorkspaceExpensifyCardPageEmptyState.tsx @@ -86,7 +86,6 @@ function WorkspaceExpensifyCardPageEmptyState({route, policy}: WorkspaceExpensif icon={Illustrations.HandCard} headerText={translate('workspace.common.expensifyCard')} route={route} - guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_EXPENSIFY_CARD} showLoadingAsFirstRender={false} shouldShowOfflineIndicatorInWideScreen > diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx index d3eedabf38e1..2a261b891376 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoicesPage.tsx @@ -29,7 +29,6 @@ function WorkspaceInvoicesPage({route}: WorkspaceInvoicesPageProps) { Date: Fri, 7 Mar 2025 16:08:01 +0100 Subject: [PATCH 3/4] fix lint and changed files lint --- ...eCompanyInformationForBankAccountParams.ts | 2 +- src/libs/actions/BankAccounts.ts | 2 +- .../ConnectedVerifiedBankAccount.tsx | 1 - .../USD/BusinessInfo/BusinessInfo.tsx | 4 +- src/pages/workspace/WorkspaceInvitePage.tsx | 45 ++++++++----------- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts b/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts index c427e26d6c92..ef883819e71a 100644 --- a/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts +++ b/src/libs/API/parameters/UpdateCompanyInformationForBankAccountParams.ts @@ -2,6 +2,6 @@ import type {BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps} type BankAccountCompanyInformation = BankAccountStepProps & CompanyStepProps & ReimbursementAccountProps; -type UpdateCompanyInformationForBankAccountParams = Partial & {bankAccountID: number; policyID: string; confirm: boolean}; +type UpdateCompanyInformationForBankAccountParams = Partial & {bankAccountID: number; policyID: string | undefined; confirm: boolean}; export default UpdateCompanyInformationForBankAccountParams; diff --git a/src/libs/actions/BankAccounts.ts b/src/libs/actions/BankAccounts.ts index 33d3ef57fdf9..7e774607c81c 100644 --- a/src/libs/actions/BankAccounts.ts +++ b/src/libs/actions/BankAccounts.ts @@ -616,7 +616,7 @@ function openReimbursementAccountPage(stepToOpen: ReimbursementAccountStep, subS * @param policyID - ID of the policy we're setting the bank account on * @param isConfirmPage - If we're submitting from the confirmation substep, to trigger all external checks */ -function updateCompanyInformationForBankAccount(bankAccountID: number, params: Partial, policyID: string, isConfirmPage: boolean) { +function updateCompanyInformationForBankAccount(bankAccountID: number, params: Partial, policyID: string | undefined, isConfirmPage: boolean) { API.write( WRITE_COMMANDS.UPDATE_COMPANY_INFORMATION_FOR_BANK_ACCOUNT, { diff --git a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx index fccc52f19b2f..4434cb272592 100644 --- a/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx +++ b/src/pages/ReimbursementAccount/ConnectedVerifiedBankAccount.tsx @@ -14,7 +14,6 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal'; import {requestResetFreePlanBankAccount, resetReimbursementAccount} from '@userActions/ReimbursementAccount'; -import CONST from '@src/CONST'; import type {ReimbursementAccount} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; diff --git a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx index 5ee339e7d58b..a3b4891ed7da 100644 --- a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx +++ b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx @@ -56,14 +56,14 @@ function BusinessInfo({onBackButtonPress}: BusinessInfoProps) { [reimbursementAccount, reimbursementAccountDraft], ); - const policyID = reimbursementAccount?.achData?.policyID ?? '-1'; + const policyID = reimbursementAccount?.achData?.policyID; const values = useMemo(() => getSubStepValues(BUSINESS_INFO_STEP_KEYS, reimbursementAccountDraft, reimbursementAccount), [reimbursementAccount, reimbursementAccountDraft]); const submit = useCallback( (isConfirmPage: boolean) => { const companyWebsite = Str.sanitizeURL(values.website, CONST.COMPANY_WEBSITE_DEFAULT_SCHEME); updateCompanyInformationForBankAccount( - Number(reimbursementAccount?.achData?.bankAccountID ?? '-1'), + Number(reimbursementAccount?.achData?.bankAccountID ?? CONST.DEFAULT_NUMBER_ID), { ...values, ...getBankAccountFields(['routingNumber', 'accountNumber', 'bankName', 'plaidAccountID', 'plaidAccessToken', 'isSavings']), diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index f247e32fb64d..56ce54f9a409 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -14,17 +14,17 @@ import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as ReportActions from '@libs/actions/Report'; +import {searchInServer} from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import {canUseTouchScreen} from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; -import * as LoginUtils from '@libs/LoginUtils'; +import {appendCountryCode} from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; +import {filterAndOrderOptions, formatMemberForList, getHeaderMessage, getMemberInviteOptions, getSearchValueForPhoneOrEmail} from '@libs/OptionsListUtils'; import type {MemberForList} from '@libs/OptionsListUtils'; -import * as PhoneNumber from '@libs/PhoneNumber'; -import * as PolicyUtils from '@libs/PolicyUtils'; +import {addSMSDomainIfPhoneNumber, parsePhoneNumber} from '@libs/PhoneNumber'; +import {getIneligibleInvitees, getMemberAccountIDsForWorkspace, goBackFromInvalidPolicy} from '@libs/PolicyUtils'; import type {OptionData} from '@libs/ReportUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; import * as Member from '@userActions/Policy/Member'; @@ -60,7 +60,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { const [invitedEmailsToAccountIDsDraft] = useOnyx(`${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${route.params.policyID.toString()}`); const openWorkspaceInvitePage = () => { - const policyMemberEmailsToAccountIDs = PolicyUtils.getMemberAccountIDsForWorkspace(policy?.employeeList); + const policyMemberEmailsToAccountIDs = getMemberAccountIDsForWorkspace(policy?.employeeList); Policy.openWorkspaceInvitePage(route.params.policyID, Object.keys(policyMemberEmailsToAccountIDs)); }; const {options, areOptionsInitialized} = useOptionsList({ @@ -76,7 +76,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { useNetwork({onReconnect: openWorkspaceInvitePage}); const excludedUsers = useMemo(() => { - const ineligibleInvites = PolicyUtils.getIneligibleInvitees(policy?.employeeList); + const ineligibleInvites = getIneligibleInvitees(policy?.employeeList); return ineligibleInvites.reduce((acc, login) => { acc[login] = true; return acc; @@ -88,15 +88,12 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { return {recentReports: [], personalDetails: [], userToInvite: null, currentUserOption: null}; } - const inviteOptions = OptionsListUtils.getMemberInviteOptions(options.personalDetails, betas ?? [], excludedUsers, true); + const inviteOptions = getMemberInviteOptions(options.personalDetails, betas ?? [], excludedUsers, true); return {...inviteOptions, recentReports: [], currentUserOption: null}; }, [areOptionsInitialized, betas, excludedUsers, options.personalDetails]); - const inviteOptions = useMemo( - () => OptionsListUtils.filterAndOrderOptions(defaultOptions, debouncedSearchTerm, {excludeLogins: excludedUsers}), - [debouncedSearchTerm, defaultOptions, excludedUsers], - ); + const inviteOptions = useMemo(() => filterAndOrderOptions(defaultOptions, debouncedSearchTerm, {excludeLogins: excludedUsers}), [debouncedSearchTerm, defaultOptions, excludedUsers]); useEffect(() => { if (!areOptionsInitialized) { @@ -114,7 +111,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { return; } - detailsMap[detail.login] = OptionsListUtils.formatMemberForList(detail); + detailsMap[detail.login] = formatMemberForList(detail); }); const newSelectedOptions: MemberForList[] = []; @@ -177,7 +174,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { const accountID = option.accountID; const isOptionInPersonalDetails = Object.values(personalDetails).some((personalDetail) => personalDetail.accountID === accountID); - const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(debouncedSearchTerm); + const searchValue = getSearchValueForPhoneOrEmail(debouncedSearchTerm); const isPartOfSearchTerm = !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue); return isPartOfSearchTerm || isOptionInPersonalDetails; @@ -193,7 +190,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { // Filtering out selected users from the search results const selectedLogins = selectedOptions.map(({login}) => login); const personalDetailsWithoutSelected = Object.values(personalDetails).filter(({login}) => !selectedLogins.some((selectedLogin) => selectedLogin === login)); - const personalDetailsFormatted = personalDetailsWithoutSelected.map((item) => OptionsListUtils.formatMemberForList(item)); + const personalDetailsFormatted = personalDetailsWithoutSelected.map((item) => formatMemberForList(item)); sectionsArr.push({ title: translate('common.contacts'), @@ -207,7 +204,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { if (hasUnselectedUserToInvite) { sectionsArr.push({ title: undefined, - data: [OptionsListUtils.formatMemberForList(userToInvite)], + data: [formatMemberForList(userToInvite)], shouldShow: true, }); } @@ -267,15 +264,11 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { } if ( usersToInvite.length === 0 && - excludedUsers[ - PhoneNumber.parsePhoneNumber(LoginUtils.appendCountryCode(searchValue)).possible - ? PhoneNumber.addSMSDomainIfPhoneNumber(LoginUtils.appendCountryCode(searchValue)) - : searchValue - ] + excludedUsers[parsePhoneNumber(appendCountryCode(searchValue)).possible ? addSMSDomainIfPhoneNumber(appendCountryCode(searchValue)) : searchValue] ) { return translate('messages.userIsAlreadyMember', {login: searchValue, name: policyName}); } - return OptionsListUtils.getHeaderMessage(personalDetails.length !== 0, usersToInvite.length > 0, searchValue); + return getHeaderMessage(personalDetails.length !== 0, usersToInvite.length > 0, searchValue); }, [excludedUsers, translate, debouncedSearchTerm, policyName, usersToInvite, personalDetails.length]); const footerContent = useMemo( @@ -294,14 +287,14 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { ); useEffect(() => { - ReportActions.searchInServer(debouncedSearchTerm); + searchInServer(debouncedSearchTerm); }, [debouncedSearchTerm]); return ( From 9d84000e1b465d8fdadd00513d6c26f818847ce0 Mon Sep 17 00:00:00 2001 From: 289Adam289 Date: Fri, 7 Mar 2025 16:20:59 +0100 Subject: [PATCH 4/4] fix changes files lint --- .../USD/BusinessInfo/BusinessInfo.tsx | 4 ++-- src/pages/workspace/WorkspaceInvitePage.tsx | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx index a3b4891ed7da..d14a1d9f41d7 100644 --- a/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx +++ b/src/pages/ReimbursementAccount/USD/BusinessInfo/BusinessInfo.tsx @@ -7,7 +7,7 @@ import useLocalize from '@hooks/useLocalize'; import useSubStep from '@hooks/useSubStep'; import type {SubStepProps} from '@hooks/useSubStep/types'; import {parsePhoneNumber} from '@libs/PhoneNumber'; -import * as ValidationUtils from '@libs/ValidationUtils'; +import {isValidWebsite} from '@libs/ValidationUtils'; import getInitialSubStepForBusinessInfo from '@pages/ReimbursementAccount/USD/utils/getInitialSubStepForBusinessInfo'; import getSubStepValues from '@pages/ReimbursementAccount/utils/getSubStepValues'; import {updateCompanyInformationForBankAccount} from '@userActions/BankAccounts'; @@ -69,7 +69,7 @@ function BusinessInfo({onBackButtonPress}: BusinessInfoProps) { ...getBankAccountFields(['routingNumber', 'accountNumber', 'bankName', 'plaidAccountID', 'plaidAccessToken', 'isSavings']), companyTaxID: values.companyTaxID?.replace(CONST.REGEX.NON_NUMERIC, ''), companyPhone: parsePhoneNumber(values.companyPhone ?? '', {regionCode: CONST.COUNTRY.US}).number?.significant, - website: ValidationUtils.isValidWebsite(companyWebsite) ? companyWebsite : undefined, + website: isValidWebsite(companyWebsite) ? companyWebsite : undefined, }, policyID, isConfirmPage, diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 56ce54f9a409..37662b909ef2 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -14,6 +14,8 @@ import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; +import {setWorkspaceInviteMembersDraft} from '@libs/actions/Policy/Member'; +import {clearErrors, openWorkspaceInvitePage as policyOpenWorkspaceInvitePage, setWorkspaceErrors} from '@libs/actions/Policy/Policy'; import {searchInServer} from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; import {canUseTouchScreen} from '@libs/DeviceCapabilities'; @@ -27,8 +29,6 @@ import {addSMSDomainIfPhoneNumber, parsePhoneNumber} from '@libs/PhoneNumber'; import {getIneligibleInvitees, getMemberAccountIDsForWorkspace, goBackFromInvalidPolicy} from '@libs/PolicyUtils'; import type {OptionData} from '@libs/ReportUtils'; import type {SettingsNavigatorParamList} from '@navigation/types'; -import * as Member from '@userActions/Policy/Member'; -import * as Policy from '@userActions/Policy/Policy'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; @@ -61,14 +61,14 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { const openWorkspaceInvitePage = () => { const policyMemberEmailsToAccountIDs = getMemberAccountIDsForWorkspace(policy?.employeeList); - Policy.openWorkspaceInvitePage(route.params.policyID, Object.keys(policyMemberEmailsToAccountIDs)); + policyOpenWorkspaceInvitePage(route.params.policyID, Object.keys(policyMemberEmailsToAccountIDs)); }; const {options, areOptionsInitialized} = useOptionsList({ shouldInitialize: didScreenTransitionEnd, }); useEffect(() => { - Policy.clearErrors(route.params.policyID); + clearErrors(route.params.policyID); openWorkspaceInvitePage(); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- policyID changes remount the component }, []); @@ -214,7 +214,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { }, [areOptionsInitialized, selectedOptions, debouncedSearchTerm, personalDetails, translate, usersToInvite]); const toggleOption = (option: MemberForList) => { - Policy.clearErrors(route.params.policyID); + clearErrors(route.params.policyID); const isOptionInList = selectedOptions.some((selectedOption) => selectedOption.login === option.login); @@ -234,7 +234,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { errors.noUserSelected = 'true'; } - Policy.setWorkspaceErrors(route.params.policyID, errors); + setWorkspaceErrors(route.params.policyID, errors); const isValid = isEmptyObject(errors); if (!isValid) { @@ -251,7 +251,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { } invitedEmailsToAccountIDs[login] = Number(accountID); }); - Member.setWorkspaceInviteMembersDraft(route.params.policyID, invitedEmailsToAccountIDs); + setWorkspaceInviteMembersDraft(route.params.policyID, invitedEmailsToAccountIDs); Navigation.navigate(ROUTES.WORKSPACE_INVITE_MESSAGE.getRoute(route.params.policyID, Navigation.getActiveRoute())); }, [route.params.policyID, selectedOptions]); @@ -307,7 +307,7 @@ function WorkspaceInvitePage({route, policy}: WorkspaceInvitePageProps) { title={translate('workspace.invite.invitePeople')} subtitle={policyName} onBackButtonPress={() => { - Policy.clearErrors(route.params.policyID); + clearErrors(route.params.policyID); Navigation.goBack(); }} />