@microsoft/1ds-core-js 3.1.6 → 3.1.10

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 (57) hide show
  1. package/README.md +4 -0
  2. package/bundle/ms.core-3.1.10.gbl.js +3722 -0
  3. package/bundle/ms.core-3.1.10.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.1.10.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.1.10.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.1.10.integrity.json +46 -0
  7. package/bundle/{ms.core-test.js → ms.core-3.1.10.js} +273 -110
  8. package/bundle/ms.core-3.1.10.js.map +1 -0
  9. package/bundle/ms.core-3.1.10.min.js +7 -0
  10. package/bundle/ms.core-3.1.10.min.js.map +1 -0
  11. package/bundle/{ms.core-3.1.6.gbl.js → ms.core.gbl.js} +272 -109
  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.6.js → ms.core.js} +273 -110
  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 +53 -41
  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 +15 -4
  25. package/dist-esm/src/AppInsightsCore.js.map +1 -1
  26. package/dist-esm/src/BaseCore.js +5 -7
  27. package/dist-esm/src/BaseCore.js.map +1 -1
  28. package/dist-esm/src/DataModels.d.ts +17 -2
  29. package/dist-esm/src/DataModels.js +1 -1
  30. package/dist-esm/src/ESPromise.js +1 -1
  31. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  32. package/dist-esm/src/Enums.d.ts +1 -0
  33. package/dist-esm/src/Enums.js +1 -1
  34. package/dist-esm/src/Index.d.ts +4 -3
  35. package/dist-esm/src/Index.js +5 -5
  36. package/dist-esm/src/Index.js.map +1 -1
  37. package/dist-esm/src/Utils.d.ts +12 -24
  38. package/dist-esm/src/Utils.js +46 -49
  39. package/dist-esm/src/Utils.js.map +1 -1
  40. package/dist-esm/src/ValueSanitizer.js +1 -1
  41. package/package.json +3 -3
  42. package/src/AppInsightsCore.ts +16 -5
  43. package/src/BaseCore.ts +4 -6
  44. package/src/DataModels.ts +24 -3
  45. package/src/Index.ts +7 -5
  46. package/src/Utils.ts +51 -56
  47. package/bundle/ms.core-3.1.6.gbl.js.map +0 -1
  48. package/bundle/ms.core-3.1.6.gbl.min.js +0 -7
  49. package/bundle/ms.core-3.1.6.gbl.min.js.map +0 -1
  50. package/bundle/ms.core-3.1.6.integrity.json +0 -46
  51. package/bundle/ms.core-3.1.6.js.map +0 -1
  52. package/bundle/ms.core-3.1.6.min.js +0 -7
  53. package/bundle/ms.core-3.1.6.min.js.map +0 -1
  54. package/bundle/ms.core-test.integrity.json +0 -26
  55. package/bundle/ms.core-test.js.map +0 -1
  56. package/bundle/ms.core-test.min.js +0 -7
  57. package/bundle/ms.core-test.min.js.map +0 -1
package/dist/ms.core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 3.1.6
2
+ * 1DS JS SDK Core, 3.1.10
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.6';
64
+ var Version = '3.1.10';
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,
@@ -264,31 +266,6 @@
264
266
  function isArrayValid(value) {
265
267
  return value.length > 0;
266
268
  }
