@microsoft/1ds-core-js 3.1.3 → 3.1.7

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 (84) hide show
  1. package/README.md +1 -1
  2. package/bundle/ms.core-3.1.7.gbl.js +3589 -0
  3. package/bundle/ms.core-3.1.7.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.1.7.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.1.7.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.1.7.integrity.json +46 -0
  7. package/bundle/{ms.core-test.js → ms.core-3.1.7.js} +203 -100
  8. package/bundle/ms.core-3.1.7.js.map +1 -0
  9. package/bundle/ms.core-3.1.7.min.js +7 -0
  10. package/bundle/ms.core-3.1.7.min.js.map +1 -0
  11. package/bundle/{ms.core-3.1.3.gbl.js → ms.core.gbl.js} +201 -98
  12. package/bundle/ms.core.gbl.js.map +1 -0
  13. package/bundle/ms.core.gbl.min.js +7 -0
  14. package/bundle/ms.core.gbl.min.js.map +1 -0
  15. package/bundle/ms.core.integrity.json +46 -0
  16. package/bundle/{ms.core-3.1.3.js → ms.core.js} +202 -99
  17. package/bundle/ms.core.js.map +1 -0
  18. package/bundle/ms.core.min.js +7 -0
  19. package/bundle/ms.core.min.js.map +1 -0
  20. package/dist/ms.core.js +64 -68
  21. package/dist/ms.core.js.map +1 -1
  22. package/dist/ms.core.min.js +2 -2
  23. package/dist/ms.core.min.js.map +1 -1
  24. package/dist-esm/src/AppInsightsCore.js +1 -1
  25. package/dist-esm/src/BaseCore.js +1 -1
  26. package/dist-esm/src/DataModels.d.ts +5 -2
  27. package/dist-esm/src/DataModels.js +2 -1
  28. package/dist-esm/src/DataModels.js.map +1 -1
  29. package/dist-esm/src/ESPromise.js +1 -1
  30. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  31. package/dist-esm/src/Enums.d.ts +1 -0
  32. package/dist-esm/src/Enums.js +1 -1
  33. package/dist-esm/src/Index.d.ts +4 -3
  34. package/dist-esm/src/Index.js +6 -5
  35. package/dist-esm/src/Index.js.map +1 -1
  36. package/dist-esm/src/Utils.d.ts +33 -19
  37. package/dist-esm/src/Utils.js +86 -75
  38. package/dist-esm/src/Utils.js.map +1 -1
  39. package/dist-esm/src/ValueSanitizer.js +1 -1
  40. package/package.json +6 -6
  41. package/src/DataModels.ts +5 -2
  42. package/src/Index.ts +10 -10
  43. package/src/Utils.ts +100 -84
  44. package/tsconfig.json +2 -4
  45. package/bundle/ms.core-3.1.3.gbl.js.map +0 -1
  46. package/bundle/ms.core-3.1.3.gbl.min.js +0 -7
  47. package/bundle/ms.core-3.1.3.gbl.min.js.map +0 -1
  48. package/bundle/ms.core-3.1.3.js.map +0 -1
  49. package/bundle/ms.core-3.1.3.min.js +0 -7
  50. package/bundle/ms.core-3.1.3.min.js.map +0 -1
  51. package/bundle/ms.core-test.js.map +0 -1
  52. package/bundle/ms.core-test.min.js +0 -7
  53. package/bundle/ms.core-test.min.js.map +0 -1
  54. package/dist-esm/test/CoreTest.d.ts +0 -6
  55. package/dist-esm/test/CoreTest.js +0 -105
  56. package/dist-esm/test/CoreTest.js.map +0 -1
  57. package/dist-esm/test/DynamicProtoTests.d.ts +0 -7
  58. package/dist-esm/test/DynamicProtoTests.js +0 -541
  59. package/dist-esm/test/DynamicProtoTests.js.map +0 -1
  60. package/dist-esm/test/ESPromiseSchedulerTests.d.ts +0 -6
  61. package/dist-esm/test/ESPromiseSchedulerTests.js +0 -190
  62. package/dist-esm/test/ESPromiseSchedulerTests.js.map +0 -1
  63. package/dist-esm/test/ESPromiseTests.d.ts +0 -5
  64. package/dist-esm/test/ESPromiseTests.js +0 -422
  65. package/dist-esm/test/ESPromiseTests.js.map +0 -1
  66. package/dist-esm/test/FileSizeCheckTest.d.ts +0 -5
  67. package/dist-esm/test/FileSizeCheckTest.js +0 -42
  68. package/dist-esm/test/FileSizeCheckTest.js.map +0 -1
  69. package/dist-esm/test/Index.d.ts +0 -1
  70. package/dist-esm/test/Index.js +0 -23
  71. package/dist-esm/test/Index.js.map +0 -1
  72. package/dist-esm/test/TestClass.d.ts +0 -103
  73. package/dist-esm/test/TestClass.js +0 -396
  74. package/dist-esm/test/TestClass.js.map +0 -1
  75. package/dist-esm/test/TestHelper.d.ts +0 -7
  76. package/dist-esm/test/TestHelper.js +0 -98
  77. package/dist-esm/test/TestHelper.js.map +0 -1
  78. package/dist-esm/test/UtilsTest.d.ts +0 -4
  79. package/dist-esm/test/UtilsTest.js +0 -224
  80. package/dist-esm/test/UtilsTest.js.map +0 -1
  81. package/dist-esm/test/ValueSanitizerTests.d.ts +0 -6
  82. package/dist-esm/test/ValueSanitizerTests.js +0 -331
  83. package/dist-esm/test/ValueSanitizerTests.js.map +0 -1
  84. package/src/typings/XDomainRequest.d.ts +0 -23
package/dist/ms.core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 3.1.3
2
+ * 1DS JS SDK Core, 3.1.7
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -7,9 +7,9 @@
7
7
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@microsoft/applicationinsights-shims'), require('@microsoft/applicationinsights-core-js'), require('@microsoft/dynamicproto-js')) :
8
8
  typeof define === 'function' && define.amd ? define(['exports', '@microsoft/applicationinsights-shims', '@microsoft/applicationinsights-core-js', '@microsoft/dynamicproto-js'], factory) :
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.oneDS = global.oneDS || {}, global.applicationinsightsShims, global.applicationinsightsCoreJs, global.dynamicProto));
10
- }(this, (function (exports, applicationinsightsShims, applicationinsightsCoreJs, dynamicProto) { 'use strict';
10
+ })(this, (function (exports, applicationinsightsShims, applicationinsightsCoreJs, dynamicProto) { 'use strict';
11
11
 
12
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
12
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
13
13
 
14
14
  var dynamicProto__default = /*#__PURE__*/_interopDefaultLegacy(dynamicProto);
15
15
 
@@ -61,8 +61,10 @@
61
61
  var _ExtendedInternalMessageId = applicationinsightsShims.__assignFn(applicationinsightsShims.__assignFn({}, applicationinsightsCoreJs._InternalMessageId), { AuthHandShakeError: 501, AuthRedirectFail: 502, BrowserCannotReadLocalStorage: 503, BrowserCannotWriteLocalStorage: 504, BrowserDoesNotSupportLocalStorage: 505, CannotParseBiBlobValue: 506, CannotParseDataAttribute: 507, CVPluginNotAvailable: 508, DroppedEvent: 509, ErrorParsingAISessionCookie: 510, ErrorProvidedChannels: 511, FailedToGetCookies: 512, FailedToInitializeCorrelationVector: 513, FailedToInitializeSDK: 514, InvalidContentBlob: 515, InvalidCorrelationValue: 516, SessionRenewalDateIsZero: 517, SendPostOnCompleteFailure: 518, PostResponseHandler: 519, SDKNotInitialized: 520 });
62
62
 
63
63
  var _a;
64
- var Version = '3.1.3';
64
+ var Version = '3.1.7';
65
65
  var FullVersionString = "1DS-Web-JS-" + Version;
66
+ var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
67
+ var strWithCredentials = "withCredentials";
66
68
  var _fieldTypeEventPropMap = (_a = {},
67
69
  _a[0 ] = EventPropertyType.Unspecified,
68
70
  _a[2 ] = EventPropertyType.Double,
@@ -72,30 +74,7 @@
72
74
  _a[4096 | 1 ] = EventPropertyType.String,
73
75
  _a[4096 | 3 ] = EventPropertyType.Bool,
74
76
  _a);
75
- var _useXDomainRequest = null;
76
- var beaconsSupported = null;
77
77
  var uInt8ArraySupported = null;
78
- function _hasProperty(theClass, property) {
79
- var supported = false;
80
- if (theClass) {
81
- supported = property in theClass;
82
- if (!supported) {
83
- var proto = theClass.prototype;
84
- if (proto) {
85
- supported = property in proto;
86
- }
87
- }
88
- if (!supported) {
89
- try {
90
- var tmp = new theClass();
91
- supported = !applicationinsightsCoreJs.isUndefined(tmp[property]);
92
- }
93
- catch (e) {
94
- }
95
- }
96
- }
97
- return supported;
98
- }
99
78
  var isDocumentObjectAvailable = Boolean(applicationinsightsCoreJs.getDocument());
100
79
  var isWindowObjectAvailable = Boolean(applicationinsightsCoreJs.getWindow());
101
80
  function isValueAssigned(value) {
@@ -110,29 +89,6 @@
110
89
  }
111
90
  return "";
112
91
  }
113
- function isBeaconsSupported() {
114
- if (beaconsSupported === null) {
115
- beaconsSupported = applicationinsightsCoreJs.hasNavigator() && Boolean(applicationinsightsCoreJs.getNavigator().sendBeacon);
116
- }
117
- return beaconsSupported;
118
- }
119
- function isFetchSupported(withKeepAlive) {
120
- var isSupported = false;
121
- try {
122
- var fetchApi = applicationinsightsCoreJs.getGlobalInst("fetch");
123
- isSupported = !!fetchApi;
124
- var request = applicationinsightsCoreJs.getGlobalInst("Request");
125
- if (isSupported && withKeepAlive && request) {
126
- isSupported = _hasProperty(request, "keepalive");
127
- }
128
- }
129
- catch (e) {
130
- }
131
- return isSupported;
132
- }
133
- function isXhrSupported() {
134
- return typeof XMLHttpRequest !== undefined;
135
- }
136
92
  function isUint8ArrayAvailable() {
137
93
  if (uInt8ArraySupported === null) {
138
94
  uInt8ArraySupported = !applicationinsightsCoreJs.isUndefined(Uint8Array) && !isSafariOrFirefox() && !applicationinsightsCoreJs.isReactNative();
@@ -174,15 +130,6 @@
174
130
  }
175
131
  return property;
176
132
  }
177
- function useXDomainRequest() {
178
- if (_useXDomainRequest === null) {
179
- _useXDomainRequest = (typeof XDomainRequest !== undefined);
180
- if (_useXDomainRequest && isXhrSupported()) {
181
- _useXDomainRequest = _useXDomainRequest && !_hasProperty(XMLHttpRequest, "withCredentials");
182
- }
183
- }
184
- return _useXDomainRequest;
185
- }
186
133
  function getCommonSchemaMetaData(value, kind, type) {
187
134
  var encodedTypeValue = -1;
188
135
  if (!applicationinsightsCoreJs.isUndefined(value)) {
@@ -319,11 +266,30 @@
319
266
  function isArrayValid(value) {
320
267
  return value.length > 0;
321
268
  }
269
+ function addPageHideEventListener(listener) {
270
+ function _handlePageVisibility(evt) {
271
+ var doc = applicationinsightsCoreJs.getDocument();
272
+ if (listener && doc && doc.visibilityState === 'hidden') {
273
+ listener(evt);
274
+ }
275
+ }
276
+ var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("pagehide", listener);
277
+ return applicationinsightsCoreJs.addEventHandler("visibilitychange", _handlePageVisibility) || pageUnloadAdded;
278
+ }
279
+ function addPageShowEventListener(listener) {
280
+ function _handlePageVisibility(evt) {
281
+ var doc = applicationinsightsCoreJs.getDocument();
282
+ if (listener && doc && doc.visibilityState === 'visible') {
283
+ listener(evt);
284
+ }
285
+ }
286
+ var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("pageshow", listener);
287
+ return applicationinsightsCoreJs.addEventHandler("visibilitychange", _handlePageVisibility) || pageUnloadAdded;
288
+ }
322
289
  function addPageUnloadEventListener(listener) {
323
290
  var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("beforeunload", listener);
324
291
  pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("unload", listener) || pageUnloadAdded;
325
- pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("pagehide", listener) || pageUnloadAdded;
326
- return pageUnloadAdded;
292
+ return applicationinsightsCoreJs.addEventHandler("pagehide", listener) || pageUnloadAdded;
327
293
  }
328
294
  function setProcessTelemetryTimings(event, identifier) {
329
295
  var evt = event;
@@ -383,12 +349,12 @@
383
349
  isWindowObjectAvailable: isWindowObjectAvailable,
384
350
  isValueAssigned: isValueAssigned,
385
351
  getTenantId: getTenantId,
386
- isBeaconsSupported: isBeaconsSupported,
352
+ isBeaconsSupported: applicationinsightsCoreJs.isBeaconsSupported,
387
353
  isUint8ArrayAvailable: isUint8ArrayAvailable,
388
354
  isLatency: isLatency,
389
355
  sanitizeProperty: sanitizeProperty,
390
356
  getISOString: applicationinsightsCoreJs.toISOString,
391
- useXDomainRequest: useXDomainRequest,
357
+ useXDomainRequest: applicationinsightsCoreJs.useXDomainRequest,
392
358
  getCommonSchemaMetaData: getCommonSchemaMetaData,
393
359
  cookieAvailable: applicationinsightsCoreJs.areCookiesSupported,
394
360
  disallowsSameSiteNone: applicationinsightsCoreJs.uaDisallowsSameSiteNone,
@@ -447,6 +413,29 @@
447
413
  function isChromium() {
448
414
  return !!applicationinsightsCoreJs.getGlobalInst("chrome");
449
415
  }
416
+ function openXhr(method, urlString, withCredentials, disabled, isSync) {
417
+ if (disabled === void 0) { disabled = false; }
418
+ if (isSync === void 0) { isSync = false; }
419
+ function _wrapSetXhrProp(xhr, prop, value) {
420
+ try {
421
+ xhr[prop] = value;
422
+ }
423
+ catch (e) {
424
+ }
425
+ }
426
+ var xhr = new XMLHttpRequest();
427
+ if (disabled) {
428
+ _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
429
+ }
430
+ if (withCredentials) {
431
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
432
+ }
433
+ xhr.open(method, urlString, !isSync);
434
+ if (withCredentials) {
435
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
436
+ }
437
+ return xhr;
438
+ }
450
439
 
451
440
  var PropVersion = "version";
452
441
  var properties = "properties";
@@ -1142,6 +1131,8 @@
1142
1131
  exports.DiagnosticLogger = applicationinsightsCoreJs.DiagnosticLogger;
1143
1132
  exports.EventHelper = applicationinsightsCoreJs.EventHelper;
1144
1133
  exports.EventsDiscardedReason = applicationinsightsCoreJs.EventsDiscardedReason;
1134
+ exports.InternalAppInsightsCore = applicationinsightsCoreJs.AppInsightsCore;
1135
+ exports.InternalBaseCore = applicationinsightsCoreJs.BaseCore;
1145
1136
  exports.LoggingSeverity = applicationinsightsCoreJs.LoggingSeverity;
1146
1137
  exports.MinChannelPriorty = applicationinsightsCoreJs.MinChannelPriorty;
1147
1138
  exports.NotificationManager = applicationinsightsCoreJs.NotificationManager;
@@ -1149,6 +1140,8 @@
1149
1140
  exports.PerfManager = applicationinsightsCoreJs.PerfManager;
1150
1141
  exports.ProcessTelemetryContext = applicationinsightsCoreJs.ProcessTelemetryContext;
1151
1142
  exports.Undefined = applicationinsightsCoreJs.strUndefined;
1143
+ exports._InternalLogMessage = applicationinsightsCoreJs._InternalLogMessage;
1144
+ exports._InternalMessageId = applicationinsightsCoreJs._InternalMessageId;
1152
1145
  exports.addEventHandler = applicationinsightsCoreJs.addEventHandler;
1153
1146
  exports.areCookiesSupported = applicationinsightsCoreJs.areCookiesSupported;
1154
1147
  exports.arrForEach = applicationinsightsCoreJs.arrForEach;
@@ -1187,9 +1180,11 @@
1187
1180
  exports.hasOwnProperty = applicationinsightsCoreJs.hasOwnProperty;
1188
1181
  exports.hasWindow = applicationinsightsCoreJs.hasWindow;
1189
1182
  exports.isArray = applicationinsightsCoreJs.isArray;
1183
+ exports.isBeaconsSupported = applicationinsightsCoreJs.isBeaconsSupported;
1190
1184
  exports.isBoolean = applicationinsightsCoreJs.isBoolean;
1191
1185
  exports.isDate = applicationinsightsCoreJs.isDate;
1192
1186
  exports.isError = applicationinsightsCoreJs.isError;
1187
+ exports.isFetchSupported = applicationinsightsCoreJs.isFetchSupported;
1193
1188
  exports.isFunction = applicationinsightsCoreJs.isFunction;
1194
1189
  exports.isIE = applicationinsightsCoreJs.isIE;
1195
1190
  exports.isNotTruthy = applicationinsightsCoreJs.isNotTruthy;
@@ -1201,6 +1196,7 @@
1201
1196
  exports.isTruthy = applicationinsightsCoreJs.isTruthy;
1202
1197
  exports.isTypeof = applicationinsightsCoreJs.isTypeof;
1203
1198
  exports.isUndefined = applicationinsightsCoreJs.isUndefined;
1199
+ exports.isXhrSupported = applicationinsightsCoreJs.isXhrSupported;
1204
1200
  exports.newGuid = applicationinsightsCoreJs.newGuid;
1205
1201
  exports.newId = applicationinsightsCoreJs.newId;
1206
1202
  exports.normalizeJsName = applicationinsightsCoreJs.normalizeJsName;
@@ -1229,6 +1225,7 @@
1229
1225
  exports.strUndefined = applicationinsightsCoreJs.strUndefined;
1230
1226
  exports.throwError = applicationinsightsCoreJs.throwError;
1231
1227
  exports.toISOString = applicationinsightsCoreJs.toISOString;
1228
+ exports.useXDomainRequest = applicationinsightsCoreJs.useXDomainRequest;
1232
1229
  exports.AppInsightsCore = AppInsightsCore;
1233
1230
  exports.BaseCore = BaseCore;
1234
1231
  exports.CoreUtils = CoreUtils;
@@ -1244,6 +1241,8 @@
1244
1241
  exports.ValueSanitizer = ValueSanitizer;
1245
1242
  exports.Version = Version;
1246
1243
  exports._ExtendedInternalMessageId = _ExtendedInternalMessageId;
1244
+ exports.addPageHideEventListener = addPageHideEventListener;
1245
+ exports.addPageShowEventListener = addPageShowEventListener;
1247
1246
  exports.addPageUnloadEventListener = addPageUnloadEventListener;
1248
1247
  exports.createGuid = createGuid;
1249
1248
  exports.deleteCookie = deleteCookie;
@@ -1256,22 +1255,19 @@
1256
1255
  exports.getTenantId = getTenantId;
1257
1256
  exports.getTime = getTime;
1258
1257
  exports.isArrayValid = isArrayValid;
1259
- exports.isBeaconsSupported = isBeaconsSupported;
1260
1258
  exports.isChromium = isChromium;
1261
1259
  exports.isDocumentObjectAvailable = isDocumentObjectAvailable;
1262
- exports.isFetchSupported = isFetchSupported;
1263
1260
  exports.isLatency = isLatency;
1264
1261
  exports.isUint8ArrayAvailable = isUint8ArrayAvailable;
1265
1262
  exports.isValueAssigned = isValueAssigned;
1266
1263
  exports.isValueKind = isValueKind;
1267
1264
  exports.isWindowObjectAvailable = isWindowObjectAvailable;
1268
- exports.isXhrSupported = isXhrSupported;
1265
+ exports.openXhr = openXhr;
1269
1266
  exports.sanitizeProperty = sanitizeProperty;
1270
1267
  exports.setCookie = setCookie;
1271
1268
  exports.setProcessTelemetryTimings = setProcessTelemetryTimings;
1272
- exports.useXDomainRequest = useXDomainRequest;
1273
1269
 
1274
1270
  (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 });
1275
1271
 
1276
- })));
1272
+ }));
1277
1273
  //# sourceMappingURL=ms.core.js.map