<commit_before>import React, { useState } from 'react'
import {MobileInput} from 'p2pu-components'

import 'p2pu-components/dist/build.css'

const SignupMobileInput = (props) => {
  const [ value, setValue ] = useState(props.phone)

  const cleanFormatting = (phoneNumber) => {
    const num = phoneNumber.replace(/[()\ -]/g, '');
    if (num.length <= 4) {
      return '';
    }
    return num;
  }

    const {label, hint, error} = props;
    let errorSpan = null;
    if (error) {
      errorSpan = (
        <span id="error_1_id_mobile" className="invalid-feedback"><strong>{error}</strong></span>
      );
    }
    return (
      <MobileInput
        name="mobile"
        id="id_mobile"
        label={label}
        helpText={hint}
        placeholder="Enter phone number"
        value={props.phone}
        flagsImagePath="/static/images/flags.png"
        errorMessage={errorSpan}
      />
    );
}

export default SignupMobileInput<commit_msg>Fixfix mobile input to prevent country code from causing an server side validation error<commit_after>import React, { useState } from 'react'
import {MobileInput} from 'p2pu-components'

import 'p2pu-components/dist/build.css'

const SignupMobileInput = (props) => {
  const [ value, setValue ] = useState(props.value)

  const cleanFormatting = (phoneNumber) => {
    const num = phoneNumber.replace(/[()\ -]/g, '');
    if (num.length <= 4) {
      return '';
    }
    return num;
  }

    const {label, hint, error} = props;
    let errorSpan = null;
    if (error) {
      errorSpan = (
        <span id="error_1_id_mobile" className="invalid-feedback"><strong>{error}</strong></span>
      );
    }
  return (
    <div>
      <input id="id_mobile" type="hidden" name="mobile" value={cleanFormatting(value)} />
      <MobileInput
        name="mobileBOB"
        id="id_mobileBOB"
        label={label}
        helpText={hint}
        placeholder="Enter phone number"
        value={props.phone}
        handleChange={({mobileBOB}) => setValue(mobileBOB)}
        flagsImagePath="/static/images/flags.png"
        errorMessage={errorSpan}
      />
    </div>
    );
}

export default SignupMobileInput
{'fraction_non_alphanumeric': 0.1419981498612396, 'fraction_numerical': 0.0037002775208140612, 'mean_word_length': 2.788091068301226, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 21, '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': '1541276', 'n_tokens_mistral': 668, 'n_tokens_neox': 663, 'n_words': 141}