@ninetailed/experience.js 1.6.0 → 1.7.0-beta.1

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.
Files changed (3) hide show
  1. package/index.esm.js +5 -431
  2. package/index.umd.js +9 -435
  3. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import get$2 from 'lodash/get';
2
2
  import unionBy from 'lodash/unionBy';
3
3
  import { buildEmptyCache, buildTrackEvent, buildIdentifyEvent, buildPageEvent } from '@ninetailed/experience.js-shared';
4
- import require$$1 from 'tty';
5
- import require$$1$1 from 'util';
6
- import require$$0 from 'os';
7
4
  import Analytics from 'analytics';
8
5
  import flatten from 'lodash/flatten';
9
6
  import find from 'lodash/find';
@@ -1535,7 +1532,7 @@ var Promise$1 = global$5.Promise;
1535
1532
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$5, 'queueMicrotask');
1536
1533
  var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
1537
1534
 
1538
- var flush, head, last, notify$1, toggle, node$1, promise, then;
1535
+ var flush, head, last, notify$1, toggle, node, promise, then;
1539
1536
 
1540
1537
  // modern engines have queueMicrotask method
1541
1538
  if (!queueMicrotask) {
@@ -1560,10 +1557,10 @@ if (!queueMicrotask) {
1560
1557
  // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1561
1558
  if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
1562
1559
  toggle = true;
1563
- node$1 = document$2.createTextNode('');
1564
- new MutationObserver(flush).observe(node$1, { characterData: true });
1560
+ node = document$2.createTextNode('');
1561
+ new MutationObserver(flush).observe(node, { characterData: true });
1565
1562
  notify$1 = function () {
1566
- node$1.data = toggle = !toggle;
1563
+ node.data = toggle = !toggle;
1567
1564
  };
1568
1565
  // environments with maybe non-completely correct, but existent Promise
1569
1566
  } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
@@ -2222,8 +2219,6 @@ const buildClientNinetailedRequestContext = () => ({
2222
2219
  }
2223
2220
  });
2224
2221
 
2225
- var src = {exports: {}};
2226
-
2227
2222
  var browser = {exports: {}};
2228
2223
 
