@microsoft/applicationinsights-analytics-js 3.0.1-nightly3.2304-38 → 3.0.1-nightly3.2304-44

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 (30) hide show
  1. package/browser/es5/applicationinsights-analytics-js.cjs.js +115 -102
  2. package/browser/es5/applicationinsights-analytics-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-analytics-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-analytics-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-analytics-js.gbl.js +115 -102
  6. package/browser/es5/applicationinsights-analytics-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-analytics-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-analytics-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-analytics-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-analytics-js.js +115 -102
  11. package/browser/es5/applicationinsights-analytics-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-analytics-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-analytics-js.min.js.map +1 -1
  14. package/dist/es5/applicationinsights-analytics-js.js +115 -102
  15. package/dist/es5/applicationinsights-analytics-js.js.map +1 -1
  16. package/dist/es5/applicationinsights-analytics-js.min.js +2 -2
  17. package/dist/es5/applicationinsights-analytics-js.min.js.map +1 -1
  18. package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js +2 -2
  19. package/dist-es5/JavaScriptSDK/AnalyticsPlugin.js.map +1 -1
  20. package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js +4 -2
  21. package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js.map +1 -1
  22. package/dist-es5/JavaScriptSDK/Telemetry/PageViewPerformanceManager.js +1 -1
  23. package/dist-es5/JavaScriptSDK/Telemetry/PageVisitTimeManager.js +1 -1
  24. package/dist-es5/JavaScriptSDK/Timing.js +1 -1
  25. package/dist-es5/JavaScriptSDK.Interfaces/ITelemetryConfig.js +1 -1
  26. package/dist-es5/__DynamicConstants.js +1 -1
  27. package/dist-es5/applicationinsights-analytics-js.js +1 -1
  28. package/package.json +6 -6
  29. package/types/applicationinsights-analytics-js.d.ts +1 -1
  30. package/types/applicationinsights-analytics-js.namespaced.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web Analytics, 3.0.1-nightly3.2304-38
2
+ * Application Insights JavaScript SDK - Web Analytics, 3.0.1-nightly3.2304-44
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
@@ -37,7 +37,7 @@ var MathCls = Math;
37
37
  var ArrCls = Array;
38
38
  var ArrProto = ArrCls[PROTOTYPE];
39
39
 
