@microsoft/1ds-post-js 3.2.6 → 3.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +5 -1
  2. package/bundle/{ms.post-3.2.6.gbl.js → ms.post-3.2.8.gbl.js} +132 -85
  3. package/bundle/ms.post-3.2.8.gbl.js.map +1 -0
  4. package/bundle/ms.post-3.2.8.gbl.min.js +7 -0
  5. package/bundle/ms.post-3.2.8.gbl.min.js.map +1 -0
  6. package/bundle/ms.post-3.2.8.integrity.json +46 -0
  7. package/bundle/{ms.post-3.2.6.js → ms.post-3.2.8.js} +132 -85
  8. package/bundle/ms.post-3.2.8.js.map +1 -0
  9. package/bundle/ms.post-3.2.8.min.js +7 -0
  10. package/bundle/ms.post-3.2.8.min.js.map +1 -0
  11. package/bundle/ms.post.gbl.js +131 -84
  12. package/bundle/ms.post.gbl.js.map +1 -1
  13. package/bundle/ms.post.gbl.min.js +2 -2
  14. package/bundle/ms.post.gbl.min.js.map +1 -1
  15. package/bundle/ms.post.integrity.json +17 -17
  16. package/bundle/ms.post.js +131 -84
  17. package/bundle/ms.post.js.map +1 -1
  18. package/bundle/ms.post.min.js +2 -2
  19. package/bundle/ms.post.min.js.map +1 -1
  20. package/dist/ms.post.js +56 -37
  21. package/dist/ms.post.js.map +1 -1
  22. package/dist/ms.post.min.js +2 -2
  23. package/dist/ms.post.min.js.map +1 -1
  24. package/dist-esm/src/BatchNotificationActions.js +1 -1
  25. package/dist-esm/src/ClockSkewManager.js +1 -1
  26. package/dist-esm/src/DataModels.d.ts +24 -3
  27. package/dist-esm/src/DataModels.js +1 -1
  28. package/dist-esm/src/EventBatch.js +3 -3
  29. package/dist-esm/src/EventBatch.js.map +1 -1
  30. package/dist-esm/src/HttpManager.js +51 -32
  31. package/dist-esm/src/HttpManager.js.map +1 -1
  32. package/dist-esm/src/Index.js +1 -1
  33. package/dist-esm/src/InternalConstants.d.ts +1 -0
  34. package/dist-esm/src/InternalConstants.js +2 -1
  35. package/dist-esm/src/InternalConstants.js.map +1 -1
  36. package/dist-esm/src/KillSwitch.js +1 -1
  37. package/dist-esm/src/PostChannel.js +3 -3
  38. package/dist-esm/src/PostChannel.js.map +1 -1
  39. package/dist-esm/src/RetryPolicy.js +1 -1
  40. package/dist-esm/src/Serializer.d.ts +3 -3
  41. package/dist-esm/src/Serializer.js +5 -4
  42. package/dist-esm/src/Serializer.js.map +1 -1
  43. package/dist-esm/src/TimeoutOverrideWrapper.js +1 -1
  44. package/dist-esm/src/typings/XDomainRequest.js +1 -1
  45. package/package.json +4 -4
  46. package/src/DataModels.ts +26 -1
  47. package/src/EventBatch.ts +2 -2
  48. package/src/HttpManager.ts +59 -34
  49. package/src/InternalConstants.ts +1 -0
  50. package/src/PostChannel.ts +1 -1
  51. package/src/Serializer.ts +12 -11
  52. package/bundle/ms.post-3.2.6.gbl.js.map +0 -1
  53. package/bundle/ms.post-3.2.6.gbl.min.js +0 -7
  54. package/bundle/ms.post-3.2.6.gbl.min.js.map +0 -1
  55. package/bundle/ms.post-3.2.6.integrity.json +0 -46
  56. package/bundle/ms.post-3.2.6.js.map +0 -1
  57. package/bundle/ms.post-3.2.6.min.js +0 -7
  58. package/bundle/ms.post-3.2.6.min.js.map +0 -1
package/README.md CHANGED
@@ -15,7 +15,7 @@ ms.reviewedBy: ramthi
15
15
 
16
16
  ## npm
17
17
 
