@microsoft/applicationinsights-react-native 3.0.2-nightly.2302-05 → 3.0.2

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, 3.0.2-nightly.2302-05
2
+ * Application Insights JavaScript SDK - React Native Plugin, 3.0.2
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -17,11 +17,11 @@
17
17
  var strShimUndefined = "undefined";
18
18
  var strShimPrototype = "prototype";
19
19
  var strShimHasOwnProperty = "hasOwnProperty";
20
- var ObjClass = Object;
21
- var ObjProto = ObjClass[strShimPrototype];
22
- var ObjCreate = ObjClass["create"];
23
- var ObjDefineProperty = ObjClass["defineProperty"];
24
- var ObjHasOwnProperty = ObjProto[strShimHasOwnProperty];
20
+ var ObjClass$1 = Object;
21
+ var ObjProto$1 = ObjClass$1[strShimPrototype];
22
+ var ObjCreate = ObjClass$1["create"];
23
+ var ObjDefineProperty = ObjClass$1["defineProperty"];
24
+ var ObjHasOwnProperty = ObjProto$1[strShimHasOwnProperty];
25
25
 
26
26
  var _cachedGlobal = null;
27
27
  function getGlobal(useCached) {
@@ -44,7 +44,7 @@
44
44
  }
45
45
  return result;
46
46
  }
47
- function throwTypeError(message) {
47
+ function throwTypeError$1(message) {
48
48
  throw new TypeError(message);
49
49
  }
50
50
  function objCreateFn(obj) {
@@ -57,7 +57,7 @@
57
57
  }
58
58
  var type = typeof obj;
59
59
  if (type !== strShimObject && type !== strShimFunction) {
60
- throwTypeError("Object prototype may only be an Object:" + obj);
60
+ throwTypeError$1("Object prototype may only be an Object:" + obj);
61
61
  }
62
62
  function tmpFunc() { }
63
63
  tmpFunc[strShimPrototype] = obj;
@@ -67,7 +67,7 @@
67
67
  (getGlobal() || {})["Symbol"];
68
68
  (getGlobal() || {})["Reflect"];
69
69
  var extendStaticsFn = function (d, b) {
70
- extendStaticsFn = ObjClass["setPrototypeOf"] ||
70
+ extendStaticsFn = ObjClass$1["setPrototypeOf"] ||
71
71
  ({ __proto__: [] } instanceof Array && function (d, b) {
72
72
  d.__proto__ = b;
73
73
  }) ||
@@ -82,7 +82,7 @@
82
82
  };
83
83
  function __extendsFn(d, b) {
84
84
  if (typeof b !== strShimFunction && b !== null) {
85
- throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
85
+ throwTypeError$1("Class extends value " + String(b) + " is not a constructor or null");
86
86
  }
87
87
  extendStaticsFn(d, b);
88
88
  function __() {
@@ -92,7 +92,7 @@
92
92
  }
93
93
 
94
94
  /*!
95
- * Microsoft Dynamic Proto Utility, 1.1.7
95
+ * Microsoft Dynamic Proto Utility, 1.1.9
96
96
  * Copyright (c) Microsoft and contributors. All rights reserved.
97
97
  */
98
98
  var _a;
@@ -411,11 +411,11 @@
411
411
  var str__Proto = "__proto__";
412
412
  var strConstructor = "constructor";
413
413
  var _objDefineProperty$1 = ObjDefineProperty;
414
- var _objFreeze = ObjClass.freeze;
414
+ var _objFreeze = ObjClass$1.freeze;
415
415
  var _isArray = Array.isArray;
416
- var _objToString = ObjProto[strToString];
416
+ var _objToString = ObjProto$1[strToString];
417
417
  var _fnToString = ObjHasOwnProperty[strToString];
418
- var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass);
418
+ var _objFunctionString = _fnToString[_DYN_CALL ](ObjClass$1);
419
419
  var rCamelCase = /-([a-z])/g;
420
420
  var rNormalizeInvalid = /([^\w\d_$])/g;
421
421
  var rLeadingNumeric = /^(\d+[\w\d_$])/;
@@ -476,7 +476,7 @@
476
476
  function _isArrayPoly(obj) {
477
477
  return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Array]");
478
478
  }
