@epigraph/epigraph-std-lib 4.5.1-alpha → 4.5.3-alpha

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,82 +1,82 @@
1
- var o = /* @__PURE__ */ ((s) => (s.UNAVAILABLE = "unavailable", s.AVAILABLE = "available", s.RESTRICTED = "restricted", s))(o || {});
2
- const l = Symbol("data"), d = Symbol("next"), P = class m {
3
- constructor(e) {
4
- this[l] = e, this[d] = null;
1
+ var u = /* @__PURE__ */ ((i) => (i.UNAVAILABLE = "unavailable", i.AVAILABLE = "available", i.RESTRICTED = "restricted", i))(u || {});
2
+ const p = Symbol("data"), d = Symbol("next"), w = class m {
3
+ constructor(t) {
4
+ this[p] = t, this[d] = null;
5
5
  }
6
6
  get data() {
7
- return this[l];
7
+ return this[p];
8
8
  }
9
- set next(e) {
10
- if (!(e instanceof m) && e !== null)
9
+ set next(t) {
10
+ if (!(t instanceof m) && t !== null)
11
11
  throw new Error(
12
12
  "This node is not an instance of the custom class 'Node'."
13
13
  );
14
- this[d] = e;
14
+ this[d] = t;
15
15
  }
16
16
  get next() {
17
17
  return this[d];
18
18
  }
19
19
  };
20
- let g = P;
21
- const p = Symbol("head");
22
- class C {
20
+ let g = w;
21
+ const l = Symbol("head");
22
+ class A {
23
23
  constructor() {
24
- this[p] = null;
24
+ this[l] = null;
25
25
  }
26
- set head(e) {
27
- this[p] = e;
26
+ set head(t) {
27
+ this[l] = t;
28
28
  }
29
29
  get head() {
30
- return this[p];
30
+ return this[l];
31
31
  }
32
- addToTail(e) {
33
- let t = this.head;
34
- if (t) {
35
- for (; t.next !== null; )
36
- t = t?.next;
37
- return t.next = new g(e);
32
+ addToTail(t) {
33
+ let e = this.head;
34
+ if (e) {
35
+ for (; e.next !== null; )
36
+ e = e?.next;
37
+ return e.next = new g(t);
38
38
  }
39
- return this.head = new g(e);
39
+ return this.head = new g(t);
40
40
  }
41
41
  removeHead() {
42
- const e = this.head;
43
- if (e)
44
- return this.head = e.next, e.data;
42
+ const t = this.head;
43
+ if (t)
44
+ return this.head = t.next, t.data;
45
45
  }
46
46
  }
47
- const v = Symbol("queue"), h = Symbol("size");
48
- class _ {
47
+ const _ = Symbol("queue"), h = Symbol("size");
48
+ class v {
49
49
  constructor() {
50
- this[v] = new C(), this[h] = 0;
50
+ this[_] = new A(), this[h] = 0;
51
51
  }
52
52
  get queue() {
53
- return this[v];
53
+ return this[_];
54
54
  }
55
55
  get size() {
56
56
  return this[h];
57
57
  }
58
- enqueue(e) {
59
- this.queue.addToTail(e), this[h]++;
58
+ enqueue(t) {
59
+ this.queue.addToTail(t), this[h]++;
60
60
  }
61
61
  dequeue() {
62
- const e = this.queue.removeHead();
63
- return this[h]--, e;
62
+ const t = this.queue.removeHead();
63
+ return this[h]--, t;
64
64
  }
65
65
  }
66
- class N {
66
+ class P {
67
67
  constructor({
68
- trackingID: e,
69
- experienceID: t,
68
+ trackingID: t,
69
+ experienceID: e,
70
70
  solution: n,
71
- verboseLogging: r = !1
71
+ verboseLogging: s = !1
72
72
  }) {
73
- this.__status = o.UNAVAILABLE, this.__sentEventCount = 0, this.name = this.pluginName = "GA4-PLUGIN", this.trackingID = e, this.experienceID = t, this.solution = n, this.verboseLogging = r, this.__queue = new _(), this.dataLayer = window.dataLayer, this.dataLayerName = "dataLayer", this.setupDataLayer(), this.initGtag(this.dataLayerName, this.trackingID);
73
+ this.dataLayerName = "dataLayer", this.__status = u.UNAVAILABLE, this.__sentEventCount = 0, this.__initializationAttempts = 0, this.__lastInitializationAttempt = 0, this.__maxInitializationAttempts = 10, this.__initializationRetryDelay = 2e3, this.__isInitialized = !1, this.__initializationMethod = "NONE", this.__nexusFailureReported = !1, this.name = this.pluginName = "GA4-PLUGIN", this.trackingID = t, this.experienceID = e, this.solution = n, this.verboseLogging = s, this.__queue = new v(), this.initializePlugin();
74
74
  }
75
75
  getStatus() {
76
76
  return this.__status;
77
77
  }
78
- setStatus(e) {
79
- this.__status = e;
78
+ setStatus(t) {
79
+ this.__status = t;
80
80
  }
81
81
  getPendingEventCount() {
82
82
  return this.__queue.size;
@@ -94,71 +94,141 @@ class N {
94
94
  return `${this.name}-${this.trackingID}`;
95
95
  }
96
96
  setupPlugin() {
97
- this.dataLayer !== void 0 && this.dequeueAndSendEvents();
97
+ this.__isInitialized && this.dataLayer !== void 0 && this.dequeueAndSendEvents();
98
98
  }
99
99
  /**
100
100
  * This function will send an Event to Google Analytics 4.
101
101
  *
102
102
  * @param eventData IAnalyticsEvent The event to be tracked
103
- * @param consentPlugin
103
+ * @param consent boolean Whether consent is granted
104
104
  */
105
- async sendEvent(e, t) {
106
- if (this.__queue.enqueue(e), !t) {
107
- this.__status = o.RESTRICTED;
105
+ async sendEvent(t, e) {
106
+ if (this.__queue.enqueue(t), !e) {
107
+ this.__status = u.RESTRICTED;
108
108
  return;
109
109
  }
110
- if (this.dataLayer !== void 0)
111
- try {
112
- await this.dequeueAndSendEvents();
113
- } catch (n) {
114
- this.logger(n);
115
- }
116
- else
117
- this.logger("Cannot send Google Analytics 4 event: dataLayer is not defined.");
110
+ if (!this.__isInitialized) {
111
+ this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");
112
+ return;
113
+ }
114
+ try {
115
+ await this.dequeueAndSendEvents();
116
+ } catch (n) {
117
+ this.logger(n), await this.reportFailureToNexus("EVENT_SEND_ERROR", n?.toString() || "Unknown error");
118
+ }
118
119
  }
119
- setupDataLayer() {
120
- if (this.dataLayer) {
121
- this.__status = o.AVAILABLE;
120
+ async initializePlugin() {
121
+ if (this.__isInitialized)
122
122
  return;
123
+ const t = Date.now();
124
+ if (this.__initializationAttempts >= this.__maxInitializationAttempts) {
125
+ this.__nexusFailureReported || (await this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS", "Maximum initialization attempts reached"), this.__nexusFailureReported = !0);
126
+ return;
127
+ }
128
+ if (t - this.__lastInitializationAttempt < this.__initializationRetryDelay)
129
+ return;
130
+ this.__lastInitializationAttempt = t, this.__initializationAttempts++;
131
+ const e = await this.detectAndSetupAnalytics();
132
+ e.success ? (this.__isInitialized = !0, this.__status = u.AVAILABLE, this.__initializationMethod = e.method, this.dataLayerName = e.dataLayerName, this.dataLayer = window[this.dataLayerName], this.logger(`Successfully initialized ${e.method} with dataLayer: ${this.dataLayerName}`), this.__queue.size > 0 && await this.dequeueAndSendEvents()) : (this.logger(`Initialization attempt ${this.__initializationAttempts} failed: ${e.error}`), this.__initializationAttempts < this.__maxInitializationAttempts && setTimeout(() => this.initializePlugin(), this.__initializationRetryDelay));
133
+ }
134
+ async detectAndSetupAnalytics() {
135
+ const t = this.detectGTM();
136
+ if (t)
137
+ return this.logger(`GTM detected with container ID: ${t.containerId}`), {
138
+ success: !0,
139
+ method: "GTM",
140
+ dataLayerName: t.dataLayerName
141
+ };
142
+ if (window.dataLayer)
143
+ return this.logger("Existing dataLayer found"), {
144
+ success: !0,
145
+ method: "GA4",
146
+ dataLayerName: "dataLayer"
147
+ };
148
+ const e = this.findGA4ScriptInfo(this.trackingID);
149
+ if (e) {
150
+ const n = e.l || "dataLayer";
151
+ if (this.logger(`GA4 script found, setting up with dataLayer: ${n}`), this.setupGA4(n))
152
+ return {
153
+ success: !0,
154
+ method: "GA4",
155
+ dataLayerName: n
156
+ };
123
157
  }
124
- const t = this.findGA4ScriptInfo(this.trackingID)?.l;
125
- t && (this.dataLayerName = t, this.dataLayer = window[t]);
158
+ return this.setupGA4("dataLayer") ? {
159
+ success: !0,
160
+ method: "GA4",
161
+ dataLayerName: "dataLayer"
162
+ } : {
163
+ success: !1,
164
+ method: "NONE",
165
+ dataLayerName: "dataLayer",
166
+ error: "No analytics setup found and unable to create one"
167
+ };
126
168
  }
127
- initGtag(e = "dataLayer", t) {
128
- window.epgDataLayerName = e, typeof window.gtag != "function" && (window.gtag = function() {
129
- window[window.epgDataLayerName].push(arguments);
130
- }, window.gtag("js", /* @__PURE__ */ new Date()), window.gtag("config", t, { send_page_view: !1 }));
169
+ detectGTM() {
170
+ const t = document.querySelectorAll('script[src*="googletagmanager.com/gtm"]');
171
+ for (const e of Array.from(t)) {
172
+ const n = e.getAttribute("src");
173
+ if (n) {
174
+ const s = n.match(/gtm\.js\?id=([^&]+)/);
175
+ if (s) {
176
+ const r = n.match(/&l=([^&]+)/), o = r ? r[1] : "dataLayer";
177
+ return {
178
+ containerId: s[1],
179
+ dataLayerName: o
180
+ };
181
+ }
182
+ }
183
+ }
184
+ return null;
185
+ }
186
+ setupGA4(t) {
187
+ try {
188
+ return window[t] || (window[t] = []), window.epgDataLayerName = t, typeof window.gtag != "function" && (window.gtag = function() {
189
+ const e = window.epgDataLayerName;
190
+ e && window[e] && Array.isArray(window[e]) && window[e].push(arguments);
191
+ }, window.gtag("js", /* @__PURE__ */ new Date()), window.gtag("config", this.trackingID, { send_page_view: !1 })), !0;
192
+ } catch (e) {
193
+ return this.logger(`Error setting up GA4: ${e}`), !1;
194
+ }
131
195
  }
132
196
  /**
133
197
  * Send all events that are in the queue
134
198
  * @private
135
199
  */
136
200
  async dequeueAndSendEvents() {
137
- let e = this.__queue.size;
138
- for (let t = 0; t < e; t++) {
139
- const n = this.__queue.dequeue(), r = n.getGa4Parameters(this.solution, this.experienceID);
140
- if (n.customParameters && Object.assign(r, n.customParameters), JSON.stringify(r).length > 459)
201
+ if (!this.__isInitialized || !this.dataLayer)
202
+ return;
203
+ let t = this.__queue.size;
204
+ for (let e = 0; e < t; e++) {
205
+ const n = this.__queue.dequeue();
206
+ let s = n.getParameters();
207
+ if (s.solution = this.solution, s.experience_id = this.experienceID, n.customParameters && Object.assign(s, n.customParameters), JSON.stringify(s).length > 459)
141
208
  try {
142
- let u = await this.sendGA4LongParameters(r);
143
- r.epg_event_tag = u;
209
+ s = {
210
+ epg_event_tag: await this.sendGA4LongParameters(s)
211
+ };
144
212
  } catch {
145
213
  }
146
- gtag("event", n.eventName, r), this.__sentEventCount++, this.logger(`Google Analytics 4 event successfully sent: ${n.eventName}`);
214
+ try {
215
+ this.__initializationMethod === "GTM" ? this.sendToGTM(n.eventName, s) : this.__initializationMethod === "GA4" && window.gtag("event", n.eventName, s), this.__sentEventCount++, this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${n.eventName}`);
216
+ } catch (o) {
217
+ this.logger(`Error sending event ${n.eventName}: ${o}`), this.__queue.enqueue(n);
218
+ }
147
219
  }
148
220
  }
149
221
  /**
150
222
  * Checks if verboseLogging is enabled, then logs the error
151
223
  * @param err
152
224
  */
153
- logger(e) {
154
- this.verboseLogging && console.warn(e);
225
+ logger(t) {
226
+ this.verboseLogging && console.warn(t);
155
227
  }
156
- async sendGA4LongParameters(e) {
157
- const t = "https://api.myepigraph.com/api/analytics/ga4/custom", n = {
158
- parameters: e
159
- };
228
+ async sendGA4LongParameters(t) {
229
+ const e = "https://api.myepigraph.com/api/analytics/ga4/custom", n = { parameters: t };
160
230
  try {
161
- const r = await fetch(t, {
231
+ const s = await fetch(e, {
162
232
  method: "POST",
163
233
  // Assuming it's a POST request, adjust if necessary
164
234
  headers: {
@@ -167,48 +237,68 @@ class N {
167
237
  },
168
238
  body: JSON.stringify(n)
169
239
  });
170
- if (r.ok) {
171
- const i = await r.json();
172
- return i && i.id ? i.id : "";
173
- } else
174
- return "";
240
+ return s.ok ? (await s.json())?.id ?? "" : "";
175
241
  } catch {
176
242
  return "";
177
243
  }
178
244
  }
179
- findGA4ScriptInfo(e) {
180
- const t = document.querySelectorAll("script[src]");
181
- for (const n of t) {
182
- const r = n.getAttribute("src");
183
- if (r && r.includes(e)) {
184
- const i = new URL(r, location.href), u = Object.fromEntries(i.searchParams.entries());
245
+ sendToGTM(t, e) {
246
+ this.dataLayer && this.dataLayer.push({
247
+ event: t,
248
+ ...e
249
+ });
250
+ }
251
+ async reportFailureToNexus(t, e) {
252
+ try {
253
+ const n = {
254
+ plugin: "GA4",
255
+ trackingId: this.trackingID,
256
+ solution: this.solution,
257
+ experienceId: this.experienceID,
258
+ failureType: t,
259
+ errorMessage: e,
260
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
261
+ url: window.location.href,
262
+ userAgent: navigator.userAgent
263
+ };
264
+ this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`);
265
+ } catch (n) {
266
+ this.logger(`Error reporting failure to Nexus: ${n}`);
267
+ }
268
+ }
269
+ findGA4ScriptInfo(t) {
270
+ const e = document.querySelectorAll("script[src]");
271
+ for (const n of e) {
272
+ const s = n.getAttribute("src");
273
+ if (s && s.includes(t)) {
274
+ const r = new URL(s, location.href), o = Object.fromEntries(r.searchParams.entries());
185
275
  return {
186
- fullSrc: i.href,
187
- id: u.id || void 0,
188
- l: u.l || void 0
276
+ fullSrc: r.href,
277
+ id: o.id || void 0,
278
+ l: o.l || void 0
189
279
  };
190
280
  }
191
281
  }
192
282
  return null;
193
283
  }
194
284
  }
195
- class S {
285
+ class I {
196
286
  constructor({
197
- trackingID: e,
198
- experienceID: t,
287
+ trackingID: t,
288
+ experienceID: e,
199
289
  solution: n,
200
- sessionId: r,
201
- xPath: i,
202
- verboseLogging: u = !1,
290
+ sessionId: s,
291
+ xPath: r,
292
+ verboseLogging: o = !1,
203
293
  sendToStaging: y = !1
204
294
  }) {
205
- this.__status = o.UNAVAILABLE, this.__sentEventCount = 0, this.sessionId = r, this.xPath = i, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = e, this.experienceID = t, this.solution = n, this.verboseLogging = u, this.__queue = new _(), this.url = y ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event", this.__status = o.AVAILABLE;
295
+ this.__status = u.UNAVAILABLE, this.__sentEventCount = 0, this.sessionId = s, this.xPath = r, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = t, this.experienceID = e, this.solution = n, this.verboseLogging = o, this.__queue = new v(), this.url = y ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event", this.__status = u.AVAILABLE;
206
296
  }
207
297
  getStatus() {
208
298
  return this.__status;
209
299
  }
210
- setStatus(e) {
211
- this.__status = e;
300
+ setStatus(t) {
301
+ this.__status = t;
212
302
  }
213
303
  getPendingEventCount() {
214
304
  return this.__queue.size;
@@ -224,22 +314,22 @@ class S {
224
314
  }
225
315
  setupPlugin() {
226
316
  }
227
- async sendEvent(e, t) {
228
- if (this.__queue.enqueue(e), !t) {
229
- this.__status = o.RESTRICTED;
317
+ async sendEvent(t, e) {
318
+ if (this.__queue.enqueue(t), !e) {
319
+ this.__status = u.RESTRICTED;
230
320
  return;
231
321
  }
232
322
  await this.dequeueAndSendEvents();
233
323
  }
234
324
  async dequeueAndSendEvents() {
235
- for (let e = 0; e < this.__queue.size; e++) {
236
- const t = this.__queue.dequeue();
237
- t.customParameters.solution = this.solution;
325
+ for (let t = 0; t < this.__queue.size; t++) {
326
+ const e = this.__queue.dequeue();
327
+ e.customParameters.solution = this.solution;
238
328
  const n = {
239
329
  trackingID: this.trackingID,
240
330
  experience_id: this.experienceID,
241
- action: t.eventName,
242
- parameters: t.getNexusParameters()
331
+ action: e.eventName,
332
+ parameters: e.getParameters()
243
333
  };
244
334
  try {
245
335
  return (await fetch(this.url, {
@@ -262,9 +352,9 @@ class S {
262
352
  return "";
263
353
  }
264
354
  }
265
- class w {
266
- constructor(e) {
267
- this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
355
+ class N {
356
+ constructor(t) {
357
+ this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = t, this.consent = !1, this.addConsentChangedListener();
268
358
  }
269
359
  /**
270
360
  * Checks to see if the user has consented. If this is false, it will block all analytics
@@ -273,8 +363,8 @@ class w {
273
363
  if (this.consentSet)
274
364
  return this.consent;
275
365
  if (window.OnetrustActiveGroups !== void 0) {
276
- let e = window.OnetrustActiveGroups;
277
- e !== void 0 && e.split(",").forEach((n) => {
366
+ let t = window.OnetrustActiveGroups;
367
+ t !== void 0 && t.split(",").forEach((n) => {
278
368
  n === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
279
369
  });
280
370
  }
@@ -288,309 +378,295 @@ class w {
288
378
  });
289
379
  }
290
380
  }
291
- var E = /* @__PURE__ */ ((s) => (s.OneTrust = "onetrust", s))(E || {});
381
+ var E = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(E || {});
292
382
  class a {
293
383
  constructor({
294
- eventName: e,
295
- interactiveEvent: t,
384
+ eventName: t,
385
+ interactiveEvent: e,
296
386
  customParameters: n
297
387
  }) {
298
- this.eventName = e, this.interactiveEvent = t, this.customParameters = n;
299
- }
300
- getGa4Parameters(e, t) {
301
- let n = {
302
- solution: e,
303
- experience_id: t,
304
- interactive_event: this.interactiveEvent,
305
- items: [],
306
- epg_event_tag: ""
307
- };
308
- return n = Object.assign(n, JSON.parse(JSON.stringify(this.customParameters))), n;
309
- }
310
- getGTMParameters() {
311
- return {};
388
+ this.eventName = t, this.interactiveEvent = e, this.customParameters = n;
312
389
  }
313
- getNexusParameters() {
314
- let e = {
315
- interactive_event: this.interactiveEvent,
316
- items: []
390
+ getParameters() {
391
+ let t = {
392
+ interactive_event: this.interactiveEvent
317
393
  };
318
- return e = Object.assign(e, JSON.parse(JSON.stringify(this.customParameters))), e;
394
+ return t = Object.assign(t, JSON.parse(JSON.stringify(this.customParameters))), t;
319
395
  }
320
396
  }
321
- class L extends a {
322
- constructor(e) {
397
+ class C extends a {
398
+ constructor(t = []) {
323
399
  super({
324
400
  eventName: "epigraph_ar_requested",
325
401
  interactiveEvent: !0,
326
402
  customParameters: {
327
- items: e
403
+ items: t
328
404
  }
329
405
  });
330
406
  }
331
407
  }
332
- class A extends a {
333
- constructor(e, t) {
408
+ class L extends a {
409
+ constructor(t) {
334
410
  super({
335
411
  eventName: "epigraph_module_loading",
336
412
  interactiveEvent: !1,
337
413
  customParameters: {
338
- items: e,
339
414
  is_pre_config: t
340
415
  }
341
416
  });
342
417
  }
343
418
  }
344
- class x extends a {
345
- constructor(e, t, n) {
419
+ class S extends a {
420
+ constructor(t, e) {
346
421
  super({
347
422
  eventName: "epigraph_module_ready",
348
423
  interactiveEvent: !1,
349
424
  customParameters: {
350
- items: e,
351
425
  is_pre_config: t,
352
- load_time_ms: n
426
+ load_time_ms: e
353
427
  }
354
428
  });
355
429
  }
356
430
  }
357
- class I extends a {
358
- constructor(e, t, n, r) {
431
+ class x extends a {
432
+ constructor(t, e, n) {
359
433
  super({
360
434
  eventName: "epigraph_module_failed",
361
435
  interactiveEvent: !1,
362
436
  customParameters: {
363
- items: e,
364
437
  is_pre_config: t,
365
- load_time_ms: n,
366
- error_type: r
438
+ load_time_ms: e,
439
+ error_type: n
367
440
  }
368
441
  });
369
442
  }
370
443
  }
371
- class q extends a {
372
- constructor(e) {
444
+ class T extends a {
445
+ constructor(t = []) {
373
446
  super({
374
447
  eventName: "epigraph_module_closed",
375
448
  interactiveEvent: !0,
376
449
  customParameters: {
377
- items: e
450
+ items: t
378
451
  }
379
452
  });
380
453
  }
381
454
  }
382
- class T extends a {
383
- constructor(e, t, n) {
455
+ class z extends a {
456
+ constructor(t, e = {}) {
384
457
  super({
385
458
  eventName: "epigraph_support_detected",
386
459
  interactiveEvent: !1,
387
460
  customParameters: {
388
- items: e,
389
461
  support_type: t,
390
- device_capabilities: n
462
+ device_capabilities: e
391
463
  }
392
464
  });
393
465
  }
394
466
  }
395
- class b extends a {
396
- constructor(e, t, n) {
467
+ class q extends a {
468
+ constructor(t, e) {
397
469
  super({
398
470
  eventName: "epigraph_button_click",
399
471
  interactiveEvent: !0,
400
472
  customParameters: {
401
- items: e,
402
473
  button_type: t,
403
- button_name: n
474
+ button_name: e
404
475
  }
405
476
  });
406
477
  }
407
478
  }
408
- class O extends a {
409
- constructor(e, t, n, r) {
479
+ class D extends a {
480
+ constructor(t = [], e, n, s) {
410
481
  super({
411
482
  eventName: "epigraph_panel_opened",
412
- interactiveEvent: t,
483
+ interactiveEvent: e,
413
484
  customParameters: {
414
- items: e,
485
+ items: t,
415
486
  panel_type: n,
416
- trigger_source: r
487
+ trigger_source: s
417
488
  }
418
489
  });
419
490
  }
420
491
  }
421
- class D extends a {
422
- constructor(e, t, n, r) {
492
+ class G extends a {
493
+ constructor(t = [], e, n, s) {
423
494
  super({
424
495
  eventName: "epigraph_panel_closed",
425
- interactiveEvent: t,
496
+ interactiveEvent: e,
426
497
  customParameters: {
427
- items: e,
498
+ items: t,
428
499
  panel_type: n,
429
- trigger_source: r
500
+ trigger_source: s
430
501
  }
431
502
  });
432
503
  }
433
504
  }
434
- class R extends a {
435
- constructor(e) {
505
+ class O extends a {
506
+ constructor(t = []) {
436
507
  super({
437
508
  eventName: "epigraph_add_to_favourites",
438
509
  interactiveEvent: !0,
439
510
  customParameters: {
440
- items: e
511
+ items: t
441
512
  }
442
513
  });
443
514
  }
444
515
  }
445
- class G extends a {
446
- constructor(e, t) {
516
+ class b extends a {
517
+ constructor(t) {
447
518
  super({
448
519
  eventName: "epigraph_keyboard_interaction",
449
520
  interactiveEvent: !0,
450
521
  customParameters: {
451
- items: e,
452
522
  action_performed: t
453
523
  }
454
524
  });
455
525
  }
456
526
  }
457
- class k extends a {
458
- constructor(e, t) {
527
+ class R extends a {
528
+ constructor(t) {
459
529
  super({
460
530
  eventName: "epigraph_touch_interaction",
461
531
  interactiveEvent: !0,
462
532
  customParameters: {
463
- items: e,
464
533
  interaction_type: t
465
534
  }
466
535
  });
467
536
  }
468
537
  }
469
- class j extends a {
470
- constructor(e, t, n, r, i) {
538
+ class M extends a {
539
+ constructor(t = [], e, n, s, r) {
471
540
  super({
472
541
  eventName: "epigraph_item_added",
473
- interactiveEvent: t,
542
+ interactiveEvent: e,
474
543
  customParameters: {
475
- items: e,
544
+ items: t,
476
545
  value: n,
477
- currency: r,
478
- quantity: i
546
+ currency: s,
547
+ quantity: r
479
548
  }
480
549
  });
481
550
  }
482
551
  }
483
- class U extends a {
484
- constructor(e) {
552
+ class $ extends a {
553
+ constructor(t = []) {
485
554
  super({
486
555
  eventName: "epigraph_item_moved",
487
556
  interactiveEvent: !0,
488
557
  customParameters: {
489
- items: e
558
+ items: t
490
559
  }
491
560
  });
492
561
  }
493
562
  }
494
- class B extends a {
495
- constructor(e, t, n) {
563
+ class k extends a {
564
+ constructor(t = [], e, n, s) {
496
565
  super({
497
566
  eventName: "epigraph_item_removed",
498
567
  interactiveEvent: !0,
499
568
  customParameters: {
500
- items: e,
501
- currency: t,
502
- quantity: n
569
+ items: t,
570
+ value: e,
571
+ currency: n,
572
+ quantity: s
503
573
  }
504
574
  });
505
575
  }
506
576
  }
507
- class M extends a {
508
- constructor(e, t) {
577
+ class U extends a {
578
+ constructor(t = [], e) {
509
579
  super({
510
580
  eventName: "epigraph_variant_changed",
511
581
  interactiveEvent: !0,
512
582
  customParameters: {
513
- items: e,
514
- change_type: t
583
+ items: t,
584
+ change_type: e
515
585
  }
516
586
  });
517
587
  }
518
588
  }
519
- class $ extends a {
520
- constructor(e, t, n) {
589
+ class j extends a {
590
+ constructor(t = [], e, n) {
521
591
  super({
522
592
  eventName: "epigraph_content_shared",
523
593
  interactiveEvent: !0,
524
594
  customParameters: {
525
- items: e,
526
- content_type: t,
595
+ items: t,
596
+ content_type: e,
527
597
  share_destination: n
528
598
  }
529
599
  });
530
600
  }
531
601
  }
532
- class z extends a {
533
- constructor(e, t, n) {
602
+ class F extends a {
603
+ constructor(t = [], e, n) {
534
604
  super({
535
605
  eventName: "epigraph_checkout",
536
606
  interactiveEvent: !0,
537
607
  customParameters: {
538
- items: e,
539
- value: t,
608
+ items: t,
609
+ value: e,
540
610
  currency: n
541
611
  }
542
612
  });
543
613
  }
544
614
  }
545
- class J extends a {
546
- constructor(e, t, n) {
615
+ class B extends a {
616
+ constructor(t = [], e, n) {
547
617
  super({
548
618
  eventName: "epigraph_conversion",
549
619
  interactiveEvent: !0,
550
620
  customParameters: {
551
- items: e,
552
- value: t,
621
+ items: t,
622
+ value: e,
553
623
  currency: n
554
624
  }
555
625
  });
556
626
  }
557
627
  }
558
628
  class V extends a {
559
- constructor(e, t) {
629
+ constructor(t) {
560
630
  super({
561
631
  eventName: "epigraph_changeRate",
562
632
  interactiveEvent: !1,
563
633
  customParameters: {
564
- items: e,
565
634
  value: t
566
635
  }
567
636
  });
568
637
  }
569
638
  }
570
- class F extends a {
571
- constructor(e, t) {
639
+ class J extends a {
640
+ constructor(t) {
572
641
  super({
573
642
  eventName: "epigraph_completionRate",
574
643
  interactiveEvent: !1,
575
644
  customParameters: {
576
- items: e,
577
645
  value: t
578
646
  }
579
647
  });
580
648
  }
581
649
  }
582
650
  class H extends a {
583
- constructor(e, t) {
651
+ constructor(t) {
584
652
  super({
585
653
  eventName: "epigraph_engagementRate",
586
654
  interactiveEvent: !1,
587
655
  customParameters: {
588
- items: e,
589
656
  value: t
590
657
  }
591
658
  });
592
659
  }
593
660
  }
661
+ class X extends a {
662
+ constructor(t, e, n) {
663
+ super({
664
+ eventName: t,
665
+ interactiveEvent: e,
666
+ customParameters: n
667
+ });
668
+ }
669
+ }
594
670
  /**
595
671
  * @license
596
672
  * Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
@@ -610,15 +686,15 @@ class H extends a {
610
686
  var f;
611
687
  const c = Symbol("analyticsPluginsMap");
612
688
  f = c;
613
- class X {
614
- constructor(e, t) {
615
- this[f] = /* @__PURE__ */ new Map(), this.__consentPlugin = null, e && t && (this.__consentPlugin = this.buildConsentPlugin(e, t)), window.addEventListener("epigraphAnalyticsConsentChange", this.__onConsentChangeFromEvent);
689
+ class K {
690
+ constructor(t, e) {
691
+ this[f] = /* @__PURE__ */ new Map(), this.__consentPlugin = null, t && e && (this.__consentPlugin = this.buildConsentPlugin(t, e)), window.addEventListener("epigraphAnalyticsConsentChange", this.__onConsentChangeFromEvent);
616
692
  }
617
- __onConsentChangeFromEvent(e) {
618
- let t = e;
619
- this.__overrideConsent = t.detail.hasConsent;
693
+ __onConsentChangeFromEvent(t) {
694
+ let e = t;
695
+ this.__overrideConsent = e.detail.hasConsent;
620
696
  for (const n of this[c].values())
621
- this.__hasConsent() || n.setStatus(o.RESTRICTED);
697
+ this.__hasConsent() || n.setStatus(u.RESTRICTED);
622
698
  }
623
699
  /**
624
700
  * Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
@@ -627,11 +703,11 @@ class X {
627
703
  *
628
704
  * @param plugin
629
705
  */
630
- addEventPlugin(e) {
631
- this[c].has(e.getUniquePluginIdentifier()) || (this[c].set(
632
- e.getUniquePluginIdentifier(),
633
- e
634
- ), e.setupPlugin());
706
+ addEventPlugin(t) {
707
+ this[c].has(t.getUniquePluginIdentifier()) || (this[c].set(
708
+ t.getUniquePluginIdentifier(),
709
+ t
710
+ ), t.setupPlugin());
635
711
  }
636
712
  /**
637
713
  * Resolves session consent by prioritizing this._overrideConsent and if not found,
@@ -640,17 +716,17 @@ class X {
640
716
  * @returns {boolean} Whether the session has consent to track analytics or not.
641
717
  */
642
718
  __hasConsent() {
643
- let e = !0;
644
- return this.__overrideConsent !== void 0 ? (e = this.__overrideConsent, e) : (this.__consentPlugin && (e = this.__consentPlugin.hasConsent()), e);
719
+ let t = !0;
720
+ return this.__overrideConsent !== void 0 ? (t = this.__overrideConsent, t) : (this.__consentPlugin && (t = this.__consentPlugin.hasConsent()), t);
645
721
  }
646
722
  /**
647
723
  * Send an Event to all plugins
648
724
  *
649
725
  * @param eventData
650
726
  */
651
- sendEvent(e) {
652
- this[c].forEach((t) => {
653
- t.sendEvent(e, this.__hasConsent());
727
+ sendEvent(t) {
728
+ this[c].forEach((e) => {
729
+ e.sendEvent(t, this.__hasConsent());
654
730
  });
655
731
  }
656
732
  /**
@@ -659,36 +735,37 @@ class X {
659
735
  * @param consentIdentifier
660
736
  * @private
661
737
  */
662
- buildConsentPlugin(e, t) {
663
- return e.toLowerCase() === E.OneTrust.toLowerCase() ? new w(t) : null;
738
+ buildConsentPlugin(t, e) {
739
+ return t.toLowerCase() === E.OneTrust.toLowerCase() ? new N(e) : null;
664
740
  }
665
741
  }
666
742
  export {
667
743
  E as ConsentPluginNames,
668
- R as EpigraphAddToFavouritesEvent,
669
- X as EpigraphAnalytics,
670
- L as EpigraphArRequestedEvent,
671
- b as EpigraphButtonClickEvent,
744
+ O as EpigraphAddToFavouritesEvent,
745
+ K as EpigraphAnalytics,
746
+ C as EpigraphArRequestedEvent,
747
+ q as EpigraphButtonClickEvent,
672
748
  V as EpigraphChangeRateEvent,
673
- z as EpigraphCheckoutEvent,
674
- F as EpigraphCompletionRateEvent,
675
- $ as EpigraphContentSharedEvent,
676
- J as EpigraphConversionEvent,
749
+ F as EpigraphCheckoutEvent,
750
+ J as EpigraphCompletionRateEvent,
751
+ j as EpigraphContentSharedEvent,
752
+ B as EpigraphConversionEvent,
753
+ X as EpigraphCustomEvent,
677
754
  H as EpigraphEngagementRateEvent,
678
- j as EpigraphItemAddedEvent,
679
- U as EpigraphItemMovedEvent,
680
- B as EpigraphItemRemovedEvent,
681
- G as EpigraphKeyboardInteractionEvent,
682
- q as EpigraphModuleClosedEvent,
683
- I as EpigraphModuleFailedEvent,
684
- A as EpigraphModuleLoadingEvent,
685
- x as EpigraphModuleReadyEvent,
686
- D as EpigraphPanelClosedEvent,
687
- O as EpigraphPanelOpenedEvent,
688
- T as EpigraphSupportDetectedEvent,
689
- k as EpigraphTouchInteractionEvent,
690
- M as EpigraphVariantChangedEvent,
691
- N as GA4AnalyticsPlugin,
692
- S as NexusAnalyticsPlugin,
693
- w as OneTrustConsentPlugin
755
+ M as EpigraphItemAddedEvent,
756
+ $ as EpigraphItemMovedEvent,
757
+ k as EpigraphItemRemovedEvent,
758
+ b as EpigraphKeyboardInteractionEvent,
759
+ T as EpigraphModuleClosedEvent,
760
+ x as EpigraphModuleFailedEvent,
761
+ L as EpigraphModuleLoadingEvent,
762
+ S as EpigraphModuleReadyEvent,
763
+ G as EpigraphPanelClosedEvent,
764
+ D as EpigraphPanelOpenedEvent,
765
+ z as EpigraphSupportDetectedEvent,
766
+ R as EpigraphTouchInteractionEvent,
767
+ U as EpigraphVariantChangedEvent,
768
+ P as GA4AnalyticsPlugin,
769
+ I as NexusAnalyticsPlugin,
770
+ N as OneTrustConsentPlugin
694
771
  };