<commit_before>/*
 * This file is part of the Sylius package.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import $ from 'jquery';

const HUB_REQUEST_TIME = 'hub_request_time';
const LAST_SYLIUS_VERSION = 'last_sylius_version';
const SYLIUS_VERSION_DISMISSED = 'sylius_version_dismissed';
const MILISECONDS_MULTIPLIER = 1000;

const store = function store(key, value) {
  localStorage.setItem(key, value);
};

const retrieve = function retrieve(key) {
  return localStorage.getItem(key);
};

const milisecondsSinceLastRequest = function milisecondsSinceLastRequest() {
  return new Date().getTime() - parseInt(retrieve(HUB_REQUEST_TIME), 10);
};

const getDismissedSyliusVersion = function getDismissedSyliusVersion() {
  return retrieve(SYLIUS_VERSION_DISMISSED);
};

$.fn.extend({
  notification() {
    const notificationMenu = $('#sylius-version-notification');
    const askFrequency = notificationMenu.attr('data-frequency') * MILISECONDS_MULTIPLIER;<commit_msg>bug #11612 Don't call the backend if the notification bar is disabled (mikemix)<commit_after>/*
 * This file is part of the Sylius package.
 *
 * (c) <NAME>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

import $ from 'jquery';

const HUB_REQUEST_TIME = 'hub_request_time';
const LAST_SYLIUS_VERSION = 'last_sylius_version';
const SYLIUS_VERSION_DISMISSED = 'sylius_version_dismissed';
const MILISECONDS_MULTIPLIER = 1000;

const store = function store(key, value) {
  localStorage.setItem(key, value);
};

const retrieve = function retrieve(key) {
  return localStorage.getItem(key);
};

const milisecondsSinceLastRequest = function milisecondsSinceLastRequest() {
  return new Date().getTime() - parseInt(retrieve(HUB_REQUEST_TIME), 10);
};

const getDismissedSyliusVersion = function getDismissedSyliusVersion() {
  return retrieve(SYLIUS_VERSION_DISMISSED);
};

$.fn.extend({
  notification() {
    const notificationMenu = $('#sylius-version-notification');

    if (0 === notificationMenu.length) {
      return;
    }

    const askFrequency = notificationMenu.attr('data-frequency') * MILISECONDS_MULTIPLIER;
{'fraction_non_alphanumeric': 0.1057481351469943, 'fraction_numerical': 0.007898200965335674, 'mean_word_length': 5.532951289398281, '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': '3635420', 'n_tokens_mistral': 734, 'n_tokens_neox': 701, 'n_words': 179}