<commit_before>import { generateLiveApiInstance } from './appId';
import { getLanguage } from '../common/lang';
import { getTokenList } from './utils/storageManager';
import { translate } from '../common/i18n';

const Elevio = (() => {
    const init = () => {
        if (!window._elev) return; // eslint-disable-line no-underscore-dangle
        // eslint-disable-next-line no-underscore-dangle
        window._elev.on('load', elev => {
            const availableElevLanguages = ['es', 'id', 'pt', 'ru'];
            const currentLanguage = getLanguage().toLowerCase();
            if (availableElevLanguages.indexOf(currentLanguage) !== -1) {
                window._elev.setLanguage(currentLanguage); // eslint-disable-line no-underscore-dangle
            }
            setUserInfo(elev);
            setTranslations(elev);
        });
    };

    const setUserInfo = elev => {
        const tokenList = getTokenList();
        if (tokenList.length) {
            const api = generateLiveApiInstance(); // Refactor when reducing WS connections
            const activeToken = tokenList[0];
            api.authorize(activeToken.token).then(() => {
                api.send({ get_settings: 1 }).then(response => {
                    const isVirtual = activeToken.loginInfo.is_virtual;
                    const userObject = {
                        email     : response.get_settings.email,
                        first_name: isVirtual ? 'Virtual' : response.get_settings.first_name,
                        last_name : isVirtual ? activeToken.loginInfo.loginid : response.get_settings.first_name,<commit_msg>Comment out available_languages until translation-dependencies are resolved<commit_after>import { generateLiveApiInstance } from './appId';
import { getLanguage } from '../common/lang';
import { getTokenList } from './utils/storageManager';
import { translate } from '../common/i18n';

const Elevio = (() => {
    const init = () => {
        if (!window._elev) return; // eslint-disable-line no-underscore-dangle
        // eslint-disable-next-line no-underscore-dangle
        window._elev.on('load', elev => {
            // const availableElevLanguages = ['es', 'id', 'pt', 'ru'];
            // const currentLanguage = getLanguage().toLowerCase();
            // if (availableElevLanguages.indexOf(currentLanguage) !== -1) {
            //     window._elev.setLanguage(currentLanguage); // eslint-disable-line no-underscore-dangle
            // }
            setUserInfo(elev);
            setTranslations(elev);
        });
    };

    const setUserInfo = elev => {
        const tokenList = getTokenList();
        if (tokenList.length) {
            const api = generateLiveApiInstance(); // Refactor when reducing WS connections
            const activeToken = tokenList[0];
            api.authorize(activeToken.token).then(() => {
                api.send({ get_settings: 1 }).then(response => {
                    const isVirtual = activeToken.loginInfo.is_virtual;
                    const userObject = {
                        email     : response.get_settings.email,
                        first_name: isVirtual ? 'Virtual' : response.get_settings.first_name,
                        last_name : isVirtual ? activeToken.loginInfo.loginid : response.get_settings.first_name,
{'fraction_non_alphanumeric': 0.12481112118464793, 'fraction_numerical': 0.0030220610456331218, 'mean_word_length': 2.179634966378482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '5355355', 'n_tokens_mistral': 886, 'n_tokens_neox': 861, 'n_words': 175}