267
- function addPageHideEventListener(listener) {
268
- function _handlePageVisibility(evt) {
269
- var doc = applicationinsightsCoreJs.getDocument();
270
- if (listener && doc && doc.visibilityState === 'hidden') {
271
- listener(evt);
272
- }
273
- }
274
- var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("pagehide", listener);
275
- return applicationinsightsCoreJs.addEventHandler("visibilitychange", _handlePageVisibility) || pageUnloadAdded;
276
- }
277
- function addPageShowEventListener(listener) {
278
- function _handlePageVisibility(evt) {
279
- var doc = applicationinsightsCoreJs.getDocument();
280
- if (listener && doc && doc.visibilityState === 'visible') {
281
- listener(evt);
282
- }
283
- }
284
- var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("pageshow", listener);
285
- return applicationinsightsCoreJs.addEventHandler("visibilitychange", _handlePageVisibility) || pageUnloadAdded;
286
- }
287
- function addPageUnloadEventListener(listener) {
288
- var pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("beforeunload", listener);
289
- pageUnloadAdded = applicationinsightsCoreJs.addEventHandler("unload", listener) || pageUnloadAdded;
290
- return applicationinsightsCoreJs.addEventHandler("pagehide", listener) || pageUnloadAdded;
291
- }
292
269
  function setProcessTelemetryTimings(event, identifier) {
293
270
  var evt = event;
294
271
  evt.timings = evt.timings || {};
@@ -365,7 +342,7 @@
365
342
  isValueKind: isValueKind,
366
343
  isArrayValid: isArrayValid,
367
344
  objDefineAccessors: applicationinsightsCoreJs.objDefineAccessors,
368
- addPageUnloadEventListener: addPageUnloadEventListener,
345
+ addPageUnloadEventListener: applicationinsightsCoreJs.addPageUnloadEventListener,
369
346
  setProcessTelemetryTimings: setProcessTelemetryTimings,
370
347
  addEventHandler: applicationinsightsCoreJs.addEventHandler,
371
348
  getFieldValueType: getFieldValueType,
@@ -411,6 +388,29 @@
411
388
  function isChromium() {
412
389
  return !!applicationinsightsCoreJs.getGlobalInst("chrome");
413
390
  }
391
+ function openXhr(method, urlString, withCredentials, disabled, isSync) {
392
+ if (disabled === void 0) { disabled = false; }
393
+ if (isSync === void 0) { isSync = false; }
394
+ function _wrapSetXhrProp(xhr, prop, value) {
395
+ try {
396
+ xhr[prop] = value;
397
+ }
398
+ catch (e) {
399
+ }
400
+ }
401
+ var xhr = new XMLHttpRequest();
402
+ if (disabled) {
403
+ _wrapSetXhrProp(xhr, strDisabledPropertyName, disabled);
404
+ }
405
+ if (withCredentials) {
406
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
407
+ }
408
+ xhr.open(method, urlString, !isSync);
409
+ if (withCredentials) {
410
+ _wrapSetXhrProp(xhr, strWithCredentials, withCredentials);
411
+ }
412
+ return xhr;
413
+ }
414
414
 
415
415
  var PropVersion = "version";
416
416
  var properties = "properties";
@@ -421,6 +421,9 @@
421
421
  _this.pluginVersionStringArr = [];
422
422
  _this.pluginVersionString = "";
423
423
  dynamicProto__default(AppInsightsCore, _this, function (_self, _base) {
424
+ if (!_self.logger || !_self.logger.queue) {
425
+ _self.logger = new applicationinsightsCoreJs.DiagnosticLogger({ loggingLevelConsole: applicationinsightsCoreJs.LoggingSeverity.CRITICAL });
426
+ }
424
427
  _self.initialize = function (config, extensions, logger, notificationManager) {
425
428
  applicationinsightsCoreJs.doPerf(_self, function () { return "AppInsightsCore.initialize"; }, function () {
426
429
  if (config) {
@@ -458,11 +461,16 @@
458
461
  _self.pluginVersionString = _self.pluginVersionStringArr.join(";");
459
462
  try {
460
463
  _base.initialize(config, extensions, logger, notificationManager);
464
+ _self.pollInternalLogs("InternalLog");
461
465
  }
462
466
  catch (e) {
463
- _self.logger.throwInternal(applicationinsightsCoreJs.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.ErrorProvidedChannels, "Channels must be provided through config.channels only");
467
+ var logger_1 = _self.logger;
468
+ var message = applicationinsightsCoreJs.dumpObj(e);
469
+ if (message.indexOf("channels") !== -1) {
470
+ message += "\n - Channels must be provided through config.channels only!";
471
+ }
472
+ logger_1.throwInternal(applicationinsightsCoreJs.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.FailedToInitializeSDK, "SDK Initialization Failed - no telemetry will be sent: " + message);
464
473
  }
465
- _self.pollInternalLogs("InternalLog");
466
474
  }, function () { return ({ config: config, extensions: extensions, logger: logger, notificationManager: notificationManager }); });
467
475
  };
468
476
  _self.track = function (item) {
@@ -504,10 +512,8 @@
504
512
  var _this = _super.call(this) || this;
505
513
  dynamicProto__default(BaseCore, _this, function (_self, _base) {
506
514
  _self.initialize = function (config, extensions, logger, notificationManager) {
507
- if (config) {
508
- if (!config.endpointUrl) {
509
- config.endpointUrl = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
510
- }
515
+ if (config && !config.endpointUrl) {
516
+ config.endpointUrl = "https://browser.events.data.microsoft.com/OneCollector/1.0/";
511
517
  }
512
518
  _self.getWParam = function () {
513
519
  return isDocumentObjectAvailable ? 0 : -1;
@@ -516,7 +522,7 @@
516
522
  _base.initialize(config, extensions, logger, notificationManager);
517
523
  }
518
524
  catch (e) {
519
- _self.logger.throwInternal(applicationinsightsCoreJs.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.ErrorProvidedChannels, "Channels must be provided through config.channels only");
525
+ _self.logger.throwInternal(applicationinsightsCoreJs.LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.FailedToInitializeSDK, "Initialization Failed: " + applicationinsightsCoreJs.dumpObj(e) + "\n - Note: Channels must be provided through config.channels only");
520
526
  }
521
527
  };
522
528
  _self.track = function (item) {
@@ -1106,6 +1112,8 @@
1106
1112
  exports.DiagnosticLogger = applicationinsightsCoreJs.DiagnosticLogger;
1107
1113
  exports.EventHelper = applicationinsightsCoreJs.EventHelper;
1108
1114
  exports.EventsDiscardedReason = applicationinsightsCoreJs.EventsDiscardedReason;
1115
+ exports.InternalAppInsightsCore = applicationinsightsCoreJs.AppInsightsCore;
1116
+ exports.InternalBaseCore = applicationinsightsCoreJs.BaseCore;
1109
1117
  exports.LoggingSeverity = applicationinsightsCoreJs.LoggingSeverity;
1110
1118
  exports.MinChannelPriorty = applicationinsightsCoreJs.MinChannelPriorty;
1111
1119
  exports.NotificationManager = applicationinsightsCoreJs.NotificationManager;
@@ -1113,7 +1121,13 @@
1113
1121
  exports.PerfManager = applicationinsightsCoreJs.PerfManager;
1114
1122
  exports.ProcessTelemetryContext = applicationinsightsCoreJs.ProcessTelemetryContext;
1115
1123
  exports.Undefined = applicationinsightsCoreJs.strUndefined;
1124
+ exports._InternalLogMessage = applicationinsightsCoreJs._InternalLogMessage;
1125
+ exports._InternalMessageId = applicationinsightsCoreJs._InternalMessageId;
1116
1126
  exports.addEventHandler = applicationinsightsCoreJs.addEventHandler;
1127
+ exports.addEventListeners = applicationinsightsCoreJs.addEventListeners;
1128
+ exports.addPageHideEventListener = applicationinsightsCoreJs.addPageHideEventListener;
1129
+ exports.addPageShowEventListener = applicationinsightsCoreJs.addPageShowEventListener;
1130
+ exports.addPageUnloadEventListener = applicationinsightsCoreJs.addPageUnloadEventListener;
1117
1131
  exports.areCookiesSupported = applicationinsightsCoreJs.areCookiesSupported;
1118
1132
  exports.arrForEach = applicationinsightsCoreJs.arrForEach;
1119
1133
  exports.arrIndexOf = applicationinsightsCoreJs.arrIndexOf;
@@ -1212,9 +1226,6 @@
1212
1226
  exports.ValueSanitizer = ValueSanitizer;
1213
1227
  exports.Version = Version;
1214
1228
  exports._ExtendedInternalMessageId = _ExtendedInternalMessageId;
1215
- exports.addPageHideEventListener = addPageHideEventListener;
1216
- exports.addPageShowEventListener = addPageShowEventListener;
1217
- exports.addPageUnloadEventListener = addPageUnloadEventListener;
1218
1229
  exports.createGuid = createGuid;
1219
1230
  exports.deleteCookie = deleteCookie;
1220
1231
  exports.disableCookies = disableCookies;
@@ -1233,11 +1244,12 @@
1233
1244
  exports.isValueAssigned = isValueAssigned;
1234
1245
  exports.isValueKind = isValueKind;
1235
1246
  exports.isWindowObjectAvailable = isWindowObjectAvailable;
1247
+ exports.openXhr = openXhr;
1236
1248
  exports.sanitizeProperty = sanitizeProperty;
1237
1249
  exports.setCookie = setCookie;
1238
1250
  exports.setProcessTelemetryTimings = setProcessTelemetryTimings;
1239
1251
 
1240
1252
  (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 });
1241
1253
 
1242
- })));
1254
+ }));
1243
1255
  //# sourceMappingURL=ms.core.js.map