18
- Packages available [here](https://msasg.visualstudio.com/Shared%20Data/_artifacts/feed/1DS-SDK/Npm/%40microsoft%2F1ds-post-js/overview/3.2.6).
18
+ Packages available [here](https://msasg.visualstudio.com/Shared%20Data/_artifacts/feed/1DS-SDK/Npm/%40microsoft%2F1ds-post-js/overview/3.2.8).
19
19
 
20
20
  ## Basic Usage
21
21
 
@@ -66,12 +66,16 @@ appInsightsCore.initialize(coreConfig, []);
66
66
  | enableCompoundKey | [Optional] Enables support for objects with compound keys which indirectly represent an object eg. event: { "somedata.embeddedvalue": 123 } where the "key" of the object contains a "." as part of it's name. Defaults to false. | boolean
67
67
  | disableOptimizeObj | [Optional] Switch to disable the v8 `optimizeObject()` calls used to provide better serialization performance. Defaults to false. | boolean
68
68
  | transports | [Optional] Either an array or single value identifying the requested `TransportType` (const enum) type that should be used. This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride is provided. | number or number[]
69
+ | useSendBeacon | [Optional] A flag to enable or disable the usage of the sendBeacon() API if available by the runtime. If running on ReactNative this defaults to `false` for all other cases it defaults to `true`.
70
+ | disableFetchKeepAlive | [Optional] A flag to disable the usage of the [fetch with keep-alive](https://javascript.info/fetch-api#keepalive) support.
71
+ | unloadTransports | [Optional] Either an array or single value identifying the requested TransportType type(s) that should be used during unload or events marked as sendBeacon. This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride is provided and alwaysUseXhrOverride is true.
69
72
  | avoidOptions<br/><sub><i>(Since 3.1.10+)</i></sub><br /><sub>Default: false (Since 3.2.0)<br />Previously true</sub> | [Optional] Avoid adding request headers to the outgoing request that would cause a pre-flight (OPTIONS) request to be sent for each request. | boolean
70
73
  | xhrTimeout<br/><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Specify a timeout (in ms) to apply to requests when sending requests using XHR or fetch() requests only, does not affect sendBeacon() or XDR (XDomainRequest) usage. Defaults to undefined and therefore the runtime defaults (normally zero for browser environments) | number
71
74
  | disableXhrSync<br/><sub><i>(Since 3.1.11+)</i></sub> | [Optional] When using [Xhr](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) for sending requests disable sending as synchronous during unload or synchronous flush. __You should enable this feature for IE (when there is no sendBeacon() or fetch (with keep-alive) support) and you have clients that end up blocking the UI during page unloading__. <span style="color:red">This will cause ALL XHR requests to be sent asynchronously which during page unload may result in the lose of telemetry</span>. This does not affect any other request type (fetch(), sendBeacon() or XDR (XDomainRequest)) | boolean<br/>Default: undefined
72
75
  | alwaysUseXhrOverride<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] By default during unload (or when you specify to use sendBeacon() or sync fetch (with keep-alive) for an event) the SDK ignores any provided httpXhrOverride and attempts to use sendBeacon() or fetch(with keep-alive) when they are available. When this configuration option is true any provided httpXhrOverride will always be used, so any provided httpXhrOverride will also need to "handle" the synchronous unload scenario. | boolean<br /> Default: false
73
76
  | maxEventRetryAttempts<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retirable) response, this causes the event to be internally "requeued" and resent in the next batch. As each normal batched send request is retried at least once before starting to increase the internal backoff send interval, normally batched events will generally be attempted the next nearest even number of times. This means that the total number of actual send attempts will almost always be even (setting to 5 will cause 6 requests), unless using manual synchronous flushing (calling flush(false)) which is not subject to request level retry attempts. | number<br/>Default: 6
74
77
  | maxUnloadEventRetryAttempts<br /><sub><i>(Since 3.1.11+)</i></sub> | [Optional] Identifies the number of times any single event will be retried if it receives a failed (retriable) response as part of processing / flushing events once a page unload state has been detected, this causes the event to be internally "requeued" and resent in the next batch, which during page unload. Unlike the normal batching process, send requests are never retried, so the value listed here is always the maximum number of attempts for any single event.<br/>Notes: The SDK by default will use the sendBeacon() API if it exists which is treated as a fire and forget successful response, so for environments that support or supply this API the events won't be retried (because they will be deeded to be successfully sent). When an environment (IE) doesn't support sendBeacon(), this will cause multiple synchronous (by default) XMLHttpRequests to be sent, which will block the UI until a response is received. You can disable ALL synchronous XHR requests by setting the 'disableXhrSync' configuration setting and/or changing this value to 0 or 1. | number<br/>Default: 2
78
+ | addNoResponse <br /><sub><i>(Since 3.2.8+)</i></sub> | [Optional] flag to indicate whether the sendBeacon and fetch (with keep-alive flag) should add the "NoResponseBody" query string value to indicate that the server should return a 204 for successful requests. | boolean<br/>Default: true
75
79
 
76
80
  ### [IXHROverride](https://1dsdocs.azurewebsites.net/api/webSDK/chnl/post/3.0/f/interfaces/ixhroverride.html)
77
81
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK POST plugin, 3.2.6
2
+ * 1DS JS SDK POST plugin, 3.2.8
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -21,21 +21,23 @@
21
21
  var _cachedGlobal = null;
22
22
  function getGlobal(useCached) {
23
23
  if (useCached === void 0) { useCached = true; }
24
- if (!_cachedGlobal || !useCached) {
25
- if (typeof globalThis !== strShimUndefined && globalThis) {
26
- _cachedGlobal = globalThis;
24
+ var result = useCached === false ? null : _cachedGlobal;
25
+ if (!result) {
26
+ if (typeof globalThis !== strShimUndefined) {
27
+ result = globalThis;
27
28
  }
28
- if (typeof self !== strShimUndefined && self) {
29
- _cachedGlobal = self;
29
+ if (!result && typeof self !== strShimUndefined) {
30
+ result = self;
30
31
  }
31
- if (typeof window !== strShimUndefined && window) {
32
- _cachedGlobal = window;
32
+ if (!result && typeof window !== strShimUndefined) {
33
+ result = window;
33
34
  }
34
- if (typeof global !== strShimUndefined && global) {
35
- _cachedGlobal = global;
35
+ if (!result && typeof global !== strShimUndefined) {
36
+ result = global;
36
37
  }
38
+ _cachedGlobal = result;
37
39
  }
38
- return _cachedGlobal;
40
+ return result;
39
41
  }
40
42
  function throwTypeError(message) {
41
43
  throw new TypeError(message);
@@ -61,7 +63,9 @@
61
63
  (getGlobal() || {})["Reflect"];
62
64
  var extendStaticsFn = function (d, b) {
63
65
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
64
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
66
+ ({ __proto__: [] } instanceof Array && function (d, b) {
67
+ d.__proto__ = b;
68
+ }) ||
65
69
  function (d, b) {
66
70
  for (var p in b) {
67
71
  if (b[strShimHasOwnProperty](p)) {
@@ -76,14 +80,18 @@
76
80
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
77
81
  }
78
82
  extendStaticsFn(d, b);
79
- function __() { this.constructor = d; }
83
+ function __() {
84
+ this.constructor = d;
85
+ }
80
86
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
81
87
  }
82
88
 
83
89
  /*!
84
- * Microsoft Dynamic Proto Utility, 1.1.6
90
+ * Microsoft Dynamic Proto Utility, 1.1.7
85
91
  * Copyright (c) Microsoft and contributors. All rights reserved.
86
92
  */
93
+ var _a$2;
94
+ var UNDEFINED = "undefined";
87
95
  var Constructor = 'constructor';
88
96
  var Prototype = 'prototype';
89
97
  var strFunction = 'function';
@@ -97,13 +105,37 @@
97
105
  var UnknownValue = '_unknown_';
98
106
  var str__Proto$1 = "__proto__";
99
107
  var DynProtoBaseProto = "_dyn" + str__Proto$1;
108
+ var DynProtoGlobalSettings = "__dynProto$Gbl";
100
109
  var DynProtoCurrent = "_dynInstProto";
101
110
  var strUseBaseInst = 'useBaseInst';
102
111
  var strSetInstFuncs = 'setInstFuncs';
103
112
  var Obj = Object;
104
113
  var _objGetPrototypeOf$1 = Obj["getPrototypeOf"];
105
114
  var _objGetOwnProps = Obj["getOwnPropertyNames"];
106
- var _dynamicNames = 0;
115
+ function _getGlobal() {
116
+ var result;
117
+ if (typeof globalThis !== UNDEFINED) {
118
+ result = globalThis;
119
+ }
120
+ if (!result && typeof self !== UNDEFINED) {
121
+ result = self;
122
+ }
123
+ if (!result && typeof window !== UNDEFINED) {
124
+ result = window;
125
+ }
126
+ if (!result && typeof global !== UNDEFINED) {
127
+ result = global;
128
+ }
129
+ return result || {};
130
+ }
131
+ var _gbl = _getGlobal();
132
+ var _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {
133
+ o: (_a$2 = {},
134
+ _a$2[strSetInstFuncs] = true,
135
+ _a$2[strUseBaseInst] = true,
136
+ _a$2),
137
+ n: 1000
138
+ });
107
139
  function _hasOwnProperty(obj, prop) {
108
140
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
109
141
  }
@@ -297,15 +329,15 @@
297
329
  }
298
330
  var classProto = theClass[Prototype];
299
331
  if (!_checkPrototype(classProto, target)) {
300
- _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
332
+ _throwTypeError("[" + _getObjName(theClass) + "] not in hierarchy of [" + _getObjName(target) + "]");
301
333
  }
302
334
  var className = null;
303
335
  if (_hasOwnProperty(classProto, DynClassName)) {
304
336
  className = classProto[DynClassName];
305
337
  }
306
338
  else {
307
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
308
- _dynamicNames++;
339
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _gblInst.n;
340
+ _gblInst.n++;
309
341
  classProto[DynClassName] = className;
310
342
  }
311
343
  var perfOptions = dynamicProto[DynProtoDefaultOptions];
@@ -322,11 +354,7 @@
322
354
  }
323
355
  _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
324
356
  }
325
- var perfDefaults = {
326
- setInstFuncs: true,
327
- useBaseInst: true
328
- };
329
- dynamicProto[DynProtoDefaultOptions] = perfDefaults;
357
+ dynamicProto[DynProtoDefaultOptions] = _gblInst.o;
330
358
 
331
359
  var _DYN_INITIALIZE = "initialize";
332
360
  var _DYN_NAME = "name";
@@ -368,7 +396,7 @@
368
396
  var _DYN_SET_CTX = "setCtx";
369
397
  var _DYN_COMPLETE = "complete";
370
398
 
371
- var STR_EMPTY$1 = "";
399
+ var STR_EMPTY$2 = "";
372
400
  var STR_CORE = "core";
373
401
  var STR_DISABLED = "disabled";
374
402
  var STR_EXTENSION_CONFIG = "extensionConfig";
@@ -537,7 +565,7 @@
537
565
  }
538
566
  function strTrim(str) {
539
567
  if (str) {
540
- str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|\s+$/g, STR_EMPTY$1) : str);
568
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|(?=\s)\s+$/g, STR_EMPTY$2) : str);
541
569
  }
542
570
  return str;
543
571
  }
