From eebdad344ed5c8ee7eecc2f227ee2222ba55bf9c Mon Sep 17 00:00:00 2001 From: daledah Date: Fri, 27 Sep 2024 16:12:53 +0700 Subject: [PATCH 01/12] fix: show correct message when disconnecting quickbooks desktop --- src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/languages/params.ts | 5 +++++ src/libs/ReportActionsUtils.ts | 10 ++++++++++ src/libs/SidebarUtils.ts | 2 ++ .../home/report/ContextMenu/ContextMenuActions.tsx | 2 ++ src/pages/home/report/ReportActionItem.tsx | 4 +++- src/types/onyx/OriginalMessage.ts | 3 +++ 8 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 6a90b1f8302a..c553c4a1abb5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -9,6 +9,7 @@ import type { AddressLineParams, AdminCanceledRequestParams, AgeParams, + AllConnectionNameParams, AlreadySignedInParams, ApprovalWorkflowErrorParams, ApprovedAmountParams, @@ -4242,6 +4243,7 @@ const translations = { addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, + removedConnection: ({connectionName}: AllConnectionNameParams) => `Removed connection to ${connectionName}.`, }, }, }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 8d8b33ca57dd..f059b44f41a2 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -8,6 +8,7 @@ import type { AddressLineParams, AdminCanceledRequestParams, AgeParams, + AllConnectionNameParams, AlreadySignedInParams, ApprovalWorkflowErrorParams, ApprovedAmountParams, @@ -4297,6 +4298,7 @@ const translations = { updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`, + removedConnection: ({connectionName}: AllConnectionNameParams) => `Conexión eliminada a ${connectionName}.`, }, }, }, diff --git a/src/languages/params.ts b/src/languages/params.ts index 8ed122283064..a9413201043d 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -350,6 +350,10 @@ type ConnectionNameParams = { connectionName: ConnectionName; }; +type AllConnectionNameParams = { + connectionName: string; +}; + type LastSyncDateParams = { connectionName: string; formattedDate: string; @@ -751,4 +755,5 @@ export type { CharacterLengthLimitParams, OptionalParam, AssignCardParams, + AllConnectionNameParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 8d567509c90e..20cd76d235c4 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1722,6 +1722,15 @@ function getPolicyChangeLogDeleteMemberMessage(reportAction: OnyxInputOrEntry): string { + if (!isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { + return ''; + } + const originalMessage = getOriginalMessage(reportAction); + const connectionName = originalMessage?.connectionName ?? ''; + return Localize.translateLocal('report.actions.type.removedConnection', {connectionName}); +} + function getRenamedAction(reportAction: OnyxEntry>) { const originalMessage = getOriginalMessage(reportAction); return Localize.translateLocal('newRoomPage.renamedRoomAction', { @@ -1882,6 +1891,7 @@ export { isCardIssuedAction, getCardIssuedMessage, hasSameActorForAllTransactions, + getRemovedConnectionMessage, }; export type {LastVisibleMessage}; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index e120f7026fce..a36b8d828473 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -448,6 +448,8 @@ function getOptionData({ result.alternateText = ReportActionsUtils.getPolicyChangeLogDeleteMemberMessage(lastAction); } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_CUSTOM_UNIT_RATE) { result.alternateText = ReportActionsUtils.getReportActionMessageText(lastAction) ?? ''; + } else if (lastAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { + result.alternateText = ReportActionsUtils.getRemovedConnectionMessage(lastAction); } else { result.alternateText = lastMessageTextFromReport.length > 0 diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 371df4db2b3c..093777a3be05 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -478,6 +478,8 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(Localize.translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage})); } else if (ReportActionsUtils.isCardIssuedAction(reportAction)) { setClipboardMessage(ReportActionsUtils.getCardIssuedMessage(reportAction, true)); + } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { + setClipboardMessage(ReportActionsUtils.getRemovedConnectionMessage(reportAction)); } else if (content) { setClipboardMessage( content.replace(/()(.*?)(<\/mention-user>)/gi, (match, openTag: string, innerContent: string, closeTag: string): string => { diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index 33664e2a4162..da6faf2f5e1c 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -64,7 +64,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; -import type {JoinWorkspaceResolution} from '@src/types/onyx/OriginalMessage'; +import type {JoinWorkspaceResolution, OriginalMessageChangeLog} from '@src/types/onyx/OriginalMessage'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import {RestrictedReadOnlyContextMenuActions} from './ContextMenu/ContextMenuActions'; import MiniReportActionContextMenu from './ContextMenu/MiniReportActionContextMenu'; @@ -683,6 +683,8 @@ function ReportActionItem({ } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { const {label, errorMessage} = ReportActionsUtils.getOriginalMessage(action) ?? {label: '', errorMessage: ''}; children = ; + } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { + children = ; } else { const hasBeenFlagged = ![CONST.MODERATION.MODERATOR_DECISION_APPROVED, CONST.MODERATION.MODERATOR_DECISION_PENDING].some((item) => item === moderationDecision) && diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 4572ac26a449..3188f7b432a0 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -271,6 +271,9 @@ type OriginalMessageChangeLog = { /** Old role of user */ oldValue?: string; + + /** Name of removed connection */ + connectionName?: string; }; /** Model of `join policy changelog` report action */ From 7c91ea0bfe75993cb9e6a00b76d143f53d677c01 Mon Sep 17 00:00:00 2001 From: daledah Date: Fri, 27 Sep 2024 16:17:23 +0700 Subject: [PATCH 02/12] fix: lint --- src/pages/home/report/ReportActionItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index da6faf2f5e1c..c2bf37be38b9 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -64,7 +64,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type * as OnyxTypes from '@src/types/onyx'; -import type {JoinWorkspaceResolution, OriginalMessageChangeLog} from '@src/types/onyx/OriginalMessage'; +import type {JoinWorkspaceResolution} from '@src/types/onyx/OriginalMessage'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import {RestrictedReadOnlyContextMenuActions} from './ContextMenu/ContextMenuActions'; import MiniReportActionContextMenu from './ContextMenu/MiniReportActionContextMenu'; From 12b3e38ccc8a04b44d3fa6c88eef7b474abf0dc2 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 15:55:10 +0700 Subject: [PATCH 03/12] fix: use isActionOfType --- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 2 +- src/pages/home/report/ReportActionItem.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index 093777a3be05..e4d30bb7ee92 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -478,7 +478,7 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(Localize.translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage})); } else if (ReportActionsUtils.isCardIssuedAction(reportAction)) { setClipboardMessage(ReportActionsUtils.getCardIssuedMessage(reportAction, true)); - } else if (reportAction?.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { + } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { setClipboardMessage(ReportActionsUtils.getRemovedConnectionMessage(reportAction)); } else if (content) { setClipboardMessage( diff --git a/src/pages/home/report/ReportActionItem.tsx b/src/pages/home/report/ReportActionItem.tsx index c2bf37be38b9..3ed0841686a1 100644 --- a/src/pages/home/report/ReportActionItem.tsx +++ b/src/pages/home/report/ReportActionItem.tsx @@ -683,7 +683,7 @@ function ReportActionItem({ } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.INTEGRATION_SYNC_FAILED)) { const {label, errorMessage} = ReportActionsUtils.getOriginalMessage(action) ?? {label: '', errorMessage: ''}; children = ; - } else if (action.actionName === CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION) { + } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { children = ; } else { const hasBeenFlagged = From 2d5efb259da5207c4165f18a9ee4394435ab56c5 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 17:18:52 +0700 Subject: [PATCH 04/12] fix: update connectionName --- src/languages/en.ts | 3 +-- src/languages/es.ts | 3 +-- src/languages/params.ts | 9 ++------- src/libs/ReportActionsUtils.ts | 4 ++-- src/pages/home/report/ContextMenu/ContextMenuActions.tsx | 2 +- src/types/onyx/OriginalMessage.ts | 3 ++- src/types/onyx/Policy.ts | 9 +++++++++ 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 06943629a838..851cbb861a8b 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -8,7 +8,6 @@ import type { AddEmployeeParams, AddressLineParams, AdminCanceledRequestParams, - AllConnectionNameParams, AlreadySignedInParams, ApprovalWorkflowErrorParams, ApprovedAmountParams, @@ -4271,7 +4270,7 @@ const translations = { addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, - removedConnection: ({connectionName}: AllConnectionNameParams) => `Removed connection to ${connectionName}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `Removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, }, }, }, diff --git a/src/languages/es.ts b/src/languages/es.ts index 9553340f96bb..663fa81a3243 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -6,7 +6,6 @@ import type { AddEmployeeParams, AddressLineParams, AdminCanceledRequestParams, - AllConnectionNameParams, AlreadySignedInParams, ApprovalWorkflowErrorParams, ApprovedAmountParams, @@ -4317,7 +4316,7 @@ const translations = { updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`, - removedConnection: ({connectionName}: AllConnectionNameParams) => `Conexión eliminada a ${connectionName}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `Conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, }, }, }, diff --git a/src/languages/params.ts b/src/languages/params.ts index 7362a688312b..bf47401c2cf0 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -1,6 +1,6 @@ import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx'; import type {DelegateRole} from '@src/types/onyx/Account'; -import type {ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy'; +import type {AllConnectionName, ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy'; import type {ViolationDataType} from '@src/types/onyx/TransactionViolation'; type AddressLineParams = { @@ -338,11 +338,7 @@ type ApprovalWorkflowErrorParams = { }; type ConnectionNameParams = { - connectionName: ConnectionName; -}; - -type AllConnectionNameParams = { - connectionName: string; + connectionName: AllConnectionName; }; type LastSyncDateParams = { @@ -734,5 +730,4 @@ export type { CharacterLengthLimitParams, OptionalParam, AssignCardParams, - AllConnectionNameParams, }; diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index 0cbd886870c1..d00d1086f18f 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -1727,8 +1727,8 @@ function getRemovedConnectionMessage(reportAction: OnyxEntry): str return ''; } const originalMessage = getOriginalMessage(reportAction); - const connectionName = originalMessage?.connectionName ?? ''; - return Localize.translateLocal('report.actions.type.removedConnection', {connectionName}); + const connectionName = originalMessage?.connectionName; + return connectionName ? Localize.translateLocal('report.actions.type.removedConnection', {connectionName}) : ''; } function getRenamedAction(reportAction: OnyxEntry>) { diff --git a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx index e4d30bb7ee92..8b1dd967c1c0 100644 --- a/src/pages/home/report/ContextMenu/ContextMenuActions.tsx +++ b/src/pages/home/report/ContextMenu/ContextMenuActions.tsx @@ -478,7 +478,7 @@ const ContextMenuActions: ContextMenuAction[] = [ setClipboardMessage(Localize.translateLocal('report.actions.type.integrationSyncFailed', {label, errorMessage})); } else if (ReportActionsUtils.isCardIssuedAction(reportAction)) { setClipboardMessage(ReportActionsUtils.getCardIssuedMessage(reportAction, true)); - } else if (ReportActionsUtils.isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { + } else if (ReportActionsUtils.isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.POLICY_CHANGE_LOG.DELETE_INTEGRATION)) { setClipboardMessage(ReportActionsUtils.getRemovedConnectionMessage(reportAction)); } else if (content) { setClipboardMessage( diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index 6c72b51f0531..ed05db8a3894 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -2,6 +2,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {OldDotOriginalMessageMap} from './OldDotAction'; +import {AllConnectionName} from './Policy'; import type ReportActionName from './ReportActionName'; /** Types of join workspace resolutions */ @@ -273,7 +274,7 @@ type OriginalMessageChangeLog = { oldValue?: string; /** Name of connection */ - connectionName?: string; + connectionName?: AllConnectionName; }; /** Model of `join policy changelog` report action */ diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index aae6486c8130..ba1d7f772166 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1232,9 +1232,17 @@ type Connections = { [CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: Connection; }; +type AllConnections = Connections & { + /** Quickbooks Desktop integration connection*/ + quickbooksDesktop: any; +}; + /** Names of integration connections */ type ConnectionName = keyof Connections; +/** Names of all integration connections */ +type AllConnectionName = keyof AllConnections; + /** Merchant Category Code. This is a way to identify the type of merchant (and type of spend) when a credit card is swiped. */ type MccGroup = { /** Default category for provided MCC Group */ @@ -1728,6 +1736,7 @@ export type { Connections, SageIntacctOfflineStateKeys, ConnectionName, + AllConnectionName, Tenant, Account, QBONonReimbursableExportAccountType, From 9035e8f3a4c2b25d45ecdde77efebe7ce783c7a5 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 17:24:59 +0700 Subject: [PATCH 05/12] fix: lint --- src/types/onyx/OriginalMessage.ts | 2 +- src/types/onyx/Policy.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/types/onyx/OriginalMessage.ts b/src/types/onyx/OriginalMessage.ts index ed05db8a3894..26c53fe60c6d 100644 --- a/src/types/onyx/OriginalMessage.ts +++ b/src/types/onyx/OriginalMessage.ts @@ -2,7 +2,7 @@ import type {ValueOf} from 'type-fest'; import type CONST from '@src/CONST'; import type DeepValueOf from '@src/types/utils/DeepValueOf'; import type {OldDotOriginalMessageMap} from './OldDotAction'; -import {AllConnectionName} from './Policy'; +import type {AllConnectionName} from './Policy'; import type ReportActionName from './ReportActionName'; /** Types of join workspace resolutions */ diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index ba1d7f772166..1560847e3ed8 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1232,8 +1232,10 @@ type Connections = { [CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: Connection; }; +/** All integration connections, including unsupported ones */ type AllConnections = Connections & { - /** Quickbooks Desktop integration connection*/ + /** Quickbooks Desktop integration connection */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any quickbooksDesktop: any; }; From 0c01ae689f5a44cfc2f2bf8ccb56325e0b8db4b5 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 18:21:18 +0700 Subject: [PATCH 06/12] Update src/languages/en.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 851cbb861a8b..efc823d7ac48 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4270,7 +4270,7 @@ const translations = { addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, - removedConnection: ({connectionName}: ConnectionNameParams) => `Removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, }, }, }, From 1df26a0dd274e863e5286dba9fb618a2c34b9b99 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 18:21:26 +0700 Subject: [PATCH 07/12] Update src/languages/es.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 663fa81a3243..177859b9d004 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4316,7 +4316,7 @@ const translations = { updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`, - removedConnection: ({connectionName}: ConnectionNameParams) => `Conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, }, }, }, From a2b47a05cfc50569c4a211de9b6c5c955735f0ac Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 18:24:30 +0700 Subject: [PATCH 08/12] Update src/languages/en.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index efc823d7ac48..96f3da628d09 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4270,7 +4270,7 @@ const translations = { addEmployee: ({email, role}: AddEmployeeParams) => `added ${email} as ${role === 'user' ? 'member' : 'admin'}`, updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `updated the role of ${email} from ${currentRole} to ${newRole}`, removeMember: ({email, role}: AddEmployeeParams) => `removed ${role} ${email}`, - removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `removed connection to ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, From 5595851daa58214b66fca6fd4c5f42df42927717 Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 18:24:37 +0700 Subject: [PATCH 09/12] Update src/languages/es.ts Co-authored-by: DylanDylann <141406735+DylanDylann@users.noreply.github.com> --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 177859b9d004..35427d2ee69a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4316,7 +4316,7 @@ const translations = { updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`, - removedConnection: ({connectionName}: ConnectionNameParams) => `conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}.`, + removedConnection: ({connectionName}: ConnectionNameParams) => `conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, From 183448c7c1c24abab3559f6049fb6ba662dc418b Mon Sep 17 00:00:00 2001 From: daledah Date: Mon, 30 Sep 2024 21:58:20 +0700 Subject: [PATCH 10/12] Update src/languages/es.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lucien Akchoté --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 35427d2ee69a..d592caa57092 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4316,7 +4316,7 @@ const translations = { updateRole: ({email, currentRole, newRole}: UpdateRoleParams) => `actualicé el rol ${email} de ${currentRole === 'user' ? 'miembro' : 'administrador'} a ${newRole === 'user' ? 'miembro' : 'administrador'}`, removeMember: ({email, role}: AddEmployeeParams) => `eliminado ${role === 'user' ? 'miembro' : 'administrador'} ${email}`, - removedConnection: ({connectionName}: ConnectionNameParams) => `conexión eliminada a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, + removedConnection: ({connectionName}: ConnectionNameParams) => `eliminó la conexión a ${CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName]}`, }, }, }, From c765479cf98fa6fe7ffe46f1d64cd86fdbf95f35 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 12 Aug 2024 16:21:45 +0200 Subject: [PATCH 11/12] integrate bank accounts logic --- .../invoices/WorkspaceInvoiceVBASection.tsx | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx b/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx index 1e876a9867c3..9ba2fa43c904 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx @@ -16,16 +16,44 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import getClickedTargetLocation from '@libs/getClickedTargetLocation'; +<<<<<<< HEAD import * as PaymentUtils from '@libs/PaymentUtils'; import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList'; +======= +import Navigation from '@libs/Navigation/Navigation'; +import * as PaymentUtils from '@libs/PaymentUtils'; +import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList'; +import type {FormattedSelectedPaymentMethodIcon} from '@pages/settings/Wallet/WalletPage/types'; +>>>>>>> be90481835 (integrate bank accounts logic) import variables from '@styles/variables'; import * as BankAccounts from '@userActions/BankAccounts'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; +<<<<<<< HEAD +import type {AccountData} from '@src/types/onyx'; +import {isEmptyObject} from '@src/types/utils/EmptyObject'; +======= +import ROUTES from '@src/ROUTES'; import type {AccountData} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; +type FormattedSelectedPaymentMethod = { + title: string; + icon?: FormattedSelectedPaymentMethodIcon; + description?: string; + type?: string; +}; + +type PaymentMethodState = { + isSelectedPaymentMethodDefault: boolean; + selectedPaymentMethod: AccountData; + formattedSelectedPaymentMethod: FormattedSelectedPaymentMethod; + methodID: string | number; + selectedPaymentMethodType: string; +}; +>>>>>>> be90481835 (integrate bank accounts logic) + type WorkspaceInvoiceVBASectionProps = { /** The policy ID currently being configured */ policyID: string; @@ -38,24 +66,54 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) const {translate} = useLocalize(); const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); +<<<<<<< HEAD const {paymentMethod, setPaymentMethod, resetSelectedPaymentMethodData} = usePaymentMethodState(); +======= + const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); + const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET); + const [fundList] = useOnyx(ONYXKEYS.FUND_LIST); +>>>>>>> be90481835 (integrate bank accounts logic) const addPaymentMethodAnchorRef = useRef(null); const paymentMethodButtonRef = useRef(null); const [shouldShowAddPaymentMenu, setShouldShowAddPaymentMenu] = useState(false); const [showConfirmDeleteModal, setShowConfirmDeleteModal] = useState(false); const [shouldShowDefaultDeleteMenu, setShouldShowDefaultDeleteMenu] = useState(false); +<<<<<<< HEAD +======= + const [paymentMethod, setPaymentMethod] = useState({ + isSelectedPaymentMethodDefault: false, + selectedPaymentMethod: {}, + formattedSelectedPaymentMethod: { + title: '', + }, + methodID: '', + selectedPaymentMethodType: '', + }); +>>>>>>> be90481835 (integrate bank accounts logic) const [anchorPosition, setAnchorPosition] = useState({ anchorPositionHorizontal: 0, anchorPositionVertical: 0, anchorPositionTop: 0, anchorPositionRight: 0, }); +<<<<<<< HEAD const hasBankAccount = !isEmptyObject(bankAccountList); const shouldShowEmptyState = !hasBankAccount; // Determines whether or not the modal popup is mounted from the bottom of the screen instead of the side mount on Web or Desktop screens const isPopoverBottomMount = anchorPosition.anchorPositionTop === 0 || shouldUseNarrowLayout; const shouldShowMakeDefaultButton = !paymentMethod.isSelectedPaymentMethodDefault; const transferBankAccountID = policy?.invoice?.bankAccount?.transferBankAccountID; +======= + const hasBankAccount = !isEmptyObject(bankAccountList) || !isEmptyObject(fundList); + const hasWallet = !isEmptyObject(userWallet); + const hasAssignedCard = !isEmptyObject(cardList); + const shouldShowEmptyState = !hasBankAccount && !hasWallet && !hasAssignedCard; + // Determines whether or not the modal popup is mounted from the bottom of the screen instead of the side mount on Web or Desktop screens + const isPopoverBottomMount = anchorPosition.anchorPositionTop === 0 || shouldUseNarrowLayout; + const shouldShowMakeDefaultButton = + !paymentMethod.isSelectedPaymentMethodDefault && + !(paymentMethod.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && paymentMethod.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS); +>>>>>>> be90481835 (integrate bank accounts logic) /** * Set position of the payment menu @@ -112,7 +170,11 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) }; } setPaymentMethod({ +<<<<<<< HEAD isSelectedPaymentMethodDefault: transferBankAccountID === methodID, +======= + isSelectedPaymentMethodDefault: !!isDefault, +>>>>>>> be90481835 (integrate bank accounts logic) selectedPaymentMethod: account ?? {}, selectedPaymentMethodType: accountType, formattedSelectedPaymentMethod, @@ -149,6 +211,7 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) }, [paymentMethod.selectedPaymentMethod.bankAccountID, paymentMethod.selectedPaymentMethodType]); const makeDefaultPaymentMethod = useCallback(() => { +<<<<<<< HEAD // Find the previous default payment method so we can revert if the MakeDefaultPaymentMethod command errors const paymentMethods = PaymentUtils.formatPaymentMethods(bankAccountList ?? {}, {}, styles); const previousPaymentMethod = paymentMethods.find((method) => !!method.isDefault); @@ -157,12 +220,55 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) PaymentMethods.setInvoicingTransferBankAccount(currentPaymentMethod?.methodID ?? -1, policyID, previousPaymentMethod?.methodID ?? -1); } }, [bankAccountList, styles, paymentMethod.selectedPaymentMethodType, paymentMethod.methodID, policyID]); +======= + const paymentCardList = fundList ?? {}; + // Find the previous default payment method so we can revert if the MakeDefaultPaymentMethod command errors + const paymentMethods = PaymentUtils.formatPaymentMethods(bankAccountList ?? {}, paymentCardList, styles); + + const previousPaymentMethod = paymentMethods.find((method) => !!method.isDefault); + const currentPaymentMethod = paymentMethods.find((method) => method.methodID === paymentMethod.methodID); + if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { + PaymentMethods.makeDefaultPaymentMethod(paymentMethod.selectedPaymentMethod.bankAccountID ?? -1, 0, previousPaymentMethod, currentPaymentMethod); + } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) { + PaymentMethods.makeDefaultPaymentMethod(0, paymentMethod.selectedPaymentMethod.fundID ?? -1, previousPaymentMethod, currentPaymentMethod); + } + }, [ + paymentMethod.methodID, + paymentMethod.selectedPaymentMethod.bankAccountID, + paymentMethod.selectedPaymentMethod.fundID, + paymentMethod.selectedPaymentMethodType, + bankAccountList, + fundList, + styles, + ]); + + const resetSelectedPaymentMethodData = useCallback(() => { + // Reset to same values as in the constructor + setPaymentMethod({ + isSelectedPaymentMethodDefault: false, + selectedPaymentMethod: {}, + formattedSelectedPaymentMethod: { + title: '', + }, + methodID: '', + selectedPaymentMethodType: '', + }); + }, [setPaymentMethod]); +>>>>>>> be90481835 (integrate bank accounts logic) /** * Navigate to the appropriate payment type addition screen */ const addPaymentMethodTypePressed = (paymentType: string) => { hideAddPaymentMenu(); +<<<<<<< HEAD +======= + + if (paymentType === CONST.PAYMENT_METHODS.DEBIT_CARD) { + Navigation.navigate(ROUTES.SETTINGS_ADD_DEBIT_CARD); + return; + } +>>>>>>> be90481835 (integrate bank accounts logic) if (paymentType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT || paymentType === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { BankAccounts.openPersonalBankAccountSetupView(); return; @@ -183,14 +289,22 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) shouldShowAddPaymentMethodButton={false} shouldShowEmptyListMessage={false} onPress={paymentMethodPressed} +<<<<<<< HEAD invoiceTransferBankAccountID={transferBankAccountID} activePaymentMethodID={transferBankAccountID} +======= + activePaymentMethodID={policy?.invoice?.bankAccount?.transferBankAccountID ?? ''} +>>>>>>> be90481835 (integrate bank accounts logic) actionPaymentMethodType={shouldShowDefaultDeleteMenu ? paymentMethod.selectedPaymentMethodType : ''} buttonRef={addPaymentMethodAnchorRef} shouldEnableScroll={false} style={[styles.mt5, hasBankAccount && [shouldUseNarrowLayout ? styles.mhn5 : styles.mhn8]]} listItemStyle={shouldUseNarrowLayout ? styles.ph5 : styles.ph8} /> +<<<<<<< HEAD +======= + +>>>>>>> be90481835 (integrate bank accounts logic) +<<<<<<< HEAD +======= + +>>>>>>> be90481835 (integrate bank accounts logic) Date: Tue, 1 Oct 2024 10:14:57 +0700 Subject: [PATCH 12/12] fix: resolve conflict --- .../invoices/WorkspaceInvoiceVBASection.tsx | 118 ------------------ 1 file changed, 118 deletions(-) diff --git a/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx b/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx index 9ba2fa43c904..1e876a9867c3 100644 --- a/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx +++ b/src/pages/workspace/invoices/WorkspaceInvoiceVBASection.tsx @@ -16,44 +16,16 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import getClickedTargetLocation from '@libs/getClickedTargetLocation'; -<<<<<<< HEAD import * as PaymentUtils from '@libs/PaymentUtils'; import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList'; -======= -import Navigation from '@libs/Navigation/Navigation'; -import * as PaymentUtils from '@libs/PaymentUtils'; -import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList'; -import type {FormattedSelectedPaymentMethodIcon} from '@pages/settings/Wallet/WalletPage/types'; ->>>>>>> be90481835 (integrate bank accounts logic) import variables from '@styles/variables'; import * as BankAccounts from '@userActions/BankAccounts'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; -<<<<<<< HEAD -import type {AccountData} from '@src/types/onyx'; -import {isEmptyObject} from '@src/types/utils/EmptyObject'; -======= -import ROUTES from '@src/ROUTES'; import type {AccountData} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -type FormattedSelectedPaymentMethod = { - title: string; - icon?: FormattedSelectedPaymentMethodIcon; - description?: string; - type?: string; -}; - -type PaymentMethodState = { - isSelectedPaymentMethodDefault: boolean; - selectedPaymentMethod: AccountData; - formattedSelectedPaymentMethod: FormattedSelectedPaymentMethod; - methodID: string | number; - selectedPaymentMethodType: string; -}; ->>>>>>> be90481835 (integrate bank accounts logic) - type WorkspaceInvoiceVBASectionProps = { /** The policy ID currently being configured */ policyID: string; @@ -66,54 +38,24 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) const {translate} = useLocalize(); const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`); const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST); -<<<<<<< HEAD const {paymentMethod, setPaymentMethod, resetSelectedPaymentMethodData} = usePaymentMethodState(); -======= - const [cardList] = useOnyx(ONYXKEYS.CARD_LIST); - const [userWallet] = useOnyx(ONYXKEYS.USER_WALLET); - const [fundList] = useOnyx(ONYXKEYS.FUND_LIST); ->>>>>>> be90481835 (integrate bank accounts logic) const addPaymentMethodAnchorRef = useRef(null); const paymentMethodButtonRef = useRef(null); const [shouldShowAddPaymentMenu, setShouldShowAddPaymentMenu] = useState(false); const [showConfirmDeleteModal, setShowConfirmDeleteModal] = useState(false); const [shouldShowDefaultDeleteMenu, setShouldShowDefaultDeleteMenu] = useState(false); -<<<<<<< HEAD -======= - const [paymentMethod, setPaymentMethod] = useState({ - isSelectedPaymentMethodDefault: false, - selectedPaymentMethod: {}, - formattedSelectedPaymentMethod: { - title: '', - }, - methodID: '', - selectedPaymentMethodType: '', - }); ->>>>>>> be90481835 (integrate bank accounts logic) const [anchorPosition, setAnchorPosition] = useState({ anchorPositionHorizontal: 0, anchorPositionVertical: 0, anchorPositionTop: 0, anchorPositionRight: 0, }); -<<<<<<< HEAD const hasBankAccount = !isEmptyObject(bankAccountList); const shouldShowEmptyState = !hasBankAccount; // Determines whether or not the modal popup is mounted from the bottom of the screen instead of the side mount on Web or Desktop screens const isPopoverBottomMount = anchorPosition.anchorPositionTop === 0 || shouldUseNarrowLayout; const shouldShowMakeDefaultButton = !paymentMethod.isSelectedPaymentMethodDefault; const transferBankAccountID = policy?.invoice?.bankAccount?.transferBankAccountID; -======= - const hasBankAccount = !isEmptyObject(bankAccountList) || !isEmptyObject(fundList); - const hasWallet = !isEmptyObject(userWallet); - const hasAssignedCard = !isEmptyObject(cardList); - const shouldShowEmptyState = !hasBankAccount && !hasWallet && !hasAssignedCard; - // Determines whether or not the modal popup is mounted from the bottom of the screen instead of the side mount on Web or Desktop screens - const isPopoverBottomMount = anchorPosition.anchorPositionTop === 0 || shouldUseNarrowLayout; - const shouldShowMakeDefaultButton = - !paymentMethod.isSelectedPaymentMethodDefault && - !(paymentMethod.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && paymentMethod.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS); ->>>>>>> be90481835 (integrate bank accounts logic) /** * Set position of the payment menu @@ -170,11 +112,7 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) }; } setPaymentMethod({ -<<<<<<< HEAD isSelectedPaymentMethodDefault: transferBankAccountID === methodID, -======= - isSelectedPaymentMethodDefault: !!isDefault, ->>>>>>> be90481835 (integrate bank accounts logic) selectedPaymentMethod: account ?? {}, selectedPaymentMethodType: accountType, formattedSelectedPaymentMethod, @@ -211,7 +149,6 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) }, [paymentMethod.selectedPaymentMethod.bankAccountID, paymentMethod.selectedPaymentMethodType]); const makeDefaultPaymentMethod = useCallback(() => { -<<<<<<< HEAD // Find the previous default payment method so we can revert if the MakeDefaultPaymentMethod command errors const paymentMethods = PaymentUtils.formatPaymentMethods(bankAccountList ?? {}, {}, styles); const previousPaymentMethod = paymentMethods.find((method) => !!method.isDefault); @@ -220,55 +157,12 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) PaymentMethods.setInvoicingTransferBankAccount(currentPaymentMethod?.methodID ?? -1, policyID, previousPaymentMethod?.methodID ?? -1); } }, [bankAccountList, styles, paymentMethod.selectedPaymentMethodType, paymentMethod.methodID, policyID]); -======= - const paymentCardList = fundList ?? {}; - // Find the previous default payment method so we can revert if the MakeDefaultPaymentMethod command errors - const paymentMethods = PaymentUtils.formatPaymentMethods(bankAccountList ?? {}, paymentCardList, styles); - - const previousPaymentMethod = paymentMethods.find((method) => !!method.isDefault); - const currentPaymentMethod = paymentMethods.find((method) => method.methodID === paymentMethod.methodID); - if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { - PaymentMethods.makeDefaultPaymentMethod(paymentMethod.selectedPaymentMethod.bankAccountID ?? -1, 0, previousPaymentMethod, currentPaymentMethod); - } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) { - PaymentMethods.makeDefaultPaymentMethod(0, paymentMethod.selectedPaymentMethod.fundID ?? -1, previousPaymentMethod, currentPaymentMethod); - } - }, [ - paymentMethod.methodID, - paymentMethod.selectedPaymentMethod.bankAccountID, - paymentMethod.selectedPaymentMethod.fundID, - paymentMethod.selectedPaymentMethodType, - bankAccountList, - fundList, - styles, - ]); - - const resetSelectedPaymentMethodData = useCallback(() => { - // Reset to same values as in the constructor - setPaymentMethod({ - isSelectedPaymentMethodDefault: false, - selectedPaymentMethod: {}, - formattedSelectedPaymentMethod: { - title: '', - }, - methodID: '', - selectedPaymentMethodType: '', - }); - }, [setPaymentMethod]); ->>>>>>> be90481835 (integrate bank accounts logic) /** * Navigate to the appropriate payment type addition screen */ const addPaymentMethodTypePressed = (paymentType: string) => { hideAddPaymentMenu(); -<<<<<<< HEAD -======= - - if (paymentType === CONST.PAYMENT_METHODS.DEBIT_CARD) { - Navigation.navigate(ROUTES.SETTINGS_ADD_DEBIT_CARD); - return; - } ->>>>>>> be90481835 (integrate bank accounts logic) if (paymentType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT || paymentType === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { BankAccounts.openPersonalBankAccountSetupView(); return; @@ -289,22 +183,14 @@ function WorkspaceInvoiceVBASection({policyID}: WorkspaceInvoiceVBASectionProps) shouldShowAddPaymentMethodButton={false} shouldShowEmptyListMessage={false} onPress={paymentMethodPressed} -<<<<<<< HEAD invoiceTransferBankAccountID={transferBankAccountID} activePaymentMethodID={transferBankAccountID} -======= - activePaymentMethodID={policy?.invoice?.bankAccount?.transferBankAccountID ?? ''} ->>>>>>> be90481835 (integrate bank accounts logic) actionPaymentMethodType={shouldShowDefaultDeleteMenu ? paymentMethod.selectedPaymentMethodType : ''} buttonRef={addPaymentMethodAnchorRef} shouldEnableScroll={false} style={[styles.mt5, hasBankAccount && [shouldUseNarrowLayout ? styles.mhn5 : styles.mhn8]]} listItemStyle={shouldUseNarrowLayout ? styles.ph5 : styles.ph8} /> -<<<<<<< HEAD -======= - ->>>>>>> be90481835 (integrate bank accounts logic) -<<<<<<< HEAD -======= - ->>>>>>> be90481835 (integrate bank accounts logic)