coveo.analytics 2.24.1 → 2.25.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.
@@ -15,7 +15,7 @@ describe('EC plugin', () => {
15
15
  title: 'MAH PAGE',
16
16
  screenColor: '24-bit',
17
17
  screenResolution: '0x0',
18
- time: expect.any(String),
18
+ time: expect.any(Number),
19
19
  userAgent: navigator.userAgent,
20
20
  language: 'en-US',
21
21
  hitType: ECPluginEventTypes.event,
@@ -25,7 +25,7 @@ describe('EC plugin', () => {
25
25
  beforeEach(() => {
26
26
  jest.clearAllMocks();
27
27
  client = createAnalyticsClientMock();
28
- ec = new ECPlugin({client, uuidGenerator: someUUIDGenerator});
28
+ ec = new ECPlugin({client, uuidGenerator: someUUIDGenerator as any});
29
29
  });
30
30
 
31
31
  it('should register a hook in the client', () => {
package/src/plugins/ec.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {EventType} from '../events';
2
- import {uuidv4} from '../client/crypto';
2
+ import {v4 as uuidv4} from 'uuid';
3
3
  import {
4
4
  convertProductToMeasurementProtocol,
5
5
  convertImpressionListToMeasurementProtocol,
@@ -15,7 +15,7 @@ describe('SVC plugin', () => {
15
15
  title: 'MAH PAGE',
16
16
  screenColor: '24-bit',
17
17
  screenResolution: '0x0',
18
- time: expect.any(String),
18
+ time: expect.any(Number),
19
19
  userAgent: navigator.userAgent,
20
20
  language: 'en-US',
21
21
  hitType: SVCPluginEventTypes.event,
@@ -25,7 +25,7 @@ describe('SVC plugin', () => {
25
25
  beforeEach(() => {
26
26
  jest.clearAllMocks();
27
27
  client = createAnalyticsClientMock();
28
- svc = new SVCPlugin({client, uuidGenerator: someUUIDGenerator});
28
+ svc = new SVCPlugin({client, uuidGenerator: someUUIDGenerator as any});
29
29
  });
30
30
 
31
31
  it('should register a hook in the client', () => {
@@ -1,5 +1,5 @@
1
1
  import {EventType} from '../events';
2
- import {uuidv4} from '../client/crypto';
2
+ import {v4 as uuidv4} from 'uuid';
3
3
  import {convertTicketToMeasurementProtocol} from '../client/measurementProtocolMapping/serviceMeasurementProtocolMapper';
4
4
  import {BasePlugin, BasePluginEventTypes, PluginClass, PluginOptions} from './BasePlugin';
5
5
 
@@ -2,7 +2,7 @@ import {WebStorage} from '../storage';
2
2
  import {AnalyticsFetchClient} from '../client/analyticsFetchClient';
3
3
  import {IRuntimeEnvironment} from '../client/runtimeEnvironment';
4
4
  import {PreprocessAnalyticsRequest} from '../client/analyticsRequestClient';
5
- import {uuidv4} from '../client/crypto';
5
+ import {v4 as uuidv4} from 'uuid';
6
6
  import {buildBaseUrl} from '../client/analytics';
7
7
 
8
8
  export type ReactNativeStorage = WebStorage;
@@ -1 +0,0 @@
1
- export declare const uuidv4: (a?: string | number | undefined) => string;
@@ -1,21 +0,0 @@
1
- import {hasCryptoRandomValues} from '../detector';
2
-
3
- export const uuidv4 = (a?: number | string): string => {
4
- if (!!a) {
5
- return (Number(a) ^ (getRandomValues(new Uint8Array(1))[0] % 16 >> (Number(a) / 4))).toString(16);
6
- }
7
- return (`${1e7}` + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuidv4);
8
- };
9
-
10
- const getRandomValues = (rnds: Uint8Array) => {
11
- if (hasCryptoRandomValues()) {
12
- return crypto.getRandomValues(rnds);
13
- }
14
- for (var i = 0, r = 0; i < rnds.length; i++) {
15
- if ((i & 0x03) === 0) {
16
- r = Math.random() * 0x100000000;
17
- }
18
- rnds[i] = (r >>> ((i & 0x03) << 3)) & 0xff;
19
- }
20
- return rnds;
21
- };