Skip to content

Commit

Permalink
Merge branch 'main' into form-migration/EditRequestMerchantPage
Browse files Browse the repository at this point in the history
merge main into form-migration/EditRequestMerchantPage
  • Loading branch information
cdOut committed Nov 23, 2023
2 parents a2b671a + 4952c39 commit 0e44f75
Show file tree
Hide file tree
Showing 81 changed files with 1,042 additions and 818 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ jobs:
- name: Check for new JavaScript files
run: |
git fetch origin main --no-tags --depth=1
count_new_js=$(git diff --name-only --diff-filter=A origin/main HEAD -- 'src/libs/*.js' 'src/hooks/*.js' 'src/styles/*.js' 'src/languages/*.js' | wc -l)
# Explanation:
# - comm is used to get the intersection between two bash arrays
# - git diff is used to see the files that were added on this branch
# - gh pr view is used to list files touched by this PR. Git diff may give false positives if the branch isn't up-to-date with main
# - wc counts the words in the result of the intersection
count_new_js=$(comm -1 -2 <(git diff --name-only --diff-filter=A origin/main HEAD -- 'src/libs/*.js' 'src/hooks/*.js' 'src/styles/*.js' 'src/languages/*.js') <(gh pr view ${{ github.event.pull_request.number }} --json files | jq -r '.files | map(.path) | .[]') | wc -l)
if [ "$count_new_js" -gt "0" ]; then
echo "ERROR: Found new JavaScript files in the /src/libs, /src/hooks, /src/styles, or /src/languages directories; use TypeScript instead."
exit 1
fi
env:
GITHUB_TOKEN: ${{ github.token }}
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001040200
versionName "1.4.2-0"
versionCode 1001040203
versionName "1.4.2-3"
}