479
- function isError(obj) {
479
+ function isError$1(obj) {
480
480
  return !!(obj && _objToString[_DYN_CALL ](obj) === "[object Error]");
481
481
  }
482
482
  function isString$1(value) {
@@ -545,7 +545,7 @@
545
545
  return dt.now ? dt.now() : new dt().getTime();
546
546
  }
547
547
  function getExceptionName(object) {
548
- if (isError(object)) {
548
+ if (isError$1(object)) {
549
549
  return object[_DYN_NAME ];
550
550
  }
551
551
  return STR_EMPTY;
@@ -697,7 +697,7 @@
697
697
  }
698
698
  return _isTrident;
699
699
  }
700
- function dumpObj(object) {
700
+ function dumpObj$1(object) {
701
701
  var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL ](object);
702
702
  var propertyValueDump = STR_EMPTY;
703
703
  if (objectTypeDump === "[object Error]") {
@@ -777,18 +777,18 @@
777
777
  var _loggingLevelConsole;
778
778
  var _loggingLevelTelemetry;
779
779
  var _maxInternalMessageLimit;
780
- var _enableDebugExceptions;
780
+ var _enableDebug;
781
781
  dynamicProto(DiagnosticLogger, this, function (_self) {
782
782
  _setDefaultsFromConfig(config || {});
783
783
  _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
784
784
  _self.telemetryLoggingLevel = function () { return _loggingLevelTelemetry; };
785
785
  _self.maxInternalMessageLimit = function () { return _maxInternalMessageLimit; };
786
- _self[_DYN_ENABLE_DEBUG_EXCEPTI4 ] = function () { return _enableDebugExceptions; };
786
+ _self[_DYN_ENABLE_DEBUG_EXCEPTI4 ] = function () { return _enableDebug; };
787
787
  _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
788
788
  if (isUserAct === void 0) { isUserAct = false; }
789
789
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
790
- if (_enableDebugExceptions) {
791
- throw dumpObj(message);
790
+ if (_enableDebug) {
791
+ throw dumpObj$1(message);
792
792
  }
793
793
  else {
794
794
  var logFunc = severity === 1 ? STR_ERROR_TO_CONSOLE : STR_WARN_TO_CONSOLE;
@@ -860,7 +860,7 @@
860
860
  _loggingLevelConsole = getCfgValue(config.loggingLevelConsole, 0);
861
861
  _loggingLevelTelemetry = getCfgValue(config.loggingLevelTelemetry, 1);
862
862
  _maxInternalMessageLimit = getCfgValue(config.maxMessageLimit, 25);
863
- _enableDebugExceptions = getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 ], false);
863
+ _enableDebug = getCfgValue(config.enableDebug, getCfgValue(config[_DYN_ENABLE_DEBUG_EXCEPTI4 ], false));
864
864
  }
865
865
  function _areInternalMessagesThrottled() {
866
866
  return _messageCount >= _maxInternalMessageLimit;
@@ -1070,7 +1070,7 @@
1070
1070
  }
1071
1071
 
1072
1072
  var _objDefineProperty = ObjDefineProperty;
1073
- var version = '2.8.10';
1073
+ var version = '2.8.12';
1074
1074
  var instanceName = "." + newId(6);
1075
1075
  var _dataUid = 0;
1076
1076
  function _createAccessor(target, prop, value) {
@@ -1216,7 +1216,7 @@
1216
1216
  completeDetails.func[_DYN_CALL ](completeDetails.self, completeDetails.args);
1217
1217
  }
1218
1218
  catch (e) {
1219
- _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1219
+ _throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj$1(e));
1220
1220
  }
1221
1221
  });
1222
1222
  _onComplete = [];
@@ -1425,7 +1425,7 @@
1425
1425
  hasRun = true;
1426
1426
  }
1427
1427
  if (!nextProxy || !hasNextRun) {
1428
- _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1428
+ _throwInternal(itemCtx[_DYN_DIAG_LOG ](), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj$1(error) + ", run flags: " + dumpObj$1(hasRunContext));
1429
1429
  }
1430
1430
  }
1431
1431
  }, details, isAsync);
@@ -1507,7 +1507,7 @@
1507
1507
  handler(unloadCtx, unloadState);
1508
1508
  }
1509
1509
  catch (e) {
1510
- _throwInternal(unloadCtx[_DYN_DIAG_LOG ](), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1510
+ _throwInternal(unloadCtx[_DYN_DIAG_LOG ](), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj$1(e));
1511
1511
  }
1512
1512
  });
1513
1513
  handlers = [];
@@ -1691,67 +1691,137 @@
1691
1691
  var AnalyticsPluginIdentifier = "ApplicationInsightsAnalytics";
1692
1692
 
