@epigraph/epigraph-std-lib 5.0.0-alpha.10 → 5.0.0-alpha.12

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