Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor identity form #12252

Merged
merged 6 commits into from
Nov 4, 2022
Merged

Conversation

mollfpr
Copy link
Contributor

@mollfpr mollfpr commented Oct 28, 2022

Details

  • Fix Datepicker doesn't show the value
  • Refactor IdentityForm
    • Remove withLocalize HOC and use the passed translate props from the parent component
    • Adding new props inputKeys and shouldSaveDraft for Form.js usage
    • Updating the inputs passing inputKeys according to the key name and shouldSaveDraft for Form.js usage
  • Updating the component that uses IdentityForm to pass translate props
Example IdentityForm usage with Form.js
import React from 'react';
import lodashGet from 'lodash/get';
import {View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
import moment from 'moment';
import PropTypes from 'prop-types';
import styles from '../../styles/styles';
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize';
import HeaderWithCloseButton from '../../components/HeaderWithCloseButton';
import CONST from '../../CONST';
import TextLink from '../../components/TextLink';
import Navigation from '../../libs/Navigation/Navigation';
import CheckboxWithLabel from '../../components/CheckboxWithLabel';
import Text from '../../components/Text';
import * as BankAccounts from '../../libs/actions/BankAccounts';
import IdentityForm from './IdentityForm';
import * as ValidationUtils from '../../libs/ValidationUtils';
import compose from '../../libs/compose';
import ONYXKEYS from '../../ONYXKEYS';
import * as ReimbursementAccountUtils from '../../libs/ReimbursementAccountUtils';
import reimbursementAccountPropTypes from './reimbursementAccountPropTypes';
import reimbursementAccountDraftPropTypes from './ReimbursementAccountDraftPropTypes';
import * as Link from '../../libs/actions/Link';
import RequestorOnfidoStep from './RequestorOnfidoStep';
import Form from '../../components/Form';

const propTypes = {
/** The bank account currently in setup */
reimbursementAccount: reimbursementAccountPropTypes.isRequired,

/** The draft values of the bank account being setup */
/* eslint-disable-next-line react/no-unused-prop-types */
reimbursementAccountDraft: reimbursementAccountDraftPropTypes.isRequired,

/** The token required to initialize the Onfido SDK */
onfidoToken: PropTypes.string,

...withLocalizePropTypes,

};

const defaultProps = {
onfidoToken: '',
};

class RequestorStep extends React.Component {
constructor(props) {
super(props);

    this.validate = this.validate.bind(this);
    this.submit = this.submit.bind(this);
    this.clearErrorsAndSetValues = this.clearErrorsAndSetValues.bind(this);
    this.setOnfidoAsComplete = this.setOnfidoAsComplete.bind(this);

    this.state = {
        isOnfidoSetupComplete: lodashGet(props, ['achData', 'isOnfidoSetupComplete'], false),
    };

    // Required fields not validated by `validateIdentity`
    this.requiredFields = [
        'isControllingOfficer',
    ];

    // Map a field to the key of the error's translation
    this.errorTranslationKeys = {
        firstName: 'bankAccount.error.firstName',
        lastName: 'bankAccount.error.lastName',
        isControllingOfficer: 'requestorStep.isControllingOfficerError',
    };

    this.clearError = inputKey => ReimbursementAccountUtils.clearError(this.props, inputKey);
    this.clearErrors = inputKeys => ReimbursementAccountUtils.clearErrors(this.props, inputKeys);
    this.getErrors = () => ReimbursementAccountUtils.getErrors(this.props);
}

/**
 * Update state to indicate that the user has completed the Onfido verification process
 */
setOnfidoAsComplete() {
    this.setState({isOnfidoSetupComplete: true});
}

/**
 * Clear the errors associated to keys in values if found and store the new values in the state.
 *
 * @param {Object} values
 */
clearErrorsAndSetValues(values) {
    const renamedFields = {
        street: 'requestorAddressStreet',
        city: 'requestorAddressCity',
        state: 'requestorAddressState',
        zipCode: 'requestorAddressZipCode',
    };
    const newState = {};
    _.each(values, (value, inputKey) => {
        const renamedInputKey = lodashGet(renamedFields, inputKey, inputKey);
        newState[renamedInputKey] = value;
    });
    this.setState(newState);
    BankAccounts.updateReimbursementAccountDraft(newState);

    // Prepare inputKeys for clearing errors
    const inputKeys = _.keys(values);

    // dob field has multiple validations/errors, we are handling it temporarily like this.
    if (_.contains(inputKeys, 'dob')) {
        inputKeys.push('dobAge');
    }
    this.clearErrors(inputKeys);
}

/**
 * @param {Object} values
 * @returns {Object}
 */
validate(values) {
    const errors = {};

    if (!values.firstName) {
        errors.firstName = this.props.translate('bankAccount.error.firstName');
    }

    if (!values.lastName) {
        errors.lastName = this.props.translate('bankAccount.error.lastName');
    }

    if (!values.requestorAddressStreet || !ValidationUtils.isValidAddress(values.requestorAddressStreet)) {
        errors.requestorAddressStreet = this.props.translate('bankAccount.error.addressStreet');
    }

    if (!values.requestorAddressCity) {
        errors.requestorAddressCity = this.props.translate('bankAccount.error.addressCity');
    }

    if (!values.requestorAddressState) {
        errors.requestorAddressState = this.props.translate('bankAccount.error.addressState');
    }

    if (!values.requestorAddressZipCode || !ValidationUtils.isValidZipCode(values.requestorAddressZipCode)) {
        errors.requestorAddressZipCode = this.props.translate('bankAccount.error.zipCode');
    }

    if (!values.dob || !ValidationUtils.isValidDate(values.dob)) {
        errors.dob = this.props.translate('bankAccount.error.dob');
    }

    if (values.dob && !ValidationUtils.meetsAgeRequirements(values.dob)) {
        errors.dob = this.props.translate('bankAccount.error.age');
    }

    if (!values.ssnLast4 || !ValidationUtils.isValidSSNLastFour(values.ssnLast4)) {
        errors.ssnLast4 = this.props.translate('bankAccount.error.ssnLast4');
    }

    if (!values.isControllingOfficer) {
        errors.isControllingOfficer = this.props.translate('requestorStep.isControllingOfficerError');
    }

    return errors;
}

submit(values) {
    const payload = {
        bankAccountID: ReimbursementAccountUtils.getDefaultStateForField(this.props, 'bankAccountID', 0),
        ...values,
        dob: moment(values.dob).format(CONST.DATE.MOMENT_FORMAT_STRING),
    };

    BankAccounts.updatePersonalInformationForBankAccount(payload);
}

render() {
    const achData = this.props.reimbursementAccount.achData;
    const shouldShowOnfido = achData.useOnfido && this.props.onfidoToken && !this.state.isOnfidoSetupComplete;

    return (
        <>
            <HeaderWithCloseButton
                title={this.props.translate('requestorStep.headerTitle')}
                stepCounter={{step: 3, total: 5}}
                shouldShowGetAssistanceButton
                guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT}
                shouldShowBackButton
                onBackButtonPress={() => {
                    if (shouldShowOnfido) {
                        BankAccounts.clearOnfidoToken();
                    } else {
                        BankAccounts.goToWithdrawalAccountSetupStep(CONST.BANK_ACCOUNT.STEP.COMPANY);
                    }
                }}
                onCloseButtonPress={Navigation.dismissModal}
            />
            {shouldShowOnfido ? (
                <RequestorOnfidoStep
                    onComplete={this.setOnfidoAsComplete}
                />
            ) : (
                <Form
                    formID="requestorStepForm"
                    submitButtonText={this.props.translate('common.saveAndContinue')}
                    validate={this.validate}
                    onSubmit={this.submit}
                    style={[styles.mh5, styles.flexGrow1]}
                >
                    <Text>{this.props.translate('requestorStep.subtitle')}</Text>
                    <View style={[styles.mb5, styles.mt1, styles.dFlex, styles.flexRow]}>
                        <TextLink
                            style={[styles.textMicro]}
                            // eslint-disable-next-line max-len
                            href="https://community.expensify.com/discussion/6983/faq-why-do-i-need-to-provide-personal-documentation-when-setting-up-updating-my-bank-account"
                        >
                            {`${this.props.translate('requestorStep.learnMore')}`}
                        </TextLink>
                        <Text style={[styles.textMicroSupporting]}>{' | '}</Text>
                        <TextLink
                            style={[styles.textMicro, styles.textLink]}
                            // eslint-disable-next-line max-len
                            href="https://community.expensify.com/discussion/5677/deep-dive-security-how-expensify-protects-your-information"
                        >
                            {`${this.props.translate('requestorStep.isMyDataSafe')}`}
                        </TextLink>
                    </View>
                    <IdentityForm
                        translate={this.props.translate}
                        inputKeys={{
                            firstName: 'firstName',
                            lastName: 'lastName',
                            dob: 'dob',
                            ssnLast4: 'ssnLast4',
                            street: 'requestorAddressStreet',
                            city: 'requestorAddressCity',
                            state: 'requestorAddressState',
                            zipCode: 'requestorAddressZipCode',
                        }}
                        shouldSaveDraft
                    />
                    <CheckboxWithLabel
                        inputID="isControllingOfficer"
                        LabelComponent={() => (
                            <View style={[styles.flex1, styles.pr1]}>
                                <Text>
                                    {this.props.translate('requestorStep.isControllingOfficer')}
                                </Text>
                            </View>
                        )}
                        style={[styles.mt4]}
                        shouldSaveDraft
                    />
                    <Text style={[styles.mt3, styles.textMicroSupporting]}>
                        {this.props.translate('requestorStep.onFidoConditions')}
                        <Text
                            onPress={() => Link.openExternalLink('https://onfido.com/facial-scan-policy-and-release/')}
                            style={[styles.textMicro, styles.link]}
                            accessibilityRole="link"
                        >
                            {`${this.props.translate('onfidoStep.facialScan')}`}
                        </Text>
                        {', '}
                        <Text
                            onPress={() => Link.openExternalLink('https://onfido.com/privacy/')}
                            style={[styles.textMicro, styles.link]}
                            accessibilityRole="link"
                        >
                            {`${this.props.translate('common.privacyPolicy')}`}
                        </Text>
                        {` ${this.props.translate('common.and')} `}
                        <Text
                            onPress={() => Link.openExternalLink('https://onfido.com/terms-of-service/')}
                            style={[styles.textMicro, styles.link]}
                            accessibilityRole="link"
                        >
                            {`${this.props.translate('common.termsOfService')}`}
                        </Text>
                    </Text>
                </Form>
            )}
        </>
    );
}

}