1693
1693
  var UNDEF_VALUE = undefined;
1694
+ var EMPTY = "";
1694
1695
  var FUNCTION = "function";
1696
+ var NUMBER = "number";
1697
+ var PROTOTYPE = "prototype";
1695
1698
  var STRING = "string";
1696
- var LENGTH = "length";
1699
+ var SLICE = "slice";
1700
+ var ObjClass = Object;
1701
+ var ObjProto = ObjClass[PROTOTYPE];
1702
+ var StrCls = String;
1697
1703
  var ArrCls = Array;
1704
+ var ArrProto = ArrCls[PROTOTYPE];
1698
1705
 
1699
1706
  function _createIs(theType) {
1700
1707
  return function (value) {
1701
1708
  return typeof value === theType;
1702
1709
  };
1703
1710
  }
1711
+ function _createObjIs(theName) {
1712
+ var theType = "[object " + theName + "]";
1713
+ return function (value) {
1714
+ return !!(value && objToString(value) === theType);
1715
+ };
1716
+ }
1717
+ function objToString(value) {
1718
+ return ObjProto.toString.call(value);
1719
+ }
1704
1720
  var isString = _createIs(STRING);
1705
1721
  var isFunction = _createIs(FUNCTION);
1706
1722
  var isArray = ArrCls.isArray;
1723
+ var isNumber = _createIs(NUMBER);
1724
+ var isError = _createObjIs("Error");
1707
1725
  function isPromiseLike(value) {
1708
1726
  return !!value && isFunction(value.then);
1709
1727
  }
1710
1728
 
