<commit_before>const Client           = require('../../../base/client');
const BinarySocket     = require('../../../base/socket');
const State            = require('../../../../_common/storage').State;

const Settings = (() => {
    const onLoad = () => {
        BinarySocket.wait('get_account_status').then(() => {
            const $class_real  = $('.real');
            const is_jp_client = Client.isJPClient();

            if (Client.get('is_virtual')) {
                $class_real.setVisibility(0);
            } else {
                $class_real.not((is_jp_client ? '.ja-hide' : '')).setVisibility(1);
            }

            const status = State.getResponse('get_account_status.status');
            if (!/social_signup/.test(status)) {
                $('#change_password').setVisibility(1);
            }

            const financial_company = State.getResponse('landing_company.financial_company.shortcode');
            // Professional Client menu should only be shown to MF and CR accounts.
            if (!is_jp_client && !/professional_requested|professional/.test(status) &&
                (Client.isAccountOfType('financial') ||
                    (/costarica/.test(financial_company) && Client.isAccountOfType('real')))) {

                if (Client.canRequestProfessional()) {
                    $('#professional_client').setVisibility(1);
                }
            }

            if (!State.getResponse('get_account_status.prompt_client_to_authenticate')) {
                $('#authenticate').setVisibility(0);
            }

            $('#settings_container').setVisibility(1);
        });
    };

    return {
        onLoad,
    };
})();

module.exports = Settings;<commit_msg>refactored code<commit_after>const Client           = require('../../../base/client');
const BinarySocket     = require('../../../base/socket');
const State            = require('../../../../_common/storage').State;

const Settings = (() => {
    const onLoad = () => {
        BinarySocket.wait('get_account_status').then(() => {
            const $class_real  = $('.real');

            if (Client.get('is_virtual')) {
                $class_real.setVisibility(0);
            } else {
                $class_real.not((Client.isJPClient() ? '.ja-hide' : '')).setVisibility(1);
            }

            const status = State.getResponse('get_account_status.status');
            if (!/social_signup/.test(status)) {
                $('#change_password').setVisibility(1);
            }

            // Professional Client menu should only be shown to MF accounts.
            if ((Client.isAccountOfType('financial')) && !/professional_requested|professional/.test(status)) {

                $('#professional_client').setVisibility(1);
            }

            if (!State.getResponse('get_account_status.prompt_client_to_authenticate')) {
                $('#authenticate').setVisibility(0);
            }

            $('#settings_container').setVisibility(1);
        });
    };

    return {
        onLoad,
    };
})();

module.exports = Settings;
{'fraction_non_alphanumeric': 0.16498535632931988, 'fraction_numerical': 0.0039049788480312398, 'mean_word_length': 1.9388145315487573, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6713605', 'n_tokens_mistral': 847, 'n_tokens_neox': 790, 'n_words': 117}