Skip to content

Commit

Permalink
Merge pull request #5692 from Expensify/update-staging-from-main
Browse files Browse the repository at this point in the history
  • Loading branch information
OSBotify authored Oct 6, 2021
2 parents 0face0e + c066d3c commit 155aca4
Show file tree
Hide file tree
Showing 26 changed files with 211 additions and 103 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001010501
versionName "1.1.5-1"
versionCode 1001010502
versionName "1.1.5-2"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.5.1</string>
<string>1.1.5.2</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.1.5.1</string>
<string>1.1.5.2</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.1.5-1",
"version": "1.1.5-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.",
Expand Down
8 changes: 7 additions & 1 deletion src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ const CONST = {
VERIFYING: 'VERIFYING',
PENDING: 'PENDING',
},
MAX_LENGTH: {
TAX_ID_NUMBER: 9,
SSN: 4,
ZIP_CODE: 5,
},
},
INCORPORATION_TYPES: {
LLC: 'LLC',
Expand Down Expand Up @@ -420,11 +425,12 @@ const CONST = {
LARGE: 'large',
DEFAULT: 'default',
},

PHONE_MAX_LENGTH: 15,
REGEX: {
US_PHONE: /^\+1\d{10}$/,
DIGITS_AND_PLUS: /^\+?[0-9]*$/,
PHONE_E164_PLUS: /^\+?[1-9]\d{1,14}$/,
PHONE_WITH_SPECIAL_CHARS: /^[+]*[(]{0,1}[0-9]{1,3}[)]{0,1}[-\s\\./0-9]{0,12}$/,
NON_ALPHA_NUMERIC: /[^A-Za-z0-9+]/g,
PO_BOX: /\b[P|p]?(OST|ost)?\.?\s*[O|o|0]?(ffice|FFICE)?\.?\s*[B|b][O|o|0]?[X|x]?\.?\s+[#]?(\d+)\b/,
ANY_VALUE: /^.+$/,
Expand Down
14 changes: 11 additions & 3 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import ExpensiPicker from './ExpensiPicker';
import Text from './Text';
import * as ReimbursementAccountUtils from '../libs/ReimbursementAccountUtils';
import ReimbursementAccountForm from '../pages/ReimbursementAccount/ReimbursementAccountForm';
import getBankIcon from './Icon/BankIcons';
import Icon from './Icon';
import variables from '../styles/variables';

const propTypes = {
...withLocalizePropTypes,
Expand Down Expand Up @@ -177,9 +180,14 @@ class AddPlaidBankAccount extends React.Component {
{!_.isEmpty(this.props.text) && (
<Text style={[styles.mb5]}>{this.props.text}</Text>
)}
{/* @TODO there are a bunch of logos to incorporate here to replace this name
https://d2k5nsl2zxldvw.cloudfront.net/images/plaid/[email protected] */}
<Text style={[styles.mb5, styles.h1]}>{this.state.institution.name}</Text>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb5]}>
<Icon
src={getBankIcon(this.state.institution.name).icon}
height={variables.avatarSizeNormal}
width={variables.avatarSizeNormal}
/>
<Text style={[styles.ml3, styles.textStrong]}>{this.state.institution.name}</Text>
</View>
<View style={[styles.mb5]}>
<ExpensiPicker
label={this.props.translate('addPersonalBankAccountPage.chooseAccountLabel')}
Expand Down
15 changes: 9 additions & 6 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
continue: 'Continue',
firstName: 'First name',
lastName: 'Last name',
phone: 'Phone',
phoneNumber: 'Phone number',
email: 'Email',
and: 'and',
Expand Down Expand Up @@ -376,8 +377,10 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'Link has been re-sent',
weSentYouMagicSignInLink: ({loginType}) => `We've sent a magic sign in link to your ${loginType}.`,
weSentYouMagicSignInLink: ({login}) => `We've sent a magic sign in link to ${login}. Check your Inbox and your Spam folder and wait 5-10 minutes before trying again.`,
resendLink: 'Resend link',
unvalidatedAccount: 'This account exists but isn\'t validated, please check your inbox for your magic link.',
newAccount: ({login, loginType}) => `Welcome ${login}, it's always great to see a new face around here! Please check your ${loginType} for a magic link to validate your account.`,
},
detailsPage: {
localTime: 'Local time',
Expand Down Expand Up @@ -414,7 +417,7 @@ export default {
checkHelpLine: 'Your routing number and account number can be found on a check for the account.',
validateAccountError: 'In order to finish setting up your bank account, you must validate your account. Please check your email to validate your account, and return here to finish up!',
hasPhoneLoginError: 'To add a verified bank account please ensure your primary login is a valid email and try again. You can add your phone number as a secondary login.',
hasBeenThrottledError: ({fromNow}) => `For security reasons, we're taking a break from bank account setup so you can double-check your company information. Please try again ${fromNow}. Sorry!`,
hasBeenThrottledError: 'There was an error adding your bank account. Please wait a few minutes and try again.',
buttonConfirm: 'Got it',
error: {
noBankAccountAvailable: 'Sorry, no bank account is available',
Expand Down Expand Up @@ -568,7 +571,7 @@ export default {
confirmCompanyIsNot: 'I confirm that this company is not on the',
listOfRestrictedBusinesses: 'list of restricted businesses',
incorporationDatePlaceholder: 'Start date (yyyy-mm-dd)',
companyPhonePlaceholder: '10 digits, no hyphens',
companyPhonePlaceholder: 'Phone Number (xxx)xxx-xxxx',
},
requestorStep: {
headerTitle: 'Personal information',
Expand Down Expand Up @@ -629,7 +632,7 @@ export default {
},
people: {
genericFailureMessage: 'An error occurred removing a user from the workspace, please try again.',
removeMembersPrompt: 'Are you sure you want to remove the selected people from your workspace?',
removeMembersPrompt: 'Are you sure you want to remove the selected members from your workspace?',
removeMembersTitle: 'Remove members',
selectAll: 'Select all',
},
Expand All @@ -644,8 +647,8 @@ export default {
cardReadyTagline: 'Your Expensify Cards are ready to go!',
},
invite: {
invitePeople: 'Invite people',
invitePeoplePrompt: 'Invite colleagues to your workspace.',
invitePeople: 'Invite new members',
invitePeoplePrompt: 'Invite new members to your workspace.',
personalMessagePrompt: 'Add a personal message (optional)',
enterEmailOrPhone: 'Emails or phone numbers',
EmailOrPhonePlaceholder: 'Enter comma-separated list of emails or phone numbers',
Expand Down
15 changes: 9 additions & 6 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default {
continue: 'Continuar',
firstName: 'Primer nombre',
lastName: 'Apellido',
phone: 'teléfono',
phoneNumber: 'Número de teléfono',
email: 'Email',
and: 'y',
Expand Down Expand Up @@ -376,8 +377,10 @@ export default {
},
resendValidationForm: {
linkHasBeenResent: 'El enlace se ha reenviado',
weSentYouMagicSignInLink: ({loginType}) => `Hemos enviado un enlace mágico de inicio de sesión a tu ${loginType}.`,
weSentYouMagicSignInLink: ({login}) => `Hemos enviado un enlace mágico de inicio de sesión a ${login}. Verifica tu bandeja de entrada y tu carpeta de correo no deseado y espera de 5 a 10 minutos antes de intentarlo de nuevo.`,
resendLink: 'Reenviar enlace',
unvalidatedAccount: 'Esta cuenta existe pero no está validada, por favor busca el enlace mágico en tu bandeja de entrada',
newAccount: ({login, loginType}) => `¡Bienvenido ${login}, es genial ver una cara nueva por aquí! En tu ${loginType} encontrarás un enlace para validar tu cuenta, por favor, revísalo`,
},
detailsPage: {
localTime: 'Hora local',
Expand Down Expand Up @@ -414,7 +417,7 @@ export default {
checkHelpLine: 'Su número de ruta y número de cuenta se pueden encontrar en un cheque de la cuenta bancaria.',
validateAccountError: 'Para terminar de configurar tu cuenta bancaria, debes validar tu cuenta de Expensify. Por favor revisa tu correo electrónico para validar tu cuenta y regresa aquí para continuar.',
hasPhoneLoginError: 'Para agregar una cuenta bancaria verificada, asegúrate de que tu nombre de usuario principal sea un correo electrónico válido y vuelve a intentarlo. Puedes agregar tu número de teléfono como nombre de usuario secundario.',
hasBeenThrottledError: ({fromNow}) => `Por razones de seguridad, nos tomamos un descanso en la configuración de la cuenta bancaria para que pueda verificar la información de su empresa. Inténtalo de nuevo ${fromNow}. ¡Lo siento!`,
hasBeenThrottledError: 'Se produjo un error al intentar agregar tu cuenta bancaria. Por favor, espera unos minutos e inténtalo de nuevo.',
buttonConfirm: 'OK',
error: {
noBankAccountAvailable: 'Lo sentimos, no hay ninguna cuenta bancaria disponible',
Expand Down Expand Up @@ -570,7 +573,7 @@ export default {
confirmCompanyIsNot: 'Confirmo que esta empresa no está en el',
listOfRestrictedBusinesses: 'lista de negocios restringidos',
incorporationDatePlaceholder: 'Fecha de inicio (aaaa-mm-dd)',
companyPhonePlaceholder: '10 dígitos, sin guiones',
companyPhonePlaceholder: '(prefijo) + (número)',
},
requestorStep: {
headerTitle: 'Información personal',
Expand Down Expand Up @@ -631,7 +634,7 @@ export default {
},
people: {
genericFailureMessage: 'Se ha producido un error al intentar eliminar a un usuario del espacio de trabajo. Por favor inténtalo más tarde.',
removeMembersPrompt: '¿Estás seguro que quieres eliminar a las personas seleccionadas de tu espacio de trabajo?',
removeMembersPrompt: '¿Estás seguro que quieres eliminar a los miembros seleccionados de tu espacio de trabajo?',
removeMembersTitle: 'Eliminar miembros',
selectAll: 'Seleccionar todo',
},
Expand All @@ -646,8 +649,8 @@ export default {
cardReadyTagline: 'Tus tarjetas Expensify están listas para usar!',
},
invite: {
invitePeople: 'Invitar a la gente',
invitePeoplePrompt: 'Invita a tus compañeros a tu espacio de trabajo.',
invitePeople: 'Invitar nuevos miembros',
invitePeoplePrompt: 'Invita nuevos miembros a tu espacio de trabajo.',
personalMessagePrompt: 'Agregar un mensaje personal (Opcional)',
enterEmailOrPhone: 'Correos electrónicos o números de teléfono',
EmailOrPhonePlaceholder: 'Introduce una lista de correos electrónicos o números de teléfono separado por comas',
Expand Down
31 changes: 23 additions & 8 deletions src/libs/ValidationUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ function isValidAddress(value) {
* @returns {Boolean} true if valid
*/
function isValidDate(date) {
if (!date) {
return false;
}

const pastDate = moment().subtract(1000, 'years');
const futureDate = moment().add(1000, 'years');
const testDate = moment(date);
Expand Down Expand Up @@ -146,6 +150,14 @@ function meetsAgeRequirements(date) {

/**
*
* @param {String} phoneNumber
* @returns {Boolean}
*/
function isValidPhoneWithSpecialChars(phoneNumber) {
return CONST.REGEX.PHONE_WITH_SPECIAL_CHARS.test(phoneNumber) && phoneNumber.length <= CONST.PHONE_MAX_LENGTH;
}

/**
* @param {String} url
* @returns {Boolean}
*/
Expand All @@ -158,17 +170,19 @@ function isValidURL(url) {
* @returns {Object}
*/
function validateIdentity(identity) {
const requiredFields = ['firstName', 'lastName', 'street', 'city', 'zipCode', 'state', 'ssnLast4', 'dob'];
const errors = {};
if (!isValidAddress(identity.street)) {
errors.street = true;
}

if (!isRequiredFulfilled(identity.state)) {
errors.state = true;
}
// Check that all required fields are filled
_.each(requiredFields, (fieldName) => {
if (isRequiredFulfilled(identity[fieldName])) {
return;
}
errors[fieldName] = true;
});

if (!isRequiredFulfilled(identity.city)) {
errors.city = true;
if (!isValidAddress(identity.street)) {
errors.street = true;
}

if (!isValidZipCode(identity.zipCode)) {
Expand Down Expand Up @@ -208,6 +222,7 @@ export {
isValidIndustryCode,
isValidZipCode,
isRequiredFulfilled,
isValidPhoneWithSpecialChars,
isValidUSPhone,
isValidURL,
validateIdentity,
Expand Down
14 changes: 11 additions & 3 deletions src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import TextLink from '../../components/TextLink';
import StatePicker from '../../components/StatePicker';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import {
isValidAddress, isValidDate, isValidZipCode, isRequiredFulfilled, isValidURL,
isValidAddress, isValidDate, isValidZipCode, isRequiredFulfilled, isValidPhoneWithSpecialChars, isValidURL,
} from '../../libs/ValidationUtils';
import compose from '../../libs/compose';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down Expand Up @@ -145,6 +145,10 @@ class CompanyStep extends React.Component {
errors.incorporationDate = true;
}

if (!isValidPhoneWithSpecialChars(this.state.companyPhone)) {
errors.companyPhone = true;
}

_.each(this.requiredFields, (inputKey) => {
if (!isRequiredFulfilled(this.state[inputKey])) {
errors[inputKey] = true;
Expand Down Expand Up @@ -218,10 +222,11 @@ class CompanyStep extends React.Component {
<ExpensiTextInput
label={this.props.translate('common.zip')}
containerStyles={[styles.mt4]}
keyboardType={CONST.KEYBOARD_TYPE.PHONE_PAD}
keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
onChangeText={value => this.clearErrorAndSetValue('addressZipCode', value)}
value={this.state.addressZipCode}
errorText={this.getErrorText('addressZipCode')}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
/>
<ExpensiTextInput
label={this.props.translate('common.phoneNumber')}
Expand All @@ -231,6 +236,8 @@ class CompanyStep extends React.Component {
value={this.state.companyPhone}
placeholder={this.props.translate('companyStep.companyPhonePlaceholder')}
errorText={this.getErrorText('companyPhone')}
maxLength={CONST.PHONE_MAX_LENGTH}

/>
<ExpensiTextInput
label={this.props.translate('companyStep.companyWebsite')}
Expand All @@ -242,12 +249,13 @@ class CompanyStep extends React.Component {
<ExpensiTextInput
label={this.props.translate('companyStep.taxIDNumber')}
containerStyles={[styles.mt4]}
keyboardType={CONST.KEYBOARD_TYPE.PHONE_PAD}
keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
onChangeText={value => this.clearErrorAndSetValue('companyTaxID', value)}
value={this.state.companyTaxID}
disabled={shouldDisableCompanyTaxID}
placeholder={this.props.translate('companyStep.taxIDNumberPlaceholder')}
errorText={this.getErrorText('companyTaxID')}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.TAX_ID_NUMBER}
/>
<View style={styles.mt4}>
<ExpensiPicker
Expand Down
6 changes: 4 additions & 2 deletions src/pages/ReimbursementAccount/IdentityForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ const IdentityForm = ({
<ExpensiTextInput
label={`${translate('common.ssnLast4')}`}
containerStyles={[styles.mt4]}
keyboardType={CONST.KEYBOARD_TYPE.PHONE_PAD}
keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
value={ssnLast4}
onChangeText={value => onFieldChange('ssnLast4', value)}
errorText={errors.ssnLast4 ? translate('bankAccount.error.ssnLast4') : ''}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.SSN}
/>
<ExpensiTextInput
label={translate('common.personalAddress')}
Expand Down Expand Up @@ -145,10 +146,11 @@ const IdentityForm = ({
<ExpensiTextInput
label={translate('common.zip')}
containerStyles={[styles.mt4]}
keyboardType={CONST.KEYBOARD_TYPE.PHONE_PAD}
keyboardType={CONST.KEYBOARD_TYPE.NUMERIC}
value={zipCode}
onChangeText={value => onFieldChange('zipCode', value)}
errorText={errors.zipCode ? translate('bankAccount.error.zipCode') : ''}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
/>
</View>
);
Expand Down
20 changes: 7 additions & 13 deletions src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import moment from 'moment';
import lodashGet from 'lodash/get';
import React from 'react';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -161,18 +160,13 @@ class ReimbursementAccountPage extends React.Component {

const throttledDate = lodashGet(this.props, 'reimbursementAccount.throttledDate');
if (throttledDate) {
const throttledEnd = moment().add(24, 'hours');
if (moment() < throttledEnd) {
errorComponent = (
<View style={[styles.m5]}>
<Text>
{this.props.translate('bankAccount.hasBeenThrottledError', {
fromNow: throttledEnd.fromNow(),
})}
</Text>
</View>
);
}
errorComponent = (
<View style={[styles.m5]}>
<Text>
{this.props.translate('bankAccount.hasBeenThrottledError')}
</Text>
</View>
);
}

if (errorComponent) {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ class RequestorStep extends React.Component {
*/
validate() {
const errors = validateIdentity({
firstName: this.state.firstName,
lastName: this.state.lastName,
street: this.state.requestorAddressStreet,
state: this.state.requestorAddressState,
city: this.state.requestorAddressCity,
Expand Down
Loading

0 comments on commit 155aca4

Please sign in to comment.