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

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.
@@ -0,0 +1,21 @@
1
+ export type ConsentSignal = 'granted' | 'denied' | 'unknown';
2
+ /**
3
+ * Resolves the visitor's analytics consent from signals the page already exposes, so consent is
4
+ * honored even when no consent plugin was configured (which is the norm for our installs).
5
+ *
6
+ * Signals, in priority order:
7
+ * 1. Google Consent Mode — every major CMP feeds it, making it a single integration point. The
8
+ * resolved state lives at window.google_tag_data.ics; entries carry default/update booleans per
9
+ * category and ics.active distinguishes "consent mode in use" from the implicit-granted state
10
+ * that exists on pages with no consent setup.
11
+ * 2. Known CMP globals, for pages where the CMP blocks the Google stack from loading at all
12
+ * (so ics never exists): Cookiebot, OneTrust.
13
+ *
14
+ * 'unknown' means no signal is present — the caller decides the default.
15
+ */
16
+ export declare class AutoConsentResolver {
17
+ resolve(): ConsentSignal;
18
+ private readGoogleConsentMode;
19
+ private readCookiebot;
20
+ private readOneTrust;
21
+ }
@@ -10,4 +10,5 @@ export declare class OneTrustConsentPlugin implements IConsentPlugin {
10
10
  */
11
11
  hasConsent(): boolean;
12
12
  private addConsentChangedListener;
13
+ private registerOnConsentChanged;
13
14
  }
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../epigraphAnalytics-Cl98luUT.cjs");exports.ACTION_PERFORMED=e.n,exports.BUTTON_TYPE=e.r,exports.CONTENT_TYPES=e.i,exports.CURRENCY=e.a,exports.ConsentPluginNames=e.F,exports.EpigraphAddToFavouritesEvent=e.o,exports.EpigraphAnalytics=e.t,exports.EpigraphArRequestedEvent=e.s,exports.EpigraphButtonClickEvent=e.c,exports.EpigraphChangeRateEvent=e.l,exports.EpigraphCheckoutEvent=e.u,exports.EpigraphCompletionRateEvent=e.d,exports.EpigraphContentSharedEvent=e.f,exports.EpigraphConversionEvent=e.p,exports.EpigraphCustomEvent=e.m,exports.EpigraphEngagementRateEvent=e.h,exports.EpigraphItemAddedEvent=e.g,exports.EpigraphItemMovedEvent=e._,exports.EpigraphItemRemovedEvent=e.v,exports.EpigraphKeyboardInteractionEvent=e.y,exports.EpigraphModuleClosedEvent=e.b,exports.EpigraphModuleFailedEvent=e.x,exports.EpigraphModuleLoadingEvent=e.S,exports.EpigraphModuleReadyEvent=e.C,exports.EpigraphPanelClosedEvent=e.w,exports.EpigraphPanelOpenedEvent=e.T,exports.EpigraphSupportDetectedEvent=e.E,exports.EpigraphTouchInteractionEvent=e.D,exports.EpigraphVariantChangedEvent=e.O,exports.GA4AnalyticsPlugin=e.z,exports.MODULE_FAILED_ERRORS=e.k,exports.NexusAnalyticsPlugin=e.R,exports.NexusSolutionsAnalyticsPlugin=e.L,exports.OneTrustConsentPlugin=e.I,exports.PANEL_TYPE=e.A,exports.SHARE_DESTINATIONS=e.j,exports.SUPPORT_TYPE=e.M,exports.TRIGGER_SOURCE=e.N,exports.VARIANT_CHANGE_TYPES=e.P;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../epigraphAnalytics-CADAVr-I.cjs");exports.ACTION_PERFORMED=e.n,exports.AutoConsentResolver=e.F,exports.BUTTON_TYPE=e.r,exports.CONTENT_TYPES=e.i,exports.CURRENCY=e.a,exports.ConsentPluginNames=e.I,exports.EpigraphAddToFavouritesEvent=e.o,exports.EpigraphAnalytics=e.t,exports.EpigraphArRequestedEvent=e.s,exports.EpigraphButtonClickEvent=e.c,exports.EpigraphChangeRateEvent=e.l,exports.EpigraphCheckoutEvent=e.u,exports.EpigraphCompletionRateEvent=e.d,exports.EpigraphContentSharedEvent=e.f,exports.EpigraphConversionEvent=e.p,exports.EpigraphCustomEvent=e.m,exports.EpigraphEngagementRateEvent=e.h,exports.EpigraphItemAddedEvent=e.g,exports.EpigraphItemMovedEvent=e._,exports.EpigraphItemRemovedEvent=e.v,exports.EpigraphKeyboardInteractionEvent=e.y,exports.EpigraphModuleClosedEvent=e.b,exports.EpigraphModuleFailedEvent=e.x,exports.EpigraphModuleLoadingEvent=e.S,exports.EpigraphModuleReadyEvent=e.C,exports.EpigraphPanelClosedEvent=e.w,exports.EpigraphPanelOpenedEvent=e.T,exports.EpigraphSupportDetectedEvent=e.E,exports.EpigraphTouchInteractionEvent=e.D,exports.EpigraphVariantChangedEvent=e.O,exports.GA4AnalyticsPlugin=e.B,exports.MODULE_FAILED_ERRORS=e.k,exports.NexusAnalyticsPlugin=e.z,exports.NexusSolutionsAnalyticsPlugin=e.R,exports.OneTrustConsentPlugin=e.L,exports.PANEL_TYPE=e.A,exports.SHARE_DESTINATIONS=e.j,exports.SUPPORT_TYPE=e.M,exports.TRIGGER_SOURCE=e.N,exports.VARIANT_CHANGE_TYPES=e.P;
@@ -5,6 +5,7 @@ import { NexusAnalyticsPlugin } from './plugins/nexus-analytics-plugin';
5
5
  import { NexusSolutionsAnalyticsPlugin } from './plugins/nexus-solutions-analytics-plugin';
6
6
  import { OneTrustConsentPlugin } from './consent-plugins/one-trust-consent-plugin';
7
7
  import { ConsentPluginNames } from './consent-plugins/consent-plugin-names';
8
+ import { AutoConsentResolver, ConsentSignal } from './consent-plugins/auto-consent-resolver';
8
9
  declare const $analyticsPluginsMap: unique symbol;
9
10
  export type AnalyticsTrackerMap = Map<string, IAnalyticsPlugin>;
10
11
  export type { IAnalyticsEvent };
@@ -14,11 +15,17 @@ export { NexusAnalyticsPlugin };
14
15
  export { NexusSolutionsAnalyticsPlugin };
15
16
  export { OneTrustConsentPlugin };
16
17
  export { ConsentPluginNames };
