<commit_before>import _ from 'underscore';
import m from 'mithril';
import h from '../h';

const railsErrors = m.prop('');
const setRailsErrors = errors => railsErrors(errors);
const errorGroups = {
    basics: ['public_name', 'permalink', 'category_id', 'city', 'public_tags', 'name'],
    goal: ['goal', 'online_days'],
    goals: ['goals.size'],
    description: ['about_html'],
    budget: ['budget'],
    announce_expiration: ['online_days'],
    card: ['uploaded_image', 'headline'],
    video: ['video_url'],
    reward: ['rewards.size', 'rewards.minimum_value', 'rewards.title', 'rewards.description', 'rewards.deliver_at', 'rewards.shipping_fees.value', 'rewards.shipping_fees.destination'],
    user_about: ['user.uploaded_image', 'user.public_name', 'user.about_html'],
    user_settings: ['bank_account.id', 'bank_account.user_id', 'bank_account.account', 'bank_account.agency', 'bank_account.owner_name', 'bank_account.owner_document', 'bank_account.created_at', 'bank_account.updated_at', 'bank_account.account_digit', 'bank_account.agency_digit', 'bank_account.bank_id', 'bank_account.account_type', 'user.name', 'user.cpf', 'user.birth_date', 'user.country_id', 'user.address_state', 'user.address_street', 'user.address_number', 'user.address_city', 'user.address_neighbourhood', 'bank_account']
};
const errorsFor = (group) => {
    let parsedErrors;
    try {
        parsedErrors = JSON.parse(railsErrors());
    } catch (err) {
        parsedErrors = {};
    }
    if (_.find(errorGroups[group], key => parsedErrors.hasOwnProperty(key))) { return m('span.fa.fa-exclamation-circle.fa-fw.fa-lg.text-error'); }
    if (_.isEmpty(parsedErrors)) { return ''; }
    return m('span.fa.fa-check-circle.fa-fw.fa-lg.text-success');
};

const mapRailsErrors = (rails_errors, errorsFields, e) => {
    let parsedErrors;
    try {<commit_msg>add phone number error to dashboard menu[#155409382]<commit_after>import _ from 'underscore';
import m from 'mithril';
import h from '../h';

const railsErrors = m.prop('');
const setRailsErrors = errors => railsErrors(errors);
const errorGroups = {
    basics: ['public_name', 'permalink', 'category_id', 'city', 'public_tags', 'name'],
    goal: ['goal', 'online_days'],
    goals: ['goals.size'],
    description: ['about_html'],
    budget: ['budget'],
    announce_expiration: ['online_days'],
    card: ['uploaded_image', 'headline'],
    video: ['video_url'],
    reward: ['rewards.size', 'rewards.minimum_value', 'rewards.title', 'rewards.description', 'rewards.deliver_at', 'rewards.shipping_fees.value', 'rewards.shipping_fees.destination'],
    user_about: ['user.uploaded_image', 'user.public_name', 'user.about_html'],
    user_settings: ['bank_account.id', 'bank_account.user_id', 'bank_account.account', 'bank_account.agency', 'bank_account.owner_name', 'bank_account.owner_document', 'bank_account.created_at', 'bank_account.updated_at', 'bank_account.account_digit', 'bank_account.agency_digit', 'bank_account.bank_id', 'bank_account.account_type', 'user.name', 'user.cpf', 'user.birth_date', 'user.country_id', 'user.address_state', 'user.address_street', 'user.address_number', 'user.address_city', 'user.address_neighbourhood', 'bank_account', 'user.phone_number']
};
const errorsFor = (group) => {
    let parsedErrors;
    try {
        parsedErrors = JSON.parse(railsErrors());
    } catch (err) {
        parsedErrors = {};
    }
    if (_.find(errorGroups[group], key => parsedErrors.hasOwnProperty(key))) { return m('span.fa.fa-exclamation-circle.fa-fw.fa-lg.text-error'); }
    if (_.isEmpty(parsedErrors)) { return ''; }
    return m('span.fa.fa-check-circle.fa-fw.fa-lg.text-success');
};

const mapRailsErrors = (rails_errors, errorsFields, e) => {
    let parsedErrors;
    try {
{'fraction_non_alphanumeric': 0.1773936170212766, 'fraction_numerical': 0.0023936170212765957, 'mean_word_length': 5.278797996661102, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7527646', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1248, 'n_words': 223}