Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Workspace Switcher and Get Assistance Button issues #58000

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
19 changes: 0 additions & 19 deletions src/components/HeaderWithBackButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function HeaderWithBackButton({
iconWidth,
iconHeight,
iconStyles,
guidesCallTaskID = '',
onBackButtonPress = () => Navigation.goBack(),
onCloseButtonPress = () => Navigation.dismissModal(),
onDownloadButtonPress = () => {},
Expand All @@ -43,8 +42,6 @@ function HeaderWithBackButton({
shouldShowCloseButton = false,
shouldShowDownloadButton = false,
isDownloading = false,
shouldShowGetAssistanceButton = false,
shouldDisableGetAssistanceButton = false,
shouldShowPinButton = false,
shouldSetModalVisibility = true,
shouldShowThreeDotsButton = false,
Expand Down Expand Up @@ -232,22 +229,6 @@ function HeaderWithBackButton({
color={theme.spinner}
/>
))}
{shouldShowGetAssistanceButton && (
<Tooltip text={translate('getAssistancePage.questionMarkButtonTooltip')}>
<PressableWithoutFeedback
disabled={shouldDisableGetAssistanceButton}
onPress={() => Navigation.navigate(ROUTES.GET_ASSISTANCE.getRoute(guidesCallTaskID, Navigation.getActiveRoute()))}
style={[styles.touchableButtonImage]}
role="button"
accessibilityLabel={translate('getAssistancePage.questionMarkButtonTooltip')}
>
<Icon
src={Expensicons.QuestionMark}
fill={iconFill ?? theme.icon}
/>
</PressableWithoutFeedback>
</Tooltip>
)}
{shouldShowPinButton && !!report && <PinButton report={report} />}
{shouldShowThreeDotsButton && (
<ThreeDotsMenu
Expand Down
9 changes: 0 additions & 9 deletions src/components/HeaderWithBackButton/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {
/** 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;

Expand Down Expand Up @@ -104,9 +98,6 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {
/** 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;

Expand Down
5 changes: 0 additions & 5 deletions src/components/InteractiveStepWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ViewStyle>;
};
Expand All @@ -57,7 +54,6 @@ function InteractiveStepWrapper(
shouldEnableMaxHeight,
shouldShowOfflineIndicator,
shouldEnablePickerAvoiding = false,
guidesCallTaskID,
offlineIndicatorStyle,
}: InteractiveStepWrapperProps,
ref: React.ForwardedRef<View>,
Expand All @@ -78,7 +74,6 @@ function InteractiveStepWrapper(
title={headerTitle}
subtitle={headerSubtitle}
onBackButtonPress={handleBackButtonPress}
guidesCallTaskID={guidesCallTaskID}
/>
{!!stepNames && (
<View style={[styles.ph5, styles.mb5, styles.mt3, {height: CONST.BANK_ACCOUNT.STEPS_HEADER_HEIGHT}]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import type {BankAccountStepProps, CompanyStepProps, ReimbursementAccountProps}

type BankAccountCompanyInformation = BankAccountStepProps & CompanyStepProps & ReimbursementAccountProps;

type UpdateCompanyInformationForBankAccountParams = Partial<BankAccountCompanyInformation> & {bankAccountID: number; policyID: string; confirm: boolean};
type UpdateCompanyInformationForBankAccountParams = Partial<BankAccountCompanyInformation> & {bankAccountID: number; policyID: string | undefined; confirm: boolean};

export default UpdateCompanyInformationForBankAccountParams;
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ const SettingsModalStackNavigator = createModalStackNavigator<SettingsNavigatorP
require<ReactComponentModule>('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopCustomersDisplayedAsPage').default,
[SCREENS.WORKSPACE.ACCOUNTING.QUICKBOOKS_DESKTOP_ITEMS]: () => require<ReactComponentModule>('../../../../pages/workspace/accounting/qbd/import/QuickbooksDesktopItemsPage').default,
[SCREENS.REIMBURSEMENT_ACCOUNT]: () => require<ReactComponentModule>('../../../../pages/ReimbursementAccount/ReimbursementAccountPage').default,
[SCREENS.GET_ASSISTANCE]: () => require<ReactComponentModule>('../../../../pages/GetAssistancePage').default,
[SCREENS.SETTINGS.REPORT_CARD_LOST_OR_DAMAGED]: () => require<ReactComponentModule>('../../../../pages/settings/Wallet/ReportCardLostPage').default,
[SCREENS.KEYBOARD_SHORTCUTS]: () => require<ReactComponentModule>('../../../../pages/KeyboardShortcutsPage').default,
[SCREENS.SETTINGS.EXIT_SURVEY.REASON]: () => require<ReactComponentModule>('../../../../pages/settings/ExitSurvey/ExitSurveyReasonPage').default,
Expand Down
3 changes: 0 additions & 3 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,9 +869,6 @@ const config: LinkingOptions<RootNavigatorParamList>['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,
},
Expand Down
3 changes: 0 additions & 3 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,6 @@ type SettingsNavigatorParamList = {
policyID: string;
connection: ValueOf<typeof CONST.POLICY.CONNECTIONS.ROUTE>;
};
[SCREENS.GET_ASSISTANCE]: {
backTo: Routes;
};
[SCREENS.TWO_FACTOR_AUTH.DISABLED]: undefined;
[SCREENS.TWO_FACTOR_AUTH.DISABLE]: undefined;
[SCREENS.SETTINGS.DELEGATE.ADD_DELEGATE]: undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/BankAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompanyStepProps>, policyID: string, isConfirmPage: boolean) {
function updateCompanyInformationForBankAccount(bankAccountID: number, params: Partial<CompanyStepProps>, policyID: string | undefined, isConfirmPage: boolean) {
API.write(
WRITE_COMMANDS.UPDATE_COMPANY_INFORMATION_FOR_BANK_ACCOUNT,
{
Expand Down
100 changes: 0 additions & 100 deletions src/pages/GetAssistancePage.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -56,7 +55,6 @@ function ConnectedVerifiedBankAccount({reimbursementAccount, onBackButtonPress,
>
<HeaderWithBackButton
title={translate('workspace.common.connectBankAccount')}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: Eslint is failing in this file

onBackButtonPress={onBackButtonPress}
/>
<ScrollView style={[styles.flex1]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -56,20 +56,20 @@ 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']),
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,
Expand Down Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,7 @@ function VerifiedBankAccountFlowEntryPoint({
<HeaderWithBackButton
title={translate('workspace.common.connectBankAccount')}
subtitle={policyName}
shouldShowGetAssistanceButton
onBackButtonPress={onBackButtonPress}
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
/>

<ScrollView style={styles.flex1}>
Expand Down
1 change: 0 additions & 1 deletion src/pages/ReportParticipantsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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))}
/>
<View style={[styles.pl5, styles.pr5]}>{headerButtons}</View>
Expand Down
1 change: 1 addition & 0 deletions src/pages/WorkspaceSwitcherPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function WorkspaceSwitcherPage() {
<HeaderWithBackButton
title={translate('workspace.switcher.headerTitle')}
onBackButtonPress={Navigation.goBack}
shouldDisplayHelpButton={false}
/>
{shouldShowLoadingIndicator ? (
<FullScreenLoadingIndicator style={[styles.flex1, styles.pRelative]} />
Expand Down
2 changes: 0 additions & 2 deletions src/pages/workspace/WorkspaceInviteMessagePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ function WorkspaceInviteMessagePage({policy, route, currentUserPersonalDetails}:
<HeaderWithBackButton
title={translate('workspace.inviteMessage.confirmDetails')}
subtitle={policyName}
shouldShowGetAssistanceButton
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_MEMBERS}
shouldShowBackButton
onCloseButtonPress={() => Navigation.dismissModal()}
onBackButtonPress={() => Navigation.goBack(route.params.backTo)}
Expand Down
Loading