@epigraph/epigraph-std-lib 4.6.0 → 4.7.1-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/dist/EpigraphLibs/EpigraphAnalytics/analytics-event-interface.d.ts +14 -7
- package/dist/EpigraphLibs/EpigraphAnalytics/analytics-plugin-interface.d.ts +15 -4
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +2 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts +14 -7
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +762 -226
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalyticsEventLibrary.d.ts +170 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/generics/epigraph-notifier.d.ts +17 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/generics/queue.d.ts +3 -3
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +82 -18
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.d.ts +24 -7
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.d.ts +2 -1
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +1 -1
- package/dist/epigraph-std-lib.cjs +1 -1
- package/dist/epigraph-std-lib.js +67 -38
- package/package.json +1 -1
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga3-analytics-plugin.d.ts +0 -44
|
@@ -1,282 +1,433 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var c = /* @__PURE__ */ ((i) => (i.UNAVAILABLE = "unavailable", i.AVAILABLE = "available", i.RESTRICTED = "restricted", i))(c || {});
|
|
2
|
+
const m = Symbol("data"), _ = Symbol("next"), L = class I {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
this[m] = t, this[_] = null;
|
|
4
5
|
}
|
|
5
6
|
get data() {
|
|
6
|
-
return this[
|
|
7
|
+
return this[m];
|
|
7
8
|
}
|
|
8
|
-
set next(
|
|
9
|
-
if (!(
|
|
9
|
+
set next(t) {
|
|
10
|
+
if (!(t instanceof I) && t !== null)
|
|
10
11
|
throw new Error(
|
|
11
12
|
"This node is not an instance of the custom class 'Node'."
|
|
12
13
|
);
|
|
13
|
-
this[
|
|
14
|
+
this[_] = t;
|
|
14
15
|
}
|
|
15
16
|
get next() {
|
|
16
|
-
return this[
|
|
17
|
+
return this[_];
|
|
17
18
|
}
|
|
18
19
|
};
|
|
19
|
-
let
|
|
20
|
-
const
|
|
21
|
-
class
|
|
20
|
+
let E = L;
|
|
21
|
+
const p = Symbol("head");
|
|
22
|
+
class D {
|
|
22
23
|
constructor() {
|
|
23
|
-
this[
|
|
24
|
+
this[p] = null;
|
|
24
25
|
}
|
|
25
|
-
set head(
|
|
26
|
-
this[
|
|
26
|
+
set head(t) {
|
|
27
|
+
this[p] = t;
|
|
27
28
|
}
|
|
28
29
|
get head() {
|
|
29
|
-
return this[
|
|
30
|
-
}
|
|
31
|
-
addToTail(
|
|
32
|
-
let
|
|
33
|
-
if (
|
|
34
|
-
for (;
|
|
35
|
-
|
|
36
|
-
return
|
|
30
|
+
return this[p];
|
|
31
|
+
}
|
|
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 E(t);
|
|
37
38
|
}
|
|
38
|
-
return this.head = new
|
|
39
|
+
return this.head = new E(t);
|
|
39
40
|
}
|
|
40
41
|
removeHead() {
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
return this.head =
|
|
42
|
+
const t = this.head;
|
|
43
|
+
if (t)
|
|
44
|
+
return this.head = t.next, t.data;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
const f = Symbol("queue"),
|
|
47
|
-
class
|
|
47
|
+
const f = Symbol("queue"), d = Symbol("size");
|
|
48
|
+
class N {
|
|
48
49
|
constructor() {
|
|
49
|
-
this[f] = new
|
|
50
|
+
this[f] = new D(), this[d] = 0;
|
|
50
51
|
}
|
|
51
52
|
get queue() {
|
|
52
53
|
return this[f];
|
|
53
54
|
}
|
|
54
55
|
get size() {
|
|
55
|
-
return this[
|
|
56
|
+
return this[d];
|
|
56
57
|
}
|
|
57
|
-
enqueue(
|
|
58
|
-
this.queue.addToTail(
|
|
58
|
+
enqueue(t) {
|
|
59
|
+
this.queue.addToTail(t), this[d]++;
|
|
59
60
|
}
|
|
60
61
|
dequeue() {
|
|
61
|
-
const
|
|
62
|
-
return this[
|
|
62
|
+
const t = this.queue.removeHead();
|
|
63
|
+
return this[d]--, t;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
class u {
|
|
67
|
+
static {
|
|
68
|
+
this.NOTIFICATION_NAME = "epg-notification";
|
|
69
|
+
}
|
|
70
|
+
static {
|
|
71
|
+
this.ACTION_SEND_EVENT = "send-event";
|
|
72
|
+
}
|
|
73
|
+
static {
|
|
74
|
+
this.ACTION_INITIALIZED = "initialized";
|
|
75
|
+
}
|
|
76
|
+
static {
|
|
77
|
+
this.ACTION_FAILED_INITIALIZATION = "initialization-failed";
|
|
78
|
+
}
|
|
79
|
+
constructor(t, e, s, n, r, o) {
|
|
80
|
+
this._pluginName = t, this._trackingId = e, this._experienceId = s, this._solution = n, this._initializer = r, this._status = o;
|
|
81
|
+
}
|
|
82
|
+
updateStatus(t) {
|
|
83
|
+
this._status = t;
|
|
84
|
+
}
|
|
85
|
+
updateInitializer(t) {
|
|
86
|
+
this._initializer = t;
|
|
87
|
+
}
|
|
88
|
+
notify(t, e) {
|
|
89
|
+
console.log("Notifying", t, e);
|
|
90
|
+
const s = {
|
|
91
|
+
pluginName: this._pluginName,
|
|
92
|
+
trackingId: this._trackingId,
|
|
93
|
+
experienceId: this._experienceId,
|
|
94
|
+
solution: this._solution,
|
|
95
|
+
initializer: this._initializer,
|
|
96
|
+
status: this._status,
|
|
97
|
+
action: t,
|
|
98
|
+
eventDetails: e
|
|
99
|
+
};
|
|
100
|
+
window.dispatchEvent(new CustomEvent("epg-notification", { detail: s }));
|
|
63
101
|
}
|
|
64
102
|
}
|
|
65
|
-
class
|
|
66
|
-
constructor(
|
|
67
|
-
|
|
103
|
+
class z {
|
|
104
|
+
constructor({
|
|
105
|
+
trackingID: t,
|
|
106
|
+
experienceID: e,
|
|
107
|
+
solution: s,
|
|
108
|
+
verboseLogging: n = !1
|
|
109
|
+
}) {
|
|
110
|
+
this.__status = c.UNAVAILABLE, this.__sentEventCount = 0, this.__initializationAttempts = 0, this.__lastInitializationAttempt = performance.now(), 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 = s, this.verboseLogging = n, this.__queue = new N(), this.__epigraphNotifier = new u(
|
|
111
|
+
this.pluginName,
|
|
112
|
+
this.pluginName,
|
|
113
|
+
this.experienceID,
|
|
114
|
+
this.solution,
|
|
115
|
+
this.__initializationMethod,
|
|
116
|
+
this.__status
|
|
117
|
+
), this.initializePlugin();
|
|
118
|
+
}
|
|
119
|
+
getStatus() {
|
|
120
|
+
return this.__status;
|
|
121
|
+
}
|
|
122
|
+
setStatus(t) {
|
|
123
|
+
this.__status = t, this.__epigraphNotifier.updateStatus(t);
|
|
124
|
+
}
|
|
125
|
+
getPendingEventCount() {
|
|
126
|
+
return this.__queue.size;
|
|
127
|
+
}
|
|
128
|
+
getSentEventCount() {
|
|
129
|
+
return this.__sentEventCount;
|
|
130
|
+
}
|
|
131
|
+
getTotalEventCount() {
|
|
132
|
+
return this.getPendingEventCount() + this.getSentEventCount();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
136
|
+
*/
|
|
137
|
+
getUniquePluginIdentifier() {
|
|
138
|
+
return `${this.name}-${this.trackingID}`;
|
|
139
|
+
}
|
|
140
|
+
setupPlugin() {
|
|
141
|
+
this.__isInitialized && this.dataLayer !== void 0 && this.dequeueAndSendEvents();
|
|
68
142
|
}
|
|
69
143
|
/**
|
|
70
|
-
* This function will send an Event to
|
|
144
|
+
* This function will send an Event to Google Analytics 4.
|
|
71
145
|
*
|
|
72
|
-
* @param
|
|
146
|
+
* @param analyticsEvent
|
|
147
|
+
* @param consent boolean Whether consent is granted
|
|
73
148
|
*/
|
|
74
|
-
sendEvent(e) {
|
|
75
|
-
if (this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
149
|
+
async sendEvent(t, e) {
|
|
150
|
+
if (this.__queue.enqueue(t), !e) {
|
|
151
|
+
this.__status = c.RESTRICTED;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (!this.__isInitialized) {
|
|
155
|
+
this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
await this.dequeueAndSendEvents();
|
|
160
|
+
} catch (s) {
|
|
161
|
+
this.logger(s), await this.reportFailureToNexus("EVENT_SEND_ERROR", s?.toString() || "Unknown error");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
initializePlugin() {
|
|
165
|
+
if (this.__isInitialized)
|
|
166
|
+
return;
|
|
167
|
+
if (this.__initializationAttempts >= this.__maxInitializationAttempts) {
|
|
168
|
+
this.__nexusFailureReported || (this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS", "Maximum initialization attempts reached"), this.__nexusFailureReported = !0, this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION, {}));
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const t = performance.now();
|
|
172
|
+
if (this.__initializationAttempts > 0 && t - this.__lastInitializationAttempt < this.__initializationRetryDelay)
|
|
173
|
+
return;
|
|
174
|
+
this.__lastInitializationAttempt = t, this.__initializationAttempts++;
|
|
175
|
+
const e = this.detectAndSetupAnalytics();
|
|
176
|
+
e.success ? (this.__isInitialized = !0, this.__status = c.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.__epigraphNotifier.notify(u.ACTION_INITIALIZED, {}), this.__queue.size > 0 && this.dequeueAndSendEvents()) : (this.logger(`Initialization attempt ${this.__initializationAttempts} failed: ${e.error}`), this.__initializationAttempts < this.__maxInitializationAttempts && setTimeout(() => {
|
|
177
|
+
this.initializePlugin();
|
|
178
|
+
}, this.__initializationRetryDelay));
|
|
179
|
+
}
|
|
180
|
+
detectAndSetupAnalytics() {
|
|
181
|
+
const t = this.detectGTM();
|
|
182
|
+
if (t)
|
|
183
|
+
return this.logger(`GTM detected with container ID: ${t.containerId}`), this.__epigraphNotifier.updateInitializer("GTM"), {
|
|
184
|
+
success: !0,
|
|
185
|
+
method: "GTM",
|
|
186
|
+
dataLayerName: t.dataLayerName
|
|
187
|
+
};
|
|
188
|
+
const e = this.findGA4Info(this.trackingID);
|
|
189
|
+
if (e) {
|
|
190
|
+
const s = e.l || "dataLayer";
|
|
191
|
+
return this.logger(`GA4 script found, setting up with dataLayer: ${s}`), this.__epigraphNotifier.updateInitializer("GA4"), {
|
|
192
|
+
success: !0,
|
|
193
|
+
method: "GA4",
|
|
194
|
+
dataLayerName: s
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
success: !1,
|
|
199
|
+
method: "NONE",
|
|
200
|
+
dataLayerName: "dataLayer",
|
|
201
|
+
error: "No analytics setup found and unable to create one"
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
detectGTM() {
|
|
205
|
+
const t = document.querySelectorAll('script[src*="googletagmanager.com/gtm"]');
|
|
206
|
+
for (const e of Array.from(t)) {
|
|
207
|
+
const s = e.getAttribute("src");
|
|
208
|
+
if (s) {
|
|
209
|
+
const n = s.match(/gtm\.js\?id=([^&]+)/);
|
|
210
|
+
if (n && n.length > 0) {
|
|
211
|
+
const r = s.match(/&l=([^&]+)/), o = r ? r[1] : "dataLayer";
|
|
212
|
+
return {
|
|
213
|
+
containerId: n[1],
|
|
214
|
+
dataLayerName: o
|
|
215
|
+
};
|
|
216
|
+
}
|
|
80
217
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return !0;
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
84
220
|
}
|
|
85
221
|
/**
|
|
86
222
|
* Send all events that are in the queue
|
|
87
223
|
* @private
|
|
88
224
|
*/
|
|
89
|
-
dequeueAndSendEvents() {
|
|
90
|
-
if (this.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
n.label,
|
|
100
|
-
n.interaction
|
|
101
|
-
), this.logger(`Google Analytics 3 event successfully sent: ${n.action}`);
|
|
225
|
+
async dequeueAndSendEvents() {
|
|
226
|
+
if (!this.__isInitialized || !this.dataLayer)
|
|
227
|
+
return;
|
|
228
|
+
let t = this.__queue.size;
|
|
229
|
+
for (let e = 0; e < t; e++) {
|
|
230
|
+
const s = this.__queue.dequeue();
|
|
231
|
+
try {
|
|
232
|
+
this.__initializationMethod === "GTM" ? (this.sendGTMEvent(s), this.__sentEventCount++, this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${s.eventName}`)) : this.__initializationMethod === "GA4" ? (this.sendGA4Event(s), this.__sentEventCount++, this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${s.eventName}`)) : this.__queue.enqueue(s);
|
|
233
|
+
} catch (n) {
|
|
234
|
+
this.logger(`Error sending event ${s.eventName}: ${n}`), this.__queue.enqueue(s);
|
|
102
235
|
}
|
|
103
|
-
}
|
|
104
|
-
this.logger("Cannot sent Google Analytics 3 event: tracker was not created.");
|
|
236
|
+
}
|
|
105
237
|
}
|
|
106
238
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* time. This is due to the events that are added will be queued from the page. This script requires
|
|
110
|
-
* that the GA script has been imported on the page already as it does not check for it today.
|
|
111
|
-
*
|
|
239
|
+
* Send events to GTM based GA4
|
|
240
|
+
* @param event
|
|
112
241
|
* @private
|
|
113
242
|
*/
|
|
114
|
-
async
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
userId: this.user
|
|
119
|
-
});
|
|
120
|
-
const e = new URL(window.location.href);
|
|
121
|
-
ga(`${this.trackerName}.set`, "page", e.pathname), ga(`${this.trackerName}.set`, "location", e.href), this.trackerCreated = !0, this.logger("Google Analytics 3 tracker successfully created."), this.dequeueAndSendEvents(), window.clearInterval(this.trackerInterval);
|
|
122
|
-
} catch (e) {
|
|
123
|
-
this.logger(e);
|
|
124
|
-
}
|
|
125
|
-
else
|
|
126
|
-
this.logger("Error: Cannot create tracker, ga function is not defined.");
|
|
243
|
+
async sendGTMEvent(t) {
|
|
244
|
+
let e = t.getGTMParameters(this.solution, this.experienceID, this.trackingID);
|
|
245
|
+
const s = e;
|
|
246
|
+
this.isValidPayload(e) || (e = await this.convertGTMParametersToEpgEventTag(t.eventName, e)), this.dataLayer && (this.dataLayer.push(e), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, s));
|
|
127
247
|
}
|
|
128
248
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @param
|
|
249
|
+
* Send events to GA4 via Google Analytics 4.
|
|
250
|
+
* @param event
|
|
251
|
+
* @private
|
|
131
252
|
*/
|
|
132
|
-
|
|
133
|
-
this.
|
|
253
|
+
async sendGA4Event(t) {
|
|
254
|
+
let e = t.getGa4Parameters(this.solution, this.experienceID, this.trackingID);
|
|
255
|
+
const s = e;
|
|
256
|
+
this.isValidPayload(e) || (e = await this.convertGA4ParametersToEpgEventTag(e)), window.gtag("event", t.eventName, e), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, s);
|
|
134
257
|
}
|
|
135
258
|
/**
|
|
136
|
-
*
|
|
259
|
+
* Validates a payload by checking its parameter count and the constraints of parameter names and values.
|
|
260
|
+
* See docs here for requirements: https://support.google.com/analytics/answer/9267744?hl=en
|
|
261
|
+
*
|
|
262
|
+
* @param {Record<string, unknown>} parameterPayload - An object containing the parameters to validate.
|
|
263
|
+
* The keys represent parameter names and the values represent parameter values.
|
|
264
|
+
* @return {boolean} Returns true if the payload meets the validation criteria; false otherwise.
|
|
137
265
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}, 1e3);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
class I {
|
|
149
|
-
constructor(e, t) {
|
|
150
|
-
this.name = this.pluginName = "GA4-PLUGIN", this.trackingID = e, this.verboseLogging = t, this.queue = new l(), this.dataLayer = window.dataLayer, this.dataLayerName = "dataLayer", this.setupDataLayer(), this.initGtag(this.dataLayerName, this.trackingID);
|
|
151
|
-
}
|
|
152
|
-
setupDataLayer() {
|
|
153
|
-
if (this.dataLayer) return;
|
|
154
|
-
const t = this.findGA4ScriptInfo(this.trackingID)?.l;
|
|
155
|
-
t && (this.dataLayerName = t, this.dataLayer = window[t]);
|
|
156
|
-
}
|
|
157
|
-
initGtag(e = "dataLayer", t) {
|
|
158
|
-
window.epgDataLayerName = e, typeof window.gtag != "function" && (window.gtag = function() {
|
|
159
|
-
window[window.epgDataLayerName].push(arguments);
|
|
160
|
-
}, window.gtag("js", /* @__PURE__ */ new Date()), window.gtag("config", t, { send_page_view: !1 }));
|
|
266
|
+
isValidPayload(t) {
|
|
267
|
+
if (Object.keys(t).length >= 25)
|
|
268
|
+
return !1;
|
|
269
|
+
for (const [n, r] of Object.entries(t))
|
|
270
|
+
if (n !== "items" && (n.length > 40 || String(r).length > 100))
|
|
271
|
+
return !1;
|
|
272
|
+
return !0;
|
|
161
273
|
}
|
|
162
274
|
/**
|
|
163
|
-
*
|
|
275
|
+
* Converts the given GTM parameters to an EPG event tag, sending specific parameter payloads
|
|
276
|
+
* for processing and returning the formatted result. Falls back to the original payload in case of errors.
|
|
164
277
|
*
|
|
165
|
-
* @param
|
|
166
|
-
* @param
|
|
278
|
+
* @param {string} eventName - The event name associated with the EPG event tag being processed.
|
|
279
|
+
* @param {Record<string, unknown>} parameterPayload - A key-value pair object containing the parameters to be converted.
|
|
280
|
+
* @return {Promise<Record<string, unknown>>} A promise that resolves to an object containing the event name and the generated EPG event tag, or the original payload upon failure.
|
|
167
281
|
*/
|
|
168
|
-
async
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
282
|
+
async convertGTMParametersToEpgEventTag(t, e) {
|
|
283
|
+
try {
|
|
284
|
+
let s = await this.sendGA4LongParameters(e);
|
|
285
|
+
return {
|
|
286
|
+
event: t,
|
|
287
|
+
epg_event_tag: s,
|
|
288
|
+
send_to: this.trackingID
|
|
289
|
+
};
|
|
290
|
+
} catch {
|
|
291
|
+
return e;
|
|
292
|
+
}
|
|
179
293
|
}
|
|
180
294
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
295
|
+
* Converts GA4 parameters into an EPG event tag.
|
|
296
|
+
*
|
|
297
|
+
* @param {Record<string, unknown>} parameterPayload - The GA4 parameters to be converted.
|
|
298
|
+
* @return {Promise<Record<string, any>>} A promise resolving to an object containing the EPG event tag or the original payload if the conversion fails.
|
|
183
299
|
*/
|
|
184
|
-
async
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
send_to: this.trackingID,
|
|
190
|
-
event_action: n.action,
|
|
191
|
-
event_category: n.category,
|
|
192
|
-
event_label: n.label,
|
|
193
|
-
epg_event_tag: ""
|
|
300
|
+
async convertGA4ParametersToEpgEventTag(t) {
|
|
301
|
+
try {
|
|
302
|
+
return {
|
|
303
|
+
epg_event_tag: await this.sendGA4LongParameters(t),
|
|
304
|
+
send_to: this.trackingID
|
|
194
305
|
};
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
let r = await this.sendGA4LongParameters(s);
|
|
198
|
-
s = {
|
|
199
|
-
send_to: this.trackingID,
|
|
200
|
-
event_action: n.action,
|
|
201
|
-
event_category: n.category,
|
|
202
|
-
event_label: n.label,
|
|
203
|
-
epg_event_tag: r
|
|
204
|
-
};
|
|
205
|
-
} catch {
|
|
206
|
-
}
|
|
207
|
-
gtag("event", n.action, s), this.logger(`Google Analytics 4 event successfully sent: ${n.action}`);
|
|
306
|
+
} catch {
|
|
307
|
+
return t;
|
|
208
308
|
}
|
|
209
309
|
}
|
|
210
310
|
/**
|
|
211
311
|
* Checks if verboseLogging is enabled, then logs the error
|
|
212
312
|
* @param err
|
|
213
313
|
*/
|
|
214
|
-
logger(
|
|
215
|
-
this.verboseLogging && console.warn(
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
219
|
-
*/
|
|
220
|
-
getUniquePluginIdentifier() {
|
|
221
|
-
return this.name + "-" + this.trackingID;
|
|
222
|
-
}
|
|
223
|
-
setupPlugin() {
|
|
224
|
-
this.dataLayer !== void 0 && this.dequeueAndSendEvents();
|
|
314
|
+
logger(t) {
|
|
315
|
+
this.verboseLogging && console.warn(t);
|
|
225
316
|
}
|
|
226
|
-
async sendGA4LongParameters(
|
|
227
|
-
const
|
|
228
|
-
parameters: e
|
|
229
|
-
};
|
|
317
|
+
async sendGA4LongParameters(t) {
|
|
318
|
+
const e = "https://api.myepigraph.com/api/analytics/ga4/custom", s = { parameters: t };
|
|
230
319
|
try {
|
|
231
|
-
const
|
|
320
|
+
const n = await fetch(e, {
|
|
232
321
|
method: "POST",
|
|
233
322
|
// Assuming it's a POST request, adjust if necessary
|
|
234
323
|
headers: {
|
|
235
324
|
"Content-Type": "application/json",
|
|
236
325
|
Accept: "application/json"
|
|
237
326
|
},
|
|
238
|
-
body: JSON.stringify(
|
|
327
|
+
body: JSON.stringify(s)
|
|
239
328
|
});
|
|
240
|
-
|
|
241
|
-
const a = await s.json();
|
|
242
|
-
return a && a.id ? a.id : "";
|
|
243
|
-
} else
|
|
244
|
-
return "";
|
|
329
|
+
return n.ok ? (await n.json())?.id ?? "" : "";
|
|
245
330
|
} catch {
|
|
246
331
|
return "";
|
|
247
332
|
}
|
|
248
333
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
334
|
+
async reportFailureToNexus(t, e) {
|
|
335
|
+
try {
|
|
336
|
+
const s = {
|
|
337
|
+
plugin: "GA4",
|
|
338
|
+
trackingId: this.trackingID,
|
|
339
|
+
solution: this.solution,
|
|
340
|
+
experienceId: this.experienceID,
|
|
341
|
+
failureType: t,
|
|
342
|
+
errorMessage: e,
|
|
343
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
344
|
+
url: window.location.href,
|
|
345
|
+
userAgent: navigator.userAgent
|
|
346
|
+
};
|
|
347
|
+
this.logger(`Failure reported to Nexus: ${JSON.stringify(s)}`);
|
|
348
|
+
} catch (s) {
|
|
349
|
+
this.logger(`Error reporting failure to Nexus: ${s}`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
findGA4Info(t) {
|
|
353
|
+
if (window.google_tag_manager && window.google_tag_manager[t]) {
|
|
354
|
+
const s = window.google_tag_manager[t];
|
|
355
|
+
if (s && s.dataLayerName)
|
|
356
|
+
return {
|
|
357
|
+
fullSrc: "",
|
|
358
|
+
id: t,
|
|
359
|
+
l: s.dataLayerName
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
const e = document.querySelectorAll("script[src]");
|
|
363
|
+
for (const s of e) {
|
|
364
|
+
const n = s.getAttribute("src");
|
|
365
|
+
if (n && n.includes(t)) {
|
|
366
|
+
const r = new URL(n, location.href), o = Object.fromEntries(r.searchParams.entries());
|
|
255
367
|
return {
|
|
256
|
-
fullSrc:
|
|
257
|
-
id:
|
|
258
|
-
l:
|
|
368
|
+
fullSrc: r.href,
|
|
369
|
+
id: o.id || void 0,
|
|
370
|
+
l: o.l || void 0
|
|
259
371
|
};
|
|
260
372
|
}
|
|
261
373
|
}
|
|
262
374
|
return null;
|
|
263
375
|
}
|
|
264
376
|
}
|
|
265
|
-
class
|
|
266
|
-
constructor(
|
|
267
|
-
|
|
377
|
+
class T {
|
|
378
|
+
constructor({
|
|
379
|
+
trackingID: t,
|
|
380
|
+
experienceID: e,
|
|
381
|
+
solution: s,
|
|
382
|
+
sessionId: n,
|
|
383
|
+
xPath: r,
|
|
384
|
+
verboseLogging: o = !1,
|
|
385
|
+
sendToStaging: x = !1
|
|
386
|
+
}) {
|
|
387
|
+
this.__status = c.UNAVAILABLE, this.__sentEventCount = 0, this.sessionId = n, this.xPath = r, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = t, this.experienceID = e, this.solution = s, this.verboseLogging = o, this.__queue = new N(), this.url = x ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event", this.__status = c.AVAILABLE, this.__epigraphNotifier = new u(
|
|
388
|
+
this.pluginName,
|
|
389
|
+
this.trackingID,
|
|
390
|
+
this.experienceID,
|
|
391
|
+
this.solution,
|
|
392
|
+
"NEXUS",
|
|
393
|
+
this.__status
|
|
394
|
+
), this.__epigraphNotifier.notify(u.ACTION_INITIALIZED, {});
|
|
395
|
+
}
|
|
396
|
+
getStatus() {
|
|
397
|
+
return this.__status;
|
|
398
|
+
}
|
|
399
|
+
setStatus(t) {
|
|
400
|
+
this.__status = t, this.__epigraphNotifier.updateStatus(t);
|
|
401
|
+
}
|
|
402
|
+
getPendingEventCount() {
|
|
403
|
+
return this.__queue.size;
|
|
404
|
+
}
|
|
405
|
+
getSentEventCount() {
|
|
406
|
+
return this.__sentEventCount;
|
|
407
|
+
}
|
|
408
|
+
getTotalEventCount() {
|
|
409
|
+
return this.getPendingEventCount() + this.getSentEventCount();
|
|
410
|
+
}
|
|
411
|
+
getUniquePluginIdentifier() {
|
|
412
|
+
return this.name + "-" + this.trackingID;
|
|
413
|
+
}
|
|
414
|
+
setupPlugin() {
|
|
268
415
|
}
|
|
269
|
-
async sendEvent(
|
|
270
|
-
this.
|
|
271
|
-
|
|
272
|
-
|
|
416
|
+
async sendEvent(t, e) {
|
|
417
|
+
if (this.__queue.enqueue(t), !e) {
|
|
418
|
+
this.__status = c.RESTRICTED, this.__epigraphNotifier.updateStatus(this.__status);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
await this.dequeueAndSendEvents();
|
|
273
422
|
}
|
|
274
423
|
async dequeueAndSendEvents() {
|
|
275
|
-
for (let
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
424
|
+
for (let t = 0; t < this.__queue.size; t++) {
|
|
425
|
+
const e = this.__queue.dequeue(), s = {
|
|
426
|
+
send_to: this.trackingID,
|
|
427
|
+
experience_id: this.experienceID,
|
|
428
|
+
solution: this.solution,
|
|
429
|
+
event: e.eventName,
|
|
430
|
+
parameters: e.getNexusParameters()
|
|
280
431
|
};
|
|
281
432
|
try {
|
|
282
433
|
return (await fetch(this.url, {
|
|
@@ -289,23 +440,19 @@ class A {
|
|
|
289
440
|
"EPG-XPATH": this.xPath,
|
|
290
441
|
Origin: typeof window < "u" ? window.location.origin : ""
|
|
291
442
|
},
|
|
292
|
-
body: JSON.stringify(
|
|
293
|
-
})).
|
|
443
|
+
body: JSON.stringify(s)
|
|
444
|
+
})).ok && this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, s), "";
|
|
294
445
|
} catch {
|
|
295
446
|
return "";
|
|
296
447
|
}
|
|
448
|
+
this.__sentEventCount++;
|
|
297
449
|
}
|
|
298
450
|
return "";
|
|
299
451
|
}
|
|
300
|
-
getUniquePluginIdentifier() {
|
|
301
|
-
return this.name + "-" + this.trackingID;
|
|
302
|
-
}
|
|
303
|
-
setupPlugin() {
|
|
304
|
-
}
|
|
305
452
|
}
|
|
306
|
-
class
|
|
307
|
-
constructor(
|
|
308
|
-
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier =
|
|
453
|
+
class P {
|
|
454
|
+
constructor(t) {
|
|
455
|
+
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = t, this.consent = !1, this.addConsentChangedListener();
|
|
309
456
|
}
|
|
310
457
|
/**
|
|
311
458
|
* Checks to see if the user has consented. If this is false, it will block all analytics
|
|
@@ -314,9 +461,9 @@ class q {
|
|
|
314
461
|
if (this.consentSet)
|
|
315
462
|
return this.consent;
|
|
316
463
|
if (window.OnetrustActiveGroups !== void 0) {
|
|
317
|
-
let
|
|
318
|
-
|
|
319
|
-
|
|
464
|
+
let t = window.OnetrustActiveGroups;
|
|
465
|
+
t !== void 0 && t.split(",").forEach((s) => {
|
|
466
|
+
s === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
|
|
320
467
|
});
|
|
321
468
|
}
|
|
322
469
|
return this.consent;
|
|
@@ -329,7 +476,351 @@ class q {
|
|
|
329
476
|
});
|
|
330
477
|
}
|
|
331
478
|
}
|
|
332
|
-
var
|
|
479
|
+
var y = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(y || {});
|
|
480
|
+
class a {
|
|
481
|
+
constructor({
|
|
482
|
+
eventName: t,
|
|
483
|
+
interactiveEvent: e,
|
|
484
|
+
customParameters: s
|
|
485
|
+
}) {
|
|
486
|
+
this.eventName = t, this.interactiveEvent = e, this.customParameters = s;
|
|
487
|
+
}
|
|
488
|
+
getGa4Parameters(t, e, s) {
|
|
489
|
+
let n = {
|
|
490
|
+
solution: t,
|
|
491
|
+
experience_id: e,
|
|
492
|
+
interactive_event: this.interactiveEvent,
|
|
493
|
+
send_to: s
|
|
494
|
+
};
|
|
495
|
+
return n = Object.assign(n, JSON.parse(JSON.stringify(this.customParameters))), n;
|
|
496
|
+
}
|
|
497
|
+
getGTMParameters(t, e, s) {
|
|
498
|
+
let n = {
|
|
499
|
+
solution: t,
|
|
500
|
+
experience_id: e,
|
|
501
|
+
event: this.eventName,
|
|
502
|
+
interactive_event: this.interactiveEvent,
|
|
503
|
+
send_to: s
|
|
504
|
+
};
|
|
505
|
+
return n = Object.assign(n, JSON.parse(JSON.stringify(this.customParameters))), n;
|
|
506
|
+
}
|
|
507
|
+
getNexusParameters() {
|
|
508
|
+
let t = {
|
|
509
|
+
interactive_event: this.interactiveEvent
|
|
510
|
+
};
|
|
511
|
+
return t = Object.assign(t, JSON.parse(JSON.stringify(this.customParameters))), t;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
var g = /* @__PURE__ */ ((i) => (i.AR = "ar", i.QR = "qr", i.INFO = "info", i.DOWNLOAD = "download", i.PREVIEW_CART = "preview_cart", i.HOTSPOT_PANEL = "hotspot_panel", i.SHARE_MODAL = "share_modal", i.RESTART_MODAL = "restart_modal", i.REMOVE_MODAL = "remove_modal", i.LOAD_PRECONFIG_MODAL = "load_preconfig_modal", i.MOVE_MODAL = "move_modal", i.OUT_OF_STOCK_MODAL = "out_of_stock_modal", i))(g || {}), v = /* @__PURE__ */ ((i) => (i.AUTO = "auto", i.BUTTON = "button", i.HOTSPOT = "hotspot", i.GESTURE = "gesture", i))(v || {}), l = /* @__PURE__ */ ((i) => (i.USD = "USD", i.EUR = "EUR", i.GBP = "GBP", i.CAD = "CAD", i))(l || {}), A = /* @__PURE__ */ ((i) => (i.AR = "ar", i.QR = "qr", i.WEBGL2 = "webgl2", i))(A || {}), S = /* @__PURE__ */ ((i) => (i.AR_VIEW = "ar_view", i.DIMENSION_SHOW = "dimension_show", i.DIMENSION_HIDE = "dimension_hide", i.HOTSPOTS_SHOW = "hotspots_show", i.HOTSPOTS_HIDE = "hotspots_hide", i.HELP_SHOW = "help_show", i.HELP_HIDE = "help_hide", i.HOTSPOT_ENTER = "hotspot_enter", i.HOTSPOT_EXIT = "hotspot_exit", i.SHARE = "share", i.PDF_DOWNLOAD = "pdf_download", i.COPY = "copy", i.RESTART = "restart", i.INSTRUCTIONS_SHOW = "show_instructions", i.REVIEW_CART = "review_cart", i.SHOP_NOW = "shop_now", i.SUB_CATEGORY = "sub_category", i.NEXT_STEP = "next_step", i.PREVIOUS_STEP = "previous_step", i))(S || {}), C = /* @__PURE__ */ ((i) => (i.ZOOM = "zoom", i.ROTATE = "rotate", i))(C || {}), O = /* @__PURE__ */ ((i) => (i.ROTATE = "rotate", i.ZOOM = "zoom", i.PAN = "pan", i))(O || {});
|
|
515
|
+
class R extends a {
|
|
516
|
+
constructor(t) {
|
|
517
|
+
super({
|
|
518
|
+
eventName: "epigraph_ar_requested",
|
|
519
|
+
interactiveEvent: !0,
|
|
520
|
+
customParameters: {
|
|
521
|
+
items: t
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
class q extends a {
|
|
527
|
+
constructor(t) {
|
|
528
|
+
super({
|
|
529
|
+
eventName: "epigraph_module_loading",
|
|
530
|
+
interactiveEvent: !1,
|
|
531
|
+
customParameters: {
|
|
532
|
+
is_pre_config: t
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
class M extends a {
|
|
538
|
+
constructor(t, e) {
|
|
539
|
+
super({
|
|
540
|
+
eventName: "epigraph_module_ready",
|
|
541
|
+
interactiveEvent: !1,
|
|
542
|
+
customParameters: {
|
|
543
|
+
is_pre_config: t,
|
|
544
|
+
load_time_ms: e
|
|
545
|
+
}
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
class G extends a {
|
|
550
|
+
constructor(t, e, s) {
|
|
551
|
+
super({
|
|
552
|
+
eventName: "epigraph_module_failed",
|
|
553
|
+
interactiveEvent: !1,
|
|
554
|
+
customParameters: {
|
|
555
|
+
is_pre_config: t,
|
|
556
|
+
load_time_ms: e,
|
|
557
|
+
error_type: s
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
class b extends a {
|
|
563
|
+
constructor(t) {
|
|
564
|
+
super({
|
|
565
|
+
eventName: "epigraph_module_closed",
|
|
566
|
+
interactiveEvent: !0,
|
|
567
|
+
customParameters: {
|
|
568
|
+
items: t
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
class k extends a {
|
|
574
|
+
static {
|
|
575
|
+
this.SUPPORT_TYPE = A;
|
|
576
|
+
}
|
|
577
|
+
constructor(t, e = {}) {
|
|
578
|
+
super({
|
|
579
|
+
eventName: "epigraph_support_detected",
|
|
580
|
+
interactiveEvent: !1,
|
|
581
|
+
customParameters: {
|
|
582
|
+
support_type: t,
|
|
583
|
+
device_capabilities: e
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
class V extends a {
|
|
589
|
+
static {
|
|
590
|
+
this.BUTTON_TYPE = S;
|
|
591
|
+
}
|
|
592
|
+
constructor(t, e) {
|
|
593
|
+
super({
|
|
594
|
+
eventName: "epigraph_button_click",
|
|
595
|
+
interactiveEvent: !0,
|
|
596
|
+
customParameters: {
|
|
597
|
+
button_type: t,
|
|
598
|
+
button_name: e
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
class $ extends a {
|
|
604
|
+
static {
|
|
605
|
+
this.PANEL_TYPE = g;
|
|
606
|
+
}
|
|
607
|
+
static {
|
|
608
|
+
this.TRIGGER_SOURCE = v;
|
|
609
|
+
}
|
|
610
|
+
constructor(t, e, s, n) {
|
|
611
|
+
super({
|
|
612
|
+
eventName: "epigraph_panel_opened",
|
|
613
|
+
interactiveEvent: t,
|
|
614
|
+
customParameters: {
|
|
615
|
+
items: n,
|
|
616
|
+
panel_type: e,
|
|
617
|
+
trigger_source: s
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
class H extends a {
|
|
623
|
+
static {
|
|
624
|
+
this.PANEL_TYPE = g;
|
|
625
|
+
}
|
|
626
|
+
static {
|
|
627
|
+
this.TRIGGER_SOURCE = v;
|
|
628
|
+
}
|
|
629
|
+
constructor(t, e, s, n) {
|
|
630
|
+
super({
|
|
631
|
+
eventName: "epigraph_panel_closed",
|
|
632
|
+
interactiveEvent: t,
|
|
633
|
+
customParameters: {
|
|
634
|
+
items: n,
|
|
635
|
+
panel_type: e,
|
|
636
|
+
trigger_source: s
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
class F extends a {
|
|
642
|
+
constructor(t) {
|
|
643
|
+
super({
|
|
644
|
+
eventName: "epigraph_add_to_favourites",
|
|
645
|
+
interactiveEvent: !0,
|
|
646
|
+
customParameters: {
|
|
647
|
+
items: t
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
class j extends a {
|
|
653
|
+
static {
|
|
654
|
+
this.ACTION_PERFORMED = C;
|
|
655
|
+
}
|
|
656
|
+
constructor(t) {
|
|
657
|
+
super({
|
|
658
|
+
eventName: "epigraph_keyboard_interaction",
|
|
659
|
+
interactiveEvent: !0,
|
|
660
|
+
customParameters: {
|
|
661
|
+
action_performed: t
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
class W extends a {
|
|
667
|
+
static {
|
|
668
|
+
this.INTERACTION_TYPE = O;
|
|
669
|
+
}
|
|
670
|
+
constructor(t) {
|
|
671
|
+
super({
|
|
672
|
+
eventName: "epigraph_touch_interaction",
|
|
673
|
+
interactiveEvent: !0,
|
|
674
|
+
customParameters: {
|
|
675
|
+
interaction_type: t
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
class J extends a {
|
|
681
|
+
static {
|
|
682
|
+
this.CURRENCY = l;
|
|
683
|
+
}
|
|
684
|
+
constructor(t, e, s, n, r) {
|
|
685
|
+
super({
|
|
686
|
+
eventName: "epigraph_item_added",
|
|
687
|
+
interactiveEvent: t,
|
|
688
|
+
customParameters: {
|
|
689
|
+
items: r,
|
|
690
|
+
value: e,
|
|
691
|
+
currency: s,
|
|
692
|
+
quantity: n
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
class Z extends a {
|
|
698
|
+
constructor(t) {
|
|
699
|
+
super({
|
|
700
|
+
eventName: "epigraph_item_moved",
|
|
701
|
+
interactiveEvent: !0,
|
|
702
|
+
customParameters: {
|
|
703
|
+
items: t
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
class U extends a {
|
|
709
|
+
static {
|
|
710
|
+
this.CURRENCY = l;
|
|
711
|
+
}
|
|
712
|
+
constructor(t, e, s, n) {
|
|
713
|
+
super({
|
|
714
|
+
eventName: "epigraph_item_removed",
|
|
715
|
+
interactiveEvent: !0,
|
|
716
|
+
customParameters: {
|
|
717
|
+
items: n,
|
|
718
|
+
value: t,
|
|
719
|
+
currency: e,
|
|
720
|
+
quantity: s
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
class X extends a {
|
|
726
|
+
constructor(t, e) {
|
|
727
|
+
super({
|
|
728
|
+
eventName: "epigraph_variant_changed",
|
|
729
|
+
interactiveEvent: !0,
|
|
730
|
+
customParameters: {
|
|
731
|
+
items: e,
|
|
732
|
+
change_type: t
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
class K extends a {
|
|
738
|
+
constructor(t, e, s) {
|
|
739
|
+
super({
|
|
740
|
+
eventName: "epigraph_content_shared",
|
|
741
|
+
interactiveEvent: !0,
|
|
742
|
+
customParameters: {
|
|
743
|
+
items: s,
|
|
744
|
+
content_type: t,
|
|
745
|
+
share_destination: e
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
class Q extends a {
|
|
751
|
+
static {
|
|
752
|
+
this.CURRENCY = l;
|
|
753
|
+
}
|
|
754
|
+
constructor(t, e, s) {
|
|
755
|
+
super({
|
|
756
|
+
eventName: "epigraph_checkout",
|
|
757
|
+
interactiveEvent: !0,
|
|
758
|
+
customParameters: {
|
|
759
|
+
items: s,
|
|
760
|
+
value: t,
|
|
761
|
+
currency: e
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
class B extends a {
|
|
767
|
+
static {
|
|
768
|
+
this.CURRENCY = l;
|
|
769
|
+
}
|
|
770
|
+
constructor(t, e, s) {
|
|
771
|
+
super({
|
|
772
|
+
eventName: "epigraph_conversion",
|
|
773
|
+
interactiveEvent: !0,
|
|
774
|
+
customParameters: {
|
|
775
|
+
items: s,
|
|
776
|
+
value: t,
|
|
777
|
+
currency: e
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
class Y extends a {
|
|
783
|
+
constructor(t) {
|
|
784
|
+
super({
|
|
785
|
+
eventName: "epigraph_changeRate",
|
|
786
|
+
interactiveEvent: !1,
|
|
787
|
+
customParameters: {
|
|
788
|
+
value: t
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
class tt extends a {
|
|
794
|
+
constructor(t) {
|
|
795
|
+
super({
|
|
796
|
+
eventName: "epigraph_completionRate",
|
|
797
|
+
interactiveEvent: !1,
|
|
798
|
+
customParameters: {
|
|
799
|
+
value: t
|
|
800
|
+
}
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
class et extends a {
|
|
805
|
+
constructor(t) {
|
|
806
|
+
super({
|
|
807
|
+
eventName: "epigraph_engagementRate",
|
|
808
|
+
interactiveEvent: !1,
|
|
809
|
+
customParameters: {
|
|
810
|
+
value: t
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
class it extends a {
|
|
816
|
+
constructor(t, e, s) {
|
|
817
|
+
super({
|
|
818
|
+
eventName: t,
|
|
819
|
+
interactiveEvent: e,
|
|
820
|
+
customParameters: s
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
333
824
|
/**
|
|
334
825
|
* @license
|
|
335
826
|
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
@@ -347,11 +838,17 @@ var p = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(p || {});
|
|
|
347
838
|
* limitations under the License.
|
|
348
839
|
*/
|
|
349
840
|
var w;
|
|
350
|
-
const
|
|
351
|
-
w =
|
|
352
|
-
class
|
|
353
|
-
constructor(
|
|
354
|
-
this[w] = /* @__PURE__ */ new Map(), this.
|
|
841
|
+
const h = Symbol("analyticsPluginsMap");
|
|
842
|
+
w = h;
|
|
843
|
+
class st {
|
|
844
|
+
constructor(t, e) {
|
|
845
|
+
this[w] = /* @__PURE__ */ new Map(), this.__consentPlugin = null, t && e && (this.__consentPlugin = this.buildConsentPlugin(t, e)), window.addEventListener("epigraphAnalyticsConsentChange", this.__onConsentChangeFromEvent);
|
|
846
|
+
}
|
|
847
|
+
__onConsentChangeFromEvent(t) {
|
|
848
|
+
let e = t;
|
|
849
|
+
this.__overrideConsent = e.detail.hasConsent;
|
|
850
|
+
for (const s of this[h].values())
|
|
851
|
+
this.__hasConsent() || s.setStatus(c.RESTRICTED);
|
|
355
852
|
}
|
|
356
853
|
/**
|
|
357
854
|
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
@@ -360,20 +857,30 @@ class S {
|
|
|
360
857
|
*
|
|
361
858
|
* @param plugin
|
|
362
859
|
*/
|
|
363
|
-
addEventPlugin(
|
|
364
|
-
this[
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
),
|
|
860
|
+
addEventPlugin(t) {
|
|
861
|
+
this[h].has(t.getUniquePluginIdentifier()) || (this[h].set(
|
|
862
|
+
t.getUniquePluginIdentifier(),
|
|
863
|
+
t
|
|
864
|
+
), t.setupPlugin());
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Resolves session consent by prioritizing this._overrideConsent and if not found,
|
|
868
|
+
* getting the value from the consent plugin, if available.
|
|
869
|
+
*
|
|
870
|
+
* @returns {boolean} Whether the session has consent to track analytics or not.
|
|
871
|
+
*/
|
|
872
|
+
__hasConsent() {
|
|
873
|
+
let t = !0;
|
|
874
|
+
return this.__overrideConsent !== void 0 ? (t = this.__overrideConsent, t) : (this.__consentPlugin && (t = this.__consentPlugin.hasConsent()), t);
|
|
368
875
|
}
|
|
369
876
|
/**
|
|
370
877
|
* Send an Event to all plugins
|
|
371
878
|
*
|
|
372
879
|
* @param eventData
|
|
373
880
|
*/
|
|
374
|
-
sendEvent(
|
|
375
|
-
this[
|
|
376
|
-
|
|
881
|
+
sendEvent(t) {
|
|
882
|
+
this[h].forEach((e) => {
|
|
883
|
+
e.sendEvent(t, this.__hasConsent());
|
|
377
884
|
});
|
|
378
885
|
}
|
|
379
886
|
/**
|
|
@@ -382,15 +889,44 @@ class S {
|
|
|
382
889
|
* @param consentIdentifier
|
|
383
890
|
* @private
|
|
384
891
|
*/
|
|
385
|
-
buildConsentPlugin(
|
|
386
|
-
return
|
|
892
|
+
buildConsentPlugin(t, e) {
|
|
893
|
+
return t.toLowerCase() === y.OneTrust.toLowerCase() ? new P(e) : null;
|
|
387
894
|
}
|
|
388
895
|
}
|
|
389
896
|
export {
|
|
390
|
-
|
|
391
|
-
S as
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
897
|
+
C as ACTION_PERFORMED,
|
|
898
|
+
S as BUTTON_TYPE,
|
|
899
|
+
l as CURRENCY,
|
|
900
|
+
y as ConsentPluginNames,
|
|
901
|
+
F as EpigraphAddToFavouritesEvent,
|
|
902
|
+
st as EpigraphAnalytics,
|
|
903
|
+
R as EpigraphArRequestedEvent,
|
|
904
|
+
V as EpigraphButtonClickEvent,
|
|
905
|
+
Y as EpigraphChangeRateEvent,
|
|
906
|
+
Q as EpigraphCheckoutEvent,
|
|
907
|
+
tt as EpigraphCompletionRateEvent,
|
|
908
|
+
K as EpigraphContentSharedEvent,
|
|
909
|
+
B as EpigraphConversionEvent,
|
|
910
|
+
it as EpigraphCustomEvent,
|
|
911
|
+
et as EpigraphEngagementRateEvent,
|
|
912
|
+
J as EpigraphItemAddedEvent,
|
|
913
|
+
Z as EpigraphItemMovedEvent,
|
|
914
|
+
U as EpigraphItemRemovedEvent,
|
|
915
|
+
j as EpigraphKeyboardInteractionEvent,
|
|
916
|
+
b as EpigraphModuleClosedEvent,
|
|
917
|
+
G as EpigraphModuleFailedEvent,
|
|
918
|
+
q as EpigraphModuleLoadingEvent,
|
|
919
|
+
M as EpigraphModuleReadyEvent,
|
|
920
|
+
H as EpigraphPanelClosedEvent,
|
|
921
|
+
$ as EpigraphPanelOpenedEvent,
|
|
922
|
+
k as EpigraphSupportDetectedEvent,
|
|
923
|
+
W as EpigraphTouchInteractionEvent,
|
|
924
|
+
X as EpigraphVariantChangedEvent,
|
|
925
|
+
z as GA4AnalyticsPlugin,
|
|
926
|
+
O as INTERACTION_TYPE,
|
|
927
|
+
T as NexusAnalyticsPlugin,
|
|
928
|
+
P as OneTrustConsentPlugin,
|
|
929
|
+
g as PANEL_TYPE,
|
|
930
|
+
A as SUPPORT_TYPE,
|
|
931
|
+
v as TRIGGER_SOURCE
|
|
396
932
|
};
|