@epigraph/epigraph-std-lib 5.0.0-alpha.14 → 5.0.0-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +68 -68
  2. package/dist/Epigraph/epigraph.cjs +1 -1
  3. package/dist/Epigraph/epigraph.js +94 -126
  4. package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -1
  5. package/dist/Epigraph/epigraphBaseSolutions.js +60 -68
  6. package/dist/EpigraphLibs/EpigraphAnalytics/consent-plugins/auto-consent-resolver.d.ts +21 -0
  7. package/dist/EpigraphLibs/EpigraphAnalytics/consent-plugins/one-trust-consent-plugin.d.ts +1 -0
  8. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +1 -16
  9. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts +14 -5
  10. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +2 -1057
  11. package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +6 -0
  12. package/dist/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.d.ts +1 -0
  13. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -1
  14. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.js +74 -198
  15. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -1
  16. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +197 -425
  17. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +1 -7
  18. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +2 -78
  19. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -1
  20. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js +24 -26
  21. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -1
  22. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +2 -88
  23. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
  24. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +44 -75
  25. package/dist/enums-BSSe4NAs.js +8 -0
  26. package/dist/enums-PfFMiIoe.cjs +1 -0
  27. package/dist/epigraph-std-lib.cjs +1 -1
  28. package/dist/epigraph-std-lib.js +11 -74
  29. package/dist/epigraphAnalytics-CADAVr-I.cjs +1 -0
  30. package/dist/epigraphAnalytics-Dv5dGbcW.js +851 -0
  31. package/dist/epigraphQrCodeGenerator-BXUNL2XK.js +54 -0
  32. package/dist/epigraphQrCodeGenerator-F2eLrPC_.cjs +7 -0
  33. package/dist/epigraphUnitsConverter-CwpmWl7p.cjs +1 -0
  34. package/dist/epigraphUnitsConverter-DsX4Rmsp.js +66 -0
  35. package/dist/lit--5TUYSGn.js +508 -0
  36. package/dist/lit-DZtv4Pds.cjs +2 -0
  37. package/package.json +40 -40
  38. package/dist/enums-1vqWxJ0i.cjs +0 -1
  39. package/dist/enums-CvOTKyNu.js +0 -5
  40. package/dist/lit-element-C3moVMGu.js +0 -524
  41. package/dist/lit-element-CYaaFRfk.cjs +0 -19
@@ -0,0 +1,851 @@
1
+ import { n as e } from "./enums-BSSe4NAs.js";
2
+ //#region lib/EpigraphLibs/EpigraphAnalytics/analytics-plugin-interface.ts
3
+ var t = /* @__PURE__ */ function(e) {
4
+ return e.UNAVAILABLE = "unavailable", e.AVAILABLE = "available", e.RESTRICTED = "restricted", e;
5
+ }({}), n = Symbol("data"), r = Symbol("next"), i = class e {
6
+ constructor(e) {
7
+ this[n] = e, this[r] = null;
8
+ }
9
+ get data() {
10
+ return this[n];
11
+ }
12
+ set next(t) {
13
+ if (!(t instanceof e) && t !== null) throw Error("This node is not an instance of the custom class 'Node'.");
14
+ this[r] = t;
15
+ }
16
+ get next() {
17
+ return this[r];
18
+ }
19
+ }, a = Symbol("head"), o = class {
20
+ constructor() {
21
+ this[a] = null;
22
+ }
23
+ set head(e) {
24
+ this[a] = e;
25
+ }
26
+ get head() {
27
+ return this[a];
28
+ }
29
+ addToTail(e) {
30
+ let t = this.head;
31
+ if (t) {
32
+ for (; t.next !== null;) t = t?.next;
33
+ return t.next = new i(e);
34
+ }
35
+ return this.head = new i(e);
36
+ }
37
+ removeHead() {
38
+ let e = this.head;
39
+ if (e) return this.head = e.next, e.data;
40
+ }
41
+ }, s = Symbol("queue"), c = Symbol("size"), l = class {
42
+ constructor() {
43
+ this[s] = new o(), this[c] = 0;
44
+ }
45
+ get queue() {
46
+ return this[s];
47
+ }
48
+ get size() {
49
+ return this[c];
50
+ }
51
+ enqueue(e) {
52
+ this.queue.addToTail(e), this[c]++;
53
+ }
54
+ dequeue() {
55
+ let e = this.queue.removeHead();
56
+ return this[c]--, e;
57
+ }
58
+ }, u = class {
59
+ static {
60
+ this.NOTIFICATION_NAME = "epg-notification";
61
+ }
62
+ static {
63
+ this.ACTION_SEND_EVENT = "send-event";
64
+ }
65
+ static {
66
+ this.ACTION_INITIALIZED = "initialized";
67
+ }
68
+ static {
69
+ this.ACTION_FAILED_INITIALIZATION = "initialization-failed";
70
+ }
71
+ constructor(e, t, n, r, i, a) {
72
+ this._pluginName = e, this._trackingId = t, this._experienceId = n, this._solution = r, this._initializer = i, this._status = a;
73
+ }
74
+ updateStatus(e) {
75
+ this._status = e;
76
+ }
77
+ updateInitializer(e) {
78
+ this._initializer = e;
79
+ }
80
+ notify(e, t) {
81
+ let n = {
82
+ pluginName: this._pluginName,
83
+ trackingId: this._trackingId,
84
+ experienceId: this._experienceId,
85
+ solution: this._solution,
86
+ initializer: this._initializer,
87
+ status: this._status,
88
+ action: e,
89
+ eventDetails: t
90
+ };
91
+ window.dispatchEvent(new CustomEvent("epg-notification", { detail: n }));
92
+ }
93
+ }, d = class {
94
+ constructor({ trackingID: e, experienceID: n, solution: r, verboseLogging: i = !1 }) {
95
+ this.__status = t.UNAVAILABLE, this.__sentEventCount = 0, this.__initializationAttempts = 0, this.__lastInitializationAttempt = performance.now(), this.__maxInitializationAttempts = 10, this.__initializationRetryDelay = 2e3, this.__maxQueuedEvents = 200, this.__isInitialized = !1, this.__initializationMethod = "NONE", this.__nexusFailureReported = !1, this.name = this.pluginName = "GA4-PLUGIN", this.trackingID = e, this.experienceID = n, this.solution = r, this.verboseLogging = i, this.__queue = new l(), this.__epigraphNotifier = new u(this.pluginName, this.pluginName, this.experienceID, this.solution, this.__initializationMethod, this.__status), this.initializePlugin();
96
+ }
97
+ setTrackingID(e) {
98
+ if (!e) return;
99
+ let t = this.trackingID !== e;
100
+ this.trackingID = e, t && this.__isInitialized && (this.resetInitialization(), this.initializePlugin());
101
+ }
102
+ setExperienceID(e) {
103
+ this.experienceID = e;
104
+ }
105
+ setSolution(e) {
106
+ this.solution = e;
107
+ }
108
+ getStatus() {
109
+ return this.__status;
110
+ }
111
+ setStatus(e) {
112
+ this.__status = e, this.__epigraphNotifier.updateStatus(e);
113
+ }
114
+ getPendingEventCount() {
115
+ return this.__queue.size;
116
+ }
117
+ getSentEventCount() {
118
+ return this.__sentEventCount;
119
+ }
120
+ getTotalEventCount() {
121
+ return this.getPendingEventCount() + this.getSentEventCount();
122
+ }
123
+ getUniquePluginIdentifier() {
124
+ return `${this.name}-${this.trackingID}`;
125
+ }
126
+ setupPlugin() {
127
+ this.__isInitialized && this.dataLayer !== void 0 && this.dequeueAndSendEvents();
128
+ }
129
+ async sendEvent(e, n) {
130
+ if (this.__queue.size >= this.__maxQueuedEvents && this.__queue.dequeue(), this.__queue.enqueue(e), !n) {
131
+ this.setStatus(t.RESTRICTED);
132
+ return;
133
+ }
134
+ if (this.__status === t.RESTRICTED && this.__isInitialized && this.setStatus(t.AVAILABLE), this.__isInitialized || this.initializePlugin(), !this.__isInitialized) {
135
+ this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");
136
+ return;
137
+ }
138
+ try {
139
+ await this.dequeueAndSendEvents();
140
+ } catch (e) {
141
+ this.logger(e), await this.reportFailureToNexus("EVENT_SEND_ERROR", e?.toString() || "Unknown error");
142
+ }
143
+ }
144
+ resetInitialization() {
145
+ this.__isInitialized = !1, this.__status = t.UNAVAILABLE, this.dataLayer = void 0, this.dataLayerName = void 0, this.__initializationMethod = "NONE", this.__initializationAttempts = 0, this.__nexusFailureReported = !1, this.__epigraphNotifier.updateStatus(this.__status);
146
+ }
147
+ initializePlugin() {
148
+ if (this.__isInitialized) return;
149
+ let e = performance.now();
150
+ if (this.__initializationAttempts > 0 && e - this.__lastInitializationAttempt < this.__initializationRetryDelay) return;
151
+ this.__lastInitializationAttempt = e, this.__initializationAttempts++;
152
+ let n = this.detectAndSetupAnalytics();
153
+ n.success ? (this.__isInitialized = !0, this.setStatus(t.AVAILABLE), this.__initializationMethod = n.method, this.dataLayerName = n.dataLayerName, this.dataLayer = window[this.dataLayerName] = window[this.dataLayerName] || [], this.logger(`Successfully initialized ${n.method} with dataLayer: ${this.dataLayerName}`), this.__epigraphNotifier.notify(u.ACTION_INITIALIZED, {}), this.__queue.size > 0 && this.dequeueAndSendEvents()) : (this.logger(`Initialization attempt ${this.__initializationAttempts} failed: ${n.error}`), this.__initializationAttempts < this.__maxInitializationAttempts ? setTimeout(() => {
154
+ this.initializePlugin();
155
+ }, this.__initializationRetryDelay) : this.__nexusFailureReported || (this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS", "Maximum initialization attempts reached"), this.__nexusFailureReported = !0, this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION, {})));
156
+ }
157
+ detectAndSetupAnalytics() {
158
+ let e = this.detectGTM();
159
+ if (e) return this.logger(`GTM detected with container ID: ${e.containerId}`), this.__epigraphNotifier.updateInitializer("GTM"), {
160
+ success: !0,
161
+ method: "GTM",
162
+ dataLayerName: e.dataLayerName
163
+ };
164
+ let t = this.findGA4Info(this.trackingID);
165
+ if (t) {
166
+ let e = t.l || "dataLayer";
167
+ return this.logger(`GA4 script found, setting up with dataLayer: ${e}`), this.__epigraphNotifier.updateInitializer("GA4"), {
168
+ success: !0,
169
+ method: "GA4",
170
+ dataLayerName: e
171
+ };
172
+ }
173
+ return {
174
+ success: !1,
175
+ method: "NONE",
176
+ dataLayerName: "dataLayer",
177
+ error: "No analytics setup found and unable to create one"
178
+ };
179
+ }
180
+ detectGTM() {
181
+ let e = window.google_tag_manager;
182
+ if (e) {
183
+ let t = Object.keys(e).find((e) => e.startsWith("GTM-"));
184
+ if (t) return {
185
+ containerId: t,
186
+ dataLayerName: this.getRuntimeDataLayerName(e[t]) || "dataLayer"
187
+ };
188
+ }
189
+ let t = document.querySelectorAll("script[src*=\"gtm.js?id=\"]");
190
+ for (let e of Array.from(t)) {
191
+ let t = e.getAttribute("src");
192
+ if (t) {
193
+ let e = t.match(/gtm\.js\?id=([^&]+)/);
194
+ if (e && e.length > 0) {
195
+ let n = t.match(/&l=([^&]+)/), r = n ? n[1] : "dataLayer";
196
+ return {
197
+ containerId: e[1],
198
+ dataLayerName: r
199
+ };
200
+ }
201
+ }
202
+ }
203
+ return null;
204
+ }
205
+ getRuntimeDataLayerName(e) {
206
+ let t = e?.dataLayer?.name ?? e?.dataLayerName;
207
+ return typeof t == "string" && t.length > 0 ? t : void 0;
208
+ }
209
+ async dequeueAndSendEvents() {
210
+ if (!this.__isInitialized || !this.dataLayer) return;
211
+ let e = this.__queue.size;
212
+ for (let t = 0; t < e; t++) {
213
+ let e = this.__queue.dequeue();
214
+ try {
215
+ this.__initializationMethod === "GTM" ? (this.sendGTMEvent(e), this.__sentEventCount++, this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${e.eventName}`)) : this.__initializationMethod === "GA4" ? (this.sendGA4Event(e), this.__sentEventCount++, this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${e.eventName}`)) : this.__queue.enqueue(e);
216
+ } catch (t) {
217
+ this.logger(`Error sending event ${e.eventName}: ${t}`), this.__queue.enqueue(e);
218
+ }
219
+ }
220
+ }
221
+ async sendGTMEvent(e) {
222
+ let t = e.getGTMParameters(this.solution, this.experienceID, this.trackingID), n = t;
223
+ this.isValidPayload(t) || (t = await this.convertGTMParametersToEpgEventTag(e.eventName, t)), this.dataLayer && (this.dataLayer.push(t), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, n));
224
+ }
225
+ async sendGA4Event(e) {
226
+ let t = e.getGa4Parameters(this.solution, this.experienceID, this.trackingID), n = t;
227
+ this.isValidPayload(t) || (t = await this.convertGA4ParametersToEpgEventTag(t));
228
+ let r = this.dataLayer;
229
+ r && ((function(...e) {
230
+ r.push(arguments);
231
+ })("event", e.eventName, t), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, n));
232
+ }
233
+ isValidPayload(e) {
234
+ if (Object.keys(e).length >= 25) return !1;
235
+ for (let [t, n] of Object.entries(e)) if (t !== "items" && (t.length > 40 || String(n).length > 100)) return !1;
236
+ return !0;
237
+ }
238
+ async convertGTMParametersToEpgEventTag(e, t) {
239
+ try {
240
+ return {
241
+ event: e,
242
+ epg_event_tag: await this.sendGA4LongParameters(t),
243
+ send_to: this.trackingID
244
+ };
245
+ } catch {
246
+ return t;
247
+ }
248
+ }
249
+ async convertGA4ParametersToEpgEventTag(e) {
250
+ try {
251
+ return {
252
+ epg_event_tag: await this.sendGA4LongParameters(e),
253
+ send_to: this.trackingID
254
+ };
255
+ } catch {
256
+ return e;
257
+ }
258
+ }
259
+ logger(e) {
260
+ this.verboseLogging && console.warn(e);
261
+ }
262
+ async sendGA4LongParameters(e) {
263
+ let t = { parameters: e };
264
+ try {
265
+ let e = await fetch("https://api.myepigraph.com/api/analytics/ga4/custom", {
266
+ method: "POST",
267
+ headers: {
268
+ "Content-Type": "application/json",
269
+ Accept: "application/json"
270
+ },
271
+ body: JSON.stringify(t)
272
+ });
273
+ return e.ok ? (await e.json())?.id ?? "" : "";
274
+ } catch {
275
+ return "";
276
+ }
277
+ }
278
+ async reportFailureToNexus(e, t) {
279
+ try {
280
+ let n = {
281
+ plugin: "GA4",
282
+ trackingId: this.trackingID,
283
+ solution: this.solution,
284
+ experienceId: this.experienceID,
285
+ failureType: e,
286
+ errorMessage: t,
287
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
288
+ url: window.location.href,
289
+ userAgent: navigator.userAgent
290
+ };
291
+ this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`);
292
+ } catch (e) {
293
+ this.logger(`Error reporting failure to Nexus: ${e}`);
294
+ }
295
+ }
296
+ findGA4Info(e) {
297
+ if (window.google_tag_manager && window.google_tag_manager[e]) return {
298
+ fullSrc: "",
299
+ id: e,
300
+ l: this.getRuntimeDataLayerName(window.google_tag_manager[e])
301
+ };
302
+ let t = document.querySelectorAll("script[src]");
303
+ for (let n of t) {
304
+ let t = n.getAttribute("src");
305
+ if (t && t.includes(e)) {
306
+ let e = new URL(t, location.href), n = Object.fromEntries(e.searchParams.entries());
307
+ return {
308
+ fullSrc: e.href,
309
+ id: n.id || void 0,
310
+ l: n.l || void 0
311
+ };
312
+ }
313
+ }
314
+ return null;
315
+ }
316
+ }, f = class {
317
+ constructor({ trackingID: n, experienceID: r, solution: i, sessionId: a, xPath: o, verboseLogging: s = !1, baseUrl: c = e.PRODUCTION }) {
318
+ this.__status = t.UNAVAILABLE, this.__sentEventCount = 0, this.__maxQueuedEvents = 200, this.sessionId = a, this.xPath = o, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = n, this.experienceID = r, this.solution = i, this.verboseLogging = s, this.__queue = new l(), this.url = `${c}analytics/event`, this.__status = t.AVAILABLE, this.__epigraphNotifier = new u(this.pluginName, this.trackingID, this.experienceID, this.solution, "NEXUS", this.__status), this.__epigraphNotifier.notify(u.ACTION_INITIALIZED, {});
319
+ }
320
+ getStatus() {
321
+ return this.__status;
322
+ }
323
+ setStatus(e) {
324
+ this.__status = e, this.__epigraphNotifier.updateStatus(e);
325
+ }
326
+ getPendingEventCount() {
327
+ return this.__queue.size;
328
+ }
329
+ getSentEventCount() {
330
+ return this.__sentEventCount;
331
+ }
332
+ getTotalEventCount() {
333
+ return this.getPendingEventCount() + this.getSentEventCount();
334
+ }
335
+ getUniquePluginIdentifier() {
336
+ return this.name + "-" + this.trackingID;
337
+ }
338
+ setupPlugin() {}
339
+ async sendEvent(e, n) {
340
+ if (this.__queue.size >= this.__maxQueuedEvents && this.__queue.dequeue(), this.__queue.enqueue(e), !n) {
341
+ this.setStatus(t.RESTRICTED);
342
+ return;
343
+ }
344
+ this.__status === t.RESTRICTED && this.setStatus(t.AVAILABLE), await this.dequeueAndSendEvents();
345
+ }
346
+ async dequeueAndSendEvents() {
347
+ for (let e = 0; e < this.__queue.size; e++) {
348
+ let e = this.__queue.dequeue(), t = {
349
+ send_to: this.trackingID,
350
+ experience_id: this.experienceID,
351
+ solution: this.solution,
352
+ event: e.eventName,
353
+ parameters: e.getNexusParameters()
354
+ };
355
+ try {
356
+ return (await fetch(this.url, {
357
+ method: "POST",
358
+ headers: {
359
+ "Content-Type": "application/json",
360
+ Accept: "application/json",
361
+ "EPG-SESSION-ID": this.sessionId,
362
+ "EPG-XPATH": this.xPath,
363
+ Origin: typeof window < "u" ? window.location.origin : ""
364
+ },
365
+ body: JSON.stringify(t)
366
+ })).ok && this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, t), "";
367
+ } catch {
368
+ return "";
369
+ }
370
+ this.__sentEventCount++;
371
+ }
372
+ return "";
373
+ }
374
+ }, p = class {
375
+ constructor({ productId: n, identifier: r, identifierType: i, experienceType: a, renderMode: o = "geo", sessionId: s, xPath: c, solution: d = "", verboseLogging: f = !1, baseUrl: p = e.PRODUCTION }) {
376
+ if (this.experienceID = "", this.__status = t.UNAVAILABLE, this.__sentEventCount = 0, n <= 0) throw Error("NexusSolutionsAnalyticsPlugin requires a valid productId greater than 0.");
377
+ this.sessionId = s, this.xPath = c, this.name = this.pluginName = "NEXUS-SOLUTIONS-PLUGIN", this.verboseLogging = f, this.__queue = new l(), this.productId = n, this.identifier = r, this.identifierType = i, this.experienceType = a, this.renderMode = o, this.solution = d, this.trackingID = String(n), this.url = `${p}analytics/event`, this.__status = t.AVAILABLE, this.__epigraphNotifier = new u(this.pluginName, this.trackingID, `${r}@${i}`, this.solution, "NEXUS-SOLUTIONS", this.__status), this.__epigraphNotifier.notify(u.ACTION_INITIALIZED, {});
378
+ }
379
+ setProductId(e) {
380
+ e <= 0 || (this.productId = e, this.trackingID = String(e));
381
+ }
382
+ setIdentifier(e) {
383
+ this.identifier = e;
384
+ }
385
+ setIdentifierType(e) {
386
+ this.identifierType = e;
387
+ }
388
+ setExperienceType(e) {
389
+ this.experienceType = e;
390
+ }
391
+ setRenderMode(e) {
392
+ this.renderMode = e;
393
+ }
394
+ getStatus() {
395
+ return this.__status;
396
+ }
397
+ setStatus(e) {
398
+ this.__status = e, this.__epigraphNotifier.updateStatus(e);
399
+ }
400
+ getPendingEventCount() {
401
+ return this.__queue.size;
402
+ }
403
+ getSentEventCount() {
404
+ return this.__sentEventCount;
405
+ }
406
+ getTotalEventCount() {
407
+ return this.getPendingEventCount() + this.getSentEventCount();
408
+ }
409
+ getUniquePluginIdentifier() {
410
+ return `${this.name}-${this.sessionId}`;
411
+ }
412
+ setupPlugin() {}
413
+ async sendEvent(e, n) {
414
+ if (this.__queue.enqueue(e), !n) {
415
+ this.__status = t.RESTRICTED, this.__epigraphNotifier.updateStatus(this.__status);
416
+ return;
417
+ }
418
+ await this.dequeueAndSendEvents();
419
+ }
420
+ async dequeueAndSendEvents() {
421
+ for (; this.__queue.size > 0;) {
422
+ let e = this.__queue.dequeue(), t = {
423
+ action: e.eventName,
424
+ product_id: this.productId,
425
+ identifier: this.identifier,
426
+ identifier_type: this.identifierType,
427
+ experience_type: this.experienceType,
428
+ render_mode: this.renderMode,
429
+ parameters: e.getNexusParameters()
430
+ };
431
+ try {
432
+ (await fetch(this.url, {
433
+ method: "POST",
434
+ headers: {
435
+ "Content-Type": "application/json",
436
+ Accept: "application/json",
437
+ "EPG-SESSION-ID": this.sessionId,
438
+ "EPG-XPATH": this.xPath,
439
+ Origin: typeof window < "u" ? window.location.origin : ""
440
+ },
441
+ body: JSON.stringify(t)
442
+ })).ok && (this.__sentEventCount++, this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, t));
443
+ } catch {
444
+ return;
445
+ }
446
+ }
447
+ }
448
+ }, m = class {
449
+ constructor(e) {
450
+ this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
451
+ }
452
+ hasConsent() {
453
+ if (this.consentSet) return this.consent;
454
+ if (window.OnetrustActiveGroups !== void 0) {
455
+ let e = String(window.OnetrustActiveGroups).split(",");
456
+ this.consent = e.includes(this.consentIdentifier), this.consentSet = !0;
457
+ }
458
+ return this.consent;
459
+ }
460
+ addConsentChangedListener() {
461
+ this.hasConsent(), this.registerOnConsentChanged(20);
462
+ }
463
+ registerOnConsentChanged(e) {
464
+ if (window.OneTrust !== void 0 && typeof window.OneTrust == "object" && typeof window.OneTrust.OnConsentChanged == "function") {
465
+ window.OneTrust.OnConsentChanged(() => {
466
+ this.consentSet = !1, this.hasConsent();
467
+ });
468
+ return;
469
+ }
470
+ e > 0 && setTimeout(() => this.registerOnConsentChanged(e - 1), 1e3);
471
+ }
472
+ }, h = /* @__PURE__ */ function(e) {
473
+ return e.OneTrust = "onetrust", e;
474
+ }({}), g = class {
475
+ resolve() {
476
+ let e = this.readGoogleConsentMode();
477
+ if (e !== "unknown") return e;
478
+ let t = this.readCookiebot();
479
+ return t === "unknown" ? this.readOneTrust() : t;
480
+ }
481
+ readGoogleConsentMode() {
482
+ let e = window.google_tag_data?.ics;
483
+ if (!e || e.active !== !0 || !e.entries) return "unknown";
484
+ let t = e.entries.analytics_storage;
485
+ return t ? typeof t.update == "boolean" ? t.update ? "granted" : "denied" : typeof t.default == "boolean" ? t.default ? "granted" : "denied" : "unknown" : "unknown";
486
+ }
487
+ readCookiebot() {
488
+ let e = window.Cookiebot;
489
+ return !e || !e.consent || e.hasResponse !== !0 ? "unknown" : e.consent.statistics === !0 ? "granted" : "denied";
490
+ }
491
+ readOneTrust() {
492
+ let e = window.OnetrustActiveGroups;
493
+ return typeof e != "string" || e.length === 0 ? "unknown" : e.split(",").includes("C0002") ? "granted" : "denied";
494
+ }
495
+ }, _ = class {
496
+ constructor({ eventName: e, interactiveEvent: t, customParameters: n }) {
497
+ this.eventName = e, this.interactiveEvent = t, this.customParameters = n;
498
+ }
499
+ getGa4Parameters(e, t, n) {
500
+ let r = {
501
+ solution: e,
502
+ experience_id: t,
503
+ interactive_event: this.interactiveEvent,
504
+ send_to: n
505
+ };
506
+ return r = Object.assign(r, JSON.parse(JSON.stringify(this.customParameters))), r;
507
+ }
508
+ getGTMParameters(e, t, n) {
509
+ let r = {
510
+ solution: e,
511
+ experience_id: t,
512
+ event: this.eventName,
513
+ interactive_event: this.interactiveEvent,
514
+ send_to: n
515
+ };
516
+ return r = Object.assign(r, JSON.parse(JSON.stringify(this.customParameters))), r;
517
+ }
518
+ getNexusParameters() {
519
+ let e = { interactive_event: this.interactiveEvent };
520
+ return e = Object.assign(e, JSON.parse(JSON.stringify(this.customParameters))), e;
521
+ }
522
+ }, v = /* @__PURE__ */ function(e) {
523
+ return e.VARIANT = "variant", e.CATEGORY_VARIANT = "category_variant", e.GEOMETRY = "geometry", e.CATEGORY_GEOMETRY = "category_geometry", e.GLOBAL = "global", e;
524
+ }({}), y = /* @__PURE__ */ function(e) {
525
+ return e.AR = "ar", e.QR = "qr", e.INFO = "info", e.INSTRUCTIONS = "instructions", e.DOWNLOAD = "download", e.PREVIEW_CART = "preview_cart", e.HOTSPOT_PANEL = "hotspot_panel", e.SHARE_MODAL = "share_modal", e.RESTART_MODAL = "restart_modal", e.REMOVE_MODAL = "remove_modal", e.LOAD_PRECONFIG_MODAL = "load_preconfig_modal", e.MOVE_MODAL = "move_modal", e.OUT_OF_STOCK_MODAL = "out_of_stock_modal", e;
526
+ }({}), b = /* @__PURE__ */ function(e) {
527
+ return e.NETWORK = "network", e.EXPERIENCE_CONFIG_ERROR = "experience-config-error", e.SCENE_LOAD_ERROR = "scene-load-error", e.INITIAL_SCENE_LOAD_ERROR = "initial-scene-load-error", e.AUTHENTICATION_FAILED = "authentication-failed", e;
528
+ }({}), x = /* @__PURE__ */ function(e) {
529
+ return e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", e;
530
+ }({}), S = /* @__PURE__ */ function(e) {
531
+ return e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e;
532
+ }({}), C = /* @__PURE__ */ function(e) {
533
+ return e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e;
534
+ }({}), w = /* @__PURE__ */ function(e) {
535
+ return e.AR_VIEW = "ar_view", e.DIMENSION_TOGGLE = "dimension_toggle", e.HOTSPOTS_TOGGLE = "hotspots_toggle", e.HELP_TOGGLE = "help_toggle", e.UTILITY_MENU_TOGGLE = "utility_menu_toggle", e.HOTSPOT_ENTER = "hotspot_enter", e.HOTSPOT_EXIT = "hotspot_exit", e.SHARE = "share", e.PDF_DOWNLOAD = "pdf_download", e.COPY = "copy", e.RESTART = "restart", e.INSTRUCTIONS_SHOW = "show_instructions", e.REVIEW_CART = "review_cart", e.SHOP_NOW = "shop_now", e.SUB_CATEGORY = "sub_category", e.NEXT_STEP = "next_step", e.PREVIOUS_STEP = "previous_step", e;
536
+ }({}), T = /* @__PURE__ */ function(e) {
537
+ return e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", e;
538
+ }({}), E = /* @__PURE__ */ function(e) {
539
+ return e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e;
540
+ }({}), D = /* @__PURE__ */ function(e) {
541
+ return e.FACEBOOK = "facebook", e.TWITTER = "twitter", e.EMAIL = "email", e.COPY_LINK = "copy_link", e.WHATSAPP = "whatsapp", e.LINKEDIN = "linkedin", e;
542
+ }({}), O = class extends _ {
543
+ constructor(e) {
544
+ super({
545
+ eventName: "epigraph_ar_requested",
546
+ interactiveEvent: !0,
547
+ customParameters: { items: e }
548
+ });
549
+ }
550
+ }, k = class extends _ {
551
+ constructor(e) {
552
+ super({
553
+ eventName: "epigraph_module_loading",
554
+ interactiveEvent: !1,
555
+ customParameters: { is_pre_config: e }
556
+ });
557
+ }
558
+ }, A = class extends _ {
559
+ constructor(e, t) {
560
+ super({
561
+ eventName: "epigraph_module_ready",
562
+ interactiveEvent: !1,
563
+ customParameters: {
564
+ is_pre_config: e,
565
+ load_time_ms: t
566
+ }
567
+ });
568
+ }
569
+ }, j = class extends _ {
570
+ static {
571
+ this.MODULE_FAILED_ERRORS = b;
572
+ }
573
+ constructor(e, t, n) {
574
+ super({
575
+ eventName: "epigraph_module_failed",
576
+ interactiveEvent: !1,
577
+ customParameters: {
578
+ is_pre_config: e,
579
+ load_time_ms: t,
580
+ error_type: n
581
+ }
582
+ });
583
+ }
584
+ }, M = class extends _ {
585
+ constructor(e) {
586
+ super({
587
+ eventName: "epigraph_module_closed",
588
+ interactiveEvent: !0,
589
+ customParameters: { items: e }
590
+ });
591
+ }
592
+ }, N = class extends _ {
593
+ static {
594
+ this.SUPPORT_TYPE = C;
595
+ }
596
+ constructor(e) {
597
+ super({
598
+ eventName: "epigraph_support_detected",
599
+ interactiveEvent: !1,
600
+ customParameters: { support_type: e }
601
+ });
602
+ }
603
+ }, P = class extends _ {
604
+ static {
605
+ this.BUTTON_TYPE = w;
606
+ }
607
+ constructor(e, t) {
608
+ super({
609
+ eventName: "epigraph_button_click",
610
+ interactiveEvent: !0,
611
+ customParameters: {
612
+ button_type: e,
613
+ button_name: t
614
+ }
615
+ });
616
+ }
617
+ }, F = class extends _ {
618
+ static {
619
+ this.PANEL_TYPE = y;
620
+ }
621
+ static {
622
+ this.TRIGGER_SOURCE = x;
623
+ }
624
+ constructor(e, t, n, r) {
625
+ super({
626
+ eventName: "epigraph_panel_opened",
627
+ interactiveEvent: e,
628
+ customParameters: {
629
+ items: r,
630
+ panel_type: t,
631
+ trigger_source: n
632
+ }
633
+ });
634
+ }
635
+ }, I = class extends _ {
636
+ static {
637
+ this.PANEL_TYPE = y;
638
+ }
639
+ static {
640
+ this.TRIGGER_SOURCE = x;
641
+ }
642
+ constructor(e, t, n, r) {
643
+ super({
644
+ eventName: "epigraph_panel_closed",
645
+ interactiveEvent: e,
646
+ customParameters: {
647
+ items: r,
648
+ panel_type: t,
649
+ trigger_source: n
650
+ }
651
+ });
652
+ }
653
+ }, L = class extends _ {
654
+ constructor(e) {
655
+ super({
656
+ eventName: "epigraph_add_to_favourites",
657
+ interactiveEvent: !0,
658
+ customParameters: { items: e }
659
+ });
660
+ }
661
+ }, R = class extends _ {
662
+ static {
663
+ this.ACTION_PERFORMED = T;
664
+ }
665
+ constructor(e) {
666
+ super({
667
+ eventName: "epigraph_keyboard_interaction",
668
+ interactiveEvent: !0,
669
+ customParameters: { action_performed: e }
670
+ });
671
+ }
672
+ }, z = class extends _ {
673
+ static {
674
+ this.INTERACTION_TYPE = T;
675
+ }
676
+ constructor(e) {
677
+ super({
678
+ eventName: "epigraph_touch_interaction",
679
+ interactiveEvent: !0,
680
+ customParameters: { interaction_type: e }
681
+ });
682
+ }
683
+ }, B = class extends _ {
684
+ static {
685
+ this.CURRENCY = S;
686
+ }
687
+ constructor(e, t, n, r, i) {
688
+ super({
689
+ eventName: "epigraph_item_added",
690
+ interactiveEvent: e,
691
+ customParameters: {
692
+ items: i,
693
+ value: t,
694
+ currency: n,
695
+ quantity: r
696
+ }
697
+ });
698
+ }
699
+ }, V = class extends _ {
700
+ constructor(e) {
701
+ super({
702
+ eventName: "epigraph_item_moved",
703
+ interactiveEvent: !0,
704
+ customParameters: { items: e }
705
+ });
706
+ }
707
+ }, H = class extends _ {
708
+ static {
709
+ this.CURRENCY = S;
710
+ }
711
+ constructor(e, t, n, r) {
712
+ super({
713
+ eventName: "epigraph_item_removed",
714
+ interactiveEvent: !0,
715
+ customParameters: {
716
+ items: r,
717
+ value: e,
718
+ currency: t,
719
+ quantity: n
720
+ }
721
+ });
722
+ }
723
+ }, U = class extends _ {
724
+ static {
725
+ this.VARIANT_CHANGE_TYPES = v;
726
+ }
727
+ constructor(e, t) {
728
+ super({
729
+ eventName: "epigraph_variant_changed",
730
+ interactiveEvent: !0,
731
+ customParameters: {
732
+ items: t,
733
+ change_type: e
734
+ }
735
+ });
736
+ }
737
+ }, W = class extends _ {
738
+ static {
739
+ this.CONTENT_TYPES = E;
740
+ }
741
+ static {
742
+ this.SHARE_DESTINATIONS = D;
743
+ }
744
+ constructor(e, t, n) {
745
+ super({
746
+ eventName: "epigraph_content_shared",
747
+ interactiveEvent: !0,
748
+ customParameters: {
749
+ items: n,
750
+ content_type: e,
751
+ share_destination: t
752
+ }
753
+ });
754
+ }
755
+ }, G = class extends _ {
756
+ static {
757
+ this.CURRENCY = S;
758
+ }
759
+ constructor(e, t, n) {
760
+ super({
761
+ eventName: "epigraph_checkout",
762
+ interactiveEvent: !0,
763
+ customParameters: {
764
+ items: n,
765
+ value: e,
766
+ currency: t
767
+ }
768
+ });
769
+ }
770
+ }, K = class extends _ {
771
+ static {
772
+ this.CURRENCY = S;
773
+ }
774
+ constructor(e, t, n) {
775
+ super({
776
+ eventName: "epigraph_conversion",
777
+ interactiveEvent: !0,
778
+ customParameters: {
779
+ items: n,
780
+ value: e,
781
+ currency: t
782
+ }
783
+ });
784
+ }
785
+ }, q = class extends _ {
786
+ constructor(e) {
787
+ super({
788
+ eventName: "epigraph_changeRate",
789
+ interactiveEvent: !1,
790
+ customParameters: { value: e }
791
+ });
792
+ }
793
+ }, J = class extends _ {
794
+ constructor(e) {
795
+ super({
796
+ eventName: "epigraph_completionRate",
797
+ interactiveEvent: !1,
798
+ customParameters: { value: e }
799
+ });
800
+ }
801
+ }, Y = class extends _ {
802
+ constructor(e) {
803
+ super({
804
+ eventName: "epigraph_engagementRate",
805
+ interactiveEvent: !1,
806
+ customParameters: { value: e }
807
+ });
808
+ }
809
+ }, X = class extends _ {
810
+ constructor(e, t, n) {
811
+ super({
812
+ eventName: e,
813
+ interactiveEvent: t,
814
+ customParameters: n
815
+ });
816
+ }
817
+ }, Z = Symbol("analyticsPluginsMap"), Q = class {
818
+ constructor(e, n, r) {
819
+ this[Z] = /* @__PURE__ */ new Map(), this.__consentPlugin = null, this.__autoConsentResolver = new g(), this.__onConsentChangeFromEvent = (e) => {
820
+ let n = e;
821
+ this.__overrideConsent = n.detail.hasConsent;
822
+ for (let e of this[Z].values()) this.__resolveConsent() !== "granted" && e.setStatus(t.RESTRICTED);
823
+ }, this.__defaultConsent = r?.defaultConsent ?? !0, e && n && (this.__consentPlugin = this.buildConsentPlugin(e, n)), window.addEventListener("epigraphAnalyticsConsentChange", this.__onConsentChangeFromEvent);
824
+ }
825
+ addEventPlugin(e) {
826
+ this[Z].has(e.getUniquePluginIdentifier()) || (this[Z].set(e.getUniquePluginIdentifier(), e), e.setupPlugin());
827
+ }
828
+ __resolveConsent() {
829
+ if (this.__overrideConsent !== void 0) return this.__overrideConsent ? "granted" : "denied";
830
+ if (this.__consentPlugin) return this.__consentPlugin.hasConsent() ? "granted" : "denied";
831
+ let e = this.__autoConsentResolver.resolve();
832
+ return e === "unknown" ? this.__defaultConsent ? "granted" : "unknown" : e;
833
+ }
834
+ sendEvent(e) {
835
+ let n = this.__resolveConsent();
836
+ if (n === "denied") {
837
+ this[Z].forEach((e) => {
838
+ e.setStatus(t.RESTRICTED);
839
+ });
840
+ return;
841
+ }
842
+ this[Z].forEach((t) => {
843
+ t.sendEvent(e, n === "granted");
844
+ });
845
+ }
846
+ buildConsentPlugin(e, t) {
847
+ return e.toLowerCase() === h.OneTrust.toLowerCase() ? new m(t) : null;
848
+ }
849
+ };
850
+ //#endregion
851
+ export { y as A, d as B, A as C, z as D, N as E, g as F, h as I, m as L, C as M, x as N, U as O, v as P, p as R, k as S, F as T, V as _, S as a, M as b, P as c, J as d, W as f, B as g, Y as h, E as i, D as j, b as k, q as l, X as m, T as n, L as o, K as p, w as r, O as s, Q as t, G as u, H as v, I as w, j as x, R as y, f as z };