From 4986bbf0cc7ce192efaec95824f1bd505a2d9aff Mon Sep 17 00:00:00 2001 From: tienifr Date: Thu, 7 Sep 2023 19:38:53 +0700 Subject: [PATCH 001/219] fix: 26762 --- src/libs/actions/Task.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 6227686b3f45..3f29730cbc30 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -529,6 +529,7 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi reportName, managerID: assigneeAccountID || report.managerID, managerEmail: assigneeEmail || report.managerEmail, + notificationPreference: [assigneeAccountID, ownerAccountID].includes(currentUserAccountID) ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, }, }, ]; From fda078116081fe005cda01c9148ab205478c1f7a Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 20 Sep 2023 18:03:05 +0700 Subject: [PATCH 002/219] fix lint --- src/libs/actions/Task.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index 1ed1d35449f8..50f524809202 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -520,7 +520,9 @@ function editTaskAssigneeAndNavigate(report, ownerAccountID, assigneeEmail, assi reportName, managerID: assigneeAccountID || report.managerID, managerEmail: assigneeEmail || report.managerEmail, - notificationPreference: [assigneeAccountID, ownerAccountID].includes(currentUserAccountID) ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, + notificationPreference: [assigneeAccountID, ownerAccountID].includes(currentUserAccountID) + ? CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS + : CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, }, }, ]; From 424a856baa954875f82fa321ff40fa7a9002b82d Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 3 Oct 2023 10:25:13 +0200 Subject: [PATCH 003/219] Migrated HttpUtils.js lib to TypeScript. --- src/components/Alert/index.js | 2 +- src/libs/{HttpUtils.js => HttpUtils.ts} | 69 ++++++++++++------------- src/types/onyx/Response.ts | 8 +++ 3 files changed, 41 insertions(+), 38 deletions(-) rename src/libs/{HttpUtils.js => HttpUtils.ts} (67%) diff --git a/src/components/Alert/index.js b/src/components/Alert/index.js index dc3a722c2331..3fc90433f13e 100644 --- a/src/components/Alert/index.js +++ b/src/components/Alert/index.js @@ -5,7 +5,7 @@ import _ from 'underscore'; * * @param {String} title The title of the alert * @param {String} description The description of the alert - * @param {Object[]} options An array of objects with `style` and `onPress` properties + * @param {Object[]} [options] An array of objects with `style` and `onPress` properties */ export default (title, description, options) => { const result = _.filter(window.confirm([title, description], Boolean)).join('\n'); diff --git a/src/libs/HttpUtils.js b/src/libs/HttpUtils.ts similarity index 67% rename from src/libs/HttpUtils.js rename to src/libs/HttpUtils.ts index 5a8185a03038..ad902385495f 100644 --- a/src/libs/HttpUtils.js +++ b/src/libs/HttpUtils.ts @@ -1,10 +1,13 @@ import Onyx from 'react-native-onyx'; -import _ from 'underscore'; import CONST from '../CONST'; import ONYXKEYS from '../ONYXKEYS'; import HttpsError from './Errors/HttpsError'; import * as ApiUtils from './ApiUtils'; import alert from '../components/Alert'; +import type Response from '../types/onyx/Response'; + +type ProcessHttpRequest = (url: string, method: string, body: FormData | null, canCancel: boolean) => Promise; +type Xhr = (command: string, data: Record, type: string, shouldUseSecure: boolean) => Promise; let shouldFailAllRequests = false; let shouldForceOffline = false; @@ -25,15 +28,9 @@ let cancellationController = new AbortController(); /** * Send an HTTP request, and attempt to resolve the json response. * If there is a network error, we'll set the application offline. - * - * @param {String} url - * @param {String} [method] - * @param {Object} [body] - * @param {Boolean} [canCancel] - * @returns {Promise} */ -function processHTTPRequest(url, method = 'get', body = null, canCancel = true) { - return fetch(url, { +const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null, canCancel = true) => + fetch(url, { // We hook requests to the same Controller signal, so we can cancel them all at once signal: canCancel ? cancellationController.signal : undefined, method, @@ -49,40 +46,40 @@ function processHTTPRequest(url, method = 'get', body = null, canCancel = true) if (!response.ok) { // Expensify site is down or there was an internal server error, or something temporary like a Bad Gateway, or unknown error occurred - const serviceInterruptedStatuses = [ + const serviceInterruptedStatuses: number[] = [ CONST.HTTP_STATUS.INTERNAL_SERVER_ERROR, CONST.HTTP_STATUS.BAD_GATEWAY, CONST.HTTP_STATUS.GATEWAY_TIMEOUT, CONST.HTTP_STATUS.UNKNOWN_ERROR, ]; - if (_.contains(serviceInterruptedStatuses, response.status)) { + if (serviceInterruptedStatuses.includes(response.status)) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, - status: response.status, + status: response.status.toString(), title: 'Issue connecting to Expensify site', }); } else if (response.status === CONST.HTTP_STATUS.TOO_MANY_REQUESTS) { throw new HttpsError({ message: CONST.ERROR.THROTTLED, - status: response.status, + status: response.status.toString(), title: 'API request throttled', }); } throw new HttpsError({ message: response.statusText, - status: response.status, + status: response.status.toString(), }); } return response.json(); }) - .then((response) => { + .then((response: Response) => { // Some retried requests will result in a "Unique Constraints Violation" error from the server, which just means the record already exists if (response.jsonCode === CONST.JSON_CODE.BAD_REQUEST && response.message === CONST.ERROR_TITLE.DUPLICATE_RECORD) { throw new HttpsError({ message: CONST.ERROR.DUPLICATE_RECORD, - status: CONST.JSON_CODE.BAD_REQUEST, + status: CONST.JSON_CODE.BAD_REQUEST.toString(), title: CONST.ERROR_TITLE.DUPLICATE_RECORD, }); } @@ -91,44 +88,42 @@ function processHTTPRequest(url, method = 'get', body = null, canCancel = true) if (response.jsonCode === CONST.JSON_CODE.EXP_ERROR && response.title === CONST.ERROR_TITLE.SOCKET && response.type === CONST.ERROR_TYPE.SOCKET) { throw new HttpsError({ message: CONST.ERROR.EXPENSIFY_SERVICE_INTERRUPTED, - status: CONST.JSON_CODE.EXP_ERROR, + status: CONST.JSON_CODE.EXP_ERROR.toString(), title: CONST.ERROR_TITLE.SOCKET, }); } if (response.jsonCode === CONST.JSON_CODE.MANY_WRITES_ERROR) { - const {phpCommandName, authWriteCommands} = response.data; - // eslint-disable-next-line max-len - const message = `The API call (${phpCommandName}) did more Auth write requests than allowed. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( - ', ', - )}. Check the APIWriteCommands class in Web-Expensify`; - alert('Too many auth writes', message); + if (response.data) { + const {phpCommandName, authWriteCommands} = response.data; + // eslint-disable-next-line max-len + const message = `The API call (${phpCommandName}) did more Auth write requests than allowed. Count ${authWriteCommands.length}, commands: ${authWriteCommands.join( + ', ', + )}. Check the APIWriteCommands class in Web-Expensify`; + alert('Too many auth writes', message); + } } return response; }); -} /** * Makes XHR request - * @param {String} command the name of the API command - * @param {Object} data parameters for the API command - * @param {String} type HTTP request type (get/post) - * @param {Boolean} shouldUseSecure should we use the secure server - * @returns {Promise} + * @param command the name of the API command + * @param data parameters for the API command + * @param type HTTP request type (get/post) + * @param shouldUseSecure should we use the secure server */ -function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) { +const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) => { const formData = new FormData(); - _.each(data, (val, key) => { - // Do not send undefined request parameters to our API. They will be processed as strings of 'undefined'. - if (_.isUndefined(val)) { + Object.keys(data).forEach((key) => { + if (data[key] === undefined) { return; } - - formData.append(key, val); + formData.append(key, data[key]); }); const url = ApiUtils.getCommandURL({shouldUseSecure, command}); - return processHTTPRequest(url, type, formData, data.canCancel); -} + return processHTTPRequest(url, type, formData, Boolean(data.canCancel)); +}; function cancelPendingRequests() { cancellationController.abort(); diff --git a/src/types/onyx/Response.ts b/src/types/onyx/Response.ts index 255ac6d9bae4..263f1f37d886 100644 --- a/src/types/onyx/Response.ts +++ b/src/types/onyx/Response.ts @@ -1,5 +1,10 @@ import {OnyxUpdate} from 'react-native-onyx'; +type Data = { + phpCommandName: string; + authWriteCommands: string[]; +}; + type Response = { previousUpdateID?: number | string; lastUpdateID?: number | string; @@ -7,6 +12,9 @@ type Response = { onyxData?: OnyxUpdate[]; requestID?: string; message?: string; + title?: string; + data?: Data; + type?: string; }; export default Response; From 1b9523e690ec0208cde6dfe4a976db9ee39a2098 Mon Sep 17 00:00:00 2001 From: Kacper Falat Date: Tue, 3 Oct 2023 14:14:06 +0200 Subject: [PATCH 004/219] Requested changes. --- src/libs/HttpUtils.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libs/HttpUtils.ts b/src/libs/HttpUtils.ts index ad902385495f..5199ee6e6e6e 100644 --- a/src/libs/HttpUtils.ts +++ b/src/libs/HttpUtils.ts @@ -6,11 +6,9 @@ import * as ApiUtils from './ApiUtils'; import alert from '../components/Alert'; import type Response from '../types/onyx/Response'; -type ProcessHttpRequest = (url: string, method: string, body: FormData | null, canCancel: boolean) => Promise; -type Xhr = (command: string, data: Record, type: string, shouldUseSecure: boolean) => Promise; - let shouldFailAllRequests = false; let shouldForceOffline = false; + Onyx.connect({ key: ONYXKEYS.NETWORK, callback: (network) => { @@ -29,8 +27,8 @@ let cancellationController = new AbortController(); * Send an HTTP request, and attempt to resolve the json response. * If there is a network error, we'll set the application offline. */ -const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null, canCancel = true) => - fetch(url, { +function processHTTPRequest(url: string, method = 'get', body: FormData | null = null, canCancel = true): Promise { + return fetch(url, { // We hook requests to the same Controller signal, so we can cancel them all at once signal: canCancel ? cancellationController.signal : undefined, method, @@ -104,6 +102,7 @@ const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null } return response; }); +} /** * Makes XHR request @@ -112,10 +111,10 @@ const processHTTPRequest: ProcessHttpRequest = (url, method = 'get', body = null * @param type HTTP request type (get/post) * @param shouldUseSecure should we use the secure server */ -const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) => { +function xhr(command: string, data: Record, type: string = CONST.NETWORK.METHOD.POST, shouldUseSecure = false): Promise { const formData = new FormData(); Object.keys(data).forEach((key) => { - if (data[key] === undefined) { + if (!data[key]) { return; } formData.append(key, data[key]); @@ -123,7 +122,7 @@ const xhr: Xhr = (command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecu const url = ApiUtils.getCommandURL({shouldUseSecure, command}); return processHTTPRequest(url, type, formData, Boolean(data.canCancel)); -}; +} function cancelPendingRequests() { cancellationController.abort(); From ab67bc431c5b4993ac78429841bf24cdc9fda31c Mon Sep 17 00:00:00 2001 From: Zany Renney <56830058+zanyrenney@users.noreply.github.com> Date: Wed, 11 Oct 2023 12:19:06 +0100 Subject: [PATCH 005/219] Create Managing Employees and Reports > Approving Reports Help Site article for report managing, specially how to approve reports. --- ... Employees and Reports > Approving Reports | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 docs/articles/expensify-classic/manage-employees-and-report-approvals/Managing Employees and Reports > Approving Reports diff --git a/docs/articles/expensify-classic/manage-employees-and-report-approvals/Managing Employees and Reports > Approving Reports b/docs/articles/expensify-classic/manage-employees-and-report-approvals/Managing Employees and Reports > Approving Reports new file mode 100644 index 000000000000..0f9b2f742cd9 --- /dev/null +++ b/docs/articles/expensify-classic/manage-employees-and-report-approvals/Managing Employees and Reports > Approving Reports @@ -0,0 +1,144 @@ +--- +title: How To: Manage Employees and Reports > Approving Reports +description: This page will help you understand the lifecycle of a report and how to approve reports that are submitted to you. +--- + + +# About + + +# How-to manage reports + From 1c5ea6b610317d019b682113bb3ac0aa784c16ab Mon Sep 17 00:00:00 2001 From: Al Garces Date: Thu, 12 Oct 2023 17:11:28 -0700 Subject: [PATCH 006/219] Update Close-Account.md Updating the Close Account resource to the help site --- .../account-settings/Close-Account.md | 123 +++++++++++++++++- 1 file changed, 120 insertions(+), 3 deletions(-) diff --git a/docs/articles/expensify-classic/account-settings/Close-Account.md b/docs/articles/expensify-classic/account-settings/Close-Account.md index 5e18490fc357..7efa8e9ec255 100644 --- a/docs/articles/expensify-classic/account-settings/Close-Account.md +++ b/docs/articles/expensify-classic/account-settings/Close-Account.md @@ -1,5 +1,122 @@ --- -title: Close Account +title: Close-Account.md description: Close Account ---- -## Resource Coming Soon! +--- +# Overview + +Here is a walk through of how to close an Expensify account through the website or mobile app. + +# How to close your account +On the Web: + +1. Go to **Settings** in the left hand menu. Click **Account**. +2. Click “Close Account” +3. Follow the prompts to verify your email or phone number. +4. Your account will be closed, and all data will be deleted.* + +![Insert alt text for accessibility here](https://help.expensify.com/assets/images/image-name.png){:width="100%"} + +On the Mobile App: + +Open the app and tap the three horizontal lines in the upper left corner. +Select Settings from the menu. +Look for the "Close Account" option in the "Others" section. (If you don’t see this option, you have a Domain Controlled account and will need to ask your Domain Admin to delete your account.) +Complete the verification process using your email or phone number. +Your account will be closed, and all data will be deleted.* + +![Insert alt text for accessibility here](https://help.expensify.com/assets/images/image-name.png){:width="100%"} + +These instructions may vary depending on the specific device you are using, so be sure to follow the steps as they appear on your screen. + +*Note: Transactions shared with other accounts will still be visible to those accounts. (Example: A report submitted to your company and reimbursed will not be deleted from your company’s account.) Additionally, we are required to retain certain records of transactions in compliance with laws in various jurisdictions. + +# How to reopen your account + +If your Expensify account is closed and not associated with a verified domain, you can reopen it with the following steps: + +1. Visit [expensify.com](https://www.expensify.com/). +2. Attempt to sign in using your email address or phone number associated with the closed account. +3. After entering your user name, you will see the following prompt: [Insert Image 3] +4. Click on **Reopen Account**. +5. A magic link will be sent to your email address. +6. Access your email and click on the magic link. This link will take you to Expensify and reopen your account. +7. Follow the prompts to create a new password associated with your account. +8. Your account is now reopened. Any previously approved expense data will still be visible in the account. + +Note: Reports submitted and closed on an Individual workspace will not be retained since they have not been approved or shared with anyone else in Expensify. + +That's it! Your account is successfully reopened, and you can access your historical data that was shared with other accounts. Remember to recreate any workspaces and adjust settings if needed. + +# How to Reopen a Domain-controlled account +Once an account has been **Closed** by a Domain Admin, it can be reopened by any Domain Admin on that domain. + +The Domain Admin will simply need to invite the previously closed account in the same manner that new accounts are invited to the Domain. The user will receive a magic link to their email account which they can use to Reopen the account. + +# How to retain a free account to keep historical expenses +If you no longer need a group workspace or have a more advanced workspace than necessary in Expensify, and you want to downgrade while retaining your historical data, here's what you should do: + +1. If you're part of a group worksapce, request the Workspace Admin to remove you, or if you own the workspace, delete it to downgrade to a free version. +2. Once you've removed or been removed from a workspace, start using your free Expensify account. Your submitted expenses will still be saved, allowing you to access the historical data. +3. Domain Admins in the company will still retain access to approved and reimbursed expenses. +4. To keep your data, avoid closing your account. Account closures are irreversible and will result in the deletion of all your unapproved data. + +# Deep Dive + +## I’m unable to close my account + +If you're encountering an error message while trying to close your Expensify account, it's important to pinpoint the specific error. Encountering an error when trying to close your account is typically only experienced if the account has been an admin on a company’s Expensify workspace. (Especially if the account was involved in responsibilities like reimbursing employees or exporting expense reports.) + +In order to avoid users accidentally creating issues for their company, Expensify prevents account closure if you still have any individual responsibilities related to a Workspace within the platform. To successfully close your account, you need to ensure that your worksapce no longer relies on your account to operate. + +Here are the reasons why you might encounter an error when trying to close your Expensify account, along with the actions required to address each of these issues: + +- **Account Under a Validated Domain**: If your account is associated with a validated domain, only a Domain Admin can close it. You can find this option in your Domain Admin's settings under Settings > Domains > Domain Members. Afterward, if you have a secondary personal login, you can delete it by following the instructions mentioned above. +- **Sole Domain Admin for Your Company**: If you are the only Domain Admin for your company's domain, you must appoint another Domain Admin before you can close your account. This is to avoid accidentally prohibiting your entire company from using Expensify. You can do this by going to Settings > Domains > [Domain Name] > Domain Admins and making the necessary changes, or you can reset the entire domain. +- **Workspace Billing Owner with an Annual Subscription**: If you are the Workspace Billing Owner with an Annual Subscription, you need to downgrade from the Annual subscription before closing the account. Alternatively, you can have another user take over billing for your workspaces. +- **Ownership of a Company Workspace or Outstanding Balance**: If you own a company workspace or there is an outstanding balance owed to Expensify, you must take one of the following actions before closing your account: + + - Make the payment for the outstanding balance. + - Have another user take over billing for the workspace. + - Request a refund for your initial bill. + - Delete the workspace. + +- **Preferred Exporter for Your Workspace Integration**: If you are the "Preferred Exporter" for a workspace Integration, you must update the Preferred Exporter before closing your account. You can do this by navigating to **Settings** > **Workspaces** > **Group** > [Workspace name] > **Connections** > **Configure** and selecting any Workspace Admin from the dropdown menu as the Preferred Exporter. +- **Verified Business Account with Outstanding Balance or Locked Status**: If you have a Verified Business Account with an outstanding balance or if the account is locked, you should wait for all payments to settle or unlock the account. To settle the amount owed, go to **Settings** > **Account** > **Payments** > **Bank Accounts** and take the necessary steps. + +## Validate the account to close it + +Sometimes, you may find yourself with an Expensify account that you don't need. This could be due to various reasons like a company inviting you for reimbursement, a vendor inviting you to pay, or a mistaken sign-up. + +In such cases, you have two options: + +**Option 1**: Retain the Account for Future Use +You can keep the Expensify account just in case you need it later. + +**Option 2**: Close the Account + +Start by verifying your email or phone number + +Before closing the account, you need to verify that you have access to the email or phone number associated with it. This ensures that only you can close the account. + +Here's how to do it: + +1. Go to[ www.expensify.com](http://www.expensify.com/). +2. Enter your email address or phone number (whichever is associated with the unwanted account). +3. Click the **Resend Link** button. +4. Check your Home Page for the most recent email with the subject line "Please validate your Expensify login." Click the link provided in the email to validate your email address. + - If it's an account linked to a phone number, tap the link sent to your phone. +5. After clicking the validation link, you'll be directed to an Expensify Home Page. +6. Navigate to **Settings** > **Account** > **Account Details** > **Close Account**. +7. Click the **Close My Account** button. + - Re-enter the email address or phone number of the account when prompted. + - Check the box that says, "I understand all of my unsubmitted expense data will be deleted." + - Click the **Close My Account** button. + +By following these steps, you can easily verify your email or phone number and close an unwanted Expensify account. + +# FAQ + +## What should I do if I'm not directed to my account when clicking the validate option from my phone or email? +It's possible your browser has blocked this, either because of some existing cache or extension. In this case, you should follow the Reset Password flow to reset the password and manually gain access with the new password, along with your email address. +## Why don't I see the Close Account option? +It's possible your account is on a managed company domain. In this case, only the admins from that company can close it. From 4fa79fd5a73bb49cada0ef7b2c7d2232454ca758 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 14:01:38 +0200 Subject: [PATCH 007/219] Add error message --- src/components/StatePicker/StateSelectorModal.js | 2 +- src/languages/en.ts | 2 ++ src/languages/types.ts | 3 +++ src/libs/actions/IOU.js | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/StatePicker/StateSelectorModal.js b/src/components/StatePicker/StateSelectorModal.js index 378dcc4ebc8b..30379c72c4a0 100644 --- a/src/components/StatePicker/StateSelectorModal.js +++ b/src/components/StatePicker/StateSelectorModal.js @@ -10,7 +10,7 @@ import useLocalize from '../../hooks/useLocalize'; import ScreenWrapper from '../ScreenWrapper'; import styles from '../../styles/styles'; import searchCountryOptions from '../../libs/searchCountryOptions'; -import StringUtils from '../../libs/StringUtils'; +import * as StringUtils from '../../libs/StringUtils'; const propTypes = { /** Whether the modal is visible */ diff --git a/src/languages/en.ts b/src/languages/en.ts index f69f9ea4bedd..edbac8d1dc61 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -74,6 +74,7 @@ import type { FormattedMaxLengthParams, RequestedAmountMessageParams, TagSelectionParams, + ReceiptCreateFailureMessageParams, TranslationBase, WalletProgramParams, } from './types'; @@ -567,6 +568,7 @@ export default { invalidSplit: 'Split amounts do not equal total amount', other: 'Unexpected error, please try again later', genericCreateFailureMessage: 'Unexpected error requesting money, please try again later', + receiptCreateFailureMessage: ({receiptUrl}: ReceiptCreateFailureMessageParams) => `The receipt didn't upload. Save the file or dismiss this error and lose it.`, genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later', genericEditFailureMessage: 'Unexpected error editing the money request, please try again later', genericSmartscanFailureMessage: 'Transaction is missing fields', diff --git a/src/languages/types.ts b/src/languages/types.ts index 3ee504ccddd7..193f226899d6 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -198,6 +198,8 @@ type FormattedMaxLengthParams = {formattedMaxLength: string}; type TagSelectionParams = {tagName: string}; +type ReceiptCreateFailureMessageParams = {tagName: string}; + type WalletProgramParams = {walletProgram: string}; /* Translation Object types */ @@ -313,6 +315,7 @@ export type { RemovedTheRequestParams, FormattedMaxLengthParams, TagSelectionParams, + ReceiptCreateFailureMessageParams, SetTheDistanceParams, UpdatedTheDistanceParams, WalletProgramParams, diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index d5676672dd33..de6fdccd7b4e 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -349,12 +349,12 @@ function buildOnyxDataForMoneyRequest( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, [iouAction.reportActionID]: { - errors: ErrorUtils.getMicroSecondOnyxError(null), + errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxError(Localize.translateLocal('iou.error.receiptCreateFailureMessage', {receiptUrl: transaction.receipt.source})) : ErrorUtils.getMicroSecondOnyxError(null), }, } : { [iouAction.reportActionID]: { - errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxError(Localize.translateLocal('iou.error.receiptCreateFailureMessage', {receiptUrl: transaction.receipt.source})) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }), }, From 418f5d7246330c1db21db885e7c849eeb546f165 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 14:02:27 +0200 Subject: [PATCH 008/219] handle htmL --- src/components/DotIndicatorMessage.js | 5 ++++- src/libs/StringUtils.ts | 15 ++++++++++++++- .../PersonalDetails/CountrySelectionPage.js | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index b3528b43dc75..f5d2bbbd5b1e 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -8,6 +8,9 @@ import * as Expensicons from './Icon/Expensicons'; import themeColors from '../styles/themes/default'; import Text from './Text'; import * as Localize from '../libs/Localize'; +import {hasHTML} from "../libs/StringUtils"; +import RenderHTML from "./RenderHTML"; +import * as StringUtils from "../libs/StringUtils"; const propTypes = { /** @@ -66,7 +69,7 @@ function DotIndicatorMessage(props) { key={i} style={styles.offlineFeedback.text} > - {message} + {StringUtils.hasHTML(message) ? : message} ))} diff --git a/src/libs/StringUtils.ts b/src/libs/StringUtils.ts index 8ef23bb0751b..b7021010aa05 100644 --- a/src/libs/StringUtils.ts +++ b/src/libs/StringUtils.ts @@ -10,4 +10,17 @@ function sanitizeString(str: string): string { return _.deburr(str).toLowerCase().replaceAll(CONST.REGEX.NON_ALPHABETIC_AND_NON_LATIN_CHARS, ''); } -export default {sanitizeString}; +/** + * Very simple function to identify if a string contains HTML elements. WARNING: Things like '' will return true + * @param str - The string to check. + * @returns True if it contains html elements + */ +function hasHTML(str: string): boolean { + const regex = new RegExp('/<\\/?[a-z][\\s\\S]*>/', 'i'); + return regex.test(str) +} + +export { + sanitizeString, + hasHTML, +}; diff --git a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js index 741974776df1..ef19ba6aad9d 100644 --- a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js +++ b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js @@ -7,7 +7,7 @@ import ScreenWrapper from '../../../../components/ScreenWrapper'; import HeaderWithBackButton from '../../../../components/HeaderWithBackButton'; import SelectionList from '../../../../components/SelectionList'; import searchCountryOptions from '../../../../libs/searchCountryOptions'; -import StringUtils from '../../../../libs/StringUtils'; +import * as StringUtils from '../../../../libs/StringUtils'; import CONST from '../../../../CONST'; import useLocalize from '../../../../hooks/useLocalize'; From ccda700add1f128ac8c882507f532d8ea56058fa Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 14:12:11 +0200 Subject: [PATCH 009/219] fix regex --- src/libs/StringUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/StringUtils.ts b/src/libs/StringUtils.ts index b7021010aa05..ae0df0e563d3 100644 --- a/src/libs/StringUtils.ts +++ b/src/libs/StringUtils.ts @@ -16,7 +16,7 @@ function sanitizeString(str: string): string { * @returns True if it contains html elements */ function hasHTML(str: string): boolean { - const regex = new RegExp('/<\\/?[a-z][\\s\\S]*>/', 'i'); + const regex = new RegExp('', 'i'); return regex.test(str) } From ee3fbdb2f6903a8bf8b426a9cf340a8145829c83 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 14:12:48 +0200 Subject: [PATCH 010/219] style --- src/components/DotIndicatorMessage.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index f5d2bbbd5b1e..3ed660865cc9 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -8,9 +8,8 @@ import * as Expensicons from './Icon/Expensicons'; import themeColors from '../styles/themes/default'; import Text from './Text'; import * as Localize from '../libs/Localize'; -import {hasHTML} from "../libs/StringUtils"; -import RenderHTML from "./RenderHTML"; -import * as StringUtils from "../libs/StringUtils"; +import RenderHTML from './RenderHTML'; +import * as StringUtils from '../libs/StringUtils'; const propTypes = { /** From 6cb7230ef7cd786c2e716b0b68d97ff01699d574 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 17:00:23 +0200 Subject: [PATCH 011/219] use object for error --- src/CONST.ts | 1 + src/components/DotIndicatorMessage.js | 20 ++++++++++++++++++-- src/libs/actions/IOU.js | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 55fd7faa5a6a..2651fb057a92 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1118,6 +1118,7 @@ const CONST = { DOCX: 'docx', SVG: 'svg', }, + RECEIPT_ERROR: 'receiptError', }, GROWL: { diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index 3ed660865cc9..e74974846141 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -10,6 +10,7 @@ import Text from './Text'; import * as Localize from '../libs/Localize'; import RenderHTML from './RenderHTML'; import * as StringUtils from '../libs/StringUtils'; +import CONST from '../CONST'; const propTypes = { /** @@ -39,6 +40,13 @@ function DotIndicatorMessage(props) { return null; } + function isReceiptError (message) { + if (_.isString(message)) { + return false; + } + return _.get(message, 'error', '') === CONST.IOU.RECEIPT_ERROR; + } + // To ensure messages are presented in order we are sort of destroying the data we are given // and rebuilding as an array so we can render the messages in order. We don't really care about // the microtime timestamps anyways so isn't the end of the world that we sort of lose them here. @@ -64,13 +72,21 @@ function DotIndicatorMessage(props) { {_.map(sortedMessages, (message, i) => ( + isReceiptError(message) ? ( + + bla + + ) : ( - {StringUtils.hasHTML(message) ? : message} + {message} - ))} + )))} ); diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index de6fdccd7b4e..60b5b1f1fad6 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -354,7 +354,7 @@ function buildOnyxDataForMoneyRequest( } : { [iouAction.reportActionID]: { - errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxError(Localize.translateLocal('iou.error.receiptCreateFailureMessage', {receiptUrl: transaction.receipt.source})) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: transaction.receipt ? {[DateUtils.getMicroseconds()]: {error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}} : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }), }, From 874985736bd4b2343b0d0d667c2c03010bcc82a9 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 17:23:20 +0200 Subject: [PATCH 012/219] Use new approach --- src/components/DotIndicatorMessage.js | 38 ++++++++++++++++++++------- src/languages/en.ts | 4 ++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index e74974846141..4486d439a05f 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -1,16 +1,17 @@ import React from 'react'; import _ from 'underscore'; import PropTypes from 'prop-types'; -import {View} from 'react-native'; +import {Keyboard, View} from 'react-native'; import styles from '../styles/styles'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import themeColors from '../styles/themes/default'; import Text from './Text'; import * as Localize from '../libs/Localize'; -import RenderHTML from './RenderHTML'; -import * as StringUtils from '../libs/StringUtils'; import CONST from '../CONST'; +import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; +import addEncryptedAuthTokenToURL from "../libs/addEncryptedAuthTokenToURL"; +import fileDownload from '../libs/fileDownload'; const propTypes = { /** @@ -40,12 +41,19 @@ function DotIndicatorMessage(props) { return null; } - function isReceiptError (message) { + const isReceiptError = (message) => { if (_.isString(message)) { return false; } return _.get(message, 'error', '') === CONST.IOU.RECEIPT_ERROR; - } + }; + + /** + * Download the failed receipt. + */ + const downloadReceipt = (source, filename) => { + fileDownload(source, filename); + }; // To ensure messages are presented in order we are sort of destroying the data we are given // and rebuilding as an array so we can render the messages in order. We don't really care about @@ -73,12 +81,22 @@ function DotIndicatorMessage(props) { {_.map(sortedMessages, (message, i) => ( isReceiptError(message) ? ( - { + downloadReceipt(message.source, message.filename) + }} > - bla - + + {Localize.translateLocal('iou.error.receiptFailureMessage')} + {Localize.translateLocal('iou.error.saveFileMessage')} + {Localize.translateLocal('iou.error.loseFileMessage')} + + ) : ( `The receipt didn't upload. Save the file or dismiss this error and lose it.`, + receiptFailureMessage: 'The receipt didn\'t upload. ', + saveFileMessage: 'Save the file ', + loseFileMessage: 'or dismiss this error and lose it', genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later', genericEditFailureMessage: 'Unexpected error editing the money request, please try again later', genericSmartscanFailureMessage: 'Transaction is missing fields', From 52f5e509b699ebaf1235e32f9f8988defe497738 Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 17:59:10 +0200 Subject: [PATCH 013/219] use function --- src/components/DotIndicatorMessage.js | 1 - src/languages/en.ts | 1 - src/languages/types.ts | 3 --- src/libs/ErrorUtils.ts | 10 +++++++++- src/libs/actions/IOU.js | 4 ++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index 4486d439a05f..afb59114cc6d 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -10,7 +10,6 @@ import Text from './Text'; import * as Localize from '../libs/Localize'; import CONST from '../CONST'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; -import addEncryptedAuthTokenToURL from "../libs/addEncryptedAuthTokenToURL"; import fileDownload from '../libs/fileDownload'; const propTypes = { diff --git a/src/languages/en.ts b/src/languages/en.ts index 9dfeddcc2f36..d4c5e300708d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -74,7 +74,6 @@ import type { FormattedMaxLengthParams, RequestedAmountMessageParams, TagSelectionParams, - ReceiptCreateFailureMessageParams, TranslationBase, WalletProgramParams, } from './types'; diff --git a/src/languages/types.ts b/src/languages/types.ts index 193f226899d6..3ee504ccddd7 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -198,8 +198,6 @@ type FormattedMaxLengthParams = {formattedMaxLength: string}; type TagSelectionParams = {tagName: string}; -type ReceiptCreateFailureMessageParams = {tagName: string}; - type WalletProgramParams = {walletProgram: string}; /* Translation Object types */ @@ -315,7 +313,6 @@ export type { RemovedTheRequestParams, FormattedMaxLengthParams, TagSelectionParams, - ReceiptCreateFailureMessageParams, SetTheDistanceParams, UpdatedTheDistanceParams, WalletProgramParams, diff --git a/src/libs/ErrorUtils.ts b/src/libs/ErrorUtils.ts index bf4fc0d810a4..4be126830500 100644 --- a/src/libs/ErrorUtils.ts +++ b/src/libs/ErrorUtils.ts @@ -42,6 +42,14 @@ function getMicroSecondOnyxError(error: string): Record { return {[DateUtils.getMicroseconds()]: error}; } +/** + * Method used to get an error object with microsecond as the key and am object as the value. + * @param error - error key or message to be saved + */ +function getMicroSecondOnyxErrorObject(error: Record): Record> { + return {[DateUtils.getMicroseconds()]: error}; +} + type OnyxDataWithErrors = { errors?: Errors; }; @@ -111,4 +119,4 @@ function addErrorMessage(errors: ErrorsList, inputID?: string, message?: string) } } -export {getAuthenticateErrorMessage, getMicroSecondOnyxError, getLatestErrorMessage, getLatestErrorField, getEarliestErrorField, addErrorMessage}; +export {getAuthenticateErrorMessage, getMicroSecondOnyxError, getMicroSecondOnyxErrorObject, getLatestErrorMessage, getLatestErrorField, getEarliestErrorField, addErrorMessage}; diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 60b5b1f1fad6..a6e028b6e7ea 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -349,12 +349,12 @@ function buildOnyxDataForMoneyRequest( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, [iouAction.reportActionID]: { - errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxError(Localize.translateLocal('iou.error.receiptCreateFailureMessage', {receiptUrl: transaction.receipt.source})) : ErrorUtils.getMicroSecondOnyxError(null), + errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) : ErrorUtils.getMicroSecondOnyxError(null), }, } : { [iouAction.reportActionID]: { - errors: transaction.receipt ? {[DateUtils.getMicroseconds()]: {error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}} : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }), }, From d97beb33efe4d1febd628b3a6baaa8c65666e19b Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 18:00:30 +0200 Subject: [PATCH 014/219] remove unneeded helper function --- src/components/StatePicker/StateSelectorModal.js | 2 +- src/libs/StringUtils.ts | 15 +-------------- .../PersonalDetails/CountrySelectionPage.js | 2 +- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/components/StatePicker/StateSelectorModal.js b/src/components/StatePicker/StateSelectorModal.js index 30379c72c4a0..378dcc4ebc8b 100644 --- a/src/components/StatePicker/StateSelectorModal.js +++ b/src/components/StatePicker/StateSelectorModal.js @@ -10,7 +10,7 @@ import useLocalize from '../../hooks/useLocalize'; import ScreenWrapper from '../ScreenWrapper'; import styles from '../../styles/styles'; import searchCountryOptions from '../../libs/searchCountryOptions'; -import * as StringUtils from '../../libs/StringUtils'; +import StringUtils from '../../libs/StringUtils'; const propTypes = { /** Whether the modal is visible */ diff --git a/src/libs/StringUtils.ts b/src/libs/StringUtils.ts index ae0df0e563d3..8ef23bb0751b 100644 --- a/src/libs/StringUtils.ts +++ b/src/libs/StringUtils.ts @@ -10,17 +10,4 @@ function sanitizeString(str: string): string { return _.deburr(str).toLowerCase().replaceAll(CONST.REGEX.NON_ALPHABETIC_AND_NON_LATIN_CHARS, ''); } -/** - * Very simple function to identify if a string contains HTML elements. WARNING: Things like '' will return true - * @param str - The string to check. - * @returns True if it contains html elements - */ -function hasHTML(str: string): boolean { - const regex = new RegExp('', 'i'); - return regex.test(str) -} - -export { - sanitizeString, - hasHTML, -}; +export default {sanitizeString}; diff --git a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js index ef19ba6aad9d..741974776df1 100644 --- a/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js +++ b/src/pages/settings/Profile/PersonalDetails/CountrySelectionPage.js @@ -7,7 +7,7 @@ import ScreenWrapper from '../../../../components/ScreenWrapper'; import HeaderWithBackButton from '../../../../components/HeaderWithBackButton'; import SelectionList from '../../../../components/SelectionList'; import searchCountryOptions from '../../../../libs/searchCountryOptions'; -import * as StringUtils from '../../../../libs/StringUtils'; +import StringUtils from '../../../../libs/StringUtils'; import CONST from '../../../../CONST'; import useLocalize from '../../../../hooks/useLocalize'; From ca1443a94469d02637aac37375c74e208973a8ac Mon Sep 17 00:00:00 2001 From: Alberto Date: Tue, 17 Oct 2023 18:06:51 +0200 Subject: [PATCH 015/219] spanish --- src/languages/es.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/languages/es.ts b/src/languages/es.ts index 83e09b2a62c0..913056364970 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -561,6 +561,9 @@ export default { invalidSplit: 'La suma de las partes no equivale al monto total', other: 'Error inesperado, por favor inténtalo más tarde', genericCreateFailureMessage: 'Error inesperado solicitando dinero, Por favor, inténtalo más tarde', + receiptFailureMessage: 'El recibo no se subió. ', + saveFileMessage: 'Guarda el archivo ', + loseFileMessage: 'o descarta este error y piérdelo', genericDeleteFailureMessage: 'Error inesperado eliminando la solicitud de dinero. Por favor, inténtalo más tarde', genericEditFailureMessage: 'Error inesperado al guardar la solicitud de dinero. Por favor, inténtalo más tarde', genericSmartscanFailureMessage: 'La transacción tiene campos vacíos', From 0c559d1a9affc62563acda575a22cb8e6a8185c4 Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 18 Oct 2023 13:10:37 +0200 Subject: [PATCH 016/219] lint --- src/components/DotIndicatorMessage.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index afb59114cc6d..2b1e4ceac97f 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -1,7 +1,7 @@ import React from 'react'; import _ from 'underscore'; import PropTypes from 'prop-types'; -import {Keyboard, View} from 'react-native'; +import {View} from 'react-native'; import styles from '../styles/styles'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; @@ -49,6 +49,9 @@ function DotIndicatorMessage(props) { /** * Download the failed receipt. + * + * @param {String} source + * @param {String} filename */ const downloadReceipt = (source, filename) => { fileDownload(source, filename); From 08d8e8667d4e24e83ff50eed7ee0b1e42372ac79 Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 18 Oct 2023 13:25:59 +0200 Subject: [PATCH 017/219] prettier --- src/components/DotIndicatorMessage.js | 19 ++++++++++--------- src/languages/en.ts | 2 +- src/libs/actions/IOU.js | 8 ++++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index 2b1e4ceac97f..2683e24e6e8e 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -81,12 +81,12 @@ function DotIndicatorMessage(props) { /> - {_.map(sortedMessages, (message, i) => ( + {_.map(sortedMessages, (message, i) => isReceiptError(message) ? ( { - downloadReceipt(message.source, message.filename) + downloadReceipt(message.source, message.filename); }} > ) : ( - - {message} - - )))} + + {message} + + ), + )} ); diff --git a/src/languages/en.ts b/src/languages/en.ts index d4c5e300708d..57d5eaf11e82 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -567,7 +567,7 @@ export default { invalidSplit: 'Split amounts do not equal total amount', other: 'Unexpected error, please try again later', genericCreateFailureMessage: 'Unexpected error requesting money, please try again later', - receiptFailureMessage: 'The receipt didn\'t upload. ', + receiptFailureMessage: "The receipt didn't upload. ", saveFileMessage: 'Save the file ', loseFileMessage: 'or dismiss this error and lose it', genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later', diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index a6e028b6e7ea..2d19366e657a 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -349,12 +349,16 @@ function buildOnyxDataForMoneyRequest( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, [iouAction.reportActionID]: { - errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) : ErrorUtils.getMicroSecondOnyxError(null), + errors: transaction.receipt + ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) + : ErrorUtils.getMicroSecondOnyxError(null), }, } : { [iouAction.reportActionID]: { - errors: transaction.receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: transaction.receipt + ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) + : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }), }, From 040c5edcb4326211493d100e88203699dd271be4 Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 18 Oct 2023 16:48:05 +0200 Subject: [PATCH 018/219] allow multiple lines --- src/components/DotIndicatorMessage.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index 2683e24e6e8e..ef838fb0ed4a 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -92,7 +92,6 @@ function DotIndicatorMessage(props) { {Localize.translateLocal('iou.error.receiptFailureMessage')} {Localize.translateLocal('iou.error.saveFileMessage')} From 17a1c43ba0dab4f7d41e7256bb6b8942cf7e215f Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 19 Oct 2023 12:04:11 +0200 Subject: [PATCH 019/219] add split flow --- src/libs/actions/IOU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 2256b72e3851..c9bcf60e88ac 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1413,7 +1413,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${splitChatReport.reportID}`, value: { [splitIOUReportAction.reportActionID]: { - errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, }); @@ -1436,7 +1436,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co errors: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'), }, [splitIOUReportAction.reportActionID]: { - errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, }, From 1d95f4613ca3567efc635e1b0c3c308c8015cc1d Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 19 Oct 2023 12:36:17 +0200 Subject: [PATCH 020/219] use isEmpty --- src/libs/actions/IOU.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index c9bcf60e88ac..a223ce212d70 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -359,16 +359,16 @@ function buildOnyxDataForMoneyRequest( errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, [iouAction.reportActionID]: { - errors: transaction.receipt - ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) - : ErrorUtils.getMicroSecondOnyxError(null), + errors: _.isEmpty(transaction.receipt) + ? ErrorUtils.getMicroSecondOnyxError(null) + : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}), }, } : { [iouAction.reportActionID]: { - errors: transaction.receipt - ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}) - : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: !_.isEmpty(transaction.receipt) + ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') + : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: transaction.receipt.source, filename: transaction.filename}), }, }), }, @@ -1413,7 +1413,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${splitChatReport.reportID}`, value: { [splitIOUReportAction.reportActionID]: { - errors: receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: _.isEmpty(receipt) ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), }, }, }); @@ -1436,7 +1436,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co errors: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'), }, [splitIOUReportAction.reportActionID]: { - errors: receipt ? ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}) : ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + errors: _.isEmpty(receipt) ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), }, }, }, From 0d010f9ede36a4c616d160fbbe98d4f2f7e90463 Mon Sep 17 00:00:00 2001 From: Alberto Date: Thu, 19 Oct 2023 12:47:24 +0200 Subject: [PATCH 021/219] use empty for split --- src/libs/actions/IOU.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index a223ce212d70..554e52f7383f 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -1413,7 +1413,9 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${splitChatReport.reportID}`, value: { [splitIOUReportAction.reportActionID]: { - errors: _.isEmpty(receipt) ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), + errors: _.isEmpty(receipt) + ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') + : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), }, }, }); @@ -1436,7 +1438,9 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co errors: ErrorUtils.getMicroSecondOnyxError('report.genericCreateReportFailureMessage'), }, [splitIOUReportAction.reportActionID]: { - errors: _.isEmpty(receipt) ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), + errors: _.isEmpty(receipt) + ? ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage') + : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source, filename}), }, }, }, From 8f961ac7430dab15850570a523ea474b70dcfaed Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Sat, 21 Oct 2023 00:00:14 +0100 Subject: [PATCH 022/219] Add a new button to the payment methods popover --- src/CONST.ts | 1 + src/components/AddPaymentMethodMenu.js | 31 +++++++++++++++++++++++++- src/components/KYCWall/BaseKYCWall.js | 1 + src/languages/en.ts | 2 ++ src/languages/es.ts | 2 ++ src/libs/ReportActionsUtils.ts | 21 +++++++++++++++++ 6 files changed, 57 insertions(+), 1 deletion(-) diff --git a/src/CONST.ts b/src/CONST.ts index 048c2dee5bab..dd6df949c3fa 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1101,6 +1101,7 @@ const CONST = { PAYMENT_METHODS: { DEBIT_CARD: 'debitCard', BANK_ACCOUNT: 'bankAccount', + BUSINESS_BANK_ACCOUNT: 'businessBankAccount', }, PAYMENT_METHOD_ID_KEYS: { diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 2c3af95a3fad..7ced56b5b63a 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -2,6 +2,7 @@ import _ from 'underscore'; import React from 'react'; import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; +import lodashGet from 'lodash/get'; import * as Expensicons from './Icon/Expensicons'; import withLocalize, {withLocalizePropTypes} from './withLocalize'; import compose from '../libs/compose'; @@ -11,6 +12,9 @@ import withWindowDimensions from './withWindowDimensions'; import Permissions from '../libs/Permissions'; import PopoverMenu from './PopoverMenu'; import refPropTypes from './refPropTypes'; +import iouReportPropTypes from '../pages/iouReportPropTypes'; +import * as ReportUtils from '../libs/ReportUtils'; +import * as ReportActionsUtils from '../libs/ReportActionsUtils'; const propTypes = { /** Should the component be visible? */ @@ -19,6 +23,9 @@ const propTypes = { /** Callback to execute when the component closes. */ onClose: PropTypes.func.isRequired, + /** The IOU/Expense report we are paying */ + iouReport: iouReportPropTypes, + /** Anchor position for the AddPaymentMenu. */ anchorPosition: PropTypes.shape({ horizontal: PropTypes.number, @@ -37,10 +44,17 @@ const propTypes = { /** Popover anchor ref */ anchorRef: refPropTypes, + /** Session info for the currently logged in user. */ + session: PropTypes.shape({ + /** Currently logged in user accountID */ + accountID: PropTypes.number, + }), + ...withLocalizePropTypes, }; const defaultProps = { + iouReport: {}, anchorPosition: {}, anchorAlignment: { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, @@ -48,6 +62,9 @@ const defaultProps = { }, betas: [], anchorRef: () => {}, + session: { + accountID: 0, + }, }; function AddPaymentMethodMenu(props) { @@ -61,12 +78,21 @@ function AddPaymentMethodMenu(props) { onItemSelected={props.onClose} menuItems={[ { - text: props.translate('common.bankAccount'), + text: props.translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT); }, }, + ...(ReportUtils.isIOUReport(this.props.iouReport) && ReportActionsUtils.hasRequestFromPayer(lodashGet(this.props.iouReport, "reportID", 0), this.props.session.accountID) + ? [ + { + text: props.translate('common.businessBankAccount'), + icon: Expensicons.Workspace, + onSelected: () => props.onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT), + }, + ] + : []), ...(Permissions.canUseWallet(props.betas) ? [ { @@ -93,5 +119,8 @@ export default compose( betas: { key: ONYXKEYS.BETAS, }, + session: { + key: ONYXKEYS.SESSION, + }, }), )(AddPaymentMethodMenu); diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index ccee8bc4e6a0..969cbfc20dcd 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -164,6 +164,7 @@ class KYCWall extends React.Component { <> this.setState({shouldShowAddPaymentMenu: false})} anchorRef={this.anchorRef} anchorPosition={{ diff --git a/src/languages/en.ts b/src/languages/en.ts index 11637846130a..0a97a47cd770 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -214,6 +214,8 @@ export default { more: 'More', debitCard: 'Debit card', bankAccount: 'Bank account', + personalBankAccount: 'Personal bank account', + businessBankAccount: 'Business bank account', join: 'Join', joinThread: 'Join thread', decline: 'Decline', diff --git a/src/languages/es.ts b/src/languages/es.ts index e4a5c37241f2..8df14012ac9a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -204,6 +204,8 @@ export default { more: 'Más', debitCard: 'Tarjeta de débito', bankAccount: 'Cuenta bancaria', + personalBankAccount: 'Personal bank account', + businessBankAccount: 'Business bank account', join: 'Unirse', joinThread: 'Unirse al hilo', decline: 'Rechazar', diff --git a/src/libs/ReportActionsUtils.ts b/src/libs/ReportActionsUtils.ts index c795e5d1c3b1..5a763bbea895 100644 --- a/src/libs/ReportActionsUtils.ts +++ b/src/libs/ReportActionsUtils.ts @@ -605,6 +605,26 @@ function isNotifiableReportAction(reportAction: OnyxEntry): boolea return actions.includes(reportAction.actionName); } +/** + * Helper method to determine if the provided accountID has made a request on the specified report. + * + * @param reportID + * @param currentAccountID + * @returns + */ +function hasRequestFromPayer(reportID: string, currentAccountID: number): boolean { + if (!reportID) { + return false; + } + + const reportActions = Object.values(getAllReportActions(reportID)); + if (reportActions.length === 0) { + return false; + } + + return reportActions.some((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && action.actorAccountID === currentAccountID); +} + export { extractLinksFromMessageHtml, getAllReportActions, @@ -644,4 +664,5 @@ export { isWhisperAction, shouldReportActionBeVisible, shouldReportActionBeVisibleAsLastAction, + hasRequestFromPayer, }; From 6c8bd199c0c73c752c58bd616fbeaaa5e500fb6b Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Sat, 21 Oct 2023 01:07:15 +0100 Subject: [PATCH 023/219] Add the business bank account option --- src/components/KYCWall/BaseKYCWall.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 969cbfc20dcd..a9814cac7492 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -97,6 +97,8 @@ class KYCWall extends React.Component { Navigation.navigate(this.props.addBankAccountRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.DEBIT_CARD) { Navigation.navigate(this.props.addDebitCardRoute); + } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { + // Start the Bottom up flow } } From 1a46590703a67280313606cac66002fc750219cd Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Sun, 22 Oct 2023 21:23:54 +0100 Subject: [PATCH 024/219] Work on the Bottom Up flow command --- src/CONST.ts | 4 +- src/components/KYCWall/BaseKYCWall.js | 3 +- src/libs/actions/Policy.js | 262 ++++++++++++++++++++++++++ 3 files changed, 266 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index dd6df949c3fa..d1db6431eecb 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1190,8 +1190,8 @@ const CONST = { TYPE: { FREE: 'free', PERSONAL: 'personal', - CORPORATE: 'corporate', - TEAM: 'team', + CORPORATE: 'corporate', // aka Control + TEAM: 'team', // aka Collect }, ROLE: { ADMIN: 'admin', diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index a9814cac7492..e7f4b6ac1b31 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -9,6 +9,7 @@ import AddPaymentMethodMenu from '../AddPaymentMethodMenu'; import getClickedTargetLocation from '../../libs/getClickedTargetLocation'; import * as PaymentUtils from '../../libs/PaymentUtils'; import * as PaymentMethods from '../../libs/actions/PaymentMethods'; +import * as Policy from '../../libs/actions/Policy'; import ONYXKEYS from '../../ONYXKEYS'; import Log from '../../libs/Log'; import {propTypes, defaultProps} from './kycWallPropTypes'; @@ -98,7 +99,7 @@ class KYCWall extends React.Component { } else if (paymentMethod === CONST.PAYMENT_METHODS.DEBIT_CARD) { Navigation.navigate(this.props.addDebitCardRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { - // Start the Bottom up flow + Policy.startCollectFlow(this.props.iouReport); } } diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 89324dd35485..02b56a079dbe 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1289,6 +1289,267 @@ function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { return lodashUnion([category], policyRecentlyUsedCategories); } + +function startCollectBottomUpFlow(iouReport, firstName, lastName) { + + // This flow only works for IOU reports + if (!ReportUtils.isIOUReport(iouReport)) { + return; + } + + // Generate new vairbales for the policy + const policyID = generatePolicyID() + const workspaceName = generateDefaultWorkspaceName(sessionEmail); + const employeeAccountID = iouReport.ownerAccountID; + const employeeEmail = iouReport.ownerEmail; + const {customUnits, customUnitID, customUnitRateID} = buildOptimisticCustomUnits(); + + const { + announceChatReportID, + announceChatData, + announceReportActionData, + announceCreatedReportActionID, + adminsChatReportID, + adminsChatData, + adminsReportActionData, + adminsCreatedReportActionID, + expenseChatReportID: workspaceChatReportID, + expenseChatData: workspaceChatData, + expenseReportActionData: workspaceChatReportActionData, + expenseCreatedReportActionID: workspaceChatCreatedReportActionID, + } = ReportUtils.buildOptimisticWorkspaceChats(policyID, workspaceName); + + // Create the workspace chat for the employee + const employeeWorkspaceChat = createPolicyExpenseChats(policyID, {[employeeEmail]: employeeAccountID}); + + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, + value: { + id: policyID, + type: CONST.POLICY.TYPE.TEAM, // We are creating a collect policy in this case + name: workspaceName, + role: CONST.POLICY.ROLE.ADMIN, + owner: sessionEmail, + isPolicyExpenseChatEnabled: true, + outputCurrency: lodashGet(allPersonalDetails, [sessionAccountID, 'localCurrencyCode'], CONST.CURRENCY.USD), + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + customUnits, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${policyID}`, + value: { + [sessionAccountID]: { + role: CONST.POLICY.ROLE.ADMIN, + errors: {}, + }, + [employeeAccountID]: { + role: CONST.POLICY.ROLE.USER, + errors: {}, + }, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${announceChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }, + ...announceChatData, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${announceChatReportID}`, + value: announceReportActionData, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }, + ...adminsChatData, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`, + value: adminsReportActionData, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${workspaceChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }, + ...workspaceChatData, + }, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${workspaceChatReportID}`, + value: workspaceChatReportActionData, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_DRAFTS}${policyID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_MEMBERS_DRAFTS}${policyID}`, + value: null, + }, + ...employeeWorkspaceChat.onyxOptimisticData, + ]; + + const successData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, + value: {pendingAction: null}, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${announceChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: null, + }, + pendingAction: null, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${announceChatReportID}`, + value: { + [_.keys(announceChatData)[0]]: { + pendingAction: null, + }, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: null, + }, + pendingAction: null, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`, + value: { + [_.keys(adminsChatData)[0]]: { + pendingAction: null, + }, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${workspaceChatReportID}`, + value: { + pendingFields: { + addWorkspaceRoom: null, + }, + pendingAction: null, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${workspaceChatReportID}`, + value: { + [_.keys(workspaceChatData)[0]]: { + pendingAction: null, + }, + }, + }, + ...employeeWorkspaceChat.onyxSuccessData + ]; + const failureData = [ + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.POLICY_MEMBERS}${policyID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${announceChatReportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${announceChatReportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT}${workspaceChatReportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${workspaceChatReportID}`, + value: null, + }, + ]; + + // Next we need to convert the IOU report to Expense report and clean up the DM chat + // Get the 1on1 chat where the request was originally made + const chatReportID = iouReport.chatReportID; ReportUtils.getReport(iouReport.chatReportID); + const reportPreviewID = iouReport.parentReportActionID; + + + const membersData = [{ + accountID: employeeAccountID, + email: employeeEmail, + workspaceChatReportID: employeeWorkspaceChat.reportCreationData[employeeEmail].reportID, + workspaceChatCreatedReportActionID: employeeWorkspaceChat.reportCreationData[employeeEmail].reportActionID, + }]; + + API.write( + 'BottomUpCollectFlow', + { + policyID, + announceChatReportID, + adminsChatReportID, + expenseChatReportID: workspaceChatReportID, + ownerEmail: sessionEmail, + makeMeAdmin: false, + policyName: workspaceName, + type: CONST.POLICY.TYPE.TEAM, + announceCreatedReportActionID, + adminsCreatedReportActionID, + expenseCreatedReportActionID: workspaceChatCreatedReportActionID, + customUnitID, + customUnitRateID, + iouReportID: iouReport.reportID, + membersData: JSON.stringify(membersData), + }, + {optimisticData, successData, failureData}, + ); + // Navigation.dismissModal(CONST.TEACHERS_UNITE.PUBLIC_ROOM_ID); +} + export { removeMembers, addMembersToWorkspace, @@ -1320,4 +1581,5 @@ export { openDraftWorkspaceRequest, buildOptimisticPolicyRecentlyUsedCategories, createDraftInitialWorkspace, + startCollectBottomUpFlow, }; From fa911fd0d07e7020057fda60b4f39110b06b4606 Mon Sep 17 00:00:00 2001 From: Al Garces Date: Mon, 23 Oct 2023 11:22:24 -0700 Subject: [PATCH 025/219] Update docs/articles/expensify-classic/account-settings/Close-Account.md Co-authored-by: Rushat Gabhane --- .../expensify-classic/account-settings/Close-Account.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/articles/expensify-classic/account-settings/Close-Account.md b/docs/articles/expensify-classic/account-settings/Close-Account.md index 7efa8e9ec255..615f75823fc7 100644 --- a/docs/articles/expensify-classic/account-settings/Close-Account.md +++ b/docs/articles/expensify-classic/account-settings/Close-Account.md @@ -1,5 +1,5 @@ --- -title: Close-Account.md +title: Close Account description: Close Account --- # Overview From a9d6bfa83aeddc12d55039b42c5ed1925ef6c179 Mon Sep 17 00:00:00 2001 From: Al Garces Date: Mon, 23 Oct 2023 11:22:37 -0700 Subject: [PATCH 026/219] Update docs/articles/expensify-classic/account-settings/Close-Account.md Co-authored-by: Rushat Gabhane --- .../expensify-classic/account-settings/Close-Account.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/articles/expensify-classic/account-settings/Close-Account.md b/docs/articles/expensify-classic/account-settings/Close-Account.md index 615f75823fc7..b3e1a5161b16 100644 --- a/docs/articles/expensify-classic/account-settings/Close-Account.md +++ b/docs/articles/expensify-classic/account-settings/Close-Account.md @@ -100,7 +100,7 @@ Before closing the account, you need to verify that you have access to the email Here's how to do it: -1. Go to[ www.expensify.com](http://www.expensify.com/). +1. Go to [www.expensify.com](http://www.expensify.com/). 2. Enter your email address or phone number (whichever is associated with the unwanted account). 3. Click the **Resend Link** button. 4. Check your Home Page for the most recent email with the subject line "Please validate your Expensify login." Click the link provided in the email to validate your email address. From 0482e5dd8edafcf18fb8748a57841b07a13c512a Mon Sep 17 00:00:00 2001 From: Al Garces Date: Mon, 23 Oct 2023 11:22:51 -0700 Subject: [PATCH 027/219] Update docs/articles/expensify-classic/account-settings/Close-Account.md Co-authored-by: Rushat Gabhane --- .../articles/expensify-classic/account-settings/Close-Account.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/articles/expensify-classic/account-settings/Close-Account.md b/docs/articles/expensify-classic/account-settings/Close-Account.md index b3e1a5161b16..0ea4f1bb287d 100644 --- a/docs/articles/expensify-classic/account-settings/Close-Account.md +++ b/docs/articles/expensify-classic/account-settings/Close-Account.md @@ -118,5 +118,6 @@ By following these steps, you can easily verify your email or phone number and c ## What should I do if I'm not directed to my account when clicking the validate option from my phone or email? It's possible your browser has blocked this, either because of some existing cache or extension. In this case, you should follow the Reset Password flow to reset the password and manually gain access with the new password, along with your email address. + ## Why don't I see the Close Account option? It's possible your account is on a managed company domain. In this case, only the admins from that company can close it. From ab00bc9131f254a0fd4004954bc81229ad126fe6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 25 Oct 2023 17:23:42 +0200 Subject: [PATCH 028/219] Rename file --- .../{DotIndicatorMessage.js => DotIndicatorMessage.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/components/{DotIndicatorMessage.js => DotIndicatorMessage.tsx} (100%) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.tsx similarity index 100% rename from src/components/DotIndicatorMessage.js rename to src/components/DotIndicatorMessage.tsx From 95d80ab047a3e3701536364eb51c6ef43d91fda4 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 25 Oct 2023 17:46:06 +0200 Subject: [PATCH 029/219] [TS migration] Migrate 'DotIndicatorMessage.js' component to TypeScript --- src/components/DotIndicatorMessage.tsx | 68 +++++++------------------- src/components/Text.tsx | 20 ++------ 2 files changed, 23 insertions(+), 65 deletions(-) diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index fc4d74339d6e..0ff5eacfe01b 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -1,75 +1,45 @@ import React from 'react'; -import _ from 'underscore'; -import PropTypes from 'prop-types'; -import {View} from 'react-native'; +import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; import styles from '../styles/styles'; -import stylePropTypes from '../styles/stylePropTypes'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import themeColors from '../styles/themes/default'; import Text from './Text'; import * as Localize from '../libs/Localize'; -const propTypes = { - /** - * In most cases this should just be errors from onxyData - * if you are not passing that data then this needs to be in a similar shape like - * { - * timestamp: 'message', - * } - */ - messages: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object]))])), - - // The type of message, 'error' shows a red dot, 'success' shows a green dot - type: PropTypes.oneOf(['error', 'success']).isRequired, - - // Additional styles to apply to the container */ - // eslint-disable-next-line react/forbid-prop-types - style: PropTypes.arrayOf(PropTypes.object), - - // Additional styles to apply to the text - textStyles: stylePropTypes, -}; - -const defaultProps = { - messages: {}, - style: [], - textStyles: [], +type DotIndicatorMessageProps = { + messages: Record; + type: 'error' | 'success'; + style?: StyleProp; + textStyles?: StyleProp; }; -function DotIndicatorMessage(props) { - if (_.isEmpty(props.messages)) { +function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndicatorMessageProps) { + if (Object.keys(messages).length === 0) { return null; } - // To ensure messages are presented in order we are sort of destroying the data we are given - // and rebuilding as an array so we can render the messages in order. We don't really care about - // the microtime timestamps anyways so isn't the end of the world that we sort of lose them here. - // BEWARE: if you decide to refactor this and keep the microtime keys it could cause performance issues - const sortedMessages = _.chain(props.messages) - .keys() - .sortBy() - .map((key) => props.messages[key]) + // Fetch the keys, sort them, and map through each key to get the corresponding message + const sortedMessages: string[] = Object.keys(messages) + .sort() + .map((key) => messages[key]); - // Using uniq here since some fields are wrapped by the same OfflineWithFeedback component (e.g. WorkspaceReimburseView) - // and can potentially pass the same error. - .uniq() - .map((message) => Localize.translateIfPhraseKey(message)) - .value(); + // Removing duplicates using Set and transforming the result into an array + const uniqueMessages: string[] = [...new Set(sortedMessages)].map((message) => Localize.translateIfPhraseKey(message)); return ( - + - {_.map(sortedMessages, (message, i) => ( + {uniqueMessages.map((message, i) => ( {message} @@ -79,8 +49,6 @@ function DotIndicatorMessage(props) { ); } -DotIndicatorMessage.propTypes = propTypes; -DotIndicatorMessage.defaultProps = defaultProps; DotIndicatorMessage.displayName = 'DotIndicatorMessage'; export default DotIndicatorMessage; diff --git a/src/components/Text.tsx b/src/components/Text.tsx index 60a59aae1520..b2ac26fbb367 100644 --- a/src/components/Text.tsx +++ b/src/components/Text.tsx @@ -1,7 +1,7 @@ import React, {ForwardedRef} from 'react'; // eslint-disable-next-line no-restricted-imports -import {Text as RNText} from 'react-native'; -import type {TextStyle} from 'react-native'; +import {Text as RNText, StyleSheet} from 'react-native'; +import type {StyleProp, TextStyle} from 'react-native'; import fontFamily from '../styles/fontFamily'; import themeColors from '../styles/themes/default'; import variables from '../styles/variables'; @@ -23,29 +23,19 @@ type TextProps = { family?: keyof typeof fontFamily; /** Any additional styles to apply */ - style?: TextStyle | TextStyle[]; + style?: StyleProp; }; function Text( {color = themeColors.text, fontSize = variables.fontSizeNormal, textAlign = 'left', children = null, family = 'EXP_NEUE', style = {}, ...props}: TextProps, ref: ForwardedRef, ) { - // If the style prop is an array of styles, we need to mix them all together - const mergedStyles = !Array.isArray(style) - ? style - : style.reduce( - (finalStyles, s) => ({ - ...finalStyles, - ...s, - }), - {}, - ); const componentStyle: TextStyle = { color, fontSize, textAlign, fontFamily: fontFamily[family], - ...mergedStyles, + ...StyleSheet.flatten(style), }; if (!componentStyle.lineHeight && componentStyle.fontSize === variables.fontSizeNormal) { @@ -56,7 +46,7 @@ function Text( From 9b0f4cade249bbd8138e1480edf5bdc611275f03 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 25 Oct 2023 17:47:05 +0200 Subject: [PATCH 030/219] Eslint disable react/no-array-index-key --- src/components/DotIndicatorMessage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index 0ff5eacfe01b..94b2fef9f7be 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -38,6 +38,7 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndica {uniqueMessages.map((message, i) => ( From f59ef2d6c374b2797399dfac3e45fb5ac93af290 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Wed, 25 Oct 2023 17:47:30 +0200 Subject: [PATCH 031/219] Use message as key --- src/components/DotIndicatorMessage.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index 94b2fef9f7be..e8882d12b3c1 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -36,10 +36,9 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndica /> - {uniqueMessages.map((message, i) => ( + {uniqueMessages.map((message) => ( {message} From 2800ff7e6ea812fd3c7729aab0ce699dff963042 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 26 Oct 2023 11:10:10 +0200 Subject: [PATCH 032/219] Disable eslint error --- src/components/DotIndicatorMessage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index e8882d12b3c1..94b2fef9f7be 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -36,9 +36,10 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndica /> - {uniqueMessages.map((message) => ( + {uniqueMessages.map((message, i) => ( {message} From ad386a4a024f35253c80480518ac40788883fbe6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Thu, 26 Oct 2023 11:53:02 +0200 Subject: [PATCH 033/219] Fix tests --- tests/ui/UnreadIndicatorsTest.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/ui/UnreadIndicatorsTest.js b/tests/ui/UnreadIndicatorsTest.js index a9ffe258ac7f..183420c77ecb 100644 --- a/tests/ui/UnreadIndicatorsTest.js +++ b/tests/ui/UnreadIndicatorsTest.js @@ -221,7 +221,7 @@ describe('Unread Indicators', () => { // And that the text is bold const displayNameHintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameText = screen.queryByLabelText(displayNameHintText); - expect(lodashGet(displayNameText, ['props', 'style', 0, 'fontWeight'])).toBe(fontWeightBold); + expect(lodashGet(displayNameText, ['props', 'style', 'fontWeight'])).toBe(fontWeightBold); return navigateToSidebarOption(0); }) @@ -360,11 +360,11 @@ describe('Unread Indicators', () => { const displayNameTexts = screen.queryAllByLabelText(displayNameHintTexts); expect(displayNameTexts).toHaveLength(2); const firstReportOption = displayNameTexts[0]; - expect(lodashGet(firstReportOption, ['props', 'style', 0, 'fontWeight'])).toBe(fontWeightBold); + expect(lodashGet(firstReportOption, ['props', 'style', 'fontWeight'])).toBe(fontWeightBold); expect(lodashGet(firstReportOption, ['props', 'children'])).toBe('C User'); const secondReportOption = displayNameTexts[1]; - expect(lodashGet(secondReportOption, ['props', 'style', 0, 'fontWeight'])).toBe(fontWeightBold); + expect(lodashGet(secondReportOption, ['props', 'style', 'fontWeight'])).toBe(fontWeightBold); expect(lodashGet(secondReportOption, ['props', 'children'])).toBe('B User'); // Tap the new report option and navigate back to the sidebar again via the back button @@ -376,9 +376,9 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(2); - expect(lodashGet(displayNameTexts[0], ['props', 'style', 0, 'fontWeight'])).toBe(undefined); + expect(lodashGet(displayNameTexts[0], ['props', 'style', 'fontWeight'])).toBe(undefined); expect(lodashGet(displayNameTexts[0], ['props', 'children'])).toBe('C User'); - expect(lodashGet(displayNameTexts[1], ['props', 'style', 0, 'fontWeight'])).toBe(fontWeightBold); + expect(lodashGet(displayNameTexts[1], ['props', 'style', 'fontWeight'])).toBe(fontWeightBold); expect(lodashGet(displayNameTexts[1], ['props', 'children'])).toBe('B User'); })); @@ -412,7 +412,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(lodashGet(displayNameTexts[0], ['props', 'style', 0, 'fontWeight'])).toBe(fontWeightBold); + expect(lodashGet(displayNameTexts[0], ['props', 'style', 'fontWeight'])).toBe(fontWeightBold); expect(lodashGet(displayNameTexts[0], ['props', 'children'])).toBe('B User'); // Navigate to the report again and back to the sidebar @@ -424,7 +424,7 @@ describe('Unread Indicators', () => { const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames'); const displayNameTexts = screen.queryAllByLabelText(hintText); expect(displayNameTexts).toHaveLength(1); - expect(lodashGet(displayNameTexts[0], ['props', 'style', 0, 'fontWeight'])).toBe(undefined); + expect(lodashGet(displayNameTexts[0], ['props', 'style', 'fontWeight'])).toBe(undefined); expect(lodashGet(displayNameTexts[0], ['props', 'children'])).toBe('B User'); // Navigate to the report again and verify the new line indicator is missing From a1f3570fcbcc76ffac9c8d159b4957e1d4fa5eb6 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Fri, 27 Oct 2023 12:32:56 +0200 Subject: [PATCH 034/219] Improve Text types --- src/components/Text.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/Text.tsx b/src/components/Text.tsx index b2ac26fbb367..21b61a7680c0 100644 --- a/src/components/Text.tsx +++ b/src/components/Text.tsx @@ -1,12 +1,12 @@ import React, {ForwardedRef} from 'react'; // eslint-disable-next-line no-restricted-imports -import {Text as RNText, StyleSheet} from 'react-native'; -import type {StyleProp, TextStyle} from 'react-native'; +import {Text as RNText, TextProps as RNTextProps, StyleSheet} from 'react-native'; +import type {TextStyle} from 'react-native'; import fontFamily from '../styles/fontFamily'; import themeColors from '../styles/themes/default'; import variables from '../styles/variables'; -type TextProps = { +type TextProps = RNTextProps & { /** The color of the text */ color?: string; @@ -21,9 +21,6 @@ type TextProps = { /** The family of the font to use */ family?: keyof typeof fontFamily; - - /** Any additional styles to apply */ - style?: StyleProp; }; function Text( From 02871ac9d817b17ca21a4e8bf1cbd4f38469403f Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Fri, 27 Oct 2023 18:17:30 +0200 Subject: [PATCH 035/219] Add FormProvider to BankAccountManualStep --- .../BankAccountManualStep.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/pages/ReimbursementAccount/BankAccountManualStep.js b/src/pages/ReimbursementAccount/BankAccountManualStep.js index 9d0b0c1f5bed..dd46bd3d22c0 100644 --- a/src/pages/ReimbursementAccount/BankAccountManualStep.js +++ b/src/pages/ReimbursementAccount/BankAccountManualStep.js @@ -15,10 +15,11 @@ import {withLocalizePropTypes} from '../../components/withLocalize'; import * as ValidationUtils from '../../libs/ValidationUtils'; import ONYXKEYS from '../../ONYXKEYS'; import exampleCheckImage from './exampleCheckImage'; -import Form from '../../components/Form'; import shouldDelayFocus from '../../libs/shouldDelayFocus'; import ScreenWrapper from '../../components/ScreenWrapper'; import StepPropTypes from './StepPropTypes'; +import FormProvider from '../../components/Form/FormProvider'; +import InputWrapper from '../../components/Form/InputWrapper'; const propTypes = { ..._.omit(StepPropTypes, _.keys(withLocalizePropTypes)), @@ -84,7 +85,7 @@ function BankAccountManualStep(props) { guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} onBackButtonPress={props.onBackButtonPress} /> -
- - - - + ); } From e44331715595fa03d6f443350ba99973fb9aa65a Mon Sep 17 00:00:00 2001 From: tienifr Date: Sat, 28 Oct 2023 16:13:07 +0700 Subject: [PATCH 036/219] fix: 30465 --- src/components/TagPicker/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/TagPicker/index.js b/src/components/TagPicker/index.js index 05eca664bd0f..ea29305c16b9 100644 --- a/src/components/TagPicker/index.js +++ b/src/components/TagPicker/index.js @@ -17,7 +17,8 @@ function TagPicker({selectedTag, tag, policyTags, policyRecentlyUsedTags, onSubm const policyRecentlyUsedTagsList = lodashGet(policyRecentlyUsedTags, tag, []); const policyTagList = PolicyUtils.getTagList(policyTags, tag); - const policyTagsCount = _.size(_.filter(policyTagList, (policyTag) => policyTag.enabled)); + const enabledTags = _.filter(policyTagList, (policyTag) => policyTag.enabled); + const policyTagsCount = _.size(enabledTags); const isTagsCountBelowThreshold = policyTagsCount < CONST.TAG_LIST_THRESHOLD; const shouldShowTextInput = !isTagsCountBelowThreshold; @@ -38,14 +39,14 @@ function TagPicker({selectedTag, tag, policyTags, policyRecentlyUsedTags, onSubm const initialFocusedIndex = useMemo(() => { if (isTagsCountBelowThreshold && selectedOptions.length > 0) { - return _.chain(policyTagList) + return _.chain(enabledTags) .values() .findIndex((policyTag) => policyTag.name === selectedOptions[0].name, true) .value(); } return 0; - }, [policyTagList, selectedOptions, isTagsCountBelowThreshold]); + }, [enabledTags, selectedOptions, isTagsCountBelowThreshold]); const sections = useMemo( () => From 42e4ba3fcf441b58dff9e254121af0787da03316 Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 30 Oct 2023 12:10:04 +0100 Subject: [PATCH 037/219] import update --- src/components/DotIndicatorMessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index bfd572bc50b3..e02635f35973 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -9,9 +9,9 @@ import themeColors from '@styles/themes/default'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import Text from './Text'; -import CONST from '../CONST'; +import CONST from '@src/CONST'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; -import fileDownload from '../libs/fileDownload'; +import fileDownload from '@libs/fileDownload'; const propTypes = { /** From 8b0382b5805d11020cea62925a4cceace0521c6b Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 30 Oct 2023 12:18:51 +0100 Subject: [PATCH 038/219] reorder --- src/components/DotIndicatorMessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index e02635f35973..fa8c7bd67c97 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -3,15 +3,15 @@ import React from 'react'; import {View} from 'react-native'; import _ from 'underscore'; import * as Localize from '@libs/Localize'; +import fileDownload from '@libs/fileDownload'; import stylePropTypes from '@styles/stylePropTypes'; import styles from '@styles/styles'; import themeColors from '@styles/themes/default'; +import CONST from '@src/CONST'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; import Text from './Text'; -import CONST from '@src/CONST'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; -import fileDownload from '@libs/fileDownload'; const propTypes = { /** From f8ce4eb16ff1c6dee199ffc7c002ac62da6a12ed Mon Sep 17 00:00:00 2001 From: Alberto Date: Mon, 30 Oct 2023 12:44:12 +0100 Subject: [PATCH 039/219] prettier --- src/components/DotIndicatorMessage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index fa8c7bd67c97..31b96899ef56 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -2,16 +2,16 @@ import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import _ from 'underscore'; -import * as Localize from '@libs/Localize'; import fileDownload from '@libs/fileDownload'; +import * as Localize from '@libs/Localize'; import stylePropTypes from '@styles/stylePropTypes'; import styles from '@styles/styles'; import themeColors from '@styles/themes/default'; import CONST from '@src/CONST'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; -import Text from './Text'; import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; +import Text from './Text'; const propTypes = { /** From 241793718d6f274ea70e229b915bee5e4961946c Mon Sep 17 00:00:00 2001 From: cdOut <88325488+cdOut@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:18:37 +0100 Subject: [PATCH 040/219] fix CheckboxWithLabel forwardedRef typing --- src/components/CheckboxWithLabel.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/CheckboxWithLabel.js b/src/components/CheckboxWithLabel.js index 4bffadecb733..f18ec346dfa2 100644 --- a/src/components/CheckboxWithLabel.js +++ b/src/components/CheckboxWithLabel.js @@ -7,6 +7,7 @@ import variables from '@styles/variables'; import Checkbox from './Checkbox'; import FormHelpMessage from './FormHelpMessage'; import PressableWithFeedback from './Pressable/PressableWithFeedback'; +import refPropTypes from './refPropTypes'; import Text from './Text'; /** @@ -54,7 +55,7 @@ const propTypes = { defaultValue: PropTypes.bool, /** React ref being forwarded to the Checkbox input */ - forwardedRef: PropTypes.func, + forwardedRef: refPropTypes, /** The ID used to uniquely identify the input in a Form */ /* eslint-disable-next-line react/no-unused-prop-types */ From 4497e35456d7b41197db1d1adf4914b519e41a52 Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Tue, 31 Oct 2023 12:04:30 +0100 Subject: [PATCH 041/219] Fix passing styles --- src/components/DotIndicatorMessage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DotIndicatorMessage.tsx b/src/components/DotIndicatorMessage.tsx index 0bba72ec219b..7828c2f5feb4 100644 --- a/src/components/DotIndicatorMessage.tsx +++ b/src/components/DotIndicatorMessage.tsx @@ -56,7 +56,7 @@ function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndica {message} From b1b83496b5473ef4a813da9c0a4f00155755d30b Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Wed, 1 Nov 2023 17:06:51 +0000 Subject: [PATCH 042/219] Fix merge conflict --- src/components/AddPaymentMethodMenu.js | 2 +- src/libs/actions/Policy.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index a0b839e736de..813e27e3b821 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -84,7 +84,7 @@ function AddPaymentMethodMenu(props) { props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT); }, }, - ...(ReportUtils.isIOUReport(this.props.iouReport) && ReportActionsUtils.hasRequestFromPayer(lodashGet(this.props.iouReport, 'reportID', 0), this.props.session.accountID) + ...(ReportUtils.isIOUReport(props.iouReport) && ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) ? [ { text: props.translate('common.businessBankAccount'), diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 0187af2c76a8..06b8970794d2 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1598,7 +1598,7 @@ function startCollectBottomUpFlow(iouReport, firstName, lastName) { ]; API.write( - 'BottomUpCollectFlow', + 'CreateWorkspaceFromIOUPayment', { policyID, announceChatReportID, From c814adedbb12d5d2d5be64d8d8ec4b0aa412ce45 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Thu, 2 Nov 2023 16:32:42 +0000 Subject: [PATCH 043/219] Fix issues in the flow --- src/components/AddPaymentMethodMenu.js | 4 +-- src/components/KYCWall/BaseKYCWall.js | 1 + src/components/MoneyReportHeader.js | 2 -- .../MoneyRequestConfirmationList.js | 1 - .../ReportActionItem/ReportPreview.js | 1 - src/components/SettlementButton.js | 32 ++----------------- 6 files changed, 5 insertions(+), 36 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 813e27e3b821..186cab115a39 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -84,11 +84,11 @@ function AddPaymentMethodMenu(props) { props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT); }, }, - ...(ReportUtils.isIOUReport(props.iouReport) && ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) + ...(ReportUtils.isIOUReport(props.iouReport) && !ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) ? [ { text: props.translate('common.businessBankAccount'), - icon: Expensicons.Workspace, + icon: Expensicons.Building, onSelected: () => props.onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT), }, ] diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 6093aae43d35..034f62466979 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -10,6 +10,7 @@ import Navigation from '@libs/Navigation/Navigation'; import * as PaymentUtils from '@libs/PaymentUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as PaymentMethods from '@userActions/PaymentMethods'; +import * as Policy from '@userActions/Policy'; import * as Wallet from '@userActions/Wallet'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; diff --git a/src/components/MoneyReportHeader.js b/src/components/MoneyReportHeader.js index a8fb5390ebb6..b3f0c52d5cdc 100644 --- a/src/components/MoneyReportHeader.js +++ b/src/components/MoneyReportHeader.js @@ -118,7 +118,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt onPress={(paymentType) => IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)} enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} addBankAccountRoute={bankAccountRoute} - shouldShowPaymentOptions style={[styles.pv2]} formattedAmount={formattedAmount} /> @@ -163,7 +162,6 @@ function MoneyReportHeader({session, personalDetails, policy, chatReport, nextSt onPress={(paymentType) => IOU.payMoneyRequest(paymentType, chatReport, moneyRequestReport)} enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} addBankAccountRoute={bankAccountRoute} - shouldShowPaymentOptions formattedAmount={formattedAmount} />
diff --git a/src/components/MoneyRequestConfirmationList.js b/src/components/MoneyRequestConfirmationList.js index da1e03bd28e8..a8b4f95cae69 100755 --- a/src/components/MoneyRequestConfirmationList.js +++ b/src/components/MoneyRequestConfirmationList.js @@ -512,7 +512,6 @@ function MoneyRequestConfirmationList(props) { addDebitCardRoute={ROUTES.IOU_SEND_ADD_DEBIT_CARD} currency={props.iouCurrencyCode} policyID={props.policyID} - shouldShowPaymentOptions buttonSize={CONST.DROPDOWN_BUTTON_SIZE.LARGE} kycWallAnchorAlignment={{ horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, diff --git a/src/components/ReportActionItem/ReportPreview.js b/src/components/ReportActionItem/ReportPreview.js index 00a4526b382f..b90b509fdefb 100644 --- a/src/components/ReportActionItem/ReportPreview.js +++ b/src/components/ReportActionItem/ReportPreview.js @@ -245,7 +245,6 @@ function ReportPreview(props) { onPress={(paymentType) => IOU.payMoneyRequest(paymentType, props.chatReport, props.iouReport)} enablePaymentsRoute={ROUTES.ENABLE_PAYMENTS} addBankAccountRoute={bankAccountRoute} - shouldShowPaymentOptions style={[styles.mt3]} kycWallAnchorAlignment={{ horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, diff --git a/src/components/SettlementButton.js b/src/components/SettlementButton.js index d2030eac8d7d..53b85b5e0f05 100644 --- a/src/components/SettlementButton.js +++ b/src/components/SettlementButton.js @@ -40,9 +40,6 @@ const propTypes = { /** The route to redirect if user does not have a payment method setup */ enablePaymentsRoute: PropTypes.string.isRequired, - /** Should we show the payment options? */ - shouldShowPaymentOptions: PropTypes.bool, - /** The last payment method used per policy */ nvp_lastPaymentMethod: PropTypes.objectOf(PropTypes.string), @@ -97,7 +94,6 @@ const defaultProps = { betas: CONST.EMPTY_ARRAY, iouReport: CONST.EMPTY_OBJECT, nvp_lastPaymentMethod: CONST.EMPTY_OBJECT, - shouldShowPaymentOptions: false, style: [], policyID: '', formattedAmount: '', @@ -130,7 +126,6 @@ function SettlementButton({ onPress, pressOnEnter, policyID, - shouldShowPaymentOptions, style, }) { const {translate} = useLocalize(); @@ -165,33 +160,10 @@ function SettlementButton({ // To achieve the one tap pay experience we need to choose the correct payment type as default, // if user already paid for some request or expense, let's use the last payment method or use default. let paymentMethod = nvp_lastPaymentMethod[policyID] || ''; - if (!shouldShowPaymentOptions) { - if (!paymentMethod) { - // In case the user hasn't paid a request yet, let's default to VBBA payment type in case of expense reports - if (isExpenseReport) { - paymentMethod = CONST.IOU.PAYMENT_TYPE.VBBA; - } else if (canUseWallet) { - // If they have Wallet set up, use that payment method as default - paymentMethod = CONST.IOU.PAYMENT_TYPE.EXPENSIFY; - } else { - paymentMethod = CONST.IOU.PAYMENT_TYPE.ELSEWHERE; - } - } - - // In case of the settlement button in the report preview component, we do not show payment options and the label for Wallet and ACH type is simply "Pay". - return [ - { - ...paymentMethods[paymentMethod], - text: paymentMethod === CONST.IOU.PAYMENT_TYPE.ELSEWHERE ? translate('iou.payElsewhere') : translate('iou.pay'), - }, - ]; - } if (canUseWallet) { buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.EXPENSIFY]); } - if (isExpenseReport) { - buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.VBBA]); - } + buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.VBBA]); buttonOptions.push(paymentMethods[CONST.IOU.PAYMENT_TYPE.ELSEWHERE]); // Put the preferred payment method to the front of the array so its shown as default @@ -199,7 +171,7 @@ function SettlementButton({ return _.sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1)); } return buttonOptions; - }, [betas, currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, shouldShowPaymentOptions, translate]); + }, [betas, currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, translate]); const selectPaymentType = (event, iouPaymentType, triggerKYCFlow) => { if (iouPaymentType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY || iouPaymentType === CONST.IOU.PAYMENT_TYPE.VBBA) { From cfe141bd6af6755d84cb1fc677bb7346372e9a48 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Thu, 2 Nov 2023 16:33:19 +0000 Subject: [PATCH 044/219] Update the personal bank account const name --- src/CONST.ts | 2 +- src/components/AddPaymentMethodMenu.js | 2 +- src/components/KYCWall/BaseKYCWall.js | 4 ++-- src/libs/PaymentUtils.ts | 2 +- src/libs/actions/PaymentMethods.ts | 10 +++++----- .../Wallet/ChooseTransferAccountPage.js | 4 ++-- src/pages/settings/Wallet/PaymentMethodList.js | 6 +++--- .../settings/Wallet/TransferBalancePage.js | 6 +++--- .../settings/Wallet/WalletPage/WalletPage.js | 18 +++++++++--------- .../settings/Wallet/walletTransferPropTypes.js | 2 +- src/types/onyx/BankAccount.ts | 2 +- src/types/onyx/WalletTransfer.ts | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index e270f0066139..cb12a2a5f746 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -1111,7 +1111,7 @@ const CONST = { PAYMENT_METHODS: { DEBIT_CARD: 'debitCard', - BANK_ACCOUNT: 'bankAccount', + PERSONAL_BANK_ACCOUNT: 'bankAccount', BUSINESS_BANK_ACCOUNT: 'businessBankAccount', }, diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 186cab115a39..f6ed7e8254a0 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -81,7 +81,7 @@ function AddPaymentMethodMenu(props) { text: props.translate('common.personalBankAccount'), icon: Expensicons.Bank, onSelected: () => { - props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT); + props.onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); }, }, ...(ReportUtils.isIOUReport(props.iouReport) && !ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 034f62466979..92df53353cf6 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -94,7 +94,7 @@ class KYCWall extends React.Component { */ selectPaymentMethod(paymentMethod) { this.props.onSelectPaymentMethod(paymentMethod); - if (paymentMethod === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (paymentMethod === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { Navigation.navigate(this.props.addBankAccountRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.DEBIT_CARD) { Navigation.navigate(this.props.addDebitCardRoute); @@ -138,7 +138,7 @@ class KYCWall extends React.Component { ) { Log.info('[KYC Wallet] User does not have valid payment method'); if (!this.props.shouldIncludeDebitCard) { - this.selectPaymentMethod(CONST.PAYMENT_METHODS.BANK_ACCOUNT); + this.selectPaymentMethod(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); return; } const clickedElementLocation = getClickedTargetLocation(targetElement); diff --git a/src/libs/PaymentUtils.ts b/src/libs/PaymentUtils.ts index b37db2584394..5bd70fee4d83 100644 --- a/src/libs/PaymentUtils.ts +++ b/src/libs/PaymentUtils.ts @@ -26,7 +26,7 @@ function hasExpensifyPaymentMethod(fundList: Record, bankAccountLi function getPaymentMethodDescription(accountType: AccountType, account: BankAccount['accountData'] | Fund['accountData']): string { if (account) { - if (accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT && 'accountNumber' in account) { + if (accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && 'accountNumber' in account) { return `${Localize.translateLocal('paymentMethodList.accountLastFour')} ${account.accountNumber?.slice(-4)}`; } if (accountType === CONST.PAYMENT_METHODS.DEBIT_CARD && 'cardNumber' in account) { diff --git a/src/libs/actions/PaymentMethods.ts b/src/libs/actions/PaymentMethods.ts index bcc5d8142470..bc2ce95c8a43 100644 --- a/src/libs/actions/PaymentMethods.ts +++ b/src/libs/actions/PaymentMethods.ts @@ -81,7 +81,7 @@ function getMakeDefaultPaymentOnyxData( key: ONYXKEYS.USER_WALLET, value: { walletLinkedAccountID: bankAccountID || fundID, - walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, + walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, // Only clear the error if this is optimistic data. If this is failure data, we do not want to clear the error that came from the server. errors: null, }, @@ -91,7 +91,7 @@ function getMakeDefaultPaymentOnyxData( key: ONYXKEYS.USER_WALLET, value: { walletLinkedAccountID: bankAccountID || fundID, - walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, + walletLinkedAccountType: bankAccountID ? CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT : CONST.PAYMENT_METHODS.DEBIT_CARD, }, }, ]; @@ -99,7 +99,7 @@ function getMakeDefaultPaymentOnyxData( if (previousPaymentMethod?.methodID) { onyxData.push({ onyxMethod: Onyx.METHOD.MERGE, - key: previousPaymentMethod.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.FUND_LIST, + key: previousPaymentMethod.accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.FUND_LIST, value: { [previousPaymentMethod.methodID]: { isDefault: !isOptimisticData, @@ -111,7 +111,7 @@ function getMakeDefaultPaymentOnyxData( if (currentPaymentMethod?.methodID) { onyxData.push({ onyxMethod: Onyx.METHOD.MERGE, - key: currentPaymentMethod.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.FUND_LIST, + key: currentPaymentMethod.accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT ? ONYXKEYS.BANK_ACCOUNT_LIST : ONYXKEYS.FUND_LIST, value: { [currentPaymentMethod.methodID]: { isDefault: isOptimisticData, @@ -223,7 +223,7 @@ function clearDebitCardFormErrorAndSubmit() { * */ function transferWalletBalance(paymentMethod: PaymentMethod) { - const paymentMethodIDKey = paymentMethod.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? CONST.PAYMENT_METHOD_ID_KEYS.BANK_ACCOUNT : CONST.PAYMENT_METHOD_ID_KEYS.DEBIT_CARD; + const paymentMethodIDKey = paymentMethod.accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT ? CONST.PAYMENT_METHOD_ID_KEYS.BANK_ACCOUNT : CONST.PAYMENT_METHOD_ID_KEYS.DEBIT_CARD; type TransferWalletBalanceParameters = Partial, number | undefined>>; diff --git a/src/pages/settings/Wallet/ChooseTransferAccountPage.js b/src/pages/settings/Wallet/ChooseTransferAccountPage.js index a44e21390b80..9fe95f477ac9 100644 --- a/src/pages/settings/Wallet/ChooseTransferAccountPage.js +++ b/src/pages/settings/Wallet/ChooseTransferAccountPage.js @@ -36,7 +36,7 @@ function ChooseTransferAccountPage(props) { * @param {Object} account of the selected account data */ const selectAccountAndNavigateBack = (event, accountType, account) => { - PaymentMethods.saveWalletTransferAccountTypeAndID(accountType, accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT ? account.bankAccountID : account.fundID); + PaymentMethods.saveWalletTransferAccountTypeAndID(accountType, accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT ? account.bankAccountID : account.fundID); Navigation.goBack(ROUTES.SETTINGS_WALLET_TRANSFER_BALANCE); }; @@ -69,7 +69,7 @@ function ChooseTransferAccountPage(props) { method.accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT || method.accountType === CONST.PAYMENT_METHODS.DEBIT_CARD, + (method) => method.accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT || method.accountType === CONST.PAYMENT_METHODS.DEBIT_CARD, ).length; return defaultablePaymentMethodCount > 1; } diff --git a/src/pages/settings/Wallet/TransferBalancePage.js b/src/pages/settings/Wallet/TransferBalancePage.js index 1df07365a1f6..fbcb7a9dc1df 100644 --- a/src/pages/settings/Wallet/TransferBalancePage.js +++ b/src/pages/settings/Wallet/TransferBalancePage.js @@ -84,7 +84,7 @@ function TransferBalancePage(props) { title: props.translate('transferAmountPage.ach'), description: props.translate('transferAmountPage.achSummary'), icon: Expensicons.Bank, - type: CONST.PAYMENT_METHODS.BANK_ACCOUNT, + type: CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT, }, ]; @@ -145,7 +145,7 @@ function TransferBalancePage(props) { { - if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { return paymentMethod.selectedPaymentMethod.bankAccountID; } if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) { @@ -150,12 +150,12 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen // The delete/default menu if (accountType) { let formattedSelectedPaymentMethod; - if (accountType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (accountType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { formattedSelectedPaymentMethod = { title: account.addressName, icon: account.icon, description: PaymentUtils.getPaymentMethodDescription(accountType, account), - type: CONST.PAYMENT_METHODS.BANK_ACCOUNT, + type: CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT, }; } else if (accountType === CONST.PAYMENT_METHODS.DEBIT_CARD) { formattedSelectedPaymentMethod = { @@ -200,7 +200,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen return; } - if (paymentType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (paymentType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { BankAccounts.openPersonalBankAccountSetupView(); return; } @@ -226,7 +226,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen const previousPaymentMethod = _.find(paymentMethods, (method) => method.isDefault); const currentPaymentMethod = _.find(paymentMethods, (method) => method.methodID === paymentMethod.methodID); - if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { PaymentMethods.makeDefaultPaymentMethod(paymentMethod.selectedPaymentMethod.bankAccountID, null, previousPaymentMethod, currentPaymentMethod); } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) { PaymentMethods.makeDefaultPaymentMethod(null, paymentMethod.selectedPaymentMethod.fundID, previousPaymentMethod, currentPaymentMethod); @@ -241,7 +241,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen ]); const deletePaymentMethod = useCallback(() => { - if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { BankAccounts.deletePaymentBankAccount(paymentMethod.selectedPaymentMethod.bankAccountID); } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD) { PaymentMethods.deletePaymentCard(paymentMethod.selectedPaymentMethod.fundID); @@ -292,7 +292,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen // We should reset selected payment method state values and close corresponding modals if the selected payment method is deleted let shouldResetPaymentMethodData = false; - if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.BANK_ACCOUNT && _.isEmpty(bankAccountList[paymentMethod.methodID])) { + if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && _.isEmpty(bankAccountList[paymentMethod.methodID])) { shouldResetPaymentMethodData = true; } else if (paymentMethod.selectedPaymentMethodType === CONST.PAYMENT_METHODS.DEBIT_CARD && _.isEmpty(fundList[paymentMethod.methodID])) { shouldResetPaymentMethodData = true; @@ -308,7 +308,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen const shouldShowMakeDefaultButton = !paymentMethod.isSelectedPaymentMethodDefault && Permissions.canUseWallet(betas) && - !(paymentMethod.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.BANK_ACCOUNT && paymentMethod.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS); + !(paymentMethod.formattedSelectedPaymentMethod.type === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT && paymentMethod.selectedPaymentMethod.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS); // 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 || isSmallScreenWidth; @@ -362,7 +362,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen navigateToWalletOrTransferBalancePage(source)} onSelectPaymentMethod={(selectedPaymentMethod) => { - if (hasActivatedWallet || selectedPaymentMethod !== CONST.PAYMENT_METHODS.BANK_ACCOUNT) { + if (hasActivatedWallet || selectedPaymentMethod !== CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { return; } // To allow upgrading to a gold wallet, continue with the KYC flow after adding a bank account diff --git a/src/pages/settings/Wallet/walletTransferPropTypes.js b/src/pages/settings/Wallet/walletTransferPropTypes.js index 38c65fcfd703..9e25213382e9 100644 --- a/src/pages/settings/Wallet/walletTransferPropTypes.js +++ b/src/pages/settings/Wallet/walletTransferPropTypes.js @@ -7,7 +7,7 @@ const walletTransferPropTypes = PropTypes.shape({ selectedAccountID: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), /** Type to filter the payment Method list */ - filterPaymentMethodType: PropTypes.oneOf([CONST.PAYMENT_METHODS.DEBIT_CARD, CONST.PAYMENT_METHODS.BANK_ACCOUNT, '']), + filterPaymentMethodType: PropTypes.oneOf([CONST.PAYMENT_METHODS.DEBIT_CARD, CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT, '']), /** Whether the success screen is shown to user. */ shouldShowSuccess: PropTypes.bool, diff --git a/src/types/onyx/BankAccount.ts b/src/types/onyx/BankAccount.ts index 4a7b6dac7387..2b2bee7df6b0 100644 --- a/src/types/onyx/BankAccount.ts +++ b/src/types/onyx/BankAccount.ts @@ -4,7 +4,7 @@ import * as OnyxCommon from './OnyxCommon'; type BankAccount = { /** The bank account type */ - accountType?: typeof CONST.PAYMENT_METHODS.BANK_ACCOUNT; + accountType?: typeof CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT; /** string like 'Account ending in XXXX' */ description?: string; diff --git a/src/types/onyx/WalletTransfer.ts b/src/types/onyx/WalletTransfer.ts index e1b1468d6536..cebea543884b 100644 --- a/src/types/onyx/WalletTransfer.ts +++ b/src/types/onyx/WalletTransfer.ts @@ -25,7 +25,7 @@ type WalletTransfer = { paymentMethodType?: ValueOf>; }; -type FilterMethodPaymentType = typeof CONST.PAYMENT_METHODS.DEBIT_CARD | typeof CONST.PAYMENT_METHODS.BANK_ACCOUNT | null; +type FilterMethodPaymentType = typeof CONST.PAYMENT_METHODS.DEBIT_CARD | typeof CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT | null; export default WalletTransfer; From ae33908060085d29e0ae3572b6bce00fbfa54b61 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Thu, 2 Nov 2023 23:31:23 +0000 Subject: [PATCH 045/219] Flow clean up --- src/CONST.ts | 1 + src/components/KYCWall/BaseKYCWall.js | 2 +- src/libs/ReportUtils.js | 45 +++++++++++++++++++++++ src/libs/actions/Policy.js | 41 ++++++++++++++------- src/pages/home/report/ReportActionItem.js | 2 +- 5 files changed, 75 insertions(+), 16 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index cb12a2a5f746..08a4252238d6 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -503,6 +503,7 @@ const CONST = { CREATED: 'CREATED', IOU: 'IOU', MODIFIEDEXPENSE: 'MODIFIEDEXPENSE', + MOVED: 'MOVED', REIMBURSEMENTQUEUED: 'REIMBURSEMENTQUEUED', RENAMED: 'RENAMED', REPORTPREVIEW: 'REPORTPREVIEW', diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 92df53353cf6..46479d554bdf 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -99,7 +99,7 @@ class KYCWall extends React.Component { } else if (paymentMethod === CONST.PAYMENT_METHODS.DEBIT_CARD) { Navigation.navigate(this.props.addDebitCardRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { - Policy.startCollectFlow(this.props.iouReport); + Policy.createWorkspaceFromIOUPayment(this.props.iouReport); } } diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 10630d7fb122..d3b16a73f16f 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2612,6 +2612,7 @@ function buildOptimisticIOUReportAction( whisperedToAccountIDs: _.contains([CONST.IOU.RECEIPT_STATE.SCANREADY, CONST.IOU.RECEIPT_STATE.SCANNING], receipt.state) ? [currentUserAccountID] : [], }; } + /** * Builds an optimistic APPROVED report action with a randomly generated reportActionID. * @@ -2650,6 +2651,49 @@ function buildOptimisticApprovedReportAction(amount, currency, expenseReportID) }; } +/** + * Builds an optimistic MOVED report action with a randomly generated reportActionID. + * This action is used when we move reports across workspaces. + * + * @param {String} fromPolicyID + * @param {String} toPolicyID + * @param {Number} newParentReportID + * @param {Number} movedReportID An ID of the report we are moveing across workspaces + * + * @returns {Object} + */ +function buildOptimisticMovedReportAction(fromPolicyID, toPolicyID, newParentReportID, movedReportID) { + const originalMessage = { + fromPolicyID, + toPolicyID, + newParentReportID, + movedReportID, + }; + + const policyName = getPolicyName(allReports[`${ONYXKEYS.COLLECTION.REPORT}${newParentReportID}`]); + + return { + actionName: CONST.REPORT.ACTIONS.TYPE.MOVED, + actorAccountID: currentUserAccountID, + automatic: false, + avatar: lodashGet(currentUserPersonalDetails, 'avatar', UserUtils.getDefaultAvatarURL(currentUserAccountID)), + isAttachment: false, + originalMessage, + message: "moved report", + person: [ + { + style: 'strong', + text: lodashGet(currentUserPersonalDetails, 'displayName', currentUserEmail), + type: 'TEXT', + }, + ], + reportActionID: NumberUtils.rand64(), + shouldShow: true, + created: DateUtils.getDBTime(), + pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, + }; +} + /** * Builds an optimistic SUBMITTED report action with a randomly generated reportActionID. * @@ -4216,6 +4260,7 @@ export { buildOptimisticEditedTaskReportAction, buildOptimisticIOUReport, buildOptimisticApprovedReportAction, + buildOptimisticMovedReportAction, buildOptimisticSubmittedReportAction, buildOptimisticExpenseReport, buildOptimisticIOUReportAction, diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index 941fa814a9b4..a022d8f61f18 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1360,7 +1360,7 @@ function buildOptimisticPolicyRecentlyUsedCategories(policyID, category) { return lodashUnion([category], policyRecentlyUsedCategories); } -function startCollectBottomUpFlow(iouReport, firstName, lastName) { +function createWorkspaceFromIOUPayment(iouReport) { // This flow only works for IOU reports if (!ReportUtils.isIOUReport(iouReport)) { return; @@ -1544,6 +1544,7 @@ function startCollectBottomUpFlow(iouReport, firstName, lastName) { }, ...employeeWorkspaceChat.onyxSuccessData, ]; + const failureData = [ { onyxMethod: Onyx.METHOD.SET, @@ -1585,17 +1586,29 @@ function startCollectBottomUpFlow(iouReport, firstName, lastName) { // Next we need to convert the IOU report to Expense report and clean up the DM chat // Get the 1on1 chat where the request was originally made const chatReportID = iouReport.chatReportID; - ReportUtils.getReport(iouReport.chatReportID); + optimisticData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, + value: { + ...iouReport, + type: CONST.REPORT.TYPE.EXPENSE + }, + }); + failureData.push({ + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, + value: iouReport, + }); + + const chatReport = ReportUtils.getReport(iouReport.chatReportID); const reportPreviewID = iouReport.parentReportActionID; - const membersData = [ - { - accountID: employeeAccountID, - email: employeeEmail, - workspaceChatReportID: employeeWorkspaceChat.reportCreationData[employeeEmail].reportID, - workspaceChatCreatedReportActionID: employeeWorkspaceChat.reportCreationData[employeeEmail].reportActionID, - }, - ]; + const memberData = { + accountID: Number(employeeAccountID), + email: employeeEmail, + workspaceChatReportID: Number(employeeWorkspaceChat.reportCreationData[employeeEmail].reportID), + workspaceChatCreatedReportActionID: Number(employeeWorkspaceChat.reportCreationData[employeeEmail].reportActionID), + }; API.write( 'CreateWorkspaceFromIOUPayment', @@ -1604,7 +1617,7 @@ function startCollectBottomUpFlow(iouReport, firstName, lastName) { announceChatReportID, adminsChatReportID, expenseChatReportID: workspaceChatReportID, - ownerEmail: sessionEmail, + ownerEmail: '', makeMeAdmin: false, policyName: workspaceName, type: CONST.POLICY.TYPE.TEAM, @@ -1614,11 +1627,11 @@ function startCollectBottomUpFlow(iouReport, firstName, lastName) { customUnitID, customUnitRateID, iouReportID: iouReport.reportID, - membersData: JSON.stringify(membersData), + memberData: JSON.stringify(memberData), + reportActionID: 0, }, {optimisticData, successData, failureData}, ); - // Navigation.dismissModal(CONST.TEACHERS_UNITE.PUBLIC_ROOM_ID); } export { @@ -1647,11 +1660,11 @@ export { openWorkspaceMembersPage, openWorkspaceInvitePage, removeWorkspace, + createWorkspaceFromIOUPayment, setWorkspaceInviteMembersDraft, clearErrors, dismissAddedWithPrimaryLoginMessages, openDraftWorkspaceRequest, buildOptimisticPolicyRecentlyUsedCategories, createDraftInitialWorkspace, - startCollectBottomUpFlow, }; diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index a7a3bc0739f3..eb0ae4f8978a 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -422,7 +422,7 @@ function ReportActionItem(props) { isHidden={isHidden} style={[ _.contains( - [..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.APPROVED], + [..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.APPROVED, CONST.REPORT.ACTIONS.TYPE.MOVED], props.action.actionName, ) ? styles.colorMuted From 3dc351255b70f5cce05e4a44000e6c79dd9767bc Mon Sep 17 00:00:00 2001 From: Alberto Date: Fri, 3 Nov 2023 13:04:03 +0100 Subject: [PATCH 046/219] docs --- src/components/DotIndicatorMessage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.js index 6610db1b4a61..3297f70fafc6 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.js @@ -45,6 +45,7 @@ const defaultProps = { * Check if the error includes a receipt. * * @param {String} message + * @returns {Boolean} */ const isReceiptError = (message) => { if (_.isString(message)) { From 93d176c82676d091313aea251db3ab48a94fac56 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Fri, 3 Nov 2023 14:26:39 +0000 Subject: [PATCH 047/219] Offer correct payment options --- src/components/AddPaymentMethodMenu.js | 18 +++++++++++------- src/components/KYCWall/BaseKYCWall.js | 6 +++++- src/pages/home/report/ReportActionItem.js | 17 +++++++++-------- .../home/report/ReportActionItemFragment.js | 2 +- .../home/report/ReportActionItemMessage.js | 1 - 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index f6ed7e8254a0..85419387cc6e 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -77,14 +77,18 @@ function AddPaymentMethodMenu(props) { anchorRef={props.anchorRef} onItemSelected={props.onClose} menuItems={[ - { - text: props.translate('common.personalBankAccount'), - icon: Expensicons.Bank, - onSelected: () => { - props.onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + ...(ReportUtils.isIOUReport(props.iouReport) + ?[ + { + text: props.translate('common.personalBankAccount'), + icon: Expensicons.Bank, + onSelected: () => { + props.onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT); + }, }, - }, - ...(ReportUtils.isIOUReport(props.iouReport) && !ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) + ] + : []), + ...(!ReportActionsUtils.hasRequestFromPayer(lodashGet(props.iouReport, 'reportID', 0), props.session.accountID) ? [ { text: props.translate('common.businessBankAccount'), diff --git a/src/components/KYCWall/BaseKYCWall.js b/src/components/KYCWall/BaseKYCWall.js index 46479d554bdf..add5d4ba042b 100644 --- a/src/components/KYCWall/BaseKYCWall.js +++ b/src/components/KYCWall/BaseKYCWall.js @@ -99,7 +99,11 @@ class KYCWall extends React.Component { } else if (paymentMethod === CONST.PAYMENT_METHODS.DEBIT_CARD) { Navigation.navigate(this.props.addDebitCardRoute); } else if (paymentMethod === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { - Policy.createWorkspaceFromIOUPayment(this.props.iouReport); + if (ReportUtils.isIOUReport(this.props.iouReport)) { + Policy.createWorkspaceFromIOUPayment(this.props.iouReport); + return; + } + Navigation.navigate(this.props.addBankAccountRoute); } } diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 39d3f04b3961..ace51be25ea3 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -425,14 +425,15 @@ function ReportActionItem(props) { action={props.action} displayAsGroup={props.displayAsGroup} isHidden={isHidden} - style={[ - _.contains( - [..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.APPROVED, CONST.REPORT.ACTIONS.TYPE.MOVED], - props.action.actionName, - ) - ? styles.colorMuted - : undefined, - ]} + // style={[ + // _.contains( + // [..._.values(CONST.REPORT.ACTIONS.TYPE.POLICYCHANGELOG), CONST.REPORT.ACTIONS.TYPE.IOU, CONST.REPORT.ACTIONS.TYPE.APPROVED, CONST.REPORT.ACTIONS.TYPE.MOVED], + // props.action.actionName, + // ) + // ? styles.colorMuted + // : undefined, + // ]} + style={[styles.colorMuted]} /> {hasBeenFlagged && (