Skip to content

Commit

Permalink
Merge pull request Expensify#31784 from Expensify/flo_rmBetas
Browse files Browse the repository at this point in the history
Remove released betas
  • Loading branch information
nkuoch authored Nov 24, 2023
2 parents 03d698a + 473a57a commit a2fc32b
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 241 deletions.
9 changes: 0 additions & 9 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,18 +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',
VIOLATIONS: 'violations',
},
BUTTON_STATES: {
Expand Down
26 changes: 8 additions & 18 deletions src/components/AddPaymentMethodMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,

Expand All @@ -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 (
Expand Down Expand Up @@ -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
/>
Expand All @@ -120,9 +113,6 @@ AddPaymentMethodMenu.displayName = 'AddPaymentMethodMenu';
export default compose(
withWindowDimensions,
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
session: {
key: ONYXKEYS.SESSION,
},
Expand Down
7 changes: 1 addition & 6 deletions src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,

Expand All @@ -65,7 +61,6 @@ const defaultProps = {
style: null,
optionItem: null,
isFocused: false,
betas: [],
};

function OptionRowLHN(props) {
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 3 additions & 12 deletions src/components/SettlementButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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: [],
Expand All @@ -113,7 +108,6 @@ function SettlementButton({
addBankAccountRoute,
kycWallAnchorAlignment,
paymentMethodDropdownAnchorAlignment,
betas,
buttonSize,
chatReportID,
currency,
Expand Down Expand Up @@ -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.
Expand All @@ -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) {
Expand Down Expand Up @@ -219,9 +213,6 @@ SettlementButton.displayName = 'SettlementButton';
export default compose(
withNavigation,
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
nvp_lastPaymentMethod: {
key: ONYXKEYS.NVP_LAST_PAYMENT_METHOD,
},
Expand Down
5 changes: 0 additions & 5 deletions src/libs/E2E/apiMocks/beginSignin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const beginSignin = ({email}: SigninParams): Response => ({
validated: true,
},
},
{
onyxMethod: 'set',
key: 'betas',
value: ['passwordless'],
},
],
jsonCode: 200,
requestID: '783e54ef4b38cff5-SJC',
Expand Down
20 changes: 0 additions & 20 deletions src/libs/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -55,13 +39,9 @@ function canUseLinkPreviews(): boolean {

export default {
canUseChronos,
canUsePayWithExpensify,
canUseDefaultRooms,
canUseWallet,
canUseCommentLinking,
canUsePolicyRooms,
canUseTasks,
canUseCustomStatus,
canUseLinkPreviews,
canUseViolations,
};
1 change: 0 additions & 1 deletion src/libs/__mocks__/Permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
1 change: 0 additions & 1 deletion src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -292,9 +291,6 @@ export default compose(
isLoadingReportData: {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
},
betas: {
key: ONYXKEYS.BETAS,
},
session: {
key: ONYXKEYS.SESSION,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -12,19 +11,14 @@ 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 useThemeStyles from '@styles/useThemeStyles';
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 */
Expand Down Expand Up @@ -87,7 +81,6 @@ const propTypes = {
};

const defaultProps = {
betas: [],
reportParticipantIDs: [],
};

Expand All @@ -98,7 +91,6 @@ const defaultProps = {
* @returns {React.Component}
*/
function AttachmentPickerWithMenuItems({
betas,
report,
reportParticipantIDs,
displayFileInModal,
Expand Down Expand Up @@ -152,7 +144,7 @@ function AttachmentPickerWithMenuItems({
* @returns {Boolean}
*/
const taskOption = useMemo(() => {
if (!Permissions.canUseTasks(betas) || !ReportUtils.canCreateTaskInReport(report)) {
if (!ReportUtils.canCreateTaskInReport(report)) {
return [];
}

Expand All @@ -163,7 +155,7 @@ function AttachmentPickerWithMenuItems({
onSelected: () => Task.clearOutTaskInfoAndNavigate(reportID),
},
];
}, [betas, report, reportID, translate]);
}, [report, reportID, translate]);

const onPopoverMenuClose = () => {
setMenuVisibility(false);
Expand Down Expand Up @@ -287,8 +279,4 @@ AttachmentPickerWithMenuItems.propTypes = propTypes;
AttachmentPickerWithMenuItems.defaultProps = defaultProps;
AttachmentPickerWithMenuItems.displayName = 'AttachmentPickerWithMenuItems';

export default withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
})(AttachmentPickerWithMenuItems);
export default AttachmentPickerWithMenuItems;
Loading

0 comments on commit a2fc32b

Please sign in to comment.