@@ -850,14 +878,14 @@
850
878
  var nav = getNavigator();
851
879
  if (nav && (nav[_DYN_USER_AGENT ] !== _navUserAgentCheck || _isTrident === null)) {
852
880
  _navUserAgentCheck = nav[_DYN_USER_AGENT ];
853
- var userAgent = (_navUserAgentCheck || STR_EMPTY$1)[_DYN_TO_LOWER_CASE ]();
881
+ var userAgent = (_navUserAgentCheck || STR_EMPTY$2)[_DYN_TO_LOWER_CASE ]();
854
882
  _isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
855
883
  }
856
884
  return _isTrident;
857
885
  }
858
886
  function dumpObj(object) {
859
887
  var objectTypeDump = Object[strShimPrototype].toString[_DYN_CALL ](object);
860
- var propertyValueDump = STR_EMPTY$1;
888
+ var propertyValueDump = STR_EMPTY$2;
861
889
  if (objectTypeDump === "[object Error]") {
862
890
  propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object[_DYN_NAME ] + "'";
863
891
  }
@@ -926,9 +954,9 @@
926
954
  var AIInternalMessagePrefix = "AITR_";
927
955
  function _sanitizeDiagnosticText(text) {
928
956
  if (text) {
929
- return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$1) + "\"";
957
+ return "\"" + text[_DYN_REPLACE ](/\"/g, STR_EMPTY$2) + "\"";
930
958
  }
931
- return STR_EMPTY$1;
959
+ return STR_EMPTY$2;
932
960
  }
933
961
  function _logToConsole(func, message) {
934
962
  var theConsole = getConsole();
@@ -950,12 +978,12 @@
950
978
  _self[_DYN_MESSAGE ] =
951
979
  (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
952
980
  msgId;
953
- var strProps = STR_EMPTY$1;
981
+ var strProps = STR_EMPTY$2;
954
982
  if (hasJSON()) {
955
983
  strProps = getJSON().stringify(properties);
956
984
  }
957
- var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$1) +
958
- (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$1);
985
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : STR_EMPTY$2) +
986
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : STR_EMPTY$2);
959
987
  _self[_DYN_MESSAGE ] += diagnosticText;
960
988
  }
961
989
  _InternalLogMessage.dataType = "MessageData";
@@ -1252,7 +1280,7 @@
1252
1280
  var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1253
1281
  var number = random32() >>> 0;
1254
1282
  var chars = 0;
1255
- var result = STR_EMPTY$1;
1283
+ var result = STR_EMPTY$2;
1256
1284
  while (result[_DYN_LENGTH ] < maxLength) {
1257
1285
  chars++;
1258
1286
  result += base64chars.charAt(number & 0x3F);
@@ -1266,7 +1294,7 @@
1266
1294
  }
1267
1295
 
1268
1296
  var _objDefineProperty = ObjDefineProperty;
1269
- var version = '2.8.6';
1297
+ var version = '2.8.9';
1270
1298
  var instanceName = "." + newId(6);
1271
1299
  var _dataUid = 0;
1272
1300
  function _createAccessor(target, prop, value) {
@@ -1305,11 +1333,11 @@
1305
1333
  }
1306
1334
  function createUniqueNamespace(name, includeVersion) {
1307
1335
  if (includeVersion === void 0) { includeVersion = false; }
1308
- return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY$1) + instanceName);
1336
+ return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : STR_EMPTY$2) + instanceName);
1309
1337
  }
1310
1338
  function createElmNodeData(name) {
1311
1339
  var data = {
1312
- id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY$1) + "." + version),
1340
+ id: createUniqueNamespace("_aiData-" + (name || STR_EMPTY$2) + "." + version),
1313
1341
  accept: function (target) {
1314
1342
  return _canAcceptData(target);
1315
1343
  },
@@ -1357,16 +1385,16 @@
1357
1385
  var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1358
1386
  function _normalizeNamespace(name) {
1359
1387
  if (name && name[_DYN_REPLACE ]) {
1360
- return name.replace(/^\s*\.*|\.*\s*$/g, STR_EMPTY$1);
1388
+ return name[_DYN_REPLACE ](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g, STR_EMPTY$2);
1361
1389
  }
1362
1390
  return name;
1363
1391
  }
1364
1392
  function _getEvtNamespace(eventName, evtNamespace) {
1365
1393
  var _a;
1366
1394
  if (evtNamespace) {
1367
- var theNamespace_1 = STR_EMPTY$1;
1395
+ var theNamespace_1 = STR_EMPTY$2;
1368
1396
  if (isArray(evtNamespace)) {
1369
- theNamespace_1 = STR_EMPTY$1;
1397
+ theNamespace_1 = STR_EMPTY$2;
1370
1398
  arrForEach(evtNamespace, function (name) {
1371
1399
  name = _normalizeNamespace(name);
1372
1400
  if (name) {
@@ -1384,13 +1412,13 @@
1384
1412
  if (theNamespace_1[0] !== ".") {
1385
1413
  theNamespace_1 = "." + theNamespace_1;
1386
1414
  }
1387
- eventName = (eventName || STR_EMPTY$1) + theNamespace_1;
1415
+ eventName = (eventName || STR_EMPTY$2) + theNamespace_1;
1388
1416
  }
1389
1417
  }
1390
- var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY$1) || []);
1418
+ var parsedEvent = (eventNamespace.exec(eventName || STR_EMPTY$2) || []);
1391
1419
  return _a = {},
1392
1420
  _a[_DYN_TYPE ] = parsedEvent[1],
1393
- _a.ns = ((parsedEvent[2] || STR_EMPTY$1).replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, STR_EMPTY$1)[_DYN_SPLIT ](".").sort()).join("."),
1421
+ _a.ns = ((parsedEvent[2] || STR_EMPTY$2).replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, STR_EMPTY$2)[_DYN_SPLIT ](".").sort()).join("."),
1394
1422
  _a;
1395
1423
  }
