@microsoft/applicationinsights-react-js 3.2.1-nightly.202110-07 → 3.2.1-nightly.202110-16

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 Plugin, 3.2.1-nightly.202110-07
2
+ * Application Insights JavaScript SDK - React Plugin, 3.2.1-nightly.202110-16
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -71,7 +71,7 @@
71
71
  }
72
72
  var type = typeof obj;
73
73
  if (type !== strShimObject && type !== strShimFunction) {
74
- throwTypeError('Object prototype may only be an Object:' + obj);
74
+ throwTypeError("Object prototype may only be an Object:" + obj);
75
75
  }
76
76
  function tmpFunc() { }
77
77
  tmpFunc[strShimPrototype] = obj;
@@ -633,20 +633,20 @@
633
633
  }
634
634
  return str.replace(/^\s+|\s+$/g, "");
635
635
  }
636
- var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString');
636
+ var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
637
637
  var _objKeysDontEnums = [
638
- 'toString',
639
- 'toLocaleString',
640
- 'valueOf',
641
- 'hasOwnProperty',
642
- 'isPrototypeOf',
643
- 'propertyIsEnumerable',
644
- 'constructor'
638
+ "toString",
639
+ "toLocaleString",
640
+ "valueOf",
641
+ "hasOwnProperty",
642
+ "isPrototypeOf",
643
+ "propertyIsEnumerable",
644
+ "constructor"
645
645
  ];
646
646
  function objKeys(obj) {
647
647
  var objType = typeof obj;
648
648
  if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
649
- throwTypeError('objKeys called on non-object');
649
+ throwTypeError("objKeys called on non-object");
650
650
  }
651
651
  var result = [];