flavorDimensions "default"
Expand Down
Binary file modified docs/assets/images/ExpensifyHelp_CloseAccount_Desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.4.2.0</string>
<string>1.4.2.3</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.4.2.0</string>
<string>1.4.2.3</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = {
},
testEnvironment: 'jsdom',
setupFiles: ['<rootDir>/jest/setup.js', './node_modules/@react-native-google-signin/google-signin/jest/build/setup.js'],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', '<rootDir>/jest/setupAfterEnv.js'],
setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect', '<rootDir>/jest/setupAfterEnv.js', '<rootDir>/tests/perf-test/setupAfterEnv.js'],
cacheDirectory: '<rootDir>/.jest-cache',
moduleNameMapper: {
'\\.(lottie)$': '<rootDir>/__mocks__/fileMock.js',
Expand Down
54 changes: 2 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.4.2-0",
"version": "1.4.2-3",
"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.",
Expand Down Expand Up @@ -100,7 +100,6 @@
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#ee14b3255da33d2b6924c357f43393251b6dc6d2",
"fbjs": "^3.0.2",
"focus-trap-react": "^10.2.1",
"htmlparser2": "^7.2.0",
"idb-keyval": "^6.2.1",
"jest-when": "^3.5.2",
Expand Down
15 changes: 14 additions & 1 deletion src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ const CONST = {
CREATED: 'CREATED',
IOU: 'IOU',
MODIFIEDEXPENSE: 'MODIFIEDEXPENSE',
MOVED: 'MOVED',
REIMBURSEMENTQUEUED: 'REIMBURSEMENTQUEUED',
RENAMED: 'RENAMED',
REPORTPREVIEW: 'REPORTPREVIEW',
Expand Down Expand Up @@ -1188,7 +1189,8 @@ const CONST = {

PAYMENT_METHODS: {
DEBIT_CARD: 'debitCard',
BANK_ACCOUNT: 'bankAccount',
PERSONAL_BANK_ACCOUNT: 'bankAccount',
BUSINESS_BANK_ACCOUNT: 'businessBankAccount',
},

PAYMENT_METHOD_ID_KEYS: {
Expand Down Expand Up @@ -1278,7 +1280,11 @@ const CONST = {
TYPE: {
FREE: 'free',
PERSONAL: 'personal',

// Often referred to as "control" workspaces
CORPORATE: 'corporate',

// Often referred to as "collect" workspaces
TEAM: 'team',
},
ROLE: {
Expand Down Expand Up @@ -2901,6 +2907,13 @@ const CONST = {
},

BACK_BUTTON_NATIVE_ID: 'backButton',

/**
* Performance test setup - run the same test multiple times to get a more accurate result
*/
PERFORMANCE_TESTS: {
RUNS: 20,
},
} as const;

export default CONST;
73 changes: 53 additions & 20 deletions src/components/AddPaymentMethodMenu.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import lodashGet from 'lodash/get';
import PropTypes from 'prop-types';
import React from 'react';
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';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import * as Expensicons from './Icon/Expensicons';
import PopoverMenu from './PopoverMenu';
import refPropTypes from './refPropTypes';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import withWindowDimensions from './withWindowDimensions';

const propTypes = {
Expand All @@ -19,6 +23,12 @@ const propTypes = {
/** Callback to execute when the component closes. */
onClose: PropTypes.func.isRequired,

/** Callback to execute when the payment method is selected. */
onItemSelected: PropTypes.func.isRequired,

/** The IOU/Expense report we are paying */
iouReport: iouReportPropTypes,

/** Anchor position for the AddPaymentMenu. */
anchorPosition: PropTypes.shape({
horizontal: PropTypes.number,
Expand All @@ -37,42 +47,63 @@ const propTypes = {
/** Popover anchor ref */
anchorRef: refPropTypes,

...withLocalizePropTypes,
/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user accountID */
accountID: PropTypes.number,
}),
};

const defaultProps = {
iouReport: {},
anchorPosition: {},
anchorAlignment: {
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.BOTTOM,
},
betas: [],
anchorRef: () => {},
session: {},
};

function AddPaymentMethodMenu(props) {
function AddPaymentMethodMenu({isVisible, onClose, anchorPosition, anchorAlignment, anchorRef, iouReport, onItemSelected, session, betas}) {
const {translate} = useLocalize();

return (
<PopoverMenu
isVisible={props.isVisible}
onClose={props.onClose}
anchorPosition={props.anchorPosition}
anchorAlignment={props.anchorAlignment}
anchorRef={props.anchorRef}
onItemSelected={props.onClose}
isVisible={isVisible}
onClose={onClose}
anchorPosition={anchorPosition}
anchorAlignment={anchorAlignment}
anchorRef={anchorRef}
onItemSelected={onClose}
menuItems={[
{
text: props.translate('common.bankAccount'),
icon: Expensicons.Bank,
onSelected: () => {
props.onItemSelected(CONST.PAYMENT_METHODS.BANK_ACCOUNT);
},
},
...(Permissions.canUseWallet(props.betas)
...(ReportUtils.isIOUReport(iouReport)
? [
{
text: props.translate('common.debitCard'),
text: translate('common.personalBankAccount'),
icon: Expensicons.Bank,
onSelected: () => {
onItemSelected(CONST.PAYMENT_METHODS.PERSONAL_BANK_ACCOUNT);
},
},
]
: []),
...(!ReportActionsUtils.hasRequestFromCurrentAccount(lodashGet(iouReport, 'reportID', 0), lodashGet(session, 'accountID', 0))
? [
{
text: translate('common.businessBankAccount'),
icon: Expensicons.Building,
onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.BUSINESS_BANK_ACCOUNT),
},
]
: []),
...(Permissions.canUseWallet(betas)
? [
{
text: translate('common.debitCard'),
icon: Expensicons.CreditCard,
onSelected: () => props.onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD),
onSelected: () => onItemSelected(CONST.PAYMENT_METHODS.DEBIT_CARD),
},
]
: []),
Expand All @@ -88,10 +119,12 @@ AddPaymentMethodMenu.displayName = 'AddPaymentMethodMenu';

export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
betas: {
key: ONYXKEYS.BETAS,
},
session: {
key: ONYXKEYS.SESSION,
},
}),
)(AddPaymentMethodMenu);
Loading

0 comments on commit 0e44f75

Please sign in to comment.