2229
2224
  /**
@@ -2935,428 +2930,7 @@ formatters.j = function (v) {
2935
2930
  };
2936
2931
  }(browser, browser.exports));
2937
2932
 
2938
- var node = {exports: {}};
2939
-
2940
- var hasFlag$1 = (flag, argv = process.argv) => {
2941
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
2942
- const position = argv.indexOf(prefix + flag);
2943
- const terminatorPosition = argv.indexOf('--');
2944
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2945
- };
2946
-
2947
- const os = require$$0;
2948
- const tty = require$$1;
2949
- const hasFlag = hasFlag$1;
2950
-
2951
- const {env} = process;
2952
-
2953
- let forceColor;
2954
- if (hasFlag('no-color') ||
2955
- hasFlag('no-colors') ||
2956
- hasFlag('color=false') ||
2957
- hasFlag('color=never')) {
2958
- forceColor = 0;
2959
- } else if (hasFlag('color') ||
2960
- hasFlag('colors') ||
2961
- hasFlag('color=true') ||
2962
- hasFlag('color=always')) {
2963
- forceColor = 1;
2964
- }
2965
-
2966
- if ('FORCE_COLOR' in env) {
2967
- if (env.FORCE_COLOR === 'true') {
2968
- forceColor = 1;
2969
- } else if (env.FORCE_COLOR === 'false') {
2970
- forceColor = 0;
2971
- } else {
2972
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
2973
- }
2974
- }
2975
-
2976
- function translateLevel(level) {
2977
- if (level === 0) {
2978
- return false;
2979
- }
2980
-
2981
- return {
2982
- level,
2983
- hasBasic: true,
2984
- has256: level >= 2,
2985
- has16m: level >= 3
2986
- };
2987
- }
2988
-
2989
- function supportsColor(haveStream, streamIsTTY) {
2990
- if (forceColor === 0) {
2991
- return 0;
2992
- }
2993
-
2994
- if (hasFlag('color=16m') ||
2995
- hasFlag('color=full') ||
2996
- hasFlag('color=truecolor')) {
2997
- return 3;
2998
- }
2999
-
3000
- if (hasFlag('color=256')) {
3001
- return 2;
3002
- }
3003
-
3004
- if (haveStream && !streamIsTTY && forceColor === undefined) {
3005
- return 0;
3006
- }
3007
-
3008
- const min = forceColor || 0;
3009
-
3010
- if (env.TERM === 'dumb') {
3011
- return min;
3012
- }
3013
-
3014
- if (process.platform === 'win32') {
3015
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
3016
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
3017
- const osRelease = os.release().split('.');
3018
- if (
3019
- Number(osRelease[0]) >= 10 &&
3020
- Number(osRelease[2]) >= 10586
3021
- ) {
3022
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
3023
- }
3024
-
3025
- return 1;
3026
- }
3027
-
3028
- if ('CI' in env) {
3029
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
3030
- return 1;
3031
- }
3032
-
3033
- return min;
3034
- }
3035
-
3036
- if ('TEAMCITY_VERSION' in env) {
3037
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3038
- }
3039
-
3040
- if (env.COLORTERM === 'truecolor') {
3041
- return 3;
3042
- }
3043
-
3044
- if ('TERM_PROGRAM' in env) {
3045
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
3046
-
3047
- switch (env.TERM_PROGRAM) {
3048
- case 'iTerm.app':
3049
- return version >= 3 ? 3 : 2;
3050
- case 'Apple_Terminal':
3051
- return 2;
3052
- // No default
3053
- }
3054
- }
3055
-
3056
- if (/-256(color)?$/i.test(env.TERM)) {
3057
- return 2;
3058
- }
3059
-
3060
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
3061
- return 1;
3062
- }
3063
-
3064
- if ('COLORTERM' in env) {
3065
- return 1;
3066
- }
3067
-
3068
- return min;
3069
- }
3070
-
3071
- function getSupportLevel(stream) {
3072
- const level = supportsColor(stream, stream && stream.isTTY);
3073
- return translateLevel(level);
3074
- }
3075
-
3076
- var supportsColor_1 = {
3077
- supportsColor: getSupportLevel,
3078
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
3079
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
3080
- };
3081
-
3082
- /**
3083
- * Module dependencies.
3084
- */
3085
-
3086
- (function (module, exports) {
3087
- const tty = require$$1;
3088
- const util = require$$1$1;
3089
-
3090
- /**
3091
- * This is the Node.js implementation of `debug()`.
3092
- */
3093
-
3094
- exports.init = init;
3095
- exports.log = log;
3096
- exports.formatArgs = formatArgs;
3097
- exports.save = save;
3098
- exports.load = load;
3099
- exports.useColors = useColors;
3100
- exports.destroy = util.deprecate(
3101
- () => {},
3102
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
3103
- );
3104
-
3105
- /**
3106
- * Colors.
3107
- */
3108
-
3109
- exports.colors = [6, 2, 3, 4, 5, 1];
3110
-
3111
- try {
3112
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
3113
- // eslint-disable-next-line import/no-extraneous-dependencies
3114
- const supportsColor = supportsColor_1;
3115
-
3116
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
3117
- exports.colors = [
3118
- 20,
3119
- 21,
3120
- 26,
3121
- 27,
3122
- 32,
3123
- 33,
3124
- 38,
3125
- 39,
3126
- 40,
3127
- 41,
3128
- 42,
3129
- 43,
3130
- 44,
3131
- 45,
3132
- 56,
3133
- 57,
3134
- 62,
3135
- 63,
3136
- 68,
3137
- 69,
3138
- 74,
3139
- 75,
3140
- 76,
3141
- 77,
3142
- 78,
3143
- 79,
3144
- 80,
3145
- 81,
3146
- 92,
3147
- 93,
3148
- 98,
3149
- 99,
3150
- 112,
3151
- 113,
3152
- 128,
3153
- 129,
3154
- 134,
3155
- 135,
3156
- 148,
3157
- 149,
3158
- 160,
3159
- 161,
3160
- 162,
3161
- 163,
3162
- 164,
3163
- 165,
3164
- 166,
3165
- 167,
3166
- 168,
3167
- 169,
3168
- 170,
3169
- 171,
3170
- 172,
3171
- 173,
3172
- 178,
3173
- 179,
3174
- 184,
3175
- 185,
3176
- 196,
3177
- 197,
3178
- 198,
3179
- 199,
3180
- 200,
3181
- 201,
3182
- 202,
3183
- 203,
3184
- 204,
3185
- 205,
3186
- 206,
3187
- 207,
3188
- 208,
3189
- 209,
3190
- 214,
3191
- 215,
3192
- 220,
3193
- 221
3194
- ];
3195
- }
3196
- } catch (error) {
3197
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
3198
- }
3199
-
3200
- /**
3201
- * Build up the default `inspectOpts` object from the environment variables.
3202
- *
3203
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
3204
- */
3205
-
3206
- exports.inspectOpts = Object.keys(process.env).filter(key => {
3207
- return /^debug_/i.test(key);
3208
- }).reduce((obj, key) => {
3209
- // Camel-case
3210
- const prop = key
3211
- .substring(6)
3212
- .toLowerCase()
3213
- .replace(/_([a-z])/g, (_, k) => {
3214
- return k.toUpperCase();
3215
- });
3216
-
3217
- // Coerce string value into JS value
3218
- let val = process.env[key];
3219
- if (/^(yes|on|true|enabled)$/i.test(val)) {
3220
- val = true;
3221
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
3222
- val = false;
3223
- } else if (val === 'null') {
3224
- val = null;
3225
- } else {
3226
- val = Number(val);
3227
- }
3228
-
3229
- obj[prop] = val;
3230
- return obj;
3231
- }, {});
3232
-
3233
- /**
3234
- * Is stdout a TTY? Colored output is enabled when `true`.
3235
- */
3236
-
3237
- function useColors() {
3238
- return 'colors' in exports.inspectOpts ?
3239
- Boolean(exports.inspectOpts.colors) :
3240
- tty.isatty(process.stderr.fd);
3241
- }
3242
-
3243
- /**
3244
- * Adds ANSI color escape codes if enabled.
3245
- *
3246
- * @api public
3247
- */
3248
-
3249
- function formatArgs(args) {
3250
- const {namespace: name, useColors} = this;
3251
-
3252
- if (useColors) {
3253
- const c = this.color;
3254
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
3255
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
3256
-
3257
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
3258
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
3259
- } else {
3260
- args[0] = getDate() + name + ' ' + args[0];
3261
- }
3262
- }
3263
-
3264
- function getDate() {
3265
- if (exports.inspectOpts.hideDate) {
3266
- return '';
3267
- }
3268
- return new Date().toISOString() + ' ';
3269
- }
3270
-
3271
- /**
3272
- * Invokes `util.format()` with the specified arguments and writes to stderr.
3273
- */
3274
-
3275
- function log(...args) {
3276
- return process.stderr.write(util.format(...args) + '\n');
3277
- }
3278
-
3279
- /**
3280
- * Save `namespaces`.
3281
- *
3282
- * @param {String} namespaces
3283
- * @api private
3284
- */
3285
- function save(namespaces) {
3286
- if (namespaces) {
3287
- process.env.DEBUG = namespaces;
3288
- } else {
3289
- // If you set a process.env field to null or undefined, it gets cast to the
3290
- // string 'null' or 'undefined'. Just delete instead.
3291
- delete process.env.DEBUG;
3292
- }
3293
- }
3294
-
3295
- /**
3296
- * Load `namespaces`.
3297
- *
3298
- * @return {String} returns the previously persisted debug modes
3299
- * @api private
3300
- */
3301
-
3302
- function load() {
3303
- return process.env.DEBUG;
3304
- }
3305
-
3306
- /**
3307
- * Init logic for `debug` instances.
3308
- *
3309
- * Create a new `inspectOpts` object in case `useColors` is set
3310
- * differently for a particular `debug` instance.
3311
- */
3312
-
3313
- function init(debug) {
3314
- debug.inspectOpts = {};
3315
-
3316
- const keys = Object.keys(exports.inspectOpts);
3317
- for (let i = 0; i < keys.length; i++) {
3318
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
3319
- }
3320
- }
3321
-
3322
- module.exports = common(exports);
3323
-
3324
- const {formatters} = module.exports;
3325
-
3326
- /**
3327
- * Map %o to `util.inspect()`, all on a single line.
3328
- */
3329
-
3330
- formatters.o = function (v) {
3331
- this.inspectOpts.colors = this.useColors;
3332
- return util.inspect(v, this.inspectOpts)
3333
- .split('\n')
3334
- .map(str => str.trim())
3335
- .join(' ');
3336
- };
3337
-
3338
- /**
3339
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
3340
- */
3341
-
3342
- formatters.O = function (v) {
3343
- this.inspectOpts.colors = this.useColors;
3344
- return util.inspect(v, this.inspectOpts);
3345
- };
3346
- }(node, node.exports));
3347
-
3348
- /**
3349
- * Detect Electron renderer / nwjs process, which is node, but we should
3350
- * treat as a browser.
3351
- */
3352
-
3353
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3354
- src.exports = browser.exports;
3355
- } else {
3356
- src.exports = node.exports;
3357
- }
3358
-
3359
- var Debug = src.exports;
2933
+ var Debug = browser.exports;
3360
2934
 
