@microsoft/1ds-core-js 3.2.6 → 3.2.8

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 (43) hide show
  1. package/README.md +20 -1
  2. package/bundle/{ms.core-3.2.6.gbl.js → ms.core-3.2.8.gbl.js} +72 -30
  3. package/bundle/ms.core-3.2.8.gbl.js.map +1 -0
  4. package/bundle/ms.core-3.2.8.gbl.min.js +7 -0
  5. package/bundle/ms.core-3.2.8.gbl.min.js.map +1 -0
  6. package/bundle/ms.core-3.2.8.integrity.json +46 -0
  7. package/bundle/{ms.core-3.2.6.js → ms.core-3.2.8.js} +72 -30
  8. package/bundle/ms.core-3.2.8.js.map +1 -0
  9. package/bundle/ms.core-3.2.8.min.js +7 -0
  10. package/bundle/ms.core-3.2.8.min.js.map +1 -0
  11. package/bundle/ms.core.gbl.js +71 -29
  12. package/bundle/ms.core.gbl.js.map +1 -1
  13. package/bundle/ms.core.gbl.min.js +2 -2
  14. package/bundle/ms.core.gbl.min.js.map +1 -1
  15. package/bundle/ms.core.integrity.json +17 -17
  16. package/bundle/ms.core.js +71 -29
  17. package/bundle/ms.core.js.map +1 -1
  18. package/bundle/ms.core.min.js +2 -2
  19. package/bundle/ms.core.min.js.map +1 -1
  20. package/dist/ms.core.js +2 -2
  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 +1 -1
  25. package/dist-esm/src/BaseCore.js +1 -1
  26. package/dist-esm/src/DataModels.js +1 -1
  27. package/dist-esm/src/ESPromise.js +1 -1
  28. package/dist-esm/src/ESPromiseScheduler.js +1 -1
  29. package/dist-esm/src/Enums.js +1 -1
  30. package/dist-esm/src/Index.js +1 -1
  31. package/dist-esm/src/InternalConstants.js +1 -1
  32. package/dist-esm/src/Utils.d.ts +1 -1
  33. package/dist-esm/src/Utils.js +2 -2
  34. package/dist-esm/src/Utils.js.map +1 -1
  35. package/dist-esm/src/ValueSanitizer.js +1 -1
  36. package/package.json +4 -4
  37. package/bundle/ms.core-3.2.6.gbl.js.map +0 -1
  38. package/bundle/ms.core-3.2.6.gbl.min.js +0 -7
  39. package/bundle/ms.core-3.2.6.gbl.min.js.map +0 -1
  40. package/bundle/ms.core-3.2.6.integrity.json +0 -46
  41. package/bundle/ms.core-3.2.6.js.map +0 -1
  42. package/bundle/ms.core-3.2.6.min.js +0 -7
  43. package/bundle/ms.core-3.2.6.min.js.map +0 -1
package/README.md CHANGED
@@ -16,7 +16,7 @@ ms.reviewedBy: ramthi
16
16
 
17
17
  ## npm
18
18
 
