coveo.analytics 2.29.1 → 2.29.2

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.29.1";
1
+ export declare const libVersion = "2.29.2";
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.29.1" ;
734
+ var libVersion = "2.29.2" ;
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);
@@ -83050,7 +83050,6 @@ var CoveoAnalyticsClient = (function () {
83050
83050
  };
83051
83051
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
83052
83052
  if (doNotTrack()) {
83053
- this.clear();
83054
83053
  this.runtime.storage = new NullStorage();
83055
83054
  }
83056
83055
  this.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
@@ -84443,9 +84442,6 @@ var CoveoSearchPageClient = (function () {
84443
84442
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
84444
84443
  }
84445
84444
  CoveoSearchPageClient.prototype.disable = function () {
84446
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
84447
- this.coveoAnalyticsClient.clear();
84448
- }
84449
84445
  this.coveoAnalyticsClient = new NoopAnalytics();
84450
84446
  };
84451
84447
  CoveoSearchPageClient.prototype.enable = function () {
@@ -85815,9 +85811,6 @@ var CaseAssistClient = (function () {
85815
85811
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85816
85812
  }
85817
85813
  CaseAssistClient.prototype.disable = function () {
85818
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85819
- this.coveoAnalyticsClient.clear();
85820
- }
85821
85814
  this.coveoAnalyticsClient = new NoopAnalytics();
85822
85815
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85823
85816
  };
@@ -85923,9 +85916,6 @@ var CoveoInsightClient = (function () {
85923
85916
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
85924
85917
  }
85925
85918
  CoveoInsightClient.prototype.disable = function () {
85926
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85927
- this.coveoAnalyticsClient.clear();
85928
- }
85929
85919
  this.coveoAnalyticsClient = new NoopAnalytics();
85930
85920
  };
85931
85921
  CoveoInsightClient.prototype.enable = function () {
@@ -596,7 +596,7 @@ function sha1(bytes) {
596
596
  const v5 = v35('v5', 0x50, sha1);
597
597
  var uuidv5 = v5;
598
598
 
599
- const libVersion = "2.29.1" ;
599
+ const libVersion = "2.29.2" ;
600
600
 
601
601
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
602
602
 
@@ -1269,7 +1269,6 @@ class CoveoAnalyticsClient {
1269
1269
  };
1270
1270
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
1271
1271
  if (doNotTrack()) {
1272
- this.clear();
1273
1272
  this.runtime.storage = new NullStorage();
1274
1273
  }
1275
1274
  this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
@@ -1926,9 +1925,6 @@ class CoveoSearchPageClient {
1926
1925
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
1927
1926
  }
1928
1927
  disable() {
1929
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
1930
- this.coveoAnalyticsClient.clear();
1931
- }
1932
1928
  this.coveoAnalyticsClient = new NoopAnalytics();
1933
1929
  }
1934
1930
  enable() {
@@ -2831,9 +2827,6 @@ class CaseAssistClient {
2831
2827
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
2832
2828
  }
2833
2829
  disable() {
2834
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
2835
- this.coveoAnalyticsClient.clear();
2836
- }
2837
2830
  this.coveoAnalyticsClient = new NoopAnalytics();
2838
2831
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
2839
2832
  }
@@ -2937,9 +2930,6 @@ class CoveoInsightClient {
2937
2930
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
2938
2931
  }
2939
2932
  disable() {
2940
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
2941
- this.coveoAnalyticsClient.clear();
2942
- }
2943
2933
  this.coveoAnalyticsClient = new NoopAnalytics();
2944
2934
  }
2945
2935
  enable() {
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.29.1" ;
734
+ var libVersion = "2.29.2" ;
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);
@@ -83050,7 +83050,6 @@ var CoveoAnalyticsClient = (function () {
83050
83050
  };
83051
83051
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
83052
83052
  if (doNotTrack()) {
83053
- this.clear();
83054
83053
  this.runtime.storage = new NullStorage();
83055
83054
  }
83056
83055
  this.addEventTypeMapping(exports.EventType.view, { newEventType: exports.EventType.view, addClientIdParameter: true });
@@ -84443,9 +84442,6 @@ var CoveoSearchPageClient = (function () {
84443
84442
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
84444
84443
  }
84445
84444
  CoveoSearchPageClient.prototype.disable = function () {
84446
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
84447
- this.coveoAnalyticsClient.clear();
84448
- }
84449
84445
  this.coveoAnalyticsClient = new NoopAnalytics();
84450
84446
  };
84451
84447
  CoveoSearchPageClient.prototype.enable = function () {
@@ -85815,9 +85811,6 @@ var CaseAssistClient = (function () {
85815
85811
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85816
85812
  }
85817
85813
  CaseAssistClient.prototype.disable = function () {
85818
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85819
- this.coveoAnalyticsClient.clear();
85820
- }
85821
85814
  this.coveoAnalyticsClient = new NoopAnalytics();
85822
85815
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85823
85816
  };
@@ -85923,9 +85916,6 @@ var CoveoInsightClient = (function () {
85923
85916
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
85924
85917
  }
85925
85918
  CoveoInsightClient.prototype.disable = function () {
85926
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85927
- this.coveoAnalyticsClient.clear();
85928
- }
85929
85919
  this.coveoAnalyticsClient = new NoopAnalytics();
85930
85920
  };
85931
85921
  CoveoInsightClient.prototype.enable = function () {
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.29.1" ;
732
+ var libVersion = "2.29.2" ;
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);
@@ -83048,7 +83048,6 @@ var CoveoAnalyticsClient = (function () {
83048
83048
  };
83049
83049
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
83050
83050
  if (doNotTrack()) {
83051
- this.clear();
83052
83051
  this.runtime.storage = new NullStorage();
83053
83052
  }
83054
83053
  this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
@@ -84441,9 +84440,6 @@ var CoveoSearchPageClient = (function () {
84441
84440
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
84442
84441
  }
84443
84442
  CoveoSearchPageClient.prototype.disable = function () {
84444
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
84445
- this.coveoAnalyticsClient.clear();
84446
- }
84447
84443
  this.coveoAnalyticsClient = new NoopAnalytics();
84448
84444
  };
84449
84445
  CoveoSearchPageClient.prototype.enable = function () {
@@ -85813,9 +85809,6 @@ var CaseAssistClient = (function () {
85813
85809
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85814
85810
  }
85815
85811
  CaseAssistClient.prototype.disable = function () {
85816
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85817
- this.coveoAnalyticsClient.clear();
85818
- }
85819
85812
  this.coveoAnalyticsClient = new NoopAnalytics();
85820
85813
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
85821
85814
  };
@@ -85921,9 +85914,6 @@ var CoveoInsightClient = (function () {
85921
85914
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
85922
85915
  }
85923
85916
  CoveoInsightClient.prototype.disable = function () {
85924
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
85925
- this.coveoAnalyticsClient.clear();
85926
- }
85927
85917
  this.coveoAnalyticsClient = new NoopAnalytics();
85928
85918
  };
85929
85919
  CoveoInsightClient.prototype.enable = function () {
@@ -658,7 +658,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
658
658
  yield store.addElementAsync(historyElement);
659
659
  });
660
660
 
661
- const libVersion = "2.29.1" ;
661
+ const libVersion = "2.29.2" ;
662
662
 
663
663
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
664
664
 
@@ -1270,7 +1270,6 @@ class CoveoAnalyticsClient {
1270
1270
  };
1271
1271
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
1272
1272
  if (doNotTrack()) {
1273
- this.clear();
1274
1273
  this.runtime.storage = new NullStorage();
1275
1274
  }
1276
1275
  this.addEventTypeMapping(EventType.view, { newEventType: EventType.view, addClientIdParameter: true });
@@ -1947,9 +1946,6 @@ class CoveoSearchPageClient {
1947
1946
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
1948
1947
  }
1949
1948
  disable() {
1950
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
1951
- this.coveoAnalyticsClient.clear();
1952
- }
1953
1949
  this.coveoAnalyticsClient = new NoopAnalytics();
1954
1950
  }
1955
1951
  enable() {
@@ -2852,9 +2848,6 @@ class CaseAssistClient {
2852
2848
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
2853
2849
  }
2854
2850
  disable() {
2855
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
2856
- this.coveoAnalyticsClient.clear();
2857
- }
2858
2851
  this.coveoAnalyticsClient = new NoopAnalytics();
2859
2852
  this.svc = new SVCPlugin({ client: this.coveoAnalyticsClient });
2860
2853
  }
@@ -2958,9 +2951,6 @@ class CoveoInsightClient {
2958
2951
  this.coveoAnalyticsClient = shouldDisableAnalytics ? new NoopAnalytics() : new CoveoAnalyticsClient(opts);
2959
2952
  }
2960
2953
  disable() {
2961
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
2962
- this.coveoAnalyticsClient.clear();
2963
- }
2964
2954
  this.coveoAnalyticsClient = new NoopAnalytics();
2965
2955
  }
2966
2956
  enable() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.29.1",
3
+ "version": "2.29.2",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.cjs",
6
6
  "module": "dist/browser.mjs",
@@ -10,6 +10,7 @@ import {mockFetch, lastCallBody} from '../../tests/fetchMock';
10
10
  import {TicketProperties} from '../plugins/svc';
11
11
  const {fetchMock, fetchMockBeforeEach} = mockFetch();
12
12
  import doNotTrack from '../donottrack';
13
+ import {Cookie} from '../cookieutils';
13
14
  jest.mock('../donottrack', () => {
14
15
  return {
15
16
  default: jest.fn(),
@@ -178,6 +179,15 @@ describe('CaseAssistClient', () => {
178
179
  expect(fetchMock.called()).toBe(false);
179
180
  });
180
181
 
182
+ it('disabling does not delete the visitorId', () => {
183
+ const visitorId = 'uuid';
184
+ Cookie.set('coveo_visitorId', visitorId);
185
+
186
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
187
+ client.disable();
188
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
189
+ });
190
+
181
191
  it('should send events after #enable function is called', async () => {
182
192
  client = new CaseAssistClient({
183
193
  enableAnalytics: false,
@@ -37,9 +37,6 @@ export class CaseAssistClient {
37
37
  }
38
38
 
39
39
  public disable() {
40
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
41
- this.coveoAnalyticsClient.clear();
42
- }
43
40
  this.coveoAnalyticsClient = new NoopAnalytics();
44
41
  this.svc = new SVCPlugin({client: this.coveoAnalyticsClient});
45
42
  }
@@ -667,14 +667,14 @@ describe('doNotTrack', () => {
667
667
  expect(client.runtime.storage).toBeInstanceOf(NullStorage);
668
668
  });
669
669
 
670
- it('should clear existing cookies', async () => {
670
+ it('should not clear existing cookies', async () => {
671
671
  jest.spyOn(doNotTrack, 'doNotTrack').mockImplementation(() => true);
672
672
  Cookie.set('coveo_visitorId', aVisitorId);
673
673
  expect(Cookie.get('coveo_visitorId')).toBe(aVisitorId);
674
674
 
675
675
  new CoveoAnalyticsClient({});
676
676
 
677
- expect(Cookie.get('coveo_visitorId')).not.toBe(aVisitorId);
677
+ expect(Cookie.get('coveo_visitorId')).toBe(aVisitorId);
678
678
  });
679
679
  });
680
680
 
@@ -184,7 +184,6 @@ export class CoveoAnalyticsClient implements AnalyticsClient, VisitorIdProvider
184
184
 
185
185
  this.runtime = this.options.runtimeEnvironment || this.initRuntime(clientsOptions);
186
186
  if (doNotTrack()) {
187
- this.clear();
188
187
  this.runtime.storage = new NullStorage();
189
188
  }
190
189
 
@@ -12,6 +12,7 @@ import {
12
12
  import {CoveoInsightClient, InsightClientProvider} from './insightClient';
13
13
  import doNotTrack from '../donottrack';
14
14
  import {InsightEvents, InsightStaticFilterToggleValueMetadata} from './insightEvents';
15
+ import {Cookie} from '../cookieutils';
15
16
 
16
17
  const baseCaseMetadata = {
17
18
  caseId: '1234',
@@ -1420,6 +1421,16 @@ describe('InsightClient', () => {
1420
1421
  expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
1421
1422
  });
1422
1423
 
1424
+ it('disabling analytics does not delete the visitorId', () => {
1425
+ const visitorId = 'uuid';
1426
+ Cookie.set('coveo_visitorId', visitorId);
1427
+ const c = new CoveoInsightClient({enableAnalytics: true}, provider);
1428
+
1429
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
1430
+ c.disable();
1431
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
1432
+ });
1433
+
1423
1434
  it('should disable analytics when doNotTrack is enabled', async () => {
1424
1435
  (doNotTrack as jest.Mock).mockImplementationOnce(() => true);
1425
1436
 
@@ -93,9 +93,6 @@ export class CoveoInsightClient {
93
93
  }
94
94
 
95
95
  public disable() {
96
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
97
- this.coveoAnalyticsClient.clear();
98
- }
99
96
  this.coveoAnalyticsClient = new NoopAnalytics();
100
97
  }
101
98
 
@@ -12,6 +12,8 @@ import CoveoAnalyticsClient from '../client/analytics';
12
12
  import {NoopAnalytics} from '../client/noopAnalytics';
13
13
  import {mockFetch, lastCallBody} from '../../tests/fetchMock';
14
14
  import doNotTrack from '../donottrack';
15
+ import {Cookie} from '../cookieutils';
16
+
15
17
  jest.mock('../donottrack', () => {
16
18
  return {
17
19
  default: jest.fn(),
@@ -1424,6 +1426,16 @@ describe('SearchPageClient', () => {
1424
1426
  expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
1425
1427
  });
1426
1428
 
1429
+ it('disabling analytics does not delete the visitorId', () => {
1430
+ const visitorId = 'uuid';
1431
+ Cookie.set('coveo_visitorId', visitorId);
1432
+ const c = new CoveoSearchPageClient({enableAnalytics: true}, provider);
1433
+
1434
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
1435
+ c.disable();
1436
+ expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
1437
+ });
1438
+
1427
1439
  it('should allow enabling analytics after initialization', () => {
1428
1440
  const c = new CoveoSearchPageClient({enableAnalytics: false}, provider);
1429
1441
  expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
@@ -84,10 +84,6 @@ export class CoveoSearchPageClient {
84
84
  }
85
85
 
86
86
  public disable() {
87
- if (this.coveoAnalyticsClient instanceof CoveoAnalyticsClient) {
88
- this.coveoAnalyticsClient.clear();
89
- }
90
-
91
87
  this.coveoAnalyticsClient = new NoopAnalytics();
92
88
  }
93
89