From 3e106183c8f1027e6ab938dadc0928d93c4c107a Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Wed, 27 Sep 2023 23:16:37 +0800 Subject: [PATCH 1/9] bring back send moeny option --- src/libs/IOUUtils.ts | 2 +- src/libs/Permissions.ts | 6 +++--- tests/unit/IOUUtilsTest.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/IOUUtils.ts b/src/libs/IOUUtils.ts index 6f6024506985..2425211d16bc 100644 --- a/src/libs/IOUUtils.ts +++ b/src/libs/IOUUtils.ts @@ -77,7 +77,7 @@ function isIOUReportPendingCurrencyConversion(iouReport: Report): boolean { * Checks if the iou type is one of request, send, or split. */ function isValidMoneyRequestType(iouType: string): boolean { - const moneyRequestType: string[] = [CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, CONST.IOU.MONEY_REQUEST_TYPE.SPLIT]; + const moneyRequestType: string[] = [CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, CONST.IOU.MONEY_REQUEST_TYPE.SPLIT, CONST.IOU.MONEY_REQUEST_TYPE.SEND]; return moneyRequestType.includes(iouType); } diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 05322472a407..172c488721ac 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -18,10 +18,10 @@ function canUseDefaultRooms(betas: Beta[]): boolean { } /** - * IOU Send feature is temporarily disabled. + * @param {Array} betas */ -function canUseIOUSend(): boolean { - return false; +function canUseIOUSend(betas: Beta[]): boolean { + return betas?.includes(CONST.BETAS.IOU_SEND) || canUseAllBetas(betas); } function canUseWallet(betas: Beta[]): boolean { diff --git a/tests/unit/IOUUtilsTest.js b/tests/unit/IOUUtilsTest.js index 9ea30638af87..9785acf68317 100644 --- a/tests/unit/IOUUtilsTest.js +++ b/tests/unit/IOUUtilsTest.js @@ -118,10 +118,10 @@ describe('isValidMoneyRequestType', () => { test('Return true for valid iou type', () => { expect(IOUUtils.isValidMoneyRequestType('request')).toBe(true); expect(IOUUtils.isValidMoneyRequestType('split')).toBe(true); + expect(IOUUtils.isValidMoneyRequestType('send')).toBe(true); }); test('Return false for invalid iou type', () => { - expect(IOUUtils.isValidMoneyRequestType('send')).toBe(false); expect(IOUUtils.isValidMoneyRequestType('money')).toBe(false); }); }); From 7bf917b1d0c57166ebadb3c07c3d902e71d57366 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Wed, 27 Sep 2023 23:42:13 +0800 Subject: [PATCH 2/9] get rid of jsdoc --- src/libs/Permissions.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 172c488721ac..b0f17c177719 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -17,9 +17,6 @@ function canUseDefaultRooms(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas); } -/** - * @param {Array} betas - */ function canUseIOUSend(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.IOU_SEND) || canUseAllBetas(betas); } From 3bd357130c39e00c67b014d7567c655127267d3d Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Thu, 5 Oct 2023 19:45:46 +0530 Subject: [PATCH 3/9] bring back send money text --- src/components/ReportWelcomeText.js | 4 +++- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js index 071e53de1776..da6fff2eb325 100644 --- a/src/components/ReportWelcomeText.js +++ b/src/components/ReportWelcomeText.js @@ -137,7 +137,9 @@ function ReportWelcomeText(props) { ))} )} - {moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST) && {props.translate('reportActionsView.usePlusButton')}} + {(moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.SEND) || moneyRequestOptions.includes(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST)) && ( + {props.translate('reportActionsView.usePlusButton')} + )} ); diff --git a/src/languages/en.ts b/src/languages/en.ts index 389faa4a696b..139ea1b59591 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -430,7 +430,7 @@ export default { chatWithAccountManager: 'Chat with your account manager here', sayHello: 'Say hello!', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, - usePlusButton: '\n\nYou can also use the + button below to request money or assign a task!', + usePlusButton: '\n\nYou can also use the + button below to send or request money or assign a task!', }, reportAction: { asCopilot: 'as copilot for', diff --git a/src/languages/es.ts b/src/languages/es.ts index 50ca3e5b23bc..b1d14f8f52de 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -422,7 +422,7 @@ export default { chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí', sayHello: '¡Saluda!', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, - usePlusButton: '\n\n¡También puedes usar el botón + de abajo para pedir dinero o asignar una tarea!', + usePlusButton: '\n\n¡También puedes usar el botón + de abajo para enviar o pedir dinero o asignar una tarea!', }, reportAction: { asCopilot: 'como copiloto de', From 2b6d5edc2d4dc0dc719f2518866716d829863581 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Thu, 5 Oct 2023 22:18:36 +0530 Subject: [PATCH 4/9] fix getting the value from ref --- .../MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 8d745903eb40..b268218ca51e 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -126,7 +126,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { ref={(el) => (optionsSelectorRef.current = el)} participants={iou.participants} onAddParticipants={IOU.setMoneyRequestParticipants} - navigateToRequest={(option) => navigateToRequestStep(CONST.IOU.MONEY_REQUEST_TYPE.REQUEST, option)} + navigateToRequest={(option) => navigateToRequestStep(iouType.current, option)} navigateToSplit={() => navigateToSplitStep(CONST.IOU.MONEY_REQUEST_TYPE.SPLIT)} safeAreaPaddingBottomStyle={safeAreaPaddingBottomStyle} iouType={iouType.current} From 24bb89dcf67fbc441a891ca4bc9d5ae555a0e817 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 6 Oct 2023 00:21:31 +0530 Subject: [PATCH 5/9] fix translation --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 139ea1b59591..590f997e0dc8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -430,7 +430,7 @@ export default { chatWithAccountManager: 'Chat with your account manager here', sayHello: 'Say hello!', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, - usePlusButton: '\n\nYou can also use the + button below to send or request money or assign a task!', + usePlusButton: '\n\nYou can also use the + button to send money, request money, or assign a task!', }, reportAction: { asCopilot: 'as copilot for', diff --git a/src/languages/es.ts b/src/languages/es.ts index b1d14f8f52de..a148e17853d4 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -422,7 +422,7 @@ export default { chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí', sayHello: '¡Saluda!', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, - usePlusButton: '\n\n¡También puedes usar el botón + de abajo para enviar o pedir dinero o asignar una tarea!', + usePlusButton: '\n\n¡También puedes usar el botón + de abajo para enviar dinero, pedir dinero, o asignar una tarea!', }, reportAction: { asCopilot: 'como copiloto de', From 5d9ac2ceda20f487c5b0772d976217525a95d547 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 6 Oct 2023 09:03:06 +0530 Subject: [PATCH 6/9] remove send money beta --- src/CONST.ts | 1 - src/components/ReportWelcomeText.js | 9 +-------- src/libs/Permissions.ts | 5 ----- src/libs/ReportUtils.js | 5 ++--- src/libs/__mocks__/Permissions.ts | 1 - .../AttachmentPickerWithMenuItems.js | 4 ++-- .../FloatingActionButtonAndPopover.js | 14 +++++--------- 7 files changed, 10 insertions(+), 29 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index e98a42c973cf..4587efa0dbb0 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -232,7 +232,6 @@ const CONST = { BETA_EXPENSIFY_WALLET: 'expensifyWallet', BETA_COMMENT_LINKING: 'commentLinking', INTERNATIONALIZATION: 'internationalization', - IOU_SEND: 'sendMoney', POLICY_ROOMS: 'policyRooms', PASSWORDLESS: 'passwordless', TASKS: 'tasks', diff --git a/src/components/ReportWelcomeText.js b/src/components/ReportWelcomeText.js index da6fff2eb325..7c8444a5d5b9 100644 --- a/src/components/ReportWelcomeText.js +++ b/src/components/ReportWelcomeText.js @@ -48,9 +48,6 @@ const propTypes = { /** All of the personal details for everyone */ personalDetails: PropTypes.objectOf(personalDetailsPropTypes), - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), - ...withLocalizePropTypes, }; @@ -58,7 +55,6 @@ const defaultProps = { report: {}, policy: {}, personalDetails: {}, - betas: [], }; function ReportWelcomeText(props) { @@ -73,7 +69,7 @@ function ReportWelcomeText(props) { ); const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(props.policy); const roomWelcomeMessage = ReportUtils.getRoomWelcomeMessage(props.report, isUserPolicyAdmin); - const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(props.report, participantAccountIDs, props.betas); + const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(props.report, participantAccountIDs); return ( <> @@ -152,9 +148,6 @@ ReportWelcomeText.displayName = 'ReportWelcomeText'; export default compose( withLocalize, withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, personalDetails: { key: ONYXKEYS.PERSONAL_DETAILS_LIST, }, diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index b0f17c177719..13489c396c3c 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -17,10 +17,6 @@ function canUseDefaultRooms(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas); } -function canUseIOUSend(betas: Beta[]): boolean { - return betas?.includes(CONST.BETAS.IOU_SEND) || canUseAllBetas(betas); -} - function canUseWallet(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas); } @@ -65,7 +61,6 @@ export default { canUseChronos, canUsePayWithExpensify, canUseDefaultRooms, - canUseIOUSend, canUseWallet, canUseCommentLinking, canUsePolicyRooms, diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 86caaa8a23a5..2c3e611f5e9d 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -3346,10 +3346,9 @@ function canRequestMoney(report, participants) { * * @param {Object} report * @param {Array} reportParticipants - * @param {Array} betas * @returns {Array} */ -function getMoneyRequestOptions(report, reportParticipants, betas) { +function getMoneyRequestOptions(report, reportParticipants) { // In any thread or task report, we do not allow any new money requests yet if (isChatThread(report) || isTaskReport(report)) { return []; @@ -3381,7 +3380,7 @@ function getMoneyRequestOptions(report, reportParticipants, betas) { ...(canRequestMoney(report, participants) ? [CONST.IOU.MONEY_REQUEST_TYPE.REQUEST] : []), // Send money option should be visible only in DMs - ...(Permissions.canUseIOUSend(betas) && isChatReport(report) && !isPolicyExpenseChat(report) && hasSingleParticipantInReport ? [CONST.IOU.MONEY_REQUEST_TYPE.SEND] : []), + ...(isChatReport(report) && !isPolicyExpenseChat(report) && hasSingleParticipantInReport ? [CONST.IOU.MONEY_REQUEST_TYPE.SEND] : []), ]; } diff --git a/src/libs/__mocks__/Permissions.ts b/src/libs/__mocks__/Permissions.ts index 2c062590573e..66ef64bbb994 100644 --- a/src/libs/__mocks__/Permissions.ts +++ b/src/libs/__mocks__/Permissions.ts @@ -12,6 +12,5 @@ export default { ...jest.requireActual('../Permissions'), canUseDefaultRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.DEFAULT_ROOMS), canUsePolicyRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.POLICY_ROOMS), - canUseIOUSend: (betas: Beta[]) => betas.includes(CONST.BETAS.IOU_SEND), canUseCustomStatus: (betas: Beta[]) => betas.includes(CONST.BETAS.CUSTOM_STATUS), }; diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js index 6dd3355f4a53..4024cbd7a2c8 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js @@ -140,11 +140,11 @@ function AttachmentPickerWithMenuItems({ }, }; - return _.map(ReportUtils.getMoneyRequestOptions(report, reportParticipantIDs, betas), (option) => ({ + return _.map(ReportUtils.getMoneyRequestOptions(report, reportParticipantIDs), (option) => ({ ...options[option], onSelected: () => IOU.startMoneyRequest(option, report.reportID), })); - }, [betas, report, reportParticipantIDs, translate]); + }, [report, reportParticipantIDs, translate]); /** * Determines if we can show the task option diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index e9ede2c9a89a..dfdea8894d68 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -185,15 +185,11 @@ function FloatingActionButtonAndPopover(props) { text: props.translate('sidebarScreen.fabNewChat'), onSelected: () => interceptAnonymousUser(() => Navigation.navigate(ROUTES.NEW)), }, - ...(Permissions.canUseIOUSend(props.betas) - ? [ - { - icon: Expensicons.Send, - text: props.translate('iou.sendMoney'), - onSelected: () => interceptAnonymousUser(() => IOU.startMoneyRequest(CONST.IOU.MONEY_REQUEST_TYPE.SEND)), - }, - ] - : []), + { + icon: Expensicons.Send, + text: props.translate('iou.sendMoney'), + onSelected: () => interceptAnonymousUser(() => IOU.startMoneyRequest(CONST.IOU.MONEY_REQUEST_TYPE.SEND)), + }, { icon: Expensicons.MoneyCircle, text: props.translate('iou.requestMoney'), From 72bbd029f87418a51cb08c69fdb281b769c9bed4 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 6 Oct 2023 18:26:09 +0530 Subject: [PATCH 7/9] update the displayname --- .../MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index b268218ca51e..2d0a98c2ef4c 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -139,7 +139,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) { ); } -MoneyRequestParticipantsPage.displayName = 'IOUParticipantsPage'; +MoneyRequestParticipantsPage.displayName = 'MoneyRequestParticipantsPage'; MoneyRequestParticipantsPage.propTypes = propTypes; MoneyRequestParticipantsPage.defaultProps = defaultProps; From 72b9d2e4cc651b80060262419cd241ca9134dcb2 Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 6 Oct 2023 18:57:30 +0530 Subject: [PATCH 8/9] make selectedTab optional: --- .../MoneyRequestParticipantsPage.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index 2d0a98c2ef4c..a22f98bfe551 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -35,11 +35,12 @@ const propTypes = { iou: iouPropTypes, /** The current tab we have navigated to in the request modal. String that corresponds to the request type. */ - selectedTab: PropTypes.oneOf([CONST.TAB.DISTANCE, CONST.TAB.MANUAL, CONST.TAB.SCAN]).isRequired, + selectedTab: PropTypes.oneOf([CONST.TAB.DISTANCE, CONST.TAB.MANUAL, CONST.TAB.SCAN]), }; const defaultProps = { iou: iouDefaultProps, + selectedTab: '', }; function MoneyRequestParticipantsPage({iou, selectedTab, route}) { From ff41050560ff52ba0a5b5d6b056d2b15a953d32a Mon Sep 17 00:00:00 2001 From: Vivek Kumar Date: Fri, 6 Oct 2023 19:17:49 +0530 Subject: [PATCH 9/9] default to undefined --- .../MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js index a22f98bfe551..77ea4391660e 100644 --- a/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js +++ b/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsPage.js @@ -40,7 +40,7 @@ const propTypes = { const defaultProps = { iou: iouDefaultProps, - selectedTab: '', + selectedTab: undefined, }; function MoneyRequestParticipantsPage({iou, selectedTab, route}) {