From 15c5210ac2835853cb3fc81c3851ba53641ccbfe Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:33:35 +0200 Subject: [PATCH 01/21] update the pay w/ expensify selectors logic --- src/CONST.ts | 5 ++ src/components/AddPaymentMethodMenu.tsx | 47 +++++++++++++++++-- .../parameters/CompleteGuidedSetupParams.ts | 1 + src/libs/actions/Report.ts | 2 + src/types/onyx/IntroSelected.ts | 3 ++ 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 50df9118a74e..bfb1ae701da4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1840,6 +1840,11 @@ const CONST = { BUSINESS_BANK_ACCOUNT: 'businessBankAccount', }, + PAYMENT_SELECTED: { + BBA: 'BBA', + PBA: 'PBA', + }, + PAYMENT_METHOD_ID_KEYS: { DEBIT_CARD: 'fundID', BANK_ACCOUNT: 'bankAccountID', diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 325bab091bec..87644c4b67fc 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -1,18 +1,22 @@ import type {RefObject} from 'react'; -import React from 'react'; +import React, {useCallback} from 'react'; import type {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx, withOnyx} from 'react-native-onyx'; +import type {ValueOf} from 'type-fest'; import useLocalize from '@hooks/useLocalize'; +import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import * as ReportUserActions from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {AnchorPosition} from '@src/styles'; -import type {Report, Session} from '@src/types/onyx'; +import type {PersonalDetails, Report, Session} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import * as Expensicons from './Icon/Expensicons'; import type {PaymentMethod} from './KYCWall/types'; +import {usePersonalDetails} from './OnyxProvider'; import PopoverMenu from './PopoverMenu'; type AddPaymentMethodMenuOnyxProps = { @@ -70,6 +74,32 @@ function AddPaymentMethodMenu({ const canUsePersonalBankAccount = shouldShowPersonalBankAccountOption || isIOUReport; + const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); + const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; + + const personalDetails = usePersonalDetails() || CONST.EMPTY_OBJECT; + const personalDetailsList = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(session?.accountID ? [session.accountID] : [], personalDetails)) as PersonalDetails[]; + const personalDetail = personalDetailsList[0] ?? {}; + + const completeEngagement = useCallback( + (paymentSelected: ValueOf) => { + if (isInviteOnboardingComplete || !introSelected?.choice) { + return; + } + + ReportUserActions.completeOnboarding( + introSelected?.choice, + CONST.ONBOARDING_MESSAGES[introSelected?.choice], + { + firstName: personalDetail.firstName ?? '', + lastName: personalDetail.lastName ?? '', + }, + paymentSelected, + ); + }, + [isInviteOnboardingComplete, introSelected?.choice, personalDetail.firstName, personalDetail.lastName], + ); + return ( { + completeEngagement(CONST.PAYMENT_SELECTED.PBA); onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, @@ -95,7 +126,10 @@ function AddPaymentMethodMenu({ { text: translate('common.businessBankAccount'), icon: Expensicons.Building, - onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT), + onSelected: () => { + completeEngagement(CONST.PAYMENT_SELECTED.BBA); + onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); + }, }, ] : []), @@ -103,7 +137,10 @@ function AddPaymentMethodMenu({ { text: translate('common.debitCard'), icon: Expensicons.CreditCard, - onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), + onSelected: () => { + completeEngagement(CONST.PAYMENT_SELECTED.PBA); + onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD); + }, }, ], ]} diff --git a/src/libs/API/parameters/CompleteGuidedSetupParams.ts b/src/libs/API/parameters/CompleteGuidedSetupParams.ts index 8e1273ac6053..0b2c0b66ef0a 100644 --- a/src/libs/API/parameters/CompleteGuidedSetupParams.ts +++ b/src/libs/API/parameters/CompleteGuidedSetupParams.ts @@ -6,6 +6,7 @@ type CompleteGuidedSetupParams = { actorAccountID: number; guidedSetupData: string; engagementChoice: OnboardingPurposeType; + paymentSelected?: string; }; export default CompleteGuidedSetupParams; diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 3060f53f12c3..bc9c114442a0 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3158,6 +3158,7 @@ function completeOnboarding( }, adminsChatReportID?: string, onboardingPolicyID?: string, + paymentSelected?: string, ) { const isAccountIDOdd = AccountUtils.isAccountIDOddNumber(currentUserAccountID ?? 0); const targetEmail = isAccountIDOdd ? CONST.EMAIL.NOTIFICATIONS : CONST.EMAIL.CONCIERGE; @@ -3504,6 +3505,7 @@ function completeOnboarding( lastName, actorAccountID, guidedSetupData: JSON.stringify(guidedSetupData), + paymentSelected, }; API.write(WRITE_COMMANDS.COMPLETE_GUIDED_SETUP, parameters, {optimisticData, successData, failureData}); diff --git a/src/types/onyx/IntroSelected.ts b/src/types/onyx/IntroSelected.ts index 6850f651ca2a..6693745d2c95 100644 --- a/src/types/onyx/IntroSelected.ts +++ b/src/types/onyx/IntroSelected.ts @@ -4,6 +4,9 @@ import type {OnboardingPurposeType} from '@src/CONST'; type IntroSelected = { /** The choice that the user selected in the engagement modal */ choice: OnboardingPurposeType; + + /** Whether the onboarding is complete */ + isInviteOnboardingComplete: boolean; }; export default IntroSelected; From f0a484508ae082a765140f53ccd0e0535c4a3333 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:03:15 +0200 Subject: [PATCH 02/21] update completeEngagement in AddPaymentMethodMenu with inviteType check for choice --- src/CONST.ts | 100 ++++++++++++++++-- src/components/AddPaymentMethodMenu.tsx | 13 ++- src/libs/actions/Report.ts | 2 + .../BaseOnboardingPurpose.tsx | 2 +- src/types/onyx/IntroSelected.ts | 9 +- 5 files changed, 112 insertions(+), 14 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index a273c2c105c4..c3a977f07e26 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4,6 +4,7 @@ import dateSubtract from 'date-fns/sub'; import Config from 'react-native-config'; import * as KeyCommand from 'react-native-key-command'; import type {ValueOf} from 'type-fest'; +import type {Video} from './libs/actions/Report'; import BankAccount from './libs/models/BankAccount'; import * as Url from './libs/Url'; import SCREENS from './SCREENS'; @@ -63,7 +64,7 @@ const chatTypes = { // Explicit type annotation is required const cardActiveStates: number[] = [2, 3, 4, 7]; -const onboardingChoices = { +const selectableOnboardingChoices = { PERSONAL_SPEND: 'newDotPersonalSpend', MANAGE_TEAM: 'newDotManageTeam', EMPLOYER: 'newDotEmployer', @@ -71,8 +72,40 @@ const onboardingChoices = { LOOKING_AROUND: 'newDotLookingAround', }; +const backendOnboardingChoices = { + ADMIN: 'newDotAdmin', + SUBMIT: 'newDotSubmit', +}; + +const onboardingChoices = { + ...selectableOnboardingChoices, + ...backendOnboardingChoices, +}; + type OnboardingPurposeType = ValueOf; +const onboardingInviteTypes = { + IOU: 'iou', + INVOICE: 'invoice', + CHAT: 'chat', +}; + +type OnboardingInviteType = ValueOf; + +type OnboardingTaskType = { + type: string; + autoCompleted: boolean; + title: string; + description: string | ((params: Partial<{adminsRoomLink: string; workspaceLink: string}>) => string); +}; + +type OnboardingMessageType = { + message: string; + video?: Video; + tasks: OnboardingTaskType[]; + type?: string; +}; + const CONST = { RECENT_WAYPOINTS_NUMBER: 20, DEFAULT_DB_NAME: 'OnyxDB', @@ -4189,6 +4222,8 @@ const CONST = { ONBOARDING_INTRODUCTION: 'Let’s get you set up 🔧', ONBOARDING_CHOICES: {...onboardingChoices}, + SELECTABLE_ONBOARDING_CHOICES: {...selectableOnboardingChoices}, + ONBOARDING_INVITE_TYPES: {...onboardingInviteTypes}, ACTIONABLE_TRACK_EXPENSE_WHISPER_MESSAGE: 'What would you like to do with this expense?', ONBOARDING_CONCIERGE: { [onboardingChoices.EMPLOYER]: @@ -4231,7 +4266,7 @@ const CONST = { }, ONBOARDING_MESSAGES: { - [onboardingChoices.EMPLOYER]: { + [(onboardingChoices.EMPLOYER || onboardingChoices.SUBMIT)]: { message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', video: { url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, @@ -4302,7 +4337,7 @@ const CONST = { type: 'meetGuide', autoCompleted: false, title: 'Meet your setup specialist', - description: ({adminsRoomLink}: {adminsRoomLink: string}) => + description: ({adminsRoomLink}) => `Meet your setup specialist, who can answer any questions as you get started with Expensify. Yes, a real human!\n` + '\n' + `Chat with the specialist in your [#admins room](${adminsRoomLink}).`, @@ -4311,7 +4346,7 @@ const CONST = { type: 'setupCategories', autoCompleted: false, title: 'Set up categories', - description: ({workspaceLink}: {workspaceLink: string}) => + description: ({workspaceLink}) => '*Set up categories* so your team can code expenses for easy reporting.\n' + '\n' + 'Here’s how to set up categories:\n' + @@ -4328,7 +4363,7 @@ const CONST = { type: 'addExpenseApprovals', autoCompleted: false, title: 'Add expense approvals', - description: ({workspaceLink}: {workspaceLink: string}) => + description: ({workspaceLink}) => '*Add expense approvals* to review your team’s spend and keep it under control.\n' + '\n' + 'Here’s how to add expense approvals:\n' + @@ -4345,7 +4380,7 @@ const CONST = { type: 'inviteTeam', autoCompleted: false, title: 'Invite your team', - description: ({workspaceLink}: {workspaceLink: string}) => + description: ({workspaceLink}) => '*Invite your team* to Expensify so they can start tracking expenses today.\n' + '\n' + 'Here’s how to invite your team:\n' + @@ -4448,12 +4483,61 @@ const CONST = { }, ], }, + [onboardingChoices.ADMIN]: { + message: "Hey 👋\nAs an admin, learn how to manage your team's workspace and submit expenses yourself.", + video: { + url: `${CLOUDFRONT_URL}/videos/guided-setup-manage-team-v2.mp4`, + thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-manage-team.jpg`, + duration: 55, + width: 1280, + height: 960, + }, + tasks: [ + { + type: 'meetSetupSpecialist', + autoCompleted: false, + title: 'Meet your setup specialist', + description: + '*Meet your setup specialist* who can answer any questions as you get started with Expensify. Yes, a real human!' + + '\n' + + 'Chat with them in your #admins room or schedule a call today.', + }, + { + type: 'reviewWorkspaceSettings', + autoCompleted: false, + title: 'Review your workspace settings', + description: + "Here's how to review and update your workspace settings:" + + '\n' + + '1. Click your profile picture.' + + '2. Click *Workspaces* > [Your workspace].' + + '\n' + + "Make any changes there and we'll track them in the #admins room.", + }, + { + type: 'submitExpense', + autoCompleted: false, + title: 'Submit an expense', + description: + '*Submit an expense* by entering an amount or scanning a receipt.\n' + + '\n' + + 'Here’s how to submit an expense:\n' + + '\n' + + '1. Click the green *+* button.\n' + + '2. Choose *Submit expense*.\n' + + '3. Enter an amount or scan a receipt.\n' + + '4. Add your reimburser to the request.\n' + + '\n' + + 'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.', + }, + ], + }, [onboardingChoices.LOOKING_AROUND]: { message: "Expensify is best known for expense and corporate card management, but we do a lot more than that. Let me know what you're interested in and I'll help get you started.", tasks: [], }, - }, + } satisfies Record, REPORT_FIELD_TITLE_FIELD_ID: 'text_title', @@ -5433,6 +5517,6 @@ type FeedbackSurveyOptionID = ValueOf; type CancellationType = ValueOf; -export type {Country, IOUAction, IOUType, RateAndUnit, OnboardingPurposeType, IOURequestType, SubscriptionType, FeedbackSurveyOptionID, CancellationType}; +export type {Country, IOUAction, IOUType, RateAndUnit, OnboardingPurposeType, IOURequestType, SubscriptionType, FeedbackSurveyOptionID, CancellationType, OnboardingInviteType}; export default CONST; diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 9847aba8df2c..51ac2776b876 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -87,9 +87,18 @@ function AddPaymentMethodMenu({ return; } + let choice = introSelected.choice; + if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.PAYMENT_SELECTED.BBA) { + choice = CONST.ONBOARDING_CHOICES.MANAGE_TEAM; + } + + if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.PAYMENT_SELECTED.BBA) { + choice = CONST.ONBOARDING_CHOICES.SUBMIT; + } + ReportUserActions.completeOnboarding( - introSelected?.choice, - CONST.ONBOARDING_MESSAGES[introSelected?.choice], + choice, + CONST.ONBOARDING_MESSAGES[choice], { firstName: personalDetail.firstName ?? '', lastName: personalDetail.lastName ?? '', diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index de651ff27610..e6ccc3d274ef 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3851,6 +3851,8 @@ function markAsManuallyExported(reportID: string) { }); } +export type {Video}; + export { searchInServer, addComment, diff --git a/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx b/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx index e9d0887bdac7..8d45a4893171 100644 --- a/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx +++ b/src/pages/OnboardingPurpose/BaseOnboardingPurpose.tsx @@ -85,7 +85,7 @@ function BaseOnboardingPurpose({shouldUseNativeStyles, shouldEnableMaxHeight, ro Navigation.navigate(ROUTES.ONBOARDING_PERSONAL_DETAILS.getRoute(route.params?.backTo)); }, [selectedPurpose, route]); - const menuItems: MenuItemProps[] = Object.values(CONST.ONBOARDING_CHOICES).map((choice) => { + const menuItems: MenuItemProps[] = Object.values(CONST.SELECTABLE_ONBOARDING_CHOICES).map((choice) => { const translationKey = `onboarding.purpose.${choice}` as const; const isSelected = selectedPurpose === choice; return { diff --git a/src/types/onyx/IntroSelected.ts b/src/types/onyx/IntroSelected.ts index 6693745d2c95..0e1b4ec60ae4 100644 --- a/src/types/onyx/IntroSelected.ts +++ b/src/types/onyx/IntroSelected.ts @@ -1,12 +1,15 @@ -import type {OnboardingPurposeType} from '@src/CONST'; +import type {OnboardingInviteType, OnboardingPurposeType} from '@src/CONST'; /** Model of onboarding */ -type IntroSelected = { +type IntroSelected = Partial<{ /** The choice that the user selected in the engagement modal */ choice: OnboardingPurposeType; + /** The invite type */ + inviteType: OnboardingInviteType; + /** Whether the onboarding is complete */ isInviteOnboardingComplete: boolean; -}; +}>; export default IntroSelected; From 7cea50d93f6e3e05bf7adaa211d1b049b6ffe918 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:05:00 +0200 Subject: [PATCH 03/21] fix lint, add useCallback dependency --- src/components/AddPaymentMethodMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 51ac2776b876..839ab6a0c9bb 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -106,7 +106,7 @@ function AddPaymentMethodMenu({ paymentSelected, ); }, - [isInviteOnboardingComplete, introSelected?.choice, personalDetail.firstName, personalDetail.lastName], + [isInviteOnboardingComplete, introSelected?.inviteType, introSelected?.choice, personalDetail.firstName, personalDetail.lastName], ); const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; From aa98fd457e0c7277dd72ac3097279e635632b195 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:05:47 +0200 Subject: [PATCH 04/21] fix prettier --- src/CONST.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index c3a977f07e26..0ab391ac1a36 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4266,7 +4266,7 @@ const CONST = { }, ONBOARDING_MESSAGES: { - [(onboardingChoices.EMPLOYER || onboardingChoices.SUBMIT)]: { + [onboardingChoices.EMPLOYER || onboardingChoices.SUBMIT]: { message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', video: { url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, From 29eda5ed0fdf10262937beb8f43c348b58a65519 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:08:43 +0200 Subject: [PATCH 05/21] refactor CONST onboarding messages --- src/CONST.ts | 139 +++++++++++++++++---------------------------------- 1 file changed, 46 insertions(+), 93 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index dd8bf93ce820..f0bb7e52a9e2 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -74,7 +74,6 @@ const selectableOnboardingChoices = { }; const backendOnboardingChoices = { - ADMIN: 'newDotAdmin', SUBMIT: 'newDotSubmit', }; @@ -83,6 +82,50 @@ const onboardingChoices = { ...backendOnboardingChoices, }; +const onboardingEmployerOrSubmitMessage = { + message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', + video: { + url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, + thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-get-paid-back.jpg`, + duration: 55, + width: 1280, + height: 960, + }, + tasks: [ + { + type: 'submitExpense', + autoCompleted: false, + title: 'Submit an expense', + description: + '*Submit an expense* by entering an amount or scanning a receipt.\n' + + '\n' + + 'Here’s how to submit an expense:\n' + + '\n' + + '1. Click the green *+* button.\n' + + '2. Choose *Submit expense*.\n' + + '3. Enter an amount or scan a receipt.\n' + + '4. Add your reimburser to the request.\n' + + '\n' + + 'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.', + }, + { + type: 'enableWallet', + autoCompleted: false, + title: 'Enable your wallet', + description: + 'You’ll need to *enable your Expensify Wallet* to get paid back. Don’t worry, it’s easy!\n' + + '\n' + + 'Here’s how to set up your wallet:\n' + + '\n' + + '1. Click your profile picture.\n' + + '2. Click *Wallet* > *Enable wallet*.\n' + + '3. Connect your bank account.\n' + + '\n' + + 'Once that’s done, you can request money from anyone and get paid back right into your personal bank account.', + }, + ], +}; + type OnboardingPurposeType = ValueOf; const onboardingInviteTypes = { @@ -4307,49 +4350,8 @@ const CONST = { }, ONBOARDING_MESSAGES: { - [onboardingChoices.EMPLOYER || onboardingChoices.SUBMIT]: { - message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', - video: { - url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, - thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-get-paid-back.jpg`, - duration: 55, - width: 1280, - height: 960, - }, - tasks: [ - { - type: 'submitExpense', - autoCompleted: false, - title: 'Submit an expense', - description: - '*Submit an expense* by entering an amount or scanning a receipt.\n' + - '\n' + - 'Here’s how to submit an expense:\n' + - '\n' + - '1. Click the green *+* button.\n' + - '2. Choose *Submit expense*.\n' + - '3. Enter an amount or scan a receipt.\n' + - '4. Add your reimburser to the request.\n' + - '\n' + - 'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.', - }, - { - type: 'enableWallet', - autoCompleted: false, - title: 'Enable your wallet', - description: - 'You’ll need to *enable your Expensify Wallet* to get paid back. Don’t worry, it’s easy!\n' + - '\n' + - 'Here’s how to set up your wallet:\n' + - '\n' + - '1. Click your profile picture.\n' + - '2. Click *Wallet* > *Enable wallet*.\n' + - '3. Connect your bank account.\n' + - '\n' + - 'Once that’s done, you can request money from anyone and get paid back right into your personal bank account.', - }, - ], - }, + [onboardingChoices.EMPLOYER]: {...onboardingEmployerOrSubmitMessage}, + [onboardingChoices.SUBMIT]: {...onboardingEmployerOrSubmitMessage}, [onboardingChoices.MANAGE_TEAM]: { message: 'Here are some important tasks to help get your team’s expenses under control.', video: { @@ -4524,55 +4526,6 @@ const CONST = { }, ], }, - [onboardingChoices.ADMIN]: { - message: "Hey 👋\nAs an admin, learn how to manage your team's workspace and submit expenses yourself.", - video: { - url: `${CLOUDFRONT_URL}/videos/guided-setup-manage-team-v2.mp4`, - thumbnailUrl: `${CLOUDFRONT_URL}/images/guided-setup-manage-team.jpg`, - duration: 55, - width: 1280, - height: 960, - }, - tasks: [ - { - type: 'meetSetupSpecialist', - autoCompleted: false, - title: 'Meet your setup specialist', - description: - '*Meet your setup specialist* who can answer any questions as you get started with Expensify. Yes, a real human!' + - '\n' + - 'Chat with them in your #admins room or schedule a call today.', - }, - { - type: 'reviewWorkspaceSettings', - autoCompleted: false, - title: 'Review your workspace settings', - description: - "Here's how to review and update your workspace settings:" + - '\n' + - '1. Click your profile picture.' + - '2. Click *Workspaces* > [Your workspace].' + - '\n' + - "Make any changes there and we'll track them in the #admins room.", - }, - { - type: 'submitExpense', - autoCompleted: false, - title: 'Submit an expense', - description: - '*Submit an expense* by entering an amount or scanning a receipt.\n' + - '\n' + - 'Here’s how to submit an expense:\n' + - '\n' + - '1. Click the green *+* button.\n' + - '2. Choose *Submit expense*.\n' + - '3. Enter an amount or scan a receipt.\n' + - '4. Add your reimburser to the request.\n' + - '\n' + - 'Then, send your request and wait for that sweet “Cha-ching!” when it’s complete.', - }, - ], - }, [onboardingChoices.LOOKING_AROUND]: { message: "Expensify is best known for expense and corporate card management, but we do a lot more than that. Let me know what you're interested in and I'll help get you started.", From 75e336dc86f33b3456dfe4ef486d4e8ab085162d Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:16:14 +0200 Subject: [PATCH 06/21] correct naming for onboardingPurpose param --- src/components/AddPaymentMethodMenu.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 525acc073822..3bde9d9ec7d7 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -85,22 +85,22 @@ function AddPaymentMethodMenu({ const completeEngagement = useCallback( (paymentSelected: ValueOf) => { - if (isInviteOnboardingComplete || !introSelected?.choice) { + if (isInviteOnboardingComplete) { return; } - let choice = introSelected.choice; + let onboardingPurpose = introSelected.choice; if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.PAYMENT_SELECTED.BBA) { - choice = CONST.ONBOARDING_CHOICES.MANAGE_TEAM; + onboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM; } if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.PAYMENT_SELECTED.BBA) { - choice = CONST.ONBOARDING_CHOICES.SUBMIT; + onboardingPurpose = CONST.ONBOARDING_CHOICES.SUBMIT; } ReportUserActions.completeOnboarding( - choice, - CONST.ONBOARDING_MESSAGES[choice], + onboardingPurpose, + CONST.ONBOARDING_MESSAGES[onboardingPurpose], { firstName: personalDetail.firstName ?? '', lastName: personalDetail.lastName ?? '', From 83d33a1efc70b7dc62e686026fd911f1a01ae001 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:19:14 +0200 Subject: [PATCH 07/21] fix prettier and undefined check --- src/components/AddPaymentMethodMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 3bde9d9ec7d7..b9aae50f1612 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -16,8 +16,8 @@ import type {PersonalDetails, Report, Session} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import * as Expensicons from './Icon/Expensicons'; import type {PaymentMethod} from './KYCWall/types'; -import {usePersonalDetails} from './OnyxProvider'; import type BaseModalProps from './Modal/types'; +import {usePersonalDetails} from './OnyxProvider'; import PopoverMenu from './PopoverMenu'; type AddPaymentMethodMenuOnyxProps = { @@ -85,7 +85,7 @@ function AddPaymentMethodMenu({ const completeEngagement = useCallback( (paymentSelected: ValueOf) => { - if (isInviteOnboardingComplete) { + if (isInviteOnboardingComplete || !introSelected?.choice) { return; } From 9ba23dd6603fdf7cb7fefac2236bbe8efd004790 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 26 Aug 2024 14:55:01 +0200 Subject: [PATCH 08/21] add completePaymentOnboarding method to all necessary components --- src/components/AddPaymentMethodMenu.tsx | 40 ++-------------- .../ReportActionItem/ReportPreview.tsx | 2 + src/libs/actions/IOU.ts | 48 +++++++++++++++++++ 3 files changed, 53 insertions(+), 37 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index b9aae50f1612..97a59cc0af69 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -17,8 +17,8 @@ import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import * as Expensicons from './Icon/Expensicons'; import type {PaymentMethod} from './KYCWall/types'; import type BaseModalProps from './Modal/types'; -import {usePersonalDetails} from './OnyxProvider'; import PopoverMenu from './PopoverMenu'; +import * as IOU from '@userActions/IOU'; type AddPaymentMethodMenuOnyxProps = { /** Session info for the currently logged-in user. */ @@ -76,40 +76,6 @@ function AddPaymentMethodMenu({ const canUsePersonalBankAccount = shouldShowPersonalBankAccountOption || isIOUReport; - const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED); - const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; - - const personalDetails = usePersonalDetails() || CONST.EMPTY_OBJECT; - const personalDetailsList = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(session?.accountID ? [session.accountID] : [], personalDetails)) as PersonalDetails[]; - const personalDetail = personalDetailsList[0] ?? {}; - - const completeEngagement = useCallback( - (paymentSelected: ValueOf) => { - if (isInviteOnboardingComplete || !introSelected?.choice) { - return; - } - - let onboardingPurpose = introSelected.choice; - if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.PAYMENT_SELECTED.BBA) { - onboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM; - } - - if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.PAYMENT_SELECTED.BBA) { - onboardingPurpose = CONST.ONBOARDING_CHOICES.SUBMIT; - } - - ReportUserActions.completeOnboarding( - onboardingPurpose, - CONST.ONBOARDING_MESSAGES[onboardingPurpose], - { - firstName: personalDetail.firstName ?? '', - lastName: personalDetail.lastName ?? '', - }, - paymentSelected, - ); - }, - [isInviteOnboardingComplete, introSelected?.inviteType, introSelected?.choice, personalDetail.firstName, personalDetail.lastName], - ); const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; // We temporarily disabled P2P debit cards so we will automatically select the personal bank account option if there is no other option to select. @@ -146,7 +112,7 @@ function AddPaymentMethodMenu({ text: translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { - completeEngagement(CONST.PAYMENT_SELECTED.PBA); + IOU.completePaymentOnboarding(CONST.PAYMENT_SELECTED.PBA); onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, @@ -158,7 +124,7 @@ function AddPaymentMethodMenu({ text: translate('common.businessBankAccount'), icon: Expensicons.Building, onSelected: () => { - completeEngagement(CONST.PAYMENT_SELECTED.BBA); + IOU.completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA); onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); }, }, diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 45a06968cefd..164348e3e949 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -200,6 +200,8 @@ function ReportPreview({ if (ReportUtils.hasHeldExpenses(iouReport?.reportID)) { setIsHoldMenuVisible(true); } else if (chatReport && iouReport) { + const paymentSelected = type === CONST.IOU.PAYMENT_TYPE.VBBA ? CONST.PAYMENT_SELECTED.BBA : CONST.PAYMENT_SELECTED.PBA; + IOU.completePaymentOnboarding(paymentSelected); if (ReportUtils.isInvoiceReport(iouReport)) { IOU.payInvoice(type, chatReport, iouReport, payAsBusiness); } else { diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 5dab6176847d..80323d96787e 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -67,6 +67,9 @@ import * as Category from './Policy/Category'; import * as Policy from './Policy/Policy'; import * as Tag from './Policy/Tag'; import * as Report from './Report'; +import * as SessionUtils from '@libs/SessionUtils'; +import * as ReportUserActions from '@userActions/Report'; +import * as OptionsListUtils from '@libs/OptionsListUtils'; type IOURequestType = ValueOf; @@ -271,6 +274,18 @@ Onyx.connect({ callback: (value) => (activePolicyID = value), }); +let introSelected: OnyxEntry; +Onyx.connect({ + key: ONYXKEYS.NVP_INTRO_SELECTED, + callback: (value) => (introSelected = value), +}); + +let personalDetailsList: OnyxEntry; +Onyx.connect({ + key: ONYXKEYS.PERSONAL_DETAILS_LIST, + callback: (value) => (personalDetailsList = value), +}); + /** * Find the report preview action from given chat report and iou report */ @@ -7366,6 +7381,38 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O ); } +function completePaymentOnboarding(paymentSelected: ValueOf) { + const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; + + if (isInviteOnboardingComplete || !introSelected?.choice) { + return; + } + + const session = SessionUtils.getSession(); + + const personalDetailsListValues = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(session?.accountID ? [session.accountID] : [], personalDetailsList)) as OnyxTypes.PersonalDetails[]; + const personalDetails = personalDetailsListValues[0] ?? {}; + + let onboardingPurpose = introSelected.choice; + if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.PAYMENT_SELECTED.BBA) { + onboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM; + } + + if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.PAYMENT_SELECTED.BBA) { + onboardingPurpose = CONST.ONBOARDING_CHOICES.SUBMIT; + } + + ReportUserActions.completeOnboarding( + onboardingPurpose, + CONST.ONBOARDING_MESSAGES[onboardingPurpose], + { + firstName: personalDetails.firstName ?? '', + lastName: personalDetails.lastName ?? '', + }, + paymentSelected, + ); +} + function payMoneyRequest(paymentType: PaymentMethodType, chatReport: OnyxTypes.Report, iouReport: OnyxTypes.Report, full = true) { if (chatReport.policyID && SubscriptionUtils.shouldRestrictUserBillableActions(chatReport.policyID)) { Navigation.navigate(ROUTES.RESTRICTED_ACTION.getRoute(chatReport.policyID)); @@ -7979,6 +8026,7 @@ export { getIOURequestPolicyID, initMoneyRequest, navigateToStartStepIfScanFileCannotBeRead, + completePaymentOnboarding, payInvoice, payMoneyRequest, putOnHold, From 29aa7f9d1885f3f3be3639e244de2bd8b6838710 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:14:34 +0200 Subject: [PATCH 09/21] fix prettier errors --- src/components/AddPaymentMethodMenu.tsx | 2 +- src/libs/actions/IOU.ts | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 97a59cc0af69..25b0830f6309 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -8,6 +8,7 @@ import useLocalize from '@hooks/useLocalize'; import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import * as IOU from '@userActions/IOU'; import * as ReportUserActions from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -18,7 +19,6 @@ import * as Expensicons from './Icon/Expensicons'; import type {PaymentMethod} from './KYCWall/types'; import type BaseModalProps from './Modal/types'; import PopoverMenu from './PopoverMenu'; -import * as IOU from '@userActions/IOU'; type AddPaymentMethodMenuOnyxProps = { /** Session info for the currently logged-in user. */ diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 80323d96787e..95f99c847523 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -40,16 +40,19 @@ import * as Localize from '@libs/Localize'; import Navigation from '@libs/Navigation/Navigation'; import * as NextStepUtils from '@libs/NextStepUtils'; import {rand64} from '@libs/NumberUtils'; +import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as PhoneNumber from '@libs/PhoneNumber'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportConnection from '@libs/ReportConnection'; import type {OptimisticChatReport, OptimisticCreatedReportAction, OptimisticIOUReportAction, TransactionDetails} from '@libs/ReportUtils'; import * as ReportUtils from '@libs/ReportUtils'; +import * as SessionUtils from '@libs/SessionUtils'; import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import {getCurrency, getTransaction} from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; +import * as ReportUserActions from '@userActions/Report'; import type {IOUAction, IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -67,9 +70,6 @@ import * as Category from './Policy/Category'; import * as Policy from './Policy/Policy'; import * as Tag from './Policy/Tag'; import * as Report from './Report'; -import * as SessionUtils from '@libs/SessionUtils'; -import * as ReportUserActions from '@userActions/Report'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; type IOURequestType = ValueOf; @@ -7390,7 +7390,9 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Tue, 27 Aug 2024 17:08:40 +0200 Subject: [PATCH 10/21] fix lint errors and remove unused imports --- src/components/AddPaymentMethodMenu.tsx | 9 +++------ src/libs/actions/IOU.ts | 3 +-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 25b0830f6309..d21ccb18c773 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -1,19 +1,16 @@ import type {RefObject} from 'react'; -import React, {useCallback, useEffect, useState} from 'react'; +import React, {useEffect, useState} from 'react'; import type {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; -import {useOnyx, withOnyx} from 'react-native-onyx'; -import type {ValueOf} from 'type-fest'; +import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; -import * as OptionsListUtils from '@libs/OptionsListUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as IOU from '@userActions/IOU'; -import * as ReportUserActions from '@userActions/Report'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {AnchorPosition} from '@src/styles'; -import type {PersonalDetails, Report, Session} from '@src/types/onyx'; +import type {Report, Session} from '@src/types/onyx'; import type AnchorAlignment from '@src/types/utils/AnchorAlignment'; import * as Expensicons from './Icon/Expensicons'; import type {PaymentMethod} from './KYCWall/types'; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 8e3423488021..eeec7ae10039 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -53,7 +53,6 @@ import * as SubscriptionUtils from '@libs/SubscriptionUtils'; import * as TransactionUtils from '@libs/TransactionUtils'; import {getCurrency, getTransaction} from '@libs/TransactionUtils'; import ViolationsUtils from '@libs/Violations/ViolationsUtils'; -import * as ReportUserActions from '@userActions/Report'; import type {IOUAction, IOUType} from '@src/CONST'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -7410,7 +7409,7 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Mon, 2 Sep 2024 13:52:34 +0200 Subject: [PATCH 11/21] move PAYMENT_SELECTED to IOU section in CONST --- src/CONST.ts | 4 ++++ src/components/AddPaymentMethodMenu.tsx | 6 +++--- src/components/ReportActionItem/ReportPreview.tsx | 2 +- src/libs/actions/IOU.ts | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 559fa8532a7b..f8af65a015d0 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2061,6 +2061,10 @@ const CONST = { ACCESS_VARIANTS: { CREATE: 'create', }, + PAYMENT_SELECTED: { + BBA: 'BBA', + PBA: 'PBA', + }, }, GROWL: { diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index d21ccb18c773..fc87af9f33a1 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -109,7 +109,7 @@ function AddPaymentMethodMenu({ text: translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { - IOU.completePaymentOnboarding(CONST.PAYMENT_SELECTED.PBA); + IOU.completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.PBA); onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, @@ -121,7 +121,7 @@ function AddPaymentMethodMenu({ text: translate('common.businessBankAccount'), icon: Expensicons.Building, onSelected: () => { - IOU.completePaymentOnboarding(CONST.PAYMENT_SELECTED.BBA); + IOU.completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.BBA); onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); }, }, @@ -133,7 +133,7 @@ function AddPaymentMethodMenu({ // text: translate('common.debitCard'), // icon: Expensicons.CreditCard, // onSelected: () => { - // completeEngagement(CONST.PAYMENT_SELECTED.PBA); + // completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.PBA); // onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD); // }, // }, diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 7dabcb5622ff..4db2c493173a 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -200,7 +200,7 @@ function ReportPreview({ if (ReportUtils.hasHeldExpenses(iouReport?.reportID)) { setIsHoldMenuVisible(true); } else if (chatReport && iouReport) { - const paymentSelected = type === CONST.IOU.PAYMENT_TYPE.VBBA ? CONST.PAYMENT_SELECTED.BBA : CONST.PAYMENT_SELECTED.PBA; + const paymentSelected = type === CONST.IOU.PAYMENT_TYPE.VBBA ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; IOU.completePaymentOnboarding(paymentSelected); if (ReportUtils.isInvoiceReport(iouReport)) { IOU.payInvoice(type, chatReport, iouReport, payAsBusiness); diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 39c226a2a1e4..fbdf275e507d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7418,11 +7418,11 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Mon, 2 Sep 2024 15:40:51 +0200 Subject: [PATCH 12/21] correct typescript typing --- src/CONST.ts | 14 +++++++------- src/libs/OptionsListUtils.ts | 5 +++-- src/libs/actions/IOU.ts | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index f8af65a015d0..e7837faac94c 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -71,18 +71,18 @@ const selectableOnboardingChoices = { EMPLOYER: 'newDotEmployer', CHAT_SPLIT: 'newDotSplitChat', LOOKING_AROUND: 'newDotLookingAround', -}; +} as const; const backendOnboardingChoices = { SUBMIT: 'newDotSubmit', -}; +} as const; const onboardingChoices = { ...selectableOnboardingChoices, ...backendOnboardingChoices, -}; +} as const; -const onboardingEmployerOrSubmitMessage = { +const onboardingEmployerOrSubmitMessage : OnboardingMessageType = { message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', video: { url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, @@ -132,7 +132,7 @@ const onboardingInviteTypes = { IOU: 'iou', INVOICE: 'invoice', CHAT: 'chat', -}; +} as const; type OnboardingInviteType = ValueOf; @@ -4324,8 +4324,8 @@ const CONST = { }, ONBOARDING_MESSAGES: { - [onboardingChoices.EMPLOYER]: {...onboardingEmployerOrSubmitMessage}, - [onboardingChoices.SUBMIT]: {...onboardingEmployerOrSubmitMessage}, + [onboardingChoices.EMPLOYER]: onboardingEmployerOrSubmitMessage, + [onboardingChoices.SUBMIT]: onboardingEmployerOrSubmitMessage, [onboardingChoices.MANAGE_TEAM]: { message: 'Here are some important tasks to help get your team’s expenses under control.', video: { diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index a4e2c721c66b..fb51cbd428a7 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -57,6 +57,7 @@ import * as ReportUtils from './ReportUtils'; import * as TaskUtils from './TaskUtils'; import * as TransactionUtils from './TransactionUtils'; import * as UserUtils from './UserUtils'; +import { SetNonNullable } from 'type-fest'; type SearchOption = ReportUtils.OptionData & { item: T; @@ -379,8 +380,8 @@ function getAvatarsForAccountIDs(accountIDs: number[], personalDetails: OnyxEntr * Returns the personal details for an array of accountIDs * @returns keys of the object are emails, values are PersonalDetails objects. */ -function getPersonalDetailsForAccountIDs(accountIDs: number[] | undefined, personalDetails: OnyxInputOrEntry): PersonalDetailsList { - const personalDetailsForAccountIDs: PersonalDetailsList = {}; +function getPersonalDetailsForAccountIDs(accountIDs: number[] | undefined, personalDetails: OnyxInputOrEntry): SetNonNullable { + const personalDetailsForAccountIDs: SetNonNullable = {}; if (!personalDetails) { return personalDetailsForAccountIDs; } diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index fbdf275e507d..9ca58dd06594 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7414,7 +7414,7 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Mon, 2 Sep 2024 15:45:20 +0200 Subject: [PATCH 13/21] fix lint and prettier --- src/CONST.ts | 2 +- src/libs/OptionsListUtils.ts | 2 +- src/libs/actions/IOU.ts | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index e7837faac94c..bc0d8c006c93 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -82,7 +82,7 @@ const onboardingChoices = { ...backendOnboardingChoices, } as const; -const onboardingEmployerOrSubmitMessage : OnboardingMessageType = { +const onboardingEmployerOrSubmitMessage: OnboardingMessageType = { message: 'Getting paid back is as easy as sending a message. Let’s go over the basics.', video: { url: `${CLOUDFRONT_URL}/videos/guided-setup-get-paid-back-v2.mp4`, diff --git a/src/libs/OptionsListUtils.ts b/src/libs/OptionsListUtils.ts index fb51cbd428a7..6824c41e60ec 100644 --- a/src/libs/OptionsListUtils.ts +++ b/src/libs/OptionsListUtils.ts @@ -7,6 +7,7 @@ import lodashSet from 'lodash/set'; import lodashSortBy from 'lodash/sortBy'; import Onyx from 'react-native-onyx'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; +import type {SetNonNullable} from 'type-fest'; import {FallbackAvatar} from '@components/Icon/Expensicons'; import type {SelectedTagOption} from '@components/TagPicker'; import type {IOUAction} from '@src/CONST'; @@ -57,7 +58,6 @@ import * as ReportUtils from './ReportUtils'; import * as TaskUtils from './TaskUtils'; import * as TransactionUtils from './TransactionUtils'; import * as UserUtils from './UserUtils'; -import { SetNonNullable } from 'type-fest'; type SearchOption = ReportUtils.OptionData & { item: T; diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 9ca58dd06594..91ab5f7e5523 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7412,9 +7412,7 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Mon, 2 Sep 2024 15:51:42 +0200 Subject: [PATCH 14/21] add JSDoc to explain onboardingPayment function --- src/libs/actions/IOU.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 91ab5f7e5523..4dcfa730fcc2 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7403,6 +7403,11 @@ function cancelPayment(expenseReport: OnyxEntry, chatReport: O ); } +/** + * Completes onboarding for invite link flow based on the selected payment option + * + * @param paymentSelected based on which we choose the onboarding choice and concierge message + */ function completePaymentOnboarding(paymentSelected: ValueOf) { const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false; From 2d833392276562ed6f4397520309d11127d3cfe9 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:23:22 +0200 Subject: [PATCH 15/21] fix typescript errors caused by as const assertion --- src/ONYXKEYS.ts | 3 ++- src/libs/actions/Report.ts | 4 ++-- src/pages/OnboardingWork/BaseOnboardingWork.tsx | 4 +--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 7aeffc44af9a..3f9dca142e55 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,5 +1,6 @@ import type {ValueOf} from 'type-fest'; import type CONST from './CONST'; +import {OnboardingPurposeType} from './CONST'; import type * as FormTypes from './types/form'; import type * as OnyxTypes from './types/onyx'; import type Onboarding from './types/onyx/Onboarding'; @@ -877,7 +878,7 @@ type OnyxValuesMapping = { [ONYXKEYS.MAX_CANVAS_AREA]: number; [ONYXKEYS.MAX_CANVAS_HEIGHT]: number; [ONYXKEYS.MAX_CANVAS_WIDTH]: number; - [ONYXKEYS.ONBOARDING_PURPOSE_SELECTED]: string; + [ONYXKEYS.ONBOARDING_PURPOSE_SELECTED]: OnboardingPurposeType; [ONYXKEYS.ONBOARDING_ERROR_MESSAGE]: string; [ONYXKEYS.ONBOARDING_POLICY_ID]: string; [ONYXKEYS.ONBOARDING_ADMINS_CHAT_REPORT_ID]: string; diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 33111162a9cc..762fffc396f2 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3357,7 +3357,7 @@ function completeOnboarding( let videoCommentAction: OptimisticAddCommentReportAction | null = null; let videoMessage: AddCommentOrAttachementParams | null = null; - if (data.video) { + if ('video' in data && data.video) { const videoComment = ReportUtils.buildOptimisticAddCommentReportAction(CONST.ATTACHMENT_MESSAGE_TEXT, undefined, actorAccountID, 2); videoCommentAction = videoComment.reportAction; videoMessage = { @@ -3638,7 +3638,7 @@ function completeOnboarding( {type: 'message', ...textMessage}, ]; - if (data.video && videoCommentAction && videoMessage) { + if ('video' in data && data.video && videoCommentAction && videoMessage) { optimisticData.push({ onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, diff --git a/src/pages/OnboardingWork/BaseOnboardingWork.tsx b/src/pages/OnboardingWork/BaseOnboardingWork.tsx index cf0809c8fb99..b295e5a1d217 100644 --- a/src/pages/OnboardingWork/BaseOnboardingWork.tsx +++ b/src/pages/OnboardingWork/BaseOnboardingWork.tsx @@ -25,8 +25,6 @@ import ROUTES from '@src/ROUTES'; import INPUT_IDS from '@src/types/form/WorkForm'; import type {BaseOnboardingWorkOnyxProps, BaseOnboardingWorkProps} from './types'; -const OPEN_WORK_PAGE_PURPOSES = [CONST.ONBOARDING_CHOICES.MANAGE_TEAM]; - function BaseOnboardingWork({shouldUseNativeStyles, onboardingPurposeSelected, onboardingPolicyID, route}: BaseOnboardingWorkProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -80,7 +78,7 @@ function BaseOnboardingWork({shouldUseNativeStyles, onboardingPurposeSelected, o Date: Mon, 2 Sep 2024 16:26:20 +0200 Subject: [PATCH 16/21] set ONYXKEYS import as type --- src/ONYXKEYS.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 3f9dca142e55..25eb81821344 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -1,6 +1,6 @@ import type {ValueOf} from 'type-fest'; import type CONST from './CONST'; -import {OnboardingPurposeType} from './CONST'; +import type {OnboardingPurposeType} from './CONST'; import type * as FormTypes from './types/form'; import type * as OnyxTypes from './types/onyx'; import type Onboarding from './types/onyx/Onboarding'; From 178cd3abe65f54c276572c76f2eac0f4c8e31698 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:40:18 +0200 Subject: [PATCH 17/21] fix remaining lint errors with leftover assertions --- src/components/AvatarWithDisplayName.tsx | 4 ++-- src/libs/SidebarUtils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/AvatarWithDisplayName.tsx b/src/components/AvatarWithDisplayName.tsx index 2ccdd47c3205..1cd1bfb36d83 100644 --- a/src/components/AvatarWithDisplayName.tsx +++ b/src/components/AvatarWithDisplayName.tsx @@ -12,7 +12,7 @@ import * as ReportUtils from '@libs/ReportUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {PersonalDetails, PersonalDetailsList, Policy, Report, ReportActions} from '@src/types/onyx'; +import type {PersonalDetailsList, Policy, Report, ReportActions} from '@src/types/onyx'; import CaretWrapper from './CaretWrapper'; import DisplayNames from './DisplayNames'; import MultipleAvatars from './MultipleAvatars'; @@ -69,7 +69,7 @@ function AvatarWithDisplayName({ ReportUtils.isMoneyRequestReport(report) || ReportUtils.isMoneyRequest(report) || ReportUtils.isTrackExpenseReport(report) || ReportUtils.isInvoiceReport(report); const icons = ReportUtils.getIcons(report, personalDetails, null, '', -1, policy, invoiceReceiverPolicy); const ownerPersonalDetails = OptionsListUtils.getPersonalDetailsForAccountIDs(report?.ownerAccountID ? [report.ownerAccountID] : [], personalDetails); - const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(Object.values(ownerPersonalDetails) as PersonalDetails[], false); + const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(Object.values(ownerPersonalDetails), false); const shouldShowSubscriptAvatar = ReportUtils.shouldReportShowSubscript(report); const avatarBorderColor = isAnonymous ? theme.highlightBG : theme.componentBG; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index c9dca5134ca7..da8d92c31b52 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -293,7 +293,7 @@ function getOptionData({ const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report); const visibleParticipantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report, true); - const participantPersonalDetailList = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails)) as PersonalDetails[]; + const participantPersonalDetailList = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails)); const personalDetail = participantPersonalDetailList[0] ?? {}; const hasErrors = Object.keys(result.allReportErrors ?? {}).length !== 0; From 2480834669904199fe70a21a6a1ba2a5064ef933 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Wed, 4 Sep 2024 11:26:49 +0200 Subject: [PATCH 18/21] change onboarding choice for personal invoice and refactor code around --- src/components/AddPaymentMethodMenu.tsx | 20 +++++++++++-------- .../ReportActionItem/ReportPreview.tsx | 2 -- src/libs/actions/IOU.ts | 8 +++++++- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index fc87af9f33a1..61869ac789a1 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -75,14 +75,21 @@ function AddPaymentMethodMenu({ const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; + const onPaymentItemSelected = (paymentMethod: PaymentMethod) => { + const paymentSelected = paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; + + IOU.completePaymentOnboarding(paymentSelected); + onItemSelected(paymentMethod); + }; + // We temporarily disabled P2P debit cards so we will automatically select the personal bank account option if there is no other option to select. useEffect(() => { if (!isVisible || !isPersonalOnlyOption) { return; } - onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); - }, [isPersonalOnlyOption, isVisible, onItemSelected]); + onPaymentItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + }, [isPersonalOnlyOption, isVisible, onPaymentItemSelected]); if (isPersonalOnlyOption) { return null; @@ -109,8 +116,7 @@ function AddPaymentMethodMenu({ text: translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { - IOU.completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.PBA); - onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + onPaymentItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, ] @@ -121,8 +127,7 @@ function AddPaymentMethodMenu({ text: translate('common.businessBankAccount'), icon: Expensicons.Building, onSelected: () => { - IOU.completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.BBA); - onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); + onPaymentItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); }, }, ] @@ -133,8 +138,7 @@ function AddPaymentMethodMenu({ // text: translate('common.debitCard'), // icon: Expensicons.CreditCard, // onSelected: () => { - // completePaymentOnboarding(CONST.IOU.PAYMENT_SELECTED.PBA); - // onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD); + // onPaymentItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD); // }, // }, // ], diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index 4db2c493173a..ad29a8d84141 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -200,8 +200,6 @@ function ReportPreview({ if (ReportUtils.hasHeldExpenses(iouReport?.reportID)) { setIsHoldMenuVisible(true); } else if (chatReport && iouReport) { - const paymentSelected = type === CONST.IOU.PAYMENT_TYPE.VBBA ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; - IOU.completePaymentOnboarding(paymentSelected); if (ReportUtils.isInvoiceReport(iouReport)) { IOU.payInvoice(type, chatReport, iouReport, payAsBusiness); } else { diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 4dcfa730fcc2..851c2311d7b3 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -7426,7 +7426,7 @@ function completePaymentOnboarding(paymentSelected: ValueOf Date: Wed, 4 Sep 2024 11:37:23 +0200 Subject: [PATCH 19/21] fix lint and prettier --- src/components/AddPaymentMethodMenu.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 61869ac789a1..029ec6962f17 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -1,5 +1,5 @@ import type {RefObject} from 'react'; -import React, {useEffect, useState} from 'react'; +import React, {useCallback, useEffect, useState} from 'react'; import type {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; @@ -75,12 +75,15 @@ function AddPaymentMethodMenu({ const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; - const onPaymentItemSelected = (paymentMethod: PaymentMethod) => { - const paymentSelected = paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; + const onPaymentItemSelected = useCallback( + (paymentMethod: PaymentMethod) => { + const paymentSelected = paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; - IOU.completePaymentOnboarding(paymentSelected); - onItemSelected(paymentMethod); - }; + IOU.completePaymentOnboarding(paymentSelected); + onItemSelected(paymentMethod); + }, + [onItemSelected], + ); // We temporarily disabled P2P debit cards so we will automatically select the personal bank account option if there is no other option to select. useEffect(() => { From 732efbfe7a2d8bbd7dd133f88f4363fac5cb2621 Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:07:52 +0200 Subject: [PATCH 20/21] remove changes from AddPaymentMethodMenu --- src/components/AddPaymentMethodMenu.tsx | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index 029ec6962f17..a306634dc7d0 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -1,12 +1,11 @@ import type {RefObject} from 'react'; -import React, {useCallback, useEffect, useState} from 'react'; +import React, {useEffect, useState} from 'react'; import type {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {withOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; -import * as IOU from '@userActions/IOU'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type {AnchorPosition} from '@src/styles'; @@ -75,24 +74,14 @@ function AddPaymentMethodMenu({ const isPersonalOnlyOption = canUsePersonalBankAccount && !canUseBusinessBankAccount; - const onPaymentItemSelected = useCallback( - (paymentMethod: PaymentMethod) => { - const paymentSelected = paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT ? CONST.IOU.PAYMENT_SELECTED.BBA : CONST.IOU.PAYMENT_SELECTED.PBA; - - IOU.completePaymentOnboarding(paymentSelected); - onItemSelected(paymentMethod); - }, - [onItemSelected], - ); - // We temporarily disabled P2P debit cards so we will automatically select the personal bank account option if there is no other option to select. useEffect(() => { if (!isVisible || !isPersonalOnlyOption) { return; } - onPaymentItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); - }, [isPersonalOnlyOption, isVisible, onPaymentItemSelected]); + onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + }, [isPersonalOnlyOption, isVisible, onItemSelected]); if (isPersonalOnlyOption) { return null; @@ -119,7 +108,7 @@ function AddPaymentMethodMenu({ text: translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { - onPaymentItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, ] @@ -130,7 +119,7 @@ function AddPaymentMethodMenu({ text: translate('common.businessBankAccount'), icon: Expensicons.Building, onSelected: () => { - onPaymentItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); + onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); }, }, ] @@ -140,9 +129,7 @@ function AddPaymentMethodMenu({ // { // text: translate('common.debitCard'), // icon: Expensicons.CreditCard, - // onSelected: () => { - // onPaymentItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD); - // }, + // onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), // }, // ], ]} From 74aaacb6f408a8be21e04469b471bc34e4c5afeb Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:09:46 +0200 Subject: [PATCH 21/21] remove unnecessary prettier changes --- src/components/AddPaymentMethodMenu.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.tsx b/src/components/AddPaymentMethodMenu.tsx index a306634dc7d0..5621c031f959 100644 --- a/src/components/AddPaymentMethodMenu.tsx +++ b/src/components/AddPaymentMethodMenu.tsx @@ -118,9 +118,7 @@ function AddPaymentMethodMenu({ { text: translate('common.businessBankAccount'), icon: Expensicons.Building, - onSelected: () => { - onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT); - }, + onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT), }, ] : []),