3361
2935
  const log = Debug('ninetailed:experience-sdk');
3362
2936
  const enable = () => {
package/index.umd.js CHANGED
@@ -1,16 +1,13 @@
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('tty'), require('util'), require('os'), require('analytics'), require('lodash/flatten'), require('lodash/find'), require('lodash/includes')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'lodash/get', 'lodash/unionBy', '@ninetailed/experience.js-shared', 'tty', 'util', 'os', 'analytics', 'lodash/flatten', 'lodash/find', 'lodash/includes'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Javascript = {}, global.get$2, global.unionBy, global.experience_jsShared, global.require$$1, global.require$$1$1, global.require$$0, global.Analytics, global.flatten, global.find, global.includes));
5
- })(this, (function (exports, get$2, unionBy, experience_jsShared, require$$1, require$$1$1, require$$0, Analytics, flatten, find, includes) { 'use strict';
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')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'lodash/get', 'lodash/unionBy', '@ninetailed/experience.js-shared', 'analytics', 'lodash/flatten', 'lodash/find', 'lodash/includes'], 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));
5
+ })(this, (function (exports, get$2, unionBy, experience_jsShared, Analytics, flatten, find, includes) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
9
9
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get$2);
10
10
  var unionBy__default = /*#__PURE__*/_interopDefaultLegacy(unionBy);
11
- var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
12
- var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
13
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
14
11
  var Analytics__default = /*#__PURE__*/_interopDefaultLegacy(Analytics);
15
12
  var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
16
13
  var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
@@ -1542,7 +1539,7 @@
1542
1539
  var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$3, 'queueMicrotask');
1543
1540
  var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
1544
1541
 
1545
- var flush, head, last, notify$1, toggle, node$1, promise, then;
1542
+ var flush, head, last, notify$1, toggle, node, promise, then;
1546
1543
 
1547
1544
  // modern engines have queueMicrotask method
1548
1545
  if (!queueMicrotask) {
@@ -1567,10 +1564,10 @@
1567
1564
  // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1568
1565
  if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
1569
1566
  toggle = true;
1570
- node$1 = document$2.createTextNode('');
1571
- new MutationObserver(flush).observe(node$1, { characterData: true });
1567
+ node = document$2.createTextNode('');
1568
+ new MutationObserver(flush).observe(node, { characterData: true });
1572
1569
  notify$1 = function () {
1573
- node$1.data = toggle = !toggle;
1570
+ node.data = toggle = !toggle;
1574
1571
  };
1575
1572
  // environments with maybe non-completely correct, but existent Promise
1576
1573
  } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
@@ -2283,8 +2280,6 @@
2283
2280
  };
