@microsoft/applicationinsights-analytics-js 3.4.0-nightlybeta3.2505-36 → 3.4.0-nightlybeta3.2507-23
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/es5/applicationinsights-analytics-js.cjs.js +471 -422
- package/browser/es5/applicationinsights-analytics-js.cjs.js.map +1 -1
- package/browser/es5/applicationinsights-analytics-js.cjs.min.js +2 -2
- package/browser/es5/applicationinsights-analytics-js.cjs.min.js.map +1 -1
- package/browser/es5/applicationinsights-analytics-js.gbl.js +473 -424
- package/browser/es5/applicationinsights-analytics-js.gbl.js.map +1 -1
- package/browser/es5/applicationinsights-analytics-js.gbl.min.js +2 -2
- package/browser/es5/applicationinsights-analytics-js.gbl.min.js.map +1 -1
- package/browser/es5/applicationinsights-analytics-js.integrity.json +25 -25
- package/browser/es5/applicationinsights-analytics-js.js +473 -424
- package/browser/es5/applicationinsights-analytics-js.js.map +1 -1
- package/browser/es5/applicationinsights-analytics-js.min.js +2 -2
- package/browser/es5/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist/es5/applicationinsights-analytics-js.js +471 -422
- package/dist/es5/applicationinsights-analytics-js.js.map +1 -1
- package/dist/es5/applicationinsights-analytics-js.min.js +2 -2
- package/dist/es5/applicationinsights-analytics-js.min.js.map +1 -1
- package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js +40 -41
- package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js.map +1 -1
- package/dist-es5/JavaScriptSDK/Interfaces/IAnalyticsConfig.js +8 -0
- package/dist-es5/JavaScriptSDK/Interfaces/IAnalyticsConfig.js.map +1 -0
- package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js +175 -178
- package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
- package/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +86 -96
- package/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js.map +1 -1
- package/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +85 -92
- package/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js.map +1 -1
- package/dist-es5/JavaScriptSDK/Timing.js +18 -15
- package/dist-es5/JavaScriptSDK/Timing.js.map +1 -1
- package/dist-es5/__DynamicConstants.js +7 -4
- package/dist-es5/__DynamicConstants.js.map +1 -1
- package/dist-es5/applicationinsights-analytics-js.js +1 -1
- package/package.json +5 -5
- package/types/applicationinsights-analytics-js.d.ts +100 -1
- package/types/applicationinsights-analytics-js.namespaced.d.ts +381 -14
|
@@ -1,207 +1,204 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Web Analytics, 3.4.0-nightlybeta3.
|
|
2
|
+
* Application Insights JavaScript SDK - Web Analytics, 3.4.0-nightlybeta3.2507-23
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
8
7
|
import { dateTimeUtilsDuration } from "@microsoft/applicationinsights-common";
|
|
9
|
-
import { _throwInternal, arrForEach, dumpObj, getDocument, getExceptionName, getLocation, isNullOrUndefined } from "@microsoft/applicationinsights-core-js";
|
|
8
|
+
import { _throwInternal, arrForEach, dumpObj, fieldRedaction, getDocument, getExceptionName, getLocation, isNullOrUndefined } from "@microsoft/applicationinsights-core-js";
|
|
10
9
|
import { getPerformance, isUndefined, isWebWorker, scheduleTimeout } from "@nevware21/ts-utils";
|
|
11
|
-
import { _DYN_DURATION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_GET_PERFORMANCE_TIMI16, _DYN_HREF, _DYN_IS_PERFORMANCE_TIMIN15, _DYN_IS_PERFORMANCE_TIMIN18, _DYN_LENGTH, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_PROPERTIES, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_SHOULD_COLLECT_DURAT17, _DYN_START_TIME
|
|
10
|
+
import { _DYN_CONFIG, _DYN_DURATION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_GET_PERFORMANCE_TIMI16, _DYN_HREF, _DYN_IS_PERFORMANCE_TIMIN15, _DYN_IS_PERFORMANCE_TIMIN18, _DYN_LENGTH, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_PROPERTIES, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_SHOULD_COLLECT_DURAT17, _DYN_START_TIME } from "../../__DynamicConstants";
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* Factory function to create a PageViewManager instance.
|
|
13
|
+
* @param appInsights - Internal interface to send telemetry
|
|
14
|
+
* @param overridePageViewDuration - Whether to override page view duration
|
|
15
|
+
* @param core - App Insights core instance
|
|
16
|
+
* @param pageViewPerformanceManager - Page view performance manager instance
|
|
17
|
+
* @returns A new IPageViewManager instance.
|
|
18
|
+
* @internal
|
|
14
19
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
export function createPageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {
|
|
21
|
+
var queueTimer = null;
|
|
22
|
+
var itemQueue = [];
|
|
23
|
+
var pageViewPerformanceSent = false;
|
|
24
|
+
var firstPageViewSent = false;
|
|
25
|
+
var _logger;
|
|
26
|
+
if (core) {
|
|
27
|
+
_logger = core.logger;
|
|
28
|
+
}
|
|
29
|
+
function _flushChannels(isAsync) {
|
|
30
|
+
if (core) {
|
|
31
|
+
core.flush(isAsync, function () {
|
|
32
|
+
// Event flushed, callback added to prevent promise creation
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function _startTimer() {
|
|
37
|
+
if (!queueTimer) {
|
|
38
|
+
queueTimer = scheduleTimeout((function () {
|
|
39
|
+
queueTimer = null;
|
|
40
|
+
var allItems = itemQueue.slice(0);
|
|
41
|
+
var doFlush = false;
|
|
42
|
+
itemQueue = [];
|
|
43
|
+
arrForEach(allItems, function (item) {
|
|
44
|
+
if (!item()) {
|
|
45
|
+
// Not processed so rescheduled
|
|
46
|
+
itemQueue.push(item);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
doFlush = true;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (itemQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
53
|
+
_startTimer();
|
|
31
54
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
queueTimer = scheduleTimeout((function () {
|
|
36
|
-
queueTimer = null;
|
|
37
|
-
var allItems = itemQueue.slice(0);
|
|
38
|
-
var doFlush = false;
|
|
39
|
-
itemQueue = [];
|
|
40
|
-
arrForEach(allItems, function (item) {
|
|
41
|
-
if (!item()) {
|
|
42
|
-
// Not processed so rescheduled
|
|
43
|
-
itemQueue.push(item);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
doFlush = true;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (itemQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
50
|
-
_startTimer();
|
|
51
|
-
}
|
|
52
|
-
if (doFlush) {
|
|
53
|
-
// We process at least one item so flush the queue
|
|
54
|
-
_flushChannels(true);
|
|
55
|
-
}
|
|
56
|
-
}), 100);
|
|
55
|
+
if (doFlush) {
|
|
56
|
+
// We process at least one item so flush the queue
|
|
57
|
+
_flushChannels(true);
|
|
57
58
|
}
|
|
59
|
+
}), 100);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function _addQueue(cb) {
|
|
63
|
+
itemQueue.push(cb);
|
|
64
|
+
_startTimer();
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
trackPageView: function (pageView, customProperties) {
|
|
68
|
+
var name = pageView.name;
|
|
69
|
+
if (isNullOrUndefined(name) || typeof name !== "string") {
|
|
70
|
+
var doc = getDocument();
|
|
71
|
+
name = pageView.name = doc && doc.title || "";
|
|
72
|
+
}
|
|
73
|
+
var uri = pageView.uri;
|
|
74
|
+
if (isNullOrUndefined(uri) || typeof uri !== "string") {
|
|
75
|
+
var location_1 = getLocation();
|
|
76
|
+
uri = pageView.uri = location_1 && location_1[_DYN_HREF /* @min:%2ehref */] || "";
|
|
58
77
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_startTimer();
|
|
78
|
+
if (core && core[_DYN_CONFIG /* @min:%2econfig */]) {
|
|
79
|
+
uri = pageView.uri = fieldRedaction(pageView.uri, core[_DYN_CONFIG /* @min:%2econfig */]);
|
|
62
80
|
}
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
81
|
+
if (!firstPageViewSent) {
|
|
82
|
+
var perf = getPerformance();
|
|
83
|
+
// Access the performance timing object
|
|
84
|
+
var navigationEntries = (perf && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */] && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */]("navigation"));
|
|
85
|
+
// Edge Case the navigation Entries may return an empty array and the timeOrigin is not supported on IE
|
|
86
|
+
if (navigationEntries && navigationEntries[0] && !isUndefined(perf.timeOrigin)) {
|
|
87
|
+
// Get the value of loadEventStart
|
|
88
|
+
var loadEventStart = navigationEntries[0].loadEventStart;
|
|
89
|
+
pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(perf.timeOrigin + loadEventStart);
|
|
68
90
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
var
|
|
72
|
-
|
|
91
|
+
else {
|
|
92
|
+
// calculate the start time manually
|
|
93
|
+
var duration_1 = ((customProperties || pageView[_DYN_PROPERTIES /* @min:%2eproperties */] || {})[_DYN_DURATION /* @min:%2eduration */] || 0);
|
|
94
|
+
pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(new Date().getTime() - duration_1);
|
|
73
95
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// calculate the start time manually
|
|
86
|
-
var duration_1 = ((customProperties || pageView[_DYN_PROPERTIES /* @min:%2eproperties */] || {})[_DYN_DURATION /* @min:%2eduration */] || 0);
|
|
87
|
-
pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(new Date().getTime() - duration_1);
|
|
88
|
-
}
|
|
89
|
-
firstPageViewSent = true;
|
|
96
|
+
firstPageViewSent = true;
|
|
97
|
+
}
|
|
98
|
+
// case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user
|
|
99
|
+
// do not provide the duration, set duration to undefined
|
|
100
|
+
// Also this is case 4
|
|
101
|
+
if (!pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN15 /* @min:%2eisPerformanceTimingSupported */]()) {
|
|
102
|
+
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
103
|
+
_flushChannels(true);
|
|
104
|
+
if (!isWebWorker()) {
|
|
105
|
+
// no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)
|
|
106
|
+
_throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 25 /* _eInternalMessageId.NavigationTimingNotSupported */, "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.");
|
|
90
107
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
var pageViewSent = false;
|
|
111
|
+
var customDuration;
|
|
112
|
+
// if the performance timing is supported by the browser, calculate the custom duration
|
|
113
|
+
var start = pageViewPerformanceManager[_DYN_GET_PERFORMANCE_TIMI16 /* @min:%2egetPerformanceTiming */]()[_DYN_NAVIGATION_START /* @min:%2enavigationStart */];
|
|
114
|
+
if (start > 0) {
|
|
115
|
+
customDuration = dateTimeUtilsDuration(start, +new Date);
|
|
116
|
+
if (!pageViewPerformanceManager[_DYN_SHOULD_COLLECT_DURAT17 /* @min:%2eshouldCollectDuration */](customDuration)) {
|
|
117
|
+
customDuration = undefined;
|
|
102
118
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
119
|
+
}
|
|
120
|
+
// if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if
|
|
121
|
+
// overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier
|
|
122
|
+
var duration;
|
|
123
|
+
if (!isNullOrUndefined(customProperties) &&
|
|
124
|
+
!isNullOrUndefined(customProperties[_DYN_DURATION /* @min:%2eduration */])) {
|
|
125
|
+
duration = customProperties[_DYN_DURATION /* @min:%2eduration */];
|
|
126
|
+
}
|
|
127
|
+
if (overridePageViewDuration || !isNaN(duration)) {
|
|
128
|
+
if (isNaN(duration)) {
|
|
129
|
+
// case 3
|
|
130
|
+
if (!customProperties) {
|
|
131
|
+
customProperties = {};
|
|
111
132
|
}
|
|
133
|
+
customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;
|
|
112
134
|
}
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
// case 2
|
|
136
|
+
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
137
|
+
_flushChannels(true);
|
|
138
|
+
pageViewSent = true;
|
|
139
|
+
}
|
|
140
|
+
// now try to send the page view performance telemetry
|
|
141
|
+
var maxDurationLimit = 60000;
|
|
142
|
+
if (!customProperties) {
|
|
143
|
+
customProperties = {};
|
|
144
|
+
}
|
|
145
|
+
// Queue the event for processing
|
|
146
|
+
_addQueue(function () {
|
|
147
|
+
var processed = false;
|
|
148
|
+
try {
|
|
149
|
+
if (pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN18 /* @min:%2eisPerformanceTimingDataReady */]()) {
|
|
150
|
+
processed = true;
|
|
151
|
+
var pageViewPerformance = {
|
|
152
|
+
name: name,
|
|
153
|
+
uri: uri
|
|
154
|
+
};
|
|
155
|
+
pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](pageViewPerformance);
|
|
156
|
+
if (!pageViewPerformance.isValid && !pageViewSent) {
|
|
157
|
+
// If navigation timing gives invalid numbers, then go back to "override page view duration" mode.
|
|
158
|
+
// That's the best value we can get that makes sense.
|
|
159
|
+
customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;
|
|
160
|
+
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
125
161
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
130
|
-
_flushChannels(true);
|
|
131
|
-
pageViewSent = true;
|
|
132
|
-
}
|
|
133
|
-
// now try to send the page view performance telemetry
|
|
134
|
-
var maxDurationLimit = 60000;
|
|
135
|
-
if (!customProperties) {
|
|
136
|
-
customProperties = {};
|
|
137
|
-
}
|
|
138
|
-
// Queue the event for processing
|
|
139
|
-
_addQueue(function () {
|
|
140
|
-
var processed = false;
|
|
141
|
-
try {
|
|
142
|
-
if (pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN18 /* @min:%2eisPerformanceTimingDataReady */]()) {
|
|
143
|
-
processed = true;
|
|
144
|
-
var pageViewPerformance = {
|
|
145
|
-
name: name,
|
|
146
|
-
uri: uri
|
|
147
|
-
};
|
|
148
|
-
pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](pageViewPerformance);
|
|
149
|
-
if (!pageViewPerformance.isValid && !pageViewSent) {
|
|
150
|
-
// If navigation timing gives invalid numbers, then go back to "override page view duration" mode.
|
|
151
|
-
// That's the best value we can get that makes sense.
|
|
152
|
-
customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;
|
|
162
|
+
else {
|
|
163
|
+
if (!pageViewSent) {
|
|
164
|
+
customProperties[_DYN_DURATION /* @min:%2eduration */] = pageViewPerformance.durationMs;
|
|
153
165
|
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
159
|
-
}
|
|
160
|
-
if (!pageViewPerformanceSent) {
|
|
161
|
-
appInsights[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](pageViewPerformance, customProperties);
|
|
162
|
-
pageViewPerformanceSent = true;
|
|
163
|
-
}
|
|
167
|
+
if (!pageViewPerformanceSent) {
|
|
168
|
+
appInsights[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](pageViewPerformance, customProperties);
|
|
169
|
+
pageViewPerformanceSent = true;
|
|
164
170
|
}
|
|
165
171
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
}
|
|
173
|
+
else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {
|
|
174
|
+
// if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry
|
|
175
|
+
// with the maximum duration limit. Otherwise, keep waiting until performance timings are ready
|
|
176
|
+
processed = true;
|
|
177
|
+
if (!pageViewSent) {
|
|
178
|
+
customProperties[_DYN_DURATION /* @min:%2eduration */] = maxDurationLimit;
|
|
179
|
+
appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
|
-
|
|
177
|
-
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
_throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 38 /* _eInternalMessageId.TrackPVFailedCalc */, "trackPageView failed on page load calculation: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
185
|
+
}
|
|
186
|
+
return processed;
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
teardown: function (unloadCtx, unloadState) {
|
|
190
|
+
if (queueTimer) {
|
|
191
|
+
queueTimer.cancel();
|
|
192
|
+
queueTimer = null;
|
|
193
|
+
var allItems = itemQueue.slice(0);
|
|
194
|
+
itemQueue = [];
|
|
195
|
+
arrForEach(allItems, function (item) {
|
|
196
|
+
if (item()) {
|
|
197
|
+
// Item processed successfully
|
|
178
198
|
}
|
|
179
|
-
return processed;
|
|
180
199
|
});
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
queueTimer = null;
|
|
186
|
-
var allItems = itemQueue.slice(0);
|
|
187
|
-
var doFlush_1 = false;
|
|
188
|
-
itemQueue = [];
|
|
189
|
-
arrForEach(allItems, function (item) {
|
|
190
|
-
if (item()) {
|
|
191
|
-
doFlush_1 = true;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
// Removed Stub for PageViewManager.prototype.trackPageView.
|
|
199
|
-
// Removed Stub for PageViewManager.prototype.teardown.
|
|
200
|
-
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
|
201
|
-
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
|
202
|
-
PageViewManager.__ieDyn=1;
|
|
203
|
-
|
|
204
|
-
return PageViewManager;
|
|
205
|
-
}());
|
|
206
|
-
export { PageViewManager };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
207
204
|
//# sourceMappingURL=PageViewManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageViewManager.js.map","sources":["PageViewManager.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { dateTimeUtilsDuration } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal, arrForEach, dumpObj, getDocument, getExceptionName, getLocation, isNullOrUndefined } from \"@microsoft/applicationinsights-core-js\";\r\nimport { getPerformance, isUndefined, isWebWorker, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_DURATION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_GET_PERFORMANCE_TIMI16, _DYN_HREF, _DYN_IS_PERFORMANCE_TIMIN15, _DYN_IS_PERFORMANCE_TIMIN18, _DYN_LENGTH, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_PROPERTIES, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_SHOULD_COLLECT_DURAT17, _DYN_START_TIME, _DYN_TRACK_PAGE_VIEW } from \"../../__DynamicConstants\";\r\n/**\r\n * Class encapsulates sending page views and page view performance telemetry.\r\n */\r\nvar PageViewManager = /** @class */ (function () {\r\n function PageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {\r\n dynamicProto(PageViewManager, this, function (_self) {\r\n var queueTimer = null;\r\n var itemQueue = [];\r\n var pageViewPerformanceSent = false;\r\n var firstPageViewSent = false;\r\n var _logger;\r\n if (core) {\r\n _logger = core.logger;\r\n }\r\n function _flushChannels(isAsync) {\r\n if (core) {\r\n core.flush(isAsync, function () {\r\n // Event flushed, callback added to prevent promise creation\r\n });\r\n }\r\n }\r\n function _startTimer() {\r\n if (!queueTimer) {\r\n queueTimer = scheduleTimeout((function () {\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n var doFlush = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (!item()) {\r\n // Not processed so rescheduled\r\n itemQueue.push(item);\r\n }\r\n else {\r\n doFlush = true;\r\n }\r\n });\r\n if (itemQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _startTimer();\r\n }\r\n if (doFlush) {\r\n // We process at least one item so flush the queue\r\n _flushChannels(true);\r\n }\r\n }), 100);\r\n }\r\n }\r\n function _addQueue(cb) {\r\n itemQueue.push(cb);\r\n _startTimer();\r\n }\r\n _self[_DYN_TRACK_PAGE_VIEW /* @min:%2etrackPageView */] = function (pageView, customProperties) {\r\n var name = pageView.name;\r\n if (isNullOrUndefined(name) || typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = pageView.name = doc && doc.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n var location_1 = getLocation();\r\n uri = pageView.uri = location_1 && location_1[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n if (!firstPageViewSent) {\r\n var perf = getPerformance();\r\n // Access the performance timing object\r\n var navigationEntries = (perf && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */] && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */](\"navigation\"));\r\n // Edge Case the navigation Entries may return an empty array and the timeOrigin is not supported on IE\r\n if (navigationEntries && navigationEntries[0] && !isUndefined(perf.timeOrigin)) {\r\n // Get the value of loadEventStart\r\n var loadEventStart = navigationEntries[0].loadEventStart;\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(perf.timeOrigin + loadEventStart);\r\n }\r\n else {\r\n // calculate the start time manually\r\n var duration_1 = ((customProperties || pageView[_DYN_PROPERTIES /* @min:%2eproperties */] || {})[_DYN_DURATION /* @min:%2eduration */] || 0);\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(new Date().getTime() - duration_1);\r\n }\r\n firstPageViewSent = true;\r\n }\r\n // case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user\r\n // do not provide the duration, set duration to undefined\r\n // Also this is case 4\r\n if (!pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN15 /* @min:%2eisPerformanceTimingSupported */]()) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n if (!isWebWorker()) {\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 25 /* _eInternalMessageId.NavigationTimingNotSupported */, \"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.\");\r\n }\r\n return;\r\n }\r\n var pageViewSent = false;\r\n var customDuration;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = pageViewPerformanceManager[_DYN_GET_PERFORMANCE_TIMI16 /* @min:%2egetPerformanceTiming */]()[_DYN_NAVIGATION_START /* @min:%2enavigationStart */];\r\n if (start > 0) {\r\n customDuration = dateTimeUtilsDuration(start, +new Date);\r\n if (!pageViewPerformanceManager[_DYN_SHOULD_COLLECT_DURAT17 /* @min:%2eshouldCollectDuration */](customDuration)) {\r\n customDuration = undefined;\r\n }\r\n }\r\n // if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if\r\n // overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier\r\n var duration;\r\n if (!isNullOrUndefined(customProperties) &&\r\n !isNullOrUndefined(customProperties[_DYN_DURATION /* @min:%2eduration */])) {\r\n duration = customProperties[_DYN_DURATION /* @min:%2eduration */];\r\n }\r\n if (overridePageViewDuration || !isNaN(duration)) {\r\n if (isNaN(duration)) {\r\n // case 3\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n }\r\n // case 2\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n pageViewSent = true;\r\n }\r\n // now try to send the page view performance telemetry\r\n var maxDurationLimit = 60000;\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n // Queue the event for processing\r\n _addQueue(function () {\r\n var processed = false;\r\n try {\r\n if (pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN18 /* @min:%2eisPerformanceTimingDataReady */]()) {\r\n processed = true;\r\n var pageViewPerformance = {\r\n name: name,\r\n uri: uri\r\n };\r\n pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](pageViewPerformance);\r\n if (!pageViewPerformance.isValid && !pageViewSent) {\r\n // If navigation timing gives invalid numbers, then go back to \"override page view duration\" mode.\r\n // That's the best value we can get that makes sense.\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = pageViewPerformance.durationMs;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n if (!pageViewPerformanceSent) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](pageViewPerformance, customProperties);\r\n pageViewPerformanceSent = true;\r\n }\r\n }\r\n }\r\n else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {\r\n // if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry\r\n // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready\r\n processed = true;\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = maxDurationLimit;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 38 /* _eInternalMessageId.TrackPVFailedCalc */, \"trackPageView failed on page load calculation: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n return processed;\r\n });\r\n };\r\n _self.teardown = function (unloadCtx, unloadState) {\r\n if (queueTimer) {\r\n queueTimer.cancel();\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n var doFlush_1 = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (item()) {\r\n doFlush_1 = true;\r\n }\r\n });\r\n }\r\n };\r\n });\r\n }\r\n /**\r\n * Currently supported cases:\r\n * 1) (default case) track page view called with default parameters, overridePageViewDuration = false. Page view is sent with page view performance when navigation timing data is available.\r\n * a. If navigation timing is not supported then page view is sent right away with undefined duration. Page view performance is not sent.\r\n * 2) overridePageViewDuration = true, custom duration provided. Custom duration is used, page view sends right away.\r\n * 3) overridePageViewDuration = true, custom duration NOT provided. Page view is sent right away, duration is time spent from page load till now (or undefined if navigation timing is not supported).\r\n * 4) overridePageViewDuration = false, custom duration is provided. Page view is sent right away with custom duration.\r\n *\r\n * In all cases page view performance is sent once (only for the 1st call of trackPageView), or not sent if navigation timing is not supported.\r\n */\r\n PageViewManager.prototype.trackPageView = function (pageView, customProperties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n PageViewManager.prototype.teardown = function (unloadCtx, unloadState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return PageViewManager;\r\n}());\r\nexport { PageViewManager };\r\n//# sourceMappingURL=PageViewManager.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;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;uDAeM,CAAC;;;;;2BACoB;AAC3B;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"PageViewManager.js.map","sources":["PageViewManager.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, arrForEach, dumpObj, fieldRedaction, getDocument, getExceptionName, getLocation, isNullOrUndefined } from \"@microsoft/applicationinsights-core-js\";\r\nimport { getPerformance, isUndefined, isWebWorker, scheduleTimeout } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CONFIG, _DYN_DURATION, _DYN_GET_ENTRIES_BY_TYPE, _DYN_GET_PERFORMANCE_TIMI16, _DYN_HREF, _DYN_IS_PERFORMANCE_TIMIN15, _DYN_IS_PERFORMANCE_TIMIN18, _DYN_LENGTH, _DYN_NAVIGATION_START, _DYN_POPULATE_PAGE_VIEW_P4, _DYN_PROPERTIES, _DYN_SEND_PAGE_VIEW_INTER2, _DYN_SEND_PAGE_VIEW_PERFO3, _DYN_SHOULD_COLLECT_DURAT17, _DYN_START_TIME } from \"../../__DynamicConstants\";\r\n/**\r\n * Factory function to create a PageViewManager instance.\r\n * @param appInsights - Internal interface to send telemetry\r\n * @param overridePageViewDuration - Whether to override page view duration\r\n * @param core - App Insights core instance\r\n * @param pageViewPerformanceManager - Page view performance manager instance\r\n * @returns A new IPageViewManager instance.\r\n * @internal\r\n */\r\nexport function createPageViewManager(appInsights, overridePageViewDuration, core, pageViewPerformanceManager) {\r\n var queueTimer = null;\r\n var itemQueue = [];\r\n var pageViewPerformanceSent = false;\r\n var firstPageViewSent = false;\r\n var _logger;\r\n if (core) {\r\n _logger = core.logger;\r\n }\r\n function _flushChannels(isAsync) {\r\n if (core) {\r\n core.flush(isAsync, function () {\r\n // Event flushed, callback added to prevent promise creation\r\n });\r\n }\r\n }\r\n function _startTimer() {\r\n if (!queueTimer) {\r\n queueTimer = scheduleTimeout((function () {\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n var doFlush = false;\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (!item()) {\r\n // Not processed so rescheduled\r\n itemQueue.push(item);\r\n }\r\n else {\r\n doFlush = true;\r\n }\r\n });\r\n if (itemQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {\r\n _startTimer();\r\n }\r\n if (doFlush) {\r\n // We process at least one item so flush the queue\r\n _flushChannels(true);\r\n }\r\n }), 100);\r\n }\r\n }\r\n function _addQueue(cb) {\r\n itemQueue.push(cb);\r\n _startTimer();\r\n }\r\n return {\r\n trackPageView: function (pageView, customProperties) {\r\n var name = pageView.name;\r\n if (isNullOrUndefined(name) || typeof name !== \"string\") {\r\n var doc = getDocument();\r\n name = pageView.name = doc && doc.title || \"\";\r\n }\r\n var uri = pageView.uri;\r\n if (isNullOrUndefined(uri) || typeof uri !== \"string\") {\r\n var location_1 = getLocation();\r\n uri = pageView.uri = location_1 && location_1[_DYN_HREF /* @min:%2ehref */] || \"\";\r\n }\r\n if (core && core[_DYN_CONFIG /* @min:%2econfig */]) {\r\n uri = pageView.uri = fieldRedaction(pageView.uri, core[_DYN_CONFIG /* @min:%2econfig */]);\r\n }\r\n if (!firstPageViewSent) {\r\n var perf = getPerformance();\r\n // Access the performance timing object\r\n var navigationEntries = (perf && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */] && perf[_DYN_GET_ENTRIES_BY_TYPE /* @min:%2egetEntriesByType */](\"navigation\"));\r\n // Edge Case the navigation Entries may return an empty array and the timeOrigin is not supported on IE\r\n if (navigationEntries && navigationEntries[0] && !isUndefined(perf.timeOrigin)) {\r\n // Get the value of loadEventStart\r\n var loadEventStart = navigationEntries[0].loadEventStart;\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(perf.timeOrigin + loadEventStart);\r\n }\r\n else {\r\n // calculate the start time manually\r\n var duration_1 = ((customProperties || pageView[_DYN_PROPERTIES /* @min:%2eproperties */] || {})[_DYN_DURATION /* @min:%2eduration */] || 0);\r\n pageView[_DYN_START_TIME /* @min:%2estartTime */] = new Date(new Date().getTime() - duration_1);\r\n }\r\n firstPageViewSent = true;\r\n }\r\n // case 1a. if performance timing is not supported by the browser, send the page view telemetry with the duration provided by the user. If the user\r\n // do not provide the duration, set duration to undefined\r\n // Also this is case 4\r\n if (!pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN15 /* @min:%2eisPerformanceTimingSupported */]()) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n if (!isWebWorker()) {\r\n // no navigation timing (IE 8, iOS Safari 8.4, Opera Mini 8 - see http://caniuse.com/#feat=nav-timing)\r\n _throwInternal(_logger, 2 /* eLoggingSeverity.WARNING */, 25 /* _eInternalMessageId.NavigationTimingNotSupported */, \"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.\");\r\n }\r\n return;\r\n }\r\n var pageViewSent = false;\r\n var customDuration;\r\n // if the performance timing is supported by the browser, calculate the custom duration\r\n var start = pageViewPerformanceManager[_DYN_GET_PERFORMANCE_TIMI16 /* @min:%2egetPerformanceTiming */]()[_DYN_NAVIGATION_START /* @min:%2enavigationStart */];\r\n if (start > 0) {\r\n customDuration = dateTimeUtilsDuration(start, +new Date);\r\n if (!pageViewPerformanceManager[_DYN_SHOULD_COLLECT_DURAT17 /* @min:%2eshouldCollectDuration */](customDuration)) {\r\n customDuration = undefined;\r\n }\r\n }\r\n // if the user has provided duration, send a page view telemetry with the provided duration. Otherwise, if\r\n // overridePageViewDuration is set to true, send a page view telemetry with the custom duration calculated earlier\r\n var duration;\r\n if (!isNullOrUndefined(customProperties) &&\r\n !isNullOrUndefined(customProperties[_DYN_DURATION /* @min:%2eduration */])) {\r\n duration = customProperties[_DYN_DURATION /* @min:%2eduration */];\r\n }\r\n if (overridePageViewDuration || !isNaN(duration)) {\r\n if (isNaN(duration)) {\r\n // case 3\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n }\r\n // case 2\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n _flushChannels(true);\r\n pageViewSent = true;\r\n }\r\n // now try to send the page view performance telemetry\r\n var maxDurationLimit = 60000;\r\n if (!customProperties) {\r\n customProperties = {};\r\n }\r\n // Queue the event for processing\r\n _addQueue(function () {\r\n var processed = false;\r\n try {\r\n if (pageViewPerformanceManager[_DYN_IS_PERFORMANCE_TIMIN18 /* @min:%2eisPerformanceTimingDataReady */]()) {\r\n processed = true;\r\n var pageViewPerformance = {\r\n name: name,\r\n uri: uri\r\n };\r\n pageViewPerformanceManager[_DYN_POPULATE_PAGE_VIEW_P4 /* @min:%2epopulatePageViewPerformanceEvent */](pageViewPerformance);\r\n if (!pageViewPerformance.isValid && !pageViewSent) {\r\n // If navigation timing gives invalid numbers, then go back to \"override page view duration\" mode.\r\n // That's the best value we can get that makes sense.\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = customDuration;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n else {\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = pageViewPerformance.durationMs;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n if (!pageViewPerformanceSent) {\r\n appInsights[_DYN_SEND_PAGE_VIEW_PERFO3 /* @min:%2esendPageViewPerformanceInternal */](pageViewPerformance, customProperties);\r\n pageViewPerformanceSent = true;\r\n }\r\n }\r\n }\r\n else if (start > 0 && dateTimeUtilsDuration(start, +new Date) > maxDurationLimit) {\r\n // if performance timings are not ready but we exceeded the maximum duration limit, just log a page view telemetry\r\n // with the maximum duration limit. Otherwise, keep waiting until performance timings are ready\r\n processed = true;\r\n if (!pageViewSent) {\r\n customProperties[_DYN_DURATION /* @min:%2eduration */] = maxDurationLimit;\r\n appInsights[_DYN_SEND_PAGE_VIEW_INTER2 /* @min:%2esendPageViewInternal */](pageView, customProperties);\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_logger, 1 /* eLoggingSeverity.CRITICAL */, 38 /* _eInternalMessageId.TrackPVFailedCalc */, \"trackPageView failed on page load calculation: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n return processed;\r\n });\r\n },\r\n teardown: function (unloadCtx, unloadState) {\r\n if (queueTimer) {\r\n queueTimer.cancel();\r\n queueTimer = null;\r\n var allItems = itemQueue.slice(0);\r\n itemQueue = [];\r\n arrForEach(allItems, function (item) {\r\n if (item()) {\r\n // Item processed successfully\r\n }\r\n });\r\n }\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=PageViewManager.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;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"}
|