<commit_before>import app from '../app';

const setFeedback = function () {
  const profile = app.profile ? app.profile.toJSON() : {};
  const contactInfo = profile.contactInfo || {};

  window.doorbellOptions = {
    appKey: '<KEY>',
    name: profile.name,
    email: contactInfo.email,
    properties: {
      peerID: profile.peerID,
      vendor: profile.vendor,
      contactInfo,
    },
  };
};

/*
 * Sets the options for the feedback tool
 */

export function setFeedbackOptions() {
  setFeedback();
}

/*
 * Adds the feedback tool to the page.
 */
export function addFeedback() {
  if (!window.doorbellOptions) setFeedback();

  (function (w, d, t) {
    let hasLoaded = false;
    function l() {
      if (hasLoaded) {
        return;
      }
      hasLoaded = true;
      window.doorbellOptions.windowLoaded = true;
      const g = d.createElement(t);<commit_msg>Pull more data from the user for feedback.<commit_after>import app from '../app';
import { version } from '../../package.json';
const os = require('os');
// TODO: make that an import above

/*
 * Sets the options for the feedback tool
 */

export function setFeedbackOptions() {
  const profile = app.profile ? app.profile.toJSON() : {};
  const contactInfo = profile.contactInfo || {};
  const sVer = app.settings && app.settings.get('version') || '';
  const serverVersion = sVer.substring(sVer.lastIndexOf(':') + 1, sVer.lastIndexOf('/'));

  window.doorbellOptions = {
    appKey: '<KEY>',
    name: profile.name || "name data missing",
    email: contactInfo.email || "email data missing",
    properties: {
      peerID: profile.peerID || "peerID data missing",
      vendor: profile.vendor || "vendor data missing",
      clientVersion: version,
      serverVersion,
      contactInfo,
      systemLanguage: navigator.language,
      numberOfCPUs: os.cpus().length,
      cpu: os.cpus()[0],
      RAMtotal: ((os.totalmem())/1048576).toFixed(2),
      RAMfree: ((os.freemem())/1048576).toFixed(2),
    },
  };
  console.log(window.doorbellOptions)
}

/*
 * Adds the feedback tool to the page.
 */
export function addFeedback() {
  if (!window.doorbellOptions) setFeedbackOptions();

  (function (w, d, t) {
    let hasLoaded = false;
    function l() {
      if (hasLoaded) {
        return;
      }
      hasLoaded = true;
      window.doorbellOptions.windowLoaded = true;
      const g = d.createElement(t);
{'fraction_non_alphanumeric': 0.14399330263708665, 'fraction_numerical': 0.007534533277521975, 'mean_word_length': 2.9966555183946486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3265326', 'n_tokens_mistral': 739, 'n_tokens_neox': 727, 'n_words': 190}