<commit_before>import React from 'react';
import CredPane from '../lock/cred_pane';
import PhoneNumberInput from '../cred/phone_number_input';
import LocationInput from '../cred/location_input';
import AskLocation from './ask_location';
import { changePhoneNumber, selectPhoneLocation } from './actions';
import * as c from '../cred/index';
import * as l from '../lock/index';
import * as m from './index';

export default class AskPhoneNumber extends React.Component {
  componentWillReceiveProps(nextProps) {
    if (m.selectingLocation(this.props.lock) && !m.selectingLocation(nextProps.lock)) {
      setTimeout(() => {
        if (c.phoneNumber(nextProps.lock)) {
          this.refs.cred.focusSubmit();
        } else {
          this.refs.phoneNumber.focus();
        }
      }, 17);
    }
  }

  render() {
    const { lock } = this.props;
    const auxiliaryPane = m.selectingLocation(lock) ?
      <AskLocation key="aux<PASSWORD>" lock={lock} /> : null;
    const terms = this.t(["footerText"]);

    return (
      <CredPane lock={lock} auxiliaryPane={auxiliaryPane} className="auth0-lock-intro" terms={terms} ref="cred">
        <div className="auth0-lock-passwordless auth0-lock-mode">
          <div className="auth0-lock-form auth0-lock-passwordless">
          <p>{this.t(["headerText"])}</p>
            <PhoneNumberInput ref="phoneNumber"
              value={c.phoneNumber(lock)}
              isValid={!c.visiblyInvalidPhoneNumber(lock)}
              onChange={::this.handlePhoneNumberChange}
              autoFocus={l.ui.focusInput(lock)}
              placeholder={this.t(["phoneNumberInputPlaceholder"], {__textOnly: true})}
              tabIndex={l.tabIndex(lock, 1)}
              disabled={l.submitting(lock)} />
            <LocationInput value={c.phoneLocationString(lock)}
              onClick={::this.handleLocationClick}
              tabIndex={l.tabIndex(lock, 2)} />
          </div>
        </div>
      </CredPane>
    );
  }

  handlePhoneNumberChange(e) {
    changePhoneNumber(l.id(this.props.lock), e.target.value);
  }

  handleLocationClick() {
    selectPhoneLocation(l.id(this.props.lock));
  }
<commit_msg>Change order of phone number and location inputs<commit_after>import React from 'react';
import CredPane from '../lock/cred_pane';
import PhoneNumberInput from '../cred/phone_number_input';
import LocationInput from '../cred/location_input';
import AskLocation from './ask_location';
import { changePhoneNumber, selectPhoneLocation } from './actions';
import * as c from '../cred/index';
import * as l from '../lock/index';
import * as m from './index';

export default class AskPhoneNumber extends React.Component {
  componentWillReceiveProps(nextProps) {
    if (m.selectingLocation(this.props.lock) && !m.selectingLocation(nextProps.lock)) {
      setTimeout(() => {
        if (c.phoneNumber(nextProps.lock)) {
          this.refs.cred.focusSubmit();
        } else {
          this.refs.phoneNumber.focus();
        }
      }, 17);
    }
  }

  render() {
    const { lock } = this.props;
    const auxiliaryPane = m.selectingLocation(lock) ?
      <AskLocation key="auxiliarypane" lock={lock} /> : null;
    const terms = this.t(["footerText"]);

    return (
      <CredPane lock={lock} auxiliaryPane={auxiliaryPane} className="auth0-lock-intro" terms={terms} ref="cred">
        <div className="auth0-lock-passwordless auth0-lock-mode">
          <div className="auth0-lock-form auth0-lock-passwordless">
          <p>{this.t(["headerText"])}</p>
            <LocationInput value={c.phoneLocationString(lock)}
              onClick={::this.handleLocationClick}
              tabIndex={l.tabIndex(lock, 1)} />
            <PhoneNumberInput ref="phoneNumber"
              value={c.phoneNumber(lock)}
              isValid={!c.visiblyInvalidPhoneNumber(lock)}
              onChange={::this.handlePhoneNumberChange}
              autoFocus={l.ui.focusInput(lock)}
              placeholder={this.t(["phoneNumberInputPlaceholder"], {__textOnly: true})}
              tabIndex={l.tabIndex(lock, 2)}
              disabled={l.submitting(lock)} />
          </div>
        </div>
      </CredPane>
    );
  }

  handlePhoneNumberChange(e) {
    changePhoneNumber(l.id(this.props.lock), e.target.value);
  }

  handleLocationClick() {
    selectPhoneLocation(l.id(this.props.lock));
  }

{'fraction_non_alphanumeric': 0.1482845959014506, 'fraction_numerical': 0.004144600506562284, 'mean_word_length': 2.8994614003590664, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2217511', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1257, 'n_words': 227}