@microsoft/1ds-post-js 4.0.0 → 4.0.2-nightly3.2307-24
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/README.md +10 -26
- package/bundle/es5/{ms.post-4.0.0.gbl.js → ms.post-4.0.2-nightly3.2307-24.gbl.js} +707 -524
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.min.js +7 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.gbl.min.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.integrity.json +46 -0
- package/bundle/es5/{ms.post-4.0.0.js → ms.post-4.0.2-nightly3.2307-24.js} +707 -524
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.js.map +1 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.min.js +7 -0
- package/bundle/es5/ms.post-4.0.2-nightly3.2307-24.min.js.map +1 -0
- package/bundle/es5/ms.post.gbl.js +706 -523
- package/bundle/es5/ms.post.gbl.js.map +1 -1
- package/bundle/es5/ms.post.gbl.min.js +2 -2
- package/bundle/es5/ms.post.gbl.min.js.map +1 -1
- package/bundle/es5/ms.post.integrity.json +17 -17
- package/bundle/es5/ms.post.js +706 -523
- package/bundle/es5/ms.post.js.map +1 -1
- package/bundle/es5/ms.post.min.js +2 -2
- package/bundle/es5/ms.post.min.js.map +1 -1
- package/dist/es5/ms.post.js +704 -521
- package/dist/es5/ms.post.js.map +1 -1
- package/dist/es5/ms.post.min.js +2 -2
- package/dist/es5/ms.post.min.js.map +1 -1
- package/dist-es5/BatchNotificationActions.js +1 -1
- package/dist-es5/ClockSkewManager.js +8 -8
- package/dist-es5/ClockSkewManager.js.map +1 -1
- package/dist-es5/DataModels.js +1 -1
- package/dist-es5/EventBatch.js +13 -12
- package/dist-es5/EventBatch.js.map +1 -1
- package/dist-es5/HttpManager.js +173 -173
- package/dist-es5/HttpManager.js.map +1 -1
- package/dist-es5/Index.js +3 -3
- package/dist-es5/Index.js.map +1 -1
- package/dist-es5/InternalConstants.js +1 -1
- package/dist-es5/KillSwitch.js +8 -8
- package/dist-es5/KillSwitch.js.map +1 -1
- package/dist-es5/PostChannel.js +92 -90
- package/dist-es5/PostChannel.js.map +1 -1
- package/dist-es5/RetryPolicy.js +1 -1
- package/dist-es5/Serializer.js +4 -5
- package/dist-es5/Serializer.js.map +1 -1
- package/dist-es5/TimeoutOverrideWrapper.js +1 -1
- package/dist-es5/__DynamicConstants.js +83 -0
- package/dist-es5/__DynamicConstants.js.map +1 -0
- package/dist-es5/typings/XDomainRequest.js +1 -1
- package/package.json +40 -24
- package/types/1ds-post-js.d.ts +5 -3
- package/types/1ds-post-js.namespaced.d.ts +5 -3
- package/bundle/es5/ms.post-4.0.0.gbl.js.map +0 -1
- package/bundle/es5/ms.post-4.0.0.gbl.min.js +0 -7
- package/bundle/es5/ms.post-4.0.0.gbl.min.js.map +0 -1
- package/bundle/es5/ms.post-4.0.0.integrity.json +0 -46
- package/bundle/es5/ms.post-4.0.0.js.map +0 -1
- package/bundle/es5/ms.post-4.0.0.min.js +0 -7
- package/bundle/es5/ms.post-4.0.0.min.js.map +0 -1
package/dist-es5/HttpManager.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* 1DS JS SDK POST plugin, 4.0.
|
|
2
|
+
* 1DS JS SDK POST plugin, 4.0.2-nightly3.2307-24
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -18,9 +18,10 @@ import { KillSwitch } from "./KillSwitch";
|
|
|
18
18
|
import { retryPolicyGetMillisToBackoffForRetry, retryPolicyShouldRetryForStatus } from "./RetryPolicy";
|
|
19
19
|
import { Serializer } from "./Serializer";
|
|
20
20
|
import { createTimeoutWrapper } from "./TimeoutOverrideWrapper";
|
|
21
|
+
import { _DYN_ALLOW_REQUEST_SENDIN0, _DYN_ALWAYS_USE_XHR_OVERR7, _DYN_AVOID_OPTIONS, _DYN_BATCHES, _DYN_CAN_SEND_REQUEST, _DYN_CLEAR_TIMEOUT_OVERRI3, _DYN_CONCAT, _DYN_COUNT, _DYN_DATA, _DYN_DISABLE_EVENT_TIMING5, _DYN_DISABLE_FETCH_KEEP_A6, _DYN_DISABLE_XHR_SYNC, _DYN_ENABLE_COMPOUND_KEY, _DYN_EVENTS, _DYN_FIRST_REQUEST_SENT, _DYN_GET_ALL_RESPONSE_HEA8, _DYN_GET_CLOCK_SKEW_HEADE2, _DYN_GET_RESPONSE_HEADER, _DYN_GET_WPARAM, _DYN_HDRS, _DYN_HEADERS, _DYN_INITIALIZE, _DYN_IS_BEACON, _DYN_IS_COMPLETELY_IDLE, _DYN_IS_SYNC, _DYN_IS_TEARDOWN, _DYN_I_KEY, _DYN_LENGTH, _DYN_ONTIMEOUT, _DYN_OVERRIDE_ENDPOINT_UR4, _DYN_PAYLOAD_PREPROCESSOR, _DYN_PUSH, _DYN_SEND_POST, _DYN_SEND_QUEUED_REQUESTS, _DYN_SEND_SYNCHRONOUS_BAT9, _DYN_SEND_TYPE, _DYN_SET_CLOCK_SKEW, _DYN_SET_KILL_SWITCH_TENA10, _DYN_SET_TIMEOUT_OVERRIDE, _DYN_SET_UNLOADING, _DYN_SHOULD_ADD_CLOCK_SKE1, _DYN_SPLICE, _DYN_SPLIT, _DYN_STRINGIFY_OBJECTS, _DYN_TIMEOUT, _DYN_TIMINGS, _DYN_TO_LOWER_CASE, _DYN_UNLOAD_TRANSPORTS, _DYN_URL_STRING, _DYN_USE_HDRS, _DYN_USE_SEND_BEACON, _DYN__BACK_OFF_TRANSMISSI11, _DYN__SEND_REASON, _DYN__THE_PAYLOAD, _DYN__TRANSPORT } from "./__DynamicConstants";
|
|
21
22
|
var strSendAttempt = "sendAttempt";
|
|
22
23
|
var _noResponseQs = "&" + STR_NO_RESPONSE_BODY + "=true";
|
|
23
|
-
var UrlQueryString = "?cors=true&" + STR_CONTENT_TYPE_HEADER
|
|
24
|
+
var UrlQueryString = "?cors=true&" + STR_CONTENT_TYPE_HEADER[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() + "=" + DEFAULT_CONTENT_TYPE;
|
|
24
25
|
/**
|
|
25
26
|
* Identifies the default notification reason to the action names
|
|
26
27
|
*/
|
|
@@ -59,12 +60,12 @@ function _hasHeader(headers, header) {
|
|
|
59
60
|
var hasHeader = false;
|
|
60
61
|
if (headers && header) {
|
|
61
62
|
var keys = objKeys(headers);
|
|
62
|
-
if (keys && keys
|
|
63
|
-
var lowerHeader = header
|
|
64
|
-
for (var lp = 0; lp < keys
|
|
63
|
+
if (keys && keys[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
64
|
+
var lowerHeader = header[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();
|
|
65
|
+
for (var lp = 0; lp < keys[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
65
66
|
var value = keys[lp];
|
|
66
67
|
if (value && hasOwnProperty(header, value) &&
|
|
67
|
-
value
|
|
68
|
+
value[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === lowerHeader) {
|
|
68
69
|
hasHeader = true;
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
@@ -74,10 +75,10 @@ function _hasHeader(headers, header) {
|
|
|
74
75
|
return hasHeader;
|
|
75
76
|
}
|
|
76
77
|
function _addRequestDetails(details, name, value, useHeaders) {
|
|
77
|
-
if (name && value && value
|
|
78
|
+
if (name && value && value[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
78
79
|
if (useHeaders && _collectorQsHeaders[name]) {
|
|
79
|
-
details
|
|
80
|
-
details
|
|
80
|
+
details[_DYN_HDRS /* @min:%2ehdrs */][_collectorQsHeaders[name]] = value;
|
|
81
|
+
details[_DYN_USE_HDRS /* @min:%2euseHdrs */] = true;
|
|
81
82
|
}
|
|
82
83
|
else {
|
|
83
84
|
details.url += "&" + name + "=" + value;
|
|
@@ -87,27 +88,27 @@ function _addRequestDetails(details, name, value, useHeaders) {
|
|
|
87
88
|
function _prependTransports(theTransports, newTransports) {
|
|
88
89
|
if (newTransports) {
|
|
89
90
|
if (isNumber(newTransports)) {
|
|
90
|
-
theTransports = [newTransports]
|
|
91
|
+
theTransports = [newTransports][_DYN_CONCAT /* @min:%2econcat */](theTransports);
|
|
91
92
|
}
|
|
92
93
|
else if (isArray(newTransports)) {
|
|
93
|
-
theTransports = newTransports
|
|
94
|
+
theTransports = newTransports[_DYN_CONCAT /* @min:%2econcat */](theTransports);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
return theTransports;
|
|
97
98
|
}
|
|
98
99
|
function _addQueryStringParameter(qsParams, name, value) {
|
|
99
|
-
for (var i = 0; i < qsParams
|
|
100
|
+
for (var i = 0; i < qsParams[_DYN_LENGTH /* @min:%2elength */]; i++) {
|
|
100
101
|
if (qsParams[i].name === name) {
|
|
101
102
|
qsParams[i].value = value;
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
qsParams
|
|
106
|
+
qsParams[_DYN_PUSH /* @min:%2epush */]({ name: name, value: value });
|
|
106
107
|
}
|
|
107
108
|
function _removeQueryStringParameter(qsParams, name) {
|
|
108
|
-
for (var i = 0; i < qsParams
|
|
109
|
+
for (var i = 0; i < qsParams[_DYN_LENGTH /* @min:%2elength */]; i++) {
|
|
109
110
|
if (qsParams[i].name === name) {
|
|
110
|
-
qsParams
|
|
111
|
+
qsParams[_DYN_SPLICE /* @min:%2esplice */](i, 1);
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -154,7 +155,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
154
155
|
dynamicProto(HttpManager, this, function (_self) {
|
|
155
156
|
_initDefaults();
|
|
156
157
|
var _sendCredentials = true;
|
|
157
|
-
_self
|
|
158
|
+
_self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (theConfig, core, postChannel) {
|
|
158
159
|
if (!_isInitialized) {
|
|
159
160
|
_core = core;
|
|
160
161
|
_cookieMgr = core.getCookieMgr();
|
|
@@ -164,44 +165,44 @@ var HttpManager = /** @class */ (function () {
|
|
|
164
165
|
var _a;
|
|
165
166
|
var coreConfig = details.cfg;
|
|
166
167
|
var channelConfig = details.cfg.extensionConfig[postChannel.identifier];
|
|
167
|
-
_timeoutWrapper = createTimeoutWrapper(channelConfig
|
|
168
|
+
_timeoutWrapper = createTimeoutWrapper(channelConfig[_DYN_SET_TIMEOUT_OVERRIDE /* @min:%2esetTimeoutOverride */], channelConfig[_DYN_CLEAR_TIMEOUT_OVERRI3 /* @min:%2eclearTimeoutOverride */]);
|
|
168
169
|
if (isValueAssigned(coreConfig.anonCookieName)) {
|
|
169
170
|
_addQueryStringParameter(_queryStringParameters, "anoncknm", coreConfig.anonCookieName);
|
|
170
171
|
}
|
|
171
172
|
else {
|
|
172
173
|
_removeQueryStringParameter(_queryStringParameters, "anoncknm");
|
|
173
174
|
}
|
|
174
|
-
_sendHook = channelConfig
|
|
175
|
+
_sendHook = channelConfig[_DYN_PAYLOAD_PREPROCESSOR /* @min:%2epayloadPreprocessor */];
|
|
175
176
|
_sendListener = channelConfig.payloadListener;
|
|
176
177
|
var httpInterface = channelConfig.httpXHROverride;
|
|
177
178
|
// Override endpointUrl if provided in Post config
|
|
178
|
-
var endpointUrl = channelConfig
|
|
179
|
+
var endpointUrl = channelConfig[_DYN_OVERRIDE_ENDPOINT_UR4 /* @min:%2eoverrideEndpointUrl */] ? channelConfig[_DYN_OVERRIDE_ENDPOINT_UR4 /* @min:%2eoverrideEndpointUrl */] : coreConfig.endpointUrl;
|
|
179
180
|
_urlString = endpointUrl + UrlQueryString;
|
|
180
|
-
_useHeaders = !isUndefined(channelConfig
|
|
181
|
-
_enableEventTimings = !channelConfig
|
|
181
|
+
_useHeaders = !isUndefined(channelConfig[_DYN_AVOID_OPTIONS /* @min:%2eavoidOptions */]) ? !channelConfig[_DYN_AVOID_OPTIONS /* @min:%2eavoidOptions */] : true;
|
|
182
|
+
_enableEventTimings = !channelConfig[_DYN_DISABLE_EVENT_TIMING5 /* @min:%2edisableEventTimings */];
|
|
182
183
|
var valueSanitizer = channelConfig.valueSanitizer;
|
|
183
|
-
var stringifyObjects = channelConfig
|
|
184
|
-
var enableCompoundKey = !!coreConfig
|
|
185
|
-
if (!isUndefined(channelConfig
|
|
186
|
-
enableCompoundKey = !!channelConfig
|
|
184
|
+
var stringifyObjects = channelConfig[_DYN_STRINGIFY_OBJECTS /* @min:%2estringifyObjects */];
|
|
185
|
+
var enableCompoundKey = !!coreConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */];
|
|
186
|
+
if (!isUndefined(channelConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */])) {
|
|
187
|
+
enableCompoundKey = !!channelConfig[_DYN_ENABLE_COMPOUND_KEY /* @min:%2eenableCompoundKey */];
|
|
187
188
|
}
|
|
188
189
|
_xhrTimeout = channelConfig.xhrTimeout;
|
|
189
|
-
_disableXhrSync = !!channelConfig
|
|
190
|
-
_disableFetchKeepAlive = !!channelConfig
|
|
190
|
+
_disableXhrSync = !!channelConfig[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */];
|
|
191
|
+
_disableFetchKeepAlive = !!channelConfig[_DYN_DISABLE_FETCH_KEEP_A6 /* @min:%2edisableFetchKeepAlive */];
|
|
191
192
|
_addNoResponse = channelConfig.addNoResponse !== false;
|
|
192
193
|
_useBeacons = !isReactNative(); // Only use beacons if not running in React Native
|
|
193
194
|
_serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey);
|
|
194
|
-
if (!isNullOrUndefined(channelConfig
|
|
195
|
-
_useBeacons = !!channelConfig
|
|
195
|
+
if (!isNullOrUndefined(channelConfig[_DYN_USE_SEND_BEACON /* @min:%2euseSendBeacon */])) {
|
|
196
|
+
_useBeacons = !!channelConfig[_DYN_USE_SEND_BEACON /* @min:%2euseSendBeacon */];
|
|
196
197
|
}
|
|
197
198
|
var syncHttpInterface = httpInterface;
|
|
198
|
-
var beaconHttpInterface = channelConfig
|
|
199
|
-
var fetchSyncHttpInterface = channelConfig
|
|
199
|
+
var beaconHttpInterface = channelConfig[_DYN_ALWAYS_USE_XHR_OVERR7 /* @min:%2ealwaysUseXhrOverride */] ? httpInterface : null;
|
|
200
|
+
var fetchSyncHttpInterface = channelConfig[_DYN_ALWAYS_USE_XHR_OVERR7 /* @min:%2ealwaysUseXhrOverride */] ? httpInterface : null;
|
|
200
201
|
var beaconUnloadTransports = [3 /* TransportType.Beacon */, 2 /* TransportType.Fetch */];
|
|
201
202
|
if (!httpInterface) {
|
|
202
203
|
_customHttpInterface = false;
|
|
203
204
|
var location_1 = getLocation();
|
|
204
|
-
if (location_1 && location_1.protocol && location_1.protocol
|
|
205
|
+
if (location_1 && location_1.protocol && location_1.protocol[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]() === "file:") {
|
|
205
206
|
// Special case where a local html file fails with a CORS error on Chromium browsers
|
|
206
207
|
_sendCredentials = false;
|
|
207
208
|
}
|
|
@@ -225,7 +226,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
225
226
|
}
|
|
226
227
|
if (!beaconHttpInterface) {
|
|
227
228
|
// Allow overriding the usage of sendBeacon
|
|
228
|
-
beaconUnloadTransports = _prependTransports(beaconUnloadTransports, channelConfig
|
|
229
|
+
beaconUnloadTransports = _prependTransports(beaconUnloadTransports, channelConfig[_DYN_UNLOAD_TRANSPORTS /* @min:%2eunloadTransports */]);
|
|
229
230
|
beaconHttpInterface = _getSenderInterface(beaconUnloadTransports, true);
|
|
230
231
|
}
|
|
231
232
|
_canHaveReducedPayload = !_customHttpInterface && ((_useBeacons && isBeaconsSupported()) || (!_disableFetchKeepAlive && isFetchSupported(true)));
|
|
@@ -240,12 +241,12 @@ var HttpManager = /** @class */ (function () {
|
|
|
240
241
|
}
|
|
241
242
|
};
|
|
242
243
|
_self.addResponseHandler = function (responseHandler) {
|
|
243
|
-
_responseHandlers
|
|
244
|
+
_responseHandlers[_DYN_PUSH /* @min:%2epush */](responseHandler);
|
|
244
245
|
return {
|
|
245
246
|
rm: function () {
|
|
246
247
|
var index = _responseHandlers.indexOf(responseHandler);
|
|
247
248
|
if (index >= 0) {
|
|
248
|
-
_responseHandlers
|
|
249
|
+
_responseHandlers[_DYN_SPLICE /* @min:%2esplice */](index, 1);
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
};
|
|
@@ -255,7 +256,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
255
256
|
var transportType = 0 /* TransportType.NotSet */;
|
|
256
257
|
var sendPostFunc = null;
|
|
257
258
|
var lp = 0;
|
|
258
|
-
while (sendPostFunc == null && lp < transports
|
|
259
|
+
while (sendPostFunc == null && lp < transports[_DYN_LENGTH /* @min:%2elength */]) {
|
|
259
260
|
transportType = transports[lp];
|
|
260
261
|
if (transportType === 1 /* TransportType.Xhr */) {
|
|
261
262
|
if (useXDomainRequest()) {
|
|
@@ -288,9 +289,9 @@ var HttpManager = /** @class */ (function () {
|
|
|
288
289
|
function _xdrSendPost(payload, oncomplete, sync) {
|
|
289
290
|
// It doesn't support custom headers, so no action is taken with current requestHeaders
|
|
290
291
|
var xdr = new XDomainRequest();
|
|
291
|
-
xdr.open(STR_POST_METHOD, payload
|
|
292
|
-
if (payload
|
|
293
|
-
xdr
|
|
292
|
+
xdr.open(STR_POST_METHOD, payload[_DYN_URL_STRING /* @min:%2eurlString */]);
|
|
293
|
+
if (payload[_DYN_TIMEOUT /* @min:%2etimeout */]) {
|
|
294
|
+
xdr[_DYN_TIMEOUT /* @min:%2etimeout */] = payload[_DYN_TIMEOUT /* @min:%2etimeout */];
|
|
294
295
|
}
|
|
295
296
|
// can't get the status code in xdr.
|
|
296
297
|
xdr.onload = function () {
|
|
@@ -304,18 +305,18 @@ var HttpManager = /** @class */ (function () {
|
|
|
304
305
|
_doOnComplete(oncomplete, 400, {});
|
|
305
306
|
};
|
|
306
307
|
// we will assume ontimeout means we need to retry the events.
|
|
307
|
-
xdr
|
|
308
|
+
xdr[_DYN_ONTIMEOUT /* @min:%2eontimeout */] = function () {
|
|
308
309
|
_doOnComplete(oncomplete, 500, {});
|
|
309
310
|
};
|
|
310
311
|
// https://cypressnorth.com/web-programming-and-development/internet-explorer-aborting-ajax-requests-fixed/
|
|
311
312
|
// tslint:disable-next-line:no-empty
|
|
312
313
|
xdr.onprogress = function () { };
|
|
313
314
|
if (sync) {
|
|
314
|
-
xdr.send(payload
|
|
315
|
+
xdr.send(payload[_DYN_DATA /* @min:%2edata */]);
|
|
315
316
|
}
|
|
316
317
|
else {
|
|
317
318
|
_timeoutWrapper.set(function () {
|
|
318
|
-
xdr.send(payload
|
|
319
|
+
xdr.send(payload[_DYN_DATA /* @min:%2edata */]);
|
|
319
320
|
}, 0);
|
|
320
321
|
}
|
|
321
322
|
}
|
|
@@ -354,18 +355,18 @@ var HttpManager = /** @class */ (function () {
|
|
|
354
355
|
}
|
|
355
356
|
function _fetchSendPost(payload, oncomplete, sync) {
|
|
356
357
|
var _a;
|
|
357
|
-
var theUrl = payload
|
|
358
|
+
var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];
|
|
358
359
|
var ignoreResponse = false;
|
|
359
360
|
var responseHandled = false;
|
|
360
361
|
var requestInit = (_a = {
|
|
361
|
-
body: payload
|
|
362
|
+
body: payload[_DYN_DATA /* @min:%2edata */],
|
|
362
363
|
method: STR_POST_METHOD
|
|
363
364
|
},
|
|
364
365
|
_a[STR_DISABLED_PROPERTY_NAME] = true,
|
|
365
366
|
_a);
|
|
366
367
|
if (sync) {
|
|
367
368
|
requestInit.keepalive = true;
|
|
368
|
-
if (payload
|
|
369
|
+
if (payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] === 2 /* SendRequestReason.Unload */) {
|
|
369
370
|
// As a sync request (during unload), it is unlikely that we will get a chance to process the response so
|
|
370
371
|
// just like beacon send assume that the events have been accepted and processed
|
|
371
372
|
ignoreResponse = true;
|
|
@@ -379,13 +380,13 @@ var HttpManager = /** @class */ (function () {
|
|
|
379
380
|
requestInit.credentials = "include";
|
|
380
381
|
}
|
|
381
382
|
// Only add headers if there are headers to add, due to issue with some polyfills
|
|
382
|
-
if (payload.headers && objKeys(payload.headers)
|
|
383
|
-
requestInit
|
|
383
|
+
if (payload.headers && objKeys(payload.headers)[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
384
|
+
requestInit[_DYN_HEADERS /* @min:%2eheaders */] = payload[_DYN_HEADERS /* @min:%2eheaders */];
|
|
384
385
|
}
|
|
385
386
|
fetch(theUrl, requestInit).then(function (response) {
|
|
386
387
|
var headerMap = {};
|
|
387
388
|
var responseText = STR_EMPTY;
|
|
388
|
-
var headers = response
|
|
389
|
+
var headers = response[_DYN_HEADERS /* @min:%2eheaders */];
|
|
389
390
|
if (headers) {
|
|
390
391
|
headers["forEach"](function (value, name) {
|
|
391
392
|
headerMap[name] = value;
|
|
@@ -414,7 +415,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
414
415
|
responseHandled = true;
|
|
415
416
|
_doOnComplete(oncomplete, 200, {});
|
|
416
417
|
}
|
|
417
|
-
if (!responseHandled && payload
|
|
418
|
+
if (!responseHandled && payload[_DYN_TIMEOUT /* @min:%2etimeout */] > 0) {
|
|
418
419
|
// Simulate timeout
|
|
419
420
|
_timeoutWrapper.set(function () {
|
|
420
421
|
if (!responseHandled) {
|
|
@@ -422,14 +423,14 @@ var HttpManager = /** @class */ (function () {
|
|
|
422
423
|
responseHandled = true;
|
|
423
424
|
_doOnComplete(oncomplete, 500, {});
|
|
424
425
|
}
|
|
425
|
-
}, payload
|
|
426
|
+
}, payload[_DYN_TIMEOUT /* @min:%2etimeout */]);
|
|
426
427
|
}
|
|
427
428
|
}
|
|
428
429
|
function _xhrSendPost(payload, oncomplete, sync) {
|
|
429
|
-
var theUrl = payload
|
|
430
|
+
var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];
|
|
430
431
|
function _appendHeader(theHeaders, xhr, name) {
|
|
431
|
-
if (!theHeaders[name] && xhr && xhr
|
|
432
|
-
var value = xhr
|
|
432
|
+
if (!theHeaders[name] && xhr && xhr[_DYN_GET_RESPONSE_HEADER /* @min:%2egetResponseHeader */]) {
|
|
433
|
+
var value = xhr[_DYN_GET_RESPONSE_HEADER /* @min:%2egetResponseHeader */](name);
|
|
433
434
|
if (value) {
|
|
434
435
|
theHeaders[name] = strTrim(value);
|
|
435
436
|
}
|
|
@@ -438,7 +439,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
438
439
|
}
|
|
439
440
|
function _getAllResponseHeaders(xhr) {
|
|
440
441
|
var theHeaders = {};
|
|
441
|
-
if (!xhr
|
|
442
|
+
if (!xhr[_DYN_GET_ALL_RESPONSE_HEA8 /* @min:%2egetAllResponseHeaders */]) {
|
|
442
443
|
// Firefox 2-63 doesn't have getAllResponseHeaders function but it does have getResponseHeader
|
|
443
444
|
// Only call these if getAllResponseHeaders doesn't exist, otherwise we can get invalid response errors
|
|
444
445
|
// as collector is not currently returning the correct header to allow JS to access these headers
|
|
@@ -447,19 +448,19 @@ var HttpManager = /** @class */ (function () {
|
|
|
447
448
|
theHeaders = _appendHeader(theHeaders, xhr, STR_KILL_DURATION_SECONDS_HEADER);
|
|
448
449
|
}
|
|
449
450
|
else {
|
|
450
|
-
theHeaders = _convertAllHeadersToMap(xhr
|
|
451
|
+
theHeaders = _convertAllHeadersToMap(xhr[_DYN_GET_ALL_RESPONSE_HEA8 /* @min:%2egetAllResponseHeaders */]());
|
|
451
452
|
}
|
|
452
453
|
return theHeaders;
|
|
453
454
|
}
|
|
454
455
|
function xhrComplete(xhr, responseTxt) {
|
|
455
456
|
_doOnComplete(oncomplete, xhr.status, _getAllResponseHeaders(xhr), responseTxt);
|
|
456
457
|
}
|
|
457
|
-
if (sync && payload
|
|
458
|
+
if (sync && payload[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */]) {
|
|
458
459
|
sync = false;
|
|
459
460
|
}
|
|
460
|
-
var xhrRequest = openXhr(STR_POST_METHOD, theUrl, _sendCredentials, true, sync, payload
|
|
461
|
+
var xhrRequest = openXhr(STR_POST_METHOD, theUrl, _sendCredentials, true, sync, payload[_DYN_TIMEOUT /* @min:%2etimeout */]);
|
|
461
462
|
// Set custom headers (e.g. gzip) here (after open())
|
|
462
|
-
objForEachKey(payload
|
|
463
|
+
objForEachKey(payload[_DYN_HEADERS /* @min:%2eheaders */], function (name, value) {
|
|
463
464
|
xhrRequest.setRequestHeader(name, value);
|
|
464
465
|
});
|
|
465
466
|
xhrRequest.onload = function () {
|
|
@@ -470,10 +471,10 @@ var HttpManager = /** @class */ (function () {
|
|
|
470
471
|
xhrRequest.onerror = function () {
|
|
471
472
|
xhrComplete(xhrRequest);
|
|
472
473
|
};
|
|
473
|
-
xhrRequest
|
|
474
|
+
xhrRequest[_DYN_ONTIMEOUT /* @min:%2eontimeout */] = function () {
|
|
474
475
|
xhrComplete(xhrRequest);
|
|
475
476
|
};
|
|
476
|
-
xhrRequest.send(payload
|
|
477
|
+
xhrRequest.send(payload[_DYN_DATA /* @min:%2edata */]);
|
|
477
478
|
}
|
|
478
479
|
function _doOnComplete(oncomplete, status, headers, response) {
|
|
479
480
|
try {
|
|
@@ -487,31 +488,31 @@ var HttpManager = /** @class */ (function () {
|
|
|
487
488
|
// Custom headers not supported in sendBeacon payload.headers would be ignored
|
|
488
489
|
var internalPayloadData = payload;
|
|
489
490
|
var status = 200;
|
|
490
|
-
var thePayload = internalPayloadData
|
|
491
|
-
var theUrl = payload
|
|
491
|
+
var thePayload = internalPayloadData[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */];
|
|
492
|
+
var theUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */] + (_addNoResponse ? _noResponseQs : STR_EMPTY);
|
|
492
493
|
try {
|
|
493
494
|
var nav_1 = getNavigator();
|
|
494
|
-
if (!nav_1.sendBeacon(theUrl, payload
|
|
495
|
+
if (!nav_1.sendBeacon(theUrl, payload[_DYN_DATA /* @min:%2edata */])) {
|
|
495
496
|
if (thePayload) {
|
|
496
497
|
// Failed to send entire payload so try and split data and try to send as much events as possible
|
|
497
498
|
var droppedBatches_1 = [];
|
|
498
|
-
arrForEach(thePayload
|
|
499
|
-
if (droppedBatches_1 && theBatch && theBatch
|
|
500
|
-
var theEvents = theBatch
|
|
501
|
-
for (var lp = 0; lp < theEvents
|
|
499
|
+
arrForEach(thePayload[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {
|
|
500
|
+
if (droppedBatches_1 && theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
501
|
+
var theEvents = theBatch[_DYN_EVENTS /* @min:%2eevents */]();
|
|
502
|
+
for (var lp = 0; lp < theEvents[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
502
503
|
if (!nav_1.sendBeacon(theUrl, _serializer.getEventBlob(theEvents[lp]))) {
|
|
503
504
|
// Can't send anymore, so split the batch and drop the rest
|
|
504
|
-
droppedBatches_1
|
|
505
|
+
droppedBatches_1[_DYN_PUSH /* @min:%2epush */](theBatch[_DYN_SPLIT /* @min:%2esplit */](lp));
|
|
505
506
|
break;
|
|
506
507
|
}
|
|
507
508
|
}
|
|
508
509
|
}
|
|
509
510
|
else {
|
|
510
511
|
// Remove all of the events from the existing batch in the payload as the copy includes the original
|
|
511
|
-
droppedBatches_1
|
|
512
|
+
droppedBatches_1[_DYN_PUSH /* @min:%2epush */](theBatch[_DYN_SPLIT /* @min:%2esplit */](0));
|
|
512
513
|
}
|
|
513
514
|
});
|
|
514
|
-
_sendBatchesNotification(droppedBatches_1, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload
|
|
515
|
+
_sendBatchesNotification(droppedBatches_1, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);
|
|
515
516
|
}
|
|
516
517
|
else {
|
|
517
518
|
status = 0;
|
|
@@ -539,10 +540,10 @@ var HttpManager = /** @class */ (function () {
|
|
|
539
540
|
_self.addHeader = function (name, value) {
|
|
540
541
|
_headers[name] = value;
|
|
541
542
|
};
|
|
542
|
-
_self
|
|
543
|
-
return _hasIdleConnection() && _clockSkewManager
|
|
543
|
+
_self[_DYN_CAN_SEND_REQUEST /* @min:%2ecanSendRequest */] = function () {
|
|
544
|
+
return _hasIdleConnection() && _clockSkewManager[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */]();
|
|
544
545
|
};
|
|
545
|
-
_self
|
|
546
|
+
_self[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */] = function (sendType, sendReason) {
|
|
546
547
|
if (isUndefined(sendType)) {
|
|
547
548
|
sendType = 0 /* EventSendType.Batched */;
|
|
548
549
|
}
|
|
@@ -554,19 +555,19 @@ var HttpManager = /** @class */ (function () {
|
|
|
554
555
|
_sendBatches(_clearQueue(), 0, false, sendType, sendReason || 0 /* SendRequestReason.Undefined */);
|
|
555
556
|
}
|
|
556
557
|
};
|
|
557
|
-
_self
|
|
558
|
-
return !_paused && _outstandingRequests === 0 && _batchQueue
|
|
558
|
+
_self[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */] = function () {
|
|
559
|
+
return !_paused && _outstandingRequests === 0 && _batchQueue[_DYN_LENGTH /* @min:%2elength */] === 0;
|
|
559
560
|
};
|
|
560
|
-
_self
|
|
561
|
+
_self[_DYN_SET_UNLOADING /* @min:%2esetUnloading */] = function (value) {
|
|
561
562
|
_isUnloading = value;
|
|
562
563
|
};
|
|
563
564
|
_self.addBatch = function (theBatch) {
|
|
564
|
-
if (theBatch && theBatch
|
|
565
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
565
566
|
// Try and kill the event faster
|
|
566
|
-
if (_killSwitch.isTenantKilled(theBatch
|
|
567
|
+
if (_killSwitch.isTenantKilled(theBatch[_DYN_I_KEY /* @min:%2eiKey */]())) {
|
|
567
568
|
return false;
|
|
568
569
|
}
|
|
569
|
-
_batchQueue
|
|
570
|
+
_batchQueue[_DYN_PUSH /* @min:%2epush */](theBatch);
|
|
570
571
|
}
|
|
571
572
|
return true;
|
|
572
573
|
};
|
|
@@ -575,7 +576,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
575
576
|
* sent using HTML5 Beacons if they are available.
|
|
576
577
|
*/
|
|
577
578
|
_self.teardown = function () {
|
|
578
|
-
if (_batchQueue
|
|
579
|
+
if (_batchQueue[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
579
580
|
_sendBatches(_clearQueue(), 0, true, 2 /* EventSendType.SendBeacon */, 2 /* SendRequestReason.Unload */);
|
|
580
581
|
}
|
|
581
582
|
arrForEach(_unloadHooks, function (hook) {
|
|
@@ -594,7 +595,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
594
595
|
*/
|
|
595
596
|
_self.resume = function () {
|
|
596
597
|
_paused = false;
|
|
597
|
-
_self
|
|
598
|
+
_self[_DYN_SEND_QUEUED_REQUESTS /* @min:%2esendQueuedRequests */](0 /* EventSendType.Batched */, 4 /* SendRequestReason.Resumed */);
|
|
598
599
|
};
|
|
599
600
|
/**
|
|
600
601
|
* Sends a request synchronously to the Aria collector. This api is used to send
|
|
@@ -603,12 +604,12 @@ var HttpManager = /** @class */ (function () {
|
|
|
603
604
|
* @param batch - The request to be sent.
|
|
604
605
|
* @param sendReason - The token used to send the request.
|
|
605
606
|
*/
|
|
606
|
-
_self
|
|
607
|
+
_self[_DYN_SEND_SYNCHRONOUS_BAT9 /* @min:%2esendSynchronousBatch */] = function (batch, sendType, sendReason) {
|
|
607
608
|
// This will not take into account the max connections restriction. Since this is sync, we can
|
|
608
609
|
// only send one of this request at a time and thus should not worry about multiple connections
|
|
609
610
|
// being used to send synchronous events.
|
|
610
611
|
// Increment active connection since we are still going to use a connection to send the request.
|
|
611
|
-
if (batch && batch
|
|
612
|
+
if (batch && batch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
612
613
|
if (isNullOrUndefined(sendType)) {
|
|
613
614
|
sendType = 1 /* EventSendType.Synchronous */;
|
|
614
615
|
}
|
|
@@ -630,10 +631,10 @@ var HttpManager = /** @class */ (function () {
|
|
|
630
631
|
}
|
|
631
632
|
function _canSendPayload(theBatches, sendType, retryCnt) {
|
|
632
633
|
var result = false;
|
|
633
|
-
if (theBatches && theBatches
|
|
634
|
+
if (theBatches && theBatches[_DYN_LENGTH /* @min:%2elength */] > 0 && !_paused && _sendInterfaces[sendType] && _serializer) {
|
|
634
635
|
// Always attempt to send synchronous events don't wait for idle or clockSkew
|
|
635
636
|
// and don't block retry requests if clockSkew is not yet set
|
|
636
|
-
result = (sendType !== 0 /* EventSendType.Batched */) || (_hasIdleConnection() && (retryCnt > 0 || _clockSkewManager
|
|
637
|
+
result = (sendType !== 0 /* EventSendType.Batched */) || (_hasIdleConnection() && (retryCnt > 0 || _clockSkewManager[_DYN_ALLOW_REQUEST_SENDIN0 /* @min:%2eallowRequestSending */]()));
|
|
637
638
|
}
|
|
638
639
|
return result;
|
|
639
640
|
}
|
|
@@ -642,15 +643,15 @@ var HttpManager = /** @class */ (function () {
|
|
|
642
643
|
if (theBatches) {
|
|
643
644
|
arrForEach(theBatches, function (theBatch, idx) {
|
|
644
645
|
values[idx] = {
|
|
645
|
-
iKey: theBatch
|
|
646
|
-
evts: theBatch
|
|
646
|
+
iKey: theBatch[_DYN_I_KEY /* @min:%2eiKey */](),
|
|
647
|
+
evts: theBatch[_DYN_EVENTS /* @min:%2eevents */]()
|
|
647
648
|
};
|
|
648
649
|
});
|
|
649
650
|
}
|
|
650
651
|
return values;
|
|
651
652
|
}
|
|
652
653
|
function _sendBatches(theBatches, retryCount, isTeardown, sendType, sendReason) {
|
|
653
|
-
if (!theBatches || theBatches
|
|
654
|
+
if (!theBatches || theBatches[_DYN_LENGTH /* @min:%2elength */] === 0) {
|
|
654
655
|
// Nothing to do
|
|
655
656
|
return;
|
|
656
657
|
}
|
|
@@ -675,13 +676,13 @@ var HttpManager = /** @class */ (function () {
|
|
|
675
676
|
var thePayload = null;
|
|
676
677
|
var serializationStart = getTime();
|
|
677
678
|
var sendInterface = _sendInterfaces[sendType] || (isSynchronous_1 ? _sendInterfaces[1 /* EventSendType.Synchronous */] : _sendInterfaces[0 /* EventSendType.Batched */]);
|
|
678
|
-
var sendTransport = sendInterface && sendInterface
|
|
679
|
+
var sendTransport = sendInterface && sendInterface[_DYN__TRANSPORT /* @min:%2e_transport */];
|
|
679
680
|
// Sync Fetch has the same payload limitation as sendBeacon -- 64kb limit
|
|
680
681
|
var isReducedPayload = _canHaveReducedPayload && (_isUnloading || _isBeaconPayload(sendType) || (sendTransport === 3 /* TransportType.Beacon */ || (sendInterface._isSync && sendTransport === 2 /* TransportType.Fetch */)));
|
|
681
682
|
while (_canSendPayload(theBatches, sendType, retryCount)) {
|
|
682
683
|
var theBatch = theBatches.shift();
|
|
683
|
-
if (theBatch && theBatch
|
|
684
|
-
if (!_killSwitch.isTenantKilled(theBatch
|
|
684
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
685
|
+
if (!_killSwitch.isTenantKilled(theBatch[_DYN_I_KEY /* @min:%2eiKey */]())) {
|
|
685
686
|
// Make sure we have a payload object
|
|
686
687
|
thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isReducedPayload, sendReason, sendType);
|
|
687
688
|
// Add the batch to the current payload
|
|
@@ -689,12 +690,12 @@ var HttpManager = /** @class */ (function () {
|
|
|
689
690
|
// Entire batch was not added so send the payload and retry adding this batch
|
|
690
691
|
_doPayloadSend(thePayload, serializationStart, getTime(), sendReason);
|
|
691
692
|
serializationStart = getTime();
|
|
692
|
-
theBatches = [theBatch]
|
|
693
|
+
theBatches = [theBatch][_DYN_CONCAT /* @min:%2econcat */](theBatches);
|
|
693
694
|
thePayload = null;
|
|
694
695
|
}
|
|
695
696
|
else if (thePayload.overflow !== null) {
|
|
696
697
|
// Total Payload size was exceeded so send the payload and add the unsent as the next batch to send
|
|
697
|
-
theBatches = [thePayload.overflow]
|
|
698
|
+
theBatches = [thePayload.overflow][_DYN_CONCAT /* @min:%2econcat */](theBatches);
|
|
698
699
|
thePayload.overflow = null;
|
|
699
700
|
_doPayloadSend(thePayload, serializationStart, getTime(), sendReason);
|
|
700
701
|
serializationStart = getTime();
|
|
@@ -702,7 +703,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
702
703
|
}
|
|
703
704
|
}
|
|
704
705
|
else {
|
|
705
|
-
droppedBatches
|
|
706
|
+
droppedBatches[_DYN_PUSH /* @min:%2epush */](theBatch);
|
|
706
707
|
}
|
|
707
708
|
}
|
|
708
709
|
}
|
|
@@ -710,9 +711,9 @@ var HttpManager = /** @class */ (function () {
|
|
|
710
711
|
if (thePayload) {
|
|
711
712
|
_doPayloadSend(thePayload, serializationStart, getTime(), sendReason);
|
|
712
713
|
}
|
|
713
|
-
if (theBatches
|
|
714
|
+
if (theBatches[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
714
715
|
// Add any unsent batches back to the head of the queue
|
|
715
|
-
_batchQueue = theBatches
|
|
716
|
+
_batchQueue = theBatches[_DYN_CONCAT /* @min:%2econcat */](_batchQueue);
|
|
716
717
|
}
|
|
717
718
|
// Now send notification about any dropped events
|
|
718
719
|
_sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, sendType);
|
|
@@ -736,21 +737,21 @@ var HttpManager = /** @class */ (function () {
|
|
|
736
737
|
}
|
|
737
738
|
else {
|
|
738
739
|
// No mapping, so just include in the headers anyway (may not get sent if using sendBeacon())
|
|
739
|
-
requestDetails
|
|
740
|
-
requestDetails
|
|
740
|
+
requestDetails[_DYN_HDRS /* @min:%2ehdrs */][name] = value;
|
|
741
|
+
requestDetails[_DYN_USE_HDRS /* @min:%2euseHdrs */] = true;
|
|
741
742
|
}
|
|
742
743
|
});
|
|
743
744
|
}
|
|
744
745
|
else {
|
|
745
746
|
// Copy the pre-defined headers into the payload headers
|
|
746
|
-
requestDetails
|
|
747
|
-
requestDetails.useHdrs = (objKeys(requestDetails.hdrs)
|
|
747
|
+
requestDetails[_DYN_HDRS /* @min:%2ehdrs */] = extend(requestDetails[_DYN_HDRS /* @min:%2ehdrs */], _headers);
|
|
748
|
+
requestDetails.useHdrs = (objKeys(requestDetails.hdrs)[_DYN_LENGTH /* @min:%2elength */] > 0);
|
|
748
749
|
}
|
|
749
750
|
_addRequestDetails(requestDetails, STR_CLIENT_ID, "NO_AUTH", useHeaders);
|
|
750
751
|
_addRequestDetails(requestDetails, STR_CLIENT_VERSION, FullVersionString, useHeaders);
|
|
751
752
|
var apiQsKeys = STR_EMPTY;
|
|
752
753
|
arrForEach(thePayload.apiKeys, function (apiKey) {
|
|
753
|
-
if (apiQsKeys
|
|
754
|
+
if (apiQsKeys[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
754
755
|
apiQsKeys += ",";
|
|
755
756
|
}
|
|
756
757
|
apiQsKeys += apiKey;
|
|
@@ -761,16 +762,16 @@ var HttpManager = /** @class */ (function () {
|
|
|
761
762
|
if (isValueAssigned(msfpc)) {
|
|
762
763
|
requestDetails.url += "&ext.intweb.msfpc=" + msfpc;
|
|
763
764
|
}
|
|
764
|
-
if (_clockSkewManager
|
|
765
|
-
_addRequestDetails(requestDetails, STR_TIME_DELTA_TO_APPLY, _clockSkewManager
|
|
765
|
+
if (_clockSkewManager[_DYN_SHOULD_ADD_CLOCK_SKE1 /* @min:%2eshouldAddClockSkewHeaders */]()) {
|
|
766
|
+
_addRequestDetails(requestDetails, STR_TIME_DELTA_TO_APPLY, _clockSkewManager[_DYN_GET_CLOCK_SKEW_HEADE2 /* @min:%2egetClockSkewHeaderValue */](), useHeaders);
|
|
766
767
|
}
|
|
767
|
-
if (_core
|
|
768
|
-
var wParam = _core
|
|
768
|
+
if (_core[_DYN_GET_WPARAM /* @min:%2egetWParam */]) {
|
|
769
|
+
var wParam = _core[_DYN_GET_WPARAM /* @min:%2egetWParam */]();
|
|
769
770
|
if (wParam >= 0) {
|
|
770
771
|
requestDetails.url += "&w=" + wParam;
|
|
771
772
|
}
|
|
772
773
|
}
|
|
773
|
-
for (var i = 0; i < _queryStringParameters
|
|
774
|
+
for (var i = 0; i < _queryStringParameters[_DYN_LENGTH /* @min:%2elength */]; i++) {
|
|
774
775
|
requestDetails.url += "&" + _queryStringParameters[i].name + "=" + _queryStringParameters[i].value;
|
|
775
776
|
}
|
|
776
777
|
return requestDetails;
|
|
@@ -780,30 +781,30 @@ var HttpManager = /** @class */ (function () {
|
|
|
780
781
|
timings[name][_postManager.identifier] = value;
|
|
781
782
|
}
|
|
782
783
|
function _doPayloadSend(thePayload, serializationStart, serializationCompleted, sendReason) {
|
|
783
|
-
if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob
|
|
784
|
+
if (thePayload && thePayload.payloadBlob && thePayload.payloadBlob[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
784
785
|
var useSendHook_1 = !!_sendHook;
|
|
785
786
|
var sendInterface_1 = _sendInterfaces[thePayload.sendType];
|
|
786
787
|
// Send all data using a beacon style transport if closing mode is on or channel was teared down
|
|
787
|
-
if (!_isBeaconPayload(thePayload
|
|
788
|
+
if (!_isBeaconPayload(thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]) && thePayload[_DYN_IS_BEACON /* @min:%2eisBeacon */] && thePayload.sendReason === 2 /* SendRequestReason.Unload */) {
|
|
788
789
|
sendInterface_1 = _sendInterfaces[2 /* EventSendType.SendBeacon */] || _sendInterfaces[3 /* EventSendType.SyncFetch */] || sendInterface_1;
|
|
789
790
|
}
|
|
790
791
|
var useHeaders_1 = _useHeaders;
|
|
791
792
|
// Disable header usage if we know we are using sendBeacon as additional headers are not supported
|
|
792
|
-
if (thePayload.isBeacon || sendInterface_1
|
|
793
|
+
if (thePayload.isBeacon || sendInterface_1[_DYN__TRANSPORT /* @min:%2e_transport */] === 3 /* TransportType.Beacon */) {
|
|
793
794
|
useHeaders_1 = false;
|
|
794
795
|
}
|
|
795
796
|
var requestDetails_1 = _buildRequestDetails(thePayload, useHeaders_1);
|
|
796
|
-
useHeaders_1 = useHeaders_1 || requestDetails_1
|
|
797
|
+
useHeaders_1 = useHeaders_1 || requestDetails_1[_DYN_USE_HDRS /* @min:%2euseHdrs */];
|
|
797
798
|
var sendEventStart_1 = getTime();
|
|
798
799
|
doPerf(_core, function () { return "HttpManager:_doPayloadSend"; }, function () {
|
|
799
800
|
// Increment the send attempt count and add timings after packaging (So it's not serialized in the 1st attempt)
|
|
800
|
-
for (var batchLp = 0; batchLp < thePayload.batches
|
|
801
|
-
var theBatch = thePayload
|
|
802
|
-
var theEvents = theBatch
|
|
803
|
-
for (var evtLp = 0; evtLp < theEvents
|
|
801
|
+
for (var batchLp = 0; batchLp < thePayload.batches[_DYN_LENGTH /* @min:%2elength */]; batchLp++) {
|
|
802
|
+
var theBatch = thePayload[_DYN_BATCHES /* @min:%2ebatches */][batchLp];
|
|
803
|
+
var theEvents = theBatch[_DYN_EVENTS /* @min:%2eevents */]();
|
|
804
|
+
for (var evtLp = 0; evtLp < theEvents[_DYN_LENGTH /* @min:%2elength */]; evtLp++) {
|
|
804
805
|
var telemetryItem = theEvents[evtLp];
|
|
805
806
|
if (_enableEventTimings) {
|
|
806
|
-
var timings = telemetryItem
|
|
807
|
+
var timings = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] = telemetryItem[_DYN_TIMINGS /* @min:%2etimings */] || {};
|
|
807
808
|
_setTimingValue(timings, "sendEventStart", sendEventStart_1);
|
|
808
809
|
_setTimingValue(timings, "serializationStart", serializationStart);
|
|
809
810
|
_setTimingValue(timings, "serializationCompleted", serializationCompleted);
|
|
@@ -812,14 +813,14 @@ var HttpManager = /** @class */ (function () {
|
|
|
812
813
|
}
|
|
813
814
|
}
|
|
814
815
|
// Note: always sending this notification in a synchronous manner.
|
|
815
|
-
_sendBatchesNotification(thePayload
|
|
816
|
-
// Disabling the use of const because of Issue:
|
|
816
|
+
_sendBatchesNotification(thePayload[_DYN_BATCHES /* @min:%2ebatches */], (1000 /* EventBatchNotificationReason.SendingUndefined */ + (sendReason || 0 /* SendRequestReason.Undefined */)), thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);
|
|
817
|
+
// Disabling the use of const because of Issue:
|
|
817
818
|
// - Task 9227844: [1DS] Some environments and packagers automatically "freeze" objects which are defined as const which causes any mutations to throw
|
|
818
819
|
// eslint-disable-next-line prefer-const
|
|
819
820
|
var orgPayloadData = {
|
|
820
821
|
data: thePayload.payloadBlob,
|
|
821
822
|
urlString: requestDetails_1.url,
|
|
822
|
-
headers: requestDetails_1
|
|
823
|
+
headers: requestDetails_1[_DYN_HDRS /* @min:%2ehdrs */],
|
|
823
824
|
_thePayload: thePayload,
|
|
824
825
|
_sendReason: sendReason,
|
|
825
826
|
timeout: _xhrTimeout,
|
|
@@ -828,11 +829,11 @@ var HttpManager = /** @class */ (function () {
|
|
|
828
829
|
};
|
|
829
830
|
// Only automatically add the following headers if already sending headers and we are not attempting to avoid an options call
|
|
830
831
|
if (useHeaders_1) {
|
|
831
|
-
if (!_hasHeader(orgPayloadData
|
|
832
|
-
orgPayloadData
|
|
832
|
+
if (!_hasHeader(orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */], STR_CACHE_CONTROL)) {
|
|
833
|
+
orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */][STR_CACHE_CONTROL] = DEFAULT_CACHE_CONTROL;
|
|
833
834
|
}
|
|
834
|
-
if (!_hasHeader(orgPayloadData
|
|
835
|
-
orgPayloadData
|
|
835
|
+
if (!_hasHeader(orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */], STR_CONTENT_TYPE_HEADER)) {
|
|
836
|
+
orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */][STR_CONTENT_TYPE_HEADER] = DEFAULT_CONTENT_TYPE;
|
|
836
837
|
}
|
|
837
838
|
}
|
|
838
839
|
var sender = null;
|
|
@@ -840,16 +841,16 @@ var HttpManager = /** @class */ (function () {
|
|
|
840
841
|
// Send sync requests if the request is immediate or we are tearing down telemetry.
|
|
841
842
|
sender = function (payload) {
|
|
842
843
|
// Notify the clock skew manager that we are sending the first request (Potentially blocking all further requests)
|
|
843
|
-
_clockSkewManager
|
|
844
|
+
_clockSkewManager[_DYN_FIRST_REQUEST_SENT /* @min:%2efirstRequestSent */]();
|
|
844
845
|
var onComplete = function (status, headers) {
|
|
845
846
|
_retryRequestIfNeeded(status, headers, thePayload, sendReason);
|
|
846
847
|
};
|
|
847
|
-
var isSync = thePayload
|
|
848
|
+
var isSync = thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */] || thePayload[_DYN_IS_SYNC /* @min:%2eisSync */];
|
|
848
849
|
try {
|
|
849
|
-
sendInterface_1
|
|
850
|
+
sendInterface_1[_DYN_SEND_POST /* @min:%2esendPOST */](payload, onComplete, isSync);
|
|
850
851
|
if (_sendListener) {
|
|
851
852
|
// Send the original payload to the listener
|
|
852
|
-
_sendListener(orgPayloadData, payload, isSync, thePayload
|
|
853
|
+
_sendListener(orgPayloadData, payload, isSync, thePayload[_DYN_IS_BEACON /* @min:%2eisBeacon */]);
|
|
853
854
|
}
|
|
854
855
|
}
|
|
855
856
|
catch (ex) {
|
|
@@ -860,23 +861,23 @@ var HttpManager = /** @class */ (function () {
|
|
|
860
861
|
}
|
|
861
862
|
doPerf(_core, function () { return "HttpManager:_doPayloadSend.sender"; }, function () {
|
|
862
863
|
if (sender) {
|
|
863
|
-
if (thePayload
|
|
864
|
+
if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {
|
|
864
865
|
_outstandingRequests++;
|
|
865
866
|
}
|
|
866
867
|
// Only call the hook if it's defined and we are not using sendBeacon as additional headers are not supported
|
|
867
|
-
if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1
|
|
868
|
+
if (useSendHook_1 && !thePayload.isBeacon && sendInterface_1[_DYN__TRANSPORT /* @min:%2e_transport */] !== 3 /* TransportType.Beacon */) {
|
|
868
869
|
// Create a new IPayloadData that is sent into the hook method, so that the hook method
|
|
869
870
|
// can't change the object references to the orgPayloadData (it can still change the content -- mainly the headers)
|
|
870
|
-
// Disabling the use of const because of Issue:
|
|
871
|
+
// Disabling the use of const because of Issue:
|
|
871
872
|
// - Task 9227844: [1DS] Some environments and packagers automatically "freeze" objects which are defined as const which causes any mutations to throw
|
|
872
873
|
// eslint-disable-next-line prefer-const
|
|
873
874
|
var hookData_1 = {
|
|
874
|
-
data: orgPayloadData
|
|
875
|
-
urlString: orgPayloadData
|
|
876
|
-
headers: extend({}, orgPayloadData
|
|
877
|
-
timeout: orgPayloadData
|
|
878
|
-
disableXhrSync: orgPayloadData
|
|
879
|
-
disableFetchKeepAlive: orgPayloadData
|
|
875
|
+
data: orgPayloadData[_DYN_DATA /* @min:%2edata */],
|
|
876
|
+
urlString: orgPayloadData[_DYN_URL_STRING /* @min:%2eurlString */],
|
|
877
|
+
headers: extend({}, orgPayloadData[_DYN_HEADERS /* @min:%2eheaders */]),
|
|
878
|
+
timeout: orgPayloadData[_DYN_TIMEOUT /* @min:%2etimeout */],
|
|
879
|
+
disableXhrSync: orgPayloadData[_DYN_DISABLE_XHR_SYNC /* @min:%2edisableXhrSync */],
|
|
880
|
+
disableFetchKeepAlive: orgPayloadData[_DYN_DISABLE_FETCH_KEEP_A6 /* @min:%2edisableFetchKeepAlive */]
|
|
880
881
|
};
|
|
881
882
|
var senderCalled_1 = false;
|
|
882
883
|
doPerf(_core, function () { return "HttpManager:_doPayloadSend.sendHook"; }, function () {
|
|
@@ -884,12 +885,12 @@ var HttpManager = /** @class */ (function () {
|
|
|
884
885
|
_sendHook(hookData_1, function (payload) {
|
|
885
886
|
senderCalled_1 = true;
|
|
886
887
|
// Add back the internal properties
|
|
887
|
-
if (!_customHttpInterface && !payload
|
|
888
|
-
payload
|
|
889
|
-
payload
|
|
888
|
+
if (!_customHttpInterface && !payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */]) {
|
|
889
|
+
payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */] = payload[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */] || orgPayloadData[_DYN__THE_PAYLOAD /* @min:%2e_thePayload */];
|
|
890
|
+
payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] = payload[_DYN__SEND_REASON /* @min:%2e_sendReason */] || orgPayloadData[_DYN__SEND_REASON /* @min:%2e_sendReason */];
|
|
890
891
|
}
|
|
891
892
|
sender(payload);
|
|
892
|
-
}, thePayload.isSync || thePayload
|
|
893
|
+
}, thePayload.isSync || thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */]);
|
|
893
894
|
}
|
|
894
895
|
catch (ex) {
|
|
895
896
|
if (!senderCalled_1) {
|
|
@@ -904,21 +905,21 @@ var HttpManager = /** @class */ (function () {
|
|
|
904
905
|
}
|
|
905
906
|
}
|
|
906
907
|
});
|
|
907
|
-
}, function () { return ({ thePayload: thePayload, serializationStart: serializationStart, serializationCompleted: serializationCompleted, sendReason: sendReason }); }, thePayload
|
|
908
|
+
}, function () { return ({ thePayload: thePayload, serializationStart: serializationStart, serializationCompleted: serializationCompleted, sendReason: sendReason }); }, thePayload[_DYN_IS_SYNC /* @min:%2eisSync */]);
|
|
908
909
|
}
|
|
909
|
-
if (thePayload.sizeExceed && thePayload.sizeExceed
|
|
910
|
+
if (thePayload.sizeExceed && thePayload.sizeExceed[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
910
911
|
// Ensure that we send any discard events for oversize events even when there was no payload to send
|
|
911
|
-
_sendBatchesNotification(thePayload.sizeExceed, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload
|
|
912
|
+
_sendBatchesNotification(thePayload.sizeExceed, 8003 /* EventBatchNotificationReason.SizeLimitExceeded */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);
|
|
912
913
|
}
|
|
913
|
-
if (thePayload.failedEvts && thePayload.failedEvts
|
|
914
|
+
if (thePayload.failedEvts && thePayload.failedEvts[_DYN_LENGTH /* @min:%2elength */] > 0) {
|
|
914
915
|
// Ensure that we send any discard events for events that could not be serialized even when there was no payload to send
|
|
915
|
-
_sendBatchesNotification(thePayload.failedEvts, 8002 /* EventBatchNotificationReason.InvalidEvent */, thePayload
|
|
916
|
+
_sendBatchesNotification(thePayload.failedEvts, 8002 /* EventBatchNotificationReason.InvalidEvent */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);
|
|
916
917
|
}
|
|
917
918
|
}
|
|
918
919
|
function _addEventCompletedTimings(theEvents, sendEventCompleted) {
|
|
919
920
|
if (_enableEventTimings) {
|
|
920
921
|
arrForEach(theEvents, function (theEvent) {
|
|
921
|
-
var timings = theEvent
|
|
922
|
+
var timings = theEvent[_DYN_TIMINGS /* @min:%2etimings */] = theEvent[_DYN_TIMINGS /* @min:%2etimings */] || {};
|
|
922
923
|
_setTimingValue(timings, "sendEventCompleted", sendEventCompleted);
|
|
923
924
|
});
|
|
924
925
|
}
|
|
@@ -932,18 +933,18 @@ var HttpManager = /** @class */ (function () {
|
|
|
932
933
|
var shouldRetry = true;
|
|
933
934
|
if (typeof status !== strUndefined) {
|
|
934
935
|
if (headers) {
|
|
935
|
-
_clockSkewManager
|
|
936
|
+
_clockSkewManager[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */](headers[STR_TIME_DELTA_HEADER]);
|
|
936
937
|
var killDuration = headers[STR_KILL_DURATION_HEADER] || headers["kill-duration-seconds"];
|
|
937
|
-
arrForEach(_killSwitch
|
|
938
|
-
arrForEach(thePayload
|
|
939
|
-
if (theBatch
|
|
938
|
+
arrForEach(_killSwitch[_DYN_SET_KILL_SWITCH_TENA10 /* @min:%2esetKillSwitchTenants */](headers[STR_KILL_TOKENS_HEADER], killDuration), function (killToken) {
|
|
939
|
+
arrForEach(thePayload[_DYN_BATCHES /* @min:%2ebatches */], function (theBatch) {
|
|
940
|
+
if (theBatch[_DYN_I_KEY /* @min:%2eiKey */]() === killToken) {
|
|
940
941
|
// Make sure we have initialized the array
|
|
941
942
|
droppedBatches = droppedBatches || [];
|
|
942
943
|
// Create a copy of the batch with all of the events (and more importantly the action functions)
|
|
943
|
-
var removedEvents = theBatch
|
|
944
|
+
var removedEvents = theBatch[_DYN_SPLIT /* @min:%2esplit */](0);
|
|
944
945
|
// And then remove the events for the payload batch and reduce the actual number of processed
|
|
945
|
-
thePayload.numEvents -= removedEvents
|
|
946
|
-
droppedBatches
|
|
946
|
+
thePayload.numEvents -= removedEvents[_DYN_COUNT /* @min:%2ecount */]();
|
|
947
|
+
droppedBatches[_DYN_PUSH /* @min:%2epush */](removedEvents);
|
|
947
948
|
}
|
|
948
949
|
});
|
|
949
950
|
});
|
|
@@ -966,19 +967,19 @@ var HttpManager = /** @class */ (function () {
|
|
|
966
967
|
// The events should be retried -- so change notification to requeue them
|
|
967
968
|
reason = 100 /* EventBatchNotificationReason.RequeueEvents */;
|
|
968
969
|
var retryCount_1 = thePayload.retryCnt;
|
|
969
|
-
if (thePayload
|
|
970
|
+
if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {
|
|
970
971
|
// attempt to resend the entire batch
|
|
971
972
|
if (retryCount_1 < maxRequestRetriesBeforeBackoff) {
|
|
972
973
|
isRetrying = true;
|
|
973
974
|
_doAction(function () {
|
|
974
975
|
// try to resend the same batches
|
|
975
|
-
if (thePayload
|
|
976
|
+
if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {
|
|
976
977
|
// Reduce the outstanding request count (if this was an async request) as we didn't reduce the count
|
|
977
978
|
// previously and we are about to reschedule our retry attempt and we want an attempt to send
|
|
978
979
|
// to occur, it's also required to ensure that a follow up handleRequestFinished() call occurs
|
|
979
980
|
_outstandingRequests--;
|
|
980
981
|
}
|
|
981
|
-
_sendBatches(thePayload
|
|
982
|
+
_sendBatches(thePayload[_DYN_BATCHES /* @min:%2ebatches */], retryCount_1 + 1, thePayload[_DYN_IS_TEARDOWN /* @min:%2eisTeardown */], _isUnloading ? 2 /* EventSendType.SendBeacon */ : thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], 5 /* SendRequestReason.Retry */);
|
|
982
983
|
}, _isUnloading, retryPolicyGetMillisToBackoffForRetry(retryCount_1));
|
|
983
984
|
}
|
|
984
985
|
else {
|
|
@@ -996,39 +997,39 @@ var HttpManager = /** @class */ (function () {
|
|
|
996
997
|
if (!isRetrying) {
|
|
997
998
|
// Make sure the clockSkewManager doesn't blocking further sending of requests once we have a proper response
|
|
998
999
|
// This won't override any previously sent clock Skew value
|
|
999
|
-
_clockSkewManager
|
|
1000
|
+
_clockSkewManager[_DYN_SET_CLOCK_SKEW /* @min:%2esetClockSkew */]();
|
|
1000
1001
|
_handleRequestFinished(thePayload, reason, sendReason, backOffTrans);
|
|
1001
1002
|
}
|
|
1002
|
-
_sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, thePayload
|
|
1003
|
+
_sendBatchesNotification(droppedBatches, 8004 /* EventBatchNotificationReason.KillSwitch */, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */]);
|
|
1003
1004
|
}
|
|
1004
1005
|
}
|
|
1005
1006
|
function _handleRequestFinished(thePayload, batchReason, sendReason, backOffTrans) {
|
|
1006
1007
|
try {
|
|
1007
1008
|
if (backOffTrans) {
|
|
1008
1009
|
// Slow down the transmission requests
|
|
1009
|
-
_postManager
|
|
1010
|
+
_postManager[_DYN__BACK_OFF_TRANSMISSI11 /* @min:%2e_backOffTransmission */]();
|
|
1010
1011
|
}
|
|
1011
1012
|
if (batchReason === 200 /* EventBatchNotificationReason.Complete */) {
|
|
1012
|
-
if (!backOffTrans && !thePayload
|
|
1013
|
+
if (!backOffTrans && !thePayload[_DYN_IS_SYNC /* @min:%2eisSync */]) {
|
|
1013
1014
|
// We have a successful async response, so the lets open the floodgates
|
|
1014
1015
|
// The reason for checking isSync is to avoid unblocking if beacon send occurred as it
|
|
1015
1016
|
// doesn't wait for a response.
|
|
1016
1017
|
_postManager._clearBackOff();
|
|
1017
1018
|
}
|
|
1018
|
-
_addCompleteTimings(thePayload
|
|
1019
|
+
_addCompleteTimings(thePayload[_DYN_BATCHES /* @min:%2ebatches */]);
|
|
1019
1020
|
}
|
|
1020
1021
|
// Send the notifications synchronously
|
|
1021
|
-
_sendBatchesNotification(thePayload
|
|
1022
|
+
_sendBatchesNotification(thePayload[_DYN_BATCHES /* @min:%2ebatches */], batchReason, thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], true);
|
|
1022
1023
|
}
|
|
1023
1024
|
finally {
|
|
1024
|
-
if (thePayload
|
|
1025
|
+
if (thePayload[_DYN_SEND_TYPE /* @min:%2esendType */] === 0 /* EventSendType.Batched */) {
|
|
1025
1026
|
// we always need to decrement this value otherwise the httpmanager locks up and won't send any more events
|
|
1026
1027
|
_outstandingRequests--;
|
|
1027
1028
|
// Don't try to send additional queued events if this is a retry operation as the retried
|
|
1028
1029
|
// response will eventually call _handleRequestFinished for the retried event
|
|
1029
1030
|
if (sendReason !== 5 /* SendRequestReason.Retry */) {
|
|
1030
1031
|
// Try and send any other queued batched events
|
|
1031
|
-
_self.sendQueuedRequests(thePayload
|
|
1032
|
+
_self.sendQueuedRequests(thePayload[_DYN_SEND_TYPE /* @min:%2esendType */], sendReason);
|
|
1032
1033
|
}
|
|
1033
1034
|
}
|
|
1034
1035
|
}
|
|
@@ -1037,8 +1038,8 @@ var HttpManager = /** @class */ (function () {
|
|
|
1037
1038
|
if (_enableEventTimings) {
|
|
1038
1039
|
var sendEventCompleted_1 = getTime();
|
|
1039
1040
|
arrForEach(theBatches, function (theBatch) {
|
|
1040
|
-
if (theBatch && theBatch
|
|
1041
|
-
_addEventCompletedTimings(theBatch
|
|
1041
|
+
if (theBatch && theBatch[_DYN_COUNT /* @min:%2ecount */]() > 0) {
|
|
1042
|
+
_addEventCompletedTimings(theBatch[_DYN_EVENTS /* @min:%2eevents */](), sendEventCompleted_1);
|
|
1042
1043
|
}
|
|
1043
1044
|
});
|
|
1044
1045
|
}
|
|
@@ -1058,13 +1059,13 @@ var HttpManager = /** @class */ (function () {
|
|
|
1058
1059
|
function _convertAllHeadersToMap(headersString) {
|
|
1059
1060
|
var headers = {};
|
|
1060
1061
|
if (isString(headersString)) {
|
|
1061
|
-
var headersArray = strTrim(headersString)
|
|
1062
|
+
var headersArray = strTrim(headersString)[_DYN_SPLIT /* @min:%2esplit */](/[\r\n]+/);
|
|
1062
1063
|
arrForEach(headersArray, function (headerEntry) {
|
|
1063
1064
|
if (headerEntry) {
|
|
1064
1065
|
var idx = headerEntry.indexOf(": ");
|
|
1065
1066
|
if (idx !== -1) {
|
|
1066
1067
|
// The new spec has the headers returning all as lowercase -- but not all browsers do this yet
|
|
1067
|
-
var header = strTrim(headerEntry.substring(0, idx))
|
|
1068
|
+
var header = strTrim(headerEntry.substring(0, idx))[_DYN_TO_LOWER_CASE /* @min:%2etoLowerCase */]();
|
|
1068
1069
|
var value = strTrim(headerEntry.substring(idx + 1));
|
|
1069
1070
|
headers[header] = value;
|
|
1070
1071
|
}
|
|
@@ -1077,8 +1078,8 @@ var HttpManager = /** @class */ (function () {
|
|
|
1077
1078
|
return headers;
|
|
1078
1079
|
}
|
|
1079
1080
|
function _getMsfpc(thePayload) {
|
|
1080
|
-
for (var lp = 0; lp < thePayload.batches
|
|
1081
|
-
var msfpc = thePayload
|
|
1081
|
+
for (var lp = 0; lp < thePayload.batches[_DYN_LENGTH /* @min:%2elength */]; lp++) {
|
|
1082
|
+
var msfpc = thePayload[_DYN_BATCHES /* @min:%2ebatches */][lp].Msfpc();
|
|
1082
1083
|
if (msfpc) {
|
|
1083
1084
|
return encodeURIComponent(msfpc);
|
|
1084
1085
|
}
|
|
@@ -1088,7 +1089,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
1088
1089
|
function _handleCollectorResponse(responseText) {
|
|
1089
1090
|
var responseHandlers = _responseHandlers;
|
|
1090
1091
|
try {
|
|
1091
|
-
for (var i = 0; i < responseHandlers
|
|
1092
|
+
for (var i = 0; i < responseHandlers[_DYN_LENGTH /* @min:%2elength */]; i++) {
|
|
1092
1093
|
try {
|
|
1093
1094
|
responseHandlers[i](responseText);
|
|
1094
1095
|
}
|
|
@@ -1109,7 +1110,7 @@ var HttpManager = /** @class */ (function () {
|
|
|
1109
1110
|
}
|
|
1110
1111
|
}
|
|
1111
1112
|
function _sendBatchesNotification(theBatches, batchReason, sendType, sendSync) {
|
|
1112
|
-
if (theBatches && theBatches
|
|
1113
|
+
if (theBatches && theBatches[_DYN_LENGTH /* @min:%2elength */] > 0 && actions) {
|
|
1113
1114
|
var theAction_1 = actions[_getNotificationAction(batchReason)];
|
|
1114
1115
|
if (theAction_1) {
|
|
1115
1116
|
var isSyncRequest_1 = sendType !== 0 /* EventSendType.Batched */;
|
|
@@ -1156,9 +1157,8 @@ var HttpManager = /** @class */ (function () {
|
|
|
1156
1157
|
// Removed Stub for HttpManager.prototype.pause.
|
|
1157
1158
|
// Removed Stub for HttpManager.prototype.resume.
|
|
1158
1159
|
// Removed Stub for HttpManager.prototype.sendSynchronousBatch.
|
|
1159
|
-
// This is a workaround for an
|
|
1160
|
+
// This is a workaround for an IE bug when using dynamicProto() with classes that don't have any
|
|
1160
1161
|
// non-dynamic functions or static properties/functions when using uglify-js to minify the resulting code.
|
|
1161
|
-
// this will be removed when ES3 support is dropped.
|
|
1162
1162
|
HttpManager.__ieDyn=1;
|
|
1163
1163
|
|
|
1164
1164
|
return HttpManager;
|