@microsoft/applicationinsights-analytics-js 3.3.10-nightly3.2507-28 → 3.3.10-nightly3.2508-02

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,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Web Analytics, 3.3.10-nightly3.2507-28
2
+ * Application Insights JavaScript SDK - Web Analytics, 3.3.10-nightly3.2508-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -1540,7 +1540,7 @@
1540
1540
  return result;
1541
1541
  }
1542
1542
 
1543
- var version = '3.3.10-nightly3.2507-28';
1543
+ var version = '3.3.10-nightly3.2508-02';
1544
1544
  var instanceName = "." + newId(6);
1545
1545
  var _dataUid = 0;
1546
1546
  function _canAcceptData(target) {
@@ -2470,6 +2470,7 @@
2470
2470
  _b.enabled = UNDEFINED_VALUE,
2471
2471
  _b.ignoreCookies = UNDEFINED_VALUE,
2472
2472
  _b.blockedCookies = UNDEFINED_VALUE,
2473
+ _b.disableCookieDefer = false,
2473
2474
  _b)),
2474
2475
  cookieDomain: UNDEFINED_VALUE,
2475
2476
  cookiePath: UNDEFINED_VALUE
@@ -2549,16 +2550,99 @@
2549
2550
  var _getCookieFn;
2550
2551
  var _setCookieFn;
2551
2552
  var _delCookieFn;
2553
+ var _pendingCookies = [];
2554
+ function _formatDeletionValue(path) {
2555
+ var _a;
2556
+ var values = (_a = {},
2557
+ _a[STR_PATH] = path ? path : "/",
2558
+ _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2559
+ _a);
2560
+ if (!isIE()) {
2561
+ values["max-age"] = "0";
2562
+ }
2563
+ return _formatCookieValue(STR_EMPTY, values);
2564
+ }
2565
+ function _formatSetCookieValue(value, maxAgeSec, domain, path) {
2566
+ var values = {};
2567
+ var theValue = strTrim(value || STR_EMPTY);
2568
+ var idx = strIndexOf(theValue, ";");
2569
+ if (idx !== -1) {
2570
+ theValue = strTrim(strLeft(value, idx));
2571
+ values = _extractParts(strSubstring(value, idx + 1));
2572
+ }
2573
+ setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2574
+ if (!isNullOrUndefined(maxAgeSec)) {
2575
+ var _isIE = isIE();
2576
+ if (isUndefined(values[strExpires])) {
2577
+ var nowMs = utcNow();
2578
+ var expireMs = nowMs + (maxAgeSec * 1000);
2579
+ if (expireMs > 0) {
2580
+ var expiry = new Date();
2581
+ expiry.setTime(expireMs);
2582
+ setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2583
+ }
2584
+ }
2585
+ if (!_isIE) {
2586
+ setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2587
+ }
2588
+ }
2589
+ var location = getLocation();
2590
+ if (location && location.protocol === "https:") {
2591
+ setValue(values, "secure", null, null, isUndefined);
2592
+ if (_allowUaSameSite === null) {
2593
+ _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2594
+ }
2595
+ if (_allowUaSameSite) {
2596
+ setValue(values, "SameSite", "None", null, isUndefined);
2597
+ }
2598
+ }
2599
+ setValue(values, STR_PATH, path || _path, null, isUndefined);
2600
+ return _formatCookieValue(theValue, values);
2601
+ }
2602
+ function _removePendingCookie(name) {
2603
+ if (_pendingCookies) {
2604
+ for (var i = _pendingCookies[_DYN_LENGTH$2 ] - 1; i >= 0; i--) {
2605
+ if (_pendingCookies[i].n === name) {
2606
+ _pendingCookies[_DYN_SPLICE ](i, 1);
2607
+ }
2608
+ }
2609
+ }
2610
+ }
2611
+ function _flushPendingCookies() {
2612
+ if (areCookiesSupported(logger) && _pendingCookies) {
2613
+ arrForEach(_pendingCookies, function (pendingData) {
2614
+ if (!_isBlockedCookie(cookieMgrConfig, pendingData.n)) {
2615
+ if (pendingData.o === 0 ) {
2616
+ _setCookieFn(pendingData.n, pendingData.v);
2617
+ }
2618
+ else if (pendingData.o === 1 ) {
2619
+ _delCookieFn(pendingData.n, pendingData.v);
2620
+ }
2621
+ }
2622
+ });
2623
+ _pendingCookies = [];
2624
+ }
2625
+ }
2552
2626
  rootConfig = createDynamicConfig(rootConfig || _globalCookieConfig, null, logger).cfg;
