@microsoft/applicationinsights-react-native 4.0.3 → 4.0.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - React Native Plugin, 4.0.3
2
+ * Application Insights JavaScript SDK - React Native Plugin, 4.0.4
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -22,22 +22,15 @@
22
22
  var NULL_VALUE = null;
23
23
  var EMPTY = "";
24
24
  var FUNCTION = "function";
25
- var NUMBER = "number";
26
25
  var OBJECT = "object";
27
26
  var PROTOTYPE = "prototype";
28
27
  var __PROTO__ = "__proto__";
29
- var STRING = "string";
30
28
  var UNDEFINED = "undefined";
31
29
  var CONSTRUCTOR = "constructor";
32
30
  var SYMBOL = "Symbol";
33
31
  var POLYFILL_TAG = "_polyfill";
34
- var INDEX_OF = "indexOf";
35
- var LAST_INDEX_OF = "lastIndexOf";
36
32
  var LENGTH = "length";
37
- var DONE = "done";
38
- var VALUE = "value";
39
33
  var NAME = "name";
40
- var SLICE = "slice";
41
34
  var CALL = "call";
42
35
  var TO_STRING = "toString";
43
36
  var ObjClass = Object;
@@ -46,6 +39,7 @@
46
39
  var StrProto = StrCls[PROTOTYPE];
47
40
  var ArrCls = Array;
48
41
  var ArrProto = ArrCls[PROTOTYPE];
42
+ var ArrSlice = ArrProto["slice"];
49
43
 
50
44
  function safe(func, argArray) {
51
45
  try {
@@ -84,7 +78,7 @@
84
78
  function isDefined(arg) {
85
79
  return !!arg || arg !== UNDEF_VALUE;
86
80
  }
87
- var isString = ( _createIs(STRING));
81
+ var isString = ( _createIs("string"));
88
82
  var isFunction = ( _createIs(FUNCTION));
89
83
  function isObject(value) {
90
84
  if (!value && isNullOrUndefined(value)) {
@@ -230,7 +224,7 @@
230
224
  object = { stack: asString(object.stack), message: asString(object.message), name: asString(object.name) };
231
225
  }
232
226
  try {
233
- propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === NUMBER) ? format : 4) : UNDEF_VALUE);
227
+ propertyValueDump = JSON.stringify(object, NULL_VALUE, format ? ((typeof format === "number") ? format : 4) : UNDEF_VALUE);
234
228
  propertyValueDump = (propertyValueDump && propertyValueDump.replace(/"(\w+)"\s*:\s{0,1}/g, "$1: ")) || asString(object);
235
229
  }
236
230
  catch (e) {
@@ -239,17 +233,14 @@
239
233
  return objType + ": " + propertyValueDump;
240
234
  }
241
235
 
242
- var _slice;
243
- var _unwrapInstFunction = _unwrapFunctionWithPoly;
244
236
  var _unwrapFunction = _unwrapFunctionWithPoly;
245
237
  function _unwrapFunctionWithPoly(funcName, clsProto, polyFunc) {
246
- _slice = _slice || ArrProto[SLICE];
247
238
  var clsFn = clsProto && clsProto[funcName];
248
239
  return function (thisArg) {
249
240
  var theFunc = (thisArg && thisArg[funcName]) || clsFn;
250
241
  if (theFunc || polyFunc) {
251
242
  var theArgs = arguments;
252
- return (theFunc || polyFunc).apply(thisArg, theFunc ? _slice[CALL](theArgs, 1) : theArgs);
243
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrSlice[CALL](theArgs, 1) : theArgs);
253
244
  }
254
245
  throwTypeError("\"" + asString(funcName) + "\" not defined for " + dumpObj(thisArg));
255
246
  };