2284
2281
  };
2285
2282
 
2286
- var src = {exports: {}};
2287
-
2288
2283
  var browser = {exports: {}};
2289
2284
 
2290
2285
  /**
@@ -2996,428 +2991,7 @@
2996
2991
  };
2997
2992
  }(browser, browser.exports));
2998
2993
 
2999
- var node = {exports: {}};
3000
-
3001
- var hasFlag$1 = (flag, argv = process.argv) => {
3002
- const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
3003
- const position = argv.indexOf(prefix + flag);
3004
- const terminatorPosition = argv.indexOf('--');
3005
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
3006
- };
3007
-
3008
- const os = require$$0__default["default"];
3009
- const tty = require$$1__default["default"];
3010
- const hasFlag = hasFlag$1;
3011
-
3012
- const {env} = process;
3013
-
3014
- let forceColor;
3015
- if (hasFlag('no-color') ||
3016
- hasFlag('no-colors') ||
3017
- hasFlag('color=false') ||
3018
- hasFlag('color=never')) {
3019
- forceColor = 0;
3020
- } else if (hasFlag('color') ||
3021
- hasFlag('colors') ||
3022
- hasFlag('color=true') ||
3023
- hasFlag('color=always')) {
3024
- forceColor = 1;
3025
- }
3026
-
3027
- if ('FORCE_COLOR' in env) {
3028
- if (env.FORCE_COLOR === 'true') {
3029
- forceColor = 1;
3030
- } else if (env.FORCE_COLOR === 'false') {
3031
- forceColor = 0;
3032
- } else {
3033
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
3034
- }
3035
- }
3036
-
3037
- function translateLevel(level) {
3038
- if (level === 0) {
3039
- return false;
3040
- }
3041
-
3042
- return {
3043
- level,
3044
- hasBasic: true,
3045
- has256: level >= 2,
3046
- has16m: level >= 3
3047
- };
3048
- }
3049
-
3050
- function supportsColor(haveStream, streamIsTTY) {
3051
- if (forceColor === 0) {
3052
- return 0;
3053
- }
3054
-
3055
- if (hasFlag('color=16m') ||
3056
- hasFlag('color=full') ||
3057
- hasFlag('color=truecolor')) {
3058
- return 3;
3059
- }
3060
-
3061
- if (hasFlag('color=256')) {
3062
- return 2;
3063
- }
3064
-
3065
- if (haveStream && !streamIsTTY && forceColor === undefined) {
3066
- return 0;
3067
- }
3068
-
3069
- const min = forceColor || 0;
3070
-
3071
- if (env.TERM === 'dumb') {
3072
- return min;
3073
- }
3074
-
3075
- if (process.platform === 'win32') {
3076
- // Windows 10 build 10586 is the first Windows release that supports 256 colors.
3077
- // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
3078
- const osRelease = os.release().split('.');
3079
- if (
3080
- Number(osRelease[0]) >= 10 &&
3081
- Number(osRelease[2]) >= 10586
3082
- ) {
3083
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
3084
- }
3085
-
3086
- return 1;
3087
- }
3088
-
3089
- if ('CI' in env) {
3090
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
3091
- return 1;
3092
- }
3093
-
3094
- return min;
3095
- }
3096
-
3097
- if ('TEAMCITY_VERSION' in env) {
3098
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3099
- }
3100
-
3101
- if (env.COLORTERM === 'truecolor') {
3102
- return 3;
3103
- }
3104
-
3105
- if ('TERM_PROGRAM' in env) {
3106
- const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
3107
-
3108
- switch (env.TERM_PROGRAM) {
3109
- case 'iTerm.app':
3110
- return version >= 3 ? 3 : 2;
3111
- case 'Apple_Terminal':
3112
- return 2;
3113
- // No default
3114
- }
3115
- }
3116
-
3117
- if (/-256(color)?$/i.test(env.TERM)) {
3118
- return 2;
3119
- }
3120
-
3121
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
3122
- return 1;
3123
- }
3124
-
3125
- if ('COLORTERM' in env) {
3126
- return 1;
3127
- }
3128
-
3129
- return min;
3130
- }
3131
-
3132
- function getSupportLevel(stream) {
3133
- const level = supportsColor(stream, stream && stream.isTTY);
3134
- return translateLevel(level);
3135
- }
3136
-
3137
- var supportsColor_1 = {
3138
- supportsColor: getSupportLevel,
3139
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
3140
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
3141
- };
3142
-
3143
- /**
3144
- * Module dependencies.
3145
- */
3146
-
3147
- (function (module, exports) {
3148
- const tty = require$$1__default["default"];
3149
- const util = require$$1__default$1["default"];
3150
-
3151
- /**
3152
- * This is the Node.js implementation of `debug()`.
3153
- */
3154
-
3155
- exports.init = init;
3156
- exports.log = log;
3157
- exports.formatArgs = formatArgs;
3158
- exports.save = save;
3159
- exports.load = load;
3160
- exports.useColors = useColors;
3161
- exports.destroy = util.deprecate(
3162
- () => {},
3163
- 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
3164
- );
3165
-
3166
- /**
3167
- * Colors.
3168
- */
3169
-
3170
- exports.colors = [6, 2, 3, 4, 5, 1];
3171
-
3172
- try {
3173
- // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
3174
- // eslint-disable-next-line import/no-extraneous-dependencies
3175
- const supportsColor = supportsColor_1;
3176
-
3177
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
3178
- exports.colors = [
3179
- 20,
3180
- 21,
3181
- 26,
3182
- 27,
3183
- 32,
3184
- 33,
3185
- 38,
3186
- 39,
3187
- 40,
3188
- 41,
3189
- 42,
3190
- 43,
3191
- 44,
3192
- 45,
3193
- 56,
3194
- 57,
3195
- 62,
3196
- 63,
3197
- 68,
3198
- 69,
3199
- 74,
3200
- 75,
3201
- 76,
3202
- 77,
3203
- 78,
3204
- 79,
3205
- 80,
3206
- 81,
3207
- 92,
3208
- 93,
3209
- 98,
3210
- 99,
3211
- 112,
3212
- 113,
3213
- 128,
3214
- 129,
3215
- 134,
3216
- 135,
3217
- 148,
3218
- 149,
3219
- 160,
3220
- 161,
3221
- 162,
3222
- 163,
3223
- 164,
3224
- 165,
3225
- 166,
3226
- 167,
3227
- 168,
3228
- 169,
3229
- 170,
3230
- 171,
3231
- 172,
3232
- 173,
3233
- 178,
3234
- 179,
3235
- 184,
3236
- 185,
3237
- 196,
3238
- 197,
3239
- 198,
3240
- 199,
3241
- 200,
3242
- 201,
3243
- 202,
3244
- 203,
3245
- 204,
3246
- 205,
3247
- 206,
3248
- 207,
3249
- 208,
3250
- 209,
3251
- 214,
3252
- 215,
3253
- 220,
3254
- 221
3255
- ];
3256
- }
3257
- } catch (error) {
3258
- // Swallow - we only care if `supports-color` is available; it doesn't have to be.
3259
- }
3260
-
3261
- /**
3262
- * Build up the default `inspectOpts` object from the environment variables.
3263
- *
3264
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
3265
- */
3266
-
3267
- exports.inspectOpts = Object.keys(process.env).filter(key => {
3268
- return /^debug_/i.test(key);
3269
- }).reduce((obj, key) => {
3270
- // Camel-case
3271
- const prop = key
3272
- .substring(6)
3273
- .toLowerCase()
3274
- .replace(/_([a-z])/g, (_, k) => {
3275
- return k.toUpperCase();
3276
- });
3277
-
3278
- // Coerce string value into JS value
3279
- let val = process.env[key];
3280
- if (/^(yes|on|true|enabled)$/i.test(val)) {
3281
- val = true;
3282
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
3283
- val = false;
3284
- } else if (val === 'null') {
3285
- val = null;
3286
- } else {
3287
- val = Number(val);
3288
- }
3289
-
3290
- obj[prop] = val;
3291
- return obj;
3292
- }, {});
3293
-
3294
- /**
3295
- * Is stdout a TTY? Colored output is enabled when `true`.
3296
- */
3297
-
3298
- function useColors() {
3299
- return 'colors' in exports.inspectOpts ?
3300
- Boolean(exports.inspectOpts.colors) :
3301
- tty.isatty(process.stderr.fd);
3302
- }
3303
-
3304
- /**
3305
- * Adds ANSI color escape codes if enabled.
3306
- *
3307
- * @api public
3308
- */
3309
-
3310
- function formatArgs(args) {
3311
- const {namespace: name, useColors} = this;
3312
-
3313
- if (useColors) {
3314
- const c = this.color;
3315
- const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
3316
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
3317
-
3318
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
3319
- args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
3320
- } else {
3321
- args[0] = getDate() + name + ' ' + args[0];
3322
- }
3323
- }
3324
-
3325
- function getDate() {
3326
- if (exports.inspectOpts.hideDate) {
3327
- return '';
3328
- }
3329
- return new Date().toISOString() + ' ';
3330
- }
3331
-
3332
- /**
3333
- * Invokes `util.format()` with the specified arguments and writes to stderr.
3334
- */
3335
-
3336
- function log(...args) {
3337
- return process.stderr.write(util.format(...args) + '\n');
3338
- }
3339
-
3340
- /**
3341
- * Save `namespaces`.
3342
- *
3343
- * @param {String} namespaces
3344
- * @api private
3345
- */
3346
- function save(namespaces) {
3347
- if (namespaces) {
3348
- process.env.DEBUG = namespaces;
3349
- } else {
3350
- // If you set a process.env field to null or undefined, it gets cast to the
3351
- // string 'null' or 'undefined'. Just delete instead.
3352
- delete process.env.DEBUG;
3353
- }
3354
- }
3355
-
3356
- /**
3357
- * Load `namespaces`.
3358
- *
3359
- * @return {String} returns the previously persisted debug modes
3360
- * @api private
3361
- */
3362
-
3363
- function load() {
3364
- return process.env.DEBUG;
3365
- }
3366
-
3367
- /**
3368
- * Init logic for `debug` instances.
3369
- *
3370
- * Create a new `inspectOpts` object in case `useColors` is set
3371
- * differently for a particular `debug` instance.
3372
- */
3373
-
3374
- function init(debug) {
3375
- debug.inspectOpts = {};
3376
-
3377
- const keys = Object.keys(exports.inspectOpts);
3378
- for (let i = 0; i < keys.length; i++) {
3379
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
3380
- }
3381
- }
3382
-
3383
- module.exports = common(exports);
3384
-
3385
- const {formatters} = module.exports;
3386
-
3387
- /**
3388
- * Map %o to `util.inspect()`, all on a single line.
3389
- */
3390
-
3391
- formatters.o = function (v) {
3392
- this.inspectOpts.colors = this.useColors;
3393
- return util.inspect(v, this.inspectOpts)
3394
- .split('\n')
3395
- .map(str => str.trim())
3396
- .join(' ');
3397
- };
3398
-
3399
- /**
3400
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
3401
- */
3402
-
3403
- formatters.O = function (v) {
3404
- this.inspectOpts.colors = this.useColors;
3405
- return util.inspect(v, this.inspectOpts);
3406
- };
3407
- }(node, node.exports));
3408
-
3409
- /**
3410
- * Detect Electron renderer / nwjs process, which is node, but we should
3411
- * treat as a browser.
3412
- */
3413
-
3414
- if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
3415
- src.exports = browser.exports;
3416
- } else {
3417
- src.exports = node.exports;
3418
- }
3419
-
3420
- var Debug = src.exports;
2994
+ var Debug = browser.exports;
3421
2995
 
3422
2996
  var log = Debug('ninetailed:experience-sdk');
3423
2997
  var enable = function enable() {
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ninetailed/experience.js",
3
- "version": "1.6.0",
3
+ "version": "1.7.0-beta.1",
4
4
  "main": "./index.umd.js",
5
5
  "module": "./index.esm.js",
6
6
  "typings": "./index.d.ts",
7
7
  "dependencies": {
8
8
  "analytics": "^0.8.0",
9
- "@ninetailed/experience.js-shared": "1.6.0",
9
+ "@ninetailed/experience.js-shared": "1.7.0-beta.1",
10
10
  "uuid": "^8.3.2",
11
11
  "ts-toolbelt": "^9.6.0",
12
12
  "locale-enum": "^1.1.1",