@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.
- package/README.md +68 -68
- package/dist/EpigraphLibs/EpigraphAnalytics/analytics-event-interface.d.ts +3 -3
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +2 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +336 -259
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalyticsEventLibrary.d.ts +26 -35
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +19 -5
- package/dist/epigraph-std-lib.cjs +1 -1
- package/dist/epigraph-std-lib.js +43 -42
- package/package.json +41 -41
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
var
|
|
2
|
-
const
|
|
3
|
-
constructor(
|
|
4
|
-
this[
|
|
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[
|
|
7
|
+
return this[p];
|
|
8
8
|
}
|
|
9
|
-
set next(
|
|
10
|
-
if (!(
|
|
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] =
|
|
14
|
+
this[d] = t;
|
|
15
15
|
}
|
|
16
16
|
get next() {
|
|
17
17
|
return this[d];
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
let g =
|
|
21
|
-
const
|
|
22
|
-
class
|
|
20
|
+
let g = w;
|
|
21
|
+
const l = Symbol("head");
|
|
22
|
+
class A {
|
|
23
23
|
constructor() {
|
|
24
|
-
this[
|
|
24
|
+
this[l] = null;
|
|
25
25
|
}
|
|
26
|
-
set head(
|
|
27
|
-
this[
|
|
26
|
+
set head(t) {
|
|
27
|
+
this[l] = t;
|
|
28
28
|
}
|
|
29
29
|
get head() {
|
|
30
|
-
return this[
|
|
30
|
+
return this[l];
|
|
31
31
|
}
|
|
32
|
-
addToTail(
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
for (;
|
|
36
|
-
|
|
37
|
-
return
|
|
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(
|
|
39
|
+
return this.head = new g(t);
|
|
40
40
|
}
|
|
41
41
|
removeHead() {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
return this.head =
|
|
42
|
+
const t = this.head;
|
|
43
|
+
if (t)
|
|
44
|
+
return this.head = t.next, t.data;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
class
|
|
47
|
+
const _ = Symbol("queue"), h = Symbol("size");
|
|
48
|
+
class v {
|
|
49
49
|
constructor() {
|
|
50
|
-
this[
|
|
50
|
+
this[_] = new A(), this[h] = 0;
|
|
51
51
|
}
|
|
52
52
|
get queue() {
|
|
53
|
-
return this[
|
|
53
|
+
return this[_];
|
|
54
54
|
}
|
|
55
55
|
get size() {
|
|
56
56
|
return this[h];
|
|
57
57
|
}
|
|
58
|
-
enqueue(
|
|
59
|
-
this.queue.addToTail(
|
|
58
|
+
enqueue(t) {
|
|
59
|
+
this.queue.addToTail(t), this[h]++;
|
|
60
60
|
}
|
|
61
61
|
dequeue() {
|
|
62
|
-
const
|
|
63
|
-
return this[h]--,
|
|
62
|
+
const t = this.queue.removeHead();
|
|
63
|
+
return this[h]--, t;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
class
|
|
66
|
+
class P {
|
|
67
67
|
constructor({
|
|
68
|
-
trackingID:
|
|
69
|
-
experienceID:
|
|
68
|
+
trackingID: t,
|
|
69
|
+
experienceID: e,
|
|
70
70
|
solution: n,
|
|
71
|
-
verboseLogging:
|
|
71
|
+
verboseLogging: s = !1
|
|
72
72
|
}) {
|
|
73
|
-
this.__status =
|
|
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(
|
|
79
|
-
this.__status =
|
|
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
|
|
103
|
+
* @param consent boolean Whether consent is granted
|
|
104
104
|
*/
|
|
105
|
-
async sendEvent(
|
|
106
|
-
if (this.__queue.enqueue(
|
|
107
|
-
this.__status =
|
|
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.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.logger(
|
|
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
|
-
|
|
120
|
-
if (this.
|
|
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
|
-
|
|
125
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
|
|
143
|
-
|
|
209
|
+
s = {
|
|
210
|
+
epg_event_tag: await this.sendGA4LongParameters(s)
|
|
211
|
+
};
|
|
144
212
|
} catch {
|
|
145
213
|
}
|
|
146
|
-
|
|
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(
|
|
154
|
-
this.verboseLogging && console.warn(
|
|
225
|
+
logger(t) {
|
|
226
|
+
this.verboseLogging && console.warn(t);
|
|
155
227
|
}
|
|
156
|
-
async sendGA4LongParameters(
|
|
157
|
-
const
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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:
|
|
187
|
-
id:
|
|
188
|
-
l:
|
|
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
|
|
285
|
+
class I {
|
|
196
286
|
constructor({
|
|
197
|
-
trackingID:
|
|
198
|
-
experienceID:
|
|
287
|
+
trackingID: t,
|
|
288
|
+
experienceID: e,
|
|
199
289
|
solution: n,
|
|
200
|
-
sessionId:
|
|
201
|
-
xPath:
|
|
202
|
-
verboseLogging:
|
|
290
|
+
sessionId: s,
|
|
291
|
+
xPath: r,
|
|
292
|
+
verboseLogging: o = !1,
|
|
203
293
|
sendToStaging: y = !1
|
|
204
294
|
}) {
|
|
205
|
-
this.__status =
|
|
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(
|
|
211
|
-
this.__status =
|
|
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(
|
|
228
|
-
if (this.__queue.enqueue(
|
|
229
|
-
this.__status =
|
|
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
|
|
236
|
-
const
|
|
237
|
-
|
|
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:
|
|
242
|
-
parameters:
|
|
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
|
|
266
|
-
constructor(
|
|
267
|
-
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier =
|
|
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
|
|
277
|
-
|
|
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__ */ ((
|
|
381
|
+
var E = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(E || {});
|
|
292
382
|
class a {
|
|
293
383
|
constructor({
|
|
294
|
-
eventName:
|
|
295
|
-
interactiveEvent:
|
|
384
|
+
eventName: t,
|
|
385
|
+
interactiveEvent: e,
|
|
296
386
|
customParameters: n
|
|
297
387
|
}) {
|
|
298
|
-
this.eventName =
|
|
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
|
-
|
|
314
|
-
let
|
|
315
|
-
interactive_event: this.interactiveEvent
|
|
316
|
-
items: []
|
|
390
|
+
getParameters() {
|
|
391
|
+
let t = {
|
|
392
|
+
interactive_event: this.interactiveEvent
|
|
317
393
|
};
|
|
318
|
-
return
|
|
394
|
+
return t = Object.assign(t, JSON.parse(JSON.stringify(this.customParameters))), t;
|
|
319
395
|
}
|
|
320
396
|
}
|
|
321
|
-
class
|
|
322
|
-
constructor(
|
|
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:
|
|
403
|
+
items: t
|
|
328
404
|
}
|
|
329
405
|
});
|
|
330
406
|
}
|
|
331
407
|
}
|
|
332
|
-
class
|
|
333
|
-
constructor(
|
|
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
|
|
345
|
-
constructor(
|
|
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:
|
|
426
|
+
load_time_ms: e
|
|
353
427
|
}
|
|
354
428
|
});
|
|
355
429
|
}
|
|
356
430
|
}
|
|
357
|
-
class
|
|
358
|
-
constructor(
|
|
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:
|
|
366
|
-
error_type:
|
|
438
|
+
load_time_ms: e,
|
|
439
|
+
error_type: n
|
|
367
440
|
}
|
|
368
441
|
});
|
|
369
442
|
}
|
|
370
443
|
}
|
|
371
|
-
class
|
|
372
|
-
constructor(
|
|
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:
|
|
450
|
+
items: t
|
|
378
451
|
}
|
|
379
452
|
});
|
|
380
453
|
}
|
|
381
454
|
}
|
|
382
|
-
class
|
|
383
|
-
constructor(
|
|
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:
|
|
462
|
+
device_capabilities: e
|
|
391
463
|
}
|
|
392
464
|
});
|
|
393
465
|
}
|
|
394
466
|
}
|
|
395
|
-
class
|
|
396
|
-
constructor(
|
|
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:
|
|
474
|
+
button_name: e
|
|
404
475
|
}
|
|
405
476
|
});
|
|
406
477
|
}
|
|
407
478
|
}
|
|
408
|
-
class
|
|
409
|
-
constructor(
|
|
479
|
+
class D extends a {
|
|
480
|
+
constructor(t = [], e, n, s) {
|
|
410
481
|
super({
|
|
411
482
|
eventName: "epigraph_panel_opened",
|
|
412
|
-
interactiveEvent:
|
|
483
|
+
interactiveEvent: e,
|
|
413
484
|
customParameters: {
|
|
414
|
-
items:
|
|
485
|
+
items: t,
|
|
415
486
|
panel_type: n,
|
|
416
|
-
trigger_source:
|
|
487
|
+
trigger_source: s
|
|
417
488
|
}
|
|
418
489
|
});
|
|
419
490
|
}
|
|
420
491
|
}
|
|
421
|
-
class
|
|
422
|
-
constructor(
|
|
492
|
+
class G extends a {
|
|
493
|
+
constructor(t = [], e, n, s) {
|
|
423
494
|
super({
|
|
424
495
|
eventName: "epigraph_panel_closed",
|
|
425
|
-
interactiveEvent:
|
|
496
|
+
interactiveEvent: e,
|
|
426
497
|
customParameters: {
|
|
427
|
-
items:
|
|
498
|
+
items: t,
|
|
428
499
|
panel_type: n,
|
|
429
|
-
trigger_source:
|
|
500
|
+
trigger_source: s
|
|
430
501
|
}
|
|
431
502
|
});
|
|
432
503
|
}
|
|
433
504
|
}
|
|
434
|
-
class
|
|
435
|
-
constructor(
|
|
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:
|
|
511
|
+
items: t
|
|
441
512
|
}
|
|
442
513
|
});
|
|
443
514
|
}
|
|
444
515
|
}
|
|
445
|
-
class
|
|
446
|
-
constructor(
|
|
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
|
|
458
|
-
constructor(
|
|
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
|
|
470
|
-
constructor(
|
|
538
|
+
class M extends a {
|
|
539
|
+
constructor(t = [], e, n, s, r) {
|
|
471
540
|
super({
|
|
472
541
|
eventName: "epigraph_item_added",
|
|
473
|
-
interactiveEvent:
|
|
542
|
+
interactiveEvent: e,
|
|
474
543
|
customParameters: {
|
|
475
|
-
items:
|
|
544
|
+
items: t,
|
|
476
545
|
value: n,
|
|
477
|
-
currency:
|
|
478
|
-
quantity:
|
|
546
|
+
currency: s,
|
|
547
|
+
quantity: r
|
|
479
548
|
}
|
|
480
549
|
});
|
|
481
550
|
}
|
|
482
551
|
}
|
|
483
|
-
class
|
|
484
|
-
constructor(
|
|
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:
|
|
558
|
+
items: t
|
|
490
559
|
}
|
|
491
560
|
});
|
|
492
561
|
}
|
|
493
562
|
}
|
|
494
|
-
class
|
|
495
|
-
constructor(e,
|
|
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:
|
|
501
|
-
|
|
502
|
-
|
|
569
|
+
items: t,
|
|
570
|
+
value: e,
|
|
571
|
+
currency: n,
|
|
572
|
+
quantity: s
|
|
503
573
|
}
|
|
504
574
|
});
|
|
505
575
|
}
|
|
506
576
|
}
|
|
507
|
-
class
|
|
508
|
-
constructor(
|
|
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:
|
|
514
|
-
change_type:
|
|
583
|
+
items: t,
|
|
584
|
+
change_type: e
|
|
515
585
|
}
|
|
516
586
|
});
|
|
517
587
|
}
|
|
518
588
|
}
|
|
519
|
-
class
|
|
520
|
-
constructor(
|
|
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:
|
|
526
|
-
content_type:
|
|
595
|
+
items: t,
|
|
596
|
+
content_type: e,
|
|
527
597
|
share_destination: n
|
|
528
598
|
}
|
|
529
599
|
});
|
|
530
600
|
}
|
|
531
601
|
}
|
|
532
|
-
class
|
|
533
|
-
constructor(
|
|
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:
|
|
539
|
-
value:
|
|
608
|
+
items: t,
|
|
609
|
+
value: e,
|
|
540
610
|
currency: n
|
|
541
611
|
}
|
|
542
612
|
});
|
|
543
613
|
}
|
|
544
614
|
}
|
|
545
|
-
class
|
|
546
|
-
constructor(
|
|
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:
|
|
552
|
-
value:
|
|
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(
|
|
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
|
|
571
|
-
constructor(
|
|
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(
|
|
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
|
|
614
|
-
constructor(
|
|
615
|
-
this[f] = /* @__PURE__ */ new Map(), this.__consentPlugin = null,
|
|
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(
|
|
618
|
-
let
|
|
619
|
-
this.__overrideConsent =
|
|
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(
|
|
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(
|
|
631
|
-
this[c].has(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
),
|
|
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
|
|
644
|
-
return this.__overrideConsent !== void 0 ? (
|
|
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(
|
|
652
|
-
this[c].forEach((
|
|
653
|
-
|
|
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(
|
|
663
|
-
return
|
|
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
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
744
|
+
O as EpigraphAddToFavouritesEvent,
|
|
745
|
+
K as EpigraphAnalytics,
|
|
746
|
+
C as EpigraphArRequestedEvent,
|
|
747
|
+
q as EpigraphButtonClickEvent,
|
|
672
748
|
V as EpigraphChangeRateEvent,
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
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
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
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
|
};
|