652
652
  for (var prop in obj) {
@@ -824,12 +824,26 @@
824
824
  var AiNonUserActionablePrefix = "AI (Internal): ";
825
825
  var AiUserActionablePrefix = "AI: ";
826
826
  var AIInternalMessagePrefix = "AITR_";
827
+ var strErrorToConsole = "errorToConsole";
828
+ var strWarnToConsole = "warnToConsole";
827
829
  function _sanitizeDiagnosticText(text) {
828
830
  if (text) {
829
831
  return "\"" + text.replace(/\"/g, "") + "\"";
830
832
  }
831
833
  return "";
832
834
  }
835
+ function _logToConsole(func, message) {
836
+ var theConsole = getConsole();
837
+ if (!!theConsole) {
838
+ var logFunc = "log";
839
+ if (theConsole[func]) {
840
+ logFunc = "func";
841
+ }
842
+ if (isFunction(theConsole[logFunc])) {
843
+ theConsole[logFunc](message);
844
+ }
845
+ }
846
+ }
833
847
  var _InternalLogMessage = /** @class */ (function () {
834
848
  function _InternalLogMessage(msgId, msg, isUserAct, properties) {
835
849
  if (isUserAct === void 0) { isUserAct = false; }
@@ -854,7 +868,7 @@
854
868
  }
855
869
  var DiagnosticLogger = /** @class */ (function () {
856
870
  function DiagnosticLogger(config) {
857
- this.identifier = 'DiagnosticLogger';
871
+ this.identifier = "DiagnosticLogger";
858
872
  this.queue = [];
859
873
  var _messageCount = 0;
860
874
  var _messageLogged = {};
@@ -862,10 +876,10 @@
862
876
  if (isNullOrUndefined(config)) {
863
877
  config = {};
864
878
  }
865
- _self.consoleLoggingLevel = function () { return _getConfigValue('loggingLevelConsole', 0); };
866
- _self.telemetryLoggingLevel = function () { return _getConfigValue('loggingLevelTelemetry', 1); };
867
- _self.maxInternalMessageLimit = function () { return _getConfigValue('maxMessageLimit', 25); };
868
- _self.enableDebugExceptions = function () { return _getConfigValue('enableDebugExceptions', false); };
879
+ _self.consoleLoggingLevel = function () { return _getConfigValue("loggingLevelConsole", 0); };
880
+ _self.telemetryLoggingLevel = function () { return _getConfigValue("loggingLevelTelemetry", 1); };
881
+ _self.maxInternalMessageLimit = function () { return _getConfigValue("maxMessageLimit", 25); };
882
+ _self.enableDebugExceptions = function () { return _getConfigValue("enableDebugExceptions", false); };
869
883
  _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
870
884
  if (isUserAct === void 0) { isUserAct = false; }
871
885
  var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
@@ -873,18 +887,19 @@
873
887
  throw message;
874
888
  }
875
889
  else {
890
+ var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
876
891
  if (!isUndefined(message.message)) {
877
892
  var logLevel = _self.consoleLoggingLevel();
878
893
  if (isUserAct) {
879
894
  var messageKey = +message.messageId;
880
- if (!_messageLogged[messageKey] && logLevel >= LoggingSeverity.WARNING) {
881
- _self.warnToConsole(message.message);
895
+ if (!_messageLogged[messageKey] && logLevel >= severity) {
896
+ _self[logFunc](message.message);
882
897
  _messageLogged[messageKey] = true;
883
898
  }
884
899
  }
885
900
  else {
886
- if (logLevel >= LoggingSeverity.WARNING) {
887
- _self.warnToConsole(message.message);
901
+ if (logLevel >= severity) {
902
+ _self[logFunc](message.message);
888
903
  }
889
904
  }
890
905
  _self.logInternalMessage(severity, message);
@@ -892,16 +907,10 @@
892
907
  }
893
908
  };
894
909
  _self.warnToConsole = function (message) {
895
- var theConsole = getConsole();
896
- if (!!theConsole) {
897
- var logFunc = 'log';
898
- if (theConsole.warn) {
899
- logFunc = 'warn';
900
- }
901
- if (isFunction(theConsole[logFunc])) {
902
- theConsole[logFunc](message);
903
- }
904
- }
910
+ _logToConsole("warn", message);
911
+ };
912
+ _self.errorToConsole = function (message) {
913
+ _logToConsole("error", message);
905
914
  };
906
915
  _self.resetInternalMessageCount = function () {
907
916
  _messageCount = 0;
@@ -958,7 +967,7 @@
958
967
  _self.isChildEvt = function () { return false; };
959
968
  if (isFunction(payloadDetails)) {
960
969
  var theDetails_1;
961
- accessorDefined = objDefineAccessors(_self, 'payload', function () {
970
+ accessorDefined = objDefineAccessors(_self, "payload", function () {
962
971
  if (!theDetails_1 && isFunction(payloadDetails)) {
963
972
  theDetails_1 = payloadDetails();
964
973
  payloadDetails = null;
@@ -1636,8 +1645,8 @@
1636
1645
  function randomHexDigit() {
1637
1646
  return randomValue(15);
1638
1647
  }
1639
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(GuidRegex, function (c) {
1640
- var r = (randomHexDigit() | 0), v = (c === 'x' ? r : r & 0x3 | 0x8);
1648
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(GuidRegex, function (c) {
1649
+ var r = (randomHexDigit() | 0), v = (c === "x" ? r : r & 0x3 | 0x8);
1641
1650
  return v.toString(16);
1642
1651
  });
1643
1652
  }
@@ -1650,7 +1659,7 @@
1650
1659
  }
1651
1660
  function newId(maxLength) {
1652
1661
  if (maxLength === void 0) { maxLength = 22; }
1653
- var base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1662
+ var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1654
1663
  var number = random32() >>> 0;
1655
1664
  var chars = 0;
1656
1665
  var result = "";
@@ -1782,6 +1791,9 @@
1782
1791
  ReactPlugin.prototype.getCookieMgr = function () {
1783
1792
  return safeGetCookieMgr(this.core);
1784
1793
  };
1794
+ ReactPlugin.prototype.getAppInsights = function () {
1795
+ return this._analyticsPlugin;
1796
+ };
1785
1797
  ReactPlugin.prototype.processTelemetry = function (event, itemCtx) {
1786
1798
  this.processNext(event, itemCtx);
1787
1799
  };
@@ -1817,6 +1829,14 @@
1817
1829
  this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
1818
1830
  }
1819
1831
  };
1832
+ ReactPlugin.prototype.trackTrace = function (trace, customProperties) {
1833
+ if (this._analyticsPlugin) {
1834
+ this._analyticsPlugin.trackTrace(trace, customProperties);
1835
+ }
1836
+ else {
1837
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.TelemetryInitializerFailed, "Analytics plugin is not available, React plugin telemetry will not be sent: ");
1838
+ }
1839
+ };
1820
1840
  ReactPlugin.prototype.addHistoryListener = function (history) {
1821
1841
  var _this = this;
1822
1842
  var locationListener = function (location, action) {