RequestorStep.propTypes = propTypes;
RequestorStep.defaultProps = defaultProps;

export default compose(
withLocalize,
withOnyx({
reimbursementAccount: {
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT,
},
onfidoToken: {
key: ONYXKEYS.ONFIDO_TOKEN,
},
reimbursementAccountDraft: {
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT,
},
}),
)(RequestorStep);

Fixed Issues

$ #10729
$ #10729 (comment)

Tests

  1. Open a form that uses IdentityForm for example RequestorStep form
  2. Go to Workspace > Connect bank account > Connect Manually > Connect Bank Account > Company Information > Personal Information
  3. Verified that the UI is not changed on First Name, Last Name, Date of Birth, Last 4 digits SSN, Address, City, State, Zip Code and Controlling Officer Checkbox inputs.
  4. Verified that the validation is working for the above inputs
  5. Verified that the form successfully submit and the value of the above input is saved
  • Verify that no errors appear in the JS console

QA Steps

  1. Open a form that uses IdentityForm for example RequestorStep form
  2. Go to Workspace > Connect bank account > Connect Manually > Connect Bank Account > Company Information > Personal Information
  3. Verified that the UI is not changed on First Name, Last Name, Date of Birth, Last 4 digits SSN, Address, City, State, Zip Code and Controlling Officer Checkbox inputs.
  4. Verified that the validation is working for the above inputs
  5. Verified that the form successfully submit and the value of the above input is saved
  • Verify that no errors appear in the JS console

PR Review Checklist

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

PR Reviewer Checklist

The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots

Web

Refactor.IdentityForm.Web.mov

Mobile Web - Chrome

Refactor.IdentityForm.mWeb-Chrome.mov

Mobile Web - Safari

Refactor.IdentityForm.mWeb-Safari.mov

Desktop

Refactor.IdentityForm.Desktop.mov
Refactor.IdentityForm.Desktop.2.mov

iOS

Refactor.IdentityForm.iOS.mov

Android

Refactor.IdentityForm.Android.mov

@mollfpr mollfpr requested a review from a team as a code owner October 28, 2022 17:28
@melvin-bot melvin-bot bot requested review from luacmartins and removed request for a team October 28, 2022 17:28
@melvin-bot
Copy link

melvin-bot bot commented Oct 28, 2022

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check that @mollfpr , accidentally approved!

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Just one small clarification

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mollfpr I used your example using Form.js and had issues setting a DOB on iOS and android. Maybe I'm holding something wrong? I saw console errors saying that onFieldChange is required, but we don't seem to pass that prop in your example.

android.mov
ios.mov

@mollfpr
Copy link
Contributor Author

mollfpr commented Nov 2, 2022

@luacmartins Sorry I miss this. It seems the props.value to DatePicker is not passed correctly. Currently, the DatePicker only shows the date text from props.defaultValue where it should show props.value.

