@microsoft/applicationinsights-analytics-js 2.8.0-nightly.2204-04 → 2.8.0-nightly.2204-05

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.
Files changed (29) hide show
  1. package/browser/applicationinsights-analytics-js.integrity.json +9 -9
  2. package/browser/applicationinsights-analytics-js.js +311 -386
  3. package/browser/applicationinsights-analytics-js.js.map +1 -1
  4. package/browser/applicationinsights-analytics-js.min.js +2 -2
  5. package/browser/applicationinsights-analytics-js.min.js.map +1 -1
  6. package/dist/applicationinsights-analytics-js.d.ts +1 -1
  7. package/dist/applicationinsights-analytics-js.js +311 -386
  8. package/dist/applicationinsights-analytics-js.js.map +1 -1
  9. package/dist/applicationinsights-analytics-js.min.js +2 -2
  10. package/dist/applicationinsights-analytics-js.min.js.map +1 -1
  11. package/dist/applicationinsights-analytics-js.rollup.d.ts +1 -1
  12. package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js +14 -14
  13. package/dist-esm/JavaScriptSDK/AnalyticsPlugin.js.map +1 -1
  14. package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js +4 -4
  15. package/dist-esm/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
  16. package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +6 -5
  17. package/dist-esm/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
  18. package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +6 -6
  19. package/dist-esm/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
  20. package/dist-esm/JavaScriptSDK/Timing.js +4 -4
  21. package/dist-esm/JavaScriptSDK/Timing.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
  23. package/dist-esm/applicationinsights-analytics-js.js +1 -1
  24. package/package.json +5 -5
  25. package/src/JavaScriptSDK/AnalyticsPlugin.ts +25 -25
  26. package/src/JavaScriptSDK/Telemetry/PageViewManager.ts +8 -8
  27. package/src/JavaScriptSDK/Telemetry/PageViewPerformanceManager.ts +13 -11
  28. package/src/JavaScriptSDK/Telemetry/PageVisitTimeManager.ts +5 -5
  29. package/src/JavaScriptSDK/Timing.ts +3 -3
@@ -1,11 +1,11 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
8
- import { hasJSON, getJSON, dateNow, dumpObj, throwError } from "@microsoft/applicationinsights-core-js";
8
+ import { hasJSON, getJSON, dateNow, dumpObj, throwError, _warnToConsole } from "@microsoft/applicationinsights-core-js";
9
9
  /**
10
10
  * Used to track page visit durations
11
11
  */
@@ -35,7 +35,7 @@ var PageVisitTimeManager = /** @class */ (function () {
35
35
  }
36
36
  }
37
37
  catch (e) {
38
- this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
38
+ _warnToConsole(this._logger, "Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
39
39
  }
40
40
  };
41
41
  /**
@@ -50,7 +50,7 @@ var PageVisitTimeManager = /** @class */ (function () {
50
50
  return prevPageVisitData;
51
51
  }
52
52
  catch (e) {
53
- this._logger.warnToConsole("Call to restart failed: " + dumpObj(e));
53
+ _warnToConsole(this._logger, "Call to restart failed: " + dumpObj(e));
54
54
  return null;
55
55
  }
56
56
  };
@@ -72,7 +72,7 @@ var PageVisitTimeManager = /** @class */ (function () {
72
72
  }
73
73
  catch (e) {
74
74
  // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out
75
- this._logger.warnToConsole("Call to start failed: " + dumpObj(e));
75
+ _warnToConsole(this._logger, "Call to start failed: " + dumpObj(e));
76
76
  }
77
77
  };
78
78
  /**
@@ -102,7 +102,7 @@ var PageVisitTimeManager = /** @class */ (function () {
102
102
  return null;
103
103
  }
104
104
  catch (e) {
105
- this._logger.warnToConsole("Stop page visit timer failed: " + dumpObj(e));
105
+ _warnToConsole(this._logger, "Stop page visit timer failed: " + dumpObj(e));
106
106
  return null;
107
107
  }
108
108
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PageVisitTimeManager.js.map","sources":["PageVisitTimeManager.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { hasJSON, getJSON, dateNow, dumpObj, throwError } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to track page visit durations\r\n */\r\nvar PageVisitTimeManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of PageVisitTimeManager\r\n * @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)\r\n * @returns {}\r\n */\r\n function PageVisitTimeManager(logger, pageVisitTimeTrackingHandler) {\r\n this.prevPageVisitDataKeyName = \"prevPageVisitData\";\r\n this.pageVisitTimeTrackingHandler = pageVisitTimeTrackingHandler;\r\n this._logger = logger;\r\n }\r\n /**\r\n * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time\r\n * @param currentPageName Name of page to begin timing for visit duration\r\n * @param currentPageUrl Url of page to begin timing for visit duration\r\n */\r\n PageVisitTimeManager.prototype.trackPreviousPageVisit = function (currentPageName, currentPageUrl) {\r\n try {\r\n // Restart timer for new page view\r\n var prevPageVisitTimeData = this.restartPageVisitTimer(currentPageName, currentPageUrl);\r\n // If there was a page already being timed, track the visit time for it now.\r\n if (prevPageVisitTimeData) {\r\n this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);\r\n }\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Auto track page visit time failed, metric will not be collected: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page (if exists) and starts timing for duration of visit to pageName\r\n * @param pageName Name of page to begin timing visit duration\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n var prevPageVisitData = this.stopPageVisitTimer();\r\n this.startPageVisitTimer(pageName, pageUrl);\r\n return prevPageVisitData;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Call to restart failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n /**\r\n * Starts timing visit duration of pageName\r\n * @param pageName\r\n * @returns {}\r\n */\r\n PageVisitTimeManager.prototype.startPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n if (utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {\r\n throwError(\"Cannot call startPageVisit consecutively without first calling stopPageVisit\");\r\n }\r\n var currPageVisitData = new PageVisitData(pageName, pageUrl);\r\n var currPageVisitDataStr = getJSON().stringify(currPageVisitData);\r\n utlSetSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);\r\n }\r\n }\r\n catch (e) {\r\n // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out\r\n this._logger.warnToConsole(\"Call to start failed: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page, if exists.\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.stopPageVisitTimer = function () {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n // Define end time of page's visit\r\n var pageVisitEndTime = dateNow();\r\n // Try to retrieve page name and start time from session storage\r\n var pageVisitDataJsonStr = utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n if (pageVisitDataJsonStr && hasJSON()) {\r\n // if previous page data exists, set end time of visit\r\n var prevPageVisitData = getJSON().parse(pageVisitDataJsonStr);\r\n prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime;\r\n // Remove data from storage since we already used it\r\n utlRemoveSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n // Return page visit data\r\n return prevPageVisitData;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n catch (e) {\r\n this._logger.warnToConsole(\"Stop page visit timer failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n return PageVisitTimeManager;\r\n}());\r\nexport { PageVisitTimeManager };\r\nvar PageVisitData = /** @class */ (function () {\r\n function PageVisitData(pageName, pageUrl) {\r\n this.pageVisitStartTime = dateNow();\r\n this.pageName = pageName;\r\n this.pageUrl = pageUrl;\r\n }\r\n return PageVisitData;\r\n}());\r\nexport { PageVisitData };\r\n//# sourceMappingURL=PageVisitTimeManager.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"PageVisitTimeManager.js.map","sources":["PageVisitTimeManager.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from \"@microsoft/applicationinsights-common\";\r\nimport { hasJSON, getJSON, dateNow, dumpObj, throwError, _warnToConsole } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to track page visit durations\r\n */\r\nvar PageVisitTimeManager = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of PageVisitTimeManager\r\n * @param pageVisitTimeTrackingHandler Delegate that will be called to send telemetry data to AI (when trackPreviousPageVisit is called)\r\n * @returns {}\r\n */\r\n function PageVisitTimeManager(logger, pageVisitTimeTrackingHandler) {\r\n this.prevPageVisitDataKeyName = \"prevPageVisitData\";\r\n this.pageVisitTimeTrackingHandler = pageVisitTimeTrackingHandler;\r\n this._logger = logger;\r\n }\r\n /**\r\n * Tracks the previous page visit time telemetry (if exists) and starts timing of new page visit time\r\n * @param currentPageName Name of page to begin timing for visit duration\r\n * @param currentPageUrl Url of page to begin timing for visit duration\r\n */\r\n PageVisitTimeManager.prototype.trackPreviousPageVisit = function (currentPageName, currentPageUrl) {\r\n try {\r\n // Restart timer for new page view\r\n var prevPageVisitTimeData = this.restartPageVisitTimer(currentPageName, currentPageUrl);\r\n // If there was a page already being timed, track the visit time for it now.\r\n if (prevPageVisitTimeData) {\r\n this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);\r\n }\r\n }\r\n catch (e) {\r\n _warnToConsole(this._logger, \"Auto track page visit time failed, metric will not be collected: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page (if exists) and starts timing for duration of visit to pageName\r\n * @param pageName Name of page to begin timing visit duration\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from last call to start or restart, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.restartPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n var prevPageVisitData = this.stopPageVisitTimer();\r\n this.startPageVisitTimer(pageName, pageUrl);\r\n return prevPageVisitData;\r\n }\r\n catch (e) {\r\n _warnToConsole(this._logger, \"Call to restart failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n /**\r\n * Starts timing visit duration of pageName\r\n * @param pageName\r\n * @returns {}\r\n */\r\n PageVisitTimeManager.prototype.startPageVisitTimer = function (pageName, pageUrl) {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n if (utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName) != null) {\r\n throwError(\"Cannot call startPageVisit consecutively without first calling stopPageVisit\");\r\n }\r\n var currPageVisitData = new PageVisitData(pageName, pageUrl);\r\n var currPageVisitDataStr = getJSON().stringify(currPageVisitData);\r\n utlSetSessionStorage(this._logger, this.prevPageVisitDataKeyName, currPageVisitDataStr);\r\n }\r\n }\r\n catch (e) {\r\n // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out\r\n _warnToConsole(this._logger, \"Call to start failed: \" + dumpObj(e));\r\n }\r\n };\r\n /**\r\n * Stops timing of current page, if exists.\r\n * @returns {PageVisitData} Page visit data (including duration) of pageName from call to start, if exists. Null if not.\r\n */\r\n PageVisitTimeManager.prototype.stopPageVisitTimer = function () {\r\n try {\r\n if (utlCanUseSessionStorage()) {\r\n // Define end time of page's visit\r\n var pageVisitEndTime = dateNow();\r\n // Try to retrieve page name and start time from session storage\r\n var pageVisitDataJsonStr = utlGetSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n if (pageVisitDataJsonStr && hasJSON()) {\r\n // if previous page data exists, set end time of visit\r\n var prevPageVisitData = getJSON().parse(pageVisitDataJsonStr);\r\n prevPageVisitData.pageVisitTime = pageVisitEndTime - prevPageVisitData.pageVisitStartTime;\r\n // Remove data from storage since we already used it\r\n utlRemoveSessionStorage(this._logger, this.prevPageVisitDataKeyName);\r\n // Return page visit data\r\n return prevPageVisitData;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n return null;\r\n }\r\n catch (e) {\r\n _warnToConsole(this._logger, \"Stop page visit timer failed: \" + dumpObj(e));\r\n return null;\r\n }\r\n };\r\n return PageVisitTimeManager;\r\n}());\r\nexport { PageVisitTimeManager };\r\nvar PageVisitData = /** @class */ (function () {\r\n function PageVisitData(pageName, pageUrl) {\r\n this.pageVisitStartTime = dateNow();\r\n this.pageName = pageName;\r\n this.pageUrl = pageUrl;\r\n }\r\n return PageVisitData;\r\n}());\r\nexport { PageVisitData };\r\n//# sourceMappingURL=PageVisitTimeManager.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,11 +1,11 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
6
6
 
7
7
  import { dateTimeUtilsDuration } from "@microsoft/applicationinsights-common";
8
- import { LoggingSeverity, _InternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
8
+ import { _throwInternal } from "@microsoft/applicationinsights-core-js";
9
9
  /**
10
10
  * Used to record timed events and page views.
11
11
  */
@@ -15,14 +15,14 @@ var Timing = /** @class */ (function () {
15
15
  var _events = {};
16
16
  _self.start = function (name) {
17
17
  if (typeof _events[name] !== "undefined") {
18
- _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
18
+ _throwInternal(logger, 2 /* WARNING */, 62 /* StartCalledMoreThanOnce */, "start was called more than once for this event without calling stop.", { name: name, key: name }, true);
19
19
  }
20
20
  _events[name] = +new Date;
21
21
  };
22
22
  _self.stop = function (name, url, properties, measurements) {
23
23
  var start = _events[name];
24
24
  if (isNaN(start)) {
25
- _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.", { name: name, key: name }, true);
25
+ _throwInternal(logger, 2 /* WARNING */, 63 /* StopCalledWithoutStart */, "stop was called without a corresponding start.", { name: name, key: name }, true);
26
26
  }
27
27
  else {
28
28
  var end = +new Date;
@@ -1 +1 @@
1
- {"version":3,"file":"Timing.js.map","sources":["Timing.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { LoggingSeverity, _InternalMessageId, _throwInternal } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to record timed events and page views.\r\n */\r\nvar Timing = /** @class */ (function () {\r\n function Timing(logger, name) {\r\n var _self = this;\r\n var _events = {};\r\n _self.start = function (name) {\r\n if (typeof _events[name] !== \"undefined\") {\r\n _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, \"start was called more than once for this event without calling stop.\", { name: name, key: name }, true);\r\n }\r\n _events[name] = +new Date;\r\n };\r\n _self.stop = function (name, url, properties, measurements) {\r\n var start = _events[name];\r\n if (isNaN(start)) {\r\n _throwInternal(logger, LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, \"stop was called without a corresponding start.\", { name: name, key: name }, true);\r\n }\r\n else {\r\n var end = +new Date;\r\n var duration = dateTimeUtilsDuration(start, end);\r\n _self.action(name, url, duration, properties, measurements);\r\n }\r\n delete _events[name];\r\n _events[name] = undefined;\r\n };\r\n }\r\n return Timing;\r\n}());\r\nexport { Timing };\r\n//# sourceMappingURL=Timing.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"Timing.js.map","sources":["Timing.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal } from \"@microsoft/applicationinsights-core-js\";\r\n/**\r\n * Used to record timed events and page views.\r\n */\r\nvar Timing = /** @class */ (function () {\r\n function Timing(logger, name) {\r\n var _self = this;\r\n var _events = {};\r\n _self.start = function (name) {\r\n if (typeof _events[name] !== \"undefined\") {\r\n _throwInternal(logger, 2 /* WARNING */, 62 /* StartCalledMoreThanOnce */, \"start was called more than once for this event without calling stop.\", { name: name, key: name }, true);\r\n }\r\n _events[name] = +new Date;\r\n };\r\n _self.stop = function (name, url, properties, measurements) {\r\n var start = _events[name];\r\n if (isNaN(start)) {\r\n _throwInternal(logger, 2 /* WARNING */, 63 /* StopCalledWithoutStart */, \"stop was called without a corresponding start.\", { name: name, key: name }, true);\r\n }\r\n else {\r\n var end = +new Date;\r\n var duration = dateTimeUtilsDuration(start, end);\r\n _self.action(name, url, duration, properties, measurements);\r\n }\r\n delete _events[name];\r\n _events[name] = undefined;\r\n };\r\n }\r\n return Timing;\r\n}());\r\nexport { Timing };\r\n//# sourceMappingURL=Timing.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-04
2
+ * Application Insights JavaScript SDK - Web Analytics, 2.8.0-nightly.2204-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-analytics-js",
3
- "version": "2.8.0-nightly.2204-04",
3
+ "version": "2.8.0-nightly.2204-05",
4
4
  "description": "Microsoft Application Insights JavaScript SDK - Web Analytics",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -26,8 +26,8 @@
26
26
  "@microsoft/ai-test-framework": "0.0.1",
27
27
  "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
28
28
  "@microsoft/applicationinsights-rollup-es3": "1.1.3",
29
- "@microsoft/applicationinsights-properties-js": "2.8.0-nightly.2204-04",
30
- "@microsoft/applicationinsights-channel-js": "2.8.0-nightly.2204-04",
29
+ "@microsoft/applicationinsights-properties-js": "2.8.0-nightly.2204-05",
30
+ "@microsoft/applicationinsights-channel-js": "2.8.0-nightly.2204-05",
31
31
  "@microsoft/api-extractor": "^7.18.1",
32
32
  "typescript": "^4.3.4",
33
33
  "tslib": "^2.0.0",
@@ -53,8 +53,8 @@
53
53
  "dependencies": {
54
54
  "@microsoft/dynamicproto-js": "^1.1.4",
55
55
  "@microsoft/applicationinsights-shims": "2.0.1",
56
- "@microsoft/applicationinsights-core-js": "2.8.0-nightly.2204-04",
57
- "@microsoft/applicationinsights-common": "2.8.0-nightly.2204-04"
56
+ "@microsoft/applicationinsights-core-js": "2.8.0-nightly.2204-05",
57
+ "@microsoft/applicationinsights-common": "2.8.0-nightly.2204-05"
58
58
  },
59
59
  "license": "MIT",
60
60
  "publishConfig": {
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  IPlugin, IConfiguration, IAppInsightsCore,
17
17
  BaseTelemetryPlugin, ITelemetryItem, IProcessTelemetryContext, ITelemetryPluginChain,
18
- LoggingSeverity, _InternalMessageId, ICustomProperties,
18
+ eLoggingSeverity, _eInternalMessageId, ICustomProperties,
19
19
  getWindow, getDocument, getHistory, getLocation, objForEachKey,
20
20
  isString, isFunction, isNullOrUndefined, arrForEach, generateW3CId, dumpObj, getExceptionName, ICookieMgr, safeGetCookieMgr,
21
21
  TelemetryInitializerFunction, hasHistory, strUndefined, objDefineAccessors, InstrumentFunc, IInstrumentCallDetails, eventOn, eventOff,
@@ -109,7 +109,7 @@ function _updateStorageUsage(extConfig: IConfig) {
109
109
  }
110
110
 
111
111
  export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
112
- public static Version = "2.8.0-nightly.2204-04"; // Not currently used anywhere
112
+ public static Version = "2.8.0-nightly.2204-05"; // Not currently used anywhere
113
113
 
114
114
  public static getDefaultConfig = _getDefaultConfig;
115
115
 
@@ -172,8 +172,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
172
172
 
173
173
  _self.core.track(telemetryItem);
174
174
  } catch (e) {
175
- _throwInternal(LoggingSeverity.WARNING,
176
- _InternalMessageId.TrackTraceFailed,
175
+ _throwInternal(eLoggingSeverity.WARNING,
176
+ _eInternalMessageId.TrackTraceFailed,
177
177
  "trackTrace failed, trace will not be collected: " + getExceptionName(e),
178
178
  { exception: dumpObj(e) });
179
179
  }
@@ -187,8 +187,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
187
187
  try {
188
188
  _eventTracking.start(name);
189
189
  } catch (e) {
190
- _throwInternal(LoggingSeverity.CRITICAL,
191
- _InternalMessageId.StartTrackEventFailed,
190
+ _throwInternal(eLoggingSeverity.CRITICAL,
191
+ _eInternalMessageId.StartTrackEventFailed,
192
192
  "startTrackEvent failed, event will not be collected: " + getExceptionName(e),
193
193
  { exception: dumpObj(e) });
194
194
  }
@@ -204,8 +204,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
204
204
  try {
205
205
  _eventTracking.stop(name, undefined, properties); // Todo: Fix to pass measurements once type is updated
206
206
  } catch (e) {
207
- _throwInternal(LoggingSeverity.CRITICAL,
208
- _InternalMessageId.StopTrackEventFailed,
207
+ _throwInternal(eLoggingSeverity.CRITICAL,
208
+ _eInternalMessageId.StopTrackEventFailed,
209
209
  "stopTrackEvent failed, event will not be collected: " + getExceptionName(e),
210
210
  { exception: dumpObj(e) });
211
211
  }
@@ -228,8 +228,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
228
228
 
229
229
  _self.core.track(telemetryItem);
230
230
  } catch (e) {
231
- _throwInternal(LoggingSeverity.WARNING,
232
- _InternalMessageId.TrackTraceFailed,
231
+ _throwInternal(eLoggingSeverity.WARNING,
232
+ _eInternalMessageId.TrackTraceFailed,
233
233
  "trackTrace failed, trace will not be collected: " + getExceptionName(e),
234
234
  { exception: dumpObj(e) });
235
235
  }
@@ -258,8 +258,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
258
258
 
259
259
  _self.core.track(telemetryItem);
260
260
  } catch (e) {
261
- _throwInternal(LoggingSeverity.CRITICAL,
262
- _InternalMessageId.TrackMetricFailed,
261
+ _throwInternal(eLoggingSeverity.CRITICAL,
262
+ _eInternalMessageId.TrackMetricFailed,
263
263
  "trackMetric failed, metric will not be collected: " + getExceptionName(e),
264
264
  { exception: dumpObj(e) });
265
265
  }
@@ -281,8 +281,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
281
281
  }
282
282
  } catch (e) {
283
283
  _throwInternal(
284
- LoggingSeverity.CRITICAL,
285
- _InternalMessageId.TrackPVFailed,
284
+ eLoggingSeverity.CRITICAL,
285
+ _eInternalMessageId.TrackPVFailed,
286
286
  "trackPageView failed, page view will not be collected: " + getExceptionName(e),
287
287
  { exception: dumpObj(e) });
288
288
  }
@@ -343,8 +343,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
343
343
  _self.sendPageViewPerformanceInternal(inPvp, customProperties);
344
344
  } catch (e) {
345
345
  _throwInternal(
346
- LoggingSeverity.CRITICAL,
347
- _InternalMessageId.TrackPVFailed,
346
+ eLoggingSeverity.CRITICAL,
347
+ _eInternalMessageId.TrackPVFailed,
348
348
  "trackPageViewPerformance failed, page view will not be collected: " + getExceptionName(e),
349
349
  { exception: dumpObj(e) });
350
350
  }
@@ -366,8 +366,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
366
366
  _pageTracking.start(name);
367
367
  } catch (e) {
368
368
  _throwInternal(
369
- LoggingSeverity.CRITICAL,
370
- _InternalMessageId.StartTrackFailed,
369
+ eLoggingSeverity.CRITICAL,
370
+ _eInternalMessageId.StartTrackFailed,
371
371
  "startTrackPage failed, page view may not be collected: " + getExceptionName(e),
372
372
  { exception: dumpObj(e) });
373
373
  }
@@ -400,8 +400,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
400
400
  }
401
401
  } catch (e) {
402
402
  _throwInternal(
403
- LoggingSeverity.CRITICAL,
404
- _InternalMessageId.StopTrackFailed,
403
+ eLoggingSeverity.CRITICAL,
404
+ _eInternalMessageId.StopTrackFailed,
405
405
  "stopTrackPage failed, page view will not be collected: " + getExceptionName(e),
406
406
  { exception: dumpObj(e) });
407
407
  }
@@ -453,8 +453,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
453
453
  _self.sendExceptionInternal(exception, customProperties);
454
454
  } catch (e) {
455
455
  _throwInternal(
456
- LoggingSeverity.CRITICAL,
457
- _InternalMessageId.TrackExceptionFailed,
456
+ eLoggingSeverity.CRITICAL,
457
+ _eInternalMessageId.TrackExceptionFailed,
458
458
  "trackException failed, exception will not be collected: " + getExceptionName(e),
459
459
  { exception: dumpObj(e) });
460
460
  }
@@ -508,8 +508,8 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
508
508
  const errorString = error ? (error.name + ", " + error.message) : "null";
509
509
 
510
510
  _throwInternal(
511
- LoggingSeverity.CRITICAL,
512
- _InternalMessageId.ExceptionWhileLoggingError,
511
+ eLoggingSeverity.CRITICAL,
512
+ _eInternalMessageId.ExceptionWhileLoggingError,
513
513
  "_onError threw exception while logging error, error will not be collected: "
514
514
  + getExceptionName(e),
515
515
  { exception: dumpObj(e), errorString }
@@ -839,7 +839,7 @@ export class AnalyticsPlugin extends BaseTelemetryPlugin implements IAppInsights
839
839
  * @param severity {LoggingSeverity} - The severity of the log message
840
840
  * @param message {_InternalLogMessage} - The log message.
841
841
  */
842
- function _throwInternal(severity: LoggingSeverity, msgId: _InternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void {
842
+ function _throwInternal(severity: eLoggingSeverity, msgId: _eInternalMessageId, msg: string, properties?: Object, isUserAct?: boolean): void {
843
843
  _self.diagLog().throwInternal(severity, msgId, msg, properties, isUserAct);
844
844
  }
845
845
 
@@ -5,8 +5,8 @@ import {
5
5
  dateTimeUtilsDuration, IPageViewTelemetry, IPageViewTelemetryInternal, IPageViewPerformanceTelemetryInternal
6
6
  } from "@microsoft/applicationinsights-common";
7
7
  import {
8
- IAppInsightsCore, IDiagnosticLogger, LoggingSeverity,
9
- _InternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj, IProcessTelemetryUnloadContext, ITelemetryUnloadState
8
+ IAppInsightsCore, IDiagnosticLogger, eLoggingSeverity,
9
+ _eInternalMessageId, getDocument, getLocation, arrForEach, isNullOrUndefined, getExceptionName, dumpObj, IProcessTelemetryUnloadContext, ITelemetryUnloadState, _throwInternal
10
10
  } from "@microsoft/applicationinsights-core-js";
11
11
  import { PageViewPerformanceManager } from "./PageViewPerformanceManager";
12
12
  import dynamicProto from "@microsoft/dynamicproto-js";
@@ -100,9 +100,9 @@ export class PageViewManager {
100
100
  _flushChannels(true);
101
101
 
102
102
  // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)
103
- _logger.throwInternal(
104
- LoggingSeverity.WARNING,
105
- _InternalMessageId.NavigationTimingNotSupported,
103
+ _throwInternal(_logger,
104
+ eLoggingSeverity.WARNING,
105
+ _eInternalMessageId.NavigationTimingNotSupported,
106
106
  "trackPageView: navigation timing API used for calculation of page duration is not supported in this browser. This page view will be collected without duration and timing info.");
107
107
 
108
108
  return;
@@ -196,9 +196,9 @@ export class PageViewManager {
196
196
  }
197
197
  }
198
198
  } catch (e) {
199
- _logger.throwInternal(
200
- LoggingSeverity.CRITICAL,
201
- _InternalMessageId.TrackPVFailedCalc,
199
+ _throwInternal(_logger,
200
+ eLoggingSeverity.CRITICAL,
201
+ _eInternalMessageId.TrackPVFailedCalc,
202
202
  "trackPageView failed on page load calculation: " + getExceptionName(e),
203
203
  { exception: dumpObj(e) });
204
204
  }
@@ -5,8 +5,8 @@ import {
5
5
  IPageViewPerformanceTelemetryInternal, dateTimeUtilsDuration, msToTimeSpan
6
6
  } from "@microsoft/applicationinsights-common";
7
7
  import {
8
- IAppInsightsCore, IDiagnosticLogger, LoggingSeverity,
9
- _InternalMessageId, getNavigator, getPerformance
8
+ IAppInsightsCore, IDiagnosticLogger, eLoggingSeverity,
9
+ _eInternalMessageId, getNavigator, getPerformance, _throwInternal
10
10
  } from "@microsoft/applicationinsights-core-js";
11
11
 
12
12
  /**
@@ -74,26 +74,28 @@ export class PageViewPerformanceManager {
74
74
  dom = dateTimeUtilsDuration(timing.responseEnd, timing.loadEventEnd);
75
75
  }
76
76
 
77
+ let logger = this._logger;
78
+
77
79
  if (total === 0) {
78
- this._logger.throwInternal(
79
- LoggingSeverity.WARNING,
80
- _InternalMessageId.ErrorPVCalc,
80
+ _throwInternal(logger,
81
+ eLoggingSeverity.WARNING,
82
+ _eInternalMessageId.ErrorPVCalc,
81
83
  "error calculating page view performance.",
82
84
  { total, network, request, response, dom });
83
85
 
84
86
  } else if (!this.shouldCollectDuration(total, network, request, response, dom)) {
85
- this._logger.throwInternal(
86
- LoggingSeverity.WARNING,
87
- _InternalMessageId.InvalidDurationValue,
87
+ _throwInternal(logger,
88
+ eLoggingSeverity.WARNING,
89
+ _eInternalMessageId.InvalidDurationValue,
88
90
  "Invalid page load duration value. Browser perf data won't be sent.",
89
91
  { total, network, request, response, dom });
90
92
 
91
93
  } else if (total < Math.floor(network) + Math.floor(request) + Math.floor(response) + Math.floor(dom)) {
92
94
  // some browsers may report individual components incorrectly so that the sum of the parts will be bigger than total PLT
93
95
  // in this case, don't report client performance from this page
94
- this._logger.throwInternal(
95
- LoggingSeverity.WARNING,
96
- _InternalMessageId.ClientPerformanceMathError,
96
+ _throwInternal(logger,
97
+ eLoggingSeverity.WARNING,
98
+ _eInternalMessageId.ClientPerformanceMathError,
97
99
  "client performance math error.",
98
100
  { total, network, request, response, dom });
99
101
 
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import { utlCanUseSessionStorage, utlGetSessionStorage, utlRemoveSessionStorage, utlSetSessionStorage } from "@microsoft/applicationinsights-common";
5
- import { IDiagnosticLogger, hasJSON, getJSON, dateNow, dumpObj, throwError } from "@microsoft/applicationinsights-core-js";
5
+ import { IDiagnosticLogger, hasJSON, getJSON, dateNow, dumpObj, throwError, _warnToConsole } from "@microsoft/applicationinsights-core-js";
6
6
 
7
7
  /**
8
8
  * Used to track page visit durations
@@ -39,7 +39,7 @@ export class PageVisitTimeManager {
39
39
  this.pageVisitTimeTrackingHandler(prevPageVisitTimeData.pageName, prevPageVisitTimeData.pageUrl, prevPageVisitTimeData.pageVisitTime);
40
40
  }
41
41
  } catch (e) {
42
- this._logger.warnToConsole("Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
42
+ _warnToConsole(this._logger, "Auto track page visit time failed, metric will not be collected: " + dumpObj(e));
43
43
  }
44
44
  }
45
45
 
@@ -55,7 +55,7 @@ export class PageVisitTimeManager {
55
55
 
56
56
  return prevPageVisitData;
57
57
  } catch (e) {
58
- this._logger.warnToConsole("Call to restart failed: " + dumpObj(e));
58
+ _warnToConsole(this._logger, "Call to restart failed: " + dumpObj(e));
59
59
  return null;
60
60
  }
61
61
  }
@@ -78,7 +78,7 @@ export class PageVisitTimeManager {
78
78
  }
79
79
  } catch (e) {
80
80
  // TODO: Remove this catch in next phase, since if start is called twice in a row the exception needs to be propagated out
81
- this._logger.warnToConsole("Call to start failed: " + dumpObj(e));
81
+ _warnToConsole(this._logger, "Call to start failed: " + dumpObj(e));
82
82
  }
83
83
  }
84
84
 
@@ -113,7 +113,7 @@ export class PageVisitTimeManager {
113
113
  }
114
114
  return null;
115
115
  } catch (e) {
116
- this._logger.warnToConsole("Stop page visit timer failed: " + dumpObj(e));
116
+ _warnToConsole(this._logger, "Stop page visit timer failed: " + dumpObj(e));
117
117
  return null;
118
118
  }
119
119
  }
@@ -2,7 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import { dateTimeUtilsDuration } from "@microsoft/applicationinsights-common";
5
- import { IDiagnosticLogger, LoggingSeverity, _InternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
5
+ import { IDiagnosticLogger, eLoggingSeverity, _eInternalMessageId, _throwInternal } from "@microsoft/applicationinsights-core-js";
6
6
 
7
7
  /**
8
8
  * Used to record timed events and page views.
@@ -20,7 +20,7 @@ export class Timing {
20
20
  _self.start = (name: string) => {
21
21
  if (typeof _events[name] !== "undefined") {
22
22
  _throwInternal(logger,
23
- LoggingSeverity.WARNING, _InternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
23
+ eLoggingSeverity.WARNING, _eInternalMessageId.StartCalledMoreThanOnce, "start was called more than once for this event without calling stop.",
24
24
  { name, key: name }, true);
25
25
  }
26
26
 
@@ -31,7 +31,7 @@ export class Timing {
31
31
  const start = _events[name];
32
32
  if (isNaN(start)) {
33
33
  _throwInternal(logger,
34
- LoggingSeverity.WARNING, _InternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
34
+ eLoggingSeverity.WARNING, _eInternalMessageId.StopCalledWithoutStart, "stop was called without a corresponding start.",
35
35
  { name, key: name }, true);
36
36
  } else {
37
37
  const end = +new Date;