coveo.analytics 2.30.19 → 2.30.23

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.19";
1
+ export declare const libVersion = "2.30.23";
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.19" ;
734
+ var libVersion = "2.30.23" ;
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);
@@ -83822,9 +83822,6 @@ var ECPlugin = (function (_super) {
83822
83822
  });
83823
83823
  };
83824
83824
  ECPlugin.prototype.addECDataToPayload = function (eventType, payload) {
83825
- if (eventType === ECPluginEventTypes.pageview) {
83826
- return __assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), payload);
83827
- }
83828
83825
  var ecPayload = __assign(__assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), (this.action ? { action: this.action } : {})), (this.actionData || {}));
83829
83826
  var productPayload = this.getProductPayload();
83830
83827
  var impressionPayload = this.getImpressionPayload();
@@ -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.30.19" ;
599
+ const libVersion = "2.30.23" ;
600
600
 
601
601
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
602
602
 
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.19" ;
734
+ var libVersion = "2.30.23" ;
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);
@@ -83822,9 +83822,6 @@ var ECPlugin = (function (_super) {
83822
83822
  });
83823
83823
  };
83824
83824
  ECPlugin.prototype.addECDataToPayload = function (eventType, payload) {
83825
- if (eventType === ECPluginEventTypes.pageview) {
83826
- return __assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), payload);
83827
- }
83828
83825
  var ecPayload = __assign(__assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), (this.action ? { action: this.action } : {})), (this.actionData || {}));
83829
83826
  var productPayload = this.getProductPayload();
83830
83827
  var impressionPayload = this.getImpressionPayload();
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.19" ;
732
+ var libVersion = "2.30.23" ;
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);
@@ -83820,9 +83820,6 @@ var ECPlugin = (function (_super) {
83820
83820
  });
83821
83821
  };
83822
83822
  ECPlugin.prototype.addECDataToPayload = function (eventType, payload) {
83823
- if (eventType === ECPluginEventTypes.pageview) {
83824
- return __assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), payload);
83825
- }
83826
83823
  var ecPayload = __assign(__assign(__assign(__assign({}, this.getLocationInformation(eventType, payload)), this.getDefaultContextInformation(eventType)), (this.action ? { action: this.action } : {})), (this.actionData || {}));
83827
83824
  var productPayload = this.getProductPayload();
83828
83825
  var impressionPayload = this.getImpressionPayload();
@@ -665,7 +665,7 @@ const addPageViewToHistory = (pageViewValue) => __awaiter(void 0, void 0, void 0
665
665
  yield store.addElementAsync(historyElement);
666
666
  });
667
667
 
668
- const libVersion = "2.30.19" ;
668
+ const libVersion = "2.30.23" ;
669
669
 
670
670
  const getFormattedLocation = (location) => `${location.protocol}//${location.hostname}${location.pathname.indexOf('/') === 0 ? location.pathname : `/${location.pathname}`}${location.search}`;
671
671
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coveo.analytics",
3
- "version": "2.30.19",
3
+ "version": "2.30.23",
4
4
  "description": "📈 Coveo analytics client (node and browser compatible) ",
5
5
  "main": "dist/library.cjs",
6
6
  "module": "dist/browser.mjs",
@@ -45,12 +45,12 @@ describe('EC plugin', () => {
45
45
  expect(result).toEqual({...defaultResult, pr1id: 'C0V30'});
46
46
  });
47
47
 