40
- function _safeGet(cb, defValue) {
40
+ function safeGet(cb, defValue) {
41
41
  var result = defValue;
42
42
  try {
43
43
  result = cb();
@@ -86,7 +86,7 @@ var isNumber = _createIs(NUMBER);
86
86
  var isBoolean = _createIs(BOOLEAN);
87
87
  var isError = _createObjIs("Error");
88
88
  function isTruthy(value) {
89
- return !(!value || _safeGet(function () { return !(value && (0 + value)); }, !value));
89
+ return !(!value || safeGet(function () { return !(value && (0 + value)); }, !value));
90
90
  }
91
91
 
92
92
  var objGetOwnPropertyDescriptor = ObjClass.getOwnPropertyDescriptor;
@@ -350,8 +350,8 @@ function getLazy(cb) {
350
350
  return lazyValue;
351
351
  }
352
352
 
353
- function _lazySafeGet(cb, defValue) {
354
- return getLazy(function () { return _safeGet(cb, defValue); });
353
+ function safeGetLazy(cb, defValue) {
354
+ return getLazy(function () { return safeGet(cb, defValue); });
355
355
  }
356
356
 
357
357
  var WINDOW = "window";
@@ -361,11 +361,11 @@ var _cachedDocument;
361
361
  var _cachedNavigator;
362
362
  var _cachedHistory;
363
363
  var _isWebWorker;
364
- function _lazySafeGetInst(name) {
365
- return _lazySafeGet(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
364
+ function lazySafeGetInst(name) {
365
+ return safeGetLazy(function () { return getInst(name) || UNDEF_VALUE; }, UNDEF_VALUE);
366
366
  }
367
367
  function getGlobal(useCached) {
368
- (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = _lazySafeGet(_getGlobalValue, null));
368
+ (!_cachedGlobal || useCached === false || (_globalLazyTestHooks.lzy && !_cachedGlobal.b)) && (_cachedGlobal = safeGetLazy(_getGlobalValue, null));
369
369
  return _cachedGlobal.v;
370
370
  }
371
371
  function getInst(name, useCached) {
@@ -379,29 +379,29 @@ function getInst(name, useCached) {
379
379
  return null;
380
380
  }
381
381
  function getDocument() {
382
- (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = _lazySafeGetInst("document"));
382
+ (!_cachedDocument || (_globalLazyTestHooks.lzy && !_cachedDocument.b)) && (_cachedDocument = lazySafeGetInst("document"));
383
383
  return _cachedDocument.v;
384
384
  }
385
385
  function hasWindow() {
386
386
  return !!getWindow();
387
387
  }
388
388
  function getWindow() {
389
- (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = _lazySafeGetInst(WINDOW));
389
+ (!_cachedWindow || (_globalLazyTestHooks.lzy && !_cachedWindow.b)) && (_cachedWindow = lazySafeGetInst(WINDOW));
390
390
  return _cachedWindow.v;
391
391
  }
392
392
  function getNavigator() {
393
- (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = _lazySafeGetInst("navigator"));
393
+ (!_cachedNavigator || (_globalLazyTestHooks.lzy && !_cachedNavigator.b)) && (_cachedNavigator = lazySafeGetInst("navigator"));
394
394
  return _cachedNavigator.v;
395
395
  }
396
396
  function hasHistory() {
397
397
  return !!getHistory();
398
398
  }
399
399
  function getHistory() {
400
- (!_cachedHistory || (_globalLazyTestHooks.lzy && !_cachedHistory.b)) && (_cachedHistory = _lazySafeGetInst("history"));
400
+ (!_cachedHistory || (_globalLazyTestHooks.lzy && !_cachedHistory.b)) && (_cachedHistory = lazySafeGetInst("history"));
401
401
  return _cachedHistory.v;
402
402
  }
403
403
  function isWebWorker() {
404
- !_isWebWorker && (_isWebWorker = _lazySafeGet(function () { return !!(self && self instanceof WorkerGlobalScope); }, false));
404
+ !_isWebWorker && (_isWebWorker = safeGetLazy(function () { return !!(self && self instanceof WorkerGlobalScope); }, false));
405
405
  return _isWebWorker.v;
406
406
  }
407
407
 
@@ -409,13 +409,13 @@ var _symbol;
409
409
  var _symbolFor;
410
410
  var _symbolKeyFor;
411
411
  function _getSymbolValue(name) {
412
- return _lazySafeGet(function () {
412
+ return safeGetLazy(function () {
413
413
  return (_symbol.v ? _symbol[name] : UNDEF_VALUE);
414
414
  }, UNDEF_VALUE);
415
415
  }
416
416
  function getSymbol() {
417
417
  var resetCache = !_symbol || (_globalLazyTestHooks && _globalLazyTestHooks.lzy && !_symbol.b);
418
- resetCache && (_symbol = _lazySafeGetInst(SYMBOL));
418
+ resetCache && (_symbol = lazySafeGetInst(SYMBOL));
419
419
  (!_symbolFor || resetCache) && (_symbolFor = _getSymbolValue("for"));
420
420
  (!_symbolKeyFor || resetCache) && (_symbolKeyFor = _getSymbolValue("keyFor"));
421
421
  return _symbol.v;
@@ -606,7 +606,7 @@ function isPlainObject(value) {
606
606
 
607
607
  var _perf;
608
608
  function getPerformance() {
609
- (!_perf || (_globalLazyTestHooks.lzy && !_perf.b)) && (_perf = _lazySafeGetInst("performance"));
609
+ (!_perf || (_globalLazyTestHooks.lzy && !_perf.b)) && (_perf = lazySafeGetInst("performance"));
610
610
  return _perf.v;
611
611
  }
612
612
 
@@ -1037,6 +1037,7 @@ var _DYN_TIME = "time";
1037
1037
  var _DYN_PROCESS_NEXT = "processNext";
1038
1038
  var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
1039
1039
  var _DYN_ENABLED = "enabled";
1040
+ var _DYN_UNLOAD = "unload";
1040
1041
  var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
1041
1042
  var _DYN_CREATE_NEW = "createNew";
1042
1043
  var _DYN_TEARDOWN = "teardown";
@@ -1287,7 +1288,7 @@ function newId(maxLength) {
1287
1288
  return result;
1288
1289
  }
1289
1290
 
1290
- var version = "3.0.1-nightly3.2304-38";
1291
+ var version = "3.0.1-nightly3.2304-44";
1291
1292
  var instanceName = "." + newId(6);
1292
1293
  var _dataUid = 0;
1293
1294
  function _canAcceptData(target) {
@@ -1882,7 +1883,7 @@ function onConfigChange(config, configHandler, logger) {
1882
1883
  return handler[_DYN_WATCH ](configHandler);
1883
1884
  }
1884
1885
  _logInvalidAccess(logger, STR_NOT_DYNAMIC_ERROR + dumpObj(config));
1885
- createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
1886
+ return createDynamicConfig(config, null, logger)[_DYN_WATCH ](configHandler);
1886
1887
  }
1887
1888
 
1888
1889
  function _stringToBoolOrDefault(theValue, defaultValue, theConfig) {
@@ -2002,8 +2003,9 @@ var DiagnosticLogger = /** @class */ (function () {
2002
2003
  var _loggingLevelTelemetry;
2003
2004
  var _maxInternalMessageLimit;
2004
2005
  var _enableDebug;
2006
+ var _unloadHandler;
2005
2007
  dynamicProto(DiagnosticLogger, this, function (_self) {
2006
- _setDefaultsFromConfig(config || {});
2008
+ _unloadHandler = _setDefaultsFromConfig(config || {});
2007
2009
  _self.consoleLoggingLevel = function () { return _loggingLevelConsole; };
2008
2010
  _self[_DYN_THROW_INTERNAL ] = function (severity, msgId, msg, properties, isUserAct) {
2009
2011
  if (isUserAct === void 0) { isUserAct = false; }
@@ -2046,6 +2048,10 @@ var DiagnosticLogger = /** @class */ (function () {
2046
2048
  _messageLogged = {};
2047
2049
  };
2048
2050
  _self[_DYN_LOG_INTERNAL_MESSAGE ] = _logInternalMessage;
2051
+ _self[_DYN_UNLOAD ] = function (isAsync) {
2052
+ _unloadHandler && _unloadHandler.rm();
2053
+ _unloadHandler = null;
2054
+ };
2049
2055
  function _logInternalMessage(severity, message) {
2050
2056
  if (_areInternalMessagesThrottled()) {
2051
2057
  return;
@@ -2078,8 +2084,7 @@ var DiagnosticLogger = /** @class */ (function () {
2078
2084
  }
2079
2085
  }
2080
2086
  function _setDefaultsFromConfig(config) {
2081
- var handler = createDynamicConfig(config, defaultValues$2, _self);
2082
- handler[_DYN_WATCH ](function (details) {
2087
+ return onConfigChange(createDynamicConfig(config, defaultValues$2, _self).cfg, function (details) {
2083
2088
  var config = details.cfg;
2084
2089
  _loggingLevelConsole = config[_DYN_LOGGING_LEVEL_CONSOL4 ];
2085
2090
  _loggingLevelTelemetry = config.loggingLevelTelemetry;
@@ -2204,15 +2209,17 @@ function safeGetCookieMgr(core, config) {
2204
2209
  return cookieMgr;
2205
2210
  }
2206
2211
  function createCookieMgr(rootConfig, logger) {
2212
+ var _a;
2207
2213
  var cookieMgrConfig;
2208
2214
  var _path;
2209
2215
  var _domain;
2216
+ var unloadHandler;
2210
2217
  var _enabled;
2211
2218
  var _getCookieFn;
2212
2219
  var _setCookieFn;
2213
2220
  var _delCookieFn;
2214
2221
  rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
2215
- onConfigChange(rootConfig, function (details) {
2222
+ unloadHandler = onConfigChange(rootConfig, function (details) {
2216
2223
  details[_DYN_SET_DF ](details.cfg, rootDefaultConfig);
2217
2224
  cookieMgrConfig = details.ref(details.cfg, "cookieCfg");
2218
2225
  _path = cookieMgrConfig[STR_PATH ] || "/";
@@ -2222,92 +2229,97 @@ function createCookieMgr(rootConfig, logger) {
2222
2229
  _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2223
2230
  _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2224
2231
  }, logger);
2225
- var cookieMgr = {
2226
- isEnabled: function () {
2227
- var enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false && _enabled && areCookiesSupported(logger);
2228
- var gblManager = _globalCookieConfig[strConfigCookieMgr];
2229
- if (enabled && gblManager && cookieMgr !== gblManager) {
2230
- enabled = _isMgrEnabled(gblManager);
2231
- }
2232
- return enabled;
2233
- },
2234
- setEnabled: function (value) {
2235
- _enabled = value !== false;
2236
- cookieMgrConfig[_DYN_ENABLED ] = value;
2237
- },
2238
- set: function (name, value, maxAgeSec, domain, path) {
2239
- var result = false;
2240
- if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2241
- var values = {};
2242
- var theValue = strTrim(value || STR_EMPTY);
2243
- var idx = strIndexOf(theValue, ";");
2244
- if (idx !== -1) {
2245
- theValue = strTrim(strLeft(value, idx));
2246
- values = _extractParts(strSubstring(value, idx + 1));
2247
- }
2248
- setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2249
- if (!isNullOrUndefined(maxAgeSec)) {
2250
- var _isIE = isIE();
2251
- if (isUndefined(values[strExpires])) {
2252
- var nowMs = utcNow();
2253
- var expireMs = nowMs + (maxAgeSec * 1000);
2254
- if (expireMs > 0) {
2255
- var expiry = new Date();
2256
- expiry.setTime(expireMs);
2257
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2232
+ var cookieMgr = (_a = {
2233
+ isEnabled: function () {
2234
+ var enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false && _enabled && areCookiesSupported(logger);
2235
+ var gblManager = _globalCookieConfig[strConfigCookieMgr];
2236
+ if (enabled && gblManager && cookieMgr !== gblManager) {
2237
+ enabled = _isMgrEnabled(gblManager);
2238
+ }
2239
+ return enabled;
2240
+ },
2241
+ setEnabled: function (value) {
2242
+ _enabled = value !== false;
2243
+ cookieMgrConfig[_DYN_ENABLED ] = value;
2244
+ },
2245
+ set: function (name, value, maxAgeSec, domain, path) {
2246
+ var result = false;
2247
+ if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2248
+ var values = {};
2249
+ var theValue = strTrim(value || STR_EMPTY);
2250
+ var idx = strIndexOf(theValue, ";");
2251
+ if (idx !== -1) {
2252
+ theValue = strTrim(strLeft(value, idx));
2253
+ values = _extractParts(strSubstring(value, idx + 1));
2254
+ }
2255
+ setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2256
+ if (!isNullOrUndefined(maxAgeSec)) {
2257
+ var _isIE = isIE();
2258
+ if (isUndefined(values[strExpires])) {
2259
+ var nowMs = utcNow();
2260
+ var expireMs = nowMs + (maxAgeSec * 1000);
2261
+ if (expireMs > 0) {
2262
+ var expiry = new Date();
2263
+ expiry.setTime(expireMs);
2264
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2265
+ }
2266
+ }
2267
+ if (!_isIE) {
2268
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2258
2269
  }
2259
2270
  }
2260
- if (!_isIE) {
2261
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2271
+ var location_1 = getLocation();
2272
+ if (location_1 && location_1.protocol === "https:") {
2273
+ setValue(values, "secure", null, null, isUndefined);
2274
+ if (_allowUaSameSite === null) {
2275
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2276
+ }
2277
+ if (_allowUaSameSite) {
2278
+ setValue(values, "SameSite", "None", null, isUndefined);
2279
+ }
2262
2280
  }
2281
+ setValue(values, STR_PATH, path || _path, null, isUndefined);
2282
+ _setCookieFn(name, _formatCookieValue(theValue, values));
2283
+ result = true;
2263
2284
  }
2264
- var location_1 = getLocation();
2265
- if (location_1 && location_1.protocol === "https:") {
2266
- setValue(values, "secure", null, null, isUndefined);
2267
- if (_allowUaSameSite === null) {
2268
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2269
- }
2270
- if (_allowUaSameSite) {
2271
- setValue(values, "SameSite", "None", null, isUndefined);
2285
+ return result;
2286
+ },
2287
+ get: function (name) {
2288
+ var value = STR_EMPTY;
2289
+ if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2290
+ value = _getCookieFn(name);
2291
+ }
2292
+ return value;
2293
+ },
2294
+ del: function (name, path) {
2295
+ var result = false;
2296
+ if (_isMgrEnabled(cookieMgr)) {
2297
+ result = cookieMgr.purge(name, path);
2298
+ }
2299
+ return result;
2300
+ },
2301
+ purge: function (name, path) {
2302
+ var _a;
2303
+ var result = false;
2304
+ if (areCookiesSupported(logger)) {
2305
+ var values = (_a = {},
2306
+ _a[STR_PATH] = path ? path : "/",
2307
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2308
+ _a);
2309
+ if (!isIE()) {
2310
+ values["max-age"] = "0";
2272
2311
  }
2312
+ _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2313
+ result = true;
2273
2314
  }
2274
- setValue(values, STR_PATH, path || _path, null, isUndefined);
2275
- _setCookieFn(name, _formatCookieValue(theValue, values));
2276
- result = true;
2277
- }
2278
- return result;
2279
- },
2280
- get: function (name) {
2281
- var value = STR_EMPTY;
2282
- if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2283
- value = _getCookieFn(name);
2315
+ return result;
2284
2316
  }
2285
- return value;
2286
2317
  },
2287
- del: function (name, path) {
2288
- var result = false;
2289
- if (_isMgrEnabled(cookieMgr)) {
2290
- result = cookieMgr.purge(name, path);
2291
- }
2292
- return result;
2318
+ _a[_DYN_UNLOAD ] = function (isAsync) {
2319
+ unloadHandler && unloadHandler.rm();
2320
+ unloadHandler = null;
2293
2321
  },
2294
- purge: function (name, path) {
2295
- var _a;
2296
- var result = false;
2297
- if (areCookiesSupported(logger)) {
2298
- var values = (_a = {},
2299
- _a[STR_PATH] = path ? path : "/",
2300
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2301
- _a);
2302
- if (!isIE()) {
2303
- values["max-age"] = "0";
2304
- }
2305
- _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2306
- result = true;
2307
- }
2308
- return result;
2309
- }
2310
- };
2322
+ _a);
2311
2323
  cookieMgr[strConfigCookieMgr] = cookieMgr;
2312
2324
  return cookieMgr;
2313
2325
  }
@@ -2721,7 +2733,7 @@ function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
2721
2733
  var context = internalContext.ctx;
2722
2734
  function _processNext(unloadState) {
2723
2735
  var nextPlugin = internalContext._next();
2724
- nextPlugin && nextPlugin.unload(context, unloadState);
2736
+ nextPlugin && nextPlugin[_DYN_UNLOAD ](context, unloadState);
2725
2737
  return !nextPlugin;
2726
2738
  }
2727
2739
  function _createNew(plugins, startAt) {
@@ -4573,7 +4585,8 @@ var PageViewManager = /** @class */ (function () {
4573
4585
  }
4574
4586
  function _flushChannels(isAsync) {
4575
4587
  if (core) {
4576
- core.flush(isAsync);
4588
+ core.flush(isAsync, function () {
4589
+ });
4577
4590
  }
4578
4591
  }
4579
4592
  function _startTimer() {
@@ -5447,7 +5460,7 @@ var AnalyticsPlugin = /** @class */ (function (_super) {
5447
5460
  });
5448
5461
  return _this;
5449
5462
  }
5450
- AnalyticsPlugin.Version = "3.0.1-nightly3.2304-38";
5463
+ AnalyticsPlugin.Version = "3.0.1-nightly3.2304-44";
5451
5464
  return AnalyticsPlugin;
5452
5465
  }(BaseTelemetryPlugin));
5453
5466