@microsoft/applicationinsights-properties-js 3.3.10-nightly3.2507-28 → 3.3.10-nightly3.2508-01

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 (50) hide show
  1. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.js → ai.props.3.3.10-nightly3.2508-01.cjs.js} +134 -78
  2. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.gbl.js.map → ai.props.3.3.10-nightly3.2508-01.cjs.js.map} +1 -1
  3. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.cjs.min.js → ai.props.3.3.10-nightly3.2508-01.cjs.min.js} +3 -3
  4. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.cjs.min.js.map → ai.props.3.3.10-nightly3.2508-01.cjs.min.js.map} +1 -1
  5. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.gbl.js → ai.props.3.3.10-nightly3.2508-01.gbl.js} +136 -53
  6. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.cjs.js.map → ai.props.3.3.10-nightly3.2508-01.gbl.js.map} +1 -1
  7. package/browser/es5/ai.props.3.3.10-nightly3.2508-01.gbl.min.js +6 -0
  8. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.gbl.min.js.map → ai.props.3.3.10-nightly3.2508-01.gbl.min.js.map} +1 -1
  9. package/browser/es5/ai.props.3.3.10-nightly3.2508-01.integrity.json +66 -0
  10. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.cjs.js → ai.props.3.3.10-nightly3.2508-01.js} +161 -51
  11. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.js.map → ai.props.3.3.10-nightly3.2508-01.js.map} +1 -1
  12. package/browser/es5/ai.props.3.3.10-nightly3.2508-01.min.js +6 -0
  13. package/browser/es5/{ai.props.3.3.10-nightly3.2507-28.min.js.map → ai.props.3.3.10-nightly3.2508-01.min.js.map} +1 -1
  14. package/browser/es5/ai.props.3.cjs.js +133 -50
  15. package/browser/es5/ai.props.3.cjs.js.map +1 -1
  16. package/browser/es5/ai.props.3.cjs.min.js +2 -2
  17. package/browser/es5/ai.props.3.cjs.min.js.map +1 -1
  18. package/browser/es5/ai.props.3.gbl.js +135 -52
  19. package/browser/es5/ai.props.3.gbl.js.map +1 -1
  20. package/browser/es5/ai.props.3.gbl.min.js +2 -2
  21. package/browser/es5/ai.props.3.gbl.min.js.map +1 -1
  22. package/browser/es5/ai.props.3.integrity.json +25 -25
  23. package/browser/es5/ai.props.3.js +135 -52
  24. package/browser/es5/ai.props.3.js.map +1 -1
  25. package/browser/es5/ai.props.3.min.js +2 -2
  26. package/browser/es5/ai.props.3.min.js.map +1 -1
  27. package/dist/es5/applicationinsights-properties-js.js +133 -50
  28. package/dist/es5/applicationinsights-properties-js.js.map +1 -1
  29. package/dist/es5/applicationinsights-properties-js.min.js +2 -2
  30. package/dist/es5/applicationinsights-properties-js.min.js.map +1 -1
  31. package/dist-es5/Context/Application.js +1 -1
  32. package/dist-es5/Context/Device.js +1 -1
  33. package/dist-es5/Context/Internal.js +2 -2
  34. package/dist-es5/Context/Internal.js.map +1 -1
  35. package/dist-es5/Context/Location.js +1 -1
  36. package/dist-es5/Context/Session.js +1 -1
  37. package/dist-es5/Context/TelemetryTrace.js +1 -1
  38. package/dist-es5/Context/User.js +1 -1
  39. package/dist-es5/Interfaces/IPropTelemetryContext.js +1 -1
  40. package/dist-es5/Interfaces/IPropertiesConfig.js +1 -1
  41. package/dist-es5/PropertiesPlugin.js +1 -1
  42. package/dist-es5/TelemetryContext.js +1 -1
  43. package/dist-es5/__DynamicConstants.js +1 -1
  44. package/dist-es5/applicationinsights-properties-js.js +1 -1
  45. package/package.json +3 -3
  46. package/types/applicationinsights-properties-js.d.ts +1 -1
  47. package/types/applicationinsights-properties-js.namespaced.d.ts +9 -1
  48. package/browser/es5/ai.props.3.3.10-nightly3.2507-28.gbl.min.js +0 -6
  49. package/browser/es5/ai.props.3.3.10-nightly3.2507-28.integrity.json +0 -66
  50. package/browser/es5/ai.props.3.3.10-nightly3.2507-28.min.js +0 -6
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 3.3.10-nightly3.2507-28
2
+ * Application Insights JavaScript SDK - Properties Plugin, 3.3.10-nightly3.2508-01
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
6
6
  var undef = "undefined";
7
- var nsKey, key, nm, theExports = {}, modName = "es5_ai_props_3_3_10_nightly3_2507_28", msMod="__ms$mod__";
8
- var mods={}, modDetail=mods[modName]={}, ver="3.3.10-nightly3.2507-28";
7
+ var nsKey, key, nm, theExports = {}, modName = "es5_ai_props_3_3_10_nightly3_2508_01", msMod="__ms$mod__";
8
+ var mods={}, modDetail=mods[modName]={}, ver="3.3.10-nightly3.2508-01";
9
9
  var baseNs=global, nsKey="Microsoft", baseNs=baseNs[nsKey]=(baseNs[nsKey]||{});
10
10
  // Versioned namespace "Microsoft.ApplicationInsights3"
11
11
  var exportNs=baseNs, nsKey="ApplicationInsights3", exportNs=exportNs[nsKey]=(exportNs[nsKey]||{});
@@ -1544,7 +1544,7 @@ function newId(maxLength) {
1544
1544
  return result;
1545
1545
  }
1546
1546
 
1547
- var version = '3.3.10-nightly3.2507-28';
1547
+ var version = '3.3.10-nightly3.2508-01';
1548
1548
  var instanceName = "." + newId(6);
1549
1549
  var _dataUid = 0;
1550
1550
  function _canAcceptData(target) {
@@ -2439,6 +2439,7 @@ var rootDefaultConfig = (_a$2 = {
2439
2439
  _b.enabled = UNDEFINED_VALUE,
2440
2440
  _b.ignoreCookies = UNDEFINED_VALUE,
2441
2441
  _b.blockedCookies = UNDEFINED_VALUE,
2442
+ _b.disableCookieDefer = false,
2442
2443
  _b)),
2443
2444
  cookieDomain: UNDEFINED_VALUE,
2444
2445
  cookiePath: UNDEFINED_VALUE
@@ -2518,16 +2519,99 @@ function createCookieMgr(rootConfig, logger) {
2518
2519
  var _getCookieFn;
2519
2520
  var _setCookieFn;
2520
2521
  var _delCookieFn;
2522
+ var _pendingCookies = [];
2523
+ function _formatDeletionValue(path) {
2524
+ var _a;
2525
+ var values = (_a = {},
2526
+ _a[STR_PATH] = path ? path : "/",
2527
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2528
+ _a);
2529
+ if (!isIE()) {
2530
+ values["max-age"] = "0";
2531
+ }
2532
+ return _formatCookieValue(STR_EMPTY, values);
2533
+ }
2534
+ function _formatSetCookieValue(value, maxAgeSec, domain, path) {
2535
+ var values = {};
2536
+ var theValue = strTrim(value || STR_EMPTY);
2537
+ var idx = strIndexOf(theValue, ";");
2538
+ if (idx !== -1) {
2539
+ theValue = strTrim(strLeft(value, idx));
2540
+ values = _extractParts(strSubstring(value, idx + 1));
2541
+ }
2542
+ setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2543
+ if (!isNullOrUndefined(maxAgeSec)) {
2544
+ var _isIE = isIE();
2545
+ if (isUndefined(values[strExpires])) {
2546
+ var nowMs = utcNow();
2547
+ var expireMs = nowMs + (maxAgeSec * 1000);
2548
+ if (expireMs > 0) {
2549
+ var expiry = new Date();
2550
+ expiry.setTime(expireMs);
2551
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2552
+ }
2553
+ }
2554
+ if (!_isIE) {
2555
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2556
+ }
2557
+ }
2558
+ var location = getLocation();
2559
+ if (location && location.protocol === "https:") {
2560
+ setValue(values, "secure", null, null, isUndefined);
2561
+ if (_allowUaSameSite === null) {
2562
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2563
+ }
2564
+ if (_allowUaSameSite) {
2565
+ setValue(values, "SameSite", "None", null, isUndefined);
2566
+ }
2567
+ }
2568
+ setValue(values, STR_PATH, path || _path, null, isUndefined);
2569
+ return _formatCookieValue(theValue, values);
2570
+ }
2571
+ function _removePendingCookie(name) {
2572
+ if (_pendingCookies) {
2573
+ for (var i = _pendingCookies[_DYN_LENGTH$1 ] - 1; i >= 0; i--) {
2574
+ if (_pendingCookies[i].n === name) {
2575
+ _pendingCookies[_DYN_SPLICE ](i, 1);
2576
+ }
2577
+ }
2578
+ }
2579
+ }
2580
+ function _flushPendingCookies() {
2581
+ if (areCookiesSupported(logger) && _pendingCookies) {
2582
+ arrForEach(_pendingCookies, function (pendingData) {
2583
+ if (!_isBlockedCookie(cookieMgrConfig, pendingData.n)) {
2584
+ if (pendingData.o === 0 ) {
2585
+ _setCookieFn(pendingData.n, pendingData.v);
2586
+ }
2587
+ else if (pendingData.o === 1 ) {
2588
+ _delCookieFn(pendingData.n, pendingData.v);
2589
+ }
2590
+ }
2591
+ });
2592
+ _pendingCookies = [];
2593
+ }
2594
+ }
2521
2595
  rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
2522
2596
  unloadHandler = onConfigChange(rootConfig, function (details) {
2523
2597
  details.setDf(details.cfg, rootDefaultConfig);
2524
2598
  cookieMgrConfig = details.ref(details.cfg, "cookieCfg");
2525
2599
  _path = cookieMgrConfig[STR_PATH ] || "/";
2526
2600
  _domain = cookieMgrConfig[STR_DOMAIN ];
2601
+ if (cookieMgrConfig.disableCookieDefer) {
2602
+ _pendingCookies = null;
2603
+ }
2604
+ else if (_pendingCookies === null) {
2605
+ _pendingCookies = [];
2606
+ }
2607
+ var wasEnabled = _enabled;
2527
2608
  _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false;
2528
2609
  _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
2529
2610
  _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2530
2611
  _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2612
+ if (!wasEnabled && _enabled && _pendingCookies) {
2613
+ _flushPendingCookies();
2614
+ }
2531
2615
  }, logger);
2532
2616
  var cookieMgr = {
2533
2617
  isEnabled: function () {
@@ -2539,55 +2623,52 @@ function createCookieMgr(rootConfig, logger) {
2539
2623
  return enabled;
2540
2624
  },
2541
2625
  setEnabled: function (value) {
2542
- _enabled = value !== false;
2543
2626
  cookieMgrConfig[_DYN_ENABLED ] = value;
2627
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
2628
+ rootConfig[strDisableCookiesUsage] = !value;
2629
+ }
2544
2630
  },
2545
2631
  set: function (name, value, maxAgeSec, domain, path) {
2546
2632
  var result = false;
2547
- if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2548
- var values = {};
2549
- var theValue = strTrim(value || STR_EMPTY);
2550
- var idx = strIndexOf(theValue, ";");
2551
- if (idx !== -1) {
2552
- theValue = strTrim(strLeft(value, idx));
2553
- values = _extractParts(strSubstring(value, idx + 1));
2554
- }
2555
- setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2556
- if (!isNullOrUndefined(maxAgeSec)) {
2557
- var _isIE = isIE();
2558
- if (isUndefined(values[strExpires])) {
2559
- var nowMs = utcNow();
2560
- var expireMs = nowMs + (maxAgeSec * 1000);
2561
- if (expireMs > 0) {
2562
- var expiry = new Date();
2563
- expiry.setTime(expireMs);
2564
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2565
- }
2566
- }
2567
- if (!_isIE) {
2568
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2569
- }
2633
+ var isBlocked = _isBlockedCookie(cookieMgrConfig, name);
2634
+ if (!isBlocked) {
2635
+ var cookieValue = _formatSetCookieValue(value, maxAgeSec, domain, path);
2636
+ if (_isMgrEnabled(cookieMgr)) {
2637
+ _setCookieFn(name, cookieValue);
2638
+ result = true;
2570
2639
  }
2571
- var location_1 = getLocation();
2572
- if (location_1 && location_1.protocol === "https:") {
2573
- setValue(values, "secure", null, null, isUndefined);
2574
- if (_allowUaSameSite === null) {
2575
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2576
- }
2577
- if (_allowUaSameSite) {
2578
- setValue(values, "SameSite", "None", null, isUndefined);
2579
- }
2640
+ else if (_pendingCookies) {
2641
+ _removePendingCookie(name);
2642
+ _pendingCookies[_DYN_PUSH ]({
2643
+ n: name,
2644
+ o: 0 ,
2645
+ v: cookieValue
2646
+ });
2647
+ result = true;
2580
2648
  }
2581
- setValue(values, STR_PATH, path || _path, null, isUndefined);
2582
- _setCookieFn(name, _formatCookieValue(theValue, values));
2583
- result = true;
2584
2649
  }
2585
2650
  return result;
2586
2651
  },
2587
2652
  get: function (name) {
2588
2653
  var value = STR_EMPTY;
2589
- if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2590
- value = _getCookieFn(name);
2654
+ var isIgnored = _isIgnoredCookie(cookieMgrConfig, name);
2655
+ if (!isIgnored) {
2656
+ if (_isMgrEnabled(cookieMgr)) {
2657
+ value = _getCookieFn(name);
2658
+ }
2659
+ else if (_pendingCookies) {
2660
+ for (var i = _pendingCookies[_DYN_LENGTH$1 ] - 1; i >= 0; i--) {
2661
+ var pendingData = _pendingCookies[i];
2662
+ if (pendingData.n === name) {
2663
+ if (pendingData.o === 0 ) {
2664
+ var cookieValue = pendingData.v;
2665
+ var idx = strIndexOf(cookieValue, ";");
2666
+ value = idx !== -1 ? strTrim(strLeft(cookieValue, idx)) : strTrim(cookieValue);
2667
+ }
2668
+ break;
2669
+ }
2670
+ }
2671
+ }
2591
2672
  }
2592
2673
  return value;
2593
2674
  },
@@ -2596,20 +2677,21 @@ function createCookieMgr(rootConfig, logger) {
2596
2677
  if (_isMgrEnabled(cookieMgr)) {
2597
2678
  result = cookieMgr.purge(name, path);
2598
2679
  }
2680
+ else if (_pendingCookies) {
2681
+ _removePendingCookie(name);
2682
+ _pendingCookies[_DYN_PUSH ]({
2683
+ n: name,
2684
+ o: 1 ,
2685
+ v: _formatDeletionValue(path)
2686
+ });
2687
+ result = true;
2688
+ }
2599
2689
  return result;
2600
2690
  },
2601
2691
  purge: function (name, path) {
2602
- var _a;
2603
2692
  var result = false;
2604
2693
  if (areCookiesSupported(logger)) {
2605
- var values = (_a = {},
2606
- _a[STR_PATH] = path ? path : "/",
2607
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2608
- _a);
2609
- if (!isIE()) {
2610
- values["max-age"] = "0";
2611
- }
2612
- _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2694
+ _delCookieFn(name, _formatDeletionValue(path));
2613
2695
  result = true;
2614
2696
  }
2615
2697
  return result;
@@ -2617,6 +2699,7 @@ function createCookieMgr(rootConfig, logger) {
2617
2699
  unload: function (isAsync) {
2618
2700
  unloadHandler && unloadHandler.rm();
2619
2701
  unloadHandler = null;
2702
+ _pendingCookies = null;
2620
2703
  }
2621
2704
  };
2622
2705
  cookieMgr[strConfigCookieMgr] = cookieMgr;
@@ -3791,7 +3874,7 @@ var Device = /** @class */ (function () {
3791
3874
  return Device;
3792
3875
  }());
3793
3876
 
3794
- var Version = '3.3.10-nightly3.2507-28';
3877
+ var Version = '3.3.10-nightly3.2508-01';
3795
3878
  var Internal = /** @class */ (function () {
3796
3879
  function Internal(config, unloadHookContainer) {
3797
3880
  var _this = this;