2553
2627
  unloadHandler = onConfigChange(rootConfig, function (details) {
2554
2628
  details.setDf(details.cfg, rootDefaultConfig);
2555
2629
  cookieMgrConfig = details.ref(details.cfg, "cookieCfg");
2556
2630
  _path = cookieMgrConfig[STR_PATH ] || "/";
2557
2631
  _domain = cookieMgrConfig[STR_DOMAIN ];
2632
+ if (cookieMgrConfig.disableCookieDefer) {
2633
+ _pendingCookies = null;
2634
+ }
2635
+ else if (_pendingCookies === null) {
2636
+ _pendingCookies = [];
2637
+ }
2638
+ var wasEnabled = _enabled;
2558
2639
  _enabled = _isCfgEnabled(rootConfig, cookieMgrConfig) !== false;
2559
2640
  _getCookieFn = cookieMgrConfig.getCookie || _getCookieValue;
2560
2641
  _setCookieFn = cookieMgrConfig.setCookie || _setCookieValue;
2561
2642
  _delCookieFn = cookieMgrConfig.delCookie || _setCookieValue;
2643
+ if (!wasEnabled && _enabled && _pendingCookies) {
2644
+ _flushPendingCookies();
2645
+ }
2562
2646
  }, logger);
2563
2647
  var cookieMgr = {
2564
2648
  isEnabled: function () {
@@ -2570,55 +2654,52 @@
2570
2654
  return enabled;
2571
2655
  },
2572
2656
  setEnabled: function (value) {
2573
- _enabled = value !== false;
2574
2657
  cookieMgrConfig[_DYN_ENABLED ] = value;
2658
+ if (!isUndefined(rootConfig[strDisableCookiesUsage])) {
2659
+ rootConfig[strDisableCookiesUsage] = !value;
2660
+ }
2575
2661
  },
2576
2662
  set: function (name, value, maxAgeSec, domain, path) {
2577
2663
  var result = false;
2578
- if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
2579
- var values = {};
2580
- var theValue = strTrim(value || STR_EMPTY);
2581
- var idx = strIndexOf(theValue, ";");
2582
- if (idx !== -1) {
2583
- theValue = strTrim(strLeft(value, idx));
2584
- values = _extractParts(strSubstring(value, idx + 1));
2585
- }
2586
- setValue(values, STR_DOMAIN, domain || _domain, isTruthy, isUndefined);
2587
- if (!isNullOrUndefined(maxAgeSec)) {
2588
- var _isIE = isIE();
2589
- if (isUndefined(values[strExpires])) {
2590
- var nowMs = utcNow();
2591
- var expireMs = nowMs + (maxAgeSec * 1000);
2592
- if (expireMs > 0) {
2593
- var expiry = new Date();
2594
- expiry.setTime(expireMs);
2595
- setValue(values, strExpires, _formatDate(expiry, !_isIE ? strToUTCString : strToGMTString) || _formatDate(expiry, _isIE ? strToGMTString : strToUTCString) || STR_EMPTY, isTruthy);
2596
- }
2597
- }
2598
- if (!_isIE) {
2599
- setValue(values, "max-age", STR_EMPTY + maxAgeSec, null, isUndefined);
2600
- }
2664
+ var isBlocked = _isBlockedCookie(cookieMgrConfig, name);
2665
+ if (!isBlocked) {
2666
+ var cookieValue = _formatSetCookieValue(value, maxAgeSec, domain, path);
2667
+ if (_isMgrEnabled(cookieMgr)) {
2668
+ _setCookieFn(name, cookieValue);
2669
+ result = true;
2601
2670
  }
2602
- var location_1 = getLocation();
2603
- if (location_1 && location_1.protocol === "https:") {
2604
- setValue(values, "secure", null, null, isUndefined);
2605
- if (_allowUaSameSite === null) {
2606
- _allowUaSameSite = !uaDisallowsSameSiteNone((getNavigator() || {})[_DYN_USER_AGENT ]);
2607
- }
2608
- if (_allowUaSameSite) {
2609
- setValue(values, "SameSite", "None", null, isUndefined);
2610
- }
2671
+ else if (_pendingCookies) {
2672
+ _removePendingCookie(name);
2673
+ _pendingCookies[_DYN_PUSH ]({
2674
+ n: name,
2675
+ o: 0 ,
2676
+ v: cookieValue
2677
+ });
2678
+ result = true;
2611
2679
  }
2612
- setValue(values, STR_PATH, path || _path, null, isUndefined);
2613
- _setCookieFn(name, _formatCookieValue(theValue, values));
2614
- result = true;
2615
2680
  }
2616
2681
  return result;
2617
2682
  },
2618
2683
  get: function (name) {
2619
2684
  var value = STR_EMPTY;
2620
- if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
2621
- value = _getCookieFn(name);
2685
+ var isIgnored = _isIgnoredCookie(cookieMgrConfig, name);
2686
+ if (!isIgnored) {
2687
+ if (_isMgrEnabled(cookieMgr)) {
2688
+ value = _getCookieFn(name);
2689
+ }
2690
+ else if (_pendingCookies) {
2691
+ for (var i = _pendingCookies[_DYN_LENGTH$2 ] - 1; i >= 0; i--) {
2692
+ var pendingData = _pendingCookies[i];
2693
+ if (pendingData.n === name) {
2694
+ if (pendingData.o === 0 ) {
2695
+ var cookieValue = pendingData.v;
2696
+ var idx = strIndexOf(cookieValue, ";");
2697
+ value = idx !== -1 ? strTrim(strLeft(cookieValue, idx)) : strTrim(cookieValue);
2698
+ }
2699
+ break;
2700
+ }
2701
+ }
2702
+ }
2622
2703
  }
2623
2704
  return value;
2624
2705
  },
@@ -2627,20 +2708,21 @@
2627
2708
  if (_isMgrEnabled(cookieMgr)) {
2628
2709
  result = cookieMgr.purge(name, path);
2629
2710
  }
2711
+ else if (_pendingCookies) {
2712
+ _removePendingCookie(name);
2713
+ _pendingCookies[_DYN_PUSH ]({
2714
+ n: name,
2715
+ o: 1 ,
2716
+ v: _formatDeletionValue(path)
2717
+ });
2718
+ result = true;
2719
+ }
2630
2720
  return result;
2631
2721
  },
2632
2722
  purge: function (name, path) {
2633
- var _a;
2634
2723
  var result = false;
2635
2724
  if (areCookiesSupported(logger)) {
2636
- var values = (_a = {},
2637
- _a[STR_PATH] = path ? path : "/",
2638
- _a[strExpires] = "Thu, 01 Jan 1970 00:00:01 GMT",
2639
- _a);
2640
- if (!isIE()) {
2641
- values["max-age"] = "0";
2642
- }
2643
- _delCookieFn(name, _formatCookieValue(STR_EMPTY, values));
2725
+ _delCookieFn(name, _formatDeletionValue(path));
2644
2726
  result = true;
2645
2727
  }
2646
2728
  return result;
@@ -2648,6 +2730,7 @@
2648
2730
  unload: function (isAsync) {
2649
2731
  unloadHandler && unloadHandler.rm();
2650
2732
  unloadHandler = null;
2733
+ _pendingCookies = null;
2651
2734
  }
2652
2735
  };
2653
2736
  cookieMgr[strConfigCookieMgr] = cookieMgr;
@@ -5991,7 +6074,7 @@
5991
6074
  });
5992
6075
  return _this;
5993
6076
  }
5994
- AnalyticsPlugin.Version = '3.3.10-nightly3.2507-28';
6077
+ AnalyticsPlugin.Version = '3.3.10-nightly3.2508-02';
5995
6078
  return AnalyticsPlugin;
5996
6079
  }(BaseTelemetryPlugin));
5997
6080