18
+ export { AutoConsentResolver };
19
+ export type { ConsentSignal };
17
20
  export declare class EpigraphAnalytics {
18
21
  private [$analyticsPluginsMap];
19
22
  private __consentPlugin;
20
23
  private __overrideConsent;
21
- constructor(consentPluginName: string | null, consentIdentifier: string | null);
24
+ private __autoConsentResolver;
25
+ private __defaultConsent;
26
+ constructor(consentPluginName: string | null, consentIdentifier: string | null, options?: {
27
+ defaultConsent?: boolean;
28
+ });
22
29
  private __onConsentChangeFromEvent;
23
30
  /**
24
31
  * Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
@@ -29,12 +36,14 @@ export declare class EpigraphAnalytics {
29
36
  */
30
37
  addEventPlugin(plugin: IAnalyticsPlugin): void;
31
38
  /**
32
- * Resolves session consent by prioritizing this._overrideConsent and if not found,
33
- * getting the value from the consent plugin, if available.
39
+ * Resolves session consent, in priority order: the override event, an explicitly configured
40
+ * consent plugin, signals the page itself exposes (Google Consent Mode, known CMPs), and
41
+ * finally the configured default.
34
42
  *
35
- * @returns {boolean} Whether the session has consent to track analytics or not.
43
+ * 'unknown' means nothing on the page has answered yet (e.g. a pending consent banner with
44
+ * defaultConsent disabled) — events are queued rather than sent or dropped.
36
45
  */
37
- private __hasConsent;
46
+ private __resolveConsent;
38
47
  /**
39
48
  * Send an Event to all plugins
40
49
  *
@@ -1,2 +1,2 @@
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, z as R } from "../../epigraphAnalytics-DzLB3jQX.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, R as GA4AnalyticsPlugin, w as MODULE_FAILED_ERRORS, d as NexusAnalyticsPlugin, o as NexusSolutionsAnalyticsPlugin, a as OneTrustConsentPlugin, e as PANEL_TYPE, C as SHARE_DESTINATIONS, s as SUPPORT_TYPE, c as TRIGGER_SOURCE, u as VARIANT_CHANGE_TYPES };
1
+ import { A as e, B as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, h as S, i as C, j as w, k as T, l as E, m as D, n as O, o as k, p as A, r as j, s as M, t as N, u as P, v as F, w as I, x as L, y as R, z } from "../../epigraphAnalytics-Dv5dGbcW.js";
2
+ export { O as ACTION_PERFORMED, a as AutoConsentResolver, j as BUTTON_TYPE, C as CONTENT_TYPES, g as CURRENCY, o as ConsentPluginNames, k as EpigraphAddToFavouritesEvent, N as EpigraphAnalytics, M as EpigraphArRequestedEvent, v as EpigraphButtonClickEvent, E as EpigraphChangeRateEvent, P as EpigraphCheckoutEvent, y as EpigraphCompletionRateEvent, b as EpigraphContentSharedEvent, A as EpigraphConversionEvent, D as EpigraphCustomEvent, S as EpigraphEngagementRateEvent, x as EpigraphItemAddedEvent, h as EpigraphItemMovedEvent, F as EpigraphItemRemovedEvent, R as EpigraphKeyboardInteractionEvent, _ as EpigraphModuleClosedEvent, L as EpigraphModuleFailedEvent, p as EpigraphModuleLoadingEvent, n as EpigraphModuleReadyEvent, I as EpigraphPanelClosedEvent, m as EpigraphPanelOpenedEvent, i as EpigraphSupportDetectedEvent, r as EpigraphTouchInteractionEvent, u as EpigraphVariantChangedEvent, t as GA4AnalyticsPlugin, T as MODULE_FAILED_ERRORS, z as NexusAnalyticsPlugin, f as NexusSolutionsAnalyticsPlugin, s as OneTrustConsentPlugin, e as PANEL_TYPE, w as SHARE_DESTINATIONS, c as SUPPORT_TYPE, l as TRIGGER_SOURCE, d as VARIANT_CHANGE_TYPES };
@@ -11,7 +11,6 @@ declare class BaseAnalyticsEvent implements IAnalyticsEvent {
11
11
  getGa4Parameters(solution: string, experienceId: string, sendTo: string): {
12
12
  solution: string;
13
13
  experience_id: string;
14
- event: string;
15
14
  interactive_event: boolean;
16
15
  send_to: string;
17
16
  };
@@ -31,6 +31,7 @@ export declare class GA4AnalyticsPlugin implements IAnalyticsPlugin {
31
31
  private __lastInitializationAttempt;
32
32
  private __maxInitializationAttempts;
33
33
  private __initializationRetryDelay;
34
+ private __maxQueuedEvents;
34
35
  private __isInitialized;
35
36
  private __initializationMethod;
36
37
  private __nexusFailureReported;
@@ -60,6 +61,11 @@ export declare class GA4AnalyticsPlugin implements IAnalyticsPlugin {
60
61
  private initializePlugin;
61
62
  private detectAndSetupAnalytics;
62
63
  private detectGTM;
64
+ /**
65
+ * Reads the name of the data layer a loaded tag is consuming from its window.google_tag_manager entry.
66
+ * Current gtag/GTM builds expose it at entry.dataLayer.name; older builds used entry.dataLayerName.
67
+ */
68
+ private getRuntimeDataLayerName;
63
69
  /**
64
70
  * Send all events that are in the queue
65
71
  * @private
@@ -14,6 +14,7 @@ export declare class NexusAnalyticsPlugin implements IAnalyticsPlugin {
14
14
  private __queue;
15
15
  private __status;
16
16
  private __sentEventCount;
17
+ private __maxQueuedEvents;
17
18
  private __epigraphNotifier;
18
19
  constructor({ trackingID, experienceID, solution, sessionId, xPath, verboseLogging, baseUrl }: {
19
20
  trackingID: string;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./epigraphQrCodeGenerator-F2eLrPC_.cjs"),t=require("./EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),n=require("./enums-PfFMiIoe.cjs"),r=require("./EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs"),i=require("./Epigraph/epigraph.cjs"),a=require("./Epigraph/epigraphBaseSolutions.cjs"),o=require("./epigraphAnalytics-Cl98luUT.cjs"),s=require("./EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs"),c=require("./EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs"),l=require("./epigraphUnitsConverter-CwpmWl7p.cjs");exports.ACTION_PERFORMED=o.n,exports.BUTTON_TYPE=o.r,exports.CONTENT_TYPES=o.i,exports.CURRENCY=o.a,exports.ConsentPluginNames=o.F,exports.Distance=l.t,exports.DistanceUnits=l.n,exports.ENVIRONMENT_TYPE=n.t,exports.Epigraph=i.Epigraph,exports.EpigraphAddToFavouritesEvent=o.o,exports.EpigraphAnalytics=o.t,exports.EpigraphArRequestedEvent=o.s,exports.EpigraphBaseSolutionHtmlElement=a.EpigraphBaseSolutionHtmlElement,exports.EpigraphBaseSolutionLitElement=a.EpigraphBaseSolutionLitElement,exports.EpigraphButtonClickEvent=o.c,exports.EpigraphChangeRateEvent=o.l,exports.EpigraphCheckoutEvent=o.u,exports.EpigraphCompletionRateEvent=o.d,exports.EpigraphContentSharedEvent=o.f,exports.EpigraphConversionEvent=o.p,exports.EpigraphCustomEvent=o.m,exports.EpigraphEngagementRateEvent=o.h,exports.EpigraphItemAddedEvent=o.g,exports.EpigraphItemMovedEvent=o._,exports.EpigraphItemRemovedEvent=o.v,exports.EpigraphKeyboardInteractionEvent=o.y,exports.EpigraphLogger=t.EpigraphLogger,exports.EpigraphModuleClosedEvent=o.b,exports.EpigraphModuleFailedEvent=o.x,exports.EpigraphModuleLoadingEvent=o.S,exports.EpigraphModuleReadyEvent=o.C,exports.EpigraphNexusAPI=c.EpigraphNexusAPI,exports.EpigraphPanelClosedEvent=o.w,exports.EpigraphPanelOpenedEvent=o.T,exports.EpigraphQrCodeGenerator=e.t,exports.EpigraphSupportDetectedEvent=o.E,exports.EpigraphTouchInteractionEvent=o.D,exports.EpigraphUrlProcessor=r.EpigraphUrlProcessor,exports.EpigraphVariantChangedEvent=o.O,exports.GA4AnalyticsPlugin=o.z,exports.HTTPMethod=c.HTTPMethod,exports.LogTypes=t.LogTypes,exports.LoggerModeNames=t.LoggerModeNames,exports.MODULE_FAILED_ERRORS=o.k,exports.NexusAPIResourceIdentifier=c.NexusAPIResourceIdentifier,exports.NexusAPIRoutes=c.NexusAPIRoutes,exports.NexusAPIVersions=c.NexusAPIVersions,exports.NexusAnalyticsPlugin=o.R,exports.NexusEndpoints=n.n,exports.NexusSolutionsAnalyticsPlugin=o.L,exports.OneTrustConsentPlugin=o.I,exports.PANEL_TYPE=o.A,exports.QUERY_PARAMETER_ACTION_NAMES=r.QUERY_PARAMETER_ACTION_NAMES,exports.QUERY_PARAMETER_NAMES=r.QUERY_PARAMETER_NAMES,exports.Result=s.Result,exports.SHARE_DESTINATIONS=o.j,exports.SUPPORT_TYPE=o.M,exports.TRIGGER_SOURCE=o.N,exports.UnitTypes=l.r,exports.VARIANT_CHANGE_TYPES=o.P,exports.failureResult=s.failureResult,exports.successResult=s.successResult;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./epigraphQrCodeGenerator-F2eLrPC_.cjs"),t=require("./EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),n=require("./enums-PfFMiIoe.cjs"),r=require("./EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs"),i=require("./Epigraph/epigraph.cjs"),a=require("./Epigraph/epigraphBaseSolutions.cjs"),o=require("./epigraphAnalytics-CADAVr-I.cjs"),s=require("./EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs"),c=require("./EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs"),l=require("./epigraphUnitsConverter-CwpmWl7p.cjs");exports.ACTION_PERFORMED=o.n,exports.AutoConsentResolver=o.F,exports.BUTTON_TYPE=o.r,exports.CONTENT_TYPES=o.i,exports.CURRENCY=o.a,exports.ConsentPluginNames=o.I,exports.Distance=l.t,exports.DistanceUnits=l.n,exports.ENVIRONMENT_TYPE=n.t,exports.Epigraph=i.Epigraph,exports.EpigraphAddToFavouritesEvent=o.o,exports.EpigraphAnalytics=o.t,exports.EpigraphArRequestedEvent=o.s,exports.EpigraphBaseSolutionHtmlElement=a.EpigraphBaseSolutionHtmlElement,exports.EpigraphBaseSolutionLitElement=a.EpigraphBaseSolutionLitElement,exports.EpigraphButtonClickEvent=o.c,exports.EpigraphChangeRateEvent=o.l,exports.EpigraphCheckoutEvent=o.u,exports.EpigraphCompletionRateEvent=o.d,exports.EpigraphContentSharedEvent=o.f,exports.EpigraphConversionEvent=o.p,exports.EpigraphCustomEvent=o.m,exports.EpigraphEngagementRateEvent=o.h,exports.EpigraphItemAddedEvent=o.g,exports.EpigraphItemMovedEvent=o._,exports.EpigraphItemRemovedEvent=o.v,exports.EpigraphKeyboardInteractionEvent=o.y,exports.EpigraphLogger=t.EpigraphLogger,exports.EpigraphModuleClosedEvent=o.b,exports.EpigraphModuleFailedEvent=o.x,exports.EpigraphModuleLoadingEvent=o.S,exports.EpigraphModuleReadyEvent=o.C,exports.EpigraphNexusAPI=c.EpigraphNexusAPI,exports.EpigraphPanelClosedEvent=o.w,exports.EpigraphPanelOpenedEvent=o.T,exports.EpigraphQrCodeGenerator=e.t,exports.EpigraphSupportDetectedEvent=o.E,exports.EpigraphTouchInteractionEvent=o.D,exports.EpigraphUrlProcessor=r.EpigraphUrlProcessor,exports.EpigraphVariantChangedEvent=o.O,exports.GA4AnalyticsPlugin=o.B,exports.HTTPMethod=c.HTTPMethod,exports.LogTypes=t.LogTypes,exports.LoggerModeNames=t.LoggerModeNames,exports.MODULE_FAILED_ERRORS=o.k,exports.NexusAPIResourceIdentifier=c.NexusAPIResourceIdentifier,exports.NexusAPIRoutes=c.NexusAPIRoutes,exports.NexusAPIVersions=c.NexusAPIVersions,exports.NexusAnalyticsPlugin=o.z,exports.NexusEndpoints=n.n,exports.NexusSolutionsAnalyticsPlugin=o.R,exports.OneTrustConsentPlugin=o.L,exports.PANEL_TYPE=o.A,exports.QUERY_PARAMETER_ACTION_NAMES=r.QUERY_PARAMETER_ACTION_NAMES,exports.QUERY_PARAMETER_NAMES=r.QUERY_PARAMETER_NAMES,exports.Result=s.Result,exports.SHARE_DESTINATIONS=o.j,exports.SUPPORT_TYPE=o.M,exports.TRIGGER_SOURCE=o.N,exports.UnitTypes=l.r,exports.VARIANT_CHANGE_TYPES=o.P,exports.failureResult=s.failureResult,exports.successResult=s.successResult;
@@ -3,9 +3,9 @@ import { n as r, t as i } from "./enums-BSSe4NAs.js";
3
3
  import { EpigraphUrlProcessor as a, QUERY_PARAMETER_ACTION_NAMES as o, QUERY_PARAMETER_NAMES as s } from "./EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js";
4
4
  import { Epigraph as c } from "./Epigraph/epigraph.js";
5
5
  import { EpigraphBaseSolutionHtmlElement as l, EpigraphBaseSolutionLitElement as u } from "./Epigraph/epigraphBaseSolutions.js";
6
- import { A as d, C as f, D as p, E as m, F as h, I as g, L as _, M as v, N as y, O as b, P as x, R as S, S as C, T as w, _ as T, a as E, b as D, c as O, d as k, f as A, g as j, h as M, i as N, j as P, k as F, l as I, m as L, n as R, o as z, p as B, r as V, s as H, t as U, u as W, v as G, w as K, x as q, y as J, z as Y } from "./epigraphAnalytics-DzLB3jQX.js";
7
- import { Result as X, failureResult as Z, successResult as Q } from "./EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js";
8
- import { EpigraphNexusAPI as $, HTTPMethod as ee, NexusAPIResourceIdentifier as te, NexusAPIRoutes as ne, NexusAPIVersions as re } from "./EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js";
9
- import { t as ie } from "./epigraphQrCodeGenerator-BXUNL2XK.js";
10
- import { n as ae, r as oe, t as se } from "./epigraphUnitsConverter-DsX4Rmsp.js";
11
- export { R as ACTION_PERFORMED, V as BUTTON_TYPE, N as CONTENT_TYPES, E as CURRENCY, h as ConsentPluginNames, se as Distance, ae as DistanceUnits, i as ENVIRONMENT_TYPE, c as Epigraph, z as EpigraphAddToFavouritesEvent, U as EpigraphAnalytics, H as EpigraphArRequestedEvent, l as EpigraphBaseSolutionHtmlElement, u as EpigraphBaseSolutionLitElement, O as EpigraphButtonClickEvent, I as EpigraphChangeRateEvent, W as EpigraphCheckoutEvent, k as EpigraphCompletionRateEvent, A as EpigraphContentSharedEvent, B as EpigraphConversionEvent, L as EpigraphCustomEvent, M as EpigraphEngagementRateEvent, j as EpigraphItemAddedEvent, T as EpigraphItemMovedEvent, G as EpigraphItemRemovedEvent, J as EpigraphKeyboardInteractionEvent, e as EpigraphLogger, D as EpigraphModuleClosedEvent, q as EpigraphModuleFailedEvent, C as EpigraphModuleLoadingEvent, f as EpigraphModuleReadyEvent, $ as EpigraphNexusAPI, K as EpigraphPanelClosedEvent, w as EpigraphPanelOpenedEvent, ie as EpigraphQrCodeGenerator, m as EpigraphSupportDetectedEvent, p as EpigraphTouchInteractionEvent, a as EpigraphUrlProcessor, b as EpigraphVariantChangedEvent, Y as GA4AnalyticsPlugin, ee as HTTPMethod, t as LogTypes, n as LoggerModeNames, F as MODULE_FAILED_ERRORS, te as NexusAPIResourceIdentifier, ne as NexusAPIRoutes, re as NexusAPIVersions, S as NexusAnalyticsPlugin, r as NexusEndpoints, _ as NexusSolutionsAnalyticsPlugin, g as OneTrustConsentPlugin, d as PANEL_TYPE, o as QUERY_PARAMETER_ACTION_NAMES, s as QUERY_PARAMETER_NAMES, X as Result, P as SHARE_DESTINATIONS, v as SUPPORT_TYPE, y as TRIGGER_SOURCE, oe as UnitTypes, x as VARIANT_CHANGE_TYPES, Z as failureResult, Q as successResult };
6
+ import { A as d, B as f, C as p, D as m, E as h, F as g, I as _, L as v, M as y, N as b, O as x, P as S, R as C, S as w, T, _ as E, a as D, b as O, c as k, d as A, f as j, g as M, h as N, i as P, j as F, k as I, l as L, m as R, n as z, o as B, p as V, r as H, s as U, t as W, u as G, v as K, w as q, x as J, y as Y, z as X } from "./epigraphAnalytics-Dv5dGbcW.js";
7
+ import { Result as Z, failureResult as Q, successResult as $ } from "./EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js";
8
+ import { EpigraphNexusAPI as ee, HTTPMethod as te, NexusAPIResourceIdentifier as ne, NexusAPIRoutes as re, NexusAPIVersions as ie } from "./EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js";
9
+ import { t as ae } from "./epigraphQrCodeGenerator-BXUNL2XK.js";
10
+ import { n as oe, r as se, t as ce } from "./epigraphUnitsConverter-DsX4Rmsp.js";
11
+ export { z as ACTION_PERFORMED, g as AutoConsentResolver, H as BUTTON_TYPE, P as CONTENT_TYPES, D as CURRENCY, _ as ConsentPluginNames, ce as Distance, oe as DistanceUnits, i as ENVIRONMENT_TYPE, c as Epigraph, B as EpigraphAddToFavouritesEvent, W as EpigraphAnalytics, U as EpigraphArRequestedEvent, l as EpigraphBaseSolutionHtmlElement, u as EpigraphBaseSolutionLitElement, k as EpigraphButtonClickEvent, L as EpigraphChangeRateEvent, G as EpigraphCheckoutEvent, A as EpigraphCompletionRateEvent, j as EpigraphContentSharedEvent, V as EpigraphConversionEvent, R as EpigraphCustomEvent, N as EpigraphEngagementRateEvent, M as EpigraphItemAddedEvent, E as EpigraphItemMovedEvent, K as EpigraphItemRemovedEvent, Y as EpigraphKeyboardInteractionEvent, e as EpigraphLogger, O as EpigraphModuleClosedEvent, J as EpigraphModuleFailedEvent, w as EpigraphModuleLoadingEvent, p as EpigraphModuleReadyEvent, ee as EpigraphNexusAPI, q as EpigraphPanelClosedEvent, T as EpigraphPanelOpenedEvent, ae as EpigraphQrCodeGenerator, h as EpigraphSupportDetectedEvent, m as EpigraphTouchInteractionEvent, a as EpigraphUrlProcessor, x as EpigraphVariantChangedEvent, f as GA4AnalyticsPlugin, te as HTTPMethod, t as LogTypes, n as LoggerModeNames, I as MODULE_FAILED_ERRORS, ne as NexusAPIResourceIdentifier, re as NexusAPIRoutes, ie as NexusAPIVersions, X as NexusAnalyticsPlugin, r as NexusEndpoints, C as NexusSolutionsAnalyticsPlugin, v as OneTrustConsentPlugin, d as PANEL_TYPE, o as QUERY_PARAMETER_ACTION_NAMES, s as QUERY_PARAMETER_NAMES, Z as Result, F as SHARE_DESTINATIONS, y as SUPPORT_TYPE, b as TRIGGER_SOURCE, se as UnitTypes, S as VARIANT_CHANGE_TYPES, Q as failureResult, $ as successResult };
@@ -0,0 +1 @@
1
+ const e=require("./enums-PfFMiIoe.cjs");var t=function(e){return e.UNAVAILABLE=`unavailable`,e.AVAILABLE=`available`,e.RESTRICTED=`restricted`,e}({}),n=Symbol(`data`),r=Symbol(`next`),i=class e{constructor(e){this[n]=e,this[r]=null}get data(){return this[n]}set next(t){if(!(t instanceof e)&&t!==null)throw Error(`This node is not an instance of the custom class 'Node'.`);this[r]=t}get next(){return this[r]}},a=Symbol(`head`),o=class{constructor(){this[a]=null}set head(e){this[a]=e}get head(){return this[a]}addToTail(e){let t=this.head;if(t){for(;t.next!==null;)t=t?.next;return t.next=new i(e)}return this.head=new i(e)}removeHead(){let e=this.head;if(e)return this.head=e.next,e.data}},s=Symbol(`queue`),c=Symbol(`size`),l=class{constructor(){this[s]=new o,this[c]=0}get queue(){return this[s]}get size(){return this[c]}enqueue(e){this.queue.addToTail(e),this[c]++}dequeue(){let e=this.queue.removeHead();return this[c]--,e}},u=class{static{this.NOTIFICATION_NAME=`epg-notification`}static{this.ACTION_SEND_EVENT=`send-event`}static{this.ACTION_INITIALIZED=`initialized`}static{this.ACTION_FAILED_INITIALIZATION=`initialization-failed`}constructor(e,t,n,r,i,a){this._pluginName=e,this._trackingId=t,this._experienceId=n,this._solution=r,this._initializer=i,this._status=a}updateStatus(e){this._status=e}updateInitializer(e){this._initializer=e}notify(e,t){let n={pluginName:this._pluginName,trackingId:this._trackingId,experienceId:this._experienceId,solution:this._solution,initializer:this._initializer,status:this._status,action:e,eventDetails:t};window.dispatchEvent(new CustomEvent(`epg-notification`,{detail:n}))}},d=class{constructor({trackingID:e,experienceID:n,solution:r,verboseLogging:i=!1}){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()}setTrackingID(e){if(!e)return;let t=this.trackingID!==e;this.trackingID=e,t&&this.__isInitialized&&(this.resetInitialization(),this.initializePlugin())}setExperienceID(e){this.experienceID=e}setSolution(e){this.solution=e}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return`${this.name}-${this.trackingID}`}setupPlugin(){this.__isInitialized&&this.dataLayer!==void 0&&this.dequeueAndSendEvents()}async sendEvent(e,n){if(this.__queue.size>=this.__maxQueuedEvents&&this.__queue.dequeue(),this.__queue.enqueue(e),!n){this.setStatus(t.RESTRICTED);return}if(this.__status===t.RESTRICTED&&this.__isInitialized&&this.setStatus(t.AVAILABLE),this.__isInitialized||this.initializePlugin(),!this.__isInitialized){this.logger(`Cannot send analytics event: dataLayer not defined or plugin not initialized.`);return}try{await this.dequeueAndSendEvents()}catch(e){this.logger(e),await this.reportFailureToNexus(`EVENT_SEND_ERROR`,e?.toString()||`Unknown error`)}}resetInitialization(){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)}initializePlugin(){if(this.__isInitialized)return;let e=performance.now();if(this.__initializationAttempts>0&&e-this.__lastInitializationAttempt<this.__initializationRetryDelay)return;this.__lastInitializationAttempt=e,this.__initializationAttempts++;let n=this.detectAndSetupAnalytics();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(()=>{this.initializePlugin()},this.__initializationRetryDelay):this.__nexusFailureReported||(this.reportFailureToNexus(`MAX_INITIALIZATION_ATTEMPTS`,`Maximum initialization attempts reached`),this.__nexusFailureReported=!0,this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION,{})))}detectAndSetupAnalytics(){let e=this.detectGTM();if(e)return this.logger(`GTM detected with container ID: ${e.containerId}`),this.__epigraphNotifier.updateInitializer(`GTM`),{success:!0,method:`GTM`,dataLayerName:e.dataLayerName};let t=this.findGA4Info(this.trackingID);if(t){let e=t.l||`dataLayer`;return this.logger(`GA4 script found, setting up with dataLayer: ${e}`),this.__epigraphNotifier.updateInitializer(`GA4`),{success:!0,method:`GA4`,dataLayerName:e}}return{success:!1,method:`NONE`,dataLayerName:`dataLayer`,error:`No analytics setup found and unable to create one`}}detectGTM(){let e=window.google_tag_manager;if(e){let t=Object.keys(e).find(e=>e.startsWith(`GTM-`));if(t)return{containerId:t,dataLayerName:this.getRuntimeDataLayerName(e[t])||`dataLayer`}}let t=document.querySelectorAll(`script[src*="gtm.js?id="]`);for(let e of Array.from(t)){let t=e.getAttribute(`src`);if(t){let e=t.match(/gtm\.js\?id=([^&]+)/);if(e&&e.length>0){let n=t.match(/&l=([^&]+)/),r=n?n[1]:`dataLayer`;return{containerId:e[1],dataLayerName:r}}}}return null}getRuntimeDataLayerName(e){let t=e?.dataLayer?.name??e?.dataLayerName;return typeof t==`string`&&t.length>0?t:void 0}async dequeueAndSendEvents(){if(!this.__isInitialized||!this.dataLayer)return;let e=this.__queue.size;for(let t=0;t<e;t++){let e=this.__queue.dequeue();try{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)}catch(t){this.logger(`Error sending event ${e.eventName}: ${t}`),this.__queue.enqueue(e)}}}async sendGTMEvent(e){let t=e.getGTMParameters(this.solution,this.experienceID,this.trackingID),n=t;this.isValidPayload(t)||(t=await this.convertGTMParametersToEpgEventTag(e.eventName,t)),this.dataLayer&&(this.dataLayer.push(t),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}async sendGA4Event(e){let t=e.getGa4Parameters(this.solution,this.experienceID,this.trackingID),n=t;this.isValidPayload(t)||(t=await this.convertGA4ParametersToEpgEventTag(t));let r=this.dataLayer;r&&((function(...e){r.push(arguments)})(`event`,e.eventName,t),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}isValidPayload(e){if(Object.keys(e).length>=25)return!1;for(let[t,n]of Object.entries(e))if(t!==`items`&&(t.length>40||String(n).length>100))return!1;return!0}async convertGTMParametersToEpgEventTag(e,t){try{return{event:e,epg_event_tag:await this.sendGA4LongParameters(t),send_to:this.trackingID}}catch{return t}}async convertGA4ParametersToEpgEventTag(e){try{return{epg_event_tag:await this.sendGA4LongParameters(e),send_to:this.trackingID}}catch{return e}}logger(e){this.verboseLogging&&console.warn(e)}async sendGA4LongParameters(e){let t={parameters:e};try{let e=await fetch(`https://api.myepigraph.com/api/analytics/ga4/custom`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(t)});return e.ok?(await e.json())?.id??``:``}catch{return``}}async reportFailureToNexus(e,t){try{let n={plugin:`GA4`,trackingId:this.trackingID,solution:this.solution,experienceId:this.experienceID,failureType:e,errorMessage:t,timestamp:new Date().toISOString(),url:window.location.href,userAgent:navigator.userAgent};this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`)}catch(e){this.logger(`Error reporting failure to Nexus: ${e}`)}}findGA4Info(e){if(window.google_tag_manager&&window.google_tag_manager[e])return{fullSrc:``,id:e,l:this.getRuntimeDataLayerName(window.google_tag_manager[e])};let t=document.querySelectorAll(`script[src]`);for(let n of t){let t=n.getAttribute(`src`);if(t&&t.includes(e)){let e=new URL(t,location.href),n=Object.fromEntries(e.searchParams.entries());return{fullSrc:e.href,id:n.id||void 0,l:n.l||void 0}}}return null}},f=class{constructor({trackingID:n,experienceID:r,solution:i,sessionId:a,xPath:o,verboseLogging:s=!1,baseUrl:c=e.n.PRODUCTION}){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,{})}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return this.name+`-`+this.trackingID}setupPlugin(){}async sendEvent(e,n){if(this.__queue.size>=this.__maxQueuedEvents&&this.__queue.dequeue(),this.__queue.enqueue(e),!n){this.setStatus(t.RESTRICTED);return}this.__status===t.RESTRICTED&&this.setStatus(t.AVAILABLE),await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(let e=0;e<this.__queue.size;e++){let e=this.__queue.dequeue(),t={send_to:this.trackingID,experience_id:this.experienceID,solution:this.solution,event:e.eventName,parameters:e.getNexusParameters()};try{return(await fetch(this.url,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"EPG-SESSION-ID":this.sessionId,"EPG-XPATH":this.xPath,Origin:typeof window<`u`?window.location.origin:``},body:JSON.stringify(t)})).ok&&this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,t),``}catch{return``}this.__sentEventCount++}return``}},p=class{constructor({productId:n,identifier:r,identifierType:i,experienceType:a,renderMode:o=`geo`,sessionId:s,xPath:c,solution:d=``,verboseLogging:f=!1,baseUrl:p=e.n.PRODUCTION}){if(this.experienceID=``,this.__status=t.UNAVAILABLE,this.__sentEventCount=0,n<=0)throw Error(`NexusSolutionsAnalyticsPlugin requires a valid productId greater than 0.`);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,{})}setProductId(e){e<=0||(this.productId=e,this.trackingID=String(e))}setIdentifier(e){this.identifier=e}setIdentifierType(e){this.identifierType=e}setExperienceType(e){this.experienceType=e}setRenderMode(e){this.renderMode=e}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return`${this.name}-${this.sessionId}`}setupPlugin(){}async sendEvent(e,n){if(this.__queue.enqueue(e),!n){this.__status=t.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(;this.__queue.size>0;){let e=this.__queue.dequeue(),t={action:e.eventName,product_id:this.productId,identifier:this.identifier,identifier_type:this.identifierType,experience_type:this.experienceType,render_mode:this.renderMode,parameters:e.getNexusParameters()};try{(await fetch(this.url,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"EPG-SESSION-ID":this.sessionId,"EPG-XPATH":this.xPath,Origin:typeof window<`u`?window.location.origin:``},body:JSON.stringify(t)})).ok&&(this.__sentEventCount++,this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,t))}catch{return}}}},m=class{constructor(e){this.consentSet=!1,this.consent=!1,this.pluginName=`OneTrustConsentPlugin`,this.consentIdentifier=e,this.consent=!1,this.addConsentChangedListener()}hasConsent(){if(this.consentSet)return this.consent;if(window.OnetrustActiveGroups!==void 0){let e=String(window.OnetrustActiveGroups).split(`,`);this.consent=e.includes(this.consentIdentifier),this.consentSet=!0}return this.consent}addConsentChangedListener(){this.hasConsent(),this.registerOnConsentChanged(20)}registerOnConsentChanged(e){if(window.OneTrust!==void 0&&typeof window.OneTrust==`object`&&typeof window.OneTrust.OnConsentChanged==`function`){window.OneTrust.OnConsentChanged(()=>{this.consentSet=!1,this.hasConsent()});return}e>0&&setTimeout(()=>this.registerOnConsentChanged(e-1),1e3)}},h=function(e){return e.OneTrust=`onetrust`,e}({}),g=class{resolve(){let e=this.readGoogleConsentMode();if(e!==`unknown`)return e;let t=this.readCookiebot();return t===`unknown`?this.readOneTrust():t}readGoogleConsentMode(){let e=window.google_tag_data?.ics;if(!e||e.active!==!0||!e.entries)return`unknown`;let t=e.entries.analytics_storage;return t?typeof t.update==`boolean`?t.update?`granted`:`denied`:typeof t.default==`boolean`?t.default?`granted`:`denied`:`unknown`:`unknown`}readCookiebot(){let e=window.Cookiebot;return!e||!e.consent||e.hasResponse!==!0?`unknown`:e.consent.statistics===!0?`granted`:`denied`}readOneTrust(){let e=window.OnetrustActiveGroups;return typeof e!=`string`||e.length===0?`unknown`:e.split(`,`).includes(`C0002`)?`granted`:`denied`}},_=class{constructor({eventName:e,interactiveEvent:t,customParameters:n}){this.eventName=e,this.interactiveEvent=t,this.customParameters=n}getGa4Parameters(e,t,n){let r={solution:e,experience_id:t,interactive_event:this.interactiveEvent,send_to:n};return r=Object.assign(r,JSON.parse(JSON.stringify(this.customParameters))),r}getGTMParameters(e,t,n){let r={solution:e,experience_id:t,event:this.eventName,interactive_event:this.interactiveEvent,send_to:n};return r=Object.assign(r,JSON.parse(JSON.stringify(this.customParameters))),r}getNexusParameters(){let e={interactive_event:this.interactiveEvent};return e=Object.assign(e,JSON.parse(JSON.stringify(this.customParameters))),e}},v=function(e){return e.VARIANT=`variant`,e.CATEGORY_VARIANT=`category_variant`,e.GEOMETRY=`geometry`,e.CATEGORY_GEOMETRY=`category_geometry`,e.GLOBAL=`global`,e}({}),y=function(e){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}({}),b=function(e){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}({}),x=function(e){return e.AUTO=`auto`,e.BUTTON=`button`,e.HOTSPOT=`hotspot`,e.GESTURE=`gesture`,e}({}),S=function(e){return e.USD=`USD`,e.EUR=`EUR`,e.GBP=`GBP`,e.CAD=`CAD`,e}({}),C=function(e){return e.AR=`ar`,e.QR=`qr`,e.AR_WEBGL2=`ar-webgl2`,e.QR_WEBGL2=`qr-webgl2`,e}({}),w=function(e){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}({}),T=function(e){return e.ZOOM=`zoom`,e.ROTATE=`rotate`,e.PAN=`pan`,e}({}),E=function(e){return e.CONFIGURATION=`configuration`,e.SCENE=`scene`,e.PRODUCT=`product`,e}({}),D=function(e){return e.FACEBOOK=`facebook`,e.TWITTER=`twitter`,e.EMAIL=`email`,e.COPY_LINK=`copy_link`,e.WHATSAPP=`whatsapp`,e.LINKEDIN=`linkedin`,e}({}),O=class extends _{constructor(e){super({eventName:`epigraph_ar_requested`,interactiveEvent:!0,customParameters:{items:e}})}},k=class extends _{constructor(e){super({eventName:`epigraph_module_loading`,interactiveEvent:!1,customParameters:{is_pre_config:e}})}},A=class extends _{constructor(e,t){super({eventName:`epigraph_module_ready`,interactiveEvent:!1,customParameters:{is_pre_config:e,load_time_ms:t}})}},j=class extends _{static{this.MODULE_FAILED_ERRORS=b}constructor(e,t,n){super({eventName:`epigraph_module_failed`,interactiveEvent:!1,customParameters:{is_pre_config:e,load_time_ms:t,error_type:n}})}},M=class extends _{constructor(e){super({eventName:`epigraph_module_closed`,interactiveEvent:!0,customParameters:{items:e}})}},N=class extends _{static{this.SUPPORT_TYPE=C}constructor(e){super({eventName:`epigraph_support_detected`,interactiveEvent:!1,customParameters:{support_type:e}})}},P=class extends _{static{this.BUTTON_TYPE=w}constructor(e,t){super({eventName:`epigraph_button_click`,interactiveEvent:!0,customParameters:{button_type:e,button_name:t}})}},F=class extends _{static{this.PANEL_TYPE=y}static{this.TRIGGER_SOURCE=x}constructor(e,t,n,r){super({eventName:`epigraph_panel_opened`,interactiveEvent:e,customParameters:{items:r,panel_type:t,trigger_source:n}})}},I=class extends _{static{this.PANEL_TYPE=y}static{this.TRIGGER_SOURCE=x}constructor(e,t,n,r){super({eventName:`epigraph_panel_closed`,interactiveEvent:e,customParameters:{items:r,panel_type:t,trigger_source:n}})}},L=class extends _{constructor(e){super({eventName:`epigraph_add_to_favourites`,interactiveEvent:!0,customParameters:{items:e}})}},R=class extends _{static{this.ACTION_PERFORMED=T}constructor(e){super({eventName:`epigraph_keyboard_interaction`,interactiveEvent:!0,customParameters:{action_performed:e}})}},z=class extends _{static{this.INTERACTION_TYPE=T}constructor(e){super({eventName:`epigraph_touch_interaction`,interactiveEvent:!0,customParameters:{interaction_type:e}})}},B=class extends _{static{this.CURRENCY=S}constructor(e,t,n,r,i){super({eventName:`epigraph_item_added`,interactiveEvent:e,customParameters:{items:i,value:t,currency:n,quantity:r}})}},V=class extends _{constructor(e){super({eventName:`epigraph_item_moved`,interactiveEvent:!0,customParameters:{items:e}})}},H=class extends _{static{this.CURRENCY=S}constructor(e,t,n,r){super({eventName:`epigraph_item_removed`,interactiveEvent:!0,customParameters:{items:r,value:e,currency:t,quantity:n}})}},U=class extends _{static{this.VARIANT_CHANGE_TYPES=v}constructor(e,t){super({eventName:`epigraph_variant_changed`,interactiveEvent:!0,customParameters:{items:t,change_type:e}})}},W=class extends _{static{this.CONTENT_TYPES=E}static{this.SHARE_DESTINATIONS=D}constructor(e,t,n){super({eventName:`epigraph_content_shared`,interactiveEvent:!0,customParameters:{items:n,content_type:e,share_destination:t}})}},G=class extends _{static{this.CURRENCY=S}constructor(e,t,n){super({eventName:`epigraph_checkout`,interactiveEvent:!0,customParameters:{items:n,value:e,currency:t}})}},K=class extends _{static{this.CURRENCY=S}constructor(e,t,n){super({eventName:`epigraph_conversion`,interactiveEvent:!0,customParameters:{items:n,value:e,currency:t}})}},q=class extends _{constructor(e){super({eventName:`epigraph_changeRate`,interactiveEvent:!1,customParameters:{value:e}})}},J=class extends _{constructor(e){super({eventName:`epigraph_completionRate`,interactiveEvent:!1,customParameters:{value:e}})}},Y=class extends _{constructor(e){super({eventName:`epigraph_engagementRate`,interactiveEvent:!1,customParameters:{value:e}})}},X=class extends _{constructor(e,t,n){super({eventName:e,interactiveEvent:t,customParameters:n})}},Z=Symbol(`analyticsPluginsMap`),Q=class{constructor(e,n,r){this[Z]=new Map,this.__consentPlugin=null,this.__autoConsentResolver=new g,this.__onConsentChangeFromEvent=e=>{let n=e;this.__overrideConsent=n.detail.hasConsent;for(let e of this[Z].values())this.__resolveConsent()!==`granted`&&e.setStatus(t.RESTRICTED)},this.__defaultConsent=r?.defaultConsent??!0,e&&n&&(this.__consentPlugin=this.buildConsentPlugin(e,n)),window.addEventListener(`epigraphAnalyticsConsentChange`,this.__onConsentChangeFromEvent)}addEventPlugin(e){this[Z].has(e.getUniquePluginIdentifier())||(this[Z].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__resolveConsent(){if(this.__overrideConsent!==void 0)return this.__overrideConsent?`granted`:`denied`;if(this.__consentPlugin)return this.__consentPlugin.hasConsent()?`granted`:`denied`;let e=this.__autoConsentResolver.resolve();return e===`unknown`?this.__defaultConsent?`granted`:`unknown`:e}sendEvent(e){let n=this.__resolveConsent();if(n===`denied`){this[Z].forEach(e=>{e.setStatus(t.RESTRICTED)});return}this[Z].forEach(t=>{t.sendEvent(e,n===`granted`)})}buildConsentPlugin(e,t){return e.toLowerCase()===h.OneTrust.toLowerCase()?new m(t):null}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return f}});
@@ -92,7 +92,7 @@ var t = /* @__PURE__ */ function(e) {
92
92
  }
93
93
  }, d = class {
94
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();
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
96
  }