@@ -297,7 +288,7 @@
297
288
  var propMap = {
298
289
  e: "enumerable",
299
290
  c: "configurable",
300
- v: VALUE,
291
+ v: "value",
301
292
  w: "writable",
302
293
  g: "get",
303
294
  s: "set"
@@ -364,8 +355,14 @@
364
355
 
365
356
  var WINDOW = "window";
366
357
  var _cachedGlobal;
367
- var _cachedWindow;
368
- var _cachedNavigator;
358
+ function _getGlobalInstFn(getFn, theArgs) {
359
+ var cachedValue;
360
+ return function () {
361
+ !_globalLazyTestHooks && _initTestHooks();
362
+ (!cachedValue || _globalLazyTestHooks.lzy) && (cachedValue = createCachedValue(safe(getFn, theArgs).v));
363
+ return cachedValue.v;
364
+ };
365
+ }
369
366
  function lazySafeGetInst(name) {
370
367
  return getLazy(function () { return safe((getInst), [name]).v || UNDEF_VALUE; });
371
368
  }
@@ -379,24 +376,16 @@
379
376
  if (gbl && gbl[name]) {
380
377
  return gbl[name];
381
378
  }
382
- if (name === WINDOW && _cachedWindow) {
383
- return _cachedWindow.v;
379
+ if (name === WINDOW) {
380
+ return getWindow();
384
381
  }
385
382
  return NULL_VALUE;
386
383
  }
387
384
  function hasWindow() {
388
385
  return !!getWindow();
389
386
  }
390
- function getWindow() {
391
- !_globalLazyTestHooks && _initTestHooks();
392
- (!_cachedWindow || _globalLazyTestHooks.lzy) && (_cachedWindow = createCachedValue(safe((getInst), [WINDOW]).v));
393
- return _cachedWindow.v;
394
- }
395
- function getNavigator() {
396
- !_globalLazyTestHooks && _initTestHooks();
397
- (!_cachedNavigator || _globalLazyTestHooks.lzy) && (_cachedNavigator = createCachedValue(safe((getInst), ["navigator"]).v));
398
- return _cachedNavigator.v;
399
- }
387
+ var getWindow = ( _getGlobalInstFn(getInst, [WINDOW]));
388
+ var getNavigator = ( _getGlobalInstFn(getInst, ["navigator"]));
400
389
 
401
390
  var _symbol;
402
391
  var _symbolFor;
@@ -443,8 +432,8 @@
443
432
  var iterResult = void 0;
444
433
  try {
445
434
  var count = 0;
446
- while (!(iterResult = iter.next())[DONE]) {
447
- if (callbackfn[CALL](thisArg || iter, iterResult[VALUE], count, iter) === -1) {
435
+ while (!(iterResult = iter.next()).done) {
436
+ if (callbackfn[CALL](thisArg || iter, iterResult.value, count, iter) === -1) {
448
437
  break;
449
438
  }
450
439
  count++;
@@ -459,7 +448,7 @@
459
448
  }
460
449
  finally {
461
450
  try {
462
- if (iterResult && !iterResult[DONE]) {
451
+ if (iterResult && !iterResult.done) {
463
452
  iter.return && iter.return(iterResult);
464
453
  }
465
454
  }
@@ -473,7 +462,9 @@
473
462
  }
474
463
  }
475
464
 
476
- var fnApply = ( _unwrapInstFunction("apply"));
465
+ function fnApply(fn, thisArg, argArray) {
466
+ return fn.apply(thisArg, argArray);
467
+ }
477
468
 
478
469
  function arrAppend(target, elms) {
479
470
  if (!isUndefined(elms) && target) {
@@ -505,8 +496,8 @@
505
496
  }
506
497
  }
507
498
 
508
- var arrIndexOf = ( _unwrapFunction(INDEX_OF, ArrProto));
509
- ( _unwrapFunction(LAST_INDEX_OF, ArrProto));
499
+ var arrIndexOf = ( _unwrapFunction("indexOf", ArrProto));
500
+ ( _unwrapFunction("lastIndexOf", ArrProto));
510
501
 
511
502
  var objCreate = ObjClass["create"] || polyObjCreate;
512
503
  function polyObjCreate(obj) {
@@ -557,7 +548,7 @@
557
548
  var theArgs = arguments;
558
549
  try {
559
550
  safe(_setName, [theBaseClass, name]);
560
- var _self = fnApply(theBaseClass, _this, ArrProto[SLICE][CALL](theArgs)) || _this;
551
+ var _self = fnApply(theBaseClass, _this, ArrSlice[CALL](theArgs)) || _this;
561
552
  if (_self !== _this) {
562
553
  var orgProto = objGetPrototypeOf(_this);
563
554
  if (orgProto !== objGetPrototypeOf(_self)) {
@@ -613,59 +604,54 @@
613
604
  return result;
614
605
  }
615
606
 
616
- var strIndexOf = ( _unwrapFunction(INDEX_OF, StrProto));
617
- ( _unwrapFunction(LAST_INDEX_OF, StrProto));
607
+ var strIndexOf = ( _unwrapFunction("indexOf", StrProto));
608
+ ( _unwrapFunction("lastIndexOf", StrProto));
618
609
 
619
610
  var REF = "ref";
620
- var UNREF = "un" + REF;
611
+ var UNREF = "unref";
621
612
  var HAS_REF = "hasRef";
622
613
  var ENABLED = "enabled";
623
614
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
624
- var _a;
625
615
  var ref = true;
626
616
  var timerId = startTimer ? refreshFn(NULL_VALUE) : NULL_VALUE;
627
617
  var theTimerHandler;
628
- var _unref = function () {
618
+ function _unref() {
629
619
  ref = false;
630
620
  timerId && timerId[UNREF] && timerId[UNREF]();
631
621
  return theTimerHandler;
632
- };
633
- var _ref = function () {
634
- ref = true;
635
- timerId && timerId[REF] && timerId[REF]();
622
+ }
623
+ function _cancel() {
624
+ timerId && cancelFn(timerId);
625
+ timerId = NULL_VALUE;
626
+ }
627
+ function _refresh() {
628
+ timerId = refreshFn(timerId);
629
+ if (!ref) {
630
+ _unref();
631
+ }
636
632
  return theTimerHandler;
633
+ }
634
+ function _setEnabled(value) {
635
+ !value && timerId && _cancel();
636
+ value && !timerId && _refresh();
637
+ }
638
+ theTimerHandler = {
639
+ cancel: _cancel,
640
+ refresh: _refresh
637
641
  };
638
- var _hasRef = function () {
642
+ theTimerHandler[HAS_REF] = function () {
639
643
  if (timerId && timerId[HAS_REF]) {
640
644
  return timerId[HAS_REF]();
641
645
  }
642
646
  return ref;
643
647
  };
644
- var _refresh = function () {
645
- timerId = refreshFn(timerId);
646
- if (!ref) {
647
- _unref();
648
- }
648
+ theTimerHandler[REF] = function () {
649
+ ref = true;
650
+ timerId && timerId[REF] && timerId[REF]();
649
651
  return theTimerHandler;
650
652
  };
651
- var _cancel = function () {
652
- timerId && cancelFn(timerId);
653
- timerId = NULL_VALUE;
654
- };
655
- var _setEnabled = function (value) {
656
- !value && timerId && _cancel();
657
- value && !timerId && _refresh();
658
- };
659
- theTimerHandler = (_a = {
660
- cancel: _cancel,
661
- refresh: _refresh
662
- },
663
- _a[HAS_REF] = _hasRef,
664
- _a[REF] = _ref,
665
- _a[UNREF] = _unref,
666
- _a[ENABLED] = false,
667
- _a);
668
- objDefineProp(theTimerHandler, ENABLED, {
653
+ theTimerHandler[UNREF] = _unref;
654
+ theTimerHandler = objDefineProp(theTimerHandler, ENABLED, {
669
655
  get: function () { return !!timerId; },
670
656
  set: _setEnabled
671
657
  });
@@ -677,7 +663,7 @@
677
663
  };
678
664
  }
679
665
 
680
- function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
666
+ function _createTimeoutWith(startTimer, overrideFn, theArgs) {
681
667
  var isArr = isArray(overrideFn);
682
668
  var len = isArr ? overrideFn.length : 0;
683
669
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
@@ -685,7 +671,7 @@
685
671
  var timerFn = theArgs[0];
686
672
  theArgs[0] = function () {
687
673
  handler.dn();
688
- fnApply(timerFn, self, ArrProto[SLICE][CALL](arguments));
674
+ fnApply(timerFn, UNDEF_VALUE, ArrSlice[CALL](arguments));
689
675
  };
690
676
  var handler = _createTimerHandler(startTimer, function (timerId) {
691
677
  if (timerId) {
@@ -693,16 +679,16 @@
693
679
  timerId.refresh();
694
680
  return timerId;
695
681
  }
696
- fnApply(clearFn, self, [timerId]);
682
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
697
683
  }
698
- return fnApply(setFn, self, theArgs);
684
+ return fnApply(setFn, UNDEF_VALUE, theArgs);
699
685
  }, function (timerId) {
700
- fnApply(clearFn, self, [timerId]);
686
+ fnApply(clearFn, UNDEF_VALUE, [timerId]);
701
687
  });
702
688
  return handler.h;
703
689
  }
704
690
  function scheduleTimeout(callback, timeout) {
705
- return _createTimeoutWith(this, true, UNDEF_VALUE, ArrProto[SLICE][CALL](arguments));
691
+ return _createTimeoutWith(true, UNDEF_VALUE, ArrSlice[CALL](arguments));
706
692
  }
707
693
 
708
694
  (getGlobal() || {})["Symbol"];
@@ -1009,7 +995,7 @@
1009
995
  var _DYN_NAME = "name";
1010
996
  var _DYN_TIME = "time";
1011
997
  var _DYN_PROCESS_NEXT = "processNext";
1012
- var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
998
+ var _DYN_GET_PROCESS_TEL_CONT2 = "getProcessTelContext";
1013
999
  var _DYN_UNLOAD = "unload";
1014
1000
  var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
1015
1001
  var _DYN_CREATE_NEW = "createNew";
@@ -1224,7 +1210,7 @@
1224
1210
  return result;
1225
1211
  }
1226
1212
 
1227
- var version = '3.0.8';
1213
+ var version = "3.0.5";
1228
1214
  var instanceName = "." + newId(6);
1229
1215
  var _dataUid = 0;
1230
1216
  function _canAcceptData(target) {
@@ -1783,6 +1769,7 @@
1783
1769
  configHandler = null;
1784
1770
  }
1785
1771
  };
1772
+ objDefine(handler, "toJSON", { v: function () { return "WatcherHandler" + (handler.fn ? "" : "[X]"); } });
1786
1773
  state.use(handler, configHandler);
1787
1774
  return handler;
1788
1775
  }
@@ -2739,7 +2726,7 @@
2739
2726
  function _setDefaults(config, core, pluginChain) {
2740
2727
  createDynamicConfig(config, defaultValues, safeGetLogger(core));
2741
2728
  if (!pluginChain && core) {
2742
- pluginChain = core[_DYN_GET_PROCESS_TEL_CONT0 ]()[_DYN_GET_NEXT ]();
2729
+ pluginChain = core[_DYN_GET_PROCESS_TEL_CONT2 ]()[_DYN_GET_NEXT ]();
2743
2730
  }
2744
2731
  var nextPlugin = _nextPlugin;
2745
2732
  if (_nextPlugin && _nextPlugin[strGetPlugin]) {