diff --git a/android/app/build.gradle b/android/app/build.gradle index 7e0f7671f561..dfea4f5dace6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -96,8 +96,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001040203 - versionName "1.4.2-3" + versionCode 1001040302 + versionName "1.4.3-2" } flavorDimensions "default" diff --git a/docs/articles/expensify-classic/manage-employees-and-report-approvals/Approving-Reports.md b/docs/articles/expensify-classic/manage-employees-and-report-approvals/Approving-Reports.md index 3ee1c8656b4b..32ce41d3cbf3 100644 --- a/docs/articles/expensify-classic/manage-employees-and-report-approvals/Approving-Reports.md +++ b/docs/articles/expensify-classic/manage-employees-and-report-approvals/Approving-Reports.md @@ -1,5 +1,189 @@ --- -title: Coming Soon -description: Coming Soon +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. --- -## Resource Coming Soon! +# About +This article provides a comprehensive guide on report management within our platform. From viewing, editing, and submitting your employees' Open reports to handling rejections and unapproving, as well as harnessing the power of our "Guided Review" feature. Additionally, we'll delve into best practices for Concierge, offering insights on how to streamline and automate your report approval processes for maximum efficiency. +Let's dive in! + + +# How-to manage reports +This section covers the most essential information a user needs to operate a feature i.e. what to click on. We’ll go over any action the user might take when configuring or using the feature, starting from configuration and moving to usage. + + +What options does a user have when configuring this feature? + + +What options does a user have then interacting with this feature? + + +What elements of this feature are pay-walled vs. free? + + +As a Workspace admin, you have the ability to view, edit, and submit your employees' Open reports. + + +We recommend beginning this process from the web version of Expensify because it offers more functionality compared to the mobile app. Here's how to get started: +Click on the "Reports" tab. +Select the "All Submitters" and "Open" filters. +This will display all employee reports on your Workspaces that have not yet been submitted. +​ +## Viewing Employee Reports +Viewing employee reports can vary depending on whether you're using the web or mobile versions of Expensify. We generally recommend using the web version for this purpose, as it offers the following advantages: + + +You will only receive reports directly submitted to you when using the mobile app. + + +The option to filter reports via the Reports page is exclusively available in the web version, making it more convenient when reviewing multiple reports during a session. +​ +## Viewing employee reports on the mobile app +When using the mobile app to view reports, please note the following: + + +Tapping on the Reports list will only display your own reports; you won't see reports from other Workspace members. + + +To view another Workspace member's report in the Expensify app, it must be submitted directly to you, and you must access it through a link from an email or via Home. + + +When you access a report in this manner, you will have the option to approve/reject it or go through the review process if there are expenses that require your attention. + + +Once you've approved or rejected the report, it won't be accessible in the app anymore. To view it again, please visit the website and follow the steps mentioned above. +​ +## Editing employee reports +If a report has been submitted directly to you, follow these steps to edit the expense details. Please note that you cannot change the expense amount; to make changes affecting the report total, you must reject it and return it to the employee. + + +Here's what to do: +- Click on any expense within the report to edit the expense details. +- Remember that you cannot modify the expense amount directly. To make changes affecting the report total, reject the report, and it will be sent back to the employee for revisions. +- If you're a Workspace admin and need to edit a report that wasn't submitted directly to you, use the "Take Control" button at the top of the report. Keep in mind that taking control of a report will disrupt the approval workflow. +​ +Additionally, here are some other editing options for Admins: +- Undelete deleted company card expenses via the Reconciliation Dashboard (requires Domain Admin privileges). +- Add unreported company card expenses to an existing Open (unsubmitted) report or create a new report via the Reconciliation Dashboard (requires Domain Admin privileges). +- Add or modify expense coding, including Category, Tag(s), and Attendees. +- Attach a receipt to an expense that doesn't have one. +- Move card expenses between two Open (unsubmitted) reports. +- Merge duplicate expenses (only applicable if they are not card transactions). +- Change the Workspace associated with a report.​ + + +## Submitting Employee Reports +As a Workspace Admin, you have the option to submit any of your employee's Open reports. If an employee is unable to do it themselves, a Workspace admin can submit an expense report on their behalf to initiate the approval process. Follow these steps: +Click the "Submit" button located at the top of the report. + + +## Report History and Comments +Please keep in mind that any changes made by the admin are tracked under "Report History and Comments." If you change the reimbursable status of an expense (e.g., from Reimbursable to Non-Reimbursable), an email notification will be sent to the employee to notify them of this change. + + +## Rejecting or Unapproving a Report +If you need to reject a report that has been submitted to you or Unapprove a report that has already been approved. + + +To reject the report, click Reject rather than beginning the Review process. If there are multiple approvers involved, you can choose how far back to reject the report. + + +Rejecting a report will return the report back to the submitter in an Open status or, in the case of a multi-level approval workflow, back to the previous approver in a Processing status (awaiting their approval). You may need to do this if the submitter is not ready to submit the report, or perhaps the report as a whole needs to be rejected based on the configuration of your organization's expense Workspace. + + +## Unapprove a Report +You can click the red Unapprove button at the top of the report to undo approving a report. Keep in mind that you'll only see the Unapprove button if you're a report approver on an admin that has taken control of the report.​ + + +## Marking a Report as Reimbursed Outside of Expensify +If you are reimbursing reports via paper check, through payroll or any other method that takes place outside of Expensify, you'll want to keep track of which reports have been taken care of by marking reports as reimbursed. + + +1. Log into your Expensify account using your preferred web browser, (ie: Chrome or Safari) +2. Head to your Reports page and locate the report +3. Click the report name to open it +4. Click on Reimburse +5. Choose "I'll do it manually - just mark it as reimbursed". This will change the report status to Reimbursed +6. The submitter can then go into the report and confirm that they received the reimbursement by clicking the button at the top of the report. +7. This will change the report status to Reimbursed: CONFIRMED + + +# How to Use Guided Review to Approve Reports +Guided Review helps alert you to what might be out-of-Workspace for an Expense Report. You'll be guided through all report violations and warnings and given the option to Reject or Edit items that need review prior to approving a report. + + +Guided Review helps approvers quickly identify reports that need more attention so they can pass over reports that can be quickly approved. Both Submitters and Approvers have actionable notifications for the following: violations, warnings, and notices. These notifications are important since they will be included in “review mode” for the approver to make clear approve or reject decisions. + + +Via the Website:​ +1. Simply click Review at the top left of the report and the system will begin to walk you through the entire report. +2. Choose to Reject, View, or skip over an item needing review. If you wish to stop the process at any time, click the X in the progress bar in the top right corner. +Reject: This will remove the expense from the report and send it back to the submitter. An email will be sent to the submitter explaining this expense has been rejected. +View: This will allow you to open the expense so you can view and fix any incorrect data. +Next: This will allow you to skip over the current item and move forward to review the rest of the report. +Finish: Click this to finish reviewing the report! +3. Click the Finish button if you are done reviewing, or reject/edit the last item to finish the review process. +4. Approve the report! Approve and Forward the report if there is another person who needs to review the report in your approval workflow, or you can Final Approve if you are the final approver. Note: When in Guided Review, you'll automatically Approve the report adhering to your Company's Approval Workflow once you Approve the final expense on the report. You'll then be immediately taken to the next report requiring your attention - making Approving multiple expenses a quick and painless process! + + + + +Via the Mobile App:​ +1. From Home, under Reports that need your attention, click Begin Review, and the system will bring you to the first expense on the oldest report in Home. +2. Edit the expense: Make any necessary edits to the expense by tapping the corresponding field. Be sure to address any Violations and Notes on the expense! Notes are indicated at the top of the expense with a yellow exclamation point, while violations appear on the expense with a red exclamation point: +3. Choose Reject or Accept at the top of the expense. + + +Reject: This will remove the expense from the report and send it back to the submitter. An email will be sent to the submitter explaining this expense has been rejected, and a comment will be added to the report it was rejected from. If this is the only expense on the report, the entire report will be rejected (and the expense will remain on the report). + + +If Scheduled Submit is being used, rejected expenses will auto-report to the next Open report on the Workspace (as if it were a new expense). If an open report doesn't exist, Concierge will create a new one. +​ + + +If Scheduled Submit is not being used, any rejected expenses will be Unreported in the submitter's account and need to be manually applied to a new report. +​ +Accept: This will move to the next expense on the report, leaving behind any outstanding violations or notes. If this is the last expense on the report, you'll be all done! +Once you've made it through all of the expenses on the report, you'll be all set! + + +# Deep Dive +## Concierge Report Management + + +Concierge report approval removes the need for you to manually click "Approve" on endless reports! Instead, you can set up your group Workspace to capture all the requirements you have for your team's expenses. As long as all the rules have been followed and Concierge's additional audit is passed (more below), we will automatically approve such reports on behalf of the approver after submission. +​ +Before you start: +Ensure are a Workspace admin on a group Workspace +Set your workflow to Submit-and-Approve or Advanced Approval workflow​ + + +## Then follow these steps: +Set up your group Workspace so that all of your expense requirements are defined. Setting automatic categories for employees and category rules (e.g., maximum amounts, receipt requirements, etc.) are great examples! + + +Navigate to Settings > Workspaces > Group > [Workspace Name] > Members.​ + + +Scroll down to Approval Mode and select either Submit-and-Approve or Advanced Approval. + + +Under Expense Approvals, select a Manual Approval Threshold greater than $0.​ + + +With this setup, manual approval will only be required: +- For reports that fail audit (i.e. there is at least one Workspace violation on the report) +- For reports that contain at least one expense over the Manual Approval Threshold +- For any percentage of reports that you'd like to spot-check (this is set at 5% or 1 in 20 by default). +- If the report meets all of the requirements you specify in your Workspace settings and all expenses are under the Manual Approval Threshold, then Concierge will automatically move your report through each step of your designated approval workflow (unless it's routed for a spot-check).​ + + + + +## Concierge Receipt Audit +Concierge Receipt Audit is a real-time audit and compliance of receipts submitted by employees and Workspace users. Concierge checks every receipt for accuracy and compliance, flagging any expenses that seem fishy before expense reports are even submitted for approval. All risky expenses are highlighted for manual review, leaving you with more control over and visibility into employee expenses. + + +1. Concierge will SmartScan every receipt to verify the data input by the user matches the currency, date, and amount on the physical receipt. +2. After the report is submitted for approval, Concierge highlights any differences between the SmartScanned values and the employee's chosen input. +3. Each receipt that has been verified will show the "Verified" logo. + diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index fb8390ed33da..26e97aceb8aa 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.4.2 + 1.4.3 CFBundleSignature ???? CFBundleURLTypes @@ -40,7 +40,7 @@ CFBundleVersion - 1.4.2.3 + 1.4.3.2 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 555d20bf7323..854f911a582b 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -15,10 +15,10 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 1.4.2 + 1.4.3 CFBundleSignature ???? CFBundleVersion - 1.4.2.3 + 1.4.3.2 diff --git a/package-lock.json b/package-lock.json index 46b0c84ac7e9..1b19367cd58d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.4.2-3", + "version": "1.4.3-2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.4.2-3", + "version": "1.4.3-2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 5e4d542aa3f4..9cea0d62eb28 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.4.2-3", + "version": "1.4.3-2", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", diff --git a/src/CONST.ts b/src/CONST.ts index 436ac4ebbc31..f1364ebbb5bf 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -248,88 +248,9 @@ const CONST = { BETAS: { ALL: 'all', CHRONOS_IN_CASH: 'chronosInCash', - PAY_WITH_EXPENSIFY: 'payWithExpensify', - FREE_PLAN: 'freePlan', DEFAULT_ROOMS: 'defaultRooms', - BETA_EXPENSIFY_WALLET: 'expensifyWallet', BETA_COMMENT_LINKING: 'commentLinking', - INTERNATIONALIZATION: 'internationalization', POLICY_ROOMS: 'policyRooms', - PASSWORDLESS: 'passwordless', - TASKS: 'tasks', - THREADS: 'threads', - CUSTOM_STATUS: 'customStatus', - NEW_DOT_SAML: 'newDotSAML', - PDF_META_STORE: 'pdfMetaStore', - REPORT_ACTION_CONTEXT_MENU: 'reportActionContextMenu', - SUBMIT_POLICY: 'submitPolicy', - ATTENDEES: 'attendees', - AUTO_EXPORT: 'autoExport', - AUTO_EXPORT_INTACCT: 'autoExportIntacct', - AUTO_EXPORT_QBO: 'autoExportQbo', - AUTO_EXPORT_XERO: 'autoExportXero', - AUTO_JOIN_POLICY: 'autoJoinPolicy', - AUTOMATED_TAX_EXEMPTION: 'automatedTaxExemption', - BILL_PAY: 'billPay', - CATEGORY_DEFAULT_TAX: 'categoryDefaultTax', - COLLECTABLE_DEPOSIT_ACCOUNTS: 'collectableDepositAccounts', - CONCIERGE_TRAVEL: 'conciergeTravel', - CONNECTED_CARDS: 'connectedCards', - DISCREPANCY: 'discrepancy', - DOMAIN_CONTACT_BILLING: 'domainContactBilling', - DOMAIN_TWO_FACTOR_AUTH: 'domainTwoFactorAuth', - DUPLICATE_DETECTION: 'duplicateDetection', - EMAIL_SUPPRESSION_BETA: 'emailSuppressionBeta', - EXPENSES_V2: 'expensesV2', - EXPENSIFY_CARD: 'expensifyCard', - EXPENSIFY_CARD_INTACCT_RECONCILIATION: 'expensifyCardIntacctReconciliation', - EXPENSIFY_CARD_NETSUITE_RECONCILIATION: 'expensifyCardNetSuiteReconciliation', - EXPENSIFY_CARD_QBO_RECONCILIATION: 'expensifyCardQBOReconciliation', - EXPENSIFY_CARD_RAPID_INCREASE_FRAUD: 'expensifyCardRapidIncreaseFraud', - EXPENSIFY_CARD_XERO_RECONCILIATION: 'expensifyCardXeroReconciliation', - EXPENSIFY_ORG: 'expensifyOrg', - FIX_VIOLATION_PUSH_NOTIFICATION: 'fixViolationPushNotification', - FREE_PLAN_FULL_LAUNCH: 'freePlanFullLaunch', - FREE_PLAN_SOFT_LAUNCH: 'freePlanSoftLaunch', - GUSTO: 'gusto', - INBOX_CACHE: 'inboxCache', - INBOX_HIDDEN_TASKS: 'inboxHiddenTasks', - INDIRECT_INTEGRATION_SETUP: 'indirectIntegrationSetup', - IOU: 'IOU', - JOIN_POLICY: 'joinPolicy', - LOAD_POLICY_ASYNC: 'loadPolicyAsync', - MAP_RECEIPT: 'mapReceipt', - MERGE_API: 'mergeAPI', - MOBILE_REALTIME_REPORT_COMMENTS: 'mobileRealtimeReportComments', - MOBILE_SECURE_RECEIPTS: 'mobileSecureReceipts', - MONTHLY_SETTLEMENT: 'monthlySettlement', - NAMES_AND_AVATARS: 'namesAndAvatars', - NATIVE_CHAT: 'nativeChat', - NEW_PRICING: 'newPricing', - NEWSLETTER_THREE: 'newsletterThree', - NEXT_STEPS: 'nextSteps', - OPEN_FACE_HAMBURGER: 'openFaceHamburger', - PER_DIEM: 'perDiem', - PER_DIEM_INTERNATIONAL: 'perDiemInternational', - PRICING_COPY_CHANGES: 'pricingCopyChanges', - QBO_INVOICES: 'qboInvoices', - QUICKBOOKS_DESKTOP_V2: 'quickbooksDesktopV2', - REALTIME_REPORT_COMMENTS: 'realtimeReportComments', - S2W_ANNOUNCEMENT: 's2wAnnouncement', - SCHEDULED_AUTO_REPORTING: 'scheduledAutoReporting', - SECURE_RECEIPTS: 'secureReceipts', - SECURE_RECEIPTS_REPORTS: 'secureReceiptsReports', - SELF_SERVICE_HARD_LAUNCH: 'selfServiceHardLaunch', - SEND_MONEY: 'sendMoney', - SMART_SCAN_USER_DISPUTES: 'smartScanUserDisputes', - SMS_SIGN_UP: 'smsSignUp', - STRIPE_CONNECT: 'stripeConnect', - SUMMARY_EMAIL: 'summaryEmail', - SWIPE_TO_WIN: 'swipeToWin', - TAX_FOR_MILEAGE: 'taxForMileage', - TWO_FACTOR_AUTH: 'twoFactorAuth', - VENMO_INTEGRATION: 'venmoIntegration', - ZENEFITS_INTEGRATION: 'zenefitsIntegration', VIOLATIONS: 'violations', }, BUTTON_STATES: { diff --git a/src/components/AddPaymentMethodMenu.js b/src/components/AddPaymentMethodMenu.js index 4f1500132106..ce26985932d6 100644 --- a/src/components/AddPaymentMethodMenu.js +++ b/src/components/AddPaymentMethodMenu.js @@ -5,7 +5,6 @@ import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import useLocalize from '@hooks/useLocalize'; import compose from '@libs/compose'; -import Permissions from '@libs/Permissions'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import iouReportPropTypes from '@pages/iouReportPropTypes'; @@ -41,9 +40,6 @@ const propTypes = { vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)), }), - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), - /** Popover anchor ref */ anchorRef: refPropTypes, @@ -61,12 +57,11 @@ const defaultProps = { horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM, }, - betas: [], anchorRef: () => {}, session: {}, }; -function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session, betas}) { +function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session}) { const {translate} = useLocalize(); return ( @@ -98,15 +93,13 @@ function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignme }, ] : []), - ...(Permissions.canUseWallet(betas) - ? [ - { - text: translate('common.debitCard'), - icon: Expensicons.CreditCard, - onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), - }, - ] - : []), + ...[ + { + text: translate('common.debitCard'), + icon: Expensicons.CreditCard, + onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD), + }, + ], ]} withoutOverlay /> @@ -120,9 +113,6 @@ AddPaymentMethodMenu.displayName = 'AddPaymentMethodMenu'; export default compose( withWindowDimensions, withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, session: { key: ONYXKEYS.SESSION, }, diff --git a/src/components/CheckboxWithLabel.js b/src/components/CheckboxWithLabel.js index 146e37ceb730..b78a7a136158 100644 --- a/src/components/CheckboxWithLabel.js +++ b/src/components/CheckboxWithLabel.js @@ -7,7 +7,6 @@ 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,9 +53,6 @@ const propTypes = { /** The default value for the checkbox */ defaultValue: PropTypes.bool, - /** React ref being forwarded to the Checkbox input */ - forwardedRef: refPropTypes, - /** The ID used to uniquely identify the input in a Form */ /* eslint-disable-next-line react/no-unused-prop-types */ inputID: PropTypes.string, @@ -79,11 +75,10 @@ const defaultProps = { isChecked: false, value: false, defaultValue: false, - forwardedRef: () => {}, accessibilityLabel: undefined, }; -function CheckboxWithLabel(props) { +const CheckboxWithLabel = React.forwardRef((props, ref) => { const styles = useThemeStyles(); // We need to pick the first value that is strictly a boolean // https://github.com/Expensify/App/issues/16885#issuecomment-1520846065 @@ -106,7 +101,7 @@ function CheckboxWithLabel(props) { label={props.label} style={[styles.checkboxWithLabelCheckboxStyle]} hasError={Boolean(props.errorText)} - forwardedRef={props.forwardedRef} + ref={ref} accessibilityLabel={props.accessibilityLabel || props.label} /> ); -} +}); CheckboxWithLabel.propTypes = propTypes; CheckboxWithLabel.defaultProps = defaultProps; CheckboxWithLabel.displayName = 'CheckboxWithLabel'; -const CheckboxWithLabelWithRef = React.forwardRef((props, ref) => ( - -)); - -CheckboxWithLabelWithRef.displayName = 'CheckboxWithLabelWithRef'; - -export default CheckboxWithLabelWithRef; +export default CheckboxWithLabel; diff --git a/src/components/DotIndicatorMessage.js b/src/components/DotIndicatorMessage.tsx similarity index 53% rename from src/components/DotIndicatorMessage.js rename to src/components/DotIndicatorMessage.tsx index 735d9e3e6924..112feab166cf 100644 --- a/src/components/DotIndicatorMessage.js +++ b/src/components/DotIndicatorMessage.tsx @@ -1,20 +1,20 @@ -import PropTypes from 'prop-types'; +/* eslint-disable react/no-array-index-key */ import React from 'react'; -import {View} from 'react-native'; -import _ from 'underscore'; +import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; import fileDownload from '@libs/fileDownload'; import * as Localize from '@libs/Localize'; -import stylePropTypes from '@styles/stylePropTypes'; import * as StyleUtils from '@styles/StyleUtils'; import useTheme from '@styles/themes/useTheme'; import useThemeStyles from '@styles/useThemeStyles'; import CONST from '@src/CONST'; import Icon from './Icon'; import * as Expensicons from './Icon/Expensicons'; -import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; +import {PressableWithoutFeedback} from './Pressable'; import Text from './Text'; -const propTypes = { +type ReceiptError = {error?: string; source: string; filename: string}; + +type DotIndicatorMessageProps = { /** * 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 @@ -22,66 +22,46 @@ const propTypes = { * timestamp: 'message', * } */ - messages: PropTypes.objectOf( - PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.string, PropTypes.object]), 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, + messages: Record; - // Additional styles to apply to the container */ - // eslint-disable-next-line react/forbid-prop-types - style: PropTypes.arrayOf(PropTypes.object), + /** The type of message, 'error' shows a red dot, 'success' shows a green dot */ + type: 'error' | 'success'; - // Additional styles to apply to the text - textStyles: stylePropTypes, -}; + /** Additional styles to apply to the container */ + style?: StyleProp; -const defaultProps = { - messages: {}, - style: [], - textStyles: [], + /** Additional styles to apply to the text */ + textStyles?: StyleProp; }; -/** - * Check if the error includes a receipt. - * - * @param {String} message - * @returns {Boolean} - */ -const isReceiptError = (message) => { - if (_.isString(message)) { +/** Check if the error includes a receipt. */ +function isReceiptError(message: string | ReceiptError): message is ReceiptError { + if (typeof message === 'string') { return false; } - return _.get(message, 'error', '') === CONST.IOU.RECEIPT_ERROR; -}; + return (message?.error ?? '') === CONST.IOU.RECEIPT_ERROR; +} -function DotIndicatorMessage(props) { +function DotIndicatorMessage({messages = {}, style, type, textStyles}: DotIndicatorMessageProps) { const theme = useTheme(); const styles = useThemeStyles(); - if (_.isEmpty(props.messages)) { + + 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 = 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 = [...new Set(sortedMessages)].map((message) => Localize.translateIfPhraseKey(message)); - const isErrorMessage = props.type === 'error'; + const isErrorMessage = type === 'error'; return ( - + - {_.map(sortedMessages, (message, i) => + {uniqueMessages.map((message, i) => isReceiptError(message) ? ( { @@ -109,8 +90,9 @@ function DotIndicatorMessage(props) { ) : ( {message} @@ -121,8 +103,6 @@ function DotIndicatorMessage(props) { ); } -DotIndicatorMessage.propTypes = propTypes; -DotIndicatorMessage.defaultProps = defaultProps; DotIndicatorMessage.displayName = 'DotIndicatorMessage'; export default DotIndicatorMessage; diff --git a/src/components/LHNOptionsList/OptionRowLHN.js b/src/components/LHNOptionsList/OptionRowLHN.js index 69354404c93b..075696f16d19 100644 --- a/src/components/LHNOptionsList/OptionRowLHN.js +++ b/src/components/LHNOptionsList/OptionRowLHN.js @@ -20,7 +20,6 @@ import DateUtils from '@libs/DateUtils'; import DomUtils from '@libs/DomUtils'; import {getGroupChatName} from '@libs/GroupChatUtils'; import * as OptionsListUtils from '@libs/OptionsListUtils'; -import Permissions from '@libs/Permissions'; import ReportActionComposeFocusManager from '@libs/ReportActionComposeFocusManager'; import * as ReportUtils from '@libs/ReportUtils'; import * as ContextMenuActions from '@pages/home/report/ContextMenu/ContextMenuActions'; @@ -36,9 +35,6 @@ const propTypes = { // eslint-disable-next-line react/forbid-prop-types hoverStyle: PropTypes.object, - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), - /** The ID of the report that the option is for */ reportID: PropTypes.string.isRequired, @@ -65,7 +61,6 @@ const defaultProps = { style: null, optionItem: null, isFocused: false, - betas: [], }; function OptionRowLHN(props) { @@ -157,7 +152,7 @@ function OptionRowLHN(props) { const statusClearAfterDate = lodashGet(optionItem, 'status.clearAfter', ''); const formattedDate = DateUtils.getStatusUntilDate(statusClearAfterDate); const statusContent = formattedDate ? `${statusText} (${formattedDate})` : statusText; - const isStatusVisible = Permissions.canUseCustomStatus(props.betas) && !!emojiCode && ReportUtils.isOneOnOneChat(ReportUtils.getReport(optionItem.reportID)); + const isStatusVisible = !!emojiCode && ReportUtils.isOneOnOneChat(ReportUtils.getReport(optionItem.reportID)); const isGroupChat = optionItem.type === CONST.REPORT.TYPE.CHAT && _.isEmpty(optionItem.chatType) && !optionItem.isThread && lodashGet(optionItem, 'displayNamesWithTooltips.length', 0) > 2; diff --git a/src/components/SettlementButton.js b/src/components/SettlementButton.js index 27ba3d08a16f..8cf9655d34dc 100644 --- a/src/components/SettlementButton.js +++ b/src/components/SettlementButton.js @@ -5,7 +5,6 @@ import _ from 'underscore'; import useLocalize from '@hooks/useLocalize'; import useNetwork from '@hooks/useNetwork'; import compose from '@libs/compose'; -import Permissions from '@libs/Permissions'; import * as ReportUtils from '@libs/ReportUtils'; import iouReportPropTypes from '@pages/iouReportPropTypes'; import * as BankAccounts from '@userActions/BankAccounts'; @@ -34,9 +33,6 @@ const propTypes = { /** The IOU/Expense report we are paying */ iouReport: iouReportPropTypes, - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), - /** The route to redirect if user does not have a payment method setup */ enablePaymentsRoute: PropTypes.string.isRequired, @@ -89,9 +85,8 @@ const defaultProps = { currency: CONST.CURRENCY.USD, chatReportID: '', - // The "betas" array, "iouReport" and "nvp_lastPaymentMethod" objects needs to be stable to prevent the "useMemo" + // The "iouReport" and "nvp_lastPaymentMethod" objects needs to be stable to prevent the "useMemo" // hook from being recreated unnecessarily, hence the use of CONST.EMPTY_ARRAY and CONST.EMPTY_OBJECT - betas: CONST.EMPTY_ARRAY, iouReport: CONST.EMPTY_OBJECT, nvp_lastPaymentMethod: CONST.EMPTY_OBJECT, style: [], @@ -113,7 +108,6 @@ function SettlementButton({ addBankAccountRoute, kycWallAnchorAlignment, paymentMethodDropdownAnchorAlignment, - betas, buttonSize, chatReportID, currency, @@ -155,7 +149,7 @@ function SettlementButton({ value: CONST.IOU.PAYMENT_TYPE.ELSEWHERE, }, }; - const canUseWallet = !isExpenseReport && currency === CONST.CURRENCY.USD && Permissions.canUsePayWithExpensify(betas) && Permissions.canUseWallet(betas); + const canUseWallet = !isExpenseReport && currency === CONST.CURRENCY.USD; // 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. @@ -171,7 +165,7 @@ function SettlementButton({ return _.sortBy(buttonOptions, (method) => (method.value === paymentMethod ? 0 : 1)); } return buttonOptions; - }, [betas, currency, formattedAmount, iouReport, nvp_lastPaymentMethod, policyID, translate]); + }, [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) { @@ -219,9 +213,6 @@ SettlementButton.displayName = 'SettlementButton'; export default compose( withNavigation, withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, nvp_lastPaymentMethod: { key: ONYXKEYS.NVP_LAST_PAYMENT_METHOD, }, diff --git a/src/languages/en.ts b/src/languages/en.ts index 96e2e99824cd..68af6ec2341d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -561,19 +561,19 @@ export default { splitAmount: ({amount}: SplitAmountParams) => `split ${amount}`, didSplitAmount: ({formattedAmount, comment}: DidSplitAmountMessageParams) => `split ${formattedAmount}${comment ? ` for ${comment}` : ''}`, amountEach: ({amount}: AmountEachParams) => `${amount} each`, - payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer} owes ${amount}`, + payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer ? `${payer} ` : ''}owes ${amount}`, payerOwes: ({payer}: PayerOwesParams) => `${payer} owes: `, - payerPaidAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer} paid ${amount}`, + payerPaidAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer ? `${payer} ` : ''}paid ${amount}`, payerPaid: ({payer}: PayerPaidParams) => `${payer} paid: `, - payerSpentAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer} spent ${amount}`, + payerSpentAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer ? `${payer} ` : ''}spent ${amount}`, payerSpent: ({payer}: PayerPaidParams) => `${payer} spent: `, managerApproved: ({manager}: ManagerApprovedParams) => `${manager} approved:`, payerSettled: ({amount}: PayerSettledParams) => `paid ${amount}`, waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up, payment is held until ${submitterDisplayName} adds a bank account`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}: SettledAfterAddedBankAccountParams) => `${submitterDisplayName} added a bank account. The ${amount} payment has been made.`, - paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer} paid ${amount} elsewhere`, - paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer} paid ${amount} using Expensify`, + paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer ? `${payer} ` : ''}paid ${amount} elsewhere`, + paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer ? `${payer} ` : ''}paid ${amount} using Expensify`, noReimbursableExpenses: 'This report has an invalid amount', pendingConversionMessage: "Total will update when you're back online", changedTheRequest: 'changed the request', diff --git a/src/languages/es.ts b/src/languages/es.ts index 3f8f68977549..f298839b05b8 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -553,19 +553,19 @@ export default { splitAmount: ({amount}: SplitAmountParams) => `dividir ${amount}`, didSplitAmount: ({formattedAmount, comment}: DidSplitAmountMessageParams) => `dividió ${formattedAmount}${comment ? ` para ${comment}` : ''}`, amountEach: ({amount}: AmountEachParams) => `${amount} cada uno`, - payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer} debe ${amount}`, + payerOwesAmount: ({payer, amount}: PayerOwesAmountParams) => `${payer ? `${payer} ` : ''}debe ${amount}`, payerOwes: ({payer}: PayerOwesParams) => `${payer} debe: `, - payerPaidAmount: ({payer, amount}: PayerPaidAmountParams) => `${payer} pagó ${amount}`, + payerPaidAmount: ({payer, amount}: PayerPaidAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount}`, payerPaid: ({payer}: PayerPaidParams) => `${payer} pagó: `, - payerSpentAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer} gastó ${amount}`, + payerSpentAmount: ({payer, amount}: PayerPaidAmountParams): string => `${payer ? `${payer} ` : ''}gastó ${amount}`, payerSpent: ({payer}: PayerPaidParams) => `${payer} gastó: `, managerApproved: ({manager}: ManagerApprovedParams) => `${manager} aprobó:`, payerSettled: ({amount}: PayerSettledParams) => `pagó ${amount}`, waitingOnBankAccount: ({submitterDisplayName}: WaitingOnBankAccountParams) => `inicio el pago, pero no se procesará hasta que ${submitterDisplayName} añada una cuenta bancaria`, settledAfterAddedBankAccount: ({submitterDisplayName, amount}: SettledAfterAddedBankAccountParams) => `${submitterDisplayName} añadió una cuenta bancaria. El pago de ${amount} se ha realizado.`, - paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer} pagó ${amount} de otra forma`, - paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer} pagó ${amount} con Expensify`, + paidElsewhereWithAmount: ({payer, amount}: PaidElsewhereWithAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount} de otra forma`, + paidWithExpensifyWithAmount: ({payer, amount}: PaidWithExpensifyWithAmountParams) => `${payer ? `${payer} ` : ''}pagó ${amount} con Expensify`, noReimbursableExpenses: 'El importe de este informe no es válido', pendingConversionMessage: 'El total se actualizará cuando estés online', changedTheRequest: 'cambió la solicitud', diff --git a/src/libs/E2E/apiMocks/beginSignin.ts b/src/libs/E2E/apiMocks/beginSignin.ts index 298846250a12..c5002f1f3dd8 100644 --- a/src/libs/E2E/apiMocks/beginSignin.ts +++ b/src/libs/E2E/apiMocks/beginSignin.ts @@ -17,11 +17,6 @@ const beginSignin = ({email}: SigninParams): Response => ({ validated: true, }, }, - { - onyxMethod: 'set', - key: 'betas', - value: ['passwordless'], - }, ], jsonCode: 200, requestID: '783e54ef4b38cff5-SJC', diff --git a/src/libs/E2E/apiMocks/openApp.ts b/src/libs/E2E/apiMocks/openApp.ts index 13fc9f1f6784..a0583d8439c0 100644 --- a/src/libs/E2E/apiMocks/openApp.ts +++ b/src/libs/E2E/apiMocks/openApp.ts @@ -1457,82 +1457,7 @@ const openApp = (): Response => ({ { onyxMethod: 'set', key: 'betas', - value: [ - 'all', - 'pdfMetaStore', - 'reportActionContextMenu', - 'submitPolicy', - 'attendees', - 'autoExport', - 'autoExportIntacct', - 'autoExportQbo', - 'autoExportXero', - 'autoJoinPolicy', - 'automatedTaxExemption', - 'billPay', - 'categoryDefaultTax', - 'collectableDepositAccounts', - 'conciergeTravel', - 'connectedCards', - 'discrepancy', - 'domainContactBilling', - 'domainTwoFactorAuth', - 'duplicateDetection', - 'emailSuppressionBeta', - 'expensesV2', - 'expensifyCard', - 'expensifyCardIntacctReconciliation', - 'expensifyCardNetSuiteReconciliation', - 'expensifyCardQBOReconciliation', - 'expensifyCardRapidIncreaseFraud', - 'expensifyCardXeroReconciliation', - 'expensifyOrg', - 'fixViolationPushNotification', - 'freePlan', - 'freePlanFullLaunch', - 'freePlanSoftLaunch', - 'gusto', - 'inboxCache', - 'inboxHiddenTasks', - 'indirectIntegrationSetup', - 'IOU', - 'joinPolicy', - 'loadPolicyAsync', - 'mapReceipt', - 'mergeAPI', - 'mobileRealtimeReportComments', - 'mobileSecureReceipts', - 'monthlySettlement', - 'namesAndAvatars', - 'nativeChat', - 'newPricing', - 'newsletterThree', - 'nextSteps', - 'openFaceHamburger', - 'pdfMetaStore', - 'perDiem', - 'perDiemInternational', - 'pricingCopyChanges', - 'qboInvoices', - 'quickbooksDesktopV2', - 'realtimeReportComments', - 's2wAnnouncement', - 'scheduledAutoReporting', - 'secureReceipts', - 'secureReceiptsReports', - 'selfServiceHardLaunch', - 'sendMoney', - 'smartScanUserDisputes', - 'smsSignUp', - 'stripeConnect', - 'submitPolicy', - 'summaryEmail', - 'swipeToWin', - 'taxForMileage', - 'twoFactorAuth', - 'venmoIntegration', - 'zenefitsIntegration', - ], + value: ['all'], }, { onyxMethod: 'merge', diff --git a/src/libs/E2E/apiMocks/signinUser.ts b/src/libs/E2E/apiMocks/signinUser.ts index d94d2fda9016..a7d841196c48 100644 --- a/src/libs/E2E/apiMocks/signinUser.ts +++ b/src/libs/E2E/apiMocks/signinUser.ts @@ -36,82 +36,7 @@ const signinUser = ({email}: SigninParams): Response => ({ { onyxMethod: 'set', key: 'betas', - value: [ - 'all', - 'pdfMetaStore', - 'reportActionContextMenu', - 'submitPolicy', - 'attendees', - 'autoExport', - 'autoExportIntacct', - 'autoExportQbo', - 'autoExportXero', - 'autoJoinPolicy', - 'automatedTaxExemption', - 'billPay', - 'categoryDefaultTax', - 'collectableDepositAccounts', - 'conciergeTravel', - 'connectedCards', - 'discrepancy', - 'domainContactBilling', - 'domainTwoFactorAuth', - 'duplicateDetection', - 'emailSuppressionBeta', - 'expensesV2', - 'expensifyCard', - 'expensifyCardIntacctReconciliation', - 'expensifyCardNetSuiteReconciliation', - 'expensifyCardQBOReconciliation', - 'expensifyCardRapidIncreaseFraud', - 'expensifyCardXeroReconciliation', - 'expensifyOrg', - 'fixViolationPushNotification', - 'freePlan', - 'freePlanFullLaunch', - 'freePlanSoftLaunch', - 'gusto', - 'inboxCache', - 'inboxHiddenTasks', - 'indirectIntegrationSetup', - 'IOU', - 'joinPolicy', - 'loadPolicyAsync', - 'mapReceipt', - 'mergeAPI', - 'mobileRealtimeReportComments', - 'mobileSecureReceipts', - 'monthlySettlement', - 'namesAndAvatars', - 'nativeChat', - 'newPricing', - 'newsletterThree', - 'nextSteps', - 'openFaceHamburger', - 'pdfMetaStore', - 'perDiem', - 'perDiemInternational', - 'pricingCopyChanges', - 'qboInvoices', - 'quickbooksDesktopV2', - 'realtimeReportComments', - 's2wAnnouncement', - 'scheduledAutoReporting', - 'secureReceipts', - 'secureReceiptsReports', - 'selfServiceHardLaunch', - 'sendMoney', - 'smartScanUserDisputes', - 'smsSignUp', - 'stripeConnect', - 'submitPolicy', - 'summaryEmail', - 'swipeToWin', - 'taxForMileage', - 'twoFactorAuth', - 'venmoIntegration', - 'zenefitsIntegration', - ], + value: ['all'], }, { onyxMethod: 'merge', diff --git a/src/libs/Localize/index.ts b/src/libs/Localize/index.ts index 6910bc7e9bdb..488ff0d9b98a 100644 --- a/src/libs/Localize/index.ts +++ b/src/libs/Localize/index.ts @@ -96,10 +96,12 @@ function translateLocal(phrase: TKey, ...variable return translate(BaseLocaleListener.getPreferredLocale(), phrase, ...variables); } +type MaybePhraseKey = string | [string, Record & {isTranslated?: true}] | []; + /** * Return translated string for given error. */ -function translateIfPhraseKey(message: string | [string, Record & {isTranslated?: true}] | []): string { +function translateIfPhraseKey(message: MaybePhraseKey): string { if (!message || (Array.isArray(message) && message.length === 0)) { return ''; } @@ -138,4 +140,4 @@ function getDevicePreferredLocale(): string { } export {translate, translateLocal, translateIfPhraseKey, arrayToString, getDevicePreferredLocale}; -export type {PhraseParameters, Phrase}; +export type {PhraseParameters, Phrase, MaybePhraseKey}; diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index b97ae6daed11..14bee6e79776 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -9,6 +9,7 @@ import _ from 'underscore'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import * as CollectionUtils from './CollectionUtils'; +import * as CurrencyUtils from './CurrencyUtils'; import * as ErrorUtils from './ErrorUtils'; import * as LocalePhoneNumber from './LocalePhoneNumber'; import * as Localize from './Localize'; @@ -372,6 +373,40 @@ function getAllReportErrors(report, reportActions) { return allReportErrors; } +/** + * Get the preview message to be displayed in the option list. + * + * @param {Object} report + * @param {Object} reportAction + * @param {Boolean} [isPreviewMessageForParentChatReport] + * @returns {String} + */ +function getReportPreviewMessageForOptionList(report, reportAction, isPreviewMessageForParentChatReport = false) { + // For the request action preview we want to show the requestor instead of the user who owes the money + if (!isPreviewMessageForParentChatReport && reportAction.originalMessage && reportAction.originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE) { + const amount = Math.abs(reportAction.originalMessage.amount); + const formattedAmount = CurrencyUtils.convertToDisplayString(amount, report.currency); + const shouldShowActorName = currentUserAccountID !== reportAction.actorAccountID; + const actorDisplayName = shouldShowActorName ? `${ReportUtils.getDisplayNameForParticipant(reportAction.actorAccountID, true)}: ` : ''; + + return `${actorDisplayName}${Localize.translateLocal('iou.requestedAmount', {formattedAmount})}`; + } + + const shouldShowWorkspaceName = ReportUtils.isExpenseReport(report) && isPreviewMessageForParentChatReport; + const actorID = report.managerID || reportAction.actorAccountID; + const actor = ReportUtils.getActorNameForPreviewMessage({ + report, + shouldShowWorkspaceName, + actorID, + shouldUseShortForm: !isPreviewMessageForParentChatReport, + }); + const shouldShowActorName = shouldShowWorkspaceName || isPreviewMessageForParentChatReport || currentUserAccountID !== actorID; + const actorDisplayName = shouldShowActorName && actor ? `${actor}${isPreviewMessageForParentChatReport ? ' ' : ': '}` : ''; + const message = ReportUtils.getReportPreviewMessage(report, reportAction, true, isPreviewMessageForParentChatReport, true); + + return `${actorDisplayName}${message}`; +} + /** * Get the last message text from the report directly or from other sources for special cases. * @param {Object} report @@ -383,7 +418,7 @@ function getLastMessageTextForReport(report) { const lastActionName = lodashGet(lastReportAction, 'actionName', ''); if (ReportActionUtils.isMoneyRequestAction(lastReportAction)) { - const properSchemaForMoneyRequestMessage = ReportUtils.getReportPreviewMessage(report, lastReportAction, true); + const properSchemaForMoneyRequestMessage = getReportPreviewMessageForOptionList(report, lastReportAction, false); lastMessageTextFromReport = ReportUtils.formatReportLastMessageText(properSchemaForMoneyRequestMessage); } else if (ReportActionUtils.isReportPreviewAction(lastReportAction)) { const iouReport = ReportUtils.getReport(ReportActionUtils.getIOUReportIDFromReportActionPreview(lastReportAction)); @@ -394,7 +429,7 @@ function getLastMessageTextForReport(report) { reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && ReportActionUtils.isMoneyRequestAction(reportAction), ); - lastMessageTextFromReport = ReportUtils.getReportPreviewMessage(iouReport, lastIOUMoneyReport, true, ReportUtils.isChatReport(report)); + lastMessageTextFromReport = getReportPreviewMessageForOptionList(iouReport, lastIOUMoneyReport, ReportUtils.isChatReport(report)); } else if (ReportActionUtils.isReimbursementQueuedAction(lastReportAction)) { lastMessageTextFromReport = ReportUtils.getReimbursementQueuedActionMessage(lastReportAction, report); } else if (ReportActionUtils.isDeletedParentAction(lastReportAction) && ReportUtils.isChatReport(report)) { @@ -411,7 +446,10 @@ function getLastMessageTextForReport(report) { ) { lastMessageTextFromReport = lodashGet(lastReportAction, 'message[0].text', ''); } else { - lastMessageTextFromReport = report ? report.lastMessageText || '' : ''; + const shouldShowLastActor = + ReportUtils.isThread(report) && (ReportUtils.isExpenseReport(report) || ReportUtils.isIOUReport(report)) && currentUserAccountID !== report.lastActorAccountID; + const lastActorDisplayName = shouldShowLastActor ? `${ReportUtils.getDisplayNameForParticipant(report.lastActorAccountID, true)}: ` : ''; + lastMessageTextFromReport = report ? `${lastActorDisplayName}${report.lastMessageText}` : ''; } return lastMessageTextFromReport; } diff --git a/src/libs/Permissions.ts b/src/libs/Permissions.ts index 0c8843b87415..c3e01735fb07 100644 --- a/src/libs/Permissions.ts +++ b/src/libs/Permissions.ts @@ -9,18 +9,10 @@ function canUseChronos(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.CHRONOS_IN_CASH) || canUseAllBetas(betas); } -function canUsePayWithExpensify(betas: Beta[]): boolean { - return betas?.includes(CONST.BETAS.PAY_WITH_EXPENSIFY) || canUseAllBetas(betas); -} - function canUseDefaultRooms(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.DEFAULT_ROOMS) || canUseAllBetas(betas); } -function canUseWallet(betas: Beta[]): boolean { - return betas?.includes(CONST.BETAS.BETA_EXPENSIFY_WALLET) || canUseAllBetas(betas); -} - function canUseCommentLinking(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.BETA_COMMENT_LINKING) || canUseAllBetas(betas); } @@ -34,14 +26,6 @@ function canUsePolicyRooms(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.POLICY_ROOMS) || canUseAllBetas(betas); } -function canUseTasks(betas: Beta[]): boolean { - return betas?.includes(CONST.BETAS.TASKS) || canUseAllBetas(betas); -} - -function canUseCustomStatus(betas: Beta[]): boolean { - return betas?.includes(CONST.BETAS.CUSTOM_STATUS) || canUseAllBetas(betas); -} - function canUseViolations(betas: Beta[]): boolean { return betas?.includes(CONST.BETAS.VIOLATIONS) || canUseAllBetas(betas); } @@ -55,13 +39,9 @@ function canUseLinkPreviews(): boolean { export default { canUseChronos, - canUsePayWithExpensify, canUseDefaultRooms, - canUseWallet, canUseCommentLinking, canUsePolicyRooms, - canUseTasks, - canUseCustomStatus, canUseLinkPreviews, canUseViolations, }; diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 78478334f810..cb5706c1c123 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1852,17 +1852,39 @@ function getTransactionReportName(reportAction) { }); } +/** + * Get actor name to display in the message preview + * + * @param {Object} report + * @param {Number} actorID + * @param {Boolean} [shouldShowWorkspaceName] + * @param {Boolean} [shouldUseShortForm] + * @param {Object|undefined} [policy] + * @returns {String} + */ +function getActorNameForPreviewMessage({report, actorID, shouldShowWorkspaceName = false, shouldUseShortForm = false, policy = undefined}) { + return shouldShowWorkspaceName ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(actorID, shouldUseShortForm); +} + /** * Get money request message for an IOU report * * @param {Object} report * @param {Object} [reportAction={}] This can be either a report preview action or the IOU action * @param {Boolean} [shouldConsiderReceiptBeingScanned=false] - * @param {Boolean} isPreviewMessageForParentChatReport + * @param {Boolean} [isPreviewMessageForParentChatReport] + * @param {Boolean} [shouldHideParticipantName] * @param {Object} [policy] * @returns {String} */ -function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceiptBeingScanned = false, isPreviewMessageForParentChatReport = false, policy = undefined) { +function getReportPreviewMessage( + report, + reportAction = {}, + shouldConsiderReceiptBeingScanned = false, + isPreviewMessageForParentChatReport = false, + shouldHideParticipantName = false, + policy = undefined, +) { const reportActionMessage = lodashGet(reportAction, 'message[0].html', ''); if (_.isEmpty(report) || !report.reportID) { @@ -1886,7 +1908,14 @@ function getReportPreviewMessage(report, reportAction = {}, shouldConsiderReceip } const totalAmount = getMoneyRequestReimbursableTotal(report); - const payerName = isExpenseReport(report) ? getPolicyName(report, false, policy) : getDisplayNameForParticipant(report.managerID, true); + const payerDisplayName = getActorNameForPreviewMessage({ + report, + actorID: report.managerID, + shouldUseShortForm: true, + shouldShowWorkspaceName: isExpenseReport(report), + policy, + }); + const payerName = shouldHideParticipantName ? '' : payerDisplayName; const formattedAmount = CurrencyUtils.convertToDisplayString(totalAmount, report.currency); if (isReportApproved(report) && getPolicyType(report, allPolicies) === CONST.POLICY.TYPE.CORPORATE) { @@ -1946,7 +1975,11 @@ function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, if (!newValue) { return Localize.translateLocal('iou.removedTheRequest', {valueName: displayValueName, oldValueToDisplay}); } - return Localize.translateLocal('iou.updatedTheRequest', {valueName: displayValueName, newValueToDisplay, oldValueToDisplay}); + return Localize.translateLocal('iou.updatedTheRequest', { + valueName: displayValueName, + newValueToDisplay, + oldValueToDisplay, + }); } /** @@ -1961,7 +1994,10 @@ function getProperSchemaForModifiedExpenseMessage(newValue, oldValue, valueName, function getProperSchemaForModifiedDistanceMessage(newDistance, oldDistance, newAmount, oldAmount) { if (!oldDistance) { - return Localize.translateLocal('iou.setTheDistance', {newDistanceToDisplay: newDistance, newAmountToDisplay: newAmount}); + return Localize.translateLocal('iou.setTheDistance', { + newDistanceToDisplay: newDistance, + newAmountToDisplay: newAmount, + }); } return Localize.translateLocal('iou.updatedTheDistance', { newDistanceToDisplay: newDistance, @@ -3412,6 +3448,7 @@ function canAccessReport(report, policies, betas, allReportActions) { return true; } + /** * Check if the report is the parent report of the currently viewed report or at least one child report has report action * @param {Object} report @@ -4553,6 +4590,7 @@ export { getPersonalDetailsForAccountID, getChannelLogMemberMessage, getRoom, + getActorNameForPreviewMessage, shouldDisableWelcomeMessage, canEditWriteCapability, }; diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 763a0000ba35..c3312ebebae9 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -406,7 +406,8 @@ function getOptionData( } : null; } - const lastActorDisplayName = hasMultipleParticipants && lastActorDetails?.accountID && Number(lastActorDetails.accountID) !== currentUserAccountID ? lastActorDetails.displayName : ''; + const lastActorDisplayName = + hasMultipleParticipants && lastActorDetails?.accountID && Number(lastActorDetails.accountID) !== currentUserAccountID ? lastActorDetails.displayName?.split(' ')[0] : ''; let lastMessageText = lastMessageTextFromReport; const reportAction = lastReportActions?.[report.reportID]; diff --git a/src/libs/__mocks__/Permissions.ts b/src/libs/__mocks__/Permissions.ts index e95d13f52803..4f47c0b756b7 100644 --- a/src/libs/__mocks__/Permissions.ts +++ b/src/libs/__mocks__/Permissions.ts @@ -12,5 +12,4 @@ export default { ...jest.requireActual('../Permissions'), canUseDefaultRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.DEFAULT_ROOMS), canUsePolicyRooms: (betas: Beta[]) => betas.includes(CONST.BETAS.POLICY_ROOMS), - canUseCustomStatus: (betas: Beta[]) => betas.includes(CONST.BETAS.CUSTOM_STATUS), }; diff --git a/src/libs/actions/Policy.js b/src/libs/actions/Policy.js index ebc1cdf9a2e1..aa75b88859f1 100644 --- a/src/libs/actions/Policy.js +++ b/src/libs/actions/Policy.js @@ -1800,7 +1800,7 @@ function createWorkspaceFromIOUPayment(iouReport) { value: { [reportPreview.reportActionID]: { ...reportPreview, - message: ReportUtils.getReportPreviewMessage(expenseReport, {}, false, false, newWorkspace), + message: ReportUtils.getReportPreviewMessage(expenseReport, {}, false, false, false, newWorkspace), created: DateUtils.getDBTime(), }, }, diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index 3c91dc4624cd..ad6fd7be10dd 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -77,7 +77,6 @@ function closeAccount(message) { * Resends a validation link to a given login * * @param {String} login - * @param {Boolean} isPasswordless - temporary param to trigger passwordless flow in backend */ function resendValidateCode(login) { Session.resendValidateCode(login); diff --git a/src/pages/ProfilePage.js b/src/pages/ProfilePage.js index 4b3c927ef317..ffe8271629f4 100755 --- a/src/pages/ProfilePage.js +++ b/src/pages/ProfilePage.js @@ -25,7 +25,6 @@ import UserDetailsTooltip from '@components/UserDetailsTooltip'; import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; import * as ValidationUtils from '@libs/ValidationUtils'; @@ -133,7 +132,7 @@ function ProfilePage(props) { const statusEmojiCode = lodashGet(details, 'status.emojiCode', ''); const statusText = lodashGet(details, 'status.text', ''); - const hasStatus = !!statusEmojiCode && Permissions.canUseCustomStatus(props.betas); + const hasStatus = !!statusEmojiCode; const statusContent = `${statusEmojiCode} ${statusText}`; const navigateBackTo = lodashGet(props.route, 'params.backTo', ROUTES.HOME); @@ -292,9 +291,6 @@ export default compose( isLoadingReportData: { key: ONYXKEYS.IS_LOADING_REPORT_DATA, }, - betas: { - key: ONYXKEYS.BETAS, - }, session: { key: ONYXKEYS.SESSION, }, diff --git a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js index 79079d8c0d44..30c20a6fb6c1 100644 --- a/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js +++ b/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js @@ -1,7 +1,6 @@ import PropTypes from 'prop-types'; import React, {useMemo} from 'react'; import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import AttachmentPicker from '@components/AttachmentPicker'; import Icon from '@components/Icon'; @@ -12,7 +11,6 @@ import Tooltip from '@components/Tooltip/PopoverAnchorTooltip'; import useLocalize from '@hooks/useLocalize'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; -import Permissions from '@libs/Permissions'; import * as ReportUtils from '@libs/ReportUtils'; import useTheme from '@styles/themes/useTheme'; import useThemeStyles from '@styles/useThemeStyles'; @@ -20,12 +18,8 @@ import * as IOU from '@userActions/IOU'; import * as Report from '@userActions/Report'; import * as Task from '@userActions/Task'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; const propTypes = { - /** Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), - /** The report currently being looked at */ report: PropTypes.shape({ /** ID of the report */ @@ -88,7 +82,6 @@ const propTypes = { }; const defaultProps = { - betas: [], reportParticipantIDs: [], }; @@ -99,7 +92,6 @@ const defaultProps = { * @returns {React.Component} */ function AttachmentPickerWithMenuItems({ - betas, report, reportParticipantIDs, displayFileInModal, @@ -154,7 +146,7 @@ function AttachmentPickerWithMenuItems({ * @returns {Boolean} */ const taskOption = useMemo(() => { - if (!Permissions.canUseTasks(betas) || !ReportUtils.canCreateTaskInReport(report)) { + if (!ReportUtils.canCreateTaskInReport(report)) { return []; } @@ -165,7 +157,7 @@ function AttachmentPickerWithMenuItems({ onSelected: () => Task.clearOutTaskInfoAndNavigate(reportID), }, ]; - }, [betas, report, reportID, translate]); + }, [report, reportID, translate]); const onPopoverMenuClose = () => { setMenuVisibility(false); @@ -298,8 +290,4 @@ AttachmentPickerWithMenuItems.propTypes = propTypes; AttachmentPickerWithMenuItems.defaultProps = defaultProps; AttachmentPickerWithMenuItems.displayName = 'AttachmentPickerWithMenuItems'; -export default withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, -})(AttachmentPickerWithMenuItems); +export default AttachmentPickerWithMenuItems; diff --git a/src/pages/home/report/ReportActionItemSingle.js b/src/pages/home/report/ReportActionItemSingle.js index 955e024bd7a8..e69531e2cc53 100644 --- a/src/pages/home/report/ReportActionItemSingle.js +++ b/src/pages/home/report/ReportActionItemSingle.js @@ -2,7 +2,6 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; -import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import Avatar from '@components/Avatar'; import MultipleAvatars from '@components/MultipleAvatars'; @@ -14,11 +13,9 @@ import Text from '@components/Text'; import Tooltip from '@components/Tooltip'; import UserDetailsTooltip from '@components/UserDetailsTooltip'; import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; -import compose from '@libs/compose'; import ControlSelection from '@libs/ControlSelection'; import DateUtils from '@libs/DateUtils'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; import reportPropTypes from '@pages/reportPropTypes'; @@ -26,7 +23,6 @@ import styles from '@styles/styles'; import * as StyleUtils from '@styles/StyleUtils'; import themeColors from '@styles/themes/default'; import CONST from '@src/CONST'; -import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import ReportActionItemDate from './ReportActionItemDate'; import ReportActionItemFragment from './ReportActionItemFragment'; @@ -205,7 +201,7 @@ function ReportActionItemSingle(props) { ); }; - const hasEmojiStatus = !displayAllActors && status && status.emojiCode && Permissions.canUseCustomStatus(props.betas); + const hasEmojiStatus = !displayAllActors && status && status.emojiCode; const formattedDate = DateUtils.getStatusUntilDate(lodashGet(status, 'clearAfter')); const statusText = lodashGet(status, 'text', ''); const statusTooltipText = formattedDate ? `${statusText} (${formattedDate})` : statusText; @@ -267,11 +263,4 @@ ReportActionItemSingle.propTypes = propTypes; ReportActionItemSingle.defaultProps = defaultProps; ReportActionItemSingle.displayName = 'ReportActionItemSingle'; -export default compose( - withLocalize, - withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, - }), -)(ReportActionItemSingle); +export default withLocalize(ReportActionItemSingle); diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index b85319ca6158..353eebb40796 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -13,7 +13,6 @@ import withWindowDimensions from '@components/withWindowDimensions'; import usePrevious from '@hooks/usePrevious'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import useThemeStyles from '@styles/useThemeStyles'; import * as App from '@userActions/App'; import * as IOU from '@userActions/IOU'; @@ -54,9 +53,6 @@ const propTypes = { name: PropTypes.string, }), - /* Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), - /** Indicated whether the report data is loading */ isLoading: PropTypes.bool, @@ -74,7 +70,6 @@ const defaultProps = { onHideCreateMenu: () => {}, onShowCreateMenu: () => {}, allPolicies: {}, - betas: [], isLoading: false, innerRef: null, demoInfo: {}, @@ -207,15 +202,13 @@ function FloatingActionButtonAndPopover(props) { text: props.translate('iou.sendMoney'), onSelected: () => interceptAnonymousUser(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SEND)), }, - ...(Permissions.canUseTasks(props.betas) - ? [ - { - icon: Expensicons.Task, - text: props.translate('newTaskPage.assignTask'), - onSelected: () => interceptAnonymousUser(() => Task.clearOutTaskInfoAndNavigate()), - }, - ] - : []), + ...[ + { + icon: Expensicons.Task, + text: props.translate('newTaskPage.assignTask'), + onSelected: () => interceptAnonymousUser(() => Task.clearOutTaskInfoAndNavigate()), + }, + ], { icon: Expensicons.Heart, text: props.translate('sidebarScreen.saveTheWorld'), @@ -280,9 +273,6 @@ export default compose( key: ONYXKEYS.COLLECTION.POLICY, selector: policySelector, }, - betas: { - key: ONYXKEYS.BETAS, - }, isLoading: { key: ONYXKEYS.IS_LOADING_APP, }, diff --git a/src/pages/home/sidebar/SignInOrAvatarWithOptionalStatus.js b/src/pages/home/sidebar/SignInOrAvatarWithOptionalStatus.js index 8e41e1c6af6a..8e680a20d419 100644 --- a/src/pages/home/sidebar/SignInOrAvatarWithOptionalStatus.js +++ b/src/pages/home/sidebar/SignInOrAvatarWithOptionalStatus.js @@ -2,13 +2,9 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React from 'react'; -import {withOnyx} from 'react-native-onyx'; import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; -import compose from '@libs/compose'; -import Permissions from '@libs/Permissions'; import personalDetailsPropType from '@pages/personalDetailsPropType'; import * as Session from '@userActions/Session'; -import ONYXKEYS from '@src/ONYXKEYS'; import AvatarWithOptionalStatus from './AvatarWithOptionalStatus'; import PressableAvatarWithIndicator from './PressableAvatarWithIndicator'; import SignInButton from './SignInButton'; @@ -19,22 +15,17 @@ const propTypes = { /** Whether the create menu is open or not */ isCreateMenuOpen: PropTypes.bool, - - /** Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), }; const defaultProps = { - betas: [], isCreateMenuOpen: false, currentUserPersonalDetails: { status: {emojiCode: ''}, }, }; -function SignInOrAvatarWithOptionalStatus({currentUserPersonalDetails, isCreateMenuOpen, betas}) { - const statusEmojiCode = lodashGet(currentUserPersonalDetails, 'status.emojiCode', ''); - const emojiStatus = Permissions.canUseCustomStatus(betas) ? statusEmojiCode : ''; +function SignInOrAvatarWithOptionalStatus({currentUserPersonalDetails, isCreateMenuOpen}) { + const emojiStatus = lodashGet(currentUserPersonalDetails, 'status.emojiCode', ''); if (Session.isAnonymousUser()) { return ; @@ -53,11 +44,4 @@ function SignInOrAvatarWithOptionalStatus({currentUserPersonalDetails, isCreateM SignInOrAvatarWithOptionalStatus.propTypes = propTypes; SignInOrAvatarWithOptionalStatus.defaultProps = defaultProps; SignInOrAvatarWithOptionalStatus.displayName = 'SignInOrAvatarWithOptionalStatus'; -export default compose( - withCurrentUserPersonalDetails, - withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, - }), -)(SignInOrAvatarWithOptionalStatus); +export default withCurrentUserPersonalDetails(SignInOrAvatarWithOptionalStatus); diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js index d88105b31360..1bd57bcab32b 100755 --- a/src/pages/settings/InitialSettingsPage.js +++ b/src/pages/settings/InitialSettingsPage.js @@ -25,7 +25,6 @@ import useWaitForNavigation from '@hooks/useWaitForNavigation'; import compose from '@libs/compose'; import * as CurrencyUtils from '@libs/CurrencyUtils'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import * as PolicyUtils from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import * as UserUtils from '@libs/UserUtils'; @@ -89,9 +88,6 @@ const propTypes = { /** Bank account attached to free plan */ reimbursementAccount: ReimbursementAccountProps.reimbursementAccountPropTypes, - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), - /** Information about the user accepting the terms for payments */ walletTerms: walletTermsPropTypes, @@ -120,7 +116,6 @@ const defaultProps = { currentBalance: 0, }, reimbursementAccount: {}, - betas: [], walletTerms: {}, bankAccountList: {}, fundList: null, @@ -288,8 +283,7 @@ function InitialSettingsPage(props) { * @param {Boolean} isPaymentItem whether the item being rendered is the payments menu item * @returns {Number} the user wallet balance */ - const getWalletBalance = (isPaymentItem) => - isPaymentItem && Permissions.canUseWallet(props.betas) ? CurrencyUtils.convertToDisplayString(props.userWallet.currentBalance) : undefined; + const getWalletBalance = (isPaymentItem) => isPaymentItem && CurrencyUtils.convertToDisplayString(props.userWallet.currentBalance); return ( <> @@ -324,7 +318,7 @@ function InitialSettingsPage(props) { })} ); - }, [getDefaultMenuItems, props.betas, props.userWallet.currentBalance, translate, isExecuting, singleExecution]); + }, [getDefaultMenuItems, props.userWallet.currentBalance, translate, isExecuting, singleExecution]); const headerContent = ( @@ -426,9 +420,6 @@ export default compose( userWallet: { key: ONYXKEYS.USER_WALLET, }, - betas: { - key: ONYXKEYS.BETAS, - }, bankAccountList: { key: ONYXKEYS.BANK_ACCOUNT_LIST, }, diff --git a/src/pages/settings/Profile/ProfilePage.js b/src/pages/settings/Profile/ProfilePage.js index 1e4485b4c36b..fc6c38f96335 100755 --- a/src/pages/settings/Profile/ProfilePage.js +++ b/src/pages/settings/Profile/ProfilePage.js @@ -15,7 +15,6 @@ import withLocalize, {withLocalizePropTypes} from '@components/withLocalize'; import withWindowDimensions, {windowDimensionsPropTypes} from '@components/withWindowDimensions'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import * as UserUtils from '@libs/UserUtils'; import userPropTypes from '@pages/settings/userPropTypes'; import useThemeStyles from '@styles/useThemeStyles'; @@ -83,15 +82,13 @@ function ProfilePage(props) { pageRoute: ROUTES.SETTINGS_CONTACT_METHODS.route, brickRoadIndicator: contactMethodBrickRoadIndicator, }, - ...(Permissions.canUseCustomStatus(props.betas) - ? [ - { - description: props.translate('statusPage.status'), - title: emojiCode ? `${emojiCode} ${lodashGet(props, 'currentUserPersonalDetails.status.text', '')}` : '', - pageRoute: ROUTES.SETTINGS_STATUS, - }, - ] - : []), + ...[ + { + description: props.translate('statusPage.status'), + title: emojiCode ? `${emojiCode} ${lodashGet(props, 'currentUserPersonalDetails.status.text', '')}` : '', + pageRoute: ROUTES.SETTINGS_STATUS, + }, + ], { description: props.translate('pronounsPage.pronouns'), title: getPronouns(), @@ -184,8 +181,5 @@ export default compose( user: { key: ONYXKEYS.USER, }, - betas: { - key: ONYXKEYS.BETAS, - }, }), )(ProfilePage); diff --git a/src/pages/settings/Wallet/AddDebitCardPage.js b/src/pages/settings/Wallet/AddDebitCardPage.js index 45893dfb5d65..ed4a545ff208 100644 --- a/src/pages/settings/Wallet/AddDebitCardPage.js +++ b/src/pages/settings/Wallet/AddDebitCardPage.js @@ -14,9 +14,7 @@ import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import usePrevious from '@hooks/usePrevious'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import * as ValidationUtils from '@libs/ValidationUtils'; -import NotFoundPage from '@pages/ErrorPage/NotFoundPage'; import useThemeStyles from '@styles/useThemeStyles'; import * as PaymentMethods from '@userActions/PaymentMethods'; import CONST from '@src/CONST'; @@ -28,16 +26,12 @@ const propTypes = { formData: PropTypes.shape({ setupComplete: PropTypes.bool, }), - - /** List of betas available to current user */ - betas: PropTypes.arrayOf(PropTypes.string), }; const defaultProps = { formData: { setupComplete: false, }, - betas: [], }; function DebitCardPage(props) { @@ -104,10 +98,6 @@ function DebitCardPage(props) { return errors; }; - if (!Permissions.canUseWallet(props.betas)) { - return ; - } - return ( nameOnCardRef.current && nameOnCardRef.current.focus()} @@ -212,7 +202,4 @@ export default withOnyx({ formData: { key: ONYXKEYS.FORMS.ADD_DEBIT_CARD_FORM, }, - betas: { - key: ONYXKEYS.BETAS, - }, })(DebitCardPage); diff --git a/src/pages/settings/Wallet/WalletPage/WalletPage.js b/src/pages/settings/Wallet/WalletPage/WalletPage.js index 4ef540f91eef..ecff9af83dbf 100644 --- a/src/pages/settings/Wallet/WalletPage/WalletPage.js +++ b/src/pages/settings/Wallet/WalletPage/WalletPage.js @@ -25,7 +25,6 @@ import compose from '@libs/compose'; import getClickedTargetLocation from '@libs/getClickedTargetLocation'; import Navigation from '@libs/Navigation/Navigation'; import * as PaymentUtils from '@libs/PaymentUtils'; -import Permissions from '@libs/Permissions'; import PaymentMethodList from '@pages/settings/Wallet/PaymentMethodList'; import WalletEmptyState from '@pages/settings/Wallet/WalletEmptyState'; import useTheme from '@styles/themes/useTheme'; @@ -38,7 +37,7 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import {defaultProps, propTypes} from './walletPagePropTypes'; -function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymentMethods, network, shouldListenForResize, userWallet, walletTerms}) { +function WalletPage({bankAccountList, cardList, fundList, isLoadingPaymentMethods, network, shouldListenForResize, userWallet, walletTerms}) { const theme = useTheme(); const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -202,7 +201,7 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen return; } - if (paymentType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT) { + if (paymentType === CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT || paymentType === CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT) { BankAccounts.openPersonalBankAccountSetupView(); return; } @@ -309,7 +308,6 @@ function WalletPage({bankAccountList, betas, cardList, fundList, isLoadingPaymen const shouldShowMakeDefaultButton = !paymentMethod.isSelectedPaymentMethodDefault && - Permissions.canUseWallet(betas) && !(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 @@ -565,9 +563,6 @@ WalletPage.displayName = 'WalletPage'; export default compose( withNetwork(), withOnyx({ - betas: { - key: ONYXKEYS.BETAS, - }, cardList: { key: ONYXKEYS.CARD_LIST, }, diff --git a/src/pages/tasks/NewTaskDescriptionPage.js b/src/pages/tasks/NewTaskDescriptionPage.js index e571edce39e9..002ca2944e52 100644 --- a/src/pages/tasks/NewTaskDescriptionPage.js +++ b/src/pages/tasks/NewTaskDescriptionPage.js @@ -13,7 +13,6 @@ import useAutoFocusInput from '@hooks/useAutoFocusInput'; import * as Browser from '@libs/Browser'; import compose from '@libs/compose'; import Navigation from '@libs/Navigation/Navigation'; -import Permissions from '@libs/Permissions'; import updateMultilineInputRange from '@libs/UpdateMultilineInputRange'; import useThemeStyles from '@styles/useThemeStyles'; import * as Task from '@userActions/Task'; @@ -22,9 +21,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; const propTypes = { - /** Beta features list */ - betas: PropTypes.arrayOf(PropTypes.string), - /** Grab the Share description of the Task */ task: PropTypes.shape({ /** Description of the Task */ @@ -35,7 +31,6 @@ const propTypes = { }; const defaultProps = { - betas: [], task: { description: '', }, @@ -52,10 +47,6 @@ function NewTaskDescriptionPage(props) { Navigation.goBack(ROUTES.NEW_TASK); }; - if (!Permissions.canUseTasks(props.betas)) { - Navigation.dismissModal(); - return null; - } return ( ({ useAnimatedRef: jest.fn, })); -jest.mock('../../src/libs/Permissions', () => ({ - canUseTasks: jest.fn(() => true), -})); - jest.mock('@react-navigation/native', () => { const actualNav = jest.requireActual('@react-navigation/native'); return { diff --git a/tests/perf-test/ReportScreen.perf-test.js b/tests/perf-test/ReportScreen.perf-test.js index f8a44b54cc39..a49aaff4d697 100644 --- a/tests/perf-test/ReportScreen.perf-test.js +++ b/tests/perf-test/ReportScreen.perf-test.js @@ -54,7 +54,6 @@ jest.mock('../../src/hooks/useEnvironment', () => ); jest.mock('../../src/libs/Permissions', () => ({ - canUseTasks: jest.fn(() => true), canUseLinkPreviews: jest.fn(() => true), }));