19
- Packages available [here](https://msasg.visualstudio.com/Shared%20Data/_artifacts/feed/1DS-SDK/Npm/%40microsoft%2F1ds-core-js/overview/3.2.6).
19
+ Packages available [here](https://msasg.visualstudio.com/Shared%20Data/_artifacts/feed/1DS-SDK/Npm/%40microsoft%2F1ds-core-js/overview/3.2.8).
20
20
 
21
21
  ## Basic Usage
22
22
 
@@ -81,6 +81,8 @@ Cookie Configuration for instance based cookie management added in version 3.1.0
81
81
  | enabled | A boolean that indicates whether the use of cookies by the SDK is enabled by the current instance. If false, the instance of the SDK initialized by this configuration will not store or read any data from cookies | boolean | true |
82
82
  | domain | Custom cookie domain. This is helpful if you want to share Application Insights cookies across subdomains. If not provided uses the value from root `cookieDomain` value. | string<br/>Defaults: null |
83
83
  | path | Specifies the path to use for the cookie, if not provided it will use any value from the root `cookiePath` value. | string<br/>Defaults: / |
84
+ | ignoreCookies | Specify the cookie name(s) to be ignored, this will cause any matching cookie name to never be read or written. They may still be explicitly purged or deleted. You do not need to repeat the name in the `blockedCookies` configuration.(Since v3.2.7) | string[] <br/> Defaults: undefined |
85
+ | blockedCookies | Specify the cookie name(s) to never be written, this will cause any cookie name to never be created or updated, they will still be read unless also included in the ignoreCookies and may still be explicitly purged or deleted. If not provided defaults to the same list provided in ignoreCookies. (Since v3.2.7) | string[] <br/> Defaults: undefined |
84
86
  | getCookie | Function to fetch the named cookie value, if not provided it will use the internal cookie parsing / caching. | `(name: string) => string`<br/>Defaults: null |
85
87
  | setCookie | Function to set the named cookie with the specified value, only called when adding or updating a cookie. | `(name: string, value: string) => void`<br/>Defaults: null |
86
88
  | delCookie | Function to delete the named cookie with the specified value, separated from setCookie to avoid the need to parse the value to determine whether the cookie is being added or removed.if not provided it will use the internal cookie parsing / caching. | `(name: string, value: string) => void`<br/>Defaults: null |
@@ -100,6 +102,23 @@ The instance based cookie management also replaces the previous CoreUtils and gl
100
102
  - oneDs.[getCookieMgr()](https://github.com/microsoft/ApplicationInsights-JS/blob/master/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ICookieMgr.ts).get("MyCookie");
101
103
  - oneDs.[getCookieMgr()](https://github.com/microsoft/ApplicationInsights-JS/blob/master/shared/AppInsightsCore/src/JavaScriptSDK.Interfaces/ICookieMgr.ts).del("MyCookie");
102
104
 
105
+ ### Blocking individual cookies
106
+
107
+ Since v3.2.7 you can now specify which Cookie name(s) that you want the SDK to either ignore (never read, written or created) or blocked (will be read if already present but will not write or create), this is useful for blocking non-critical Cookies that your site does not need but the SDK automatically populates. These settings only affect the Javascript SDK reading, writing and creation of the cookies and do NOT affect automatic cookies added by the Collector. See the ["Cookies Set/Read by 1DS Web SDK" section of the linked page](https://eng.ms/docs/products/geneva/collect/instrument/1ds/javascriptsdk/getting-started).
108
+
109
+ Example.
110
+
111
+ ```typescript
112
+ var coreConfig: IExtendedConfiguration = {
113
+ instrumentationKey: "YOUR_TENANT_KEY",
114
+ cookieCfg: {
115
+ ignoreCookies: [ "MicrosoftApplicationsTelemetryDeviceId" ]
116
+ }
117
+ extensions: [ /* Your extensions */ ],
118
+ extensionConfig: []
119
+ };
120
+ ```
121
+
103
122
  ## API documentation
104
123
 
105
124
  [https://1dsdocs.azurewebsites.net/api/webSDK/utl/core/3.0/f/index.html](https://1dsdocs.azurewebsites.net/api/webSDK/utl/core/3.0/f/index.html)
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * 1DS JS SDK Core, 3.2.6
2
+ * 1DS JS SDK Core, 3.2.8
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  * (Microsoft Internal Only)
5
5
  */
@@ -21,21 +21,23 @@
21
21
  var _cachedGlobal = null;
22
22
  function getGlobal(useCached) {
23
23
  if (useCached === void 0) { useCached = true; }
24
- if (!_cachedGlobal || !useCached) {
25
- if (typeof globalThis !== strShimUndefined && globalThis) {
26
- _cachedGlobal = globalThis;
24
+ var result = useCached === false ? null : _cachedGlobal;
25
+ if (!result) {
26
+ if (typeof globalThis !== strShimUndefined) {
27
+ result = globalThis;
27
28
  }
28
- if (typeof self !== strShimUndefined && self) {
29
- _cachedGlobal = self;
29
+ if (!result && typeof self !== strShimUndefined) {
30
+ result = self;
30
31
  }
31
- if (typeof window !== strShimUndefined && window) {
32
- _cachedGlobal = window;
32
+ if (!result && typeof window !== strShimUndefined) {
33
+ result = window;
33
34
  }
34
- if (typeof global !== strShimUndefined && global) {
35
- _cachedGlobal = global;
35
+ if (!result && typeof global !== strShimUndefined) {
36
+ result = global;
36
37
  }
38
+ _cachedGlobal = result;
37
39
  }
38
- return _cachedGlobal;
40
+ return result;
39
41
  }
40
42
  function throwTypeError(message) {
41
43
  throw new TypeError(message);
@@ -73,7 +75,9 @@
73
75
  var __assignFn = ObjAssign || __objAssignFnImpl;
74
76
  var extendStaticsFn = function (d, b) {
75
77
  extendStaticsFn = ObjClass["setPrototypeOf"] ||
76
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
78
+ ({ __proto__: [] } instanceof Array && function (d, b) {
79
+ d.__proto__ = b;
80
+ }) ||
77
81
  function (d, b) {
78
82
  for (var p in b) {
79
83
  if (b[strShimHasOwnProperty](p)) {
@@ -88,7 +92,9 @@
88
92
  throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
89
93
  }
90
94
  extendStaticsFn(d, b);
91
- function __() { this.constructor = d; }
95
+ function __() {
96
+ this.constructor = d;
97
+ }
92
98
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
93
99
  }
94
100
  function __spreadArrayFn(to, from) {
@@ -447,7 +453,7 @@
447
453
  }
448
454
  function strTrim(str) {
449
455
  if (str) {
450
- str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|\s+$/g, STR_EMPTY$1) : str);
456
+ str = (_strTrim && str[cStrTrim]) ? str[cStrTrim]() : (str[_DYN_REPLACE ] ? str[_DYN_REPLACE ](/^\s+|(?=\s)\s+$/g, STR_EMPTY$1) : str);
451
457
  }
452
458
  return str;
453
459
  }
@@ -704,9 +710,11 @@
704
710
  });
705
711
 
706
712
  /*!
707
- * Microsoft Dynamic Proto Utility, 1.1.6
713
+ * Microsoft Dynamic Proto Utility, 1.1.7
708
714
  * Copyright (c) Microsoft and contributors. All rights reserved.
709
715
  */
716
+ var _a$2;
717
+ var UNDEFINED = "undefined";
710
718
  var Constructor = 'constructor';
711
719
  var Prototype = 'prototype';
712
720
  var strFunction = 'function';
@@ -720,13 +728,37 @@
720
728
  var UnknownValue = '_unknown_';
721
729
  var str__Proto = "__proto__";
722
730
  var DynProtoBaseProto = "_dyn" + str__Proto;
731
+ var DynProtoGlobalSettings = "__dynProto$Gbl";
723
732
  var DynProtoCurrent = "_dynInstProto";
724
733
  var strUseBaseInst = 'useBaseInst';
725
734
  var strSetInstFuncs = 'setInstFuncs';
726
735
  var Obj = Object;
727
736
  var _objGetPrototypeOf = Obj["getPrototypeOf"];
728
737
  var _objGetOwnProps = Obj["getOwnPropertyNames"];
729
- var _dynamicNames = 0;
738
+ function _getGlobal() {
739
+ var result;
740
+ if (typeof globalThis !== UNDEFINED) {
741
+ result = globalThis;
742
+ }
743
+ if (!result && typeof self !== UNDEFINED) {
744
+ result = self;
745
+ }
746
+ if (!result && typeof window !== UNDEFINED) {
747
+ result = window;
748
+ }
749
+ if (!result && typeof global !== UNDEFINED) {
750
+ result = global;
751
+ }
752
+ return result || {};
753
+ }
754
+ var _gbl = _getGlobal();
755
+ var _gblInst = _gbl[DynProtoGlobalSettings] || (_gbl[DynProtoGlobalSettings] = {
756
+ o: (_a$2 = {},
757
+ _a$2[strSetInstFuncs] = true,
758
+ _a$2[strUseBaseInst] = true,
759
+ _a$2),
760
+ n: 1000
761
+ });
730
762
  function _hasOwnProperty(obj, prop) {
731
763
  return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
732
764
  }
@@ -920,15 +952,15 @@
920
952
  }
921
953
  var classProto = theClass[Prototype];
922
954
  if (!_checkPrototype(classProto, target)) {
923
- _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
955
+ _throwTypeError("[" + _getObjName(theClass) + "] not in hierarchy of [" + _getObjName(target) + "]");
924
956
  }
925
957
  var className = null;
926
958
  if (_hasOwnProperty(classProto, DynClassName)) {
927
959
  className = classProto[DynClassName];
928
960
  }
929
961
  else {
930
- className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
931
- _dynamicNames++;
962
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _gblInst.n;
963
+ _gblInst.n++;
932
964
  classProto[DynClassName] = className;
933
965
  }
934
966
  var perfOptions = dynamicProto[DynProtoDefaultOptions];
@@ -945,11 +977,7 @@
945
977
  }
946
978
  _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
947
979
  }
948
- var perfDefaults = {
949
- setInstFuncs: true,
950
- useBaseInst: true
951
- };
952
- dynamicProto[DynProtoDefaultOptions] = perfDefaults;
980
+ dynamicProto[DynProtoDefaultOptions] = _gblInst.o;
953
981
 
954
982
  var strWindow = "window";
955
983
  var strDocument = "document";
@@ -1629,7 +1657,7 @@
1629
1657
  }
1630
1658
 
1631
1659
  var _objDefineProperty = ObjDefineProperty;
1632
- var version = '2.8.6';
1660
+ var version = '2.8.9';
1633
1661
  var instanceName = "." + newId(6);
1634
1662
  var _dataUid = 0;
1635
1663
  function _createAccessor(target, prop, value) {
@@ -1744,6 +1772,20 @@
1744
1772
  }
1745
1773
  return cookieMgrCfg;
1746
1774
  }
1775
+ function _isIgnoredCookie(cookieMgrCfg, name) {
1776
+ if (name && cookieMgrCfg && isArray(cookieMgrCfg.ignoreCookies)) {
1777
+ return cookieMgrCfg.ignoreCookies[_DYN_INDEX_OF ](name) !== -1;
1778
+ }
1779
+ return false;
1780
+ }
1781
+ function _isBlockedCookie(cookieMgrCfg, name) {
1782
+ if (name && cookieMgrCfg && isArray(cookieMgrCfg.blockedCookies)) {
1783
+ if (cookieMgrCfg.blockedCookies[_DYN_INDEX_OF ](name) !== -1) {
1784
+ return true;
1785
+ }
1786
+ }
1787
+ return _isIgnoredCookie(cookieMgrCfg, name);
1788
+ }
1747
1789
  function safeGetCookieMgr(core, config) {
1748
1790
  var cookieMgr;
1749
1791
  if (core) {
@@ -1784,7 +1826,7 @@
1784
1826
  },
1785
1827
  _a.set = function (name, value, maxAgeSec, domain, path) {
1786
1828
  var result = false;
1787
- if (_isMgrEnabled(cookieMgr)) {
1829
+ if (_isMgrEnabled(cookieMgr) && !_isBlockedCookie(cookieMgrConfig, name)) {
1788
1830
  var values = {};
1789
1831
  var theValue = strTrim(value || STR_EMPTY$1);
1790
1832
  var idx = theValue[_DYN_INDEX_OF ](";");
@@ -1827,7 +1869,7 @@
1827
1869
  },
1828
1870
  _a.get = function (name) {
1829
1871
  var value = STR_EMPTY$1;
1830
- if (_isMgrEnabled(cookieMgr)) {
1872
+ if (_isMgrEnabled(cookieMgr) && !_isIgnoredCookie(cookieMgrConfig, name)) {
1831
1873
  value = (cookieMgrConfig.getCookie || _getCookieValue)(name);
1832
1874
  }
1833
1875
  return value;
@@ -1967,7 +2009,7 @@
1967
2009
  var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
1968
2010
  function _normalizeNamespace(name) {
1969
2011
  if (name && name[_DYN_REPLACE ]) {
1970
- return name.replace(/^\s*\.*|\.*\s*$/g, STR_EMPTY$1);
2012
+ return name[_DYN_REPLACE ](/^[\s\.]+|(?=[\s\.])[\.\s]+$/g, STR_EMPTY$1);
1971
2013
  }
1972
2014
  return name;
1973
2015
  }
@@ -4093,7 +4135,7 @@
4093
4135
  var STR_PROPERTIES = "properties";
4094
4136
 
4095
4137
  var _a;
4096
- var Version = '3.2.6';
4138
+ var Version = '3.2.8';
4097
4139
  var FullVersionString = "1DS-Web-JS-" + Version;
4098
4140
  var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
4099
4141
  var strWithCredentials = "withCredentials";
@@ -5312,4 +5354,4 @@
5312
5354
  (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 });
5313
5355
 
5314
5356
  })(this.oneDS = this.oneDS || {});
5315
- //# sourceMappingURL=ms.core-3.2.6.gbl.js.map
5357
+ //# sourceMappingURL=ms.core-3.2.8.gbl.js.map