<commit_before>import Onboarding from './components/Onboarding';
import ContextSlide from './components/ContextSlide';
import InstructionSlide from './components/InstructionSlide';

const $ = require('jquery');
const React = require('react');
const ReactDom = require('react-dom');

/**
 * Welcome to the Laboratory.
 * Run your experiments below.
 */
$(document).ready(function() {
  const campaign = Drupal.settings.dsCampaign || null;
  const user = Drupal.settings.dsUser || null;
  const disabled_langs = ['mx', 'br']
  let localStorageKey = null;

  if (campaign && user && disabled_langs.indexOf(campaign.language.language_code) == -1) {
    localStorageKey = `onboarding:campaign=${campaign.id}-user=${user.info.id}`;
  }

  // Enable the Onboarding experiment.
  if (Drupal.settings.dsOnboarding.enabled && localStorage.getItem(localStorageKey) !== 'true') {
    const jsxElementHook = 'jsx-onboarding';
    const slides = [ContextSlide, InstructionSlide];

    $('.chrome').find('> .wrapper').before(`<div id="${jsxElementHook}"></div>`);

    if (localStorageKey) {
      localStorage.setItem(localStorageKey, true);
    }

    ReactDom.render(<Onboarding slides={slides} campaign={campaign} user={user} />, document.getElementById(jsxElementHook));
  }

});<commit_msg>Refactors onboarding to make the condtional easier to read<commit_after>import Onboarding from './components/Onboarding';
import ContextSlide from './components/ContextSlide';
import InstructionSlide from './components/InstructionSlide';

const $ = require('jquery');
const React = require('react');
const ReactDom = require('react-dom');

/**
 * Welcome to the Laboratory.
 * Run your experiments below.
 */
$(document).ready(function() {
  const campaign = Drupal.settings.dsCampaign || null;
  const user = Drupal.settings.dsUser || null;
  const disabledByLanguage = ['mx', 'br'].indexOf(campaign.language.language_code) != -1;
  let localStorageKey = null;

  if (campaign && user && !disabledByLanguage) {
    localStorageKey = `onboarding:campaign=${campaign.id}-user=${user.info.id}`;
  }

  // Enable the Onboarding experiment.
  if (Drupal.settings.dsOnboarding.enabled && localStorage.getItem(localStorageKey) !== 'true') {
    const jsxElementHook = 'jsx-onboarding';
    const slides = [ContextSlide, InstructionSlide];

    $('.chrome').find('> .wrapper').before(`<div id="${jsxElementHook}"></div>`);

    if (localStorageKey) {
      localStorage.setItem(localStorageKey, true);
    }

    ReactDom.render(<Onboarding slides={slides} campaign={campaign} user={user} />, document.getElementById(jsxElementHook));
  }

});
{'fraction_non_alphanumeric': 0.15743217424531908, 'fraction_numerical': 0.0007642338555598013, 'mean_word_length': 4.936507936507937, 'pattern_counts': {'":': 0, '<': 9, '<?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': '4890951', 'n_tokens_mistral': 790, 'n_tokens_neox': 757, 'n_words': 164}