1711
- function _extractArgs(args, startAt) {
1712
- var theArgs = [];
1713
- for (var lp = startAt; lp < args[LENGTH]; lp++) {
1714
- theArgs[lp - startAt] = args[lp];
1729
+ function throwTypeError(message) {
1730
+ throw new TypeError(message);
1731
+ }
1732
+
1733
+ var asString = StrCls;
1734
+
1735
+ function dumpObj(object, format) {
1736
+ var propertyValueDump = EMPTY;
1737
+ if (isError(object)) {
1738
+ propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
1715
1739
  }
1716
- return theArgs;
1740
+ else {
1741
+ try {
1742
+ propertyValueDump = JSON.stringify(object, null, format ? (isNumber(format) ? format : 4) : UNDEF_VALUE);
1743
+ }
1744
+ catch (e) {
1745
+ propertyValueDump = " - " + dumpObj(e, format);
1746
+ }
1747
+ }
1748
+ return objToString(object) + ": " + propertyValueDump;
1717
1749
  }
1718
1750
 
1751
+ function _unwrapFunction(funcName, target, polyFunc) {
1752
+ return function (thisArg) {
1753
+ var theFunc = (thisArg && thisArg[funcName]) || (target && target[funcName]);
1754
+ if (theFunc || polyFunc) {
1755
+ var theArgs = arguments;
1756
+ return (theFunc || polyFunc).apply(thisArg, theFunc ? ArrProto[SLICE].call(theArgs, 1) : theArgs);
1757
+ }
1758
+ throwTypeError("'" + asString(funcName) + "' not defined for " + dumpObj(thisArg));
1759
+ };
1760
+ }
1761
+
1762
+ var objDefineProp = ObjClass["defineProperty"];
1763
+
1764
+ var arrSlice = _unwrapFunction(SLICE, ArrProto);
1765
+
1766
+ var REF = "ref";
1767
+ var UNREF = "un" + REF;
1768
+ var HAS_REF = "hasRef";
1769
+ var ENABLED = "enabled";
1719
1770
  function _createTimerHandler(startTimer, refreshFn, cancelFn) {
1771
+ var _a;
1720
1772
  var ref = true;
1721
1773
  var timerId = startTimer ? refreshFn(null) : null;
1722
- function _unref() {
1774
+ var theTimerHandler;
1775
+ var _unref = function () {
1723
1776
  ref = false;
1724
- timerId && timerId["unref"] && timerId["unref"]();
1725
- return timer;
1726
- }
1727
- function _ref() {
1777
+ timerId && timerId[UNREF] && timerId[UNREF]();
1778
+ return theTimerHandler;
1779
+ };
1780
+ var _ref = function () {
1728
1781
  ref = true;
1729
- timerId && timerId["ref"] && timerId["ref"]();
1730
- return timer;
1731
- }
1732
- function _hasRef() {
1733
- if (timerId && timerId["hasRef"]) {
1734
- return timerId["hasRef"]();
1782
+ timerId && timerId[REF] && timerId[REF]();
1783
+ return theTimerHandler;
1784
+ };
1785
+ var _hasRef = function () {
1786
+ if (timerId && timerId[HAS_REF]) {
1787
+ return timerId[HAS_REF]();
1735
1788
  }
1736
1789
  return ref;
1737
- }
1738
- var timer = {
1739
- cancel: function () {
1740
- timerId && cancelFn(timerId);
1741
- timerId = null;
1742
- },
1743
- refresh: function () {
1744
- timerId = refreshFn(timerId);
1745
- if (!ref) {
1746
- _unref();
1747
- }
1748
- return timer;
1790
+ };
1791
+ var _refresh = function () {
1792
+ timerId = refreshFn(timerId);
1793
+ if (!ref) {
1794
+ _unref();
1795
+ }
1796
+ return theTimerHandler;
1797
+ };
1798
+ var _cancel = function () {
1799
+ timerId && cancelFn(timerId);
1800
+ timerId = null;
1801
+ };
1802
+ var _setEnabled = function (value) {
1803
+ !value && timerId && _cancel();
1804
+ value && !timerId && _refresh();
1805
+ };
1806
+ theTimerHandler = (_a = {
1807
+ cancel: _cancel,
1808
+ refresh: _refresh
1749
1809
  },
1750
- hasRef: _hasRef,
1751
- ref: _ref,
1752
- unref: _unref
1810
+ _a[HAS_REF] = _hasRef,
1811
+ _a[REF] = _ref,
1812
+ _a[UNREF] = _unref,
1813
+ _a[ENABLED] = false,
1814
+ _a);
1815
+ objDefineProp(theTimerHandler, ENABLED, {
1816
+ get: function () { return !!timerId; },
1817
+ set: _setEnabled
1818
+ });
1819
+ return {
1820
+ h: theTimerHandler,
1821
+ dn: function () {
1822
+ timerId = null;
1823
+ }
1753
1824
  };
1754
- return timer;
1755
1825
  }
1756
1826
 
1757
1827
  function _createTimeoutWith(self, startTimer, overrideFn, theArgs) {
@@ -1759,7 +1829,12 @@
1759
1829
  var len = isArr ? overrideFn.length : 0;
1760
1830
  var setFn = (len > 0 ? overrideFn[0] : (!isArr ? overrideFn : UNDEF_VALUE)) || setTimeout;
1761
1831
  var clearFn = (len > 1 ? overrideFn[1] : UNDEF_VALUE) || clearTimeout;
1762
- return _createTimerHandler(startTimer, function (timerId) {
1832
+ var timerFn = theArgs[0];
1833
+ theArgs[0] = function () {
1834
+ handler.dn();
1835
+ timerFn.apply(self, arguments);
1836
+ };
1837
+ var handler = _createTimerHandler(startTimer, function (timerId) {
1763
1838
  if (timerId) {
1764
1839
  if (timerId.refresh) {
1765
1840
  timerId.refresh();
@@ -1771,9 +1846,10 @@
1771
1846
  }, function (timerId) {
1772
1847
  clearFn.call(self, timerId);
1773
1848
  });
1849
+ return handler.h;
1774
1850
  }
1775
1851
  function scheduleTimeout(callback, timeout) {
1776
- return _createTimeoutWith(this, true, UNDEF_VALUE, _extractArgs(arguments, 0));
1852
+ return _createTimeoutWith(this, true, UNDEF_VALUE, arrSlice(arguments));
1777
1853
  }
1778
1854
 
1779
1855
  function getReactNativeDeviceInfo() {
@@ -1859,7 +1935,7 @@
1859
1935
  uniqueId.then(function (value) {
1860
1936
  _setDeviceId(value);
1861
1937
  }, function (reason) {
1862
- _warnToConsole(_self.diagLog(), "Failed to get device id: " + dumpObj(reason));
1938
+ _warnToConsole(_self.diagLog(), "Failed to get device id: " + dumpObj$1(reason));
1863
1939
  _setDeviceId(_device.id);
1864
1940
  });
1865
1941
  }
@@ -1868,7 +1944,7 @@
1868
1944
  }
1869
1945
  }
1870
1946
  catch (e) {
1871
- _warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj(e));
1947
+ _warnToConsole(_self.diagLog(), "Failed to get DeviceInfo: " + getExceptionName(e) + " - " + dumpObj$1(e));
1872
1948
  }
1873
1949
  };
1874
1950
  _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {