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

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 (37) 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/epigraphAnalytics.cjs +1 -16
  7. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +2 -1057
  8. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalyticsEventLibrary.d.ts +1 -0
  9. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -1
  10. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.js +74 -198
  11. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -1
  12. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +197 -425
  13. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +1 -7
  14. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +2 -78
  15. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -1
  16. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js +24 -26
  17. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -1
  18. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +2 -88
  19. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
  20. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +44 -75
  21. package/dist/enums-BSSe4NAs.js +8 -0
  22. package/dist/enums-PfFMiIoe.cjs +1 -0
  23. package/dist/epigraph-std-lib.cjs +1 -1
  24. package/dist/epigraph-std-lib.js +11 -74
  25. package/dist/epigraphAnalytics-Cl98luUT.cjs +1 -0
  26. package/dist/epigraphAnalytics-DzLB3jQX.js +811 -0
  27. package/dist/epigraphQrCodeGenerator-BXUNL2XK.js +54 -0
  28. package/dist/epigraphQrCodeGenerator-F2eLrPC_.cjs +7 -0
  29. package/dist/epigraphUnitsConverter-CwpmWl7p.cjs +1 -0
  30. package/dist/epigraphUnitsConverter-DsX4Rmsp.js +66 -0
  31. package/dist/lit--5TUYSGn.js +508 -0
  32. package/dist/lit-DZtv4Pds.cjs +2 -0
  33. package/package.json +40 -40
  34. package/dist/enums-1vqWxJ0i.cjs +0 -1
  35. package/dist/enums-CvOTKyNu.js +0 -5
  36. package/dist/lit-element-C3moVMGu.js +0 -524
  37. package/dist/lit-element-CYaaFRfk.cjs +0 -19