I just push a quick fix for that. Thanks!

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mollfpr Thanks for the fix, it seems to work well on iOS and android. I've come across another console error that we should fix:

  1. On web, enter a DOB
  2. Delete the date entered
  3. Focus on another input and then back on DOB
error.mov

Screen Shot 2022-11-02 at 11 28 20 AM

Screen Shot 2022-11-02 at 11 28 26 AM

Screen Shot 2022-11-02 at 11 27 25 AM

@mollfpr
Copy link
Contributor Author

mollfpr commented Nov 2, 2022

@luacmartins Fixed the controlled input issue with a null value!

@luacmartins
Copy link
Contributor

I'll let @Santhosh-Sellavel do another round of testing and then I'll jump in for the final review

Copy link
Contributor

@luacmartins luacmartins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and tests well

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
web.mov
desktop.mov
ios.mov
safari.mov
android.mov

@Santhosh-Sellavel
Copy link
Collaborator

Sorry for the delay, checking this now!

@Santhosh-Sellavel
Copy link
Collaborator

@mollfpr or @luacmartins
I noticed this error warning, can we fix this here, or should report it in the channel?
Simulator Screen Shot - iPhone 13 - 2022-11-04 at 22 56 25

@Santhosh-Sellavel
Copy link
Collaborator

Screen Recordings

WEB & DESKTOP

WEB_DESKTOP.mov

ANDROID & IOS Native

ANDROID_IOS_I.mov
ANDROID_IOS_II.mov

ANDROID & IOS MWEB

MWEB_ANDROID_IOS_I.mov
MWEB_ANDROID_IOS_II.mov

@Santhosh-Sellavel
Copy link
Collaborator

PR Reviewer Checklist

The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product was added in all src/languages/* files
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Copy link
Collaborator

@Santhosh-Sellavel Santhosh-Sellavel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Recordings: #12252 (comment)
PR Reviewer Checklist #12252 (comment)

Warning: #12252 (comment)

Approving as this warning is not introduced here.
C+ Reviewed
🎀 👀 🎀

@luacmartins
Let me if this warning issue should be raised in slack or not, thanks!

@luacmartins
Copy link
Contributor

@Santhosh-Sellavel let's report the warning in Slack

@OSBotify
Copy link
Contributor

OSBotify commented Nov 4, 2022

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

OSBotify commented Nov 8, 2022

🚀 Deployed to staging by @luacmartins in version: 1.2.25-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@luacmartins luacmartins mentioned this pull request Nov 8, 2022
8 tasks
@OSBotify
Copy link
Contributor

OSBotify commented Nov 9, 2022

🚀 Deployed to production by @yuwenmemon in version: 1.2.25-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants