@ninetailed/experience.js 2.0.0-beta.11 → 2.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.umd.js CHANGED
@@ -1,13 +1,32 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/get'), require('lodash/unionBy'), require('@ninetailed/experience.js-shared'), require('analytics'), require('lodash/flatten'), require('lodash/find'), require('lodash/includes'), require('lodash/pickBy'), require('murmurhash-js')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash/get', 'lodash/unionBy', '@ninetailed/experience.js-shared', 'analytics', 'lodash/flatten', 'lodash/find', 'lodash/includes', 'lodash/pickBy', 'murmurhash-js'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Javascript = {}, global.get$2, global.unionBy, global.experience_jsShared, global.Analytics, global.flatten, global.find, global.includes, global.pickBy, global.murmurhashJs));
5
- })(this, (function (exports, get$2, unionBy, experience_jsShared, Analytics, flatten, find, includes, pickBy, murmurhashJs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lodash/get'), require('lodash/unionBy'), require('@ninetailed/experience.js-shared'), require('loglevel'), require('analytics'), require('lodash/flatten'), require('lodash/find'), require('lodash/includes'), require('lodash/pickBy'), require('murmurhash-js')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash/get', 'lodash/unionBy', '@ninetailed/experience.js-shared', 'loglevel', 'analytics', 'lodash/flatten', 'lodash/find', 'lodash/includes', 'lodash/pickBy', 'murmurhash-js'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Javascript = {}, global.get$2, global.unionBy, global.experience_jsShared, global.loglevel, global.Analytics, global.flatten, global.find, global.includes, global.pickBy, global.murmurhashJs));
5
+ })(this, (function (exports, get$2, unionBy, experience_jsShared, loglevel, Analytics, flatten, find, includes, pickBy, murmurhashJs) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
9
27
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get$2);
10
28
  var unionBy__default = /*#__PURE__*/_interopDefaultLegacy(unionBy);
29
+ var loglevel__namespace = /*#__PURE__*/_interopNamespace(loglevel);
11
30
  var Analytics__default = /*#__PURE__*/_interopDefaultLegacy(Analytics);
12
31
  var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
13
32
  var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
@@ -184,9 +203,9 @@
184
203
  var global$B = global$F;
185
204
  var userAgent$3 = engineUserAgent;
186
205
 
187
- var process$4 = global$B.process;
206
+ var process$3 = global$B.process;
188
207
  var Deno = global$B.Deno;
189
- var versions = process$4 && process$4.versions || Deno && Deno.version;
208
+ var versions = process$3 && process$3.versions || Deno && Deno.version;
190
209
  var v8 = versions && versions.v8;
191
210
  var match, version;
192
211
 
@@ -1412,7 +1431,7 @@
1412
1431
 
1413
1432
  var set$1 = global$b.setImmediate;
1414
1433
  var clear = global$b.clearImmediate;
1415
- var process$3 = global$b.process;
1434
+ var process$2 = global$b.process;
1416
1435
  var Dispatch = global$b.Dispatch;
1417
1436
  var Function$1 = global$b.Function;
1418
1437
  var MessageChannel = global$b.MessageChannel;
@@ -1468,7 +1487,7 @@
1468
1487
  // Node.js 0.8-
1469
1488
  if (IS_NODE$2) {
1470
1489
  defer = function (id) {
1471
- process$3.nextTick(runner(id));
1490
+ process$2.nextTick(runner(id));
1472
1491
  };
1473
1492
  // Sphere (JS game engine) Dispatch API
1474
1493
  } else if (Dispatch && Dispatch.now) {
@@ -1534,7 +1553,7 @@
1534
1553
 
1535
1554
  var MutationObserver = global$9.MutationObserver || global$9.WebKitMutationObserver;
1536
1555
  var document$2 = global$9.document;
1537
- var process$2 = global$9.process;
1556
+ var process$1 = global$9.process;
1538
1557
  var Promise$1 = global$9.Promise;
1539
1558
  // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
1540
1559
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor$1(global$9, 'queueMicrotask');
@@ -1546,7 +1565,7 @@
1546
1565
  if (!queueMicrotask) {
1547
1566
  flush = function () {
1548
1567
  var parent, fn;
1549
- if (IS_NODE$1 && (parent = process$2.domain)) parent.exit();
1568
+ if (IS_NODE$1 && (parent = process$1.domain)) parent.exit();
1550
1569
  while (head) {
1551
1570
  fn = head.fn;
1552
1571
  head = head.next;
@@ -1583,7 +1602,7 @@
1583
1602
  // Node.js without promises
1584
1603
  } else if (IS_NODE$1) {
1585
1604
  notify$1 = function () {
1586
- process$2.nextTick(flush);
1605
+ process$1.nextTick(flush);
1587
1606
  };
1588
1607
  // for other environments - macrotask based on:
1589
1608
  // - setImmediate
@@ -1729,7 +1748,7 @@
1729
1748
  var PromisePrototype = NativePromisePrototype;
1730
1749
  var TypeError$3 = global$7.TypeError;
1731
1750
  var document$1 = global$7.document;
1732
- var process$1 = global$7.process;
1751
+ var process = global$7.process;
1733
1752
  var newPromiseCapability = newPromiseCapabilityModule.f;
1734
1753
  var newGenericPromiseCapability = newPromiseCapability;
1735
1754
 
@@ -1851,7 +1870,7 @@
1851
1870
  if (IS_UNHANDLED) {
1852
1871
  result = perform(function () {
1853
1872
  if (IS_NODE) {
1854
- process$1.emit('unhandledRejection', value, promise);
1873
+ process.emit('unhandledRejection', value, promise);
1855
1874
  } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1856
1875
  });
1857
1876
  // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
@@ -1869,7 +1888,7 @@
1869
1888
  call$4(task, global$7, function () {
1870
1889
  var promise = state.facade;
1871
1890
  if (IS_NODE) {
1872
- process$1.emit('rejectionHandled', promise);
1891
+ process.emit('rejectionHandled', promise);
1873
1892
  } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1874
1893
  });
1875
1894
  };
@@ -1956,7 +1975,7 @@
1956
1975
  state.parent = true;
1957
1976
  reaction.ok = isCallable$2(onFulfilled) ? onFulfilled : true;
1958
1977
  reaction.fail = isCallable$2(onRejected) && onRejected;
1959
- reaction.domain = IS_NODE ? process$1.domain : undefined;
1978
+ reaction.domain = IS_NODE ? process.domain : undefined;
1960
1979
  if (state.state == PENDING) state.reactions.add(reaction);
1961
1980
  else microtask(function () {
1962
1981
  callReaction(reaction, state);
@@ -2281,726 +2300,14 @@
2281
2300
  };
2282
2301
  };
2283
2302
 
2284
- var browser = {exports: {}};
2285
-
2286
- /**
2287
- * Helpers.
2288
- */
2289
-
2290
- var s = 1000;
2291
- var m = s * 60;
2292
- var h = m * 60;
2293
- var d = h * 24;
2294
- var w = d * 7;
2295
- var y = d * 365.25;
2296
-
2297
- /**
2298
- * Parse or format the given `val`.
2299
- *
2300
- * Options:
2301
- *
2302
- * - `long` verbose formatting [false]
2303
- *
2304
- * @param {String|Number} val
2305
- * @param {Object} [options]
2306
- * @throws {Error} throw an error if val is not a non-empty string or a number
2307
- * @return {String|Number}
2308
- * @api public
2309
- */
2310
-
2311
- var ms = function(val, options) {
2312
- options = options || {};
2313
- var type = typeof val;
2314
- if (type === 'string' && val.length > 0) {
2315
- return parse(val);
2316
- } else if (type === 'number' && isFinite(val)) {
2317
- return options.long ? fmtLong(val) : fmtShort(val);
2318
- }
2319
- throw new Error(
2320
- 'val is not a non-empty string or a valid number. val=' +
2321
- JSON.stringify(val)
2322
- );
2323
- };
2324
-
2325
- /**
2326
- * Parse the given `str` and return milliseconds.
2327
- *
2328
- * @param {String} str
2329
- * @return {Number}
2330
- * @api private
2331
- */
2332
-
2333
- function parse(str) {
2334
- str = String(str);
2335
- if (str.length > 100) {
2336
- return;
2337
- }
2338
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
2339
- str
2340
- );
2341
- if (!match) {
2342
- return;
2343
- }
2344
- var n = parseFloat(match[1]);
2345
- var type = (match[2] || 'ms').toLowerCase();
2346
- switch (type) {
2347
- case 'years':
2348
- case 'year':
2349
- case 'yrs':
2350
- case 'yr':
2351
- case 'y':
2352
- return n * y;
2353
- case 'weeks':
2354
- case 'week':
2355
- case 'w':
2356
- return n * w;
2357
- case 'days':
2358
- case 'day':
2359
- case 'd':
2360
- return n * d;
2361
- case 'hours':
2362
- case 'hour':
2363
- case 'hrs':
2364
- case 'hr':
2365
- case 'h':
2366
- return n * h;
2367
- case 'minutes':
2368
- case 'minute':
2369
- case 'mins':
2370
- case 'min':
2371
- case 'm':
2372
- return n * m;
2373
- case 'seconds':
2374
- case 'second':
2375
- case 'secs':
2376
- case 'sec':
2377
- case 's':
2378
- return n * s;
2379
- case 'milliseconds':
2380
- case 'millisecond':
2381
- case 'msecs':
2382
- case 'msec':
2383
- case 'ms':
2384
- return n;
2385
- default:
2386
- return undefined;
2387
- }
2388
- }
2389
-
2390
- /**
2391
- * Short format for `ms`.
2392
- *
2393
- * @param {Number} ms
2394
- * @return {String}
2395
- * @api private
2396
- */
2397
-
2398
- function fmtShort(ms) {
2399
- var msAbs = Math.abs(ms);
2400
- if (msAbs >= d) {
2401
- return Math.round(ms / d) + 'd';
2402
- }
2403
- if (msAbs >= h) {
2404
- return Math.round(ms / h) + 'h';
2405
- }
2406
- if (msAbs >= m) {
2407
- return Math.round(ms / m) + 'm';
2408
- }
2409
- if (msAbs >= s) {
2410
- return Math.round(ms / s) + 's';
2411
- }
2412
- return ms + 'ms';
2413
- }
2414
-
2415
- /**
2416
- * Long format for `ms`.
2417
- *
2418
- * @param {Number} ms
2419
- * @return {String}
2420
- * @api private
2421
- */
2422
-
2423
- function fmtLong(ms) {
2424
- var msAbs = Math.abs(ms);
2425
- if (msAbs >= d) {
2426
- return plural(ms, msAbs, d, 'day');
2427
- }
2428
- if (msAbs >= h) {
2429
- return plural(ms, msAbs, h, 'hour');
2430
- }
2431
- if (msAbs >= m) {
2432
- return plural(ms, msAbs, m, 'minute');
2433
- }
2434
- if (msAbs >= s) {
2435
- return plural(ms, msAbs, s, 'second');
2436
- }
2437
- return ms + ' ms';
2438
- }
2439
-
2440
- /**
2441
- * Pluralization helper.
2442
- */
2443
-
2444
- function plural(ms, msAbs, n, name) {
2445
- var isPlural = msAbs >= n * 1.5;
2446
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
2447
- }
2448
-
2449
- /**
2450
- * This is the common logic for both the Node.js and web browser
2451
- * implementations of `debug()`.
2452
- */
2453
-
2454
- function setup(env) {
2455
- createDebug.debug = createDebug;
2456
- createDebug.default = createDebug;
2457
- createDebug.coerce = coerce;
2458
- createDebug.disable = disable;
2459
- createDebug.enable = enable;
2460
- createDebug.enabled = enabled;
2461
- createDebug.humanize = ms;
2462
- createDebug.destroy = destroy;
2463
-
2464
- Object.keys(env).forEach(key => {
2465
- createDebug[key] = env[key];
2466
- });
2467
-
2468
- /**
2469
- * The currently active debug mode names, and names to skip.
2470
- */
2471
-
2472
- createDebug.names = [];
2473
- createDebug.skips = [];
2474
-
2475
- /**
2476
- * Map of special "%n" handling functions, for the debug "format" argument.
2477
- *
2478
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
2479
- */
2480
- createDebug.formatters = {};
2481
-
2482
- /**
2483
- * Selects a color for a debug namespace
2484
- * @param {String} namespace The namespace string for the debug instance to be colored
2485
- * @return {Number|String} An ANSI color code for the given namespace
2486
- * @api private
2487
- */
2488
- function selectColor(namespace) {
2489
- let hash = 0;
2490
-
2491
- for (let i = 0; i < namespace.length; i++) {
2492
- hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
2493
- hash |= 0; // Convert to 32bit integer
2494
- }
2495
-
2496
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
2497
- }
2498
- createDebug.selectColor = selectColor;
2499
-
2500
- /**
2501
- * Create a debugger with the given `namespace`.
2502
- *
2503
- * @param {String} namespace
2504
- * @return {Function}
2505
- * @api public
2506
- */
2507
- function createDebug(namespace) {
2508
- let prevTime;
2509
- let enableOverride = null;
2510
- let namespacesCache;
2511
- let enabledCache;
2512
-
2513
- function debug(...args) {
2514
- // Disabled?
2515
- if (!debug.enabled) {
2516
- return;
2517
- }
2518
-
2519
- const self = debug;
2520
-
2521
- // Set `diff` timestamp
2522
- const curr = Number(new Date());
2523
- const ms = curr - (prevTime || curr);
2524
- self.diff = ms;
2525
- self.prev = prevTime;
2526
- self.curr = curr;
2527
- prevTime = curr;
2528
-
2529
- args[0] = createDebug.coerce(args[0]);
2530
-
2531
- if (typeof args[0] !== 'string') {
2532
- // Anything else let's inspect with %O
2533
- args.unshift('%O');
2534
- }
2535
-
2536
- // Apply any `formatters` transformations
2537
- let index = 0;
2538
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
2539
- // If we encounter an escaped % then don't increase the array index
2540
- if (match === '%%') {
2541
- return '%';
2542
- }
2543
- index++;
2544
- const formatter = createDebug.formatters[format];
2545
- if (typeof formatter === 'function') {
2546
- const val = args[index];
2547
- match = formatter.call(self, val);
2548
-
2549
- // Now we need to remove `args[index]` since it's inlined in the `format`
2550
- args.splice(index, 1);
2551
- index--;
2552
- }
2553
- return match;
2554
- });
2555
-
2556
- // Apply env-specific formatting (colors, etc.)
2557
- createDebug.formatArgs.call(self, args);
2558
-
2559
- const logFn = self.log || createDebug.log;
2560
- logFn.apply(self, args);
2561
- }
2562
-
2563
- debug.namespace = namespace;
2564
- debug.useColors = createDebug.useColors();
2565
- debug.color = createDebug.selectColor(namespace);
2566
- debug.extend = extend;
2567
- debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
2568
-
2569
- Object.defineProperty(debug, 'enabled', {
2570
- enumerable: true,
2571
- configurable: false,
2572
- get: () => {
2573
- if (enableOverride !== null) {
2574
- return enableOverride;
2575
- }
2576
- if (namespacesCache !== createDebug.namespaces) {
2577
- namespacesCache = createDebug.namespaces;
2578
- enabledCache = createDebug.enabled(namespace);
2579
- }
2580
-
2581
- return enabledCache;
2582
- },
2583
- set: v => {
2584
- enableOverride = v;
2585
- }
2586
- });
2587
-
2588
- // Env-specific initialization logic for debug instances
2589
- if (typeof createDebug.init === 'function') {
2590
- createDebug.init(debug);
2591
- }
2592
-
2593
- return debug;
2594
- }
2595
-
2596
- function extend(namespace, delimiter) {
2597
- const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
2598
- newDebug.log = this.log;
2599
- return newDebug;
2600
- }
2601
-
2602
- /**
2603
- * Enables a debug mode by namespaces. This can include modes
2604
- * separated by a colon and wildcards.
2605
- *
2606
- * @param {String} namespaces
2607
- * @api public
2608
- */
2609
- function enable(namespaces) {
2610
- createDebug.save(namespaces);
2611
- createDebug.namespaces = namespaces;
2612
-
2613
- createDebug.names = [];
2614
- createDebug.skips = [];
2615
-
2616
- let i;
2617
- const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
2618
- const len = split.length;
2619
-
2620
- for (i = 0; i < len; i++) {
2621
- if (!split[i]) {
2622
- // ignore empty strings
2623
- continue;
2624
- }
2625
-
2626
- namespaces = split[i].replace(/\*/g, '.*?');
2627
-
2628
- if (namespaces[0] === '-') {
2629
- createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
2630
- } else {
2631
- createDebug.names.push(new RegExp('^' + namespaces + '$'));
2632
- }
2633
- }
2634
- }
2635
-
2636
- /**
2637
- * Disable debug output.
2638
- *
2639
- * @return {String} namespaces
2640
- * @api public
2641
- */
2642
- function disable() {
2643
- const namespaces = [
2644
- ...createDebug.names.map(toNamespace),
2645
- ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
2646
- ].join(',');
2647
- createDebug.enable('');
2648
- return namespaces;
2649
- }
2650
-
2651
- /**
2652
- * Returns true if the given mode name is enabled, false otherwise.
2653
- *
2654
- * @param {String} name
2655
- * @return {Boolean}
2656
- * @api public
2657
- */
2658
- function enabled(name) {
2659
- if (name[name.length - 1] === '*') {
2660
- return true;
2661
- }
2662
-
2663
- let i;
2664
- let len;
2665
-
2666
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
2667
- if (createDebug.skips[i].test(name)) {
2668
- return false;
2669
- }
2670
- }
2671
-
2672
- for (i = 0, len = createDebug.names.length; i < len; i++) {
2673
- if (createDebug.names[i].test(name)) {
2674
- return true;
2675
- }
2676
- }
2677
-
2678
- return false;
2679
- }
2680
-
2681
- /**
2682
- * Convert regexp to namespace
2683
- *
2684
- * @param {RegExp} regxep
2685
- * @return {String} namespace
2686
- * @api private
2687
- */
2688
- function toNamespace(regexp) {
2689
- return regexp.toString()
2690
- .substring(2, regexp.toString().length - 2)
2691
- .replace(/\.\*\?$/, '*');
2692
- }
2693
-
2694
- /**
2695
- * Coerce `val`.
2696
- *
2697
- * @param {Mixed} val
2698
- * @return {Mixed}
2699
- * @api private
2700
- */
2701
- function coerce(val) {
2702
- if (val instanceof Error) {
2703
- return val.stack || val.message;
2704
- }
2705
- return val;
2706
- }
2707
-
2708
- /**
2709
- * XXX DO NOT USE. This is a temporary stub function.
2710
- * XXX It WILL be removed in the next major release.
2711
- */
2712
- function destroy() {
2713
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
2714
- }
2715
-
2716
- createDebug.enable(createDebug.load());
2717
-
2718
- return createDebug;
2719
- }
2720
-
2721
- var common = setup;
2722
-
2723
- /* eslint-env browser */
2724
-
2725
- (function (module, exports) {
2726
- /**
2727
- * This is the web browser implementation of `debug()`.
2728
- */
2729
-
2730
- exports.formatArgs = formatArgs;
2731
- exports.save = save;
2732
- exports.load = load;
2733
- exports.useColors = useColors;
2734
- exports.storage = localstorage();
2735
- exports.destroy = (() => {
2736
- let warned = false;
2737
-
2738
- return () => {
2739
- if (!warned) {
2740
- warned = true;
2741
- console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
2742
- }
2743
- };
2744
- })();
2745
-
2746
- /**
2747
- * Colors.
2748
- */
2749
-
2750
- exports.colors = [
2751
- '#0000CC',
2752
- '#0000FF',
2753
- '#0033CC',
2754
- '#0033FF',
2755
- '#0066CC',
2756
- '#0066FF',
2757
- '#0099CC',
2758
- '#0099FF',
2759
- '#00CC00',
2760
- '#00CC33',
2761
- '#00CC66',
2762
- '#00CC99',
2763
- '#00CCCC',
2764
- '#00CCFF',
2765
- '#3300CC',
2766
- '#3300FF',
2767
- '#3333CC',
2768
- '#3333FF',
2769
- '#3366CC',
2770
- '#3366FF',
2771
- '#3399CC',
2772
- '#3399FF',
2773
- '#33CC00',
2774
- '#33CC33',
2775
- '#33CC66',
2776
- '#33CC99',
2777
- '#33CCCC',
2778
- '#33CCFF',
2779
- '#6600CC',
2780
- '#6600FF',
2781
- '#6633CC',
2782
- '#6633FF',
2783
- '#66CC00',
2784
- '#66CC33',
2785
- '#9900CC',
2786
- '#9900FF',
2787
- '#9933CC',
2788
- '#9933FF',
2789
- '#99CC00',
2790
- '#99CC33',
2791
- '#CC0000',
2792
- '#CC0033',
2793
- '#CC0066',
2794
- '#CC0099',
2795
- '#CC00CC',
2796
- '#CC00FF',
2797
- '#CC3300',
2798
- '#CC3333',
2799
- '#CC3366',
2800
- '#CC3399',
2801
- '#CC33CC',
2802
- '#CC33FF',
2803
- '#CC6600',
2804
- '#CC6633',
2805
- '#CC9900',
2806
- '#CC9933',
2807
- '#CCCC00',
2808
- '#CCCC33',
2809
- '#FF0000',
2810
- '#FF0033',
2811
- '#FF0066',
2812
- '#FF0099',
2813
- '#FF00CC',
2814
- '#FF00FF',
2815
- '#FF3300',
2816
- '#FF3333',
2817
- '#FF3366',
2818
- '#FF3399',
2819
- '#FF33CC',
2820
- '#FF33FF',
2821
- '#FF6600',
2822
- '#FF6633',
2823
- '#FF9900',
2824
- '#FF9933',
2825
- '#FFCC00',
2826
- '#FFCC33'
2827
- ];
2828
-
2829
- /**
2830
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
2831
- * and the Firebug extension (any Firefox version) are known
2832
- * to support "%c" CSS customizations.
2833
- *
2834
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
2835
- */
2836
-
2837
- // eslint-disable-next-line complexity
2838
- function useColors() {
2839
- // NB: In an Electron preload script, document will be defined but not fully
2840
- // initialized. Since we know we're in Chrome, we'll just detect this case
2841
- // explicitly
2842
- if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
2843
- return true;
2844
- }
2845
-
2846
- // Internet Explorer and Edge do not support colors.
2847
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
2848
- return false;
2849
- }
2850
-
2851
- // Is webkit? http://stackoverflow.com/a/16459606/376773
2852
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
2853
- return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
2854
- // Is firebug? http://stackoverflow.com/a/398120/376773
2855
- (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
2856
- // Is firefox >= v31?
2857
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
2858
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
2859
- // Double check webkit in userAgent just in case we are in a worker
2860
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
2861
- }
2862
-
2863
- /**
2864
- * Colorize log arguments if enabled.
2865
- *
2866
- * @api public
2867
- */
2868
-
2869
- function formatArgs(args) {
2870
- args[0] = (this.useColors ? '%c' : '') +
2871
- this.namespace +
2872
- (this.useColors ? ' %c' : ' ') +
2873
- args[0] +
2874
- (this.useColors ? '%c ' : ' ') +
2875
- '+' + module.exports.humanize(this.diff);
2876
-
2877
- if (!this.useColors) {
2878
- return;
2879
- }
2880
-
2881
- const c = 'color: ' + this.color;
2882
- args.splice(1, 0, c, 'color: inherit');
2883
-
2884
- // The final "%c" is somewhat tricky, because there could be other
2885
- // arguments passed either before or after the %c, so we need to
2886
- // figure out the correct index to insert the CSS into
2887
- let index = 0;
2888
- let lastC = 0;
2889
- args[0].replace(/%[a-zA-Z%]/g, match => {
2890
- if (match === '%%') {
2891
- return;
2892
- }
2893
- index++;
2894
- if (match === '%c') {
2895
- // We only are interested in the *last* %c
2896
- // (the user may have provided their own)
2897
- lastC = index;
2898
- }
2899
- });
2900
-
2901
- args.splice(lastC, 0, c);
2902
- }
2903
-
2904
- /**
2905
- * Invokes `console.debug()` when available.
2906
- * No-op when `console.debug` is not a "function".
2907
- * If `console.debug` is not available, falls back
2908
- * to `console.log`.
2909
- *
2910
- * @api public
2911
- */
2912
- exports.log = console.debug || console.log || (() => {});
2913
-
2914
- /**
2915
- * Save `namespaces`.
2916
- *
2917
- * @param {String} namespaces
2918
- * @api private
2919
- */
2920
- function save(namespaces) {
2921
- try {
2922
- if (namespaces) {
2923
- exports.storage.setItem('debug', namespaces);
2924
- } else {
2925
- exports.storage.removeItem('debug');
2926
- }
2927
- } catch (error) {
2928
- // Swallow
2929
- // XXX (@Qix-) should we be logging these?
2930
- }
2931
- }
2932
-
2933
- /**
2934
- * Load `namespaces`.
2935
- *
2936
- * @return {String} returns the previously persisted debug modes
2937
- * @api private
2938
- */
2939
- function load() {
2940
- let r;
2941
- try {
2942
- r = exports.storage.getItem('debug');
2943
- } catch (error) {
2944
- // Swallow
2945
- // XXX (@Qix-) should we be logging these?
2946
- }
2947
-
2948
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
2949
- if (!r && typeof process !== 'undefined' && 'env' in process) {
2950
- r = process.env.DEBUG;
2951
- }
2952
-
2953
- return r;
2954
- }
2955
-
2956
- /**
2957
- * Localstorage attempts to return the localstorage.
2958
- *
2959
- * This is necessary because safari throws
2960
- * when a user disables cookies/localstorage
2961
- * and you attempt to access it.
2962
- *
2963
- * @return {LocalStorage}
2964
- * @api private
2965
- */
2966
-
2967
- function localstorage() {
2968
- try {
2969
- // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
2970
- // The Browser also has localStorage in the global context.
2971
- return localStorage;
2972
- } catch (error) {
2973
- // Swallow
2974
- // XXX (@Qix-) should we be logging these?
2975
- }
2976
- }
2977
-
2978
- module.exports = common(exports);
2979
-
2980
- const {formatters} = module.exports;
2981
-
2982
- /**
2983
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
2984
- */
2985
-
2986
- formatters.j = function (v) {
2987
- try {
2988
- return JSON.stringify(v);
2989
- } catch (error) {
2990
- return '[UnexpectedJSONParseError]: ' + error.message;
2991
- }
2992
- };
2993
- }(browser, browser.exports));
2994
-
2995
- var Debug = browser.exports;
2996
-
2997
- var log = Debug('ninetailed:experience-sdk');
2998
2303
  var enable = function enable() {
2999
- Debug.enable('ninetailed:experience-sdk');
2304
+ loglevel__namespace.enableAll();
3000
2305
  };