@@ -0,0 +1,811 @@
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.__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.enqueue(e), !n) {
131
+ this.__status = t.RESTRICTED;
132
+ return;
133
+ }
134
+ if (!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
+ if (this.__initializationAttempts >= this.__maxInitializationAttempts) {
150
+ this.__nexusFailureReported || (this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS", "Maximum initialization attempts reached"), this.__nexusFailureReported = !0, this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION, {}));
151
+ return;
152
+ }
153
+ let e = performance.now();
154
+ if (this.__initializationAttempts > 0 && e - this.__lastInitializationAttempt < this.__initializationRetryDelay) return;
155
+ this.__lastInitializationAttempt = e, this.__initializationAttempts++;
156
+ let n = this.detectAndSetupAnalytics();
157
+ n.success ? (this.__isInitialized = !0, this.__status = t.AVAILABLE, this.__initializationMethod = n.method, this.dataLayerName = n.dataLayerName, this.dataLayer = 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(() => {
158
+ this.initializePlugin();
159
+ }, this.__initializationRetryDelay));
160
+ }
161
+ detectAndSetupAnalytics() {
162
+ let e = this.detectGTM();
163
+ if (e) return this.logger(`GTM detected with container ID: ${e.containerId}`), this.__epigraphNotifier.updateInitializer("GTM"), {
164
+ success: !0,
165
+ method: "GTM",
166
+ dataLayerName: e.dataLayerName
167
+ };
168
+ let t = this.findGA4Info(this.trackingID);
169
+ if (t) {
170
+ let e = t.l || "dataLayer";
171
+ return this.logger(`GA4 script found, setting up with dataLayer: ${e}`), this.__epigraphNotifier.updateInitializer("GA4"), {
172
+ success: !0,
173
+ method: "GA4",
174
+ dataLayerName: e
175
+ };
176
+ }
177
+ return {
178
+ success: !1,
179
+ method: "NONE",
180
+ dataLayerName: "dataLayer",
181
+ error: "No analytics setup found and unable to create one"
182
+ };
183
+ }
184
+ detectGTM() {
185
+ let e = document.querySelectorAll("script[src*=\"googletagmanager.com/gtm\"]");
186
+ for (let t of Array.from(e)) {
187
+ let e = t.getAttribute("src");
188
+ if (e) {
189
+ let t = e.match(/gtm\.js\?id=([^&]+)/);
190
+ if (t && t.length > 0) {
191
+ let n = e.match(/&l=([^&]+)/), r = n ? n[1] : "dataLayer";
192
+ return {
193
+ containerId: t[1],
194
+ dataLayerName: r
195
+ };
196
+ }
197
+ }
198
+ }
199
+ return null;
200
+ }
201
+ async dequeueAndSendEvents() {
202
+ if (!this.__isInitialized || !this.dataLayer) return;
203
+ let e = this.__queue.size;
204
+ for (let t = 0; t < e; t++) {
205
+ let e = this.__queue.dequeue();
206
+ try {
207
+ 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);
208
+ } catch (t) {
209
+ this.logger(`Error sending event ${e.eventName}: ${t}`), this.__queue.enqueue(e);
210
+ }
211
+ }
212
+ }
213
+ async sendGTMEvent(e) {
214
+ let t = e.getGTMParameters(this.solution, this.experienceID, this.trackingID), n = t;
215
+ this.isValidPayload(t) || (t = await this.convertGTMParametersToEpgEventTag(e.eventName, t)), this.dataLayer && (this.dataLayer.push(t), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, n));
216
+ }
217
+ async sendGA4Event(e) {
218
+ let t = e.getGa4Parameters(this.solution, this.experienceID, this.trackingID), n = t;
219
+ this.isValidPayload(t) || (t = await this.convertGA4ParametersToEpgEventTag(t)), this.dataLayer && (this.dataLayer?.push(t), this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, n));
220
+ }
221
+ isValidPayload(e) {
222
+ if (Object.keys(e).length >= 25) return !1;
223
+ for (let [t, n] of Object.entries(e)) if (t !== "items" && (t.length > 40 || String(n).length > 100)) return !1;
224
+ return !0;
225
+ }
226
+ async convertGTMParametersToEpgEventTag(e, t) {
227
+ try {
228
+ return {
229
+ event: e,
230
+ epg_event_tag: await this.sendGA4LongParameters(t),
231
+ send_to: this.trackingID
232
+ };
233
+ } catch {
234
+ return t;
235
+ }
236
+ }
237
+ async convertGA4ParametersToEpgEventTag(e) {
238
+ try {
239
+ return {
240
+ epg_event_tag: await this.sendGA4LongParameters(e),
241
+ send_to: this.trackingID
242
+ };
243
+ } catch {
244
+ return e;
245
+ }
246
+ }
247
+ logger(e) {
248
+ this.verboseLogging && console.warn(e);
249
+ }
250
+ async sendGA4LongParameters(e) {
251
+ let t = { parameters: e };
252
+ try {
253
+ let e = await fetch("https://api.myepigraph.com/api/analytics/ga4/custom", {
254
+ method: "POST",
255
+ headers: {
256
+ "Content-Type": "application/json",
257
+ Accept: "application/json"
258
+ },
259
+ body: JSON.stringify(t)
260
+ });
261
+ return e.ok ? (await e.json())?.id ?? "" : "";
262
+ } catch {
263
+ return "";
264
+ }
265
+ }
266
+ async reportFailureToNexus(e, t) {
267
+ try {
268
+ let n = {
269
+ plugin: "GA4",
270
+ trackingId: this.trackingID,
271
+ solution: this.solution,
272
+ experienceId: this.experienceID,
273
+ failureType: e,
274
+ errorMessage: t,
275
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
276
+ url: window.location.href,
277
+ userAgent: navigator.userAgent
278
+ };
279
+ this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`);
280
+ } catch (e) {
281
+ this.logger(`Error reporting failure to Nexus: ${e}`);
282
+ }
283
+ }
284
+ findGA4Info(e) {
285
+ if (window.google_tag_manager && window.google_tag_manager[e]) {
286
+ let t = window.google_tag_manager[e];
287
+ if (t && t.dataLayerName) return {
288
+ fullSrc: "",
289
+ id: e,
290
+ l: t.dataLayerName
291
+ };
292
+ }
293
+ let t = document.querySelectorAll("script[src]");
294
+ for (let n of t) {
295
+ let t = n.getAttribute("src");
296
+ if (t && t.includes(e)) {
297
+ let e = new URL(t, location.href), n = Object.fromEntries(e.searchParams.entries());
298
+ return {
299
+ fullSrc: e.href,
300
+ id: n.id || void 0,
301
+ l: n.l || void 0
302
+ };
303
+ }
304
+ }
305
+ return null;
306
+ }
307
+ }, f = class {
308
+ constructor({ trackingID: n, experienceID: r, solution: i, sessionId: a, xPath: o, verboseLogging: s = !1, baseUrl: c = e.PRODUCTION }) {
309
+ this.__status = t.UNAVAILABLE, this.__sentEventCount = 0, 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, {});
310
+ }
311
+ getStatus() {
312
+ return this.__status;
313
+ }
314
+ setStatus(e) {
315
+ this.__status = e, this.__epigraphNotifier.updateStatus(e);
316
+ }
317
+ getPendingEventCount() {
318
+ return this.__queue.size;
319
+ }
320
+ getSentEventCount() {
321
+ return this.__sentEventCount;
322
+ }
323
+ getTotalEventCount() {
324
+ return this.getPendingEventCount() + this.getSentEventCount();
325
+ }
326
+ getUniquePluginIdentifier() {
327
+ return this.name + "-" + this.trackingID;
328
+ }
329
+ setupPlugin() {}
330
+ async sendEvent(e, n) {
331
+ if (this.__queue.enqueue(e), !n) {
332
+ this.__status = t.RESTRICTED, this.__epigraphNotifier.updateStatus(this.__status);
333
+ return;
334
+ }
335
+ await this.dequeueAndSendEvents();
336
+ }
337
+ async dequeueAndSendEvents() {
338
+ for (let e = 0; e < this.__queue.size; e++) {
339
+ let e = this.__queue.dequeue(), t = {
340
+ send_to: this.trackingID,
341
+ experience_id: this.experienceID,
342
+ solution: this.solution,
343
+ event: e.eventName,
344
+ parameters: e.getNexusParameters()
345
+ };
346
+ try {
347
+ return (await fetch(this.url, {
348
+ method: "POST",
349
+ headers: {
350
+ "Content-Type": "application/json",
351
+ Accept: "application/json",
352
+ "EPG-SESSION-ID": this.sessionId,
353
+ "EPG-XPATH": this.xPath,
354
+ Origin: typeof window < "u" ? window.location.origin : ""
355
+ },
356
+ body: JSON.stringify(t)
357
+ })).ok && this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, t), "";
358
+ } catch {
359
+ return "";
360
+ }
361
+ this.__sentEventCount++;
362
+ }
363
+ return "";
364
+ }
365
+ }, p = class {
366
+ 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 }) {
367
+ if (this.experienceID = "", this.__status = t.UNAVAILABLE, this.__sentEventCount = 0, n <= 0) throw Error("NexusSolutionsAnalyticsPlugin requires a valid productId greater than 0.");
368
+ 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, {});
369
+ }
370
+ setProductId(e) {
371
+ e <= 0 || (this.productId = e, this.trackingID = String(e));
372
+ }
373
+ setIdentifier(e) {
374
+ this.identifier = e;
375
+ }
376
+ setIdentifierType(e) {
377
+ this.identifierType = e;
378
+ }
379
+ setExperienceType(e) {
380
+ this.experienceType = e;
381
+ }
382
+ setRenderMode(e) {
383
+ this.renderMode = e;
384
+ }
385
+ getStatus() {
386
+ return this.__status;
387
+ }
388
+ setStatus(e) {
389
+ this.__status = e, this.__epigraphNotifier.updateStatus(e);
390
+ }
391
+ getPendingEventCount() {
392
+ return this.__queue.size;
393
+ }
394
+ getSentEventCount() {
395
+ return this.__sentEventCount;
396
+ }
397
+ getTotalEventCount() {
398
+ return this.getPendingEventCount() + this.getSentEventCount();
399
+ }
400
+ getUniquePluginIdentifier() {
401
+ return `${this.name}-${this.sessionId}`;
402
+ }
403
+ setupPlugin() {}
404
+ async sendEvent(e, n) {
405
+ if (this.__queue.enqueue(e), !n) {
406
+ this.__status = t.RESTRICTED, this.__epigraphNotifier.updateStatus(this.__status);
407
+ return;
408
+ }
409
+ await this.dequeueAndSendEvents();
410
+ }
411
+ async dequeueAndSendEvents() {
412
+ for (; this.__queue.size > 0;) {
413
+ let e = this.__queue.dequeue(), t = {
414
+ action: e.eventName,
415
+ product_id: this.productId,
416
+ identifier: this.identifier,
417
+ identifier_type: this.identifierType,
418
+ experience_type: this.experienceType,
419
+ render_mode: this.renderMode,
420
+ parameters: e.getNexusParameters()
421
+ };
422
+ try {
423
+ (await fetch(this.url, {
424
+ method: "POST",
425
+ headers: {
426
+ "Content-Type": "application/json",
427
+ Accept: "application/json",
428
+ "EPG-SESSION-ID": this.sessionId,
429
+ "EPG-XPATH": this.xPath,
430
+ Origin: typeof window < "u" ? window.location.origin : ""
431
+ },
432
+ body: JSON.stringify(t)
433
+ })).ok && (this.__sentEventCount++, this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT, t));
434
+ } catch {
435
+ return;
436
+ }
437
+ }
438
+ }
439
+ }, m = class {
440
+ constructor(e) {
441
+ this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
442
+ }
443
+ hasConsent() {
444
+ if (this.consentSet) return this.consent;
445
+ if (window.OnetrustActiveGroups !== void 0) {
446
+ let e = window.OnetrustActiveGroups;
447
+ e !== void 0 && e.split(",").forEach((e) => {
448
+ e === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
449
+ });
450
+ }
451
+ return this.consent;
452
+ }
453
+ addConsentChangedListener() {
454
+ window.addEventListener("load", () => {
455
+ this.hasConsent(), window.OneTrust !== void 0 && typeof window.OneTrust == "object" && window.OneTrust.OnConsentChanged(() => {
456
+ this.consentSet = !1, this.hasConsent();
457
+ });
458
+ });
459
+ }
460
+ }, h = /* @__PURE__ */ function(e) {
461
+ return e.OneTrust = "onetrust", e;
462
+ }({}), g = class {
463
+ constructor({ eventName: e, interactiveEvent: t, customParameters: n }) {
464
+ this.eventName = e, this.interactiveEvent = t, this.customParameters = n;
465
+ }
466
+ getGa4Parameters(e, t, n) {
467
+ let r = {
468
+ solution: e,
469
+ experience_id: t,
470
+ event: this.eventName,
471
+ interactive_event: this.interactiveEvent,
472
+ send_to: n
473
+ };
474
+ return r = Object.assign(r, JSON.parse(JSON.stringify(this.customParameters))), r;
475
+ }
476
+ getGTMParameters(e, t, n) {
477
+ let r = {
478
+ solution: e,
479
+ experience_id: t,
480
+ event: this.eventName,
481
+ interactive_event: this.interactiveEvent,
482
+ send_to: n
483
+ };
484
+ return r = Object.assign(r, JSON.parse(JSON.stringify(this.customParameters))), r;
485
+ }
486
+ getNexusParameters() {
487
+ let e = { interactive_event: this.interactiveEvent };
488
+ return e = Object.assign(e, JSON.parse(JSON.stringify(this.customParameters))), e;
489
+ }
490
+ }, _ = /* @__PURE__ */ function(e) {
491
+ return e.VARIANT = "variant", e.CATEGORY_VARIANT = "category_variant", e.GEOMETRY = "geometry", e.CATEGORY_GEOMETRY = "category_geometry", e.GLOBAL = "global", e;
492
+ }({}), v = /* @__PURE__ */ function(e) {
493
+ 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;
494
+ }({}), y = /* @__PURE__ */ function(e) {
495
+ 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;
496
+ }({}), b = /* @__PURE__ */ function(e) {
497
+ return e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", e;
498
+ }({}), x = /* @__PURE__ */ function(e) {
499
+ return e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e;
500
+ }({}), S = /* @__PURE__ */ function(e) {
501
+ return e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e;
502
+ }({}), C = /* @__PURE__ */ function(e) {
503
+ 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;
504
+ }({}), w = /* @__PURE__ */ function(e) {
505
+ return e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", e;
506
+ }({}), T = /* @__PURE__ */ function(e) {
507
+ return e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e;
508
+ }({}), E = /* @__PURE__ */ function(e) {
509
+ return e.FACEBOOK = "facebook", e.TWITTER = "twitter", e.EMAIL = "email", e.COPY_LINK = "copy_link", e.WHATSAPP = "whatsapp", e.LINKEDIN = "linkedin", e;
510
+ }({}), D = class extends g {
511
+ constructor(e) {
512
+ super({
513
+ eventName: "epigraph_ar_requested",
514
+ interactiveEvent: !0,
515
+ customParameters: { items: e }
516
+ });
517
+ }
518
+ }, O = class extends g {
519
+ constructor(e) {
520
+ super({
521
+ eventName: "epigraph_module_loading",
522
+ interactiveEvent: !1,
523
+ customParameters: { is_pre_config: e }
524
+ });
525
+ }
526
+ }, k = class extends g {
527
+ constructor(e, t) {
528
+ super({
529
+ eventName: "epigraph_module_ready",
530
+ interactiveEvent: !1,
531
+ customParameters: {
532
+ is_pre_config: e,
533
+ load_time_ms: t
534
+ }
535
+ });
536
+ }
537
+ }, A = class extends g {
538
+ static {
539
+ this.MODULE_FAILED_ERRORS = y;
540
+ }
541
+ constructor(e, t, n) {
542
+ super({
543
+ eventName: "epigraph_module_failed",
544
+ interactiveEvent: !1,
545
+ customParameters: {
546
+ is_pre_config: e,
547
+ load_time_ms: t,
548
+ error_type: n
549
+ }
550
+ });
551
+ }
552
+ }, j = class extends g {
553
+ constructor(e) {
554
+ super({
555
+ eventName: "epigraph_module_closed",
556
+ interactiveEvent: !0,
557
+ customParameters: { items: e }
558
+ });
559
+ }
560
+ }, M = class extends g {
561
+ static {
562
+ this.SUPPORT_TYPE = S;
563
+ }
564
+ constructor(e) {
565
+ super({
566
+ eventName: "epigraph_support_detected",
567
+ interactiveEvent: !1,
568
+ customParameters: { support_type: e }
569
+ });
570
+ }
571
+ }, N = class extends g {
572
+ static {
573
+ this.BUTTON_TYPE = C;
574
+ }
575
+ constructor(e, t) {
576
+ super({
577
+ eventName: "epigraph_button_click",
578
+ interactiveEvent: !0,
579
+ customParameters: {
580
+ button_type: e,
581
+ button_name: t
582
+ }
583
+ });
584
+ }
585
+ }, P = class extends g {
586
+ static {
587
+ this.PANEL_TYPE = v;
588
+ }
589
+ static {
590
+ this.TRIGGER_SOURCE = b;
591
+ }
592
+ constructor(e, t, n, r) {
593
+ super({
594
+ eventName: "epigraph_panel_opened",
595
+ interactiveEvent: e,
596
+ customParameters: {
597
+ items: r,
598
+ panel_type: t,
599
+ trigger_source: n
600
+ }
601
+ });
602
+ }
603
+ }, F = class extends g {
604
+ static {
605
+ this.PANEL_TYPE = v;
606
+ }
607
+ static {
608
+ this.TRIGGER_SOURCE = b;
609
+ }
610
+ constructor(e, t, n, r) {
611
+ super({
612
+ eventName: "epigraph_panel_closed",
613
+ interactiveEvent: e,
614
+ customParameters: {
615
+ items: r,
616
+ panel_type: t,
617
+ trigger_source: n
618
+ }
619
+ });
620
+ }
621
+ }, I = class extends g {
622
+ constructor(e) {
623
+ super({
624
+ eventName: "epigraph_add_to_favourites",
625
+ interactiveEvent: !0,
626
+ customParameters: { items: e }
627
+ });
628
+ }
629
+ }, L = class extends g {
630
+ static {
631
+ this.ACTION_PERFORMED = w;
632
+ }
633
+ constructor(e) {
634
+ super({
635
+ eventName: "epigraph_keyboard_interaction",
636
+ interactiveEvent: !0,
637
+ customParameters: { action_performed: e }
638
+ });
639
+ }
640
+ }, R = class extends g {
641
+ static {
642
+ this.INTERACTION_TYPE = w;
643
+ }
644
+ constructor(e) {
645
+ super({
646
+ eventName: "epigraph_touch_interaction",
647
+ interactiveEvent: !0,
648
+ customParameters: { interaction_type: e }
649
+ });
650
+ }
651
+ }, z = class extends g {
652
+ static {
653
+ this.CURRENCY = x;
654
+ }
655
+ constructor(e, t, n, r, i) {
656
+ super({
657
+ eventName: "epigraph_item_added",
658
+ interactiveEvent: e,
659
+ customParameters: {
660
+ items: i,
661
+ value: t,
662
+ currency: n,
663
+ quantity: r
664
+ }
665
+ });
666
+ }
667
+ }, B = class extends g {
668
+ constructor(e) {
669
+ super({
670
+ eventName: "epigraph_item_moved",
671
+ interactiveEvent: !0,
672
+ customParameters: { items: e }
673
+ });
674
+ }
675
+ }, V = class extends g {
676
+ static {
677
+ this.CURRENCY = x;
678
+ }
679
+ constructor(e, t, n, r) {
680
+ super({
681
+ eventName: "epigraph_item_removed",
682
+ interactiveEvent: !0,
683
+ customParameters: {
684
+ items: r,
685
+ value: e,
686
+ currency: t,
687
+ quantity: n
688
+ }
689
+ });
690
+ }
691
+ }, H = class extends g {
692
+ static {
693
+ this.VARIANT_CHANGE_TYPES = _;
694
+ }
695
+ constructor(e, t) {
696
+ super({
697
+ eventName: "epigraph_variant_changed",
698
+ interactiveEvent: !0,
699
+ customParameters: {
700
+ items: t,
701
+ change_type: e
702
+ }
703
+ });
704
+ }
705
+ }, U = class extends g {
706
+ static {
707
+ this.CONTENT_TYPES = T;
708
+ }
709
+ static {
710
+ this.SHARE_DESTINATIONS = E;
711
+ }
712
+ constructor(e, t, n) {
713
+ super({
714
+ eventName: "epigraph_content_shared",
715
+ interactiveEvent: !0,
716
+ customParameters: {
717
+ items: n,
718
+ content_type: e,
719
+ share_destination: t
720
+ }
721
+ });
722
+ }
723
+ }, W = class extends g {
724
+ static {
725
+ this.CURRENCY = x;
726
+ }
727
+ constructor(e, t, n) {
728
+ super({
729
+ eventName: "epigraph_checkout",
730
+ interactiveEvent: !0,
731
+ customParameters: {
732
+ items: n,
733
+ value: e,
734
+ currency: t
735
+ }
736
+ });
737
+ }
738
+ }, G = class extends g {
739
+ static {
740
+ this.CURRENCY = x;
741
+ }
742
+ constructor(e, t, n) {
743
+ super({
744
+ eventName: "epigraph_conversion",
745
+ interactiveEvent: !0,
746
+ customParameters: {
747
+ items: n,
748
+ value: e,
749
+ currency: t
750
+ }
751
+ });
752
+ }
753
+ }, K = class extends g {
754
+ constructor(e) {
755
+ super({
756
+ eventName: "epigraph_changeRate",
757
+ interactiveEvent: !1,
758
+ customParameters: { value: e }
759
+ });
760
+ }
761
+ }, q = class extends g {
762
+ constructor(e) {
763
+ super({
764
+ eventName: "epigraph_completionRate",
765
+ interactiveEvent: !1,
766
+ customParameters: { value: e }
767
+ });
768
+ }
769
+ }, J = class extends g {
770
+ constructor(e) {
771
+ super({
772
+ eventName: "epigraph_engagementRate",
773
+ interactiveEvent: !1,
774
+ customParameters: { value: e }
775
+ });
776
+ }
777
+ }, Y = class extends g {
778
+ constructor(e, t, n) {
779
+ super({
780
+ eventName: e,
781
+ interactiveEvent: t,
782
+ customParameters: n
783
+ });
784
+ }
785
+ }, X = Symbol("analyticsPluginsMap"), Z = class {
786
+ constructor(e, t) {
787
+ this[X] = /* @__PURE__ */ new Map(), this.__consentPlugin = null, e && t && (this.__consentPlugin = this.buildConsentPlugin(e, t)), window.addEventListener("epigraphAnalyticsConsentChange", this.__onConsentChangeFromEvent);
788
+ }
789
+ __onConsentChangeFromEvent(e) {
790
+ let n = e;
791
+ this.__overrideConsent = n.detail.hasConsent;
792
+ for (let e of this[X].values()) this.__hasConsent() || e.setStatus(t.RESTRICTED);
793
+ }
794
+ addEventPlugin(e) {
795
+ this[X].has(e.getUniquePluginIdentifier()) || (this[X].set(e.getUniquePluginIdentifier(), e), e.setupPlugin());
796
+ }
797
+ __hasConsent() {
798
+ let e = !0;
799
+ return this.__overrideConsent === void 0 ? (this.__consentPlugin && (e = this.__consentPlugin.hasConsent()), e) : (e = this.__overrideConsent, e);
800
+ }
801
+ sendEvent(e) {
802
+ this[X].forEach((t) => {
803
+ t.sendEvent(e, this.__hasConsent());
804
+ });
805
+ }
806
+ buildConsentPlugin(e, t) {
807
+ return e.toLowerCase() === h.OneTrust.toLowerCase() ? new m(t) : null;
808
+ }
809
+ };
810
+ //#endregion
811
+ export { v as A, k as C, R as D, M as E, h as F, m as I, p as L, S as M, b as N, H as O, _ as P, f as R, O as S, P as T, B as _, x as a, j as b, N as c, q as d, U as f, z as g, J as h, T as i, E as j, y as k, K as l, Y as m, w as n, I as o, G as p, C as r, D as s, Z as t, W as u, V as v, F as w, A as x, L as y, d as z };