1396
1424
  function _getRegisteredEvents(target, evtName, addDefault) {
@@ -1900,7 +1928,7 @@
1900
1928
  doPerf(itemCtx[STR_CORE ](), function () { return identifier + ":" + name; }, function () {
1901
1929
  hasRunContext[chainId] = true;
1902
1930
  try {
1903
- var nextId = nextProxy ? nextProxy._id : STR_EMPTY$1;
1931
+ var nextId = nextProxy ? nextProxy._id : STR_EMPTY$2;
1904
1932
  if (nextId) {
1905
1933
  hasRunContext[nextId] = false;
1906
1934
  }
@@ -2156,10 +2184,10 @@
2156
2184
  return BaseTelemetryPlugin;
2157
2185
  }());
2158
2186
 
2159
- var STR_EMPTY = "";
2187
+ var STR_EMPTY$1 = "";
2160
2188
 
2161
2189
  var _a$1;
2162
- var Version = '3.2.6';
2190
+ var Version = '3.2.8';
2163
2191
  var FullVersionString = "1DS-Web-JS-" + Version;
2164
2192
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2165
2193
  var strWithCredentials = "withCredentials";
@@ -2176,7 +2204,7 @@
2176
2204
  Boolean(getDocument());
2177
2205
  Boolean(getWindow());
2178
2206
  function isValueAssigned(value) {
2179
- return !(value === STR_EMPTY || isNullOrUndefined(value));
2207
+ return !(value === STR_EMPTY$1 || isNullOrUndefined(value));
2180
2208
  }
2181
2209
  function getTenantId(apiKey) {
2182
2210
  if (apiKey) {
@@ -2185,7 +2213,7 @@
2185
2213
  return apiKey.substring(0, indexTenantId);
2186
2214
  }
2187
2215
  }
2188
- return STR_EMPTY;
2216
+ return STR_EMPTY$1;
2189
2217
  }
2190
2218
  function sanitizeProperty(name, property, stringifyObjects) {
2191
2219
  if ((!property && !isValueAssigned(property)) || typeof name !== "string") {
@@ -2199,7 +2227,7 @@
2199
2227
  property = { value: stringifyObjects ? JSON.stringify(property) : property };
2200
2228
  }
2201
2229
  else if (isNullOrUndefined(property.value)
2202
- || property.value === STR_EMPTY || (!isString(property.value)
2230
+ || property.value === STR_EMPTY$1 || (!isString(property.value)
2203
2231
  && !isNumber(property.value) && !isBoolean(property.value)
2204
2232
  && !isArray(property.value))) {
2205
2233
  return null;
@@ -2366,6 +2394,7 @@
2366
2394
  var NRT_PROFILE = "NEAR_REAL_TIME";
2367
2395
  var BE_PROFILE = "BEST_EFFORT";
2368
2396
 
2397
+ var STR_EMPTY = "";
2369
2398
  var STR_POST_METHOD = "POST";
2370
2399
  var STR_DISABLED_PROPERTY_NAME = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
2371
2400
  var STR_DROPPED = "drop";
@@ -2416,7 +2445,7 @@
2416
2445
  return iKey;
2417
2446
  };
2418
2447
  _self.Msfpc = function () {
2419
- return _msfpc || "";
2448
+ return _msfpc || STR_EMPTY;
2420
2449
  };
2421
2450
  _self.count = function () {
2422
2451
  return events.length;
@@ -2582,10 +2611,10 @@
2582
2611
  var _theSanitizer = valueSanitizer;
2583
2612
  var _isReservedCache = {};
2584
2613
  dynamicProto(Serializer, this, function (_self) {
2585
- _self.createPayload = function (retryCnt, isTeardown, isSync, useSendBeacon, sendReason, sendType) {
2614
+ _self.createPayload = function (retryCnt, isTeardown, isSync, isReducedPayload, sendReason, sendType) {
2586
2615
  return {
2587
2616
  apiKeys: [],
2588
- payloadBlob: "",
2617
+ payloadBlob: STR_EMPTY,
2589
2618
  overflow: null,
2590
2619
  sizeExceed: [],
2591
2620
  failedEvts: [],
@@ -2594,7 +2623,7 @@
2594
2623
  retryCnt: retryCnt,
2595
2624
  isTeardown: isTeardown,
2596
2625
  isSync: isSync,
2597
- isBeacon: useSendBeacon,
2626
+ isBeacon: isReducedPayload,
2598
2627
  sendType: sendType,
2599
2628
  sendReason: sendReason
2600
2629
  };
@@ -2841,7 +2870,7 @@
2841
2870
  }
2842
2871
  catch (e) {
2843
2872
  }
2844
- return "";
2873
+ return STR_EMPTY;
2845
2874
  }
2846
2875
  function _hasHeader(headers, header) {
2847
2876
  var hasHeader = false;
@@ -2872,6 +2901,17 @@
2872
2901
  }
2873
2902
  }
2874
2903
  }
2904
+ function _prependTransports(theTransports, newTransports) {
2905
+ if (newTransports) {
2906
+ if (isNumber(newTransports)) {
2907
+ theTransports = [newTransports].concat(theTransports);
2908
+ }
2909
+ else if (isArray(newTransports)) {
2910
+ theTransports = newTransports.concat(theTransports);
2911
+ }
2912
+ }
2913
+ return theTransports;
2914
+ }
2875
2915
  var HttpManager = /** @class */ (function () {
2876
2916
  function HttpManager(maxEventsPerBatch, maxConnections, maxRequestRetriesBeforeBackoff, actions, timeoutOverride) {
2877
2917
  this._responseHandlers = [];
@@ -2896,6 +2936,9 @@
2896
2936
  var _useHeaders = false;
2897
2937
  var _xhrTimeout;
2898
2938
  var _disableXhrSync;
2939
+ var _disableFetchKeepAlive;
2940
+ var _canHaveReducedPayload;
2941
+ var _addNoResponse;
2899
2942
  dynamicProto(HttpManager, this, function (_self) {
2900
2943
  var _sendCredentials = true;
2901
2944
  _self.initialize = function (endpointUrl, core, postChannel, httpInterface, channelConfig) {
@@ -2917,12 +2960,18 @@
2917
2960
  enableCompoundKey = !!channelConfig.enableCompoundKey;
2918
2961
  }
2919
2962
  _xhrTimeout = channelConfig.xhrTimeout;
2920
- _disableXhrSync = channelConfig.disableXhrSync;
2963
+ _disableXhrSync = !!channelConfig.disableXhrSync;
2964
+ _disableFetchKeepAlive = !!channelConfig.disableFetchKeepAlive;
2965
+ _addNoResponse = channelConfig.addNoResponse !== false;
2921
2966
  _useBeacons = !isReactNative();
2922
2967
  _serializer = new Serializer(_core, valueSanitizer, stringifyObjects, enableCompoundKey);
2968
+ if (!isNullOrUndefined(channelConfig.useSendBeacon)) {
2969
+ _useBeacons = !!channelConfig.useSendBeacon;
2970
+ }
2923
2971
  var syncHttpInterface = httpInterface;
2924
2972
  var beaconHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;
2925
2973
  var fetchSyncHttpInterface = channelConfig.alwaysUseXhrOverride ? httpInterface : null;
2974
+ var beaconUnloadTransports = [3 , 2 ];
2926
2975
  if (!httpInterface) {
2927
2976
  _customHttpInterface = false;
2928
2977
  var location_1 = getLocation();
@@ -2932,29 +2981,27 @@
2932
2981
  var theTransports = [];
2933
2982
  if (isReactNative()) {
2934
2983
  theTransports = [2 , 1 ];
2984
+ beaconUnloadTransports = [2 , 1 , 3 ];
2935
2985
  }
2936
2986
  else {
2937
2987
  theTransports = [1 , 2 , 3 ];
2938
2988
  }
2939
- var configTransports = channelConfig.transports;
2940
- if (configTransports) {
2941
- if (isNumber(configTransports)) {
2942
- theTransports = [configTransports].concat(theTransports);
2943
- }
2944
- else if (isArray(configTransports)) {
2945
- theTransports = configTransports.concat(theTransports);
2946
- }
2947
- }
2989
+ theTransports = _prependTransports(theTransports, channelConfig.transports);
2948
2990
  httpInterface = _getSenderInterface(theTransports, false);
2949
- syncHttpInterface = _getSenderInterface(theTransports, true);
2950
2991
  if (!httpInterface) {
2951
2992
  _warnToConsole(_logger, "No available transport to send events");
2952
2993
  }
2994
+ syncHttpInterface = _getSenderInterface(theTransports, true);
2995
+ }
2996
+ if (!beaconHttpInterface) {
2997
+ beaconUnloadTransports = _prependTransports(beaconUnloadTransports, channelConfig.unloadTransports);
2998
+ beaconHttpInterface = _getSenderInterface(beaconUnloadTransports, true);
2953
2999
  }
3000
+ _canHaveReducedPayload = !_customHttpInterface && ((_useBeacons && isBeaconsSupported()) || (!_disableFetchKeepAlive && isFetchSupported(true)));
2954
3001
  _sendInterfaces = (_a = {},
2955
3002
  _a[0 ] = httpInterface,
2956
3003
  _a[1 ] = syncHttpInterface || _getSenderInterface([1 , 2 , 3 ], true),
2957
- _a[2 ] = beaconHttpInterface || _getSenderInterface([3 , 2 ], true) || syncHttpInterface || _getSenderInterface([1 ], true),
3004
+ _a[2 ] = beaconHttpInterface || syncHttpInterface || _getSenderInterface([1 ], true),
2958
3005
  _a[3 ] = fetchSyncHttpInterface || _getSenderInterface([2 , 3 ], true) || syncHttpInterface || _getSenderInterface([1 ], true),
2959
3006
  _a);
2960
3007
  };
@@ -2972,7 +3019,7 @@
2972
3019
  sendPostFunc = _xhrSendPost;
2973
3020
  }
2974
3021
  }
2975
- else if (transportType === 2 && isFetchSupported(syncSupport)) {
3022
+ else if (transportType === 2 && isFetchSupported(syncSupport) && (!syncSupport || (syncSupport && !_disableFetchKeepAlive))) {
2976
3023
  sendPostFunc = _fetchSendPost;
2977
3024
  }
2978
3025
  else if (_useBeacons && transportType === 3 && isBeaconsSupported()) {
@@ -3034,7 +3081,9 @@
3034
3081
  requestInit.keepalive = true;
3035
3082
  if (payload._sendReason === 2 ) {
3036
3083
  ignoreResponse = true;
3037
- theUrl += _noResponseQs;
3084
+ if (_addNoResponse) {
3085
+ theUrl += _noResponseQs;
3086
+ }
3038
3087
  }
3039
3088
  }
3040
3089
  if (_sendCredentials) {
@@ -3045,7 +3094,7 @@
3045
3094
  }
3046
3095
  fetch(theUrl, requestInit).then(function (response) {
3047
3096
  var headerMap = {};
3048
- var responseText = "";
3097
+ var responseText = STR_EMPTY;
3049
3098
  var headers = response.headers;
3050
3099
  if (headers) {
3051
3100
  headers["forEach"](function (value, name) {
@@ -3139,7 +3188,7 @@
3139
3188
  var internalPayloadData = payload;
3140
3189
  var status = 200;
3141
3190
  var thePayload = internalPayloadData._thePayload;
3142
- var theUrl = payload.urlString + _noResponseQs;
3191
+ var theUrl = payload.urlString + (_addNoResponse ? _noResponseQs : STR_EMPTY);
3143
3192
  try {
3144
3193
  var nav_1 = getNavigator();
3145
3194
  if (!nav_1.sendBeacon(theUrl, payload.data)) {
@@ -3171,7 +3220,7 @@
3171
3220
  status = 0;
3172
3221
  }
3173
3222
  finally {
3174
- _doOnComplete(oncomplete, status, {}, "");
3223
+ _doOnComplete(oncomplete, status, {}, STR_EMPTY);
3175
3224
  }
3176
3225
  }
3177
3226
  function _isBeaconPayload(sendType) {
@@ -3296,12 +3345,13 @@
3296
3345
  var thePayload = null;
3297
3346
  var serializationStart = getTime();
3298
3347
  var sendInterface = _sendInterfaces[sendType] || (isSynchronous_1 ? _sendInterfaces[1 ] : _sendInterfaces[0 ]);
3299
- var isBeaconTransport = (_isUnloading || _isBeaconPayload(sendType) || (sendInterface && sendInterface._transport === 3 )) && _canUseSendBeaconApi();
3348
+ var sendTransport = sendInterface && sendInterface._transport;
3349
+ var isReducedPayload = _canHaveReducedPayload && (_isUnloading || _isBeaconPayload(sendType) || (sendTransport === 3 || (sendInterface._isSync && sendTransport === 2 )));
3300
3350
  while (_canSendPayload(theBatches, sendType, retryCount)) {
3301
3351
  var theBatch = theBatches.shift();
3302
3352
  if (theBatch && theBatch.count() > 0) {
3303
3353
  if (!_killSwitch.isTenantKilled(theBatch.iKey())) {
3304
- thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isBeaconTransport, sendReason, sendType);
3354
+ thePayload = thePayload || _serializer.createPayload(retryCount, isTeardown, isSynchronous_1, isReducedPayload, sendReason, sendType);
3305
3355
  if (!_serializer.appendPayload(thePayload, theBatch, maxEventsPerBatch)) {
3306
3356
  _doPayloadSend(thePayload, serializationStart, getTime(), sendReason);
3307
3357
  serializationStart = getTime();
@@ -3357,7 +3407,7 @@
3357
3407
  }
3358
3408
  _addRequestDetails(requestDetails, STR_CLIENT_ID, "NO_AUTH", useHeaders);
3359
3409
  _addRequestDetails(requestDetails, STR_CLIENT_VERSION, FullVersionString, useHeaders);
3360
- var apiQsKeys = "";
3410
+ var apiQsKeys = STR_EMPTY;
3361
3411
  arrForEach(thePayload.apiKeys, function (apiKey) {
3362
3412
  if (apiQsKeys.length > 0) {
3363
3413
  apiQsKeys += ",";
@@ -3384,9 +3434,6 @@
3384
3434
  }
3385
3435
  return requestDetails;
3386
3436
  }
3387
- function _canUseSendBeaconApi() {
3388
- return !_customHttpInterface && _useBeacons && isBeaconsSupported();
3389
- }
3390
3437
  function _setTimingValue(timings, name, value) {
3391
3438
  timings[name] = timings[name] || {};
3392
3439
  timings[name][_postManager.identifier] = value;
@@ -3427,11 +3474,10 @@
3427
3474
  headers: requestDetails_1.hdrs,
3428
3475
  _thePayload: thePayload,
3429
3476
  _sendReason: sendReason,
3430
- timeout: _xhrTimeout
3477
+ timeout: _xhrTimeout,
3478
+ disableXhrSync: _disableXhrSync,
3479
+ disableFetchKeepAlive: _disableFetchKeepAlive
3431
3480
  };
3432
- if (!isUndefined(_disableXhrSync)) {
3433
- orgPayloadData.disableXhrSync = !!_disableXhrSync;
3434
- }
3435
3481
  if (useHeaders_1) {
3436
3482
  if (!_hasHeader(orgPayloadData.headers, STR_CACHE_CONTROL)) {
3437
3483
  orgPayloadData.headers[STR_CACHE_CONTROL] = DEFAULT_CACHE_CONTROL;
@@ -3471,7 +3517,8 @@
3471
3517
  urlString: orgPayloadData.urlString,
3472
3518
  headers: extend({}, orgPayloadData.headers),
3473
3519
  timeout: orgPayloadData.timeout,
3474
- disableXhrSync: orgPayloadData.disableXhrSync
3520
+ disableXhrSync: orgPayloadData.disableXhrSync,
3521
+ disableFetchKeepAlive: orgPayloadData.disableFetchKeepAlive
3475
3522
  };
3476
3523
  var senderCalled_1 = false;
3477
3524
  doPerf(_core, function () { return "HttpManager:_doPayloadSend.sendHook"; }, function () {
@@ -3642,7 +3689,7 @@
3642
3689
  return encodeURIComponent(msfpc);
3643
3690
  }
3644
3691
  }
3645
- return "";
3692
+ return STR_EMPTY;
3646
3693
  }
3647
3694
  function _handleCollectorResponse(responseText) {
3648
3695
  var responseHandlers = _self._responseHandlers;
@@ -3741,7 +3788,7 @@
3741
3788
  var _this = _super.call(this) || this;
3742
3789
  _this.identifier = "PostChannel";
3743
3790
  _this.priority = 1011;
3744
- _this.version = '3.2.6';
3791
+ _this.version = '3.2.8';
3745
3792
  var _config;
3746
3793
  var _isTeardownCalled = false;
3747
3794
  var _flushCallbackQueue = [];
@@ -3813,7 +3860,7 @@
3813
3860
  _httpManager.sendHook = _config.payloadPreprocessor;
3814
3861
  _httpManager.sendListener = _config.payloadListener;
3815
3862
  var endpointUrl = _config.overrideEndpointUrl ? _config.overrideEndpointUrl : coreConfig.endpointUrl;
3816
- _self._notificationManager = coreConfig.extensionConfig.NotificationManager;
3863
+ _self._notificationManager = core.getNotifyMgr();
3817
3864
  _httpManager.initialize(endpointUrl, _self.core, _self, _xhrOverride, _config);
3818
3865
  var excludePageUnloadEvents = coreConfig.disablePageUnloadEvents || [];
3819
3866
  addPageUnloadEventListener(_handleUnloadEvents, excludePageUnloadEvents, _evtNamespace);
@@ -4474,4 +4521,4 @@
4474
4521
  (function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
4475
4522
 
4476
4523
  })(this.oneDS = this.oneDS || {});
4477
- //# sourceMappingURL=ms.post-3.2.6.gbl.js.map
4524
+ //# sourceMappingURL=ms.post-3.2.8.gbl.js.map