@microsoft/applicationinsights-analytics-js 3.3.10-nightly3.2507-29 → 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 (29) hide show
  1. package/browser/es5/applicationinsights-analytics-js.cjs.js +133 -50
  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 +135 -52
  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 +135 -52
  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 +133 -50
  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/Interfaces/IAnalyticsConfig.js +1 -1
  21. package/dist-es5/JavaScriptSDK/Telemetry/PageViewManager.js +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/__DynamicConstants.js +1 -1
  26. package/dist-es5/applicationinsights-analytics-js.js +1 -1
  27. package/package.json +6 -6
  28. package/types/applicationinsights-analytics-js.d.ts +1 -1
  29. package/types/applicationinsights-analytics-js.namespaced.d.ts +9 -1
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web Analytics, 3.3.10-nightly3.2507-29
2
+ * Application Insights JavaScript SDK - Web Analytics, 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_applicationinsights_analytics_js_3_3_10_nightly3_2507_29", msMod="__ms$mod__";
8
- var mods={}, modDetail=mods[modName]={}, ver="3.3.10-nightly3.2507-29";
7
+ var nsKey, key, nm, theExports = {}, modName = "es5_applicationinsights_analytics_js_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]||{});
@@ -1558,7 +1558,7 @@ function newId(maxLength) {
1558
1558
  return result;
1559
1559
  }
1560
1560
 
1561
- var version = '3.3.10-nightly3.2507-29';
1561
+ var version = '3.3.10-nightly3.2508-01';
1562
1562
  var instanceName = "." + newId(6);
1563
1563
  var _dataUid = 0;
1564
1564
  function _canAcceptData(target) {
@@ -2488,6 +2488,7 @@ var rootDefaultConfig = (_a$2 = {
2488
2488
  _b.enabled = UNDEFINED_VALUE,
2489
2489
  _b.ignoreCookies = UNDEFINED_VALUE,
2490
2490
  _b.blockedCookies = UNDEFINED_VALUE,
2491
+ _b.disableCookieDefer = false,
2491
2492
  _b)),
2492
2493
  cookieDomain: UNDEFINED_VALUE,
2493
2494
  cookiePath: UNDEFINED_VALUE
@@ -2567,16 +2568,99 @@ function createCookieMgr(rootConfig, logger) {
2567
2568
  var _getCookieFn;
2568
2569
  var _setCookieFn;
2569
2570
  var _delCookieFn;
2571
+ var _pendingCookies = [];
2572
+ function _formatDeletionValue(path) {
2573
+ var _a;
2574
+ var values = (_a = {},
2575
+ _a[STR_PATH] = path ? path : "/",
2576
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2577
+ _a);
2578
+ if (!isIE()) {
2579
+ values["max-age"] = "0";
2580
+ }
2581
+ return _formatCookieValue(STR_EMPTY, values);
2582
+ }
2583
+ function _formatSetCookieValue(value, maxAgeSec, domain, path) {
2584
+ var values = {};
2585
+ var theValue = strTrim(value || STR_EMPTY);
2586
+ var idx = strIndexOf(theValue, ";");
2587
+ if (idx !== -1) {
2588
+ theValue = strTrim(strLeft(value, idx));
2589
+ values = _extractParts(strSubstring(value, idx + 1));
2590
+ }
2591
+ setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2592
+ if (!isNullOrUndefined(maxAgeSec)) {
2593
+ var _isIE = isIE();
2594
+ if (isUndefined(values[strExpires])) {
2595
+ var nowMs = utcNow();
2596
+ var expireMs = nowMs + (maxAgeSec * 1000);
2597
+ if (expireMs > 0) {
2598
+ var expiry = new Date();
2599
+ expiry.setTime(expireMs);
2600
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2601
+ }
2602
+ }
2603
+ if (!_isIE) {
2604
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2605
+ }
2606
+ }
2607
+ var location = getLocation();
2608
+ if (location && location.protocol === "https:") {
2609
+ setValue(values, "secure", null, null, isUndefined);
2610
+ if (_allowUaSameSite === null) {
2611
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2612
+ }
2613
+ if (_allowUaSameSite) {
2614
+ setValue(values, "SameSite", "None", null, isUndefined);
2615
+ }
2616
+ }
2617
+ setValue(values, STR_PATH, path || _path, null, isUndefined);
2618
+ return _formatCookieValue(theValue, values);
2619
+ }
2620
+ function _removePendingCookie(name) {
2621
+ if (_pendingCookies) {
2622
+ for (var i = _pendingCookies[_DYN_LENGTH$2 ] - 1; i >= 0; i--) {
2623
+ if (_pendingCookies[i].n === name) {
2624
+ _pendingCookies[_DYN_SPLICE ](i, 1);
2625
+ }
2626
+ }
2627
+ }
2628
+ }
2629
+ function _flushPendingCookies() {
2630
+ if (areCookiesSupported(logger) && _pendingCookies) {
2631
+ arrForEach(_pendingCookies, function (pendingData) {
2632
+ if (!_isBlockedCookie(cookieMgrConfig, pendingData.n)) {
2633
+ if (pendingData.o === 0 ) {
2634
+ _setCookieFn(pendingData.n, pendingData.v);
2635
+ }
2636
+ else if (pendingData.o === 1 ) {
2637
+ _delCookieFn(pendingData.n, pendingData.v);
2638
+ }
2639
+ }
2640
+ });
2641
+ _pendingCookies = [];
2642
+ }
2643
+ }
2570
2644
  rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
2571
2645
  unloadHandler = onConfigChange(rootConfig, function (details) {
2572
2646
  details.setDf(details.cfg, rootDefaultConfig);
2573
2647
  cookieMgrConfig = details.ref(details.cfg, "cookieCfg");
2574
2648
  _path = cookieMgrConfig[STR_PATH ] || "/";
2575
2649
  _domain = cookieMgrConfig[STR_DOMAIN ];
2650
+ if (cookieMgrConfig.disableCookieDefer) {
2651
+ _pendingCookies = null;
2652
+ }
2653
+ else if (_pendingCookies === null) {
2654
+ _pendingCookies = [];
2655
+ }
2656
+ var wasEnabled = _enabled;
2576
2657
  _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false;
2577
2658
  _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
2578
2659
  _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2579
2660
  _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2661
+ if (!wasEnabled && _enabled && _pendingCookies) {
2662
+ _flushPendingCookies();
2663
+ }
2580
2664
  }, logger);
2581
2665
  var cookieMgr = {
2582
2666
  isEnabled: function () {
@@ -2588,55 +2672,52 @@ function createCookieMgr(rootConfig, logger) {
2588
2672
  return enabled;
2589
2673
  },
2590
2674
  setEnabled: function (value) {
2591
- _enabled = value !== false;
2592
2675
  cookieMgrConfig[_DYN_ENABLED ] = value;
2676
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
2677
+ rootConfig[strDisableCookiesUsage] = !value;
2678
+ }
2593
2679
  },
2594
2680
  set: function (name, value, maxAgeSec, domain, path) {
2595
2681
  var result = false;
2596
- if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2597
- var values = {};
2598
- var theValue = strTrim(value || STR_EMPTY);
2599
- var idx = strIndexOf(theValue, ";");
2600
- if (idx !== -1) {
2601
- theValue = strTrim(strLeft(value, idx));
2602
- values = _extractParts(strSubstring(value, idx + 1));
2603
- }
2604
- setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2605
- if (!isNullOrUndefined(maxAgeSec)) {
2606
- var _isIE = isIE();
2607
- if (isUndefined(values[strExpires])) {
2608
- var nowMs = utcNow();
2609
- var expireMs = nowMs + (maxAgeSec * 1000);
2610
- if (expireMs > 0) {
2611
- var expiry = new Date();
2612
- expiry.setTime(expireMs);
2613
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2614
- }
2615
- }
2616
- if (!_isIE) {
2617
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2618
- }
2682
+ var isBlocked = _isBlockedCookie(cookieMgrConfig, name);
2683
+ if (!isBlocked) {
2684
+ var cookieValue = _formatSetCookieValue(value, maxAgeSec, domain, path);
2685
+ if (_isMgrEnabled(cookieMgr)) {
2686
+ _setCookieFn(name, cookieValue);
2687
+ result = true;
2619
2688
  }
2620
- var location_1 = getLocation();
2621
- if (location_1 && location_1.protocol === "https:") {
2622
- setValue(values, "secure", null, null, isUndefined);
2623
- if (_allowUaSameSite === null) {
2624
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2625
- }
2626
- if (_allowUaSameSite) {
2627
- setValue(values, "SameSite", "None", null, isUndefined);
2628
- }
2689
+ else if (_pendingCookies) {
2690
+ _removePendingCookie(name);
2691
+ _pendingCookies[_DYN_PUSH ]({
2692
+ n: name,
2693
+ o: 0 ,
2694
+ v: cookieValue
2695
+ });
2696
+ result = true;
2629
2697
  }
2630
- setValue(values, STR_PATH, path || _path, null, isUndefined);
2631
- _setCookieFn(name, _formatCookieValue(theValue, values));
2632
- result = true;
2633
2698
  }
2634
2699
  return result;
2635
2700
  },
2636
2701
  get: function (name) {
2637
2702
  var value = STR_EMPTY;
2638
- if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2639
- value = _getCookieFn(name);
2703
+ var isIgnored = _isIgnoredCookie(cookieMgrConfig, name);
2704
+ if (!isIgnored) {
2705
+ if (_isMgrEnabled(cookieMgr)) {
2706
+ value = _getCookieFn(name);
2707
+ }
2708
+ else if (_pendingCookies) {
2709
+ for (var i = _pendingCookies[_DYN_LENGTH$2 ] - 1; i >= 0; i--) {
2710
+ var pendingData = _pendingCookies[i];
2711
+ if (pendingData.n === name) {
2712
+ if (pendingData.o === 0 ) {
2713
+ var cookieValue = pendingData.v;
2714
+ var idx = strIndexOf(cookieValue, ";");
2715
+ value = idx !== -1 ? strTrim(strLeft(cookieValue, idx)) : strTrim(cookieValue);
2716
+ }
2717
+ break;
2718
+ }
2719
+ }
2720
+ }
2640
2721
  }
2641
2722
  return value;
2642
2723
  },
@@ -2645,20 +2726,21 @@ function createCookieMgr(rootConfig, logger) {
2645
2726
  if (_isMgrEnabled(cookieMgr)) {
2646
2727
  result = cookieMgr.purge(name, path);
2647
2728
  }
2729
+ else if (_pendingCookies) {
2730
+ _removePendingCookie(name);
2731
+ _pendingCookies[_DYN_PUSH ]({
2732
+ n: name,
2733
+ o: 1 ,
2734
+ v: _formatDeletionValue(path)
2735
+ });
2736
+ result = true;
2737
+ }
2648
2738
  return result;
2649
2739
  },
2650
2740
  purge: function (name, path) {
2651
- var _a;
2652
2741
  var result = false;
2653
2742
  if (areCookiesSupported(logger)) {
2654
- var values = (_a = {},
2655
- _a[STR_PATH] = path ? path : "/",
2656
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2657
- _a);
2658
- if (!isIE()) {
2659
- values["max-age"] = "0";
2660
- }
2661
- _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2743
+ _delCookieFn(name, _formatDeletionValue(path));
2662
2744
  result = true;
2663
2745
  }
2664
2746
  return result;
@@ -2666,6 +2748,7 @@ function createCookieMgr(rootConfig, logger) {
2666
2748
  unload: function (isAsync) {
2667
2749
  unloadHandler && unloadHandler.rm();
2668
2750
  unloadHandler = null;
2751
+ _pendingCookies = null;
2669
2752
  }
2670
2753
  };
2671
2754
  cookieMgr[strConfigCookieMgr] = cookieMgr;
@@ -6009,7 +6092,7 @@ var AnalyticsPlugin = /** @class */ (function (_super) {
6009
6092
  });
6010
6093
  return _this;
6011
6094
  }
6012
- AnalyticsPlugin.Version = '3.3.10-nightly3.2507-29';
6095
+ AnalyticsPlugin.Version = '3.3.10-nightly3.2508-01';
6013
6096
  return AnalyticsPlugin;
6014
6097
  }(BaseTelemetryPlugin));
6015
6098