@epigraph/epigraph-std-lib 4.7.1-alpha → 4.8.0
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 +7 -14
- package/dist/EpigraphLibs/EpigraphAnalytics/analytics-plugin-interface.d.ts +4 -15
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +2 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts +7 -14
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +227 -763
- package/dist/EpigraphLibs/EpigraphAnalytics/generics/queue.d.ts +3 -3
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga3-analytics-plugin.d.ts +44 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +18 -82
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.d.ts +7 -24
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.d.ts +1 -2
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +1 -1
- package/dist/epigraph-std-lib.cjs +1 -1
- package/dist/epigraph-std-lib.js +38 -67
- package/package.json +1 -1
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalyticsEventLibrary.d.ts +0 -170
- package/dist/EpigraphLibs/EpigraphAnalytics/generics/epigraph-notifier.d.ts +0 -17
|
@@ -1,433 +1,282 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
this[m] = t, this[_] = null;
|
|
1
|
+
const d = Symbol("data"), u = Symbol("next"), v = class y {
|
|
2
|
+
constructor(e) {
|
|
3
|
+
this[d] = e, this[u] = null;
|
|
5
4
|
}
|
|
6
5
|
get data() {
|
|
7
|
-
return this[
|
|
6
|
+
return this[d];
|
|
8
7
|
}
|
|
9
|
-
set next(
|
|
10
|
-
if (!(
|
|
8
|
+
set next(e) {
|
|
9
|
+
if (!(e instanceof y) && e !== null)
|
|
11
10
|
throw new Error(
|
|
12
11
|
"This node is not an instance of the custom class 'Node'."
|
|
13
12
|
);
|
|
14
|
-
this[
|
|
13
|
+
this[u] = e;
|
|
15
14
|
}
|
|
16
15
|
get next() {
|
|
17
|
-
return this[
|
|
16
|
+
return this[u];
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
let
|
|
21
|
-
const
|
|
22
|
-
class
|
|
19
|
+
let g = v;
|
|
20
|
+
const h = Symbol("head");
|
|
21
|
+
class m {
|
|
23
22
|
constructor() {
|
|
24
|
-
this[
|
|
23
|
+
this[h] = null;
|
|
25
24
|
}
|
|
26
|
-
set head(
|
|
27
|
-
this[
|
|
25
|
+
set head(e) {
|
|
26
|
+
this[h] = e;
|
|
28
27
|
}
|
|
29
28
|
get head() {
|
|
30
|
-
return this[
|
|
31
|
-
}
|
|
32
|
-
addToTail(
|
|
33
|
-
let
|
|
34
|
-
if (
|
|
35
|
-
for (;
|
|
36
|
-
|
|
37
|
-
return
|
|
29
|
+
return this[h];
|
|
30
|
+
}
|
|
31
|
+
addToTail(e) {
|
|
32
|
+
let t = this.head;
|
|
33
|
+
if (t) {
|
|
34
|
+
for (; t.next !== null; )
|
|
35
|
+
t = t?.next;
|
|
36
|
+
return t.next = new g(e);
|
|
38
37
|
}
|
|
39
|
-
return this.head = new
|
|
38
|
+
return this.head = new g(e);
|
|
40
39
|
}
|
|
41
40
|
removeHead() {
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
return this.head =
|
|
41
|
+
const e = this.head;
|
|
42
|
+
if (e)
|
|
43
|
+
return this.head = e.next, e.data;
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
|
-
const f = Symbol("queue"),
|
|
48
|
-
class
|
|
46
|
+
const f = Symbol("queue"), o = Symbol("size");
|
|
47
|
+
class l {
|
|
49
48
|
constructor() {
|
|
50
|
-
this[f] = new
|
|
49
|
+
this[f] = new m(), this[o] = 0;
|
|
51
50
|
}
|
|
52
51
|
get queue() {
|
|
53
52
|
return this[f];
|
|
54
53
|
}
|
|
55
54
|
get size() {
|
|
56
|
-
return this[
|
|
55
|
+
return this[o];
|
|
57
56
|
}
|
|
58
|
-
enqueue(
|
|
59
|
-
this.queue.addToTail(
|
|
57
|
+
enqueue(e) {
|
|
58
|
+
this.queue.addToTail(e), this[o]++;
|
|
60
59
|
}
|
|
61
60
|
dequeue() {
|
|
62
|
-
const
|
|
63
|
-
return this[
|
|
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 }));
|
|
61
|
+
const e = this.queue.removeHead();
|
|
62
|
+
return this[o]--, e;
|
|
101
63
|
}
|
|
102
64
|
}
|
|
103
|
-
class
|
|
104
|
-
constructor({
|
|
105
|
-
trackingID
|
|
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();
|
|
65
|
+
class L {
|
|
66
|
+
constructor(e, t, n, s) {
|
|
67
|
+
this.name = this.pluginName = "GA3-PLUGIN", this.trackingID = e, this.verboseLogging = t, this.user = n, this.trackerName = s, this.queue = new l(), this.trackerInterval = 0, this.trackerCreated = !1;
|
|
142
68
|
}
|
|
143
69
|
/**
|
|
144
|
-
* This function will send an Event to
|
|
70
|
+
* This function will send an Event to GA3.
|
|
145
71
|
*
|
|
146
|
-
* @param
|
|
147
|
-
* @param consent boolean Whether consent is granted
|
|
72
|
+
* @param eventData AnalyticsEvent The event to be tracked
|
|
148
73
|
*/
|
|
149
|
-
|
|
150
|
-
if (this.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
}
|
|
74
|
+
sendEvent(e) {
|
|
75
|
+
if (this.queue.enqueue(e), window.ga !== void 0 && typeof ga == "function")
|
|
76
|
+
try {
|
|
77
|
+
this.dequeueAndSendEvents();
|
|
78
|
+
} catch (t) {
|
|
79
|
+
this.logger(t);
|
|
217
80
|
}
|
|
218
|
-
|
|
219
|
-
|
|
81
|
+
else
|
|
82
|
+
this.logger("Cannot send Google Analytics 3 event: ga function is not defined.");
|
|
83
|
+
return !0;
|
|
220
84
|
}
|
|
221
85
|
/**
|
|
222
86
|
* Send all events that are in the queue
|
|
223
87
|
* @private
|
|
224
88
|
*/
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
89
|
+
dequeueAndSendEvents() {
|
|
90
|
+
if (this.trackerCreated) {
|
|
91
|
+
let e = this.queue.size;
|
|
92
|
+
for (let t = 0; t < e; t++) {
|
|
93
|
+
const n = this.queue.dequeue();
|
|
94
|
+
ga(
|
|
95
|
+
`${this.trackerName}.send`,
|
|
96
|
+
n.type,
|
|
97
|
+
n.category,
|
|
98
|
+
n.action,
|
|
99
|
+
n.label,
|
|
100
|
+
n.interaction
|
|
101
|
+
), this.logger(`Google Analytics 3 event successfully sent: ${n.action}`);
|
|
235
102
|
}
|
|
236
|
-
}
|
|
103
|
+
} else
|
|
104
|
+
this.logger("Cannot sent Google Analytics 3 event: tracker was not created.");
|
|
237
105
|
}
|
|
238
106
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
107
|
+
* GA3 requires that a tracker be created prior to being sent. This is called from the constructor. It is
|
|
108
|
+
* important to note that the promise that is inherently returned is ignored in the constructor at this
|
|
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
|
+
*
|
|
241
112
|
* @private
|
|
242
113
|
*/
|
|
243
|
-
async
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
114
|
+
async createTracker() {
|
|
115
|
+
if (window.ga !== void 0 && typeof ga == "function")
|
|
116
|
+
try {
|
|
117
|
+
ga("create", this.trackingID, "auto", this.trackerName, {
|
|
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.");
|
|
247
127
|
}
|
|
248
128
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @param
|
|
251
|
-
* @private
|
|
129
|
+
* Checks if verboseLogging is enabled, then logs the error
|
|
130
|
+
* @param err
|
|
252
131
|
*/
|
|
253
|
-
|
|
254
|
-
|
|
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);
|
|
132
|
+
logger(e) {
|
|
133
|
+
this.verboseLogging && console.warn(e);
|
|
257
134
|
}
|
|
258
135
|
/**
|
|
259
|
-
*
|
|
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.
|
|
136
|
+
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
265
137
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
138
|
+
getUniquePluginIdentifier() {
|
|
139
|
+
return this.pluginName + "-" + this.trackingID;
|
|
140
|
+
}
|
|
141
|
+
setupPlugin() {
|
|
142
|
+
var e = 0;
|
|
143
|
+
this.trackerInterval = window.setInterval(() => {
|
|
144
|
+
this.createTracker(), ++e === 10 && (window.clearInterval(this.trackerInterval), this.logger("Error: Failed to create Google Analytics tracker in the allotted timeframe."));
|
|
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[window.epgDataLayerName] !== void 0 && (window.gtag = function() {
|
|
159
|
+
window[window.epgDataLayerName].push(arguments);
|
|
160
|
+
}, window.gtag("js", /* @__PURE__ */ new Date()), window.gtag("config", t, { send_page_view: !1 }));
|
|
273
161
|
}
|
|
274
162
|
/**
|
|
275
|
-
*
|
|
276
|
-
* for processing and returning the formatted result. Falls back to the original payload in case of errors.
|
|
163
|
+
* This function will send an Event to GA3.
|
|
277
164
|
*
|
|
278
|
-
* @param
|
|
279
|
-
* @param
|
|
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.
|
|
165
|
+
* @param eventData AnalyticsEvent The event to be tracked
|
|
166
|
+
* @param consentPlugin
|
|
281
167
|
*/
|
|
282
|
-
async
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
168
|
+
async sendEvent(e, t) {
|
|
169
|
+
this.queue.enqueue(e);
|
|
170
|
+
let n = !0;
|
|
171
|
+
if (t && (n = t.hasConsent()), this.dataLayer !== void 0 && n)
|
|
172
|
+
try {
|
|
173
|
+
await this.dequeueAndSendEvents();
|
|
174
|
+
} catch (s) {
|
|
175
|
+
this.logger(s);
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
this.logger("Cannot send Google Analytics 4 event: dataLayer is not defined.");
|
|
293
179
|
}
|
|
294
180
|
/**
|
|
295
|
-
*
|
|
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.
|
|
181
|
+
* Send all events that are in the queue
|
|
182
|
+
* @private
|
|
299
183
|
*/
|
|
300
|
-
async
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
184
|
+
async dequeueAndSendEvents() {
|
|
185
|
+
let e = this.queue.size;
|
|
186
|
+
for (let t = 0; t < e; t++) {
|
|
187
|
+
const n = this.queue.dequeue();
|
|
188
|
+
let s = {
|
|
189
|
+
send_to: this.trackingID,
|
|
190
|
+
event_action: n.action,
|
|
191
|
+
event_category: n.category,
|
|
192
|
+
event_label: n.label,
|
|
193
|
+
epg_event_tag: ""
|
|
305
194
|
};
|
|
306
|
-
|
|
307
|
-
|
|
195
|
+
if ("parameters" in n && Object.assign(s, n.parameters), JSON.stringify(s).length > 459)
|
|
196
|
+
try {
|
|
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}`);
|
|
308
208
|
}
|
|
309
209
|
}
|
|
310
210
|
/**
|
|
311
211
|
* Checks if verboseLogging is enabled, then logs the error
|
|
312
212
|
* @param err
|
|
313
213
|
*/
|
|
314
|
-
logger(
|
|
315
|
-
this.verboseLogging && console.warn(
|
|
214
|
+
logger(e) {
|
|
215
|
+
this.verboseLogging && console.warn(e);
|
|
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();
|
|
316
225
|
}
|
|
317
|
-
async sendGA4LongParameters(
|
|
318
|
-
const
|
|
226
|
+
async sendGA4LongParameters(e) {
|
|
227
|
+
const t = "https://api.myepigraph.com/api/analytics/ga4/custom", n = {
|
|
228
|
+
parameters: e
|
|
229
|
+
};
|
|
319
230
|
try {
|
|
320
|
-
const
|
|
231
|
+
const s = await fetch(t, {
|
|
321
232
|
method: "POST",
|
|
322
233
|
// Assuming it's a POST request, adjust if necessary
|
|
323
234
|
headers: {
|
|
324
235
|
"Content-Type": "application/json",
|
|
325
236
|
Accept: "application/json"
|
|
326
237
|
},
|
|
327
|
-
body: JSON.stringify(
|
|
238
|
+
body: JSON.stringify(n)
|
|
328
239
|
});
|
|
329
|
-
|
|
240
|
+
if (s.ok) {
|
|
241
|
+
const a = await s.json();
|
|
242
|
+
return a && a.id ? a.id : "";
|
|
243
|
+
} else
|
|
244
|
+
return "";
|
|
330
245
|
} catch {
|
|
331
246
|
return "";
|
|
332
247
|
}
|
|
333
248
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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());
|
|
249
|
+
findGA4ScriptInfo(e) {
|
|
250
|
+
const t = document.querySelectorAll("script[src]");
|
|
251
|
+
for (const n of t) {
|
|
252
|
+
const s = n.getAttribute("src");
|
|
253
|
+
if (s && s.includes(e)) {
|
|
254
|
+
const a = new URL(s, location.href), r = Object.fromEntries(a.searchParams.entries());
|
|
367
255
|
return {
|
|
368
|
-
fullSrc:
|
|
369
|
-
id:
|
|
370
|
-
l:
|
|
256
|
+
fullSrc: a.href,
|
|
257
|
+
id: r.id || void 0,
|
|
258
|
+
l: r.l || void 0
|
|
371
259
|
};
|
|
372
260
|
}
|
|
373
261
|
}
|
|
374
262
|
return null;
|
|
375
263
|
}
|
|
376
264
|
}
|
|
377
|
-
class
|
|
378
|
-
constructor({
|
|
379
|
-
trackingID:
|
|
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() {
|
|
265
|
+
class A {
|
|
266
|
+
constructor(e, t, n, s, a = !1) {
|
|
267
|
+
this.sessionId = t, this.xPath = n, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = e, this.verboseLogging = s, this.queue = new l(), this.url = a ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event";
|
|
415
268
|
}
|
|
416
|
-
async sendEvent(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
await this.dequeueAndSendEvents();
|
|
269
|
+
async sendEvent(e, t) {
|
|
270
|
+
this.queue.enqueue(e);
|
|
271
|
+
let n = !0;
|
|
272
|
+
t && (n = t.hasConsent()), n && await this.dequeueAndSendEvents();
|
|
422
273
|
}
|
|
423
274
|
async dequeueAndSendEvents() {
|
|
424
|
-
for (let
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
event: e.eventName,
|
|
430
|
-
parameters: e.getNexusParameters()
|
|
275
|
+
for (let e = 0; e < this.queue.size; e++) {
|
|
276
|
+
const t = this.queue.dequeue(), n = {
|
|
277
|
+
experience_id: this.trackingID,
|
|
278
|
+
action: t.action,
|
|
279
|
+
parameters: t.parameters
|
|
431
280
|
};
|
|
432
281
|
try {
|
|
433
282
|
return (await fetch(this.url, {
|
|
@@ -440,19 +289,23 @@ class T {
|
|
|
440
289
|
"EPG-XPATH": this.xPath,
|
|
441
290
|
Origin: typeof window < "u" ? window.location.origin : ""
|
|
442
291
|
},
|
|
443
|
-
body: JSON.stringify(
|
|
444
|
-
})).
|
|
292
|
+
body: JSON.stringify(n)
|
|
293
|
+
})).status === 204, "";
|
|
445
294
|
} catch {
|
|
446
295
|
return "";
|
|
447
296
|
}
|
|
448
|
-
this.__sentEventCount++;
|
|
449
297
|
}
|
|
450
298
|
return "";
|
|
451
299
|
}
|
|
300
|
+
getUniquePluginIdentifier() {
|
|
301
|
+
return this.name + "-" + this.trackingID;
|
|
302
|
+
}
|
|
303
|
+
setupPlugin() {
|
|
304
|
+
}
|
|
452
305
|
}
|
|
453
|
-
class
|
|
454
|
-
constructor(
|
|
455
|
-
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier =
|
|
306
|
+
class q {
|
|
307
|
+
constructor(e) {
|
|
308
|
+
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
|
|
456
309
|
}
|
|
457
310
|
/**
|
|
458
311
|
* Checks to see if the user has consented. If this is false, it will block all analytics
|
|
@@ -461,9 +314,9 @@ class P {
|
|
|
461
314
|
if (this.consentSet)
|
|
462
315
|
return this.consent;
|
|
463
316
|
if (window.OnetrustActiveGroups !== void 0) {
|
|
464
|
-
let
|
|
465
|
-
|
|
466
|
-
|
|
317
|
+
let e = window.OnetrustActiveGroups;
|
|
318
|
+
e !== void 0 && e.split(",").forEach((n) => {
|
|
319
|
+
n === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
|
|
467
320
|
});
|
|
468
321
|
}
|
|
469
322
|
return this.consent;
|
|
@@ -476,351 +329,7 @@ class P {
|
|
|
476
329
|
});
|
|
477
330
|
}
|
|
478
331
|
}
|
|
479
|
-
var
|
|
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
|
-
}
|
|
332
|
+
var w = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(w || {});
|
|
824
333
|
/**
|
|
825
334
|
* @license
|
|
826
335
|
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
@@ -837,18 +346,12 @@ class it extends a {
|
|
|
837
346
|
* See the License for the specific language governing permissions and
|
|
838
347
|
* limitations under the License.
|
|
839
348
|
*/
|
|
840
|
-
var
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
-
class
|
|
844
|
-
constructor(
|
|
845
|
-
this[
|
|
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);
|
|
349
|
+
var p;
|
|
350
|
+
const c = Symbol("analyticsPluginsMap");
|
|
351
|
+
p = c;
|
|
352
|
+
class S {
|
|
353
|
+
constructor(e, t) {
|
|
354
|
+
this[p] = /* @__PURE__ */ new Map(), this._consentPlugin = null, e && t && (this._consentPlugin = this.buildConsentPlugin(e, t));
|
|
852
355
|
}
|
|
853
356
|
/**
|
|
854
357
|
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
@@ -857,30 +360,20 @@ class st {
|
|
|
857
360
|
*
|
|
858
361
|
* @param plugin
|
|
859
362
|
*/
|
|
860
|
-
addEventPlugin(
|
|
861
|
-
this[
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
),
|
|
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);
|
|
363
|
+
addEventPlugin(e) {
|
|
364
|
+
this[c].has(e.getUniquePluginIdentifier()) || (this[c].set(
|
|
365
|
+
e.getUniquePluginIdentifier(),
|
|
366
|
+
e
|
|
367
|
+
), e.setupPlugin());
|
|
875
368
|
}
|
|
876
369
|
/**
|
|
877
370
|
* Send an Event to all plugins
|
|
878
371
|
*
|
|
879
372
|
* @param eventData
|
|
880
373
|
*/
|
|
881
|
-
sendEvent(
|
|
882
|
-
this[
|
|
883
|
-
|
|
374
|
+
sendEvent(e) {
|
|
375
|
+
this[c].forEach((t) => {
|
|
376
|
+
t.sendEvent(e, this._consentPlugin);
|
|
884
377
|
});
|
|
885
378
|
}
|
|
886
379
|
/**
|
|
@@ -889,44 +382,15 @@ class st {
|
|
|
889
382
|
* @param consentIdentifier
|
|
890
383
|
* @private
|
|
891
384
|
*/
|
|
892
|
-
buildConsentPlugin(
|
|
893
|
-
return
|
|
385
|
+
buildConsentPlugin(e, t) {
|
|
386
|
+
return e.toLowerCase() === w.OneTrust.toLowerCase() ? new q(t) : null;
|
|
894
387
|
}
|
|
895
388
|
}
|
|
896
389
|
export {
|
|
897
|
-
|
|
898
|
-
S as
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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
|
|
390
|
+
w as ConsentPluginNames,
|
|
391
|
+
S as EpigraphAnalytics,
|
|
392
|
+
L as GA3AnalyticsPlugin,
|
|
393
|
+
I as GA4AnalyticsPlugin,
|
|
394
|
+
A as NexusAnalyticsPlugin,
|
|
395
|
+
q as OneTrustConsentPlugin
|
|
932
396
|
};
|