@microsoft/applicationinsights-react-js 3.2.1-nightly.202110-08 → 3.2.1-nightly.202110-17
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/browser/applicationinsights-react-js.js +35 -15
- package/browser/applicationinsights-react-js.js.map +1 -1
- package/browser/applicationinsights-react-js.min.js +2 -2
- package/browser/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.api.json +92 -1
- package/dist/applicationinsights-react-js.api.md +7 -0
- package/dist/applicationinsights-react-js.d.ts +10 -1
- package/dist/applicationinsights-react-js.js +35 -15
- package/dist/applicationinsights-react-js.js.map +1 -1
- package/dist/applicationinsights-react-js.min.js +2 -2
- package/dist/applicationinsights-react-js.min.js.map +1 -1
- package/dist/applicationinsights-react-js.rollup.d.ts +10 -1
- package/dist-esm/AppInsightsContext.js +1 -1
- package/dist-esm/AppInsightsErrorBoundary.js +1 -1
- package/dist-esm/Interfaces/IReactExtensionConfig.js +1 -1
- package/dist-esm/ReactPlugin.js +15 -2
- package/dist-esm/ReactPlugin.js.map +1 -1
- package/dist-esm/applicationinsights-react-js.js +1 -1
- package/dist-esm/useTrackEvent.js +1 -1
- package/dist-esm/useTrackMetric.js +1 -1
- package/dist-esm/withAITracking.js +1 -1
- package/package.json +3 -3
- package/src/ReactPlugin.ts +20 -2
- package/types/ReactPlugin.d.ts +8 -1
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - React Plugin, 3.2.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - React Plugin, 3.2.1-nightly.202110-17
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -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; }
|
|
@@ -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 >=
|
|
881
|
-
_self
|
|
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 >=
|
|
887
|
-
_self
|
|
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
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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;
|
|
@@ -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) {
|