97
97
  setTrackingID(e) {
98
98
  if (!e) return;
@@ -127,11 +127,11 @@ var t = /* @__PURE__ */ function(e) {
127
127
  this.__isInitialized && this.dataLayer !== void 0 && this.dequeueAndSendEvents();
128
128
  }
129
129
  async sendEvent(e, n) {
130
- if (this.__queue.enqueue(e), !n) {
131
- this.__status = t.RESTRICTED;
130
+ if (this.__queue.size >= this.__maxQueuedEvents && this.__queue.dequeue(), this.__queue.enqueue(e), !n) {
131
+ this.setStatus(t.RESTRICTED);
132
132
  return;
133
133
  }
134
- if (!this.__isInitialized) {
134
+ if (this.__status === t.RESTRICTED && this.__isInitialized && this.setStatus(t.AVAILABLE), this.__isInitialized || this.initializePlugin(), !this.__isInitialized) {
135
135
  this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");
136
136
  return;
137
137
  }
@@ -146,17 +146,13 @@ var t = /* @__PURE__ */ function(e) {
146
146
  }
147
147
  initializePlugin() {
148
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
149
  let e = performance.now();
154
150
  if (this.__initializationAttempts > 0 && e - this.__lastInitializationAttempt < this.__initializationRetryDelay) return;
155
151
  this.__lastInitializationAttempt = e, this.__initializationAttempts++;
156
152
  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(() => {
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(() => {
158
154
  this.initializePlugin();
159
- }, this.__initializationRetryDelay));
155
+ }, this.__initializationRetryDelay) : this.__nexusFailureReported || (this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS", "Maximum initialization attempts reached"), this.__nexusFailureReported = !0, this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION, {})));
160
156
  }
161
157
  detectAndSetupAnalytics() {
162
158
  let e = this.detectGTM();
@@ -182,15 +178,23 @@ var t = /* @__PURE__ */ function(e) {
182
178
  };
183
179
  }
184
180
  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";
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";
192
196
  return {
193
- containerId: t[1],
197
+ containerId: e[1],
194
198
  dataLayerName: r
195
199
  };
196
200
  }
@@ -198,6 +202,10 @@ var t = /* @__PURE__ */ function(e) {
198
202
  }
199
203
  return null;
200
204
  }
205
+ getRuntimeDataLayerName(e) {
206
+ let t = e?.dataLayer?.name ?? e?.dataLayerName;
207
+ return typeof t == "string" && t.length > 0 ? t : void 0;
208
+ }
201
209
  async dequeueAndSendEvents() {
202
210
  if (!this.__isInitialized || !this.dataLayer) return;
203
211
  let e = this.__queue.size;
@@ -216,7 +224,11 @@ var t = /* @__PURE__ */ function(e) {
216
224
  }
217
225
  async sendGA4Event(e) {
218
226
  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));
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));
220
232
  }
221
233
  isValidPayload(e) {
222
234
  if (Object.keys(e).length >= 25) return !1;
@@ -282,14 +294,11 @@ var t = /* @__PURE__ */ function(e) {
282
294
  }
283
295
  }
284
296
  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
- }
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
+ };
293
302
  let t = document.querySelectorAll("script[src]");
294
303
  for (let n of t) {
295
304
  let t = n.getAttribute("src");
@@ -306,7 +315,7 @@ var t = /* @__PURE__ */ function(e) {
306
315
  }
307
316
  }, f = class {
308
317
  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, {});
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, {});
310
319
  }
311
320
  getStatus() {
312
321
  return this.__status;
@@ -328,11 +337,11 @@ var t = /* @__PURE__ */ function(e) {
328
337
  }
329
338
  setupPlugin() {}
330
339
  async sendEvent(e, n) {
331
- if (this.__queue.enqueue(e), !n) {
332
- this.__status = t.RESTRICTED, this.__epigraphNotifier.updateStatus(this.__status);
340
+ if (this.__queue.size >= this.__maxQueuedEvents && this.__queue.dequeue(), this.__queue.enqueue(e), !n) {
341
+ this.setStatus(t.RESTRICTED);
333
342
  return;
334
343
  }
335
- await this.dequeueAndSendEvents();
344
+ this.__status === t.RESTRICTED && this.setStatus(t.AVAILABLE), await this.dequeueAndSendEvents();
336
345
  }
337
346
  async dequeueAndSendEvents() {
338
347
  for (let e = 0; e < this.__queue.size; e++) {
@@ -443,23 +452,47 @@ var t = /* @__PURE__ */ function(e) {
443
452
  hasConsent() {
444
453
  if (this.consentSet) return this.consent;
445
454
  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
- });
455
+ let e = String(window.OnetrustActiveGroups).split(",");
456
+ this.consent = e.includes(this.consentIdentifier), this.consentSet = !0;
450
457
  }
451
458
  return this.consent;
452
459
  }
453
460
  addConsentChangedListener() {
454
- window.addEventListener("load", () => {
455
- this.hasConsent(), window.OneTrust !== void 0 && typeof window.OneTrust == "object" && window.OneTrust.OnConsentChanged(() => {
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(() => {
456
466
  this.consentSet = !1, this.hasConsent();
457
467
  });
458
- });
468
+ return;
469
+ }
470
+ e > 0 && setTimeout(() => this.registerOnConsentChanged(e - 1), 1e3);
459
471
  }
460
472
  }, h = /* @__PURE__ */ function(e) {
461
473
  return e.OneTrust = "onetrust", e;
462
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 {
463
496
  constructor({ eventName: e, interactiveEvent: t, customParameters: n }) {
464
497
  this.eventName = e, this.interactiveEvent = t, this.customParameters = n;
465
498
  }
@@ -467,7 +500,6 @@ var t = /* @__PURE__ */ function(e) {
467
500
  let r = {
468
501
  solution: e,
469
502
  experience_id: t,
470
- event: this.eventName,
471
503
  interactive_event: this.interactiveEvent,
472
504
  send_to: n
473
505
  };
@@ -487,27 +519,27 @@ var t = /* @__PURE__ */ function(e) {
487
519
  let e = { interactive_event: this.interactiveEvent };
488
520
  return e = Object.assign(e, JSON.parse(JSON.stringify(this.customParameters))), e;
489
521
  }
490
- }, _ = /* @__PURE__ */ function(e) {
522
+ }, v = /* @__PURE__ */ function(e) {
491
523
  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
524
  }({}), 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;
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;
496
526
  }({}), b = /* @__PURE__ */ function(e) {
497
- return e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", 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;
498
528
  }({}), x = /* @__PURE__ */ function(e) {
499
- return e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e;
529
+ return e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", e;
500
530
  }({}), S = /* @__PURE__ */ function(e) {
501
- return e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e;
531
+ return e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e;
502
532
  }({}), 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;
533
+ return e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e;
504
534
  }({}), w = /* @__PURE__ */ function(e) {
505
- return e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", 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;
506
536
  }({}), T = /* @__PURE__ */ function(e) {
507
- return e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e;
537
+ return e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", e;
508
538
  }({}), E = /* @__PURE__ */ function(e) {
539
+ return e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e;
540
+ }({}), D = /* @__PURE__ */ function(e) {
509
541
  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 {
542
+ }({}), O = class extends _ {
511
543
  constructor(e) {
512
544
  super({
513
545
  eventName: "epigraph_ar_requested",
@@ -515,7 +547,7 @@ var t = /* @__PURE__ */ function(e) {
515
547
  customParameters: { items: e }
516
548
  });
517
549
  }
518
- }, O = class extends g {
550
+ }, k = class extends _ {
519
551
  constructor(e) {
520
552
  super({
521
553
  eventName: "epigraph_module_loading",
@@ -523,7 +555,7 @@ var t = /* @__PURE__ */ function(e) {
523
555
  customParameters: { is_pre_config: e }
524
556
  });
525
557
  }
526
- }, k = class extends g {
558
+ }, A = class extends _ {
527
559
  constructor(e, t) {
528
560
  super({
529
561
  eventName: "epigraph_module_ready",
@@ -534,9 +566,9 @@ var t = /* @__PURE__ */ function(e) {
534
566
  }
535
567
  });
536
568
  }
537
- }, A = class extends g {
569
+ }, j = class extends _ {
538
570
  static {
539
- this.MODULE_FAILED_ERRORS = y;
571
+ this.MODULE_FAILED_ERRORS = b;
540
572
  }
541
573
  constructor(e, t, n) {
542
574
  super({
@@ -549,7 +581,7 @@ var t = /* @__PURE__ */ function(e) {
549
581
  }
550
582
  });
551
583
  }
552
- }, j = class extends g {
584
+ }, M = class extends _ {
553
585
  constructor(e) {
554
586
  super({
555
587
  eventName: "epigraph_module_closed",
@@ -557,9 +589,9 @@ var t = /* @__PURE__ */ function(e) {
557
589
  customParameters: { items: e }
558
590
  });
559
591
  }
560
- }, M = class extends g {
592
+ }, N = class extends _ {
561
593
  static {
562
- this.SUPPORT_TYPE = S;
594
+ this.SUPPORT_TYPE = C;
563
595
  }
564
596
  constructor(e) {
565
597
  super({
@@ -568,9 +600,9 @@ var t = /* @__PURE__ */ function(e) {
568
600
  customParameters: { support_type: e }
569
601
  });
570
602
  }
571
- }, N = class extends g {
603
+ }, P = class extends _ {
572
604
  static {
573
- this.BUTTON_TYPE = C;
605
+ this.BUTTON_TYPE = w;
574
606
  }
575
607
  constructor(e, t) {
576
608
  super({
@@ -582,12 +614,12 @@ var t = /* @__PURE__ */ function(e) {
582
614
  }
583
615
  });
584
616
  }
585
- }, P = class extends g {
617
+ }, F = class extends _ {
586
618
  static {
587
- this.PANEL_TYPE = v;
619
+ this.PANEL_TYPE = y;
588
620
  }
589
621
  static {
590
- this.TRIGGER_SOURCE = b;
622
+ this.TRIGGER_SOURCE = x;
591
623
  }
592
624
  constructor(e, t, n, r) {
593
625
  super({
@@ -600,12 +632,12 @@ var t = /* @__PURE__ */ function(e) {
600
632
  }
601
633
  });
602
634
  }
603
- }, F = class extends g {
635
+ }, I = class extends _ {
604
636
  static {
605
- this.PANEL_TYPE = v;
637
+ this.PANEL_TYPE = y;
606
638
  }
607
639
  static {
608
- this.TRIGGER_SOURCE = b;
640
+ this.TRIGGER_SOURCE = x;
609
641
  }
610
642
  constructor(e, t, n, r) {
611
643
  super({
@@ -618,7 +650,7 @@ var t = /* @__PURE__ */ function(e) {
618
650
  }
619
651
  });
620
652
  }
621
- }, I = class extends g {
653
+ }, L = class extends _ {
622
654
  constructor(e) {
623
655
  super({
624
656
  eventName: "epigraph_add_to_favourites",
@@ -626,9 +658,9 @@ var t = /* @__PURE__ */ function(e) {
626
658
  customParameters: { items: e }
627
659
  });
628
660
  }
629
- }, L = class extends g {
661
+ }, R = class extends _ {
630
662
  static {
631
- this.ACTION_PERFORMED = w;
663
+ this.ACTION_PERFORMED = T;
632
664
  }
633
665
  constructor(e) {
634
666
  super({
@@ -637,9 +669,9 @@ var t = /* @__PURE__ */ function(e) {
637
669
  customParameters: { action_performed: e }
638
670
  });
639
671
  }
640
- }, R = class extends g {
672
+ }, z = class extends _ {
641
673
  static {
642
- this.INTERACTION_TYPE = w;
674
+ this.INTERACTION_TYPE = T;
643
675
  }
644
676
  constructor(e) {
645
677
  super({
@@ -648,9 +680,9 @@ var t = /* @__PURE__ */ function(e) {
648
680
  customParameters: { interaction_type: e }
649
681
  });
650
682
  }
651
- }, z = class extends g {
683
+ }, B = class extends _ {
652
684
  static {
653
- this.CURRENCY = x;
685
+ this.CURRENCY = S;
654
686
  }
655
687
  constructor(e, t, n, r, i) {
656
688
  super({
@@ -664,7 +696,7 @@ var t = /* @__PURE__ */ function(e) {
664
696
  }
665
697
  });
666
698
  }
667
- }, B = class extends g {
699
+ }, V = class extends _ {
668
700
  constructor(e) {
669
701
  super({
670
702
  eventName: "epigraph_item_moved",
@@ -672,9 +704,9 @@ var t = /* @__PURE__ */ function(e) {
672
704
  customParameters: { items: e }
673
705
  });
674
706
  }
675
- }, V = class extends g {
707
+ }, H = class extends _ {
676
708
  static {
677
- this.CURRENCY = x;
709
+ this.CURRENCY = S;
678
710
  }
679
711
  constructor(e, t, n, r) {
680
712
  super({
@@ -688,9 +720,9 @@ var t = /* @__PURE__ */ function(e) {
688
720
  }
689
721
  });
690
722
  }
691
- }, H = class extends g {
723
+ }, U = class extends _ {
692
724
  static {
693
- this.VARIANT_CHANGE_TYPES = _;
725
+ this.VARIANT_CHANGE_TYPES = v;
694
726
  }
695
727
  constructor(e, t) {
696
728
  super({
@@ -702,12 +734,12 @@ var t = /* @__PURE__ */ function(e) {
702
734
  }
703
735
  });
704
736
  }
705
- }, U = class extends g {
737
+ }, W = class extends _ {
706
738
  static {
707
- this.CONTENT_TYPES = T;
739
+ this.CONTENT_TYPES = E;
708
740
  }
709
741
  static {
710
- this.SHARE_DESTINATIONS = E;
742
+ this.SHARE_DESTINATIONS = D;
711
743
  }
712
744
  constructor(e, t, n) {
713
745
  super({
@@ -720,9 +752,9 @@ var t = /* @__PURE__ */ function(e) {
720
752
  }
721
753
  });
722
754
  }
723
- }, W = class extends g {
755
+ }, G = class extends _ {
724
756
  static {
725
- this.CURRENCY = x;
757
+ this.CURRENCY = S;
726
758
  }
727
759
  constructor(e, t, n) {
728
760
  super({
@@ -735,9 +767,9 @@ var t = /* @__PURE__ */ function(e) {
735
767
  }
736
768
  });
737
769
  }
738
- }, G = class extends g {
770
+ }, K = class extends _ {
739
771
  static {
740
- this.CURRENCY = x;
772
+ this.CURRENCY = S;
741
773
  }
742
774
  constructor(e, t, n) {
743
775
  super({
@@ -750,7 +782,7 @@ var t = /* @__PURE__ */ function(e) {
750
782
  }
751
783
  });
752
784
  }
753
- }, K = class extends g {
785
+ }, q = class extends _ {
754
786
  constructor(e) {
755
787
  super({
756
788
  eventName: "epigraph_changeRate",
@@ -758,7 +790,7 @@ var t = /* @__PURE__ */ function(e) {
758
790
  customParameters: { value: e }
759
791
  });
760
792
  }
761
- }, q = class extends g {
793
+ }, J = class extends _ {
762
794
  constructor(e) {
763
795
  super({
764
796
  eventName: "epigraph_completionRate",
@@ -766,7 +798,7 @@ var t = /* @__PURE__ */ function(e) {
766
798
  customParameters: { value: e }
767
799
  });
768
800
  }
769
- }, J = class extends g {
801
+ }, Y = class extends _ {
770
802
  constructor(e) {
771
803
  super({
772
804
  eventName: "epigraph_engagementRate",
@@ -774,7 +806,7 @@ var t = /* @__PURE__ */ function(e) {
774
806
  customParameters: { value: e }
775
807
  });
776
808
  }
777
- }, Y = class extends g {
809
+ }, X = class extends _ {
778
810
  constructor(e, t, n) {
779
811
  super({
780
812
  eventName: e,
@@ -782,25 +814,33 @@ var t = /* @__PURE__ */ function(e) {
782
814
  customParameters: n
783
815
  });
784
816
  }
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);
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);
793
824
  }
794
825
  addEventPlugin(e) {
795
- this[X].has(e.getUniquePluginIdentifier()) || (this[X].set(e.getUniquePluginIdentifier(), e), e.setupPlugin());
826
+ this[Z].has(e.getUniquePluginIdentifier()) || (this[Z].set(e.getUniquePluginIdentifier(), e), e.setupPlugin());
796
827
  }
797
- __hasConsent() {
798
- let e = !0;
799
- return this.__overrideConsent === void 0 ? (this.__consentPlugin && (e = this.__consentPlugin.hasConsent()), e) : (e = this.__overrideConsent, e);
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;
800
833
  }
801
834
  sendEvent(e) {
802
- this[X].forEach((t) => {
803
- t.sendEvent(e, this.__hasConsent());
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");
804
844
  });
805
845
  }
806
846
  buildConsentPlugin(e, t) {
@@ -808,4 +848,4 @@ var t = /* @__PURE__ */ function(e) {
808
848
  }
809
849
  };
810
850
  //#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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/epigraph-std-lib",
3
- "version": "5.0.0-alpha.15",
3
+ "version": "5.0.0-alpha.17",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-std-lib.cjs",
6
6
  "module": "./dist/epigraph-std-lib.js",
@@ -1 +0,0 @@
1
- const e=require("./enums-PfFMiIoe.cjs");var t=function(e){return e.UNAVAILABLE=`unavailable`,e.AVAILABLE=`available`,e.RESTRICTED=`restricted`,e}({}),n=Symbol(`data`),r=Symbol(`next`),i=class e{constructor(e){this[n]=e,this[r]=null}get data(){return this[n]}set next(t){if(!(t instanceof e)&&t!==null)throw Error(`This node is not an instance of the custom class 'Node'.`);this[r]=t}get next(){return this[r]}},a=Symbol(`head`),o=class{constructor(){this[a]=null}set head(e){this[a]=e}get head(){return this[a]}addToTail(e){let t=this.head;if(t){for(;t.next!==null;)t=t?.next;return t.next=new i(e)}return this.head=new i(e)}removeHead(){let e=this.head;if(e)return this.head=e.next,e.data}},s=Symbol(`queue`),c=Symbol(`size`),l=class{constructor(){this[s]=new o,this[c]=0}get queue(){return this[s]}get size(){return this[c]}enqueue(e){this.queue.addToTail(e),this[c]++}dequeue(){let e=this.queue.removeHead();return this[c]--,e}},u=class{static{this.NOTIFICATION_NAME=`epg-notification`}static{this.ACTION_SEND_EVENT=`send-event`}static{this.ACTION_INITIALIZED=`initialized`}static{this.ACTION_FAILED_INITIALIZATION=`initialization-failed`}constructor(e,t,n,r,i,a){this._pluginName=e,this._trackingId=t,this._experienceId=n,this._solution=r,this._initializer=i,this._status=a}updateStatus(e){this._status=e}updateInitializer(e){this._initializer=e}notify(e,t){let n={pluginName:this._pluginName,trackingId:this._trackingId,experienceId:this._experienceId,solution:this._solution,initializer:this._initializer,status:this._status,action:e,eventDetails:t};window.dispatchEvent(new CustomEvent(`epg-notification`,{detail:n}))}},d=class{constructor({trackingID:e,experienceID:n,solution:r,verboseLogging:i=!1}){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()}setTrackingID(e){if(!e)return;let t=this.trackingID!==e;this.trackingID=e,t&&this.__isInitialized&&(this.resetInitialization(),this.initializePlugin())}setExperienceID(e){this.experienceID=e}setSolution(e){this.solution=e}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return`${this.name}-${this.trackingID}`}setupPlugin(){this.__isInitialized&&this.dataLayer!==void 0&&this.dequeueAndSendEvents()}async sendEvent(e,n){if(this.__queue.enqueue(e),!n){this.__status=t.RESTRICTED;return}if(!this.__isInitialized){this.logger(`Cannot send analytics event: dataLayer not defined or plugin not initialized.`);return}try{await this.dequeueAndSendEvents()}catch(e){this.logger(e),await this.reportFailureToNexus(`EVENT_SEND_ERROR`,e?.toString()||`Unknown error`)}}resetInitialization(){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)}initializePlugin(){if(this.__isInitialized)return;if(this.__initializationAttempts>=this.__maxInitializationAttempts){this.__nexusFailureReported||(this.reportFailureToNexus(`MAX_INITIALIZATION_ATTEMPTS`,`Maximum initialization attempts reached`),this.__nexusFailureReported=!0,this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION,{}));return}let e=performance.now();if(this.__initializationAttempts>0&&e-this.__lastInitializationAttempt<this.__initializationRetryDelay)return;this.__lastInitializationAttempt=e,this.__initializationAttempts++;let n=this.detectAndSetupAnalytics();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(()=>{this.initializePlugin()},this.__initializationRetryDelay))}detectAndSetupAnalytics(){let e=this.detectGTM();if(e)return this.logger(`GTM detected with container ID: ${e.containerId}`),this.__epigraphNotifier.updateInitializer(`GTM`),{success:!0,method:`GTM`,dataLayerName:e.dataLayerName};let t=this.findGA4Info(this.trackingID);if(t){let e=t.l||`dataLayer`;return this.logger(`GA4 script found, setting up with dataLayer: ${e}`),this.__epigraphNotifier.updateInitializer(`GA4`),{success:!0,method:`GA4`,dataLayerName:e}}return{success:!1,method:`NONE`,dataLayerName:`dataLayer`,error:`No analytics setup found and unable to create one`}}detectGTM(){let e=document.querySelectorAll(`script[src*="googletagmanager.com/gtm"]`);for(let t of Array.from(e)){let e=t.getAttribute(`src`);if(e){let t=e.match(/gtm\.js\?id=([^&]+)/);if(t&&t.length>0){let n=e.match(/&l=([^&]+)/),r=n?n[1]:`dataLayer`;return{containerId:t[1],dataLayerName:r}}}}return null}async dequeueAndSendEvents(){if(!this.__isInitialized||!this.dataLayer)return;let e=this.__queue.size;for(let t=0;t<e;t++){let e=this.__queue.dequeue();try{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)}catch(t){this.logger(`Error sending event ${e.eventName}: ${t}`),this.__queue.enqueue(e)}}}async sendGTMEvent(e){let t=e.getGTMParameters(this.solution,this.experienceID,this.trackingID),n=t;this.isValidPayload(t)||(t=await this.convertGTMParametersToEpgEventTag(e.eventName,t)),this.dataLayer&&(this.dataLayer.push(t),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}async sendGA4Event(e){let t=e.getGa4Parameters(this.solution,this.experienceID,this.trackingID),n=t;this.isValidPayload(t)||(t=await this.convertGA4ParametersToEpgEventTag(t)),this.dataLayer&&(this.dataLayer?.push(t),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}isValidPayload(e){if(Object.keys(e).length>=25)return!1;for(let[t,n]of Object.entries(e))if(t!==`items`&&(t.length>40||String(n).length>100))return!1;return!0}async convertGTMParametersToEpgEventTag(e,t){try{return{event:e,epg_event_tag:await this.sendGA4LongParameters(t),send_to:this.trackingID}}catch{return t}}async convertGA4ParametersToEpgEventTag(e){try{return{epg_event_tag:await this.sendGA4LongParameters(e),send_to:this.trackingID}}catch{return e}}logger(e){this.verboseLogging&&console.warn(e)}async sendGA4LongParameters(e){let t={parameters:e};try{let e=await fetch(`https://api.myepigraph.com/api/analytics/ga4/custom`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`},body:JSON.stringify(t)});return e.ok?(await e.json())?.id??``:``}catch{return``}}async reportFailureToNexus(e,t){try{let n={plugin:`GA4`,trackingId:this.trackingID,solution:this.solution,experienceId:this.experienceID,failureType:e,errorMessage:t,timestamp:new Date().toISOString(),url:window.location.href,userAgent:navigator.userAgent};this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`)}catch(e){this.logger(`Error reporting failure to Nexus: ${e}`)}}findGA4Info(e){if(window.google_tag_manager&&window.google_tag_manager[e]){let t=window.google_tag_manager[e];if(t&&t.dataLayerName)return{fullSrc:``,id:e,l:t.dataLayerName}}let t=document.querySelectorAll(`script[src]`);for(let n of t){let t=n.getAttribute(`src`);if(t&&t.includes(e)){let e=new URL(t,location.href),n=Object.fromEntries(e.searchParams.entries());return{fullSrc:e.href,id:n.id||void 0,l:n.l||void 0}}}return null}},f=class{constructor({trackingID:n,experienceID:r,solution:i,sessionId:a,xPath:o,verboseLogging:s=!1,baseUrl:c=e.n.PRODUCTION}){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,{})}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return this.name+`-`+this.trackingID}setupPlugin(){}async sendEvent(e,n){if(this.__queue.enqueue(e),!n){this.__status=t.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(let e=0;e<this.__queue.size;e++){let e=this.__queue.dequeue(),t={send_to:this.trackingID,experience_id:this.experienceID,solution:this.solution,event:e.eventName,parameters:e.getNexusParameters()};try{return(await fetch(this.url,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"EPG-SESSION-ID":this.sessionId,"EPG-XPATH":this.xPath,Origin:typeof window<`u`?window.location.origin:``},body:JSON.stringify(t)})).ok&&this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,t),``}catch{return``}this.__sentEventCount++}return``}},p=class{constructor({productId:n,identifier:r,identifierType:i,experienceType:a,renderMode:o=`geo`,sessionId:s,xPath:c,solution:d=``,verboseLogging:f=!1,baseUrl:p=e.n.PRODUCTION}){if(this.experienceID=``,this.__status=t.UNAVAILABLE,this.__sentEventCount=0,n<=0)throw Error(`NexusSolutionsAnalyticsPlugin requires a valid productId greater than 0.`);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,{})}setProductId(e){e<=0||(this.productId=e,this.trackingID=String(e))}setIdentifier(e){this.identifier=e}setIdentifierType(e){this.identifierType=e}setExperienceType(e){this.experienceType=e}setRenderMode(e){this.renderMode=e}getStatus(){return this.__status}setStatus(e){this.__status=e,this.__epigraphNotifier.updateStatus(e)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return`${this.name}-${this.sessionId}`}setupPlugin(){}async sendEvent(e,n){if(this.__queue.enqueue(e),!n){this.__status=t.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(;this.__queue.size>0;){let e=this.__queue.dequeue(),t={action:e.eventName,product_id:this.productId,identifier:this.identifier,identifier_type:this.identifierType,experience_type:this.experienceType,render_mode:this.renderMode,parameters:e.getNexusParameters()};try{(await fetch(this.url,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"EPG-SESSION-ID":this.sessionId,"EPG-XPATH":this.xPath,Origin:typeof window<`u`?window.location.origin:``},body:JSON.stringify(t)})).ok&&(this.__sentEventCount++,this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,t))}catch{return}}}},m=class{constructor(e){this.consentSet=!1,this.consent=!1,this.pluginName=`OneTrustConsentPlugin`,this.consentIdentifier=e,this.consent=!1,this.addConsentChangedListener()}hasConsent(){if(this.consentSet)return this.consent;if(window.OnetrustActiveGroups!==void 0){let e=window.OnetrustActiveGroups;e!==void 0&&e.split(`,`).forEach(e=>{e===this.consentIdentifier&&(this.consent=!0,this.consentSet=!0)})}return this.consent}addConsentChangedListener(){window.addEventListener(`load`,()=>{this.hasConsent(),window.OneTrust!==void 0&&typeof window.OneTrust==`object`&&window.OneTrust.OnConsentChanged(()=>{this.consentSet=!1,this.hasConsent()})})}},h=function(e){return e.OneTrust=`onetrust`,e}({}),g=class{constructor({eventName:e,interactiveEvent:t,customParameters:n}){this.eventName=e,this.interactiveEvent=t,this.customParameters=n}getGa4Parameters(e,t,n){let r={solution:e,experience_id:t,event:this.eventName,interactive_event:this.interactiveEvent,send_to:n};return r=Object.assign(r,JSON.parse(JSON.stringify(this.customParameters))),r}getGTMParameters(e,t,n){let r={solution:e,experience_id:t,event:this.eventName,interactive_event:this.interactiveEvent,send_to:n};return r=Object.assign(r,JSON.parse(JSON.stringify(this.customParameters))),r}getNexusParameters(){let e={interactive_event:this.interactiveEvent};return e=Object.assign(e,JSON.parse(JSON.stringify(this.customParameters))),e}},_=function(e){return e.VARIANT=`variant`,e.CATEGORY_VARIANT=`category_variant`,e.GEOMETRY=`geometry`,e.CATEGORY_GEOMETRY=`category_geometry`,e.GLOBAL=`global`,e}({}),v=function(e){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}({}),y=function(e){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}({}),b=function(e){return e.AUTO=`auto`,e.BUTTON=`button`,e.HOTSPOT=`hotspot`,e.GESTURE=`gesture`,e}({}),x=function(e){return e.USD=`USD`,e.EUR=`EUR`,e.GBP=`GBP`,e.CAD=`CAD`,e}({}),S=function(e){return e.AR=`ar`,e.QR=`qr`,e.AR_WEBGL2=`ar-webgl2`,e.QR_WEBGL2=`qr-webgl2`,e}({}),C=function(e){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}({}),w=function(e){return e.ZOOM=`zoom`,e.ROTATE=`rotate`,e.PAN=`pan`,e}({}),T=function(e){return e.CONFIGURATION=`configuration`,e.SCENE=`scene`,e.PRODUCT=`product`,e}({}),E=function(e){return e.FACEBOOK=`facebook`,e.TWITTER=`twitter`,e.EMAIL=`email`,e.COPY_LINK=`copy_link`,e.WHATSAPP=`whatsapp`,e.LINKEDIN=`linkedin`,e}({}),D=class extends g{constructor(e){super({eventName:`epigraph_ar_requested`,interactiveEvent:!0,customParameters:{items:e}})}},O=class extends g{constructor(e){super({eventName:`epigraph_module_loading`,interactiveEvent:!1,customParameters:{is_pre_config:e}})}},k=class extends g{constructor(e,t){super({eventName:`epigraph_module_ready`,interactiveEvent:!1,customParameters:{is_pre_config:e,load_time_ms:t}})}},A=class extends g{static{this.MODULE_FAILED_ERRORS=y}constructor(e,t,n){super({eventName:`epigraph_module_failed`,interactiveEvent:!1,customParameters:{is_pre_config:e,load_time_ms:t,error_type:n}})}},j=class extends g{constructor(e){super({eventName:`epigraph_module_closed`,interactiveEvent:!0,customParameters:{items:e}})}},M=class extends g{static{this.SUPPORT_TYPE=S}constructor(e){super({eventName:`epigraph_support_detected`,interactiveEvent:!1,customParameters:{support_type:e}})}},N=class extends g{static{this.BUTTON_TYPE=C}constructor(e,t){super({eventName:`epigraph_button_click`,interactiveEvent:!0,customParameters:{button_type:e,button_name:t}})}},P=class extends g{static{this.PANEL_TYPE=v}static{this.TRIGGER_SOURCE=b}constructor(e,t,n,r){super({eventName:`epigraph_panel_opened`,interactiveEvent:e,customParameters:{items:r,panel_type:t,trigger_source:n}})}},F=class extends g{static{this.PANEL_TYPE=v}static{this.TRIGGER_SOURCE=b}constructor(e,t,n,r){super({eventName:`epigraph_panel_closed`,interactiveEvent:e,customParameters:{items:r,panel_type:t,trigger_source:n}})}},I=class extends g{constructor(e){super({eventName:`epigraph_add_to_favourites`,interactiveEvent:!0,customParameters:{items:e}})}},L=class extends g{static{this.ACTION_PERFORMED=w}constructor(e){super({eventName:`epigraph_keyboard_interaction`,interactiveEvent:!0,customParameters:{action_performed:e}})}},R=class extends g{static{this.INTERACTION_TYPE=w}constructor(e){super({eventName:`epigraph_touch_interaction`,interactiveEvent:!0,customParameters:{interaction_type:e}})}},z=class extends g{static{this.CURRENCY=x}constructor(e,t,n,r,i){super({eventName:`epigraph_item_added`,interactiveEvent:e,customParameters:{items:i,value:t,currency:n,quantity:r}})}},B=class extends g{constructor(e){super({eventName:`epigraph_item_moved`,interactiveEvent:!0,customParameters:{items:e}})}},V=class extends g{static{this.CURRENCY=x}constructor(e,t,n,r){super({eventName:`epigraph_item_removed`,interactiveEvent:!0,customParameters:{items:r,value:e,currency:t,quantity:n}})}},H=class extends g{static{this.VARIANT_CHANGE_TYPES=_}constructor(e,t){super({eventName:`epigraph_variant_changed`,interactiveEvent:!0,customParameters:{items:t,change_type:e}})}},U=class extends g{static{this.CONTENT_TYPES=T}static{this.SHARE_DESTINATIONS=E}constructor(e,t,n){super({eventName:`epigraph_content_shared`,interactiveEvent:!0,customParameters:{items:n,content_type:e,share_destination:t}})}},W=class extends g{static{this.CURRENCY=x}constructor(e,t,n){super({eventName:`epigraph_checkout`,interactiveEvent:!0,customParameters:{items:n,value:e,currency:t}})}},G=class extends g{static{this.CURRENCY=x}constructor(e,t,n){super({eventName:`epigraph_conversion`,interactiveEvent:!0,customParameters:{items:n,value:e,currency:t}})}},K=class extends g{constructor(e){super({eventName:`epigraph_changeRate`,interactiveEvent:!1,customParameters:{value:e}})}},q=class extends g{constructor(e){super({eventName:`epigraph_completionRate`,interactiveEvent:!1,customParameters:{value:e}})}},J=class extends g{constructor(e){super({eventName:`epigraph_engagementRate`,interactiveEvent:!1,customParameters:{value:e}})}},Y=class extends g{constructor(e,t,n){super({eventName:e,interactiveEvent:t,customParameters:n})}},X=Symbol(`analyticsPluginsMap`),Z=class{constructor(e,t){this[X]=new Map,this.__consentPlugin=null,e&&t&&(this.__consentPlugin=this.buildConsentPlugin(e,t)),window.addEventListener(`epigraphAnalyticsConsentChange`,this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(e){let n=e;this.__overrideConsent=n.detail.hasConsent;for(let e of this[X].values())this.__hasConsent()||e.setStatus(t.RESTRICTED)}addEventPlugin(e){this[X].has(e.getUniquePluginIdentifier())||(this[X].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}__hasConsent(){let e=!0;return this.__overrideConsent===void 0?(this.__consentPlugin&&(e=this.__consentPlugin.hasConsent()),e):(e=this.__overrideConsent,e)}sendEvent(e){this[X].forEach(t=>{t.sendEvent(e,this.__hasConsent())})}buildConsentPlugin(e,t){return e.toLowerCase()===h.OneTrust.toLowerCase()?new m(t):null}};Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return d}});