@coveo/relay 1.0.0 → 1.1.1

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 (58) hide show
  1. package/lib/npm/client-id/client-id.d.ts.map +1 -0
  2. package/lib/{config → npm/config}/config.d.ts +7 -0
  3. package/lib/npm/config/config.d.ts.map +1 -0
  4. package/lib/npm/emit/emit.d.ts.map +1 -0
  5. package/lib/npm/environment/browser/browser.d.ts.map +1 -0
  6. package/lib/npm/environment/browser/storage/availability.d.ts.map +1 -0
  7. package/lib/npm/environment/browser/storage/cookie.d.ts.map +1 -0
  8. package/lib/npm/environment/browser/storage/storage.d.ts.map +1 -0
  9. package/lib/{environment → npm/environment}/environment.d.ts +1 -1
  10. package/lib/npm/environment/environment.d.ts.map +1 -0
  11. package/lib/npm/environment/manager/manager.d.ts.map +1 -0
  12. package/lib/npm/environment/null/null.d.ts.map +1 -0
  13. package/lib/npm/environment/storage.d.ts.map +1 -0
  14. package/lib/npm/event/meta/meta.d.ts.map +1 -0
  15. package/lib/npm/event/relay-event.d.ts.map +1 -0
  16. package/lib/npm/listener/listener.d.ts.map +1 -0
  17. package/lib/npm/relay-payload.d.ts.map +1 -0
  18. package/lib/{relay.cjs → npm/relay.cjs} +11 -73
  19. package/lib/{relay.d.ts → npm/relay.d.ts} +2 -2
  20. package/lib/npm/relay.d.ts.map +1 -0
  21. package/lib/{relay.mjs → npm/relay.mjs} +8 -70
  22. package/lib/npm/version.d.ts.map +1 -0
  23. package/package.json +10 -18
  24. package/lib/cdn/relay.min.js +0 -2
  25. package/lib/cdn/relay.min.js.map +0 -1
  26. package/lib/client-id/client-id.d.ts.map +0 -1
  27. package/lib/config/config.d.ts.map +0 -1
  28. package/lib/docs/relay-docs.json +0 -1862
  29. package/lib/emit/emit.d.ts.map +0 -1
  30. package/lib/environment/browser/browser.d.ts.map +0 -1
  31. package/lib/environment/browser/storage/availability.d.ts.map +0 -1
  32. package/lib/environment/browser/storage/cookie.d.ts.map +0 -1
  33. package/lib/environment/browser/storage/storage.d.ts.map +0 -1
  34. package/lib/environment/environment.d.ts.map +0 -1
  35. package/lib/environment/manager/manager.d.ts.map +0 -1
  36. package/lib/environment/null/null.d.ts.map +0 -1
  37. package/lib/environment/storage.d.ts.map +0 -1
  38. package/lib/event/meta/meta.d.ts.map +0 -1
  39. package/lib/event/relay-event.d.ts.map +0 -1
  40. package/lib/listener/listener.d.ts.map +0 -1
  41. package/lib/relay-payload.d.ts.map +0 -1
  42. package/lib/relay.d.ts.map +0 -1
  43. package/lib/relay.js +0 -375
  44. package/lib/version.d.ts.map +0 -1
  45. /package/lib/{client-id → npm/client-id}/client-id.d.ts +0 -0
  46. /package/lib/{emit → npm/emit}/emit.d.ts +0 -0
  47. /package/lib/{environment → npm/environment}/browser/browser.d.ts +0 -0
  48. /package/lib/{environment → npm/environment}/browser/storage/availability.d.ts +0 -0
  49. /package/lib/{environment → npm/environment}/browser/storage/cookie.d.ts +0 -0
  50. /package/lib/{environment → npm/environment}/browser/storage/storage.d.ts +0 -0
  51. /package/lib/{environment → npm/environment}/manager/manager.d.ts +0 -0
  52. /package/lib/{environment → npm/environment}/null/null.d.ts +0 -0
  53. /package/lib/{environment → npm/environment}/storage.d.ts +0 -0
  54. /package/lib/{event → npm/event}/meta/meta.d.ts +0 -0
  55. /package/lib/{event → npm/event}/relay-event.d.ts +0 -0
  56. /package/lib/{listener → npm/listener}/listener.d.ts +0 -0
  57. /package/lib/{relay-payload.d.ts → npm/relay-payload.d.ts} +0 -0
  58. /package/lib/{version.d.ts → npm/version.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-id.d.ts","sourceRoot":"","sources":["../../../src/client-id/client-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,MAAM,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,kBAAkB,GACrC,eAAe,CAgBjB"}
@@ -1,3 +1,5 @@
1
+ import { Environment } from "../environment/environment";
2
+ export type CustomEnvironment = Pick<Environment, "generateUUID" | "getLocation" | "getReferrer" | "getUserAgent" | "send" | "storage">;
1
3
  /**
2
4
  * The `RelayConfig` object defines the configuration options for initializing a Relay instance.
3
5
  */
@@ -27,6 +29,11 @@ export interface RelayConfig {
27
29
  * version. The recommendation is to specify them using a 'softwarename@softwareversion' string.
28
30
  */
29
31
  source?: string[];
32
+ /**
33
+ * Specifies a custom environment for Relay, allowing integrations to override the default behavior.
34
+ * This is useful when Relay runs in unsupported or specialized contexts that require custom handling.
35
+ */
36
+ environment?: CustomEnvironment;
30
37
  }
31
38
  export interface ConfigManager {
32
39
  get: () => Readonly<RelayConfig>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,WAAW,EACT,cAAc,GACd,aAAa,GACb,aAAa,GACb,cAAc,GACd,MAAM,GACN,SAAS,CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;OAGG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAkBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../src/emit/emit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,wBAAgB,IAAI,CAAC,EACnB,MAAM,EACN,WAAW,EACX,KAAK,EACL,eAAe,GAChB,EAAE,UAAU,QAQZ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../src/environment/browser/browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAW7C,wBAAgB,uBAAuB,IAAI,WAAW,CA0BrD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../../../../src/environment/browser/storage/availability.ts"],"names":[],"mappings":"AACA,wBAAgB,qBAAqB,YAepC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cookie.d.ts","sourceRoot":"","sources":["../../../../../src/environment/browser/storage/cookie.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D;AAED,eAAO,MAAM,aAAa,EAAE,aAAqC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../src/environment/browser/storage/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,wBAAgB,oBAAoB,IAAI,OAAO,CAiB9C"}
@@ -1,7 +1,7 @@
1
1
  import { RelayEvent } from "../event/relay-event";
2
2
  import { Storage } from "./storage";
3
3
  export interface Environment {
4
- runtime: "browser" | "null";
4
+ runtime: "browser" | "null" | "custom";
5
5
  send: (url: string, token: string, event: RelayEvent) => void;
6
6
  getReferrer: () => string | null;
7
7
  getLocation: () => string | null;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IACvC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAC9D,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/environment/manager/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;CAClC;AA0BD,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,aAAa,GAC3B,QAAQ,CAAC,kBAAkB,CAAC,CAI9B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../../src/environment/null/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,wBAAgB,oBAAoB,IAAI,WAAW,CAUlD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/environment/storage.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../src/event/meta/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;C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tB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listener.d.ts","sourceRoot":"","sources":["../../../src/listener/listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AAExD,UAAU,QAAQ;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,IAAI,CAAC;IACxC,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;CAC1D;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAgEvD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay-payload.d.ts","sourceRoot":"","sources":["../../src/relay-payload.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var crypto = require('crypto');
3
+ var uuid = require('uuid');
4
+ var explorerMessenger = require('@coveo/explorer-messenger');
4
5
 
5
6
  function emit({ config, environment, event, listenerManager, }) {
6
7
  const { url, token, mode } = config;
@@ -11,65 +12,6 @@ function emit({ config, environment, event, listenerManager, }) {
11
12
  }
12
13
  }
13
14
 
14
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
15
-
16
- function validate(uuid) {
17
- return typeof uuid === 'string' && REGEX.test(uuid);
18
- }
19
-
20
- const byteToHex = [];
21
- for (let i = 0; i < 256; ++i) {
22
- byteToHex.push((i + 0x100).toString(16).slice(1));
23
- }
24
- function unsafeStringify(arr, offset = 0) {
25
- return (byteToHex[arr[offset + 0]] +
26
- byteToHex[arr[offset + 1]] +
27
- byteToHex[arr[offset + 2]] +
28
- byteToHex[arr[offset + 3]] +
29
- '-' +
30
- byteToHex[arr[offset + 4]] +
31
- byteToHex[arr[offset + 5]] +
32
- '-' +
33
- byteToHex[arr[offset + 6]] +
34
- byteToHex[arr[offset + 7]] +
35
- '-' +
36
- byteToHex[arr[offset + 8]] +
37
- byteToHex[arr[offset + 9]] +
38
- '-' +
39
- byteToHex[arr[offset + 10]] +
40
- byteToHex[arr[offset + 11]] +
41
- byteToHex[arr[offset + 12]] +
42
- byteToHex[arr[offset + 13]] +
43
- byteToHex[arr[offset + 14]] +
44
- byteToHex[arr[offset + 15]]).toLowerCase();
45
- }
46
-
47
- const rnds8Pool = new Uint8Array(256);
48
- let poolPtr = rnds8Pool.length;
49
- function rng() {
50
- if (poolPtr > rnds8Pool.length - 16) {
51
- crypto.randomFillSync(rnds8Pool);
52
- poolPtr = 0;
53
- }
54
- return rnds8Pool.slice(poolPtr, (poolPtr += 16));
55
- }
56
-
57
- var native = { randomUUID: crypto.randomUUID };
58
-
59
- function v4(options, buf, offset) {
60
- if (native.randomUUID && true && !options) {
61
- return native.randomUUID();
62
- }
63
- options = options || {};
64
- const rnds = options.random ?? options.rng?.() ?? rng();
65
- if (rnds.length < 16) {
66
- throw new Error('Random bytes length must be >= 16');
67
- }
68
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
69
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
70
- return unsafeStringify(rnds);
71
- }
72
-
73
15
  function createClientIdManager(environmentManager) {
74
16
  return {
75
17
  getClientId: () => {
@@ -77,7 +19,7 @@ function createClientIdManager(environmentManager) {
77
19
  const environment = environmentManager.get();
78
20
  const storage = environment.storage;
79
21
  const existingClientId = storage.getItem(key);
80
- const clientId = existingClientId && validate(existingClientId)
22
+ const clientId = existingClientId && uuid.validate(existingClientId)
81
23
  ? existingClientId
82
24
  : environment.generateUUID();
83
25
  storage.setItem(key, clientId);
@@ -86,7 +28,7 @@ function createClientIdManager(environmentManager) {
86
28
  };
87
29
  }
88
30
 
89
- const version = "1.0.0";
31
+ const version = "1.1.1";
90
32
 
91
33
  function getEventConfig(config) {
92
34
  const { trackingId } = config;
@@ -185,6 +127,7 @@ function pick({ url, token, trackingId, ...rest }) {
185
127
  trackingId,
186
128
  ...(!!rest.mode && { mode: rest.mode }),
187
129
  ...(!!rest.source && { source: rest.source }),
130
+ ...(!!rest.environment && { environment: rest.environment }),
188
131
  });
189
132
  }
190
133
  function createConfigManager(initialConfig) {
@@ -197,15 +140,6 @@ function createConfigManager(initialConfig) {
197
140
  };
198
141
  }
199
142
 
200
- function createExplorerMessenger() {
201
- const isBrowser = typeof window !== "undefined";
202
- return {
203
- sendMessage(message) {
204
- isBrowser && window.postMessage(message, "*");
205
- }
206
- };
207
- }
208
-
209
143
  const cookieManager = createCookieManager();
210
144
  function createCookieManager() {
211
145
  const prefix = "coveo_";
@@ -265,7 +199,7 @@ function buildBrowserEnvironment() {
265
199
  const response = navigator.sendBeacon(`${url}?access_token=${token}`, new Blob([JSON.stringify([event])], {
266
200
  type: "application/json",
267
201
  }));
268
- const messenger = createExplorerMessenger();
202
+ const messenger = explorerMessenger.createExplorerMessenger();
269
203
  messenger.sendMessage({ kind: "EVENT_PROTOCOL", event, url, token });
270
204
  if (!response) {
271
205
  throw new Error(`Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.`);
@@ -274,7 +208,7 @@ function buildBrowserEnvironment() {
274
208
  getReferrer: () => getReferrer(),
275
209
  getLocation: () => window.location.href,
276
210
  getUserAgent: () => navigator.userAgent,
277
- generateUUID: () => v4(),
211
+ generateUUID: () => uuid.v4(),
278
212
  storage: createBrowserStorage(),
279
213
  };
280
214
  }
@@ -324,6 +258,10 @@ function buildNullEnvironment() {
324
258
 
325
259
  function buildEnvironment(configManager) {
326
260
  const active = configManager.get().mode !== "disabled";
261
+ const environmentFromConfig = configManager.get().environment;
262
+ if (active && environmentFromConfig) {
263
+ return { ...environmentFromConfig, runtime: "custom" };
264
+ }
327
265
  if (active && isBrowser() && localStorageAvailable()) {
328
266
  return buildBrowserEnvironment();
329
267
  }
@@ -1,7 +1,7 @@
1
1
  import { RelayEvent } from "./event/relay-event";
2
2
  import { Meta, EventConfig } from "./event/meta/meta";
3
3
  import { EventCallback } from "./listener/listener";
4
- import { RelayConfig } from "./config/config";
4
+ import { RelayConfig, CustomEnvironment } from "./config/config";
5
5
  import { RelayPayload } from "./relay-payload";
6
6
  /**
7
7
  * Function that detaches an event callback.
@@ -63,5 +63,5 @@ interface Relay {
63
63
  * @returns {Relay}
64
64
  */
65
65
  export declare function createRelay(initialConfig: RelayConfig): Relay;
66
- export type { Relay, Meta, EventConfig, EventCallback, RelayConfig, RelayPayload, RelayEvent, };
66
+ export type { Relay, Meta, EventConfig, EventCallback, RelayConfig, RelayPayload, RelayEvent, CustomEnvironment, };
67
67
  //# sourceMappingURL=relay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relay.d.ts","sourceRoot":"","sources":["../../src/relay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAc,IAAI,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAyB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAEL,WAAW,EACX,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC;AAE7B;;;GAGG;AACH,UAAU,KAAK;IACb;;;;;OAKG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAE3D;;;;OAIG;IACH,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC;;;;;;;;;OASG;IACH,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,KAAK,GAAG,CAAC;IAEnD;;;;;;OAMG;IACH,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAEtD;;;;OAIG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAErD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,WAAW,GAAG,KAAK,CAyC7D;AAED,YAAY,EACV,KAAK,EACL,IAAI,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,CAAC"}
@@ -1,4 +1,5 @@
1
- import { randomFillSync, randomUUID } from 'crypto';
1
+ import { validate, v4 } from 'uuid';
2
+ import { createExplorerMessenger } from '@coveo/explorer-messenger';
2
3
 
3
4
  function emit({ config, environment, event, listenerManager, }) {
4
5
  const { url, token, mode } = config;
@@ -9,65 +10,6 @@ function emit({ config, environment, event, listenerManager, }) {
9
10
  }
10
11
  }
11
12
 
12
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
13
-
14
- function validate(uuid) {
15
- return typeof uuid === 'string' && REGEX.test(uuid);
16
- }
17
-
18
- const byteToHex = [];
19
- for (let i = 0; i < 256; ++i) {
20
- byteToHex.push((i + 0x100).toString(16).slice(1));
21
- }
22
- function unsafeStringify(arr, offset = 0) {
23
- return (byteToHex[arr[offset + 0]] +
24
- byteToHex[arr[offset + 1]] +
25
- byteToHex[arr[offset + 2]] +
26
- byteToHex[arr[offset + 3]] +
27
- '-' +
28
- byteToHex[arr[offset + 4]] +
29
- byteToHex[arr[offset + 5]] +
30
- '-' +
31
- byteToHex[arr[offset + 6]] +
32
- byteToHex[arr[offset + 7]] +
33
- '-' +
34
- byteToHex[arr[offset + 8]] +
35
- byteToHex[arr[offset + 9]] +
36
- '-' +
37
- byteToHex[arr[offset + 10]] +
38
- byteToHex[arr[offset + 11]] +
39
- byteToHex[arr[offset + 12]] +
40
- byteToHex[arr[offset + 13]] +
41
- byteToHex[arr[offset + 14]] +
42
- byteToHex[arr[offset + 15]]).toLowerCase();
43
- }
44
-
45
- const rnds8Pool = new Uint8Array(256);
46
- let poolPtr = rnds8Pool.length;
47
- function rng() {
48
- if (poolPtr > rnds8Pool.length - 16) {
49
- randomFillSync(rnds8Pool);
50
- poolPtr = 0;
51
- }
52
- return rnds8Pool.slice(poolPtr, (poolPtr += 16));
53
- }
54
-
55
- var native = { randomUUID };
56
-
57
- function v4(options, buf, offset) {
58
- if (native.randomUUID && true && !options) {
59
- return native.randomUUID();
60
- }
61
- options = options || {};
62
- const rnds = options.random ?? options.rng?.() ?? rng();
63
- if (rnds.length < 16) {
64
- throw new Error('Random bytes length must be >= 16');
65
- }
66
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
67
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
68
- return unsafeStringify(rnds);
69
- }
70
-
71
13
  function createClientIdManager(environmentManager) {
72
14
  return {
73
15
  getClientId: () => {
@@ -84,7 +26,7 @@ function createClientIdManager(environmentManager) {
84
26
  };
85
27
  }
86
28
 
87
- const version = "1.0.0";
29
+ const version = "1.1.1";
88
30
 
89
31
  function getEventConfig(config) {
90
32
  const { trackingId } = config;
@@ -183,6 +125,7 @@ function pick({ url, token, trackingId, ...rest }) {
183
125
  trackingId,
184
126
  ...(!!rest.mode && { mode: rest.mode }),
185
127
  ...(!!rest.source && { source: rest.source }),
128
+ ...(!!rest.environment && { environment: rest.environment }),
186
129
  });
187
130
  }
188
131
  function createConfigManager(initialConfig) {
@@ -195,15 +138,6 @@ function createConfigManager(initialConfig) {
195
138
  };
196
139
  }
197
140
 
198
- function createExplorerMessenger() {
199
- const isBrowser = typeof window !== "undefined";
200
- return {
201
- sendMessage(message) {
202
- isBrowser && window.postMessage(message, "*");
203
- }
204
- };
205
- }
206
-
207
141
  const cookieManager = createCookieManager();
208
142
  function createCookieManager() {
209
143
  const prefix = "coveo_";
@@ -322,6 +256,10 @@ function buildNullEnvironment() {
322
256
 
323
257
  function buildEnvironment(configManager) {
324
258
  const active = configManager.get().mode !== "disabled";
259
+ const environmentFromConfig = configManager.get().environment;
260
+ if (active && environmentFromConfig) {
261
+ return { ...environmentFromConfig, runtime: "custom" };
262
+ }
325
263
  if (active && isBrowser() && localStorageAvailable()) {
326
264
  return buildBrowserEnvironment();
327
265
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,wBAAwB,CAAC"}
package/package.json CHANGED
@@ -1,26 +1,18 @@
1
1
  {
2
2
  "name": "@coveo/relay",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "A library for sending analytics events using Coveo's Event protocol.",
5
+ "type": "module",
5
6
  "files": [
6
- "lib/**/*"
7
+ "lib/npm/*"
7
8
  ],
8
- "types": "./lib/relay.d.ts",
9
+ "types": "./lib/npm/relay.d.ts",
9
10
  "exports": {
10
- "node": {
11
- "import": {
12
- "types": "./lib/relay.d.ts",
13
- "default": "./lib/relay.mjs"
14
- },
15
- "require": {
16
- "types": "./lib/relay.d.ts",
17
- "default": "./lib/relay.cjs"
18
- }
19
- },
20
- "default": {
21
- "types": "./lib/relay.d.ts",
22
- "default": "./lib/relay.js"
23
- }
11
+ "types": "./lib/npm/relay.d.ts",
12
+ "import": "./lib/npm/relay.mjs",
13
+ "require": "./lib/npm/relay.cjs",
14
+ "browser": "./lib/npm/relay.mjs",
15
+ "default": "./lib/npm/relay.mjs"
24
16
  },
25
17
  "repository": {
26
18
  "type": "git",
@@ -57,7 +49,7 @@
57
49
  "tsconfig": "0.0.0"
58
50
  },
59
51
  "dependencies": {
60
- "@coveo/explorer-messenger": "^0.4.0",
52
+ "@coveo/explorer-messenger": "^0.4.1",
61
53
  "uuid": "^11.0.0"
62
54
  },
63
55
  "scripts": {
@@ -1,2 +0,0 @@
1
- var e=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const t=[];for(let e=0;e<256;++e)t.push((e+256).toString(16).slice(1));let n;const o=new Uint8Array(16);var r={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function c(e,c,a){if(r.randomUUID&&!e)return r.randomUUID();const i=(e=e||{}).random??e.rng?.()??function(){if(!n){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");n=crypto.getRandomValues.bind(crypto)}return n(o)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=15&i[6]|64,i[8]=63&i[8]|128,function(e,n=0){return(t[e[n+0]]+t[e[n+1]]+t[e[n+2]]+t[e[n+3]]+"-"+t[e[n+4]]+t[e[n+5]]+"-"+t[e[n+6]]+t[e[n+7]]+"-"+t[e[n+8]]+t[e[n+9]]+"-"+t[e[n+10]]+t[e[n+11]]+t[e[n+12]]+t[e[n+13]]+t[e[n+14]]+t[e[n+15]]).toLowerCase()}(i)}function a(t){return{getClientId:()=>{const n="visitorId",o=t.get(),r=o.storage,c=r.getItem(n),a=c&&("string"==typeof(i=c)&&e.test(i))?c:o.generateUUID();var i;return r.setItem(n,a),a}}}const i="1.0.0";function s(e){return(e.source||[]).concat([`relay@${i}`])}function u(e,t,n,o){const{getReferrer:r,getLocation:c,getUserAgent:a}=n,i=function(e){const{trackingId:t}=e;return{trackingId:t}}(t),u=o.getClientId();return Object.freeze({type:e,config:i,ts:Date.now(),source:s(t),clientId:u,userAgent:a(),referrer:r(),location:c()})}function f(){const e=[];function t({type:t,callback:n}){return e.findIndex((e=>e.type===t&&e.callback===n))}function n(n,o){o?function(n){const o=t(n);o>=0&&e.splice(o,1)}({type:n,callback:o}):function(t){if("*"===t)e.length=0;else for(let n=e.length-1;n>=0;n--)e[n].type===t&&e.splice(n,1)}(n)}return{add:function(o){return t(o)<0&&e.push(o),()=>n(o.type,o.callback)},call:function(t){e.forEach((e=>{if(function(e,t){return"*"===e.type||t===e.type}(e,t.meta.type))try{e.callback(t)}catch(e){console.error(e)}}))},remove:n}}function l({url:e,token:t,trackingId:n,...o}){return Object.freeze({url:e,token:t,trackingId:n,...!!o.mode&&{mode:o.mode},...!!o.source&&{source:o.source}})}const g=function(){const e="coveo_";return{getItem(t){const n=`${e}${t}=`,o=document.cookie.split(";");for(const e of o){const t=e.replace(/^\s+/,"");if(0===t.lastIndexOf(n,0))return t.substring(n.length,t.length)}return null},setItem(t,n,o){const r=(e=>{const t=e.split(".").slice(-2);return 2==t.length?t.join("."):""})(window.location.hostname),c=`;expires=${new Date((new Date).getTime()+o).toUTCString()}`,a=r?`;domain=${r}`:"";document.cookie=`${e}${t}=${n}${c}${a};path=/;SameSite=Lax`},removeItem(e){this.setItem(e,"",-1)}}}();function d(){return{runtime:"browser",send:(e,t,n)=>{const o=navigator.sendBeacon(`${e}?access_token=${t}`,new Blob([JSON.stringify([n])],{type:"application/json"})),r=function(){const e="undefined"!=typeof window;return{sendMessage(t){e&&window.postMessage(t,"*")}}}();if(r.sendMessage({kind:"EVENT_PROTOCOL",event:n,url:e,token:t}),!o)throw new Error("Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.")},getReferrer:()=>function(){const e=document.referrer;return""===e?null:e}(),getLocation:()=>window.location.href,getUserAgent:()=>navigator.userAgent,generateUUID:()=>c(),storage:{getItem:e=>g.getItem(e)||localStorage.getItem(e),removeItem(e){g.removeItem(e),localStorage.removeItem(e)},setItem(e,t){localStorage.setItem(e,t),g.setItem(e,t,31556952e3)}}}}function m(e){return"disabled"!==e.get().mode&&function(){try{return"object"==typeof window}catch{return!1}}()&&function(){try{const e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return e instanceof DOMException&&"QuotaExceededError"===e.name&&localStorage&&0!==localStorage.length}}()?d():{runtime:"null",send:()=>{},getReferrer:()=>null,getLocation:()=>null,getUserAgent:()=>null,generateUUID:()=>"",storage:{getItem:()=>null,removeItem(){},setItem(){}}}}function p(e){const t=function(e){let t=l(e);return{get:()=>t,update:e=>{t=l({...t,...e})}}}(e),n=f(),o=function(e){return{get:()=>Object.freeze(m(e))}}(t),r=a(o);return{emit:(e,c)=>{const a=t.get(),i=o.get(),s=function(e,t,n,o,r){return{...t,meta:u(e,n,o,r)}}(e,c,a,i,r);return function({config:e,environment:t,event:n,listenerManager:o}){const{url:r,token:c,mode:a}=e;"disabled"!==a&&(o.call(n),t.send(r,c,n))}({config:a,environment:i,event:s,listenerManager:n})},getMeta:e=>u(e,t.get(),o.get(),r),on:(e,t)=>n.add({type:e,callback:t}),off:(e,t)=>n.remove(e,t),updateConfig:e=>t.update(e),version:i}}export{p as createRelay};
2
- //# sourceMappingURL=relay.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relay.min.js","sources":["../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/regex.js","../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/stringify.js","../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/rng.js","../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/native.js","../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/v4.js","../../../src/client-id/client-id.ts","../../../../node_modules/.pnpm/uuid@11.0.4/node_modules/uuid/dist/esm-browser/validate.js","../../../src/version.ts","../../../src/event/meta/meta.ts","../../../src/listener/listener.ts","../../../src/config/config.ts","../../../src/environment/browser/storage/cookie.ts","../../../src/environment/browser/browser.ts","../../../../node_modules/.pnpm/@coveo+explorer-messenger@0.4.0/node_modules/@coveo/explorer-messenger/dist/messenger.js","../../../src/environment/browser/storage/storage.ts","../../../src/environment/manager/manager.ts","../../../src/environment/browser/storage/availability.ts","../../../src/environment/null/null.ts","../../../src/environment/storage.ts","../../../src/relay.ts","../../../src/event/relay-event.ts","../../../src/emit/emit.ts"],"sourcesContent":["export default /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;\n","import validate from './validate.js';\nconst byteToHex = [];\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\nexport function unsafeStringify(arr, offset = 0) {\n return (byteToHex[arr[offset + 0]] +\n byteToHex[arr[offset + 1]] +\n byteToHex[arr[offset + 2]] +\n byteToHex[arr[offset + 3]] +\n '-' +\n byteToHex[arr[offset + 4]] +\n byteToHex[arr[offset + 5]] +\n '-' +\n byteToHex[arr[offset + 6]] +\n byteToHex[arr[offset + 7]] +\n '-' +\n byteToHex[arr[offset + 8]] +\n byteToHex[arr[offset + 9]] +\n '-' +\n byteToHex[arr[offset + 10]] +\n byteToHex[arr[offset + 11]] +\n byteToHex[arr[offset + 12]] +\n byteToHex[arr[offset + 13]] +\n byteToHex[arr[offset + 14]] +\n byteToHex[arr[offset + 15]]).toLowerCase();\n}\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset);\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n return uuid;\n}\nexport default stringify;\n","let getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n if (!getRandomValues) {\n if (typeof crypto === 'undefined' || !crypto.getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n getRandomValues = crypto.getRandomValues.bind(crypto);\n }\n return getRandomValues(rnds8);\n}\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default { randomUUID };\n","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n options = options || {};\n const rnds = options.random ?? options.rng?.() ?? rng();\n if (rnds.length < 16) {\n throw new Error('Random bytes length must be >= 16');\n }\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n if (buf) {\n offset = offset || 0;\n if (offset < 0 || offset + 16 > buf.length) {\n throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);\n }\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n return buf;\n }\n return unsafeStringify(rnds);\n}\nexport default v4;\n","import { validate } from \"uuid\";\nimport { EnvironmentManager } from \"../environment/manager/manager\";\n\nexport interface ClientIdManager {\n getClientId: () => string;\n}\n\nexport function createClientIdManager(\n environmentManager: EnvironmentManager,\n): ClientIdManager {\n return {\n getClientId: () => {\n const key = \"visitorId\";\n const environment = environmentManager.get();\n const storage = environment.storage;\n\n const existingClientId = storage.getItem(key);\n const clientId =\n existingClientId && validate(existingClientId)\n ? existingClientId\n : environment.generateUUID();\n storage.setItem(key, clientId);\n return clientId;\n },\n };\n}\n","import REGEX from './regex.js';\nfunction validate(uuid) {\n return typeof uuid === 'string' && REGEX.test(uuid);\n}\nexport default validate;\n","export const version = \"process.env.VERSION\";\n","import { ClientIdManager } from \"../../client-id/client-id\";\nimport { Environment } from \"../../environment/environment\";\nimport { RelayConfig } from \"../../config/config\";\nimport { version } from \"../../version\";\n\n/**\n * The `EventConfig` object provides additonal information for the configuration associated with the event.\n */\nexport interface EventConfig {\n /**\n * The unique identifier of a web property. See [What's a tracking ID?](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n}\n\n/**\n * The `Meta` object provides a structured representation of metadata associated with an emitted event.\n * This object is auto-populated by Relay.\n */\nexport interface Meta {\n /**\n * Event's type that was emitted.\n */\n type: string;\n\n /**\n * Configuration associated with the event.\n */\n config: EventConfig;\n\n /**\n * Timestamp when the event was emitted.\n */\n ts: number;\n\n /**\n * Names and versions of the client side libraries which built and emitted this event.\n */\n source: string[];\n\n /**\n * Persistent unique identifier of a device.\n */\n clientId: string;\n\n /**\n * Browser Navigator's [user agent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent) property if set.\n */\n userAgent: string | null;\n\n /**\n * Browser Document's [referrer](https://developer.mozilla.org/en-US/docs/Web/API/Document/referrer) property if set.\n */\n referrer: string | null;\n\n /**\n * Browser Location's [href](https://developer.mozilla.org/en-US/docs/Web/API/Location/href) property if set.\n */\n location: string | null;\n}\n\nfunction getEventConfig(config: RelayConfig): EventConfig {\n const { trackingId } = config;\n return { trackingId };\n}\n\nfunction getSource(config: RelayConfig): string[] {\n return (config.source || []).concat([`relay@${version}`]);\n}\n\nexport function createMeta(\n type: string,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager,\n): Readonly<Meta> {\n const { getReferrer, getLocation, getUserAgent } = environment;\n const eventConfig = getEventConfig(config);\n const clientId = clientIdManager.getClientId();\n\n return Object.freeze<Meta>({\n type,\n config: eventConfig,\n ts: Date.now(),\n source: getSource(config),\n clientId,\n userAgent: getUserAgent(),\n referrer: getReferrer(),\n location: getLocation(),\n });\n}\n","import { RelayEvent } from \"../event/relay-event\";\n\nconst ANY_EVENT_TYPE = \"*\";\n\n/**\n * Callback to perform an action when a specified event is emitted.\n * @typedef {function} EventCallback\n * @param {RelayEvent} event - the Relay event payload that triggered the callback.\n * @returns {void}\n */\nexport type EventCallback = (event: RelayEvent) => void;\n\ninterface Listener {\n type: string;\n callback: EventCallback;\n}\n\nexport interface ListenerManager {\n add: (listener: Listener) => () => void;\n call: (event: RelayEvent) => void;\n remove: (type: string, callback?: EventCallback) => void;\n}\n\nexport function createListenerManager(): ListenerManager {\n const listeners: Listener[] = [];\n\n function getListenerIndex({ type, callback }: Listener): number {\n return listeners.findIndex(\n (listener) => listener.type === type && listener.callback === callback,\n );\n }\n\n function isMatchesType(listener: Listener, type: string): boolean {\n return listener.type === \"*\" || type === listener.type;\n }\n\n function add(listener: Listener): () => void {\n if (getListenerIndex(listener) < 0) {\n listeners.push(listener);\n }\n return () => remove(listener.type, listener.callback);\n }\n\n function call(event: RelayEvent) {\n listeners.forEach((listener) => {\n if (isMatchesType(listener, event.meta.type)) {\n try {\n listener.callback(event);\n } catch (e) {\n console.error(e);\n }\n }\n });\n }\n\n function removeMultiple(type: string) {\n if (type === ANY_EVENT_TYPE) {\n listeners.length = 0;\n } else {\n for (let i = listeners.length - 1; i >= 0; i--) {\n if (listeners[i].type === type) {\n listeners.splice(i, 1);\n }\n }\n }\n }\n\n function removeOne(listener: Listener) {\n const index = getListenerIndex(listener);\n if (index >= 0) {\n listeners.splice(index, 1);\n }\n }\n\n function remove(type: string, callback?: EventCallback) {\n if (callback) {\n removeOne({ type, callback });\n } else {\n removeMultiple(type);\n }\n }\n\n return {\n add,\n call,\n remove,\n };\n}\n","/**\n * The `RelayConfig` object defines the configuration options for initializing a Relay instance.\n */\nexport interface RelayConfig {\n /**\n * Endpoint defined to communicate with the Event API.\n */\n url: string;\n\n /**\n * Token to authorize the access to the Event API endpoint.\n */\n token: string;\n\n /**\n * The unique identifier of a web property. See [What's a tracking ID?](https://docs.coveo.com/en/n8tg0567/).\n */\n trackingId: string;\n\n /**\n * Defines the library mode. The available modes are `emit` and `disabled`.\n * `emit` sends analytics events to Coveo to be stored.\n * `disabled` prevents the emission of events and does not trigger callbacks.\n * @default emit\n */\n mode?: \"emit\" | \"disabled\";\n\n /**\n * Optionally allows a Relay integration to specify the name(s) of software package(s) relay is\n * being called from. These names will be transmitted with each event, along with Relay's own\n * version. The recommendation is to specify them using a 'softwarename@softwareversion' string.\n */\n source?: string[];\n}\n\nexport interface ConfigManager {\n get: () => Readonly<RelayConfig>;\n update: (updatedConfig: Partial<RelayConfig>) => void;\n}\n\nfunction pick({\n url,\n token,\n trackingId,\n ...rest\n}: RelayConfig): Readonly<RelayConfig> {\n return Object.freeze({\n url,\n token,\n trackingId,\n ...(!!rest.mode && { mode: rest.mode }),\n ...(!!rest.source && { source: rest.source }),\n });\n}\n\nexport function createConfigManager(\n initialConfig: RelayConfig,\n): Readonly<ConfigManager> {\n let _config: Readonly<RelayConfig> = pick(initialConfig);\n\n return {\n get: () => _config,\n update: (updatedConfig: Partial<RelayConfig>) => {\n _config = pick({ ..._config, ...updatedConfig });\n },\n };\n}\n","export interface CookieManager {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string, expire: number) => void;\n}\n\nexport const cookieManager: CookieManager = createCookieManager();\n\nfunction createCookieManager(): CookieManager {\n const prefix = \"coveo_\";\n const getDomain = (host: string) => {\n const parts = host.split(\".\").slice(-2);\n return parts.length == 2 ? parts.join(\".\") : \"\";\n };\n\n return {\n getItem(key: string): string | null {\n const cookiePrefix = `${prefix}${key}=`;\n const cookieArray = document.cookie.split(\";\");\n for (const cookie of cookieArray) {\n const prettifyCookie = cookie.replace(/^\\s+/, \"\");\n if (prettifyCookie.lastIndexOf(cookiePrefix, 0) === 0) {\n return prettifyCookie.substring(\n cookiePrefix.length,\n prettifyCookie.length,\n );\n }\n }\n return null;\n },\n setItem(key: string, data: string, expire: number): void {\n const domain = getDomain(window.location.hostname);\n const expireSection = `;expires=${new Date(\n new Date().getTime() + expire,\n ).toUTCString()}`;\n const domainSection = domain ? `;domain=${domain}` : \"\";\n document.cookie = `${prefix}${key}=${data}${expireSection}${domainSection};path=/;SameSite=Lax`;\n },\n\n removeItem(key: string): void {\n this.setItem(key, \"\", -1);\n },\n };\n}\n","import { createExplorerMessenger } from \"@coveo/explorer-messenger\";\nimport { Environment } from \"../environment\";\nimport { createBrowserStorage } from \"./storage/storage\";\nimport { RelayEvent } from \"../../event/relay-event\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nfunction getReferrer() {\n const referrer = document.referrer;\n\n return referrer === \"\" ? null : referrer;\n}\n\nexport function buildBrowserEnvironment(): Environment {\n return {\n runtime: \"browser\",\n send: (url: string, token: string, event: RelayEvent) => {\n const response = navigator.sendBeacon(\n `${url}?access_token=${token}`,\n new Blob([JSON.stringify([event])], {\n type: \"application/json\",\n }),\n );\n\n const messenger = createExplorerMessenger();\n messenger.sendMessage({ kind: \"EVENT_PROTOCOL\", event, url, token });\n\n if (!response) {\n throw new Error(\n `Failed to send the event(s) because the payload size exceeded the maximum allowed size (32 KB). Please contact support if the problem persists.`,\n );\n }\n },\n getReferrer: () => getReferrer(),\n getLocation: () => window.location.href,\n getUserAgent: () => navigator.userAgent,\n generateUUID: () => uuidv4(),\n storage: createBrowserStorage(),\n };\n}\n","function createExplorerMessenger() {\n const isBrowser = typeof window !== \"undefined\";\n return {\n sendMessage(message) {\n isBrowser && window.postMessage(message, \"*\");\n }\n };\n}\nexport {\n createExplorerMessenger\n};\n","import { Storage } from \"../../storage\";\nimport { cookieManager } from \"./cookie\";\n\nexport function createBrowserStorage(): Storage {\n return {\n getItem(key: string): string | null {\n return cookieManager.getItem(key) || localStorage.getItem(key);\n },\n\n removeItem(key: string): void {\n cookieManager.removeItem(key);\n localStorage.removeItem(key);\n },\n\n setItem(key: string, data: string): void {\n const oneYear = 31556952000;\n localStorage.setItem(key, data);\n cookieManager.setItem(key, data, oneYear);\n },\n };\n}\n","import { ConfigManager } from \"../../config/config\";\nimport { buildBrowserEnvironment } from \"../browser/browser\";\nimport { localStorageAvailable } from \"../browser/storage/availability\";\nimport { Environment } from \"../environment\";\nimport { buildNullEnvironment } from \"../null/null\";\n\nexport interface EnvironmentManager {\n get: () => Readonly<Environment>;\n}\n\nfunction buildEnvironment(configManager: ConfigManager) {\n const active = configManager.get().mode !== \"disabled\";\n\n if (active && isBrowser() && localStorageAvailable()) {\n return buildBrowserEnvironment();\n }\n\n return buildNullEnvironment();\n}\n\nfunction isBrowser() {\n try {\n return typeof window === \"object\";\n } catch {\n return false;\n }\n}\n\nexport function createEnvironmentManager(\n configManager: ConfigManager,\n): Readonly<EnvironmentManager> {\n return {\n get: () => Object.freeze(buildEnvironment(configManager)),\n };\n}\n","// From: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API#feature-detecting_localstorage\nexport function localStorageAvailable() {\n try {\n const x = \"__storage_test__\";\n localStorage.setItem(x, x);\n localStorage.removeItem(x);\n return true;\n } catch (e) {\n return (\n e instanceof DOMException &&\n e.name === \"QuotaExceededError\" &&\n // acknowledge QuotaExceededError only if there's something already stored\n localStorage &&\n localStorage.length !== 0\n );\n }\n}\n","import { Environment } from \"../environment\";\nimport { createNullStorage } from \"../storage\";\n\nexport function buildNullEnvironment(): Environment {\n return {\n runtime: \"null\",\n send: () => undefined,\n getReferrer: () => null,\n getLocation: () => null,\n getUserAgent: () => null,\n generateUUID: () => \"\",\n storage: createNullStorage(),\n };\n}\n","export interface Storage {\n getItem: (key: string) => string | null;\n removeItem: (key: string) => void;\n setItem: (key: string, data: string) => void;\n}\n\nexport function createNullStorage(): Storage {\n return {\n getItem(): string | null {\n return null;\n },\n removeItem(): void {\n return;\n },\n setItem(): void {\n return;\n },\n };\n}\n","import { emit } from \"./emit/emit\";\nimport { createClientIdManager } from \"./client-id/client-id\";\nimport { createRelayEvent, RelayEvent } from \"./event/relay-event\";\nimport { version } from \"./version\";\nimport { createMeta, Meta, EventConfig } from \"./event/meta/meta\";\nimport { createListenerManager, EventCallback } from \"./listener/listener\";\nimport { createConfigManager, RelayConfig } from \"./config/config\";\nimport { createEnvironmentManager } from \"./environment/manager/manager\";\nimport { RelayPayload } from \"./relay-payload\";\n\n/**\n * Function that detaches an event callback.\n * @typedef {function} Off\n * @returns {void}\n */\nexport type Off = () => void;\n\n/**\n * Relay instance.\n * This object provides a comprehensive set of variables and methods for interacting with the Event API.\n */\ninterface Relay {\n /**\n * Sends an event to the Event API.\n * @param {string} type - event's type to be emitted.\n * @param {Record<string,any>} payload - payload to include within the event.\n * @returns {void}\n */\n emit: (type: string, payload: Record<string, any>) => void;\n\n /**\n * Gets the client-side generated meta object.\n * @param {string} type - event's type that will be included in the meta object.\n * @returns {Meta}\n */\n getMeta: (type: string) => Meta;\n\n /**\n * Attaches an event callback to either all event types or a specific one.\n * The callback set will be called when an event with the specified type is emitted.\n * It’s not possible to modify the payload of the event sent to Coveo using this listener.\n * Setting type as \"*\" will trigger the callback for all event types.\n * Returns the \"off\" function to detach the event callback.\n * @param {string} type - event's type.\n * @param {EventCallback} callback - callback that should be called when the event is emitted.\n * @returns {Off}\n */\n on: (type: string, callback: EventCallback) => Off;\n\n /**\n * Detach callback(s) from events.\n * If only the \"type\" parameter is set, all callbacks for the specified type will be removed.\n * @param {string} type - event's type.\n * @param {EventCallback} callback - callback that should be removed.\n * @returns {void}\n */\n off: (type: string, callback?: EventCallback) => void;\n\n /**\n * Updates Relay's configuration after its initialization.\n * @param {Partial<RelayConfig>} config - configuration that should be updated.\n * @returns {void}\n */\n updateConfig: (config: Partial<RelayConfig>) => void;\n\n /**\n * Current version of the Relay library.\n */\n version: string;\n}\n\n/**\n * Initializes the Relay library object.\n * @param {RelayConfig} initialConfig\n * @returns {Relay}\n */\nexport function createRelay(initialConfig: RelayConfig): Relay {\n const configManager = createConfigManager(initialConfig);\n const listenerManager = createListenerManager();\n const environmentManager = createEnvironmentManager(configManager);\n const clientIdManager = createClientIdManager(environmentManager);\n\n return {\n emit: (type: string, payload: Record<string, any>) => {\n const config = configManager.get();\n const environment = environmentManager.get();\n\n const event = createRelayEvent(\n type,\n payload,\n config,\n environment,\n clientIdManager,\n );\n\n return emit({\n config,\n environment,\n event,\n listenerManager,\n });\n },\n getMeta: (type: string) =>\n createMeta(\n type,\n configManager.get(),\n environmentManager.get(),\n clientIdManager,\n ),\n on: (type: string, callback: EventCallback) =>\n listenerManager.add({ type, callback }),\n off: (type: string, callback?: EventCallback) =>\n listenerManager.remove(type, callback),\n updateConfig: (config: Partial<RelayConfig>) =>\n configManager.update(config),\n version,\n };\n}\n\nexport type {\n Relay,\n Meta,\n EventConfig,\n EventCallback,\n RelayConfig,\n RelayPayload,\n RelayEvent,\n};\n","import { ClientIdManager } from \"../client-id/client-id\";\nimport { Environment } from \"../environment/environment\";\nimport { RelayPayload } from \"../relay-payload\";\nimport { RelayConfig } from \"../relay\";\nimport { createMeta, Meta } from \"./meta/meta\";\n\n/**\n * Defines the structure of a RelayEvent, extending the RelayPayload.\n */\nexport interface RelayEvent extends RelayPayload {\n /**\n * Read-only `meta` property of Meta type.\n */\n meta: Readonly<Meta>;\n}\n\nexport function createRelayEvent(\n type: string,\n payload: RelayPayload,\n config: RelayConfig,\n environment: Environment,\n clientIdManager: ClientIdManager,\n): Readonly<RelayEvent> {\n return {\n ...payload,\n meta: createMeta(type, config, environment, clientIdManager),\n };\n}\n","import { Environment } from \"../environment/environment\";\nimport { ListenerManager } from \"../listener/listener\";\nimport { RelayEvent } from \"../event/relay-event\";\nimport { RelayConfig } from \"../relay\";\n\nexport interface EmitParams {\n config: RelayConfig;\n environment: Environment;\n event: RelayEvent;\n listenerManager: ListenerManager;\n}\n\nexport function emit({\n config,\n environment,\n event,\n listenerManager,\n}: EmitParams) {\n const { url, token, mode } = config;\n const isEnabled = mode !== \"disabled\";\n\n if (isEnabled) {\n listenerManager.call(event);\n environment.send(url, token, event);\n }\n}\n"],"names":["REGEX","byteToHex","i","push","toString","slice","getRandomValues","rnds8","Uint8Array","native","randomUUID","crypto","bind","v4","options","buf","offset","rnds","random","rng","Error","length","arr","toLowerCase","unsafeStringify","createClientIdManager","environmentManager","getClientId","key","environment","get","storage","existingClientId","getItem","clientId","uuid","test","generateUUID","setItem","version","getSource","config","source","concat","createMeta","type","clientIdManager","getReferrer","getLocation","getUserAgent","eventConfig","trackingId","getEventConfig","Object","freeze","ts","Date","now","userAgent","referrer","location","createListenerManager","listeners","getListenerIndex","callback","findIndex","listener","remove","index","splice","removeOne","removeMultiple","add","call","event","forEach","isMatchesType","meta","e","console","error","pick","url","token","rest","mode","cookieManager","prefix","cookiePrefix","cookieArray","document","cookie","split","prettifyCookie","replace","lastIndexOf","substring","data","expire","domain","host","parts","join","getDomain","window","hostname","expireSection","getTime","toUTCString","domainSection","removeItem","this","createCookieManager","buildBrowserEnvironment","runtime","send","response","navigator","sendBeacon","Blob","JSON","stringify","messenger","isBrowser","sendMessage","message","postMessage","createExplorerMessenger","kind","href","uuidv4","localStorage","buildEnvironment","configManager","x","DOMException","name","localStorageAvailable","createRelay","initialConfig","_config","update","updatedConfig","createConfigManager","listenerManager","createEnvironmentManager","emit","payload","createRelayEvent","getMeta","on","off","updateConfig"],"mappings":"AAAA,IAAAA,EAAe,2JCCf,MAAMC,EAAY,GAClB,IAAK,IAAIC,EAAI,EAAGA,EAAI,MAAOA,EACvBD,EAAUE,MAAMD,EAAI,KAAOE,SAAS,IAAIC,MAAM,ICHlD,IAAIC,EACJ,MAAMC,EAAQ,IAAIC,WAAW,ICA7B,IAAeC,EAAA,CAAEC,WADoB,oBAAXC,QAA0BA,OAAOD,YAAcC,OAAOD,WAAWE,KAAKD,SCGhG,SAASE,EAAGC,EAASC,EAAKC,GACtB,GAAIP,EAAOC,aAAuBI,EAC9B,OAAOL,EAAOC,aAGlB,MAAMO,GADNH,EAAUA,GAAW,CAAE,GACFI,QAAUJ,EA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id/client-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,MAAM,CAAC;CAC3B;AAED,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,kBAAkB,GACrC,eAAe,CAgBjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAE3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjC,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACvD;AAiBD,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,WAAW,GACzB,QAAQ,CAAC,aAAa,CAAC,CASzB"}