@ninetailed/experience.js 2.2.9-beta.0 → 3.0.1-beta.4
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.d.ts +0 -2
- package/index.esm.js +481 -725
- package/index.umd.js +282 -698
- package/lib/Ninetailed.d.ts +5 -6
- package/lib/analytics/constants.d.ts +4 -0
- package/lib/analytics/get-analytics-plugin.d.ts +0 -6
- package/lib/analytics/index.d.ts +0 -1
- package/lib/experience/selectVariant.d.ts +1 -1
- package/lib/utils/asyncThrottle.d.ts +6 -0
- package/package.json +6 -6
- package/lib/analytics/Cache/cache.d.ts +0 -11
- package/lib/analytics/Cache/index.d.ts +0 -1
- package/lib/analytics/utility/apiClient.d.ts +0 -23
- package/lib/analytics/utility/index.d.ts +0 -1
- package/lib/logger/ConsoleLogSink.d.ts +0 -10
- package/lib/logger/LogSink.d.ts +0 -10
- package/lib/logger/Logger.d.ts +0 -17
- package/lib/logger/OnErrorLogSink.d.ts +0 -10
- package/lib/logger/OnLogLogSink.d.ts +0 -12
- package/lib/logger/index.d.ts +0 -7
package/index.esm.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import get$2 from 'lodash/get';
|
|
2
1
|
import unionBy from 'lodash/unionBy';
|
|
3
|
-
import {
|
|
4
|
-
import { diary, enable } from 'diary';
|
|
2
|
+
import { NinetailedApiClient, logger, ConsoleLogSink, buildTrackEvent, buildIdentifyEvent, buildPageEvent, OnLogLogSink, OnErrorLogSink } from '@ninetailed/experience.js-shared';
|
|
5
3
|
import Analytics from 'analytics';
|
|
6
4
|
import flatten from 'lodash/flatten';
|
|
7
5
|
import find from 'lodash/find';
|
|
@@ -90,32 +88,32 @@ var NATIVE_BIND$2 = functionBindNative;
|
|
|
90
88
|
var FunctionPrototype$2 = Function.prototype;
|
|
91
89
|
var bind$5 = FunctionPrototype$2.bind;
|
|
92
90
|
var call$e = FunctionPrototype$2.call;
|
|
93
|
-
var uncurryThis$
|
|
91
|
+
var uncurryThis$o = NATIVE_BIND$2 && bind$5.bind(call$e, call$e);
|
|
94
92
|
|
|
95
93
|
var functionUncurryThis = NATIVE_BIND$2 ? function (fn) {
|
|
96
|
-
return fn && uncurryThis$
|
|
94
|
+
return fn && uncurryThis$o(fn);
|
|
97
95
|
} : function (fn) {
|
|
98
96
|
return fn && function () {
|
|
99
97
|
return call$e.apply(fn, arguments);
|
|
100
98
|
};
|
|
101
99
|
};
|
|
102
100
|
|
|
103
|
-
var uncurryThis$
|
|
101
|
+
var uncurryThis$n = functionUncurryThis;
|
|
104
102
|
|
|
105
|
-
var toString$
|
|
106
|
-
var stringSlice$6 = uncurryThis$
|
|
103
|
+
var toString$a = uncurryThis$n({}.toString);
|
|
104
|
+
var stringSlice$6 = uncurryThis$n(''.slice);
|
|
107
105
|
|
|
108
106
|
var classofRaw$1 = function (it) {
|
|
109
|
-
return stringSlice$6(toString$
|
|
107
|
+
return stringSlice$6(toString$a(it), 8, -1);
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
var global$J = global$K;
|
|
113
|
-
var uncurryThis$
|
|
111
|
+
var uncurryThis$m = functionUncurryThis;
|
|
114
112
|
var fails$h = fails$k;
|
|
115
113
|
var classof$7 = classofRaw$1;
|
|
116
114
|
|
|
117
115
|
var Object$5 = global$J.Object;
|
|
118
|
-
var split = uncurryThis$
|
|
116
|
+
var split = uncurryThis$m(''.split);
|
|
119
117
|
|
|
120
118
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
121
119
|
var indexedObject = fails$h(function () {
|
|
@@ -132,17 +130,17 @@ var TypeError$h = global$I.TypeError;
|
|
|
132
130
|
|
|
133
131
|
// `RequireObjectCoercible` abstract operation
|
|
134
132
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
135
|
-
var requireObjectCoercible$
|
|
133
|
+
var requireObjectCoercible$8 = function (it) {
|
|
136
134
|
if (it == undefined) throw TypeError$h("Can't call method on " + it);
|
|
137
135
|
return it;
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
// toObject with fallback for non-array-like ES3 strings
|
|
141
139
|
var IndexedObject$2 = indexedObject;
|
|
142
|
-
var requireObjectCoercible$
|
|
140
|
+
var requireObjectCoercible$7 = requireObjectCoercible$8;
|
|
143
141
|
|
|
144
142
|
var toIndexedObject$5 = function (it) {
|
|
145
|
-
return IndexedObject$2(requireObjectCoercible$
|
|
143
|
+
return IndexedObject$2(requireObjectCoercible$7(it));
|
|
146
144
|
};
|
|
147
145
|
|
|
148
146
|
// `IsCallable` abstract operation
|
|
@@ -168,9 +166,9 @@ var getBuiltIn$7 = function (namespace, method) {
|
|
|
168
166
|
return arguments.length < 2 ? aFunction(global$H[namespace]) : global$H[namespace] && global$H[namespace][method];
|
|
169
167
|
};
|
|
170
168
|
|
|
171
|
-
var uncurryThis$
|
|
169
|
+
var uncurryThis$l = functionUncurryThis;
|
|
172
170
|
|
|
173
|
-
var objectIsPrototypeOf = uncurryThis$
|
|
171
|
+
var objectIsPrototypeOf = uncurryThis$l({}.isPrototypeOf);
|
|
174
172
|
|
|
175
173
|
var getBuiltIn$6 = getBuiltIn$7;
|
|
176
174
|
|
|
@@ -328,20 +326,20 @@ var store$2 = sharedStore;
|
|
|
328
326
|
});
|
|
329
327
|
|
|
330
328
|
var global$z = global$K;
|
|
331
|
-
var requireObjectCoercible$
|
|
329
|
+
var requireObjectCoercible$6 = requireObjectCoercible$8;
|
|
332
330
|
|
|
333
331
|
var Object$3 = global$z.Object;
|
|
334
332
|
|
|
335
333
|
// `ToObject` abstract operation
|
|
336
334
|
// https://tc39.es/ecma262/#sec-toobject
|
|
337
335
|
var toObject$5 = function (argument) {
|
|
338
|
-
return Object$3(requireObjectCoercible$
|
|
336
|
+
return Object$3(requireObjectCoercible$6(argument));
|
|
339
337
|
};
|
|
340
338
|
|
|
341
|
-
var uncurryThis$
|
|
339
|
+
var uncurryThis$k = functionUncurryThis;
|
|
342
340
|
var toObject$4 = toObject$5;
|
|
343
341
|
|
|
344
|
-
var hasOwnProperty = uncurryThis$
|
|
342
|
+
var hasOwnProperty = uncurryThis$k({}.hasOwnProperty);
|
|
345
343
|
|
|
346
344
|
// `HasOwnProperty` abstract operation
|
|
347
345
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
@@ -349,14 +347,14 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
|
349
347
|
return hasOwnProperty(toObject$4(it), key);
|
|
350
348
|
};
|
|
351
349
|
|
|
352
|
-
var uncurryThis$
|
|
350
|
+
var uncurryThis$j = functionUncurryThis;
|
|
353
351
|
|
|
354
352
|
var id = 0;
|
|
355
353
|
var postfix = Math.random();
|
|
356
|
-
var toString$
|
|
354
|
+
var toString$9 = uncurryThis$j(1.0.toString);
|
|
357
355
|
|
|
358
356
|
var uid$2 = function (key) {
|
|
359
|
-
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$
|
|
357
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$9(++id + postfix, 36);
|
|
360
358
|
};
|
|
361
359
|
|
|
362
360
|
var global$y = global$K;
|
|
@@ -552,11 +550,11 @@ var createNonEnumerableProperty$6 = DESCRIPTORS$5 ? function (object, key, value
|
|
|
552
550
|
|
|
553
551
|
var redefine$6 = {exports: {}};
|
|
554
552
|
|
|
555
|
-
var uncurryThis$
|
|
553
|
+
var uncurryThis$i = functionUncurryThis;
|
|
556
554
|
var isCallable$d = isCallable$j;
|
|
557
555
|
var store$1 = sharedStore;
|
|
558
556
|
|
|
559
|
-
var functionToString = uncurryThis$
|
|
557
|
+
var functionToString = uncurryThis$i(Function.toString);
|
|
560
558
|
|
|
561
559
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
562
560
|
if (!isCallable$d(store$1.inspectSource)) {
|
|
@@ -588,7 +586,7 @@ var hiddenKeys$4 = {};
|
|
|
588
586
|
|
|
589
587
|
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
590
588
|
var global$s = global$K;
|
|
591
|
-
var uncurryThis$
|
|
589
|
+
var uncurryThis$h = functionUncurryThis;
|
|
592
590
|
var isObject$3 = isObject$8;
|
|
593
591
|
var createNonEnumerableProperty$5 = createNonEnumerableProperty$6;
|
|
594
592
|
var hasOwn$7 = hasOwnProperty_1;
|
|
@@ -599,16 +597,16 @@ var hiddenKeys$3 = hiddenKeys$4;
|
|
|
599
597
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
600
598
|
var TypeError$b = global$s.TypeError;
|
|
601
599
|
var WeakMap = global$s.WeakMap;
|
|
602
|
-
var set$
|
|
600
|
+
var set$1, get, has;
|
|
603
601
|
|
|
604
602
|
var enforce = function (it) {
|
|
605
|
-
return has(it) ? get
|
|
603
|
+
return has(it) ? get(it) : set$1(it, {});
|
|
606
604
|
};
|
|
607
605
|
|
|
608
606
|
var getterFor = function (TYPE) {
|
|
609
607
|
return function (it) {
|
|
610
608
|
var state;
|
|
611
|
-
if (!isObject$3(it) || (state = get
|
|
609
|
+
if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
|
|
612
610
|
throw TypeError$b('Incompatible receiver, ' + TYPE + ' required');
|
|
613
611
|
} return state;
|
|
614
612
|
};
|
|
@@ -616,16 +614,16 @@ var getterFor = function (TYPE) {
|
|
|
616
614
|
|
|
617
615
|
if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
618
616
|
var store = shared$1.state || (shared$1.state = new WeakMap());
|
|
619
|
-
var wmget = uncurryThis$
|
|
620
|
-
var wmhas = uncurryThis$
|
|
621
|
-
var wmset = uncurryThis$
|
|
622
|
-
set$
|
|
617
|
+
var wmget = uncurryThis$h(store.get);
|
|
618
|
+
var wmhas = uncurryThis$h(store.has);
|
|
619
|
+
var wmset = uncurryThis$h(store.set);
|
|
620
|
+
set$1 = function (it, metadata) {
|
|
623
621
|
if (wmhas(store, it)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
624
622
|
metadata.facade = it;
|
|
625
623
|
wmset(store, it, metadata);
|
|
626
624
|
return metadata;
|
|
627
625
|
};
|
|
628
|
-
get
|
|
626
|
+
get = function (it) {
|
|
629
627
|
return wmget(store, it) || {};
|
|
630
628
|
};
|
|
631
629
|
has = function (it) {
|
|
@@ -634,13 +632,13 @@ if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
|
634
632
|
} else {
|
|
635
633
|
var STATE = sharedKey$2('state');
|
|
636
634
|
hiddenKeys$3[STATE] = true;
|
|
637
|
-
set$
|
|
635
|
+
set$1 = function (it, metadata) {
|
|
638
636
|
if (hasOwn$7(it, STATE)) throw new TypeError$b(OBJECT_ALREADY_INITIALIZED);
|
|
639
637
|
metadata.facade = it;
|
|
640
638
|
createNonEnumerableProperty$5(it, STATE, metadata);
|
|
641
639
|
return metadata;
|
|
642
640
|
};
|
|
643
|
-
get
|
|
641
|
+
get = function (it) {
|
|
644
642
|
return hasOwn$7(it, STATE) ? it[STATE] : {};
|
|
645
643
|
};
|
|
646
644
|
has = function (it) {
|
|
@@ -649,8 +647,8 @@ if (NATIVE_WEAK_MAP || shared$1.state) {
|
|
|
649
647
|
}
|
|
650
648
|
|
|
651
649
|
var internalState = {
|
|
652
|
-
set: set$
|
|
653
|
-
get: get
|
|
650
|
+
set: set$1,
|
|
651
|
+
get: get,
|
|
654
652
|
has: has,
|
|
655
653
|
enforce: enforce,
|
|
656
654
|
getterFor: getterFor
|
|
@@ -798,13 +796,13 @@ var arrayIncludes = {
|
|
|
798
796
|
indexOf: createMethod$3(false)
|
|
799
797
|
};
|
|
800
798
|
|
|
801
|
-
var uncurryThis$
|
|
799
|
+
var uncurryThis$g = functionUncurryThis;
|
|
802
800
|
var hasOwn$4 = hasOwnProperty_1;
|
|
803
801
|
var toIndexedObject$2 = toIndexedObject$5;
|
|
804
802
|
var indexOf$1 = arrayIncludes.indexOf;
|
|
805
803
|
var hiddenKeys$2 = hiddenKeys$4;
|
|
806
804
|
|
|
807
|
-
var push$2 = uncurryThis$
|
|
805
|
+
var push$2 = uncurryThis$g([].push);
|
|
808
806
|
|
|
809
807
|
var objectKeysInternal = function (object, names) {
|
|
810
808
|
var O = toIndexedObject$2(object);
|
|
@@ -848,12 +846,12 @@ var objectGetOwnPropertySymbols = {};
|
|
|
848
846
|
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
849
847
|
|
|
850
848
|
var getBuiltIn$4 = getBuiltIn$7;
|
|
851
|
-
var uncurryThis$
|
|
849
|
+
var uncurryThis$f = functionUncurryThis;
|
|
852
850
|
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
853
851
|
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
854
852
|
var anObject$c = anObject$e;
|
|
855
853
|
|
|
856
|
-
var concat$2 = uncurryThis$
|
|
854
|
+
var concat$2 = uncurryThis$f([].concat);
|
|
857
855
|
|
|
858
856
|
// all object keys, includes non-enumerable and symbols
|
|
859
857
|
var ownKeys$1 = getBuiltIn$4('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
@@ -982,7 +980,7 @@ var aPossiblePrototype$1 = function (argument) {
|
|
|
982
980
|
|
|
983
981
|
/* eslint-disable no-proto -- safe */
|
|
984
982
|
|
|
985
|
-
var uncurryThis$
|
|
983
|
+
var uncurryThis$e = functionUncurryThis;
|
|
986
984
|
var anObject$b = anObject$e;
|
|
987
985
|
var aPossiblePrototype = aPossiblePrototype$1;
|
|
988
986
|
|
|
@@ -996,7 +994,7 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
996
994
|
var setter;
|
|
997
995
|
try {
|
|
998
996
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
999
|
-
setter = uncurryThis$
|
|
997
|
+
setter = uncurryThis$e(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1000
998
|
setter(test, []);
|
|
1001
999
|
CORRECT_SETTER = test instanceof Array;
|
|
1002
1000
|
} catch (error) { /* empty */ }
|
|
@@ -1051,11 +1049,11 @@ var anInstance$1 = function (it, Prototype) {
|
|
|
1051
1049
|
throw TypeError$9('Incorrect invocation');
|
|
1052
1050
|
};
|
|
1053
1051
|
|
|
1054
|
-
var uncurryThis$
|
|
1052
|
+
var uncurryThis$d = functionUncurryThis;
|
|
1055
1053
|
var aCallable$4 = aCallable$6;
|
|
1056
1054
|
var NATIVE_BIND$1 = functionBindNative;
|
|
1057
1055
|
|
|
1058
|
-
var bind$4 = uncurryThis$
|
|
1056
|
+
var bind$4 = uncurryThis$d(uncurryThis$d.bind);
|
|
1059
1057
|
|
|
1060
1058
|
// optional / simple context binding
|
|
1061
1059
|
var functionBindContext = function (fn, that) {
|
|
@@ -1276,7 +1274,7 @@ var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
|
|
|
1276
1274
|
return ITERATION_SUPPORT;
|
|
1277
1275
|
};
|
|
1278
1276
|
|
|
1279
|
-
var uncurryThis$
|
|
1277
|
+
var uncurryThis$c = functionUncurryThis;
|
|
1280
1278
|
var fails$c = fails$k;
|
|
1281
1279
|
var isCallable$7 = isCallable$j;
|
|
1282
1280
|
var classof$4 = classof$6;
|
|
@@ -1287,7 +1285,7 @@ var noop = function () { /* empty */ };
|
|
|
1287
1285
|
var empty = [];
|
|
1288
1286
|
var construct = getBuiltIn$2('Reflect', 'construct');
|
|
1289
1287
|
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1290
|
-
var exec$3 = uncurryThis$
|
|
1288
|
+
var exec$3 = uncurryThis$c(constructorRegExp.exec);
|
|
1291
1289
|
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1292
1290
|
|
|
1293
1291
|
var isConstructorModern = function isConstructor(argument) {
|
|
@@ -1370,9 +1368,9 @@ var getBuiltIn$1 = getBuiltIn$7;
|
|
|
1370
1368
|
|
|
1371
1369
|
var html$2 = getBuiltIn$1('document', 'documentElement');
|
|
1372
1370
|
|
|
1373
|
-
var uncurryThis$
|
|
1371
|
+
var uncurryThis$b = functionUncurryThis;
|
|
1374
1372
|
|
|
1375
|
-
var arraySlice$2 = uncurryThis$
|
|
1373
|
+
var arraySlice$2 = uncurryThis$b([].slice);
|
|
1376
1374
|
|
|
1377
1375
|
var global$i = global$K;
|
|
1378
1376
|
|
|
@@ -1405,7 +1403,7 @@ var validateArgumentsLength = validateArgumentsLength$1;
|
|
|
1405
1403
|
var IS_IOS$1 = engineIsIos;
|
|
1406
1404
|
var IS_NODE$3 = engineIsNode;
|
|
1407
1405
|
|
|
1408
|
-
var set
|
|
1406
|
+
var set = global$g.setImmediate;
|
|
1409
1407
|
var clear = global$g.clearImmediate;
|
|
1410
1408
|
var process$2 = global$g.process;
|
|
1411
1409
|
var Dispatch = global$g.Dispatch;
|
|
@@ -1446,8 +1444,8 @@ var post = function (id) {
|
|
|
1446
1444
|
};
|
|
1447
1445
|
|
|
1448
1446
|
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
1449
|
-
if (!set
|
|
1450
|
-
set
|
|
1447
|
+
if (!set || !clear) {
|
|
1448
|
+
set = function setImmediate(handler) {
|
|
1451
1449
|
validateArgumentsLength(arguments.length, 1);
|
|
1452
1450
|
var fn = isCallable$6(handler) ? handler : Function$1(handler);
|
|
1453
1451
|
var args = arraySlice$1(arguments, 1);
|
|
@@ -1505,7 +1503,7 @@ if (!set$1 || !clear) {
|
|
|
1505
1503
|
}
|
|
1506
1504
|
|
|
1507
1505
|
var task$1 = {
|
|
1508
|
-
set: set
|
|
1506
|
+
set: set,
|
|
1509
1507
|
clear: clear
|
|
1510
1508
|
};
|
|
1511
1509
|
|
|
@@ -1681,7 +1679,7 @@ var queue = Queue$1;
|
|
|
1681
1679
|
|
|
1682
1680
|
var engineIsBrowser = typeof window == 'object';
|
|
1683
1681
|
|
|
1684
|
-
var $$
|
|
1682
|
+
var $$7 = _export;
|
|
1685
1683
|
var global$c = global$K;
|
|
1686
1684
|
var getBuiltIn = getBuiltIn$7;
|
|
1687
1685
|
var call$6 = functionCall;
|
|
@@ -2006,7 +2004,7 @@ if (FORCED$1) {
|
|
|
2006
2004
|
}
|
|
2007
2005
|
}
|
|
2008
2006
|
|
|
2009
|
-
$$
|
|
2007
|
+
$$7({ global: true, wrap: true, forced: FORCED$1 }, {
|
|
2010
2008
|
Promise: PromiseConstructor
|
|
2011
2009
|
});
|
|
2012
2010
|
|
|
@@ -2016,7 +2014,7 @@ setSpecies(PROMISE);
|
|
|
2016
2014
|
PromiseWrapper = getBuiltIn(PROMISE);
|
|
2017
2015
|
|
|
2018
2016
|
// statics
|
|
2019
|
-
$$
|
|
2017
|
+
$$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
|
|
2020
2018
|
// `Promise.reject` method
|
|
2021
2019
|
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2022
2020
|
reject: function reject(r) {
|
|
@@ -2026,7 +2024,7 @@ $$6({ target: PROMISE, stat: true, forced: FORCED$1 }, {
|
|
|
2026
2024
|
}
|
|
2027
2025
|
});
|
|
2028
2026
|
|
|
2029
|
-
$$
|
|
2027
|
+
$$7({ target: PROMISE, stat: true, forced: FORCED$1 }, {
|
|
2030
2028
|
// `Promise.resolve` method
|
|
2031
2029
|
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2032
2030
|
resolve: function resolve(x) {
|
|
@@ -2034,7 +2032,7 @@ $$6({ target: PROMISE, stat: true, forced: FORCED$1 }, {
|
|
|
2034
2032
|
}
|
|
2035
2033
|
});
|
|
2036
2034
|
|
|
2037
|
-
$$
|
|
2035
|
+
$$7({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
2038
2036
|
// `Promise.all` method
|
|
2039
2037
|
// https://tc39.es/ecma262/#sec-promise.all
|
|
2040
2038
|
all: function all(iterable) {
|
|
@@ -2091,7 +2089,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
|
|
|
2091
2089
|
};
|
|
2092
2090
|
|
|
2093
2091
|
var DESCRIPTORS$2 = descriptors;
|
|
2094
|
-
var uncurryThis$
|
|
2092
|
+
var uncurryThis$a = functionUncurryThis;
|
|
2095
2093
|
var call$5 = functionCall;
|
|
2096
2094
|
var fails$a = fails$k;
|
|
2097
2095
|
var objectKeys$1 = objectKeys$2;
|
|
@@ -2104,7 +2102,7 @@ var IndexedObject$1 = indexedObject;
|
|
|
2104
2102
|
var $assign = Object.assign;
|
|
2105
2103
|
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2106
2104
|
var defineProperty$1 = Object.defineProperty;
|
|
2107
|
-
var concat$1 = uncurryThis$
|
|
2105
|
+
var concat$1 = uncurryThis$a([].concat);
|
|
2108
2106
|
|
|
2109
2107
|
// `Object.assign` method
|
|
2110
2108
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
@@ -2147,16 +2145,87 @@ var objectAssign = !$assign || fails$a(function () {
|
|
|
2147
2145
|
} return T;
|
|
2148
2146
|
} : $assign;
|
|
2149
2147
|
|
|
2150
|
-
var $$
|
|
2148
|
+
var $$6 = _export;
|
|
2151
2149
|
var assign = objectAssign;
|
|
2152
2150
|
|
|
2153
2151
|
// `Object.assign` method
|
|
2154
2152
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2155
2153
|
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
2156
|
-
$$
|
|
2154
|
+
$$6({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
|
|
2157
2155
|
assign: assign
|
|
2158
2156
|
});
|
|
2159
2157
|
|
|
2158
|
+
var isObject = isObject$8;
|
|
2159
|
+
var classof$2 = classofRaw$1;
|
|
2160
|
+
var wellKnownSymbol$7 = wellKnownSymbol$i;
|
|
2161
|
+
|
|
2162
|
+
var MATCH$1 = wellKnownSymbol$7('match');
|
|
2163
|
+
|
|
2164
|
+
// `IsRegExp` abstract operation
|
|
2165
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
2166
|
+
var isRegexp = function (it) {
|
|
2167
|
+
var isRegExp;
|
|
2168
|
+
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) == 'RegExp');
|
|
2169
|
+
};
|
|
2170
|
+
|
|
2171
|
+
var global$b = global$K;
|
|
2172
|
+
var isRegExp$1 = isRegexp;
|
|
2173
|
+
|
|
2174
|
+
var TypeError$3 = global$b.TypeError;
|
|
2175
|
+
|
|
2176
|
+
var notARegexp = function (it) {
|
|
2177
|
+
if (isRegExp$1(it)) {
|
|
2178
|
+
throw TypeError$3("The method doesn't accept regular expressions");
|
|
2179
|
+
} return it;
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
var global$a = global$K;
|
|
2183
|
+
var classof$1 = classof$6;
|
|
2184
|
+
|
|
2185
|
+
var String$1 = global$a.String;
|
|
2186
|
+
|
|
2187
|
+
var toString$8 = function (argument) {
|
|
2188
|
+
if (classof$1(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
2189
|
+
return String$1(argument);
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
var wellKnownSymbol$6 = wellKnownSymbol$i;
|
|
2193
|
+
|
|
2194
|
+
var MATCH = wellKnownSymbol$6('match');
|
|
2195
|
+
|
|
2196
|
+
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
2197
|
+
var regexp = /./;
|
|
2198
|
+
try {
|
|
2199
|
+
'/./'[METHOD_NAME](regexp);
|
|
2200
|
+
} catch (error1) {
|
|
2201
|
+
try {
|
|
2202
|
+
regexp[MATCH] = false;
|
|
2203
|
+
return '/./'[METHOD_NAME](regexp);
|
|
2204
|
+
} catch (error2) { /* empty */ }
|
|
2205
|
+
} return false;
|
|
2206
|
+
};
|
|
2207
|
+
|
|
2208
|
+
var $$5 = _export;
|
|
2209
|
+
var uncurryThis$9 = functionUncurryThis;
|
|
2210
|
+
var notARegExp$1 = notARegexp;
|
|
2211
|
+
var requireObjectCoercible$5 = requireObjectCoercible$8;
|
|
2212
|
+
var toString$7 = toString$8;
|
|
2213
|
+
var correctIsRegExpLogic$1 = correctIsRegexpLogic;
|
|
2214
|
+
|
|
2215
|
+
var stringIndexOf$1 = uncurryThis$9(''.indexOf);
|
|
2216
|
+
|
|
2217
|
+
// `String.prototype.includes` method
|
|
2218
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
2219
|
+
$$5({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
|
|
2220
|
+
includes: function includes(searchString /* , position = 0 */) {
|
|
2221
|
+
return !!~stringIndexOf$1(
|
|
2222
|
+
toString$7(requireObjectCoercible$5(this)),
|
|
2223
|
+
toString$7(notARegExp$1(searchString)),
|
|
2224
|
+
arguments.length > 1 ? arguments[1] : undefined
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
});
|
|
2228
|
+
|
|
2160
2229
|
/*! *****************************************************************************
|
|
2161
2230
|
Copyright (c) Microsoft Corporation.
|
|
2162
2231
|
|
|
@@ -2182,48 +2251,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
2182
2251
|
});
|
|
2183
2252
|
}
|
|
2184
2253
|
|
|
2185
|
-
const NINETAILED_CACHE_KEY = '__nt-cache__';
|
|
2186
|
-
const initialize = ({
|
|
2187
|
-
instance
|
|
2188
|
-
}, data = {}) => {
|
|
2189
|
-
const cache = buildEmptyCache();
|
|
2190
|
-
instance.storage.setItem(NINETAILED_CACHE_KEY, Object.assign(Object.assign({}, cache), data));
|
|
2191
|
-
return cache;
|
|
2192
|
-
};
|
|
2193
|
-
const get = ({
|
|
2194
|
-
instance
|
|
2195
|
-
}) => {
|
|
2196
|
-
const cache = instance.storage.getItem(NINETAILED_CACHE_KEY);
|
|
2197
|
-
return cache;
|
|
2198
|
-
};
|
|
2199
|
-
const set = (cache, {
|
|
2200
|
-
instance
|
|
2201
|
-
}) => {
|
|
2202
|
-
instance.storage.setItem(NINETAILED_CACHE_KEY, cache);
|
|
2203
|
-
return cache;
|
|
2204
|
-
};
|
|
2205
|
-
const remove = ({
|
|
2206
|
-
instance
|
|
2207
|
-
}) => {
|
|
2208
|
-
instance.storage.removeItem(NINETAILED_CACHE_KEY);
|
|
2209
|
-
};
|
|
2210
|
-
const reset = ({
|
|
2211
|
-
instance
|
|
2212
|
-
}) => {
|
|
2213
|
-
return initialize({
|
|
2214
|
-
instance
|
|
2215
|
-
});
|
|
2216
|
-
};
|
|
2217
|
-
|
|
2218
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
2219
|
-
__proto__: null,
|
|
2220
|
-
initialize: initialize,
|
|
2221
|
-
get: get,
|
|
2222
|
-
set: set,
|
|
2223
|
-
remove: remove,
|
|
2224
|
-
reset: reset
|
|
2225
|
-
});
|
|
2226
|
-
|
|
2227
2254
|
const buildClientLocale = () => navigator.languages && navigator.languages.length ? navigator.languages[0] : navigator.language;
|
|
2228
2255
|
|
|
2229
2256
|
const buildClientNinetailedRequestContext = () => ({
|
|
@@ -2236,161 +2263,312 @@ const buildClientNinetailedRequestContext = () => ({
|
|
|
2236
2263
|
}
|
|
2237
2264
|
});
|
|
2238
2265
|
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
} = init;
|
|
2245
|
-
const controller = new AbortController();
|
|
2246
|
-
const id = setTimeout(() => {
|
|
2247
|
-
logger.warn('Ninetailed Request timed out.');
|
|
2248
|
-
controller.abort();
|
|
2249
|
-
}, timeout);
|
|
2250
|
-
const response = yield fetch(input, Object.assign(Object.assign({}, init), {
|
|
2251
|
-
signal: controller.signal
|
|
2252
|
-
}));
|
|
2253
|
-
clearTimeout(id);
|
|
2254
|
-
return response;
|
|
2255
|
-
});
|
|
2256
|
-
|
|
2257
|
-
class NinetailedApiClient {
|
|
2258
|
-
constructor({
|
|
2259
|
-
clientId,
|
|
2260
|
-
environment = 'main',
|
|
2261
|
-
url = BASE_URL
|
|
2262
|
-
}) {
|
|
2263
|
-
this.clientId = clientId;
|
|
2264
|
-
this.environment = environment;
|
|
2265
|
-
this.url = url;
|
|
2266
|
-
}
|
|
2267
|
-
|
|
2268
|
-
profile(options) {
|
|
2269
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2270
|
-
logger.info('Sending Profile Request.');
|
|
2271
|
-
const {
|
|
2272
|
-
events
|
|
2273
|
-
} = options; // TODO throw error if not all events have same anon id.
|
|
2266
|
+
/**
|
|
2267
|
+
* Similar to _.throttle but waits for the promise to resolve. There is no
|
|
2268
|
+
* wait time because you can simply await `Promise.timeout` inside `fn`
|
|
2269
|
+
* to wait some time before the next call.
|
|
2270
|
+
*/
|
|
2274
2271
|
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2272
|
+
function asyncThrottle(fn) {
|
|
2273
|
+
let runningPromise;
|
|
2274
|
+
let queuedPromise;
|
|
2275
|
+
let nextArgs;
|
|
2276
|
+
return args => __awaiter(this, void 0, void 0, function* () {
|
|
2277
|
+
if (runningPromise) {
|
|
2278
|
+
nextArgs = args;
|
|
2278
2279
|
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
timeout: options.timeout || 3000
|
|
2280
|
+
if (queuedPromise) {
|
|
2281
|
+
return queuedPromise;
|
|
2282
|
+
} else {
|
|
2283
|
+
queuedPromise = runningPromise.then(() => {
|
|
2284
|
+
queuedPromise = undefined;
|
|
2285
|
+
runningPromise = fn(nextArgs);
|
|
2286
|
+
return runningPromise;
|
|
2287
2287
|
});
|
|
2288
|
-
|
|
2289
|
-
const {
|
|
2290
|
-
data
|
|
2291
|
-
} = yield request.json();
|
|
2292
|
-
logger.debug('Profile Request completed.');
|
|
2293
|
-
return data;
|
|
2294
|
-
} catch (error) {
|
|
2295
|
-
throw error;
|
|
2288
|
+
return queuedPromise;
|
|
2296
2289
|
}
|
|
2297
|
-
}
|
|
2298
|
-
|
|
2299
|
-
|
|
2290
|
+
} else {
|
|
2291
|
+
runningPromise = fn(args);
|
|
2292
|
+
return runningPromise;
|
|
2293
|
+
}
|
|
2294
|
+
});
|
|
2300
2295
|
}
|
|
2301
2296
|
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
var definePropertyModule$2 = objectDefineProperty;
|
|
2307
|
-
var anObject$5 = anObject$e;
|
|
2308
|
-
var toIndexedObject$1 = toIndexedObject$5;
|
|
2309
|
-
var objectKeys = objectKeys$2;
|
|
2297
|
+
const LEGACY_ANONYMOUS_ID = '__anon_id';
|
|
2298
|
+
const ANONYMOUS_ID = '__nt_anonymous_id__';
|
|
2299
|
+
const DEBUG_FLAG = '__nt_debug__';
|
|
2300
|
+
const PROFILE_FALLBACK_CACHE = '__nt_profile__';
|
|
2310
2301
|
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
var props = toIndexedObject$1(Properties);
|
|
2317
|
-
var keys = objectKeys(Properties);
|
|
2318
|
-
var length = keys.length;
|
|
2319
|
-
var index = 0;
|
|
2320
|
-
var key;
|
|
2321
|
-
while (length > index) definePropertyModule$2.f(O, key = keys[index++], props[key]);
|
|
2322
|
-
return O;
|
|
2302
|
+
const NINETAILED_TRACKER_EVENTS = {
|
|
2303
|
+
/**
|
|
2304
|
+
* `profile` - Fires when the profile is returned by the cdp API.
|
|
2305
|
+
*/
|
|
2306
|
+
profile: 'profile'
|
|
2323
2307
|
};
|
|
2308
|
+
const PLUGIN_NAME = 'ninetailed';
|
|
2324
2309
|
|
|
2325
|
-
|
|
2310
|
+
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
2326
2311
|
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2312
|
+
const emptyProfile = {
|
|
2313
|
+
id: '',
|
|
2314
|
+
random: 0,
|
|
2315
|
+
audiences: [],
|
|
2316
|
+
traits: {},
|
|
2317
|
+
location: {}
|
|
2318
|
+
};
|
|
2319
|
+
const ninetailedPlugin = ({
|
|
2320
|
+
clientId,
|
|
2321
|
+
environment,
|
|
2322
|
+
preview: _preview = false,
|
|
2323
|
+
url,
|
|
2324
|
+
profile,
|
|
2325
|
+
locale
|
|
2326
|
+
}) => {
|
|
2327
|
+
const apiClient = new NinetailedApiClient({
|
|
2328
|
+
clientId,
|
|
2329
|
+
environment,
|
|
2330
|
+
url
|
|
2331
|
+
});
|
|
2332
|
+
let queue = [];
|
|
2334
2333
|
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
var IE_PROTO$1 = sharedKey$1('IE_PROTO');
|
|
2334
|
+
const flush = instance => __awaiter(void 0, void 0, void 0, function* () {
|
|
2335
|
+
const events = Object.assign([], queue);
|
|
2336
|
+
logger.info('Start flushing events.');
|
|
2337
|
+
queue = [];
|
|
2340
2338
|
|
|
2341
|
-
|
|
2339
|
+
if (!events.length) {
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2342
2342
|
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2343
|
+
try {
|
|
2344
|
+
const anonymousId = instance.storage.getItem(ANONYMOUS_ID);
|
|
2345
|
+
const profile = yield apiClient.upsertProfile(events, anonymousId);
|
|
2346
|
+
instance.storage.setItem(ANONYMOUS_ID, profile.id);
|
|
2347
|
+
instance.storage.setItem(PROFILE_FALLBACK_CACHE, profile);
|
|
2348
|
+
logger.debug('Profile from api: ', profile);
|
|
2349
|
+
instance.dispatch({
|
|
2350
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
2351
|
+
profile
|
|
2352
|
+
});
|
|
2353
|
+
} catch (error) {
|
|
2354
|
+
logger.debug('An error occurred during flushing the events: ', error);
|
|
2355
|
+
const fallbackProfile = instance.storage.getItem(PROFILE_FALLBACK_CACHE) || emptyProfile;
|
|
2356
|
+
instance.dispatch({
|
|
2357
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
2358
|
+
profile: fallbackProfile
|
|
2359
|
+
});
|
|
2360
|
+
} // This is necessary to make sure that the cache is updated before the next flush is performed
|
|
2346
2361
|
|
|
2347
|
-
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
2348
|
-
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
2349
|
-
activeXDocument.write(scriptTag(''));
|
|
2350
|
-
activeXDocument.close();
|
|
2351
|
-
var temp = activeXDocument.parentWindow.Object;
|
|
2352
|
-
activeXDocument = null; // avoid memory leak
|
|
2353
|
-
return temp;
|
|
2354
|
-
};
|
|
2355
2362
|
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
// Thrash, waste and sodomy: IE GC bug
|
|
2359
|
-
var iframe = documentCreateElement$1('iframe');
|
|
2360
|
-
var JS = 'java' + SCRIPT + ':';
|
|
2361
|
-
var iframeDocument;
|
|
2362
|
-
iframe.style.display = 'none';
|
|
2363
|
-
html.appendChild(iframe);
|
|
2364
|
-
// https://github.com/zloirock/core-js/issues/475
|
|
2365
|
-
iframe.src = String(JS);
|
|
2366
|
-
iframeDocument = iframe.contentWindow.document;
|
|
2367
|
-
iframeDocument.open();
|
|
2368
|
-
iframeDocument.write(scriptTag('document.F=Object'));
|
|
2369
|
-
iframeDocument.close();
|
|
2370
|
-
return iframeDocument.F;
|
|
2371
|
-
};
|
|
2363
|
+
yield delay(20);
|
|
2364
|
+
});
|
|
2372
2365
|
|
|
2373
|
-
|
|
2374
|
-
// No need to use active x approach when document.domain is not set
|
|
2375
|
-
// see https://github.com/es-shims/es5-shim/issues/150
|
|
2376
|
-
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
2377
|
-
// avoid IE GC bug
|
|
2378
|
-
var activeXDocument;
|
|
2379
|
-
var NullProtoObject = function () {
|
|
2380
|
-
try {
|
|
2381
|
-
activeXDocument = new ActiveXObject('htmlfile');
|
|
2382
|
-
} catch (error) { /* ignore */ }
|
|
2383
|
-
NullProtoObject = typeof document != 'undefined'
|
|
2384
|
-
? document.domain && activeXDocument
|
|
2385
|
-
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
2386
|
-
: NullProtoObjectViaIFrame()
|
|
2387
|
-
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
2388
|
-
var length = enumBugKeys.length;
|
|
2389
|
-
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
2390
|
-
return NullProtoObject();
|
|
2391
|
-
};
|
|
2366
|
+
const throttledFlush = asyncThrottle(flush);
|
|
2392
2367
|
|
|
2393
|
-
|
|
2368
|
+
const enqueueEvent = (event, instance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2369
|
+
queue = unionBy([event], queue, 'messageId');
|
|
2370
|
+
throttledFlush(instance);
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2373
|
+
return {
|
|
2374
|
+
name: 'ninetailed',
|
|
2375
|
+
config: {},
|
|
2376
|
+
initialize: ({
|
|
2377
|
+
instance
|
|
2378
|
+
}) => {
|
|
2379
|
+
if (instance.storage.getItem(DEBUG_FLAG)) {
|
|
2380
|
+
logger.addSink(new ConsoleLogSink());
|
|
2381
|
+
logger.info('Ninetailed Debug Mode is enabled.');
|
|
2382
|
+
} // legacy support for the old anonymousId
|
|
2383
|
+
|
|
2384
|
+
|
|
2385
|
+
const legacyAnonymousId = instance.storage.getItem(LEGACY_ANONYMOUS_ID);
|
|
2386
|
+
|
|
2387
|
+
if (legacyAnonymousId) {
|
|
2388
|
+
logger.debug('Found legacy anonymousId, migrating to new one.', legacyAnonymousId);
|
|
2389
|
+
instance.storage.setItem(ANONYMOUS_ID, legacyAnonymousId);
|
|
2390
|
+
instance.storage.removeItem(LEGACY_ANONYMOUS_ID);
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
if (profile) {
|
|
2394
|
+
instance.storage.setItem(ANONYMOUS_ID, profile.id);
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
logger.debug('Ninetailed Core plugin initialized.');
|
|
2398
|
+
},
|
|
2399
|
+
page: ({
|
|
2400
|
+
payload,
|
|
2401
|
+
instance
|
|
2402
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2403
|
+
logger.info('Sending Page event.');
|
|
2404
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
2405
|
+
yield enqueueEvent(buildPageEvent({
|
|
2406
|
+
messageId: payload.meta.rid,
|
|
2407
|
+
timestamp: payload.meta.ts,
|
|
2408
|
+
properties: payload.properties,
|
|
2409
|
+
ctx
|
|
2410
|
+
}), instance);
|
|
2411
|
+
}),
|
|
2412
|
+
track: ({
|
|
2413
|
+
payload,
|
|
2414
|
+
instance
|
|
2415
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2416
|
+
logger.info('Sending Track event.');
|
|
2417
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
2418
|
+
yield enqueueEvent(buildTrackEvent({
|
|
2419
|
+
messageId: payload.meta.rid,
|
|
2420
|
+
timestamp: payload.meta.ts,
|
|
2421
|
+
event: payload.event,
|
|
2422
|
+
properties: payload.properties,
|
|
2423
|
+
ctx
|
|
2424
|
+
}), instance);
|
|
2425
|
+
}),
|
|
2426
|
+
identify: ({
|
|
2427
|
+
payload,
|
|
2428
|
+
instance
|
|
2429
|
+
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2430
|
+
logger.info('Sending Identify event.');
|
|
2431
|
+
const ctx = buildClientNinetailedRequestContext();
|
|
2432
|
+
yield enqueueEvent(buildIdentifyEvent({
|
|
2433
|
+
// doing this here as the anonymous id is set to late from init
|
|
2434
|
+
messageId: payload.meta.rid,
|
|
2435
|
+
timestamp: payload.meta.ts,
|
|
2436
|
+
traits: payload.traits,
|
|
2437
|
+
userId: payload.userId,
|
|
2438
|
+
ctx
|
|
2439
|
+
}), instance);
|
|
2440
|
+
}),
|
|
2441
|
+
setItemStart: ({
|
|
2442
|
+
abort,
|
|
2443
|
+
payload
|
|
2444
|
+
}) => {
|
|
2445
|
+
if (![ANONYMOUS_ID, DEBUG_FLAG, PROFILE_FALLBACK_CACHE].includes(payload.key)) {
|
|
2446
|
+
return abort();
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
return payload;
|
|
2450
|
+
},
|
|
2451
|
+
methods: {
|
|
2452
|
+
reset: (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2453
|
+
const instance = args[args.length - 1];
|
|
2454
|
+
yield instance.storage.removeItem(ANONYMOUS_ID);
|
|
2455
|
+
instance.dispatch({
|
|
2456
|
+
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
2457
|
+
profile: emptyProfile
|
|
2458
|
+
});
|
|
2459
|
+
yield delay(10);
|
|
2460
|
+
}),
|
|
2461
|
+
debug: (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2462
|
+
const enabled = args[0];
|
|
2463
|
+
const instance = args[args.length - 1];
|
|
2464
|
+
const consoleLogSink = new ConsoleLogSink();
|
|
2465
|
+
|
|
2466
|
+
if (enabled) {
|
|
2467
|
+
yield instance.storage.setItem(DEBUG_FLAG, true);
|
|
2468
|
+
logger.addSink(consoleLogSink);
|
|
2469
|
+
logger.info('Debug mode enabled.');
|
|
2470
|
+
} else {
|
|
2471
|
+
yield instance.storage.removeItem(DEBUG_FLAG);
|
|
2472
|
+
logger.info('Debug mode disabled.');
|
|
2473
|
+
logger.removeSink(consoleLogSink.name);
|
|
2474
|
+
}
|
|
2475
|
+
})
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
};
|
|
2479
|
+
|
|
2480
|
+
var objectDefineProperties = {};
|
|
2481
|
+
|
|
2482
|
+
var DESCRIPTORS$1 = descriptors;
|
|
2483
|
+
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
2484
|
+
var definePropertyModule$2 = objectDefineProperty;
|
|
2485
|
+
var anObject$5 = anObject$e;
|
|
2486
|
+
var toIndexedObject$1 = toIndexedObject$5;
|
|
2487
|
+
var objectKeys = objectKeys$2;
|
|
2488
|
+
|
|
2489
|
+
// `Object.defineProperties` method
|
|
2490
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
2491
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
2492
|
+
objectDefineProperties.f = DESCRIPTORS$1 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
2493
|
+
anObject$5(O);
|
|
2494
|
+
var props = toIndexedObject$1(Properties);
|
|
2495
|
+
var keys = objectKeys(Properties);
|
|
2496
|
+
var length = keys.length;
|
|
2497
|
+
var index = 0;
|
|
2498
|
+
var key;
|
|
2499
|
+
while (length > index) definePropertyModule$2.f(O, key = keys[index++], props[key]);
|
|
2500
|
+
return O;
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2503
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
2504
|
+
|
|
2505
|
+
var anObject$4 = anObject$e;
|
|
2506
|
+
var definePropertiesModule = objectDefineProperties;
|
|
2507
|
+
var enumBugKeys = enumBugKeys$3;
|
|
2508
|
+
var hiddenKeys = hiddenKeys$4;
|
|
2509
|
+
var html = html$2;
|
|
2510
|
+
var documentCreateElement$1 = documentCreateElement$2;
|
|
2511
|
+
var sharedKey$1 = sharedKey$3;
|
|
2512
|
+
|
|
2513
|
+
var GT = '>';
|
|
2514
|
+
var LT = '<';
|
|
2515
|
+
var PROTOTYPE = 'prototype';
|
|
2516
|
+
var SCRIPT = 'script';
|
|
2517
|
+
var IE_PROTO$1 = sharedKey$1('IE_PROTO');
|
|
2518
|
+
|
|
2519
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
2520
|
+
|
|
2521
|
+
var scriptTag = function (content) {
|
|
2522
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2525
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
2526
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
2527
|
+
activeXDocument.write(scriptTag(''));
|
|
2528
|
+
activeXDocument.close();
|
|
2529
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
2530
|
+
activeXDocument = null; // avoid memory leak
|
|
2531
|
+
return temp;
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
2535
|
+
var NullProtoObjectViaIFrame = function () {
|
|
2536
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
2537
|
+
var iframe = documentCreateElement$1('iframe');
|
|
2538
|
+
var JS = 'java' + SCRIPT + ':';
|
|
2539
|
+
var iframeDocument;
|
|
2540
|
+
iframe.style.display = 'none';
|
|
2541
|
+
html.appendChild(iframe);
|
|
2542
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
2543
|
+
iframe.src = String(JS);
|
|
2544
|
+
iframeDocument = iframe.contentWindow.document;
|
|
2545
|
+
iframeDocument.open();
|
|
2546
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
2547
|
+
iframeDocument.close();
|
|
2548
|
+
return iframeDocument.F;
|
|
2549
|
+
};
|
|
2550
|
+
|
|
2551
|
+
// Check for document.domain and active x support
|
|
2552
|
+
// No need to use active x approach when document.domain is not set
|
|
2553
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
2554
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
2555
|
+
// avoid IE GC bug
|
|
2556
|
+
var activeXDocument;
|
|
2557
|
+
var NullProtoObject = function () {
|
|
2558
|
+
try {
|
|
2559
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
2560
|
+
} catch (error) { /* ignore */ }
|
|
2561
|
+
NullProtoObject = typeof document != 'undefined'
|
|
2562
|
+
? document.domain && activeXDocument
|
|
2563
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
2564
|
+
: NullProtoObjectViaIFrame()
|
|
2565
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
2566
|
+
var length = enumBugKeys.length;
|
|
2567
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
2568
|
+
return NullProtoObject();
|
|
2569
|
+
};
|
|
2570
|
+
|
|
2571
|
+
hiddenKeys[IE_PROTO$1] = true;
|
|
2394
2572
|
|
|
2395
2573
|
// `Object.create` method
|
|
2396
2574
|
// https://tc39.es/ecma262/#sec-object.create
|
|
@@ -2406,11 +2584,11 @@ var objectCreate = Object.create || function create(O, Properties) {
|
|
|
2406
2584
|
return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
|
|
2407
2585
|
};
|
|
2408
2586
|
|
|
2409
|
-
var wellKnownSymbol$
|
|
2587
|
+
var wellKnownSymbol$5 = wellKnownSymbol$i;
|
|
2410
2588
|
var create$2 = objectCreate;
|
|
2411
2589
|
var definePropertyModule$1 = objectDefineProperty;
|
|
2412
2590
|
|
|
2413
|
-
var UNSCOPABLES = wellKnownSymbol$
|
|
2591
|
+
var UNSCOPABLES = wellKnownSymbol$5('unscopables');
|
|
2414
2592
|
var ArrayPrototype = Array.prototype;
|
|
2415
2593
|
|
|
2416
2594
|
// Array.prototype[@@unscopables]
|
|
@@ -2436,7 +2614,7 @@ var correctPrototypeGetter = !fails$9(function () {
|
|
|
2436
2614
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
2437
2615
|
});
|
|
2438
2616
|
|
|
2439
|
-
var global$
|
|
2617
|
+
var global$9 = global$K;
|
|
2440
2618
|
var hasOwn = hasOwnProperty_1;
|
|
2441
2619
|
var isCallable$4 = isCallable$j;
|
|
2442
2620
|
var toObject$2 = toObject$5;
|
|
@@ -2444,7 +2622,7 @@ var sharedKey = sharedKey$3;
|
|
|
2444
2622
|
var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
|
|
2445
2623
|
|
|
2446
2624
|
var IE_PROTO = sharedKey('IE_PROTO');
|
|
2447
|
-
var Object$1 = global$
|
|
2625
|
+
var Object$1 = global$9.Object;
|
|
2448
2626
|
var ObjectPrototype = Object$1.prototype;
|
|
2449
2627
|
|
|
2450
2628
|
// `Object.getPrototypeOf` method
|
|
@@ -2462,9 +2640,9 @@ var fails$8 = fails$k;
|
|
|
2462
2640
|
var isCallable$3 = isCallable$j;
|
|
2463
2641
|
var getPrototypeOf$1 = objectGetPrototypeOf;
|
|
2464
2642
|
var redefine$2 = redefine$6.exports;
|
|
2465
|
-
var wellKnownSymbol$
|
|
2643
|
+
var wellKnownSymbol$4 = wellKnownSymbol$i;
|
|
2466
2644
|
|
|
2467
|
-
var ITERATOR$3 = wellKnownSymbol$
|
|
2645
|
+
var ITERATOR$3 = wellKnownSymbol$4('iterator');
|
|
2468
2646
|
var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
2469
2647
|
|
|
2470
2648
|
// `%IteratorPrototype%` object
|
|
@@ -2529,7 +2707,7 @@ var setPrototypeOf = objectSetPrototypeOf;
|
|
|
2529
2707
|
var setToStringTag = setToStringTag$3;
|
|
2530
2708
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$6;
|
|
2531
2709
|
var redefine$1 = redefine$6.exports;
|
|
2532
|
-
var wellKnownSymbol$
|
|
2710
|
+
var wellKnownSymbol$3 = wellKnownSymbol$i;
|
|
2533
2711
|
var Iterators$1 = iterators;
|
|
2534
2712
|
var IteratorsCore = iteratorsCore;
|
|
2535
2713
|
|
|
@@ -2537,7 +2715,7 @@ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
|
|
|
2537
2715
|
var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
|
|
2538
2716
|
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
|
2539
2717
|
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
2540
|
-
var ITERATOR$2 = wellKnownSymbol$
|
|
2718
|
+
var ITERATOR$2 = wellKnownSymbol$3('iterator');
|
|
2541
2719
|
var KEYS = 'keys';
|
|
2542
2720
|
var VALUES = 'values';
|
|
2543
2721
|
var ENTRIES = 'entries';
|
|
@@ -2720,15 +2898,15 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
|
|
|
2720
2898
|
|
|
2721
2899
|
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
|
|
2722
2900
|
|
|
2723
|
-
var global$
|
|
2901
|
+
var global$8 = global$K;
|
|
2724
2902
|
var DOMIterables = domIterables;
|
|
2725
2903
|
var DOMTokenListPrototype = domTokenListPrototype;
|
|
2726
2904
|
var ArrayIteratorMethods = es_array_iterator;
|
|
2727
2905
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$6;
|
|
2728
|
-
var wellKnownSymbol$
|
|
2906
|
+
var wellKnownSymbol$2 = wellKnownSymbol$i;
|
|
2729
2907
|
|
|
2730
|
-
var ITERATOR$1 = wellKnownSymbol$
|
|
2731
|
-
var TO_STRING_TAG = wellKnownSymbol$
|
|
2908
|
+
var ITERATOR$1 = wellKnownSymbol$2('iterator');
|
|
2909
|
+
var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
|
|
2732
2910
|
var ArrayValues = ArrayIteratorMethods.values;
|
|
2733
2911
|
|
|
2734
2912
|
var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
@@ -2754,401 +2932,11 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
|
|
|
2754
2932
|
};
|
|
2755
2933
|
|
|
2756
2934
|
for (var COLLECTION_NAME in DOMIterables) {
|
|
2757
|
-
handlePrototype(global$
|
|
2935
|
+
handlePrototype(global$8[COLLECTION_NAME] && global$8[COLLECTION_NAME].prototype, COLLECTION_NAME);
|
|
2758
2936
|
}
|
|
2759
2937
|
|
|
2760
2938
|
handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
|
|
2761
2939
|
|
|
2762
|
-
class Logger {
|
|
2763
|
-
constructor() {
|
|
2764
|
-
this.name = '@ninetailed/experience.js';
|
|
2765
|
-
this.sinks = [];
|
|
2766
|
-
this.diary = diary(this.name, this.onLogEvent.bind(this));
|
|
2767
|
-
enable(this.name);
|
|
2768
|
-
}
|
|
2769
|
-
|
|
2770
|
-
addSink(sink) {
|
|
2771
|
-
this.sinks = [...this.sinks.filter(existingSink => existingSink.name !== sink.name), sink];
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
|
-
removeSink(name) {
|
|
2775
|
-
this.sinks = this.sinks.filter(sink => sink.name !== name);
|
|
2776
|
-
}
|
|
2777
|
-
|
|
2778
|
-
debug(message, ...args) {
|
|
2779
|
-
this.diary.debug(message, ...args);
|
|
2780
|
-
}
|
|
2781
|
-
|
|
2782
|
-
info(message, ...args) {
|
|
2783
|
-
this.diary.info(message, ...args);
|
|
2784
|
-
}
|
|
2785
|
-
|
|
2786
|
-
log(message, ...args) {
|
|
2787
|
-
this.diary.log(message, ...args);
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
warn(message, ...args) {
|
|
2791
|
-
this.diary.warn(message, ...args);
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
error(message, ...args) {
|
|
2795
|
-
this.diary.error(message, ...args);
|
|
2796
|
-
}
|
|
2797
|
-
|
|
2798
|
-
fatal(message, ...args) {
|
|
2799
|
-
this.diary.fatal(message, ...args);
|
|
2800
|
-
}
|
|
2801
|
-
|
|
2802
|
-
onLogEvent(event) {
|
|
2803
|
-
this.sinks.forEach(sink => {
|
|
2804
|
-
if (sink[event.level]) {
|
|
2805
|
-
sink[event.level](event.message, ...event.extra);
|
|
2806
|
-
}
|
|
2807
|
-
});
|
|
2808
|
-
}
|
|
2809
|
-
|
|
2810
|
-
}
|
|
2811
|
-
const logger = new Logger();
|
|
2812
|
-
|
|
2813
|
-
class ConsoleLogSink {
|
|
2814
|
-
constructor() {
|
|
2815
|
-
this.name = "ConsoleLogSink";
|
|
2816
|
-
}
|
|
2817
|
-
|
|
2818
|
-
debug(message, ...args) {
|
|
2819
|
-
console.debug(message, ...args);
|
|
2820
|
-
}
|
|
2821
|
-
|
|
2822
|
-
info(message, ...args) {
|
|
2823
|
-
console.info(message, ...args);
|
|
2824
|
-
}
|
|
2825
|
-
|
|
2826
|
-
log(message, ...args) {
|
|
2827
|
-
console.log(message, ...args);
|
|
2828
|
-
}
|
|
2829
|
-
|
|
2830
|
-
warn(message, ...args) {
|
|
2831
|
-
console.warn(message, ...args);
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
|
-
error(message, ...args) {
|
|
2835
|
-
console.error(message, ...args);
|
|
2836
|
-
}
|
|
2837
|
-
|
|
2838
|
-
fatal(message, ...args) {
|
|
2839
|
-
console.error(message, ...args);
|
|
2840
|
-
}
|
|
2841
|
-
|
|
2842
|
-
}
|
|
2843
|
-
|
|
2844
|
-
class OnLogLogSink {
|
|
2845
|
-
constructor(onLog) {
|
|
2846
|
-
this.onLog = onLog;
|
|
2847
|
-
this.name = 'OnLogLogSink';
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
debug(message, ...args) {
|
|
2851
|
-
this.onLog(message, ...args);
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
info(message, ...args) {
|
|
2855
|
-
this.onLog(message, ...args);
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
log(message, ...args) {
|
|
2859
|
-
this.onLog(message, ...args);
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
|
-
warn(message, ...args) {
|
|
2863
|
-
this.onLog(message, ...args);
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
class OnErrorLogSink {
|
|
2869
|
-
constructor(onError) {
|
|
2870
|
-
this.onError = onError;
|
|
2871
|
-
this.name = 'OnErrorLogSink';
|
|
2872
|
-
}
|
|
2873
|
-
|
|
2874
|
-
error(message, ...args) {
|
|
2875
|
-
this.onError(message, ...args);
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
|
-
fatal(message, ...args) {
|
|
2879
|
-
this.onError(message, ...args);
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
const NINETAILED_TRACKER_EVENTS = {
|
|
2885
|
-
/**
|
|
2886
|
-
* `profile` - Fires when the profile is returned by the cdp API.
|
|
2887
|
-
*/
|
|
2888
|
-
profile: 'profile'
|
|
2889
|
-
};
|
|
2890
|
-
const PLUGIN_NAME = 'ninetailed';
|
|
2891
|
-
const DEBUG_FLAG_KEY = 'nt-debug';
|
|
2892
|
-
|
|
2893
|
-
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
2894
|
-
/**
|
|
2895
|
-
* Similar to _.throttle but waits for the promise to resolve. There is no
|
|
2896
|
-
* wait time because you can simply await `Promise.timeout` inside `fn`
|
|
2897
|
-
* to wait some time before the next call.
|
|
2898
|
-
*/
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
function asyncThrottle(fn) {
|
|
2902
|
-
let runningPromise;
|
|
2903
|
-
let queuedPromise;
|
|
2904
|
-
let nextArgs;
|
|
2905
|
-
return args => __awaiter(this, void 0, void 0, function* () {
|
|
2906
|
-
if (runningPromise) {
|
|
2907
|
-
nextArgs = args;
|
|
2908
|
-
|
|
2909
|
-
if (queuedPromise) {
|
|
2910
|
-
return queuedPromise;
|
|
2911
|
-
} else {
|
|
2912
|
-
queuedPromise = runningPromise.then(() => {
|
|
2913
|
-
queuedPromise = undefined;
|
|
2914
|
-
runningPromise = fn(nextArgs);
|
|
2915
|
-
return runningPromise;
|
|
2916
|
-
});
|
|
2917
|
-
return queuedPromise;
|
|
2918
|
-
}
|
|
2919
|
-
} else {
|
|
2920
|
-
runningPromise = fn(args);
|
|
2921
|
-
return runningPromise;
|
|
2922
|
-
}
|
|
2923
|
-
});
|
|
2924
|
-
}
|
|
2925
|
-
const ninetailedPlugin = ({
|
|
2926
|
-
clientId,
|
|
2927
|
-
environment,
|
|
2928
|
-
preview: _preview = false,
|
|
2929
|
-
url,
|
|
2930
|
-
profile,
|
|
2931
|
-
locale
|
|
2932
|
-
}) => {
|
|
2933
|
-
let isInitialized = false;
|
|
2934
|
-
const apiClient = new NinetailedApiClient({
|
|
2935
|
-
clientId,
|
|
2936
|
-
environment,
|
|
2937
|
-
url
|
|
2938
|
-
});
|
|
2939
|
-
let queue = [];
|
|
2940
|
-
let localOnly = false;
|
|
2941
|
-
|
|
2942
|
-
const flush = instance => __awaiter(void 0, void 0, void 0, function* () {
|
|
2943
|
-
const events = Object.assign([], queue);
|
|
2944
|
-
logger.info('Start flushing events.');
|
|
2945
|
-
queue = [];
|
|
2946
|
-
|
|
2947
|
-
if (!events.length) {
|
|
2948
|
-
return;
|
|
2949
|
-
}
|
|
2950
|
-
|
|
2951
|
-
const cache = get({
|
|
2952
|
-
instance
|
|
2953
|
-
});
|
|
2954
|
-
|
|
2955
|
-
try {
|
|
2956
|
-
logger.debug('Cache: ', cache);
|
|
2957
|
-
const {
|
|
2958
|
-
profile,
|
|
2959
|
-
signals,
|
|
2960
|
-
traitsUpdatedAt,
|
|
2961
|
-
sessions
|
|
2962
|
-
} = yield apiClient.profile({
|
|
2963
|
-
events,
|
|
2964
|
-
signals: get$2(cache, 'signals', {}),
|
|
2965
|
-
traits: get$2(cache, 'traits', {}),
|
|
2966
|
-
traitsUpdatedAt: get$2(cache, 'traitsUpdatedAt', new Date().toISOString()),
|
|
2967
|
-
localOnly,
|
|
2968
|
-
preview: _preview,
|
|
2969
|
-
options: {
|
|
2970
|
-
locale: locale || 'en'
|
|
2971
|
-
},
|
|
2972
|
-
sessions: get$2(cache, 'sessions', [])
|
|
2973
|
-
});
|
|
2974
|
-
logger.debug('Profile from api: ', profile);
|
|
2975
|
-
const updatedCache = set({
|
|
2976
|
-
id: profile.id,
|
|
2977
|
-
random: profile.random,
|
|
2978
|
-
audiences: profile.audiences,
|
|
2979
|
-
traits: profile.traits,
|
|
2980
|
-
location: profile.location,
|
|
2981
|
-
signals,
|
|
2982
|
-
traitsUpdatedAt,
|
|
2983
|
-
sessions,
|
|
2984
|
-
session: profile.session
|
|
2985
|
-
}, {
|
|
2986
|
-
instance
|
|
2987
|
-
});
|
|
2988
|
-
instance.dispatch({
|
|
2989
|
-
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
2990
|
-
profile,
|
|
2991
|
-
cache: updatedCache
|
|
2992
|
-
});
|
|
2993
|
-
} catch (error) {
|
|
2994
|
-
logger.debug('An error occurred during flushing the events: ', error);
|
|
2995
|
-
instance.dispatch({
|
|
2996
|
-
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
2997
|
-
profile: {
|
|
2998
|
-
id: cache.id,
|
|
2999
|
-
random: cache.random,
|
|
3000
|
-
audiences: cache.audiences,
|
|
3001
|
-
traits: cache.traits,
|
|
3002
|
-
location: cache.location,
|
|
3003
|
-
session: cache.session
|
|
3004
|
-
},
|
|
3005
|
-
cache
|
|
3006
|
-
});
|
|
3007
|
-
} // This is necessary to make sure that the cache is updated before the next flush is performed
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
yield delay(20);
|
|
3011
|
-
}); // const throttledFlush = throttle(flush, 200, {
|
|
3012
|
-
// leading: false,
|
|
3013
|
-
// trailing: true,
|
|
3014
|
-
// });
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
const throttledFlush = asyncThrottle(flush);
|
|
3018
|
-
|
|
3019
|
-
const createEvent = (event, instance) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3020
|
-
queue = unionBy([event], queue, 'messageId');
|
|
3021
|
-
throttledFlush(instance);
|
|
3022
|
-
});
|
|
3023
|
-
|
|
3024
|
-
return {
|
|
3025
|
-
name: 'ninetailed',
|
|
3026
|
-
config: {},
|
|
3027
|
-
initialize: ({
|
|
3028
|
-
instance
|
|
3029
|
-
}) => {
|
|
3030
|
-
if (instance.storage.getItem(DEBUG_FLAG_KEY)) {
|
|
3031
|
-
logger.addSink(new ConsoleLogSink());
|
|
3032
|
-
logger.info('Ninetailed Debug Mode is enabled.');
|
|
3033
|
-
}
|
|
3034
|
-
|
|
3035
|
-
const cache = get({
|
|
3036
|
-
instance
|
|
3037
|
-
});
|
|
3038
|
-
|
|
3039
|
-
if (profile) {
|
|
3040
|
-
instance.storage.setItem('__anon_id', profile.id);
|
|
3041
|
-
initialize({
|
|
3042
|
-
instance
|
|
3043
|
-
}, Object.assign(Object.assign({}, cache), {
|
|
3044
|
-
id: profile.id
|
|
3045
|
-
}));
|
|
3046
|
-
} else {
|
|
3047
|
-
const anonymousId = instance.storage.getItem('__anon_id');
|
|
3048
|
-
initialize({
|
|
3049
|
-
instance
|
|
3050
|
-
}, Object.assign(Object.assign({}, cache), {
|
|
3051
|
-
id: anonymousId
|
|
3052
|
-
}));
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
isInitialized = true;
|
|
3056
|
-
logger.debug('Ninetailed Core plugin initialized.');
|
|
3057
|
-
},
|
|
3058
|
-
page: ({
|
|
3059
|
-
payload,
|
|
3060
|
-
instance
|
|
3061
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3062
|
-
logger.info('Sending Page event.');
|
|
3063
|
-
const ctx = buildClientNinetailedRequestContext();
|
|
3064
|
-
localOnly = payload.localOnly;
|
|
3065
|
-
yield createEvent(buildPageEvent({
|
|
3066
|
-
// doing this here as the anonymous id is set to late from init
|
|
3067
|
-
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3068
|
-
messageId: payload.meta.rid,
|
|
3069
|
-
timestamp: payload.meta.ts,
|
|
3070
|
-
properties: payload.properties,
|
|
3071
|
-
ctx
|
|
3072
|
-
}), instance);
|
|
3073
|
-
}),
|
|
3074
|
-
track: ({
|
|
3075
|
-
payload,
|
|
3076
|
-
instance
|
|
3077
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3078
|
-
logger.info('Sending Track event.');
|
|
3079
|
-
const ctx = buildClientNinetailedRequestContext();
|
|
3080
|
-
localOnly = payload.localOnly;
|
|
3081
|
-
yield createEvent(buildTrackEvent({
|
|
3082
|
-
// doing this here as the anonymous id is set to late from init
|
|
3083
|
-
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3084
|
-
messageId: payload.meta.rid,
|
|
3085
|
-
timestamp: payload.meta.ts,
|
|
3086
|
-
event: payload.event,
|
|
3087
|
-
properties: payload.properties,
|
|
3088
|
-
ctx
|
|
3089
|
-
}), instance);
|
|
3090
|
-
}),
|
|
3091
|
-
identify: ({
|
|
3092
|
-
payload,
|
|
3093
|
-
instance
|
|
3094
|
-
}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3095
|
-
logger.info('Sending Identify event.');
|
|
3096
|
-
localOnly = payload.localOnly;
|
|
3097
|
-
const ctx = buildClientNinetailedRequestContext();
|
|
3098
|
-
yield createEvent(buildIdentifyEvent({
|
|
3099
|
-
// doing this here as the anonymous id is set to late from init
|
|
3100
|
-
anonymousId: (profile === null || profile === void 0 ? void 0 : profile.id) || payload.anonymousId,
|
|
3101
|
-
messageId: payload.meta.rid,
|
|
3102
|
-
timestamp: payload.meta.ts,
|
|
3103
|
-
traits: payload.traits,
|
|
3104
|
-
userId: payload.userId,
|
|
3105
|
-
ctx
|
|
3106
|
-
}), instance);
|
|
3107
|
-
}),
|
|
3108
|
-
loaded: () => {
|
|
3109
|
-
return isInitialized;
|
|
3110
|
-
},
|
|
3111
|
-
methods: {
|
|
3112
|
-
reset: (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3113
|
-
const instance = args[args.length - 1];
|
|
3114
|
-
const cache = reset({
|
|
3115
|
-
instance
|
|
3116
|
-
});
|
|
3117
|
-
yield instance.storage.setItem('__anon_id', cache.id);
|
|
3118
|
-
instance.dispatch({
|
|
3119
|
-
type: NINETAILED_TRACKER_EVENTS.profile,
|
|
3120
|
-
profile: {
|
|
3121
|
-
id: cache.id,
|
|
3122
|
-
random: 0,
|
|
3123
|
-
audiences: [],
|
|
3124
|
-
traits: {},
|
|
3125
|
-
location: {}
|
|
3126
|
-
},
|
|
3127
|
-
cache: cache
|
|
3128
|
-
});
|
|
3129
|
-
yield delay(10);
|
|
3130
|
-
}),
|
|
3131
|
-
debug: (...args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3132
|
-
const enabled = args[0];
|
|
3133
|
-
const instance = args[args.length - 1];
|
|
3134
|
-
const consoleLogSink = new ConsoleLogSink();
|
|
3135
|
-
|
|
3136
|
-
if (enabled) {
|
|
3137
|
-
yield instance.storage.setItem(DEBUG_FLAG_KEY, true); // cleanup other console log sinks if there are already some.
|
|
3138
|
-
|
|
3139
|
-
logger.removeSink(consoleLogSink.name);
|
|
3140
|
-
logger.addSink(consoleLogSink);
|
|
3141
|
-
logger.info('Debug mode enabled.');
|
|
3142
|
-
} else {
|
|
3143
|
-
yield instance.storage.removeItem(DEBUG_FLAG_KEY);
|
|
3144
|
-
logger.info('Debug mode disabled.');
|
|
3145
|
-
logger.removeSink(consoleLogSink.name);
|
|
3146
|
-
}
|
|
3147
|
-
})
|
|
3148
|
-
}
|
|
3149
|
-
};
|
|
3150
|
-
};
|
|
3151
|
-
|
|
3152
2940
|
class Ninetailed {
|
|
3153
2941
|
constructor({
|
|
3154
2942
|
clientId,
|
|
@@ -3195,17 +2983,23 @@ class Ninetailed {
|
|
|
3195
2983
|
|
|
3196
2984
|
this.identify = (uid, traits, options) => __awaiter(this, void 0, void 0, function* () {
|
|
3197
2985
|
yield this.waitUntilInitialized();
|
|
2986
|
+
/*console.log("Identify triggered");*/
|
|
2987
|
+
|
|
3198
2988
|
return this.instance.identify(uid, traits, this.buildOptions(options));
|
|
3199
2989
|
});
|
|
3200
2990
|
|
|
3201
2991
|
this.reset = () => {
|
|
3202
2992
|
this.onIsInitialized(() => {
|
|
2993
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2994
|
+
// @ts-ignore
|
|
3203
2995
|
this.instance.plugins[PLUGIN_NAME].reset();
|
|
3204
2996
|
});
|
|
3205
2997
|
};
|
|
3206
2998
|
|
|
3207
2999
|
this.debug = enabled => {
|
|
3208
3000
|
this.onIsInitialized(() => {
|
|
3001
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3002
|
+
// @ts-ignore
|
|
3209
3003
|
this.instance.plugins[PLUGIN_NAME].debug(enabled);
|
|
3210
3004
|
});
|
|
3211
3005
|
};
|
|
@@ -3218,7 +3012,7 @@ class Ninetailed {
|
|
|
3218
3012
|
cb(Object.assign(Object.assign({}, this._profileState), {
|
|
3219
3013
|
status: 'success',
|
|
3220
3014
|
profile: payload.profile,
|
|
3221
|
-
error:
|
|
3015
|
+
error: null
|
|
3222
3016
|
}));
|
|
3223
3017
|
});
|
|
3224
3018
|
};
|
|
@@ -3248,14 +3042,14 @@ class Ninetailed {
|
|
|
3248
3042
|
this._profileState = {
|
|
3249
3043
|
status: 'success',
|
|
3250
3044
|
profile,
|
|
3251
|
-
error:
|
|
3045
|
+
error: null,
|
|
3252
3046
|
from: 'hydrated'
|
|
3253
3047
|
};
|
|
3254
3048
|
} else {
|
|
3255
3049
|
this._profileState = {
|
|
3256
3050
|
status: 'loading',
|
|
3257
3051
|
profile: null,
|
|
3258
|
-
error:
|
|
3052
|
+
error: null,
|
|
3259
3053
|
from: 'api'
|
|
3260
3054
|
};
|
|
3261
3055
|
}
|
|
@@ -3326,12 +3120,12 @@ const selectVariant$1 = (baseline, variants, {
|
|
|
3326
3120
|
if (status === 'loading') {
|
|
3327
3121
|
return {
|
|
3328
3122
|
loading: true,
|
|
3329
|
-
variant: Object.assign({
|
|
3123
|
+
variant: Object.assign(Object.assign({}, baseline), {
|
|
3330
3124
|
id: 'baseline',
|
|
3331
3125
|
audience: {
|
|
3332
3126
|
id: 'baseline'
|
|
3333
3127
|
}
|
|
3334
|
-
}
|
|
3128
|
+
}),
|
|
3335
3129
|
audience: {
|
|
3336
3130
|
id: 'baseline'
|
|
3337
3131
|
},
|
|
@@ -3343,12 +3137,12 @@ const selectVariant$1 = (baseline, variants, {
|
|
|
3343
3137
|
if (status === 'error') {
|
|
3344
3138
|
return {
|
|
3345
3139
|
loading: false,
|
|
3346
|
-
variant: Object.assign({
|
|
3140
|
+
variant: Object.assign(Object.assign({}, baseline), {
|
|
3347
3141
|
id: 'baseline',
|
|
3348
3142
|
audience: {
|
|
3349
3143
|
id: 'baseline'
|
|
3350
3144
|
}
|
|
3351
|
-
}
|
|
3145
|
+
}),
|
|
3352
3146
|
audience: {
|
|
3353
3147
|
id: 'baseline'
|
|
3354
3148
|
},
|
|
@@ -3364,15 +3158,15 @@ const selectVariant$1 = (baseline, variants, {
|
|
|
3364
3158
|
});
|
|
3365
3159
|
|
|
3366
3160
|
if (variant) {
|
|
3367
|
-
|
|
3161
|
+
// @ts-ignore
|
|
3162
|
+
if ((options === null || options === void 0 ? void 0 : options.holdout) || -1 > (profile === null || profile === void 0 ? void 0 : profile.random)) {
|
|
3368
3163
|
return {
|
|
3369
3164
|
loading: false,
|
|
3370
|
-
variant: Object.assign({
|
|
3371
|
-
id: baseline.id,
|
|
3165
|
+
variant: Object.assign(Object.assign({}, baseline), {
|
|
3372
3166
|
audience: {
|
|
3373
3167
|
id: 'baseline'
|
|
3374
3168
|
}
|
|
3375
|
-
}
|
|
3169
|
+
}),
|
|
3376
3170
|
audience: Object.assign(Object.assign({}, variant.audience), {
|
|
3377
3171
|
id: variant.audience.id
|
|
3378
3172
|
}),
|
|
@@ -3398,12 +3192,12 @@ const selectVariant$1 = (baseline, variants, {
|
|
|
3398
3192
|
|
|
3399
3193
|
return {
|
|
3400
3194
|
loading: false,
|
|
3401
|
-
variant: Object.assign({
|
|
3195
|
+
variant: Object.assign(Object.assign({}, baseline), {
|
|
3402
3196
|
id: 'baseline',
|
|
3403
3197
|
audience: {
|
|
3404
3198
|
id: 'baseline'
|
|
3405
3199
|
}
|
|
3406
|
-
}
|
|
3200
|
+
}),
|
|
3407
3201
|
audience: {
|
|
3408
3202
|
id: 'baseline'
|
|
3409
3203
|
},
|
|
@@ -3415,7 +3209,9 @@ const selectVariant$1 = (baseline, variants, {
|
|
|
3415
3209
|
const EXPERIENCE_TRAIT_PREFIX = 'nt_experiment_';
|
|
3416
3210
|
|
|
3417
3211
|
const selectBaselineWithVariants = (experience, baseline) => {
|
|
3418
|
-
|
|
3212
|
+
var _a;
|
|
3213
|
+
|
|
3214
|
+
return (_a = experience.components.find(baselineWithVariants => baselineWithVariants.baseline.id === baseline.id)) !== null && _a !== void 0 ? _a : null;
|
|
3419
3215
|
};
|
|
3420
3216
|
|
|
3421
3217
|
const selectVariants = (experience, baseline) => {
|
|
@@ -3433,63 +3229,13 @@ const selectHasVariants = (experience, baseline) => {
|
|
|
3433
3229
|
return variants.length > 0;
|
|
3434
3230
|
};
|
|
3435
3231
|
|
|
3436
|
-
var global$9 = global$K;
|
|
3437
|
-
var classof$2 = classof$6;
|
|
3438
|
-
|
|
3439
|
-
var String$1 = global$9.String;
|
|
3440
|
-
|
|
3441
|
-
var toString$7 = function (argument) {
|
|
3442
|
-
if (classof$2(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
3443
|
-
return String$1(argument);
|
|
3444
|
-
};
|
|
3445
|
-
|
|
3446
|
-
var isObject = isObject$8;
|
|
3447
|
-
var classof$1 = classofRaw$1;
|
|
3448
|
-
var wellKnownSymbol$3 = wellKnownSymbol$i;
|
|
3449
|
-
|
|
3450
|
-
var MATCH$1 = wellKnownSymbol$3('match');
|
|
3451
|
-
|
|
3452
|
-
// `IsRegExp` abstract operation
|
|
3453
|
-
// https://tc39.es/ecma262/#sec-isregexp
|
|
3454
|
-
var isRegexp = function (it) {
|
|
3455
|
-
var isRegExp;
|
|
3456
|
-
return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$1(it) == 'RegExp');
|
|
3457
|
-
};
|
|
3458
|
-
|
|
3459
|
-
var global$8 = global$K;
|
|
3460
|
-
var isRegExp$1 = isRegexp;
|
|
3461
|
-
|
|
3462
|
-
var TypeError$3 = global$8.TypeError;
|
|
3463
|
-
|
|
3464
|
-
var notARegexp = function (it) {
|
|
3465
|
-
if (isRegExp$1(it)) {
|
|
3466
|
-
throw TypeError$3("The method doesn't accept regular expressions");
|
|
3467
|
-
} return it;
|
|
3468
|
-
};
|
|
3469
|
-
|
|
3470
|
-
var wellKnownSymbol$2 = wellKnownSymbol$i;
|
|
3471
|
-
|
|
3472
|
-
var MATCH = wellKnownSymbol$2('match');
|
|
3473
|
-
|
|
3474
|
-
var correctIsRegexpLogic = function (METHOD_NAME) {
|
|
3475
|
-
var regexp = /./;
|
|
3476
|
-
try {
|
|
3477
|
-
'/./'[METHOD_NAME](regexp);
|
|
3478
|
-
} catch (error1) {
|
|
3479
|
-
try {
|
|
3480
|
-
regexp[MATCH] = false;
|
|
3481
|
-
return '/./'[METHOD_NAME](regexp);
|
|
3482
|
-
} catch (error2) { /* empty */ }
|
|
3483
|
-
} return false;
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
3232
|
var $$3 = _export;
|
|
3487
3233
|
var uncurryThis$8 = functionUncurryThis;
|
|
3488
3234
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
3489
3235
|
var toLength$2 = toLength$4;
|
|
3490
|
-
var toString$6 = toString$
|
|
3236
|
+
var toString$6 = toString$8;
|
|
3491
3237
|
var notARegExp = notARegexp;
|
|
3492
|
-
var requireObjectCoercible$4 = requireObjectCoercible$
|
|
3238
|
+
var requireObjectCoercible$4 = requireObjectCoercible$8;
|
|
3493
3239
|
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
3494
3240
|
|
|
3495
3241
|
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
|
|
@@ -3592,7 +3338,7 @@ var regexpUnsupportedNcg = fails$5(function () {
|
|
|
3592
3338
|
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
3593
3339
|
var call$3 = functionCall;
|
|
3594
3340
|
var uncurryThis$7 = functionUncurryThis;
|
|
3595
|
-
var toString$5 = toString$
|
|
3341
|
+
var toString$5 = toString$8;
|
|
3596
3342
|
var regexpFlags = regexpFlags$1;
|
|
3597
3343
|
var stickyHelpers$1 = regexpStickyHelpers;
|
|
3598
3344
|
var shared = shared$4.exports;
|
|
@@ -3790,8 +3536,8 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
3790
3536
|
|
|
3791
3537
|
var uncurryThis$5 = functionUncurryThis;
|
|
3792
3538
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$4;
|
|
3793
|
-
var toString$4 = toString$
|
|
3794
|
-
var requireObjectCoercible$3 = requireObjectCoercible$
|
|
3539
|
+
var toString$4 = toString$8;
|
|
3540
|
+
var requireObjectCoercible$3 = requireObjectCoercible$8;
|
|
3795
3541
|
|
|
3796
3542
|
var charAt$2 = uncurryThis$5(''.charAt);
|
|
3797
3543
|
var charCodeAt = uncurryThis$5(''.charCodeAt);
|
|
@@ -3909,8 +3655,8 @@ var anObject$1 = anObject$e;
|
|
|
3909
3655
|
var isCallable = isCallable$j;
|
|
3910
3656
|
var toIntegerOrInfinity = toIntegerOrInfinity$4;
|
|
3911
3657
|
var toLength$1 = toLength$4;
|
|
3912
|
-
var toString$3 = toString$
|
|
3913
|
-
var requireObjectCoercible$2 = requireObjectCoercible$
|
|
3658
|
+
var toString$3 = toString$8;
|
|
3659
|
+
var requireObjectCoercible$2 = requireObjectCoercible$8;
|
|
3914
3660
|
var advanceStringIndex$1 = advanceStringIndex$2;
|
|
3915
3661
|
var getMethod$1 = getMethod$5;
|
|
3916
3662
|
var getSubstitution = getSubstitution$1;
|
|
@@ -4106,7 +3852,7 @@ const selectExperience = ({
|
|
|
4106
3852
|
activeExperiments,
|
|
4107
3853
|
profile
|
|
4108
3854
|
}));
|
|
4109
|
-
return selectedExperience;
|
|
3855
|
+
return selectedExperience !== null && selectedExperience !== void 0 ? selectedExperience : null;
|
|
4110
3856
|
};
|
|
4111
3857
|
|
|
4112
3858
|
const selectDistribution = ({
|
|
@@ -4120,6 +3866,16 @@ const selectDistribution = ({
|
|
|
4120
3866
|
end
|
|
4121
3867
|
}) => distributionRandom >= start && distributionRandom <= end // this overlaps on one value for each boundary but we just find the first match
|
|
4122
3868
|
);
|
|
3869
|
+
|
|
3870
|
+
if (!distribution) {
|
|
3871
|
+
// This should never happen. If it happens then the distribution is not configured correctly. So we just return the baseline.
|
|
3872
|
+
return {
|
|
3873
|
+
index: 0,
|
|
3874
|
+
start: 0,
|
|
3875
|
+
end: 1
|
|
3876
|
+
};
|
|
3877
|
+
}
|
|
3878
|
+
|
|
4123
3879
|
return distribution;
|
|
4124
3880
|
};
|
|
4125
3881
|
|
|
@@ -4274,11 +4030,11 @@ var uncurryThis$2 = functionUncurryThis;
|
|
|
4274
4030
|
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
4275
4031
|
var isRegExp = isRegexp;
|
|
4276
4032
|
var anObject = anObject$e;
|
|
4277
|
-
var requireObjectCoercible$1 = requireObjectCoercible$
|
|
4033
|
+
var requireObjectCoercible$1 = requireObjectCoercible$8;
|
|
4278
4034
|
var speciesConstructor = speciesConstructor$2;
|
|
4279
4035
|
var advanceStringIndex = advanceStringIndex$2;
|
|
4280
4036
|
var toLength = toLength$4;
|
|
4281
|
-
var toString$2 = toString$
|
|
4037
|
+
var toString$2 = toString$8;
|
|
4282
4038
|
var getMethod = getMethod$5;
|
|
4283
4039
|
var arraySlice = arraySliceSimple;
|
|
4284
4040
|
var callRegExpExec = regexpExecAbstract;
|
|
@@ -4429,8 +4185,8 @@ var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u200
|
|
|
4429
4185
|
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
4430
4186
|
|
|
4431
4187
|
var uncurryThis$1 = functionUncurryThis;
|
|
4432
|
-
var requireObjectCoercible = requireObjectCoercible$
|
|
4433
|
-
var toString$1 = toString$
|
|
4188
|
+
var requireObjectCoercible = requireObjectCoercible$8;
|
|
4189
|
+
var toString$1 = toString$8;
|
|
4434
4190
|
var whitespaces$1 = whitespaces$2;
|
|
4435
4191
|
|
|
4436
4192
|
var replace = uncurryThis$1(''.replace);
|
|
@@ -4463,7 +4219,7 @@ var stringTrim = {
|
|
|
4463
4219
|
var global$1 = global$K;
|
|
4464
4220
|
var fails = fails$k;
|
|
4465
4221
|
var uncurryThis = functionUncurryThis;
|
|
4466
|
-
var toString = toString$
|
|
4222
|
+
var toString = toString$8;
|
|
4467
4223
|
var trim = stringTrim.trim;
|
|
4468
4224
|
var whitespaces = whitespaces$2;
|
|
4469
4225
|
|
|
@@ -4505,9 +4261,9 @@ const decodeExperienceVariantsMap = encodedExperienceVariantsMap => {
|
|
|
4505
4261
|
experienceId,
|
|
4506
4262
|
variantIndex
|
|
4507
4263
|
};
|
|
4508
|
-
}).filter(x => x).reduce((acc, curr) => Object.assign(Object.assign({}, acc), {
|
|
4264
|
+
}).filter(x => !!x).reduce((acc, curr) => Object.assign(Object.assign({}, acc), {
|
|
4509
4265
|
[curr.experienceId]: curr.variantIndex
|
|
4510
4266
|
}), {});
|
|
4511
4267
|
};
|
|
4512
4268
|
|
|
4513
|
-
export {
|
|
4269
|
+
export { EXPERIENCE_TRAIT_PREFIX, NINETAILED_TRACKER_EVENTS, Ninetailed, PLUGIN_NAME, decodeExperienceVariantsMap, isExperienceMatch, ninetailedPlugin, selectActiveExperiments, selectDistribution, selectEligibleExperiences, selectExperience, selectBaselineWithVariants as selectExperienceBaselineWithVariants, selectVariant as selectExperienceVariant, selectVariants as selectExperienceVariants, selectHasVariants as selectHasExperienceVariants, selectVariant$1 as selectVariant };
|