48
- it('should not append the product with the pageview event', () => {
48
+ it('should append the product with the pageview event', () => {
49
49
  ec.addProduct({name: 'Relevance T-Shirt'});
50
50
 
51
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
51
+ const result = executeRegisteredHook(ECPluginEventTypes.event, {});
52
52
 
53
- expect(result).toEqual({...defaultResult, hitType: ECPluginEventTypes.pageview});
53
+ expect(result).toEqual({...defaultResult, pr1nm: 'Relevance T-Shirt'});
54
54
  });
55
55
 
56
56
  it('should not append the product with a random event type', () => {
@@ -61,15 +61,14 @@ describe('EC plugin', () => {
61
61
  expect(result).toEqual({});
62
62
  });
63
63
 
64
- it('should keep the products until an event type is used', () => {
64
+ it('should keep the products until a valid event type is used', () => {
65
65
  ec.addProduct({id: 'P12345'});
66
66
 
67
67
  executeRegisteredHook('🎲', {});
68
68
  executeRegisteredHook('🐟', {});
69
- const pageviewResult = executeRegisteredHook(ECPluginEventTypes.pageview, {});
69
+ executeRegisteredHook('💀', {});
70
70
  const result = executeRegisteredHook(ECPluginEventTypes.event, {});
71
71
 
72
- expect(pageviewResult).toEqual({...defaultResult, hitType: ECPluginEventTypes.pageview});
73
72
  expect(result).toEqual({...defaultResult, pr1id: 'P12345'});
74
73
  });
75
74
 
@@ -120,18 +119,6 @@ describe('EC plugin', () => {
120
119
  expect(secondResult).toEqual({...defaultResult});
121
120
  });
122
121
 
123
- it('should not flush the products when the pageview is sent', () => {
124
- ec.addProduct({name: 'boup'});
125
-
126
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
127
-
128
- expect(result).not.toEqual({});
129
-
130
- const secondResult = executeRegisteredHook(ECPluginEventTypes.event, {});
131
-
132
- expect(secondResult).toEqual({...defaultResult, pr1nm: 'boup'});
133
- });
134
-
135
122
  it('should convert position to number if possible', () => {
136
123
  const validValues = ['13', '5.5'];
137
124
  for (const value of validValues) {
@@ -277,14 +264,14 @@ describe('EC plugin', () => {
277
264
  expect(result).toEqual({...defaultResult, il1pi1id: 'C0V30'});
278
265
  });
279
266
 
280
- it('should not append the impression with the pageview event', () => {
267
+ it('should append the impression with the pageview event', () => {
281
268
  ec.addImpression({name: 'Relevance T-Shirt'});
282
269
 
283
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
270
+ const result = executeRegisteredHook(ECPluginEventTypes.event, {});
284
271
 
285
272
  expect(result).toEqual({
286
273
  ...defaultResult,
287
- hitType: ECPluginEventTypes.pageview,
274
+ il1pi1nm: 'Relevance T-Shirt',
288
275
  });
289
276
  });
290
277
 
@@ -296,15 +283,14 @@ describe('EC plugin', () => {
296
283
  expect(result).toEqual({});
297
284
  });
298
285
 
299
- it('should keep the impressions until an event type is used', () => {
286
+ it('should keep the impressions until a valid event type is used', () => {
300
287
  ec.addImpression({id: 'P12345'});
301
288
 
302
289
  executeRegisteredHook('🎲', {});
303
290
  executeRegisteredHook('🐟', {});
304
- const pageviewResult = executeRegisteredHook(ECPluginEventTypes.pageview, {});
291
+ executeRegisteredHook('💀', {});
305
292
  const result = executeRegisteredHook(ECPluginEventTypes.event, {});
306
293
 
307
- expect(pageviewResult).toEqual({...defaultResult, hitType: ECPluginEventTypes.pageview});
308
294
  expect(result).toEqual({...defaultResult, il1pi1id: 'P12345'});
309
295
  });
310
296
 
@@ -386,7 +372,7 @@ describe('EC plugin', () => {
386
372
  });
387
373
  });
388
374
 
389
- it('should flush the impressions once they are sent', () => {
375
+ it('should flush the products once they are sent', () => {
390
376
  ec.addImpression({name: '🍟', price: 1.99});
391
377
  ec.addImpression({name: '🍿', price: 3});
392
378
 
@@ -399,18 +385,6 @@ describe('EC plugin', () => {
399
385
  expect(secondResult).toEqual({...defaultResult});
400
386
  });
401
387
 
402
- it('should not flush the impressions when a pageview is sent', () => {
403
- ec.addImpression({name: 'bap'});
404
-
405
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
406
-
407
- expect(result).not.toEqual({});
408
-
409
- const secondResult = executeRegisteredHook(ECPluginEventTypes.event, {});
410
-
411
- expect(secondResult).toEqual({...defaultResult, il1pi1nm: 'bap'});
412
- });
413
-
414
388
  describe('when the position is invalid', () => {
415
389
  it('should warn when executing hook on added impression', () => {
416
390
  jest.spyOn(console, 'warn').mockImplementation();
@@ -506,17 +480,6 @@ describe('EC plugin', () => {
506
480
  });
507
481
  });
508
482
 
509
- it('should not set an action with a pageview', () => {
510
- ec.setAction('ok');
511
-
512
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
513
-
514
- expect(result).toEqual({
515
- ...defaultResult,
516
- hitType: ECPluginEventTypes.pageview,
517
- });
518
- });
519
-
520
483
  it('should flush the action once it is sent', () => {
521
484
  ec.setAction('ok');
522
485
 
@@ -529,18 +492,6 @@ describe('EC plugin', () => {
529
492
  expect(secondResult).toEqual({...defaultResult});
530
493
  });
531
494
 
532
- it('should not flush the action with the pageview', () => {
533
- ec.setAction('ok');
534
-
535
- const result = executeRegisteredHook(ECPluginEventTypes.pageview, {});
536
-
537
- expect(result).not.toEqual({});
538
-
539
- const secondResult = executeRegisteredHook(ECPluginEventTypes.event, {});
540
-
541
- expect(secondResult).toEqual({...defaultResult, action: 'ok'});
542
- });
543
-
544
495
  it('should be able to clear all the data', () => {
545
496
  ec.addProduct({name: '🍨', price: 2.99});
546
497
  ec.addImpression({id: '🍦', price: 3.49});
package/src/plugins/ec.ts CHANGED
@@ -135,14 +135,6 @@ export class ECPlugin extends BasePlugin {
135
135
  }
136
136
 
137
137
  private addECDataToPayload(eventType: string, payload: any) {
138
- if (eventType === ECPluginEventTypes.pageview) {
139
- return {
140
- ...this.getLocationInformation(eventType, payload),
141
- ...this.getDefaultContextInformation(eventType),
142
- ...payload,
143
- };
144
- }
145
-
146
138
  const ecPayload = {
147
139
  ...this.getLocationInformation(eventType, payload),
148
140
  ...this.getDefaultContextInformation(eventType),