3001
2306
  var disable = function disable() {
3002
- return Debug.disable();
2307
+ loglevel__namespace.disableAll();
3003
2308
  };
2309
+ var Logger = loglevel__namespace.getLogger('ninetailed:experience.js');
2310
+ var log = Logger.log;
3004
2311
 
3005
2312
  var BASE_URL = 'https://api.ninetailed.co';
3006
2313
 
@@ -4508,6 +3815,7 @@
4508
3815
  });
4509
3816
  var selectedExperience = eglibleExperiences.find(function (experience) {
4510
3817
  var trafficRandom = getTrafficRandom(profile, experience);
3818
+ log("The traffic random factor for experience ".concat(experience.id, " is ").concat(trafficRandom, ". It's traffic allocation is set to ").concat(experience.trafficAllocation, "."));
4511
3819
  return experience.trafficAllocation > trafficRandom && (includes__default["default"](profile.audiences, experience.audience.id) || // if the expriment is active already then it's selectible without further contraints to be fullfilled
4512
3820
  find__default["default"](activeExperiments, {
4513
3821
  id: experience.id
@@ -4531,7 +3839,8 @@
4531
3839
  return variants[0];
4532
3840
  }
4533
3841
 
4534
- var distributionRandom = getDistributionRandom(profile, experience); // Experiment
3842
+ var distributionRandom = getDistributionRandom(profile, experience);
3843
+ log("The distribution random factor for experience ".concat(experience.id, " is ").concat(distributionRandom, ". It's distribution is set to ").concat(JSON.stringify(experience.distribution, null, 2), ".")); // Experiment
4535
3844
 
4536
3845
  var distribution = find__default["default"](experience.distribution, function (_a) {
4537
3846
  var start = _a.start,