coveo.analytics 2.30.40 → 2.30.42

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.
@@ -1 +1 @@
1
- export declare const libVersion = "2.30.40";
1
+ export declare const libVersion = "2.30.42";
package/dist/library.cjs CHANGED
@@ -731,7 +731,7 @@ function sha1(bytes) {
731
731
  const v5 = v35('v5', 0x50, sha1);
732
732
  var uuidv5 = v5;
733
733
 
734
- var libVersion = "2.30.40" ;
734
+ var libVersion = "2.30.42" ;
735
735
 
736
736
  var getFormattedLocation = function (location) {
737
737
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -83048,13 +83048,14 @@ function isReactNative() {
83048
83048
 
83049
83049
  var doNotTrackValues = ['1', 1, 'yes', true];
83050
83050
  function doNotTrack() {
83051
- return (hasNavigator() &&
83052
- [
83053
- navigator.globalPrivacyControl,
83054
- navigator.doNotTrack,
83055
- navigator.msDoNotTrack,
83056
- window.doNotTrack,
83057
- ].some(function (value) { return doNotTrackValues.indexOf(value) !== -1; }));
83051
+ var checks = [];
83052
+ if (hasWindow()) {
83053
+ checks.push(window.doNotTrack);
83054
+ }
83055
+ if (hasNavigator()) {
83056
+ checks.push(navigator.doNotTrack, navigator.msDoNotTrack, navigator.globalPrivacyControl);
83057
+ }
83058
+ return checks.some(function (value) { return doNotTrackValues.indexOf(value) !== -1; });
83058
83059
  }
83059
83060
 
83060
83061
  var donottrack = /*#__PURE__*/Object.freeze({
@@ -12,6 +12,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
+ /* global Reflect, Promise */
16
+
15
17
 
16
18
  function __rest(s, e) {
17
19
  var t = {};
@@ -596,7 +598,7 @@ function sha1(bytes) {
596
598
  const v5 = v35('v5', 0x50, sha1);
597
599
  var uuidv5 = v5;
598
600
 
599
- const libVersion = "2.30.40" ;
601
+ const libVersion = "2.30.42" ;
600
602
 
601
603
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
602
604
 
@@ -1261,13 +1263,14 @@ function isReactNative() {
1261
1263
 
1262
1264
  const doNotTrackValues = ['1', 1, 'yes', true];
1263
1265
  function doNotTrack() {
1264
- return (hasNavigator() &&
1265
- [
1266
- navigator.globalPrivacyControl,
1267
- navigator.doNotTrack,
1268
- navigator.msDoNotTrack,
1269
- window.doNotTrack,
1270
- ].some((value) => doNotTrackValues.indexOf(value) !== -1));
1266
+ const checks = [];
1267
+ if (hasWindow()) {
1268
+ checks.push(window.doNotTrack);
1269
+ }
1270
+ if (hasNavigator()) {
1271
+ checks.push(navigator.doNotTrack, navigator.msDoNotTrack, navigator.globalPrivacyControl);
1272
+ }
1273
+ return checks.some((value) => doNotTrackValues.indexOf(value) !== -1);
1271
1274
  }
1272
1275
 
1273
1276
  const Version = 'v15';
package/dist/library.js CHANGED
@@ -731,7 +731,7 @@ function sha1(bytes) {
731
731
  const v5 = v35('v5', 0x50, sha1);
732
732
  var uuidv5 = v5;
733
733
 
734
- var libVersion = "2.30.40" ;
734
+ var libVersion = "2.30.42" ;
735
735
 
736
736
  var getFormattedLocation = function (location) {
737
737
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -83048,13 +83048,14 @@ function isReactNative() {
83048
83048
 
83049
83049
  var doNotTrackValues = ['1', 1, 'yes', true];
83050
83050
  function doNotTrack() {
83051
- return (hasNavigator() &&
83052
- [
83053
- navigator.globalPrivacyControl,
83054
- navigator.doNotTrack,
83055
- navigator.msDoNotTrack,
83056
- window.doNotTrack,
83057
- ].some(function (value) { return doNotTrackValues.indexOf(value) !== -1; }));
83051
+ var checks = [];
83052
+ if (hasWindow()) {
83053
+ checks.push(window.doNotTrack);
83054
+ }
83055
+ if (hasNavigator()) {
83056
+ checks.push(navigator.doNotTrack, navigator.msDoNotTrack, navigator.globalPrivacyControl);
83057
+ }
83058
+ return checks.some(function (value) { return doNotTrackValues.indexOf(value) !== -1; });
83058
83059
  }
83059
83060
 
83060
83061
  var donottrack = /*#__PURE__*/Object.freeze({
package/dist/library.mjs CHANGED
@@ -729,7 +729,7 @@ function sha1(bytes) {
729
729
  const v5 = v35('v5', 0x50, sha1);
730
730
  var uuidv5 = v5;
731
731
 
732
- var libVersion = "2.30.40" ;
732
+ var libVersion = "2.30.42" ;
733
733
 
734
734
  var getFormattedLocation = function (location) {
735
735
  return "".concat(location.protocol, "//").concat(location.hostname).concat(location.pathname.indexOf('/') === 0 ? location.pathname : "/".concat(location.pathname)).concat(location.search);
@@ -83046,13 +83046,14 @@ function isReactNative() {
83046
83046
 
83047
83047
  var doNotTrackValues = ['1', 1, 'yes', true];
83048
83048
  function doNotTrack() {
83049
- return (hasNavigator() &&
83050
- [
83051
- navigator.globalPrivacyControl,
83052
- navigator.doNotTrack,
83053
- navigator.msDoNotTrack,
83054
- window.doNotTrack,
83055
- ].some(function (value) { return doNotTrackValues.indexOf(value) !== -1; }));
83049
+ var checks = [];
83050
+ if (hasWindow()) {
83051
+ checks.push(window.doNotTrack);
83052
+ }
83053
+ if (hasNavigator()) {
83054
+ checks.push(navigator.doNotTrack, navigator.msDoNotTrack, navigator.globalPrivacyControl);
83055
+ }
83056
+ return checks.some(function (value) { return doNotTrackValues.indexOf(value) !== -1; });
83056
83057
  }
83057
83058
 
83058
83059
  var donottrack = /*#__PURE__*/Object.freeze({
@@ -15,6 +15,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
15
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
16
  PERFORMANCE OF THIS SOFTWARE.
17
17
  ***************************************************************************** */
18
+ /* global Reflect, Promise */
19
+
18
20
 
19
21
  function __rest(s, e) {
20
22
  var t = {};
@@ -665,7 +667,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
665
667
  yield store.addElementAsync(historyElement);
666
668
  });
667
669
 
668
- const libVersion = "2.30.40" ;
670
+ const libVersion = "2.30.42" ;
669
671
 
670
672
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
671
673
 
@@ -1262,13 +1264,14 @@ function isReactNative() {
1262
1264
 
1263
1265
  const doNotTrackValues = ['1', 1, 'yes', true];
1264
1266
  function doNotTrack() {
1265
- return (hasNavigator() &&
1266
- [
1267
- navigator.globalPrivacyControl,
1268
- navigator.doNotTrack,
1269
- navigator.msDoNotTrack,
1270
- window.doNotTrack,
1271
- ].some((value) => doNotTrackValues.indexOf(value) !== -1));
1267
+ const checks = [];
1268
+ if (hasWindow()) {
1269
+ checks.push(window.doNotTrack);
1270
+ }
1271
+ if (hasNavigator()) {
1272
+ checks.push(navigator.doNotTrack, navigator.msDoNotTrack, navigator.globalPrivacyControl);
1273
+ }
1274
+ return checks.some((value) => doNotTrackValues.indexOf(value) !== -1);
1272
1275
  }
1273
1276
 
1274
1277
  const Version = 'v15';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.30.40",
3
+ "version": "2.30.42",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.cjs",
6
6
  "module": "dist/browser.mjs",
@@ -57,7 +57,7 @@
57
57
  "lint-staged": "^13.2.1",
58
58
  "prettier": "^2.8.7",
59
59
  "rimraf": "^3.0.2",
60
- "rollup": "^3.20.2",
60
+ "rollup": "^3.29.5",
61
61
  "rollup-plugin-copy": "^3.5.0",
62
62
  "rollup-plugin-serve": "^1.0.1",
63
63
  "rollup-plugin-typescript2": "^0.34.0",
@@ -2,6 +2,7 @@ describe('doNotTrack', () => {
2
2
  let doNotTrack: () => boolean;
3
3
  function initModule(
4
4
  hasNav: boolean,
5
+ hasWin: boolean,
5
6
  options?: {
6
7
  navigatorGlobalPrivacyControl?: any;
7
8
  navigatorDoNotTrack?: any;
@@ -12,6 +13,7 @@ describe('doNotTrack', () => {
12
13
  jest.resetModules();
13
14
  jest.mock('./detector', () => ({
14
15
  hasNavigator: () => hasNav,
16
+ hasWindow: () => hasWin,
15
17
  }));
16
18
  if (hasNav) {
17
19
  Object.defineProperty(<any>navigator, 'globalPrivacyControl', {
@@ -32,6 +34,8 @@ describe('doNotTrack', () => {
32
34
  },
33
35
  configurable: true,
34
36
  });
37
+ }
38
+ if (hasWin) {
35
39
  Object.defineProperty(<any>window, 'doNotTrack', {
36
40
  get() {
37
41
  return options!.windowDoNotTrack;
@@ -41,30 +45,30 @@ describe('doNotTrack', () => {
41
45
  }
42
46
  doNotTrack = require('./donottrack').doNotTrack;
43
47
  }
44
- describe('without a Navigator', () => {
48
+ describe('without a Navigator and without window', () => {
45
49
  it('should be false', () => {
46
- initModule(false);
50
+ initModule(false, false);
47
51
 
48
52
  expect(doNotTrack()).toBeFalsy();
49
53
  });
50
54
  });
51
55
  describe('with a Navigator', () => {
52
56
  it('should respect GPC false', () => {
53
- initModule(true, {
57
+ initModule(true, false, {
54
58
  navigatorGlobalPrivacyControl: false,
55
59
  });
56
60
 
57
61
  expect(doNotTrack()).toBeFalsy();
58
62
  });
59
63
  it('should respect GPC true', () => {
60
- initModule(true, {
64
+ initModule(true, false, {
61
65
  navigatorGlobalPrivacyControl: true,
62
66
  });
63
67
 
64
68
  expect(doNotTrack()).toBeTruthy();
65
69
  });
66
70
  it('should respect GPC undefined', () => {
67
- initModule(true, {
71
+ initModule(true, false, {
68
72
  navigatorGlobalPrivacyControl: undefined,
69
73
  });
70
74
 
@@ -73,7 +77,7 @@ describe('doNotTrack', () => {
73
77
 
74
78
  [true, 'yes', '1'].forEach((value) => {
75
79
  it('should fallback on `navigator.doNotTrack`: ' + JSON.stringify(value), () => {
76
- initModule(true, {
80
+ initModule(true, false, {
77
81
  navigatorDoNotTrack: value,
78
82
  });
79
83
 
@@ -81,23 +85,16 @@ describe('doNotTrack', () => {
81
85
  });
82
86
 
83
87
  it('should fallback on `navigator.msDoNotTrack`: ' + JSON.stringify(value), () => {
84
- initModule(true, {
88
+ initModule(true, false, {
85
89
  navigatorMsDoNotTrack: value,
86
90
  });
87
91
  expect(doNotTrack()).toBeTruthy();
88
92
  });
89
-
90
- it('should fallback on `window.doNotTrack`: ' + JSON.stringify(value), () => {
91
- initModule(true, {
92
- windowDoNotTrack: value,
93
- });
94
- expect(doNotTrack()).toBeTruthy();
95
- });
96
93
  });
97
94
 
98
95
  [false, 'no', '0', 'unspecified'].forEach((value) => {
99
96
  it('should fallback on `navigator.doNotTrack`: ' + JSON.stringify(value), () => {
100
- initModule(true, {
97
+ initModule(true, false, {
101
98
  navigatorDoNotTrack: value,
102
99
  });
103
100
 
@@ -105,18 +102,43 @@ describe('doNotTrack', () => {
105
102
  });
106
103
 
107
104
  it('should fallback on `navigator.msDoNotTrack`: ' + JSON.stringify(value), () => {
108
- initModule(true, {
105
+ initModule(true, false, {
109
106
  navigatorMsDoNotTrack: value,
110
107
  });
111
108
  expect(doNotTrack()).toBeFalsy();
112
109
  });
110
+ });
111
+ });
112
+
113
+ describe('with a Window', () => {
114
+ [true, 'yes', '1'].forEach((value) => {
115
+ it('should fallback on `window.doNotTrack`: ' + JSON.stringify(value), () => {
116
+ initModule(false, true, {
117
+ windowDoNotTrack: value,
118
+ });
119
+ expect(doNotTrack()).toBeTruthy();
120
+ });
121
+ });
113
122
 
123
+ [false, 'no', '0', 'unspecified'].forEach((value) => {
114
124
  it('should fallback on `window.doNotTrack`: ' + JSON.stringify(value), () => {
115
- initModule(true, {
125
+ initModule(false, true, {
116
126
  windowDoNotTrack: value,
117
127
  });
118
128
  expect(doNotTrack()).toBeFalsy();
119
129
  });
120
130
  });
121
131
  });
132
+
133
+ describe('with a Navigator and a Window', () => {
134
+ it('should fallback on `window.doNotTrack` if all navigator properties are falsy', () => {
135
+ initModule(true, true, {
136
+ navigatorDoNotTrack: false,
137
+ navigatorGlobalPrivacyControl: undefined,
138
+ navigatorMsDoNotTrack: '0',
139
+ windowDoNotTrack: 1,
140
+ });
141
+ expect(doNotTrack()).toBeTruthy();
142
+ });
143
+ });
122
144
  });
package/src/donottrack.ts CHANGED
@@ -1,23 +1,22 @@
1
1
  // Read the Mozilla Do Not Track Field Guide
2
2
  // (https://developer.mozilla.org/en-US/docs/Web/Security/Do_not_track_field_guide),
3
3
  // for information on how to use the donottrack
4
- // gathering data of actions of an user as long as it is not associated to the
4
+ // gathering data of actions of a user as long as it is not associated to the
5
5
  // identity of that user, doNotTrack is not enabled here.
6
6
 
7
- import {hasNavigator} from './detector';
7
+ import {hasNavigator, hasWindow} from './detector';
8
8
 
9
9
  const doNotTrackValues = ['1', 1, 'yes', true];
10
10
 
11
11
  export function doNotTrack(): boolean {
12
- return (
13
- hasNavigator() &&
14
- [
15
- (<any>navigator).globalPrivacyControl,
16
- (<any>navigator).doNotTrack,
17
- (<any>navigator).msDoNotTrack,
18
- (<any>window).doNotTrack,
19
- ].some((value) => doNotTrackValues.indexOf(value) !== -1)
20
- );
12
+ const checks: any[] = [];
13
+ if (hasWindow()) {
14
+ checks.push((<any>window).doNotTrack);
15
+ }
16
+ if (hasNavigator()) {
17
+ checks.push((<any>navigator).doNotTrack, (<any>navigator).msDoNotTrack, (<any>navigator).globalPrivacyControl);
18
+ }
19
+ return checks.some((value) => doNotTrackValues.indexOf(value) !== -1);
21
20
  }
22
21
 
23
22
  export default doNotTrack;