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

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../lit-element-CYaaFRfk.cjs"),e=require("./epigraph.cjs");class s extends HTMLElement{constructor(t,i){super(),this._isReady=!1,this._elementName="epigraph-base-solution-html",this._solutionVersion="",this._loggerContextOverride="[EPIGRAPH BASE SOLUTION]",this.attachShadow({mode:"open"}),this._environment=i,this._solutionVersion=t,this._xPath=e.Epigraph.generateXPath(this),this._uuid=e.Epigraph.safeGenerateUuid()??this._xPath,new e.Epigraph(this),window.epigraph.logger.info({title:"Epigraph Base Solution Ready",contextOverride:this._loggerContextOverride})}get isReady(){return this._isReady}get environment(){return this._environment}get elementName(){return this._elementName}get solutionVersion(){return this._solutionVersion}get uuid(){return this._uuid}get xPath(){return this._xPath}disconnectedCallback(){window.epigraph.deregisterActiveComponent(this)}}class o extends r.i{constructor(t,i){super(),this._isReady=!1,this._elementName="epigraph-base-solution-lit",this._solutionVersion="",this._loggerContextOverride="[EPIGRAPH BASE SOLUTION]",this._environment=i,this._solutionVersion=t,this._xPath=e.Epigraph.generateXPath(this),this._uuid=e.Epigraph.safeGenerateUuid()??this._xPath,new e.Epigraph(this),this._isReady=!0,window.epigraph.logger.info({title:"Epigraph Base Solution Ready",contextOverride:this._loggerContextOverride})}get isReady(){return this._isReady}get environment(){return this._environment}get elementName(){return this._elementName}get solutionVersion(){return this._solutionVersion}get uuid(){return this._uuid}get xPath(){return this._xPath}disconnectedCallback(){window.epigraph.deregisterActiveComponent(this)}}exports.EpigraphBaseSolutionHtmlElement=s;exports.EpigraphBaseSolutionLitElement=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../lit-element-CYaaFRfk.cjs"),e=require("./epigraph.cjs");class s extends HTMLElement{constructor(t,i){super(),this._isReady=!1,this._elementName="epigraph-base-solution-html",this._solutionVersion="",this._loggerContextOverride="[EPIGRAPH BASE SOLUTION]",this.attachShadow({mode:"open"}),this.__environment=i,this._solutionVersion=t,this.__xPath=e.Epigraph.generateXPath(this),this.__uuid=e.Epigraph.safeGenerateUuid()??this.__xPath,new e.Epigraph(this),window.epigraph.logger.info({title:"Epigraph Base Solution Ready",contextOverride:this._loggerContextOverride})}get isReady(){return this._isReady}get environment(){return this.__environment}get elementName(){return this._elementName}get solutionVersion(){return this._solutionVersion}get uuid(){return this.__uuid}get xPath(){return this.__xPath}disconnectedCallback(){window.epigraph.deregisterActiveComponent(this)}}class o extends r.i{constructor(t,i){super(),this._isReady=!1,this._elementName="epigraph-base-solution-lit",this._solutionVersion="",this._loggerContextOverride="[EPIGRAPH BASE SOLUTION]",this._environment=i,this._solutionVersion=t,this._xPath=e.Epigraph.generateXPath(this),this._uuid=e.Epigraph.safeGenerateUuid()??this._xPath,new e.Epigraph(this),this._isReady=!0,window.epigraph.logger.info({title:"Epigraph Base Solution Ready",contextOverride:this._loggerContextOverride})}get isReady(){return this._isReady}get environment(){return this._environment}get elementName(){return this._elementName}get solutionVersion(){return this._solutionVersion}get uuid(){return this._uuid}get xPath(){return this._xPath}disconnectedCallback(){window.epigraph.deregisterActiveComponent(this)}}exports.EpigraphBaseSolutionHtmlElement=s;exports.EpigraphBaseSolutionLitElement=o;
@@ -1,10 +1,10 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { ENVIRONMENT_TYPE } from './constants/enums';
3
3
  export declare class EpigraphBaseSolutionHtmlElement extends HTMLElement {
4
- private _xPath;
5
- private _uuid;
6
- private _isReady;
7
- private _environment;
4
+ private __xPath;
5
+ private __uuid;
6
+ private __environment;
7
+ protected _isReady: boolean;
8
8
  protected _elementName: string;
9
9
  protected _solutionVersion: string;
10
10
  protected _loggerContextOverride: string;
@@ -23,8 +23,8 @@ export declare class EpigraphBaseSolutionHtmlElement extends HTMLElement {
23
23
  export declare class EpigraphBaseSolutionLitElement extends LitElement {
24
24
  private _xPath;
25
25
  private _uuid;
26
- private _isReady;
27
26
  private _environment;
27
+ protected _isReady: boolean;
28
28
  protected _elementName: string;
29
29
  protected _solutionVersion: string;
30
30
  protected _loggerContextOverride: string;
@@ -2,7 +2,7 @@ import { i as s } from "../lit-element-C3moVMGu.js";
2
2
  import { Epigraph as e } from "./epigraph.js";
3
3
  class h extends HTMLElement {
4
4
  constructor(t, i) {
5
- super(), this._isReady = !1, this._elementName = "epigraph-base-solution-html", this._solutionVersion = "", this._loggerContextOverride = "[EPIGRAPH BASE SOLUTION]", this.attachShadow({ mode: "open" }), this._environment = i, this._solutionVersion = t, this._xPath = e.generateXPath(this), this._uuid = e.safeGenerateUuid() ?? this._xPath, new e(this), window.epigraph.logger.info({
5
+ super(), this._isReady = !1, this._elementName = "epigraph-base-solution-html", this._solutionVersion = "", this._loggerContextOverride = "[EPIGRAPH BASE SOLUTION]", this.attachShadow({ mode: "open" }), this.__environment = i, this._solutionVersion = t, this.__xPath = e.generateXPath(this), this.__uuid = e.safeGenerateUuid() ?? this.__xPath, new e(this), window.epigraph.logger.info({
6
6
  title: "Epigraph Base Solution Ready",
7
7
  contextOverride: this._loggerContextOverride
8
8
  });
@@ -11,7 +11,7 @@ class h extends HTMLElement {
11
11
  return this._isReady;
12
12
  }
13
13
  get environment() {
14
- return this._environment;
14
+ return this.__environment;
15
15
  }
16
16
  get elementName() {
17
17
  return this._elementName;
@@ -23,10 +23,10 @@ class h extends HTMLElement {
23
23
  return this._solutionVersion;
24
24
  }
25
25
  get uuid() {
26
- return this._uuid;
26
+ return this.__uuid;
27
27
  }
28
28
  get xPath() {
29
- return this._xPath;
29
+ return this.__xPath;
30
30
  }
31
31
  disconnectedCallback() {
32
32
  window.epigraph.deregisterActiveComponent(this);
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c=(e=>(e.UNAVAILABLE="unavailable",e.AVAILABLE="available",e.RESTRICTED="restricted",e))(c||{});const O=Symbol("data"),v=Symbol("next"),D=class L{constructor(t){this[O]=t,this[v]=null}get data(){return this[O]}set next(t){if(!(t instanceof L)&&t!==null)throw new Error("This node is not an instance of the custom class 'Node'.");this[v]=t}get next(){return this[v]}};let S=D;const E=Symbol("head");class G{constructor(){this[E]=null}set head(t){this[E]=t}get head(){return this[E]}addToTail(t){let i=this.head;if(i){for(;i.next!==null;)i=i?.next;return i.next=new S(t)}return this.head=new S(t)}removeHead(){const t=this.head;if(t)return this.head=t.next,t.data}}const T=Symbol("queue"),l=Symbol("size");class w{constructor(){this[T]=new G,this[l]=0}get queue(){return this[T]}get size(){return this[l]}enqueue(t){this.queue.addToTail(t),this[l]++}dequeue(){const t=this.queue.removeHead();return this[l]--,t}}class u{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(t,i,n,s,r,o){this._pluginName=t,this._trackingId=i,this._experienceId=n,this._solution=s,this._initializer=r,this._status=o}updateStatus(t){this._status=t}updateInitializer(t){this._initializer=t}notify(t,i){console.log("Notifying",t,i);const n={pluginName:this._pluginName,trackingId:this._trackingId,experienceId:this._experienceId,solution:this._solution,initializer:this._initializer,status:this._status,action:t,eventDetails:i};window.dispatchEvent(new CustomEvent("epg-notification",{detail:n}))}}class z{constructor({trackingID:t,experienceID:i,solution:n,verboseLogging:s=!1}){this.__status=c.UNAVAILABLE,this.__sentEventCount=0,this.__initializationAttempts=0,this.__lastInitializationAttempt=performance.now(),this.__maxInitializationAttempts=10,this.__initializationRetryDelay=2e3,this.__isInitialized=!1,this.__initializationMethod="NONE",this.__nexusFailureReported=!1,this.name=this.pluginName="GA4-PLUGIN",this.trackingID=t,this.experienceID=i,this.solution=n,this.verboseLogging=s,this.__queue=new w,this.__epigraphNotifier=new u(this.pluginName,this.pluginName,this.experienceID,this.solution,this.__initializationMethod,this.__status),this.initializePlugin()}getStatus(){return this.__status}setStatus(t){this.__status=t,this.__epigraphNotifier.updateStatus(t)}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(t,i){if(this.__queue.enqueue(t),!i){this.__status=c.RESTRICTED;return}if(!this.__isInitialized){this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");return}try{await this.dequeueAndSendEvents()}catch(n){this.logger(n),await this.reportFailureToNexus("EVENT_SEND_ERROR",n?.toString()||"Unknown error")}}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}const t=performance.now();if(this.__initializationAttempts>0&&t-this.__lastInitializationAttempt<this.__initializationRetryDelay)return;this.__lastInitializationAttempt=t,this.__initializationAttempts++;const i=this.detectAndSetupAnalytics();i.success?(this.__isInitialized=!0,this.__status=c.AVAILABLE,this.__initializationMethod=i.method,this.dataLayerName=i.dataLayerName,this.dataLayer=window[this.dataLayerName],this.logger(`Successfully initialized ${i.method} with dataLayer: ${this.dataLayerName}`),this.__epigraphNotifier.notify(u.ACTION_INITIALIZED,{}),this.__queue.size>0&&this.dequeueAndSendEvents()):(this.logger(`Initialization attempt ${this.__initializationAttempts} failed: ${i.error}`),this.__initializationAttempts<this.__maxInitializationAttempts&&setTimeout(()=>{this.initializePlugin()},this.__initializationRetryDelay))}detectAndSetupAnalytics(){const t=this.detectGTM();if(t)return this.logger(`GTM detected with container ID: ${t.containerId}`),this.__epigraphNotifier.updateInitializer("GTM"),{success:!0,method:"GTM",dataLayerName:t.dataLayerName};const i=this.findGA4Info(this.trackingID);if(i){const n=i.l||"dataLayer";return this.logger(`GA4 script found, setting up with dataLayer: ${n}`),this.__epigraphNotifier.updateInitializer("GA4"),{success:!0,method:"GA4",dataLayerName:n}}return{success:!1,method:"NONE",dataLayerName:"dataLayer",error:"No analytics setup found and unable to create one"}}detectGTM(){const t=document.querySelectorAll('script[src*="googletagmanager.com/gtm"]');for(const i of Array.from(t)){const n=i.getAttribute("src");if(n){const s=n.match(/gtm\.js\?id=([^&]+)/);if(s&&s.length>0){const r=n.match(/&l=([^&]+)/),o=r?r[1]:"dataLayer";return{containerId:s[1],dataLayerName:o}}}}return null}async dequeueAndSendEvents(){if(!this.__isInitialized||!this.dataLayer)return;let t=this.__queue.size;for(let i=0;i<t;i++){const n=this.__queue.dequeue();try{this.__initializationMethod==="GTM"?(this.sendGTMEvent(n),this.__sentEventCount++,this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${n.eventName}`)):this.__initializationMethod==="GA4"?(this.sendGA4Event(n),this.__sentEventCount++,this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${n.eventName}`)):this.__queue.enqueue(n)}catch(s){this.logger(`Error sending event ${n.eventName}: ${s}`),this.__queue.enqueue(n)}}}async sendGTMEvent(t){let i=t.getGTMParameters(this.solution,this.experienceID,this.trackingID);const n=i;this.isValidPayload(i)||(i=await this.convertGTMParametersToEpgEventTag(t.eventName,i)),this.dataLayer&&(this.dataLayer.push(i),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}async sendGA4Event(t){let i=t.getGa4Parameters(this.solution,this.experienceID,this.trackingID);const n=i;this.isValidPayload(i)||(i=await this.convertGA4ParametersToEpgEventTag(i)),window.gtag("event",t.eventName,i),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n)}isValidPayload(t){if(Object.keys(t).length>=25)return!1;for(const[s,r]of Object.entries(t))if(s!=="items"&&(s.length>40||String(r).length>100))return!1;return!0}async convertGTMParametersToEpgEventTag(t,i){try{let n=await this.sendGA4LongParameters(i);return{event:t,epg_event_tag:n,send_to:this.trackingID}}catch{return i}}async convertGA4ParametersToEpgEventTag(t){try{return{epg_event_tag:await this.sendGA4LongParameters(t),send_to:this.trackingID}}catch{return t}}logger(t){this.verboseLogging&&console.warn(t)}async sendGA4LongParameters(t){const i="https://api.myepigraph.com/api/analytics/ga4/custom",n={parameters:t};try{const s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});return s.ok?(await s.json())?.id??"":""}catch{return""}}async reportFailureToNexus(t,i){try{const n={plugin:"GA4",trackingId:this.trackingID,solution:this.solution,experienceId:this.experienceID,failureType:t,errorMessage:i,timestamp:new Date().toISOString(),url:window.location.href,userAgent:navigator.userAgent};this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`)}catch(n){this.logger(`Error reporting failure to Nexus: ${n}`)}}findGA4Info(t){if(window.google_tag_manager&&window.google_tag_manager[t]){const n=window.google_tag_manager[t];if(n&&n.dataLayerName)return{fullSrc:"",id:t,l:n.dataLayerName}}const i=document.querySelectorAll("script[src]");for(const n of i){const s=n.getAttribute("src");if(s&&s.includes(t)){const r=new URL(s,location.href),o=Object.fromEntries(r.searchParams.entries());return{fullSrc:r.href,id:o.id||void 0,l:o.l||void 0}}}return null}}class M{constructor({trackingID:t,experienceID:i,solution:n,sessionId:s,xPath:r,verboseLogging:o=!1,sendToStaging:x=!1}){this.__status=c.UNAVAILABLE,this.__sentEventCount=0,this.sessionId=s,this.xPath=r,this.name=this.pluginName="NEXUS-PLUGIN",this.trackingID=t,this.experienceID=i,this.solution=n,this.verboseLogging=o,this.__queue=new w,this.url=x?"https://nexus.epigraph.dev/api/analytics/event":"https://api.myepigraph.com/api/analytics/event",this.__status=c.AVAILABLE,this.__epigraphNotifier=new u(this.pluginName,this.trackingID,this.experienceID,this.solution,"NEXUS",this.__status),this.__epigraphNotifier.notify(u.ACTION_INITIALIZED,{})}getStatus(){return this.__status}setStatus(t){this.__status=t,this.__epigraphNotifier.updateStatus(t)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return this.name+"-"+this.trackingID}setupPlugin(){}async sendEvent(t,i){if(this.__queue.enqueue(t),!i){this.__status=c.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(let t=0;t<this.__queue.size;t++){const i=this.__queue.dequeue(),n={send_to:this.trackingID,experience_id:this.experienceID,solution:this.solution,event:i.eventName,parameters:i.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(n)})).ok&&this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n),""}catch{return""}this.__sentEventCount++}return""}}class P{constructor(t){this.consentSet=!1,this.consent=!1,this.pluginName="OneTrustConsentPlugin",this.consentIdentifier=t,this.consent=!1,this.addConsentChangedListener()}hasConsent(){if(this.consentSet)return this.consent;if(window.OnetrustActiveGroups!==void 0){let t=window.OnetrustActiveGroups;t!==void 0&&t.split(",").forEach(n=>{n===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()})})}}var m=(e=>(e.OneTrust="onetrust",e))(m||{});class a{constructor({eventName:t,interactiveEvent:i,customParameters:n}){this.eventName=t,this.interactiveEvent=i,this.customParameters=n}getGa4Parameters(t,i,n){let s={solution:t,experience_id:i,interactive_event:this.interactiveEvent,send_to:n};return s=Object.assign(s,JSON.parse(JSON.stringify(this.customParameters))),s}getGTMParameters(t,i,n){let s={solution:t,experience_id:i,event:this.eventName,interactive_event:this.interactiveEvent,send_to:n};return s=Object.assign(s,JSON.parse(JSON.stringify(this.customParameters))),s}getNexusParameters(){let t={interactive_event:this.interactiveEvent};return t=Object.assign(t,JSON.parse(JSON.stringify(this.customParameters))),t}}var f=(e=>(e.VARIANT="variant",e.CATEGORY_VARIANT="category_variant",e.GEOMETRY="geometry",e.CATEGORY_GEOMETRY="category_geometry",e.GLOBAL="global",e))(f||{}),d=(e=>(e.AR="ar",e.QR="qr",e.INFO="info",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))(d||{}),I=(e=>(e.NETWORK="network",e.EXPERIENCE_CONFIG_ERROR="experience-config-error",e.SCENE_LOAD_ERROR="scene-load-error",e.INITIAL_SCENE_LOAD_ERROR="initial-scene-load-error",e.AUTHENTICATION_FAILED="authentication-failed",e))(I||{}),_=(e=>(e.AUTO="auto",e.BUTTON="button",e.HOTSPOT="hotspot",e.GESTURE="gesture",e))(_||{}),h=(e=>(e.USD="USD",e.EUR="EUR",e.GBP="GBP",e.CAD="CAD",e))(h||{}),N=(e=>(e.AR="ar",e.QR="qr",e.AR_WEBGL2="ar-webgl2",e.QR_WEBGL2="qr-webgl2",e))(N||{}),y=(e=>(e.AR_VIEW="ar_view",e.DIMENSION_TOGGLE="dimension_toggle",e.HOTSPOTS_TOGGLE="hotspots_toggle",e.HELP_TOGGLE="help_toggle",e.UTILITY_MENU_TOGGLE="utility_menu_toggle",e.HOTSPOT_ENTER="hotspot_enter",e.HOTSPOT_EXIT="hotspot_exit",e.SHARE="share",e.PDF_DOWNLOAD="pdf_download",e.COPY="copy",e.RESTART="restart",e.INSTRUCTIONS_SHOW="show_instructions",e.REVIEW_CART="review_cart",e.SHOP_NOW="shop_now",e.SUB_CATEGORY="sub_category",e.NEXT_STEP="next_step",e.PREVIOUS_STEP="previous_step",e))(y||{}),g=(e=>(e.ZOOM="zoom",e.ROTATE="rotate",e.PAN="pan",e))(g||{}),A=(e=>(e.CONFIGURATION="configuration",e.SCENE="scene",e.PRODUCT="product",e))(A||{}),C=(e=>(e.FACEBOOK="facebook",e.TWITTER="twitter",e.EMAIL="email",e.COPY_LINK="copy_link",e.WHATSAPP="whatsapp",e.LINKEDIN="linkedin",e))(C||{});class q extends a{constructor(t){super({eventName:"epigraph_ar_requested",interactiveEvent:!0,customParameters:{items:t}})}}class b extends a{constructor(t){super({eventName:"epigraph_module_loading",interactiveEvent:!1,customParameters:{is_pre_config:t}})}}class k extends a{constructor(t,i){super({eventName:"epigraph_module_ready",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i}})}}class V extends a{static{this.MODULE_FAILED_ERRORS=I}constructor(t,i,n){super({eventName:"epigraph_module_failed",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i,error_type:n}})}}class F extends a{constructor(t){super({eventName:"epigraph_module_closed",interactiveEvent:!0,customParameters:{items:t}})}}class $ extends a{static{this.SUPPORT_TYPE=N}constructor(t){super({eventName:"epigraph_support_detected",interactiveEvent:!1,customParameters:{support_type:t}})}}class j extends a{static{this.BUTTON_TYPE=y}constructor(t,i){super({eventName:"epigraph_button_click",interactiveEvent:!0,customParameters:{button_type:t,button_name:i}})}}class U extends a{static{this.PANEL_TYPE=d}static{this.TRIGGER_SOURCE=_}constructor(t,i,n,s){super({eventName:"epigraph_panel_opened",interactiveEvent:t,customParameters:{items:s,panel_type:i,trigger_source:n}})}}class W extends a{static{this.PANEL_TYPE=d}static{this.TRIGGER_SOURCE=_}constructor(t,i,n,s){super({eventName:"epigraph_panel_closed",interactiveEvent:t,customParameters:{items:s,panel_type:i,trigger_source:n}})}}class H extends a{constructor(t){super({eventName:"epigraph_add_to_favourites",interactiveEvent:!0,customParameters:{items:t}})}}class J extends a{static{this.ACTION_PERFORMED=g}constructor(t){super({eventName:"epigraph_keyboard_interaction",interactiveEvent:!0,customParameters:{action_performed:t}})}}class K extends a{static{this.INTERACTION_TYPE=g}constructor(t){super({eventName:"epigraph_touch_interaction",interactiveEvent:!0,customParameters:{interaction_type:t}})}}class X extends a{static{this.CURRENCY=h}constructor(t,i,n,s,r){super({eventName:"epigraph_item_added",interactiveEvent:t,customParameters:{items:r,value:i,currency:n,quantity:s}})}}class Z extends a{constructor(t){super({eventName:"epigraph_item_moved",interactiveEvent:!0,customParameters:{items:t}})}}class B extends a{static{this.CURRENCY=h}constructor(t,i,n,s){super({eventName:"epigraph_item_removed",interactiveEvent:!0,customParameters:{items:s,value:t,currency:i,quantity:n}})}}class Q extends a{static{this.VARIANT_CHANGE_TYPES=f}constructor(t,i){super({eventName:"epigraph_variant_changed",interactiveEvent:!0,customParameters:{items:i,change_type:t}})}}class Y extends a{static{this.CONTENT_TYPES=A}static{this.SHARE_DESTINATIONS=C}constructor(t,i,n){super({eventName:"epigraph_content_shared",interactiveEvent:!0,customParameters:{items:n,content_type:t,share_destination:i}})}}class tt extends a{static{this.CURRENCY=h}constructor(t,i,n){super({eventName:"epigraph_checkout",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class et extends a{static{this.CURRENCY=h}constructor(t,i,n){super({eventName:"epigraph_conversion",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class it extends a{constructor(t){super({eventName:"epigraph_changeRate",interactiveEvent:!1,customParameters:{value:t}})}}class nt extends a{constructor(t){super({eventName:"epigraph_completionRate",interactiveEvent:!1,customParameters:{value:t}})}}class st extends a{constructor(t){super({eventName:"epigraph_engagementRate",interactiveEvent:!1,customParameters:{value:t}})}}class at extends a{constructor(t,i,n){super({eventName:t,interactiveEvent:i,customParameters:n})}}/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c=(e=>(e.UNAVAILABLE="unavailable",e.AVAILABLE="available",e.RESTRICTED="restricted",e))(c||{});const O=Symbol("data"),v=Symbol("next"),D=class w{constructor(t){this[O]=t,this[v]=null}get data(){return this[O]}set next(t){if(!(t instanceof w)&&t!==null)throw new Error("This node is not an instance of the custom class 'Node'.");this[v]=t}get next(){return this[v]}};let S=D;const E=Symbol("head");class G{constructor(){this[E]=null}set head(t){this[E]=t}get head(){return this[E]}addToTail(t){let i=this.head;if(i){for(;i.next!==null;)i=i?.next;return i.next=new S(t)}return this.head=new S(t)}removeHead(){const t=this.head;if(t)return this.head=t.next,t.data}}const T=Symbol("queue"),l=Symbol("size");class L{constructor(){this[T]=new G,this[l]=0}get queue(){return this[T]}get size(){return this[l]}enqueue(t){this.queue.addToTail(t),this[l]++}dequeue(){const t=this.queue.removeHead();return this[l]--,t}}class u{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(t,i,n,s,r,o){this._pluginName=t,this._trackingId=i,this._experienceId=n,this._solution=s,this._initializer=r,this._status=o}updateStatus(t){this._status=t}updateInitializer(t){this._initializer=t}notify(t,i){const n={pluginName:this._pluginName,trackingId:this._trackingId,experienceId:this._experienceId,solution:this._solution,initializer:this._initializer,status:this._status,action:t,eventDetails:i};window.dispatchEvent(new CustomEvent("epg-notification",{detail:n}))}}class z{constructor({trackingID:t,experienceID:i,solution:n,verboseLogging:s=!1}){this.__status=c.UNAVAILABLE,this.__sentEventCount=0,this.__initializationAttempts=0,this.__lastInitializationAttempt=performance.now(),this.__maxInitializationAttempts=10,this.__initializationRetryDelay=2e3,this.__isInitialized=!1,this.__initializationMethod="NONE",this.__nexusFailureReported=!1,this.name=this.pluginName="GA4-PLUGIN",this.trackingID=t,this.experienceID=i,this.solution=n,this.verboseLogging=s,this.__queue=new L,this.__epigraphNotifier=new u(this.pluginName,this.pluginName,this.experienceID,this.solution,this.__initializationMethod,this.__status),this.initializePlugin()}getStatus(){return this.__status}setStatus(t){this.__status=t,this.__epigraphNotifier.updateStatus(t)}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(t,i){if(this.__queue.enqueue(t),!i){this.__status=c.RESTRICTED;return}if(!this.__isInitialized){this.logger("Cannot send analytics event: dataLayer not defined or plugin not initialized.");return}try{await this.dequeueAndSendEvents()}catch(n){this.logger(n),await this.reportFailureToNexus("EVENT_SEND_ERROR",n?.toString()||"Unknown error")}}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}const t=performance.now();if(this.__initializationAttempts>0&&t-this.__lastInitializationAttempt<this.__initializationRetryDelay)return;this.__lastInitializationAttempt=t,this.__initializationAttempts++;const i=this.detectAndSetupAnalytics();i.success?(this.__isInitialized=!0,this.__status=c.AVAILABLE,this.__initializationMethod=i.method,this.dataLayerName=i.dataLayerName,this.dataLayer=window[this.dataLayerName],this.logger(`Successfully initialized ${i.method} with dataLayer: ${this.dataLayerName}`),this.__epigraphNotifier.notify(u.ACTION_INITIALIZED,{}),this.__queue.size>0&&this.dequeueAndSendEvents()):(this.logger(`Initialization attempt ${this.__initializationAttempts} failed: ${i.error}`),this.__initializationAttempts<this.__maxInitializationAttempts&&setTimeout(()=>{this.initializePlugin()},this.__initializationRetryDelay))}detectAndSetupAnalytics(){const t=this.detectGTM();if(t)return this.logger(`GTM detected with container ID: ${t.containerId}`),this.__epigraphNotifier.updateInitializer("GTM"),{success:!0,method:"GTM",dataLayerName:t.dataLayerName};const i=this.findGA4Info(this.trackingID);if(i){const n=i.l||"dataLayer";return this.logger(`GA4 script found, setting up with dataLayer: ${n}`),this.__epigraphNotifier.updateInitializer("GA4"),{success:!0,method:"GA4",dataLayerName:n}}return{success:!1,method:"NONE",dataLayerName:"dataLayer",error:"No analytics setup found and unable to create one"}}detectGTM(){const t=document.querySelectorAll('script[src*="googletagmanager.com/gtm"]');for(const i of Array.from(t)){const n=i.getAttribute("src");if(n){const s=n.match(/gtm\.js\?id=([^&]+)/);if(s&&s.length>0){const r=n.match(/&l=([^&]+)/),o=r?r[1]:"dataLayer";return{containerId:s[1],dataLayerName:o}}}}return null}async dequeueAndSendEvents(){if(!this.__isInitialized||!this.dataLayer)return;let t=this.__queue.size;for(let i=0;i<t;i++){const n=this.__queue.dequeue();try{this.__initializationMethod==="GTM"?(this.sendGTMEvent(n),this.__sentEventCount++,this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${n.eventName}`)):this.__initializationMethod==="GA4"?(this.sendGA4Event(n),this.__sentEventCount++,this.logger(`Analytics event successfully sent via ${this.__initializationMethod}: ${n.eventName}`)):this.__queue.enqueue(n)}catch(s){this.logger(`Error sending event ${n.eventName}: ${s}`),this.__queue.enqueue(n)}}}async sendGTMEvent(t){let i=t.getGTMParameters(this.solution,this.experienceID,this.trackingID);const n=i;this.isValidPayload(i)||(i=await this.convertGTMParametersToEpgEventTag(t.eventName,i)),this.dataLayer&&(this.dataLayer.push(i),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n))}async sendGA4Event(t){let i=t.getGa4Parameters(this.solution,this.experienceID,this.trackingID);const n=i;this.isValidPayload(i)||(i=await this.convertGA4ParametersToEpgEventTag(i)),window.gtag("event",t.eventName,i),this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n)}isValidPayload(t){if(Object.keys(t).length>=25)return!1;for(const[s,r]of Object.entries(t))if(s!=="items"&&(s.length>40||String(r).length>100))return!1;return!0}async convertGTMParametersToEpgEventTag(t,i){try{let n=await this.sendGA4LongParameters(i);return{event:t,epg_event_tag:n,send_to:this.trackingID}}catch{return i}}async convertGA4ParametersToEpgEventTag(t){try{return{epg_event_tag:await this.sendGA4LongParameters(t),send_to:this.trackingID}}catch{return t}}logger(t){this.verboseLogging&&console.warn(t)}async sendGA4LongParameters(t){const i="https://api.myepigraph.com/api/analytics/ga4/custom",n={parameters:t};try{const s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});return s.ok?(await s.json())?.id??"":""}catch{return""}}async reportFailureToNexus(t,i){try{const n={plugin:"GA4",trackingId:this.trackingID,solution:this.solution,experienceId:this.experienceID,failureType:t,errorMessage:i,timestamp:new Date().toISOString(),url:window.location.href,userAgent:navigator.userAgent};this.logger(`Failure reported to Nexus: ${JSON.stringify(n)}`)}catch(n){this.logger(`Error reporting failure to Nexus: ${n}`)}}findGA4Info(t){if(window.google_tag_manager&&window.google_tag_manager[t]){const n=window.google_tag_manager[t];if(n&&n.dataLayerName)return{fullSrc:"",id:t,l:n.dataLayerName}}const i=document.querySelectorAll("script[src]");for(const n of i){const s=n.getAttribute("src");if(s&&s.includes(t)){const r=new URL(s,location.href),o=Object.fromEntries(r.searchParams.entries());return{fullSrc:r.href,id:o.id||void 0,l:o.l||void 0}}}return null}}class M{constructor({trackingID:t,experienceID:i,solution:n,sessionId:s,xPath:r,verboseLogging:o=!1,sendToStaging:x=!1}){this.__status=c.UNAVAILABLE,this.__sentEventCount=0,this.sessionId=s,this.xPath=r,this.name=this.pluginName="NEXUS-PLUGIN",this.trackingID=t,this.experienceID=i,this.solution=n,this.verboseLogging=o,this.__queue=new L,this.url=x?"https://nexus.epigraph.dev/api/analytics/event":"https://api.myepigraph.com/api/analytics/event",this.__status=c.AVAILABLE,this.__epigraphNotifier=new u(this.pluginName,this.trackingID,this.experienceID,this.solution,"NEXUS",this.__status),this.__epigraphNotifier.notify(u.ACTION_INITIALIZED,{})}getStatus(){return this.__status}setStatus(t){this.__status=t,this.__epigraphNotifier.updateStatus(t)}getPendingEventCount(){return this.__queue.size}getSentEventCount(){return this.__sentEventCount}getTotalEventCount(){return this.getPendingEventCount()+this.getSentEventCount()}getUniquePluginIdentifier(){return this.name+"-"+this.trackingID}setupPlugin(){}async sendEvent(t,i){if(this.__queue.enqueue(t),!i){this.__status=c.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(let t=0;t<this.__queue.size;t++){const i=this.__queue.dequeue(),n={send_to:this.trackingID,experience_id:this.experienceID,solution:this.solution,event:i.eventName,parameters:i.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(n)})).ok&&this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,n),""}catch{return""}this.__sentEventCount++}return""}}class P{constructor(t){this.consentSet=!1,this.consent=!1,this.pluginName="OneTrustConsentPlugin",this.consentIdentifier=t,this.consent=!1,this.addConsentChangedListener()}hasConsent(){if(this.consentSet)return this.consent;if(window.OnetrustActiveGroups!==void 0){let t=window.OnetrustActiveGroups;t!==void 0&&t.split(",").forEach(n=>{n===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()})})}}var m=(e=>(e.OneTrust="onetrust",e))(m||{});class a{constructor({eventName:t,interactiveEvent:i,customParameters:n}){this.eventName=t,this.interactiveEvent=i,this.customParameters=n}getGa4Parameters(t,i,n){let s={solution:t,experience_id:i,interactive_event:this.interactiveEvent,send_to:n};return s=Object.assign(s,JSON.parse(JSON.stringify(this.customParameters))),s}getGTMParameters(t,i,n){let s={solution:t,experience_id:i,event:this.eventName,interactive_event:this.interactiveEvent,send_to:n};return s=Object.assign(s,JSON.parse(JSON.stringify(this.customParameters))),s}getNexusParameters(){let t={interactive_event:this.interactiveEvent};return t=Object.assign(t,JSON.parse(JSON.stringify(this.customParameters))),t}}var f=(e=>(e.VARIANT="variant",e.CATEGORY_VARIANT="category_variant",e.GEOMETRY="geometry",e.CATEGORY_GEOMETRY="category_geometry",e.GLOBAL="global",e))(f||{}),d=(e=>(e.AR="ar",e.QR="qr",e.INFO="info",e.INSTRUCTIONS="instructions",e.DOWNLOAD="download",e.PREVIEW_CART="preview_cart",e.HOTSPOT_PANEL="hotspot_panel",e.SHARE_MODAL="share_modal",e.RESTART_MODAL="restart_modal",e.REMOVE_MODAL="remove_modal",e.LOAD_PRECONFIG_MODAL="load_preconfig_modal",e.MOVE_MODAL="move_modal",e.OUT_OF_STOCK_MODAL="out_of_stock_modal",e))(d||{}),I=(e=>(e.NETWORK="network",e.EXPERIENCE_CONFIG_ERROR="experience-config-error",e.SCENE_LOAD_ERROR="scene-load-error",e.INITIAL_SCENE_LOAD_ERROR="initial-scene-load-error",e.AUTHENTICATION_FAILED="authentication-failed",e))(I||{}),_=(e=>(e.AUTO="auto",e.BUTTON="button",e.HOTSPOT="hotspot",e.GESTURE="gesture",e))(_||{}),h=(e=>(e.USD="USD",e.EUR="EUR",e.GBP="GBP",e.CAD="CAD",e))(h||{}),N=(e=>(e.AR="ar",e.QR="qr",e.AR_WEBGL2="ar-webgl2",e.QR_WEBGL2="qr-webgl2",e))(N||{}),y=(e=>(e.AR_VIEW="ar_view",e.DIMENSION_TOGGLE="dimension_toggle",e.HOTSPOTS_TOGGLE="hotspots_toggle",e.HELP_TOGGLE="help_toggle",e.UTILITY_MENU_TOGGLE="utility_menu_toggle",e.HOTSPOT_ENTER="hotspot_enter",e.HOTSPOT_EXIT="hotspot_exit",e.SHARE="share",e.PDF_DOWNLOAD="pdf_download",e.COPY="copy",e.RESTART="restart",e.INSTRUCTIONS_SHOW="show_instructions",e.REVIEW_CART="review_cart",e.SHOP_NOW="shop_now",e.SUB_CATEGORY="sub_category",e.NEXT_STEP="next_step",e.PREVIOUS_STEP="previous_step",e))(y||{}),g=(e=>(e.ZOOM="zoom",e.ROTATE="rotate",e.PAN="pan",e))(g||{}),A=(e=>(e.CONFIGURATION="configuration",e.SCENE="scene",e.PRODUCT="product",e))(A||{}),C=(e=>(e.FACEBOOK="facebook",e.TWITTER="twitter",e.EMAIL="email",e.COPY_LINK="copy_link",e.WHATSAPP="whatsapp",e.LINKEDIN="linkedin",e))(C||{});class q extends a{constructor(t){super({eventName:"epigraph_ar_requested",interactiveEvent:!0,customParameters:{items:t}})}}class b extends a{constructor(t){super({eventName:"epigraph_module_loading",interactiveEvent:!1,customParameters:{is_pre_config:t}})}}class k extends a{constructor(t,i){super({eventName:"epigraph_module_ready",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i}})}}class V extends a{static{this.MODULE_FAILED_ERRORS=I}constructor(t,i,n){super({eventName:"epigraph_module_failed",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i,error_type:n}})}}class F extends a{constructor(t){super({eventName:"epigraph_module_closed",interactiveEvent:!0,customParameters:{items:t}})}}class $ extends a{static{this.SUPPORT_TYPE=N}constructor(t){super({eventName:"epigraph_support_detected",interactiveEvent:!1,customParameters:{support_type:t}})}}class U extends a{static{this.BUTTON_TYPE=y}constructor(t,i){super({eventName:"epigraph_button_click",interactiveEvent:!0,customParameters:{button_type:t,button_name:i}})}}class j extends a{static{this.PANEL_TYPE=d}static{this.TRIGGER_SOURCE=_}constructor(t,i,n,s){super({eventName:"epigraph_panel_opened",interactiveEvent:t,customParameters:{items:s,panel_type:i,trigger_source:n}})}}class W extends a{static{this.PANEL_TYPE=d}static{this.TRIGGER_SOURCE=_}constructor(t,i,n,s){super({eventName:"epigraph_panel_closed",interactiveEvent:t,customParameters:{items:s,panel_type:i,trigger_source:n}})}}class H extends a{constructor(t){super({eventName:"epigraph_add_to_favourites",interactiveEvent:!0,customParameters:{items:t}})}}class J extends a{static{this.ACTION_PERFORMED=g}constructor(t){super({eventName:"epigraph_keyboard_interaction",interactiveEvent:!0,customParameters:{action_performed:t}})}}class K extends a{static{this.INTERACTION_TYPE=g}constructor(t){super({eventName:"epigraph_touch_interaction",interactiveEvent:!0,customParameters:{interaction_type:t}})}}class X extends a{static{this.CURRENCY=h}constructor(t,i,n,s,r){super({eventName:"epigraph_item_added",interactiveEvent:t,customParameters:{items:r,value:i,currency:n,quantity:s}})}}class Z extends a{constructor(t){super({eventName:"epigraph_item_moved",interactiveEvent:!0,customParameters:{items:t}})}}class B extends a{static{this.CURRENCY=h}constructor(t,i,n,s){super({eventName:"epigraph_item_removed",interactiveEvent:!0,customParameters:{items:s,value:t,currency:i,quantity:n}})}}class Q extends a{static{this.VARIANT_CHANGE_TYPES=f}constructor(t,i){super({eventName:"epigraph_variant_changed",interactiveEvent:!0,customParameters:{items:i,change_type:t}})}}class Y extends a{static{this.CONTENT_TYPES=A}static{this.SHARE_DESTINATIONS=C}constructor(t,i,n){super({eventName:"epigraph_content_shared",interactiveEvent:!0,customParameters:{items:n,content_type:t,share_destination:i}})}}class tt extends a{static{this.CURRENCY=h}constructor(t,i,n){super({eventName:"epigraph_checkout",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class et extends a{static{this.CURRENCY=h}constructor(t,i,n){super({eventName:"epigraph_conversion",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class it extends a{constructor(t){super({eventName:"epigraph_changeRate",interactiveEvent:!1,customParameters:{value:t}})}}class nt extends a{constructor(t){super({eventName:"epigraph_completionRate",interactiveEvent:!1,customParameters:{value:t}})}}class st extends a{constructor(t){super({eventName:"epigraph_engagementRate",interactiveEvent:!1,customParameters:{value:t}})}}class at extends a{constructor(t,i,n){super({eventName:t,interactiveEvent:i,customParameters:n})}}/**
2
2
  * @license
3
3
  * Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
4
4
  *
@@ -13,4 +13,4 @@
13
13
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
- */var R;const p=Symbol("analyticsPluginsMap");R=p;class rt{constructor(t,i){this[R]=new Map,this.__consentPlugin=null,t&&i&&(this.__consentPlugin=this.buildConsentPlugin(t,i)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(t){let i=t;this.__overrideConsent=i.detail.hasConsent;for(const n of this[p].values())this.__hasConsent()||n.setStatus(c.RESTRICTED)}addEventPlugin(t){this[p].has(t.getUniquePluginIdentifier())||(this[p].set(t.getUniquePluginIdentifier(),t),t.setupPlugin())}__hasConsent(){let t=!0;return this.__overrideConsent!==void 0?(t=this.__overrideConsent,t):(this.__consentPlugin&&(t=this.__consentPlugin.hasConsent()),t)}sendEvent(t){this[p].forEach(i=>{i.sendEvent(t,this.__hasConsent())})}buildConsentPlugin(t,i){return t.toLowerCase()===m.OneTrust.toLowerCase()?new P(i):null}}exports.ACTION_PERFORMED=g;exports.BUTTON_TYPE=y;exports.CONTENT_TYPES=A;exports.CURRENCY=h;exports.ConsentPluginNames=m;exports.EpigraphAddToFavouritesEvent=H;exports.EpigraphAnalytics=rt;exports.EpigraphArRequestedEvent=q;exports.EpigraphButtonClickEvent=j;exports.EpigraphChangeRateEvent=it;exports.EpigraphCheckoutEvent=tt;exports.EpigraphCompletionRateEvent=nt;exports.EpigraphContentSharedEvent=Y;exports.EpigraphConversionEvent=et;exports.EpigraphCustomEvent=at;exports.EpigraphEngagementRateEvent=st;exports.EpigraphItemAddedEvent=X;exports.EpigraphItemMovedEvent=Z;exports.EpigraphItemRemovedEvent=B;exports.EpigraphKeyboardInteractionEvent=J;exports.EpigraphModuleClosedEvent=F;exports.EpigraphModuleFailedEvent=V;exports.EpigraphModuleLoadingEvent=b;exports.EpigraphModuleReadyEvent=k;exports.EpigraphPanelClosedEvent=W;exports.EpigraphPanelOpenedEvent=U;exports.EpigraphSupportDetectedEvent=$;exports.EpigraphTouchInteractionEvent=K;exports.EpigraphVariantChangedEvent=Q;exports.GA4AnalyticsPlugin=z;exports.MODULE_FAILED_ERRORS=I;exports.NexusAnalyticsPlugin=M;exports.OneTrustConsentPlugin=P;exports.PANEL_TYPE=d;exports.SHARE_DESTINATIONS=C;exports.SUPPORT_TYPE=N;exports.TRIGGER_SOURCE=_;exports.VARIANT_CHANGE_TYPES=f;
16
+ */var R;const p=Symbol("analyticsPluginsMap");R=p;class rt{constructor(t,i){this[R]=new Map,this.__consentPlugin=null,t&&i&&(this.__consentPlugin=this.buildConsentPlugin(t,i)),window.addEventListener("epigraphAnalyticsConsentChange",this.__onConsentChangeFromEvent)}__onConsentChangeFromEvent(t){let i=t;this.__overrideConsent=i.detail.hasConsent;for(const n of this[p].values())this.__hasConsent()||n.setStatus(c.RESTRICTED)}addEventPlugin(t){this[p].has(t.getUniquePluginIdentifier())||(this[p].set(t.getUniquePluginIdentifier(),t),t.setupPlugin())}__hasConsent(){let t=!0;return this.__overrideConsent!==void 0?(t=this.__overrideConsent,t):(this.__consentPlugin&&(t=this.__consentPlugin.hasConsent()),t)}sendEvent(t){this[p].forEach(i=>{i.sendEvent(t,this.__hasConsent())})}buildConsentPlugin(t,i){return t.toLowerCase()===m.OneTrust.toLowerCase()?new P(i):null}}exports.ACTION_PERFORMED=g;exports.BUTTON_TYPE=y;exports.CONTENT_TYPES=A;exports.CURRENCY=h;exports.ConsentPluginNames=m;exports.EpigraphAddToFavouritesEvent=H;exports.EpigraphAnalytics=rt;exports.EpigraphArRequestedEvent=q;exports.EpigraphButtonClickEvent=U;exports.EpigraphChangeRateEvent=it;exports.EpigraphCheckoutEvent=tt;exports.EpigraphCompletionRateEvent=nt;exports.EpigraphContentSharedEvent=Y;exports.EpigraphConversionEvent=et;exports.EpigraphCustomEvent=at;exports.EpigraphEngagementRateEvent=st;exports.EpigraphItemAddedEvent=X;exports.EpigraphItemMovedEvent=Z;exports.EpigraphItemRemovedEvent=B;exports.EpigraphKeyboardInteractionEvent=J;exports.EpigraphModuleClosedEvent=F;exports.EpigraphModuleFailedEvent=V;exports.EpigraphModuleLoadingEvent=b;exports.EpigraphModuleReadyEvent=k;exports.EpigraphPanelClosedEvent=W;exports.EpigraphPanelOpenedEvent=j;exports.EpigraphSupportDetectedEvent=$;exports.EpigraphTouchInteractionEvent=K;exports.EpigraphVariantChangedEvent=Q;exports.GA4AnalyticsPlugin=z;exports.MODULE_FAILED_ERRORS=I;exports.NexusAnalyticsPlugin=M;exports.OneTrustConsentPlugin=P;exports.PANEL_TYPE=d;exports.SHARE_DESTINATIONS=C;exports.SUPPORT_TYPE=N;exports.TRIGGER_SOURCE=_;exports.VARIANT_CHANGE_TYPES=f;
@@ -1,5 +1,5 @@
1
1
  var c = /* @__PURE__ */ ((e) => (e.UNAVAILABLE = "unavailable", e.AVAILABLE = "available", e.RESTRICTED = "restricted", e))(c || {});
2
- const E = Symbol("data"), p = Symbol("next"), z = class N {
2
+ const E = Symbol("data"), p = Symbol("next"), R = class N {
3
3
  constructor(t) {
4
4
  this[E] = t, this[p] = null;
5
5
  }
@@ -17,9 +17,9 @@ const E = Symbol("data"), p = Symbol("next"), z = class N {
17
17
  return this[p];
18
18
  }
19
19
  };
20
- let f = z;
20
+ let f = R;
21
21
  const _ = Symbol("head");
22
- class R {
22
+ class z {
23
23
  constructor() {
24
24
  this[_] = null;
25
25
  }
@@ -47,7 +47,7 @@ class R {
47
47
  const I = Symbol("queue"), d = Symbol("size");
48
48
  class y {
49
49
  constructor() {
50
- this[I] = new R(), this[d] = 0;
50
+ this[I] = new z(), this[d] = 0;
51
51
  }
52
52
  get queue() {
53
53
  return this[I];
@@ -86,7 +86,6 @@ class u {
86
86
  this._initializer = t;
87
87
  }
88
88
  notify(t, i) {
89
- console.log("Notifying", t, i);
90
89
  const n = {
91
90
  pluginName: this._pluginName,
92
91
  trackingId: this._trackingId,
@@ -100,7 +99,7 @@ class u {
100
99
  window.dispatchEvent(new CustomEvent("epg-notification", { detail: n }));
101
100
  }
102
101
  }
103
- class D {
102
+ class G {
104
103
  constructor({
105
104
  trackingID: t,
106
105
  experienceID: i,
@@ -450,7 +449,7 @@ class q {
450
449
  return "";
451
450
  }
452
451
  }
453
- class G {
452
+ class D {
454
453
  constructor(t) {
455
454
  this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = t, this.consent = !1, this.addConsentChangedListener();
456
455
  }
@@ -511,7 +510,7 @@ class a {
511
510
  return t = Object.assign(t, JSON.parse(JSON.stringify(this.customParameters))), t;
512
511
  }
513
512
  }
514
- var C = /* @__PURE__ */ ((e) => (e.VARIANT = "variant", e.CATEGORY_VARIANT = "category_variant", e.GEOMETRY = "geometry", e.CATEGORY_GEOMETRY = "category_geometry", e.GLOBAL = "global", e))(C || {}), g = /* @__PURE__ */ ((e) => (e.AR = "ar", e.QR = "qr", e.INFO = "info", e.DOWNLOAD = "download", e.PREVIEW_CART = "preview_cart", e.HOTSPOT_PANEL = "hotspot_panel", e.SHARE_MODAL = "share_modal", e.RESTART_MODAL = "restart_modal", e.REMOVE_MODAL = "remove_modal", e.LOAD_PRECONFIG_MODAL = "load_preconfig_modal", e.MOVE_MODAL = "move_modal", e.OUT_OF_STOCK_MODAL = "out_of_stock_modal", e))(g || {}), O = /* @__PURE__ */ ((e) => (e.NETWORK = "network", e.EXPERIENCE_CONFIG_ERROR = "experience-config-error", e.SCENE_LOAD_ERROR = "scene-load-error", e.INITIAL_SCENE_LOAD_ERROR = "initial-scene-load-error", e.AUTHENTICATION_FAILED = "authentication-failed", e))(O || {}), v = /* @__PURE__ */ ((e) => (e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", e))(v || {}), l = /* @__PURE__ */ ((e) => (e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e))(l || {}), w = /* @__PURE__ */ ((e) => (e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e))(w || {}), L = /* @__PURE__ */ ((e) => (e.AR_VIEW = "ar_view", e.DIMENSION_TOGGLE = "dimension_toggle", e.HOTSPOTS_TOGGLE = "hotspots_toggle", e.HELP_TOGGLE = "help_toggle", e.UTILITY_MENU_TOGGLE = "utility_menu_toggle", e.HOTSPOT_ENTER = "hotspot_enter", e.HOTSPOT_EXIT = "hotspot_exit", e.SHARE = "share", e.PDF_DOWNLOAD = "pdf_download", e.COPY = "copy", e.RESTART = "restart", e.INSTRUCTIONS_SHOW = "show_instructions", e.REVIEW_CART = "review_cart", e.SHOP_NOW = "shop_now", e.SUB_CATEGORY = "sub_category", e.NEXT_STEP = "next_step", e.PREVIOUS_STEP = "previous_step", e))(L || {}), m = /* @__PURE__ */ ((e) => (e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", e))(m || {}), S = /* @__PURE__ */ ((e) => (e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e))(S || {}), x = /* @__PURE__ */ ((e) => (e.FACEBOOK = "facebook", e.TWITTER = "twitter", e.EMAIL = "email", e.COPY_LINK = "copy_link", e.WHATSAPP = "whatsapp", e.LINKEDIN = "linkedin", e))(x || {});
513
+ var C = /* @__PURE__ */ ((e) => (e.VARIANT = "variant", e.CATEGORY_VARIANT = "category_variant", e.GEOMETRY = "geometry", e.CATEGORY_GEOMETRY = "category_geometry", e.GLOBAL = "global", e))(C || {}), g = /* @__PURE__ */ ((e) => (e.AR = "ar", e.QR = "qr", e.INFO = "info", e.INSTRUCTIONS = "instructions", e.DOWNLOAD = "download", e.PREVIEW_CART = "preview_cart", e.HOTSPOT_PANEL = "hotspot_panel", e.SHARE_MODAL = "share_modal", e.RESTART_MODAL = "restart_modal", e.REMOVE_MODAL = "remove_modal", e.LOAD_PRECONFIG_MODAL = "load_preconfig_modal", e.MOVE_MODAL = "move_modal", e.OUT_OF_STOCK_MODAL = "out_of_stock_modal", e))(g || {}), O = /* @__PURE__ */ ((e) => (e.NETWORK = "network", e.EXPERIENCE_CONFIG_ERROR = "experience-config-error", e.SCENE_LOAD_ERROR = "scene-load-error", e.INITIAL_SCENE_LOAD_ERROR = "initial-scene-load-error", e.AUTHENTICATION_FAILED = "authentication-failed", e))(O || {}), v = /* @__PURE__ */ ((e) => (e.AUTO = "auto", e.BUTTON = "button", e.HOTSPOT = "hotspot", e.GESTURE = "gesture", e))(v || {}), l = /* @__PURE__ */ ((e) => (e.USD = "USD", e.EUR = "EUR", e.GBP = "GBP", e.CAD = "CAD", e))(l || {}), w = /* @__PURE__ */ ((e) => (e.AR = "ar", e.QR = "qr", e.AR_WEBGL2 = "ar-webgl2", e.QR_WEBGL2 = "qr-webgl2", e))(w || {}), L = /* @__PURE__ */ ((e) => (e.AR_VIEW = "ar_view", e.DIMENSION_TOGGLE = "dimension_toggle", e.HOTSPOTS_TOGGLE = "hotspots_toggle", e.HELP_TOGGLE = "help_toggle", e.UTILITY_MENU_TOGGLE = "utility_menu_toggle", e.HOTSPOT_ENTER = "hotspot_enter", e.HOTSPOT_EXIT = "hotspot_exit", e.SHARE = "share", e.PDF_DOWNLOAD = "pdf_download", e.COPY = "copy", e.RESTART = "restart", e.INSTRUCTIONS_SHOW = "show_instructions", e.REVIEW_CART = "review_cart", e.SHOP_NOW = "shop_now", e.SUB_CATEGORY = "sub_category", e.NEXT_STEP = "next_step", e.PREVIOUS_STEP = "previous_step", e))(L || {}), m = /* @__PURE__ */ ((e) => (e.ZOOM = "zoom", e.ROTATE = "rotate", e.PAN = "pan", e))(m || {}), S = /* @__PURE__ */ ((e) => (e.CONFIGURATION = "configuration", e.SCENE = "scene", e.PRODUCT = "product", e))(S || {}), x = /* @__PURE__ */ ((e) => (e.FACEBOOK = "facebook", e.TWITTER = "twitter", e.EMAIL = "email", e.COPY_LINK = "copy_link", e.WHATSAPP = "whatsapp", e.LINKEDIN = "linkedin", e))(x || {});
515
514
  class M extends a {
516
515
  constructor(t) {
517
516
  super({
@@ -621,7 +620,7 @@ class W extends a {
621
620
  });
622
621
  }
623
622
  }
624
- class J extends a {
623
+ class U extends a {
625
624
  static {
626
625
  this.PANEL_TYPE = g;
627
626
  }
@@ -640,7 +639,7 @@ class J extends a {
640
639
  });
641
640
  }
642
641
  }
643
- class U extends a {
642
+ class J extends a {
644
643
  constructor(t) {
645
644
  super({
646
645
  eventName: "epigraph_add_to_favourites",
@@ -901,7 +900,7 @@ class rt {
901
900
  * @private
902
901
  */
903
902
  buildConsentPlugin(t, i) {
904
- return t.toLowerCase() === A.OneTrust.toLowerCase() ? new G(i) : null;
903
+ return t.toLowerCase() === A.OneTrust.toLowerCase() ? new D(i) : null;
905
904
  }
906
905
  }
907
906
  export {
@@ -910,7 +909,7 @@ export {
910
909
  S as CONTENT_TYPES,
911
910
  l as CURRENCY,
912
911
  A as ConsentPluginNames,
913
- U as EpigraphAddToFavouritesEvent,
912
+ J as EpigraphAddToFavouritesEvent,
914
913
  rt as EpigraphAnalytics,
915
914
  M as EpigraphArRequestedEvent,
916
915
  j as EpigraphButtonClickEvent,
@@ -929,15 +928,15 @@ export {
929
928
  $ as EpigraphModuleFailedEvent,
930
929
  b as EpigraphModuleLoadingEvent,
931
930
  k as EpigraphModuleReadyEvent,
932
- J as EpigraphPanelClosedEvent,
931
+ U as EpigraphPanelClosedEvent,
933
932
  W as EpigraphPanelOpenedEvent,
934
933
  F as EpigraphSupportDetectedEvent,
935
934
  K as EpigraphTouchInteractionEvent,
936
935
  B as EpigraphVariantChangedEvent,
937
- D as GA4AnalyticsPlugin,
936
+ G as GA4AnalyticsPlugin,
938
937
  O as MODULE_FAILED_ERRORS,
939
938
  q as NexusAnalyticsPlugin,
940
- G as OneTrustConsentPlugin,
939
+ D as OneTrustConsentPlugin,
941
940
  g as PANEL_TYPE,
942
941
  x as SHARE_DESTINATIONS,
943
942
  w as SUPPORT_TYPE,
@@ -36,6 +36,7 @@ export declare enum PANEL_TYPE {
36
36
  AR = "ar",
37
37
  QR = "qr",
38
38
  INFO = "info",
39
+ INSTRUCTIONS = "instructions",
39
40
  DOWNLOAD = "download",
40
41
  PREVIEW_CART = "preview_cart",
41
42
  HOTSPOT_PANEL = "hotspot_panel",
@@ -119,7 +120,7 @@ export declare class EpigraphModuleReadyEvent extends BaseAnalyticsEvent {
119
120
  }
120
121
  export declare class EpigraphModuleFailedEvent extends BaseAnalyticsEvent {
121
122
  static readonly MODULE_FAILED_ERRORS: typeof MODULE_FAILED_ERRORS;
122
- constructor(isPreConfig: boolean, loadTimeMs: number, errorType: string);
123
+ constructor(isPreConfig: boolean, loadTimeMs: number, errorType: MODULE_FAILED_ERRORS | string);
123
124
  }
124
125
  export declare class EpigraphModuleClosedEvent extends BaseAnalyticsEvent {
125
126
  constructor(items: IAnalyticsParameterItems);
@@ -166,12 +167,12 @@ export declare class EpigraphItemRemovedEvent extends BaseAnalyticsEvent {
166
167
  }
167
168
  export declare class EpigraphVariantChangedEvent extends BaseAnalyticsEvent {
168
169
  static readonly VARIANT_CHANGE_TYPES: typeof VARIANT_CHANGE_TYPES;
169
- constructor(changeType: string, items: IAnalyticsParameterItems);
170
+ constructor(changeType: VARIANT_CHANGE_TYPES, items: IAnalyticsParameterItems);
170
171
  }
171
172
  export declare class EpigraphContentSharedEvent extends BaseAnalyticsEvent {
172
173
  static readonly CONTENT_TYPES: typeof CONTENT_TYPES;
173
174
  static readonly SHARE_DESTINATIONS: typeof SHARE_DESTINATIONS;
174
- constructor(contentType: string, shareDestination: string, items: IAnalyticsParameterItems);
175
+ constructor(contentType: CONTENT_TYPES, shareDestination: SHARE_DESTINATIONS, items: IAnalyticsParameterItems);
175
176
  }
176
177
  export declare class EpigraphCheckoutEvent extends BaseAnalyticsEvent {
177
178
  static readonly CURRENCY: typeof CURRENCY;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../EpigraphResultFactory/epigraphResultFactory.cjs");class E{constructor(i="https://api.myepigraph.com/api/",t,e,r="",s="",a="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=r,this.epigraphSessionId=e,this.epigraphXPath=s,this.baseUrl=i+a,this.epgLocation=t}async getButtonBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorByExperienceId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator/experience_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorByClientAccessKey(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator/client_access_key/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorLiteByExperienceId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator-lite/experience_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorLiteByProjectId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator-lite/project_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async postExperienceSaveAndShare(i,t){const e=`experience/${i}/save`,r=this.buildNexusUrl(e),s={save_data:JSON.stringify(t)},a=new Headers;return a.set("Content-Type","application/json"),await this.callNexusAPI(r,"POST",JSON.stringify(s),a)}async getExperienceSaveAndShare(i,t){const e=`experience/${i}/save/${t}`,r=this.buildNexusUrl(e);return await this.callNexusAPI(r,"GET")}async callNexusAPI(i,t="GET",e,r=new Headers){r=this.addRequiredHeaders(r);const s={method:t,body:e,headers:r};try{const a=await fetch(i,s),c=await a.json();if(!a.ok){let u="Unable to retrieve configurator experience";return c.message&&(u=c.message),Promise.resolve(o.failureResult(c,a.status,u))}return Promise.resolve(o.successResult(c,a.status))}catch{return Promise.resolve(o.failureResult({},500,"Unknown error"))}}buildNexusUrl(i,t={}){let e=new URL(this.baseUrl);e.pathname+=i;for(const[r,s]of Object.entries(t))e.searchParams.set(r,s);return e}addRequiredHeaders(i){return i.has("accept")||i.set("accept","application/json"),i.has("EPG-Location")||i.set("EPG-location",this.epgLocation),i.has("EPG-Session-ID")||i.set("EPG-Session-ID",this.epigraphSessionId),i.has("EPG-XPATH")||i.set("EPG-XPATH",this.epigraphXPath),i.has("EPG-Version")||i.set("EPG-Version",this.epigraphComponentVersion),i}}var l=(n=>(n.PRODUCTION="https://api.myepigraph.com/api/",n.STAGING="https://nexus.epigraph.dev/api/",n.LOCAL="https://nexus.test/api/",n))(l||{}),p=(n=>(n.CLIENT_ACCESS_KEY="client_access_key",n.EXPERIENCE_ID="experience_id",n.PROJECT_ID="project_id",n.SKU="sku",n.SHOPIFY_VARIANT_ID="shopify_variant_id",n.UPC="upc",n.ASIN="asin",n))(p||{}),h=(n=>(n.BUTTON="experience/button",n.VIEWER="experience/viewer",n.TOUR="experience/tour",n.CUSTOMIZER="experience/customizer",n.CONFIGURATOR="experience/configurator",n.CONFIGURATOR_LITE="experience/configurator-lite",n.EXPERIENCE="experience",n.SAVE="save",n))(h||{}),y=(n=>(n.V1="v1/",n))(y||{}),x=(n=>(n.GET="GET",n.POST="POST",n.PUT="PUT",n.DELETE="DELETE",n))(x||{});exports.EpigraphNexusAPI=E;exports.HTTPMethod=x;exports.NexusAPIResourceIdentifier=p;exports.NexusAPIRoutes=h;exports.NexusAPIVersions=y;exports.NexusEndpoints=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../EpigraphResultFactory/epigraphResultFactory.cjs");class ${constructor(i="https://api.myepigraph.com/api/",t,e,r="",s="",a="v1/"){this.epigraphXPath="",this.epigraphComponentVersion=r,this.epigraphSessionId=e,this.epigraphXPath=s,this.baseUrl=i+a,this.epgLocation=t}async getButtonBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getButtonByUuid(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/button/uuid/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getViewerByUuid(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/viewer/uuid/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getTourByUuid(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/tour/uuid/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getCustomizerBySku(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/customizer/sku/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getCustomizerByShopifyVariantId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/customizer/shopify_variant_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getCustomizerByUpc(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/customizer/upc/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getCustomizerByAsin(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/customizer/asin/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getCustomizerByUuid(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/customizer/uuid/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorByExperienceId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator/experience_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorByClientAccessKey(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator/client_access_key/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorLiteByExperienceId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator-lite/experience_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async getConfiguratorLiteByProjectId(i,t=""){const e={};t!==""&&(e.version_id=t);const r=`experience/configurator-lite/project_id/${i}`,s=this.buildNexusUrl(r,e);return await this.callNexusAPI(s,"GET")}async postExperienceSaveAndShare(i,t){const e=`experience/${i}/save`,r=this.buildNexusUrl(e),s={save_data:JSON.stringify(t)},a=new Headers;return a.set("Content-Type","application/json"),await this.callNexusAPI(r,"POST",JSON.stringify(s),a)}async getExperienceSaveAndShare(i,t){const e=`experience/${i}/save/${t}`,r=this.buildNexusUrl(e);return await this.callNexusAPI(r,"GET")}async callNexusAPI(i,t="GET",e,r=new Headers){r=this.addRequiredHeaders(r);const s={method:t,body:e,headers:r};try{const a=await fetch(i,s),u=await a.json();if(!a.ok){let o="Unable to retrieve configurator experience";return u.message&&(o=u.message),Promise.resolve(c.failureResult(u,a.status,o))}return Promise.resolve(c.successResult(u,a.status))}catch{return Promise.resolve(c.failureResult({},500,"Unknown error"))}}buildNexusUrl(i,t={}){let e=new URL(this.baseUrl);e.pathname+=i;for(const[r,s]of Object.entries(t))e.searchParams.set(r,s);return e}addRequiredHeaders(i){return i.has("accept")||i.set("accept","application/json"),i.has("EPG-Location")||i.set("EPG-location",this.epgLocation),i.has("EPG-Session-ID")||i.set("EPG-Session-ID",this.epigraphSessionId),i.has("EPG-XPATH")||i.set("EPG-XPATH",this.epigraphXPath),i.has("EPG-Version")||i.set("EPG-Version",this.epigraphComponentVersion),i}}var l=(n=>(n.PRODUCTION="https://api.myepigraph.com/api/",n.STAGING="https://nexus.epigraph.dev/api/",n.STAGING_CANARY="https://staging-canary.epigraph.dev/api/",n.LOCAL="https://nexus.test/api/",n))(l||{}),p=(n=>(n.CLIENT_ACCESS_KEY="client_access_key",n.EXPERIENCE_ID="experience_id",n.PROJECT_ID="project_id",n.SKU="sku",n.SHOPIFY_VARIANT_ID="shopify_variant_id",n.UPC="upc",n.ASIN="asin",n.UUID="uuid",n))(p||{}),y=(n=>(n.BUTTON="experience/button",n.VIEWER="experience/viewer",n.TOUR="experience/tour",n.CUSTOMIZER="experience/customizer",n.CONFIGURATOR="experience/configurator",n.CONFIGURATOR_LITE="experience/configurator-lite",n.EXPERIENCE="experience",n.SAVE="save",n))(y||{}),h=(n=>(n.V1="v1/",n))(h||{}),x=(n=>(n.GET="GET",n.POST="POST",n.PUT="PUT",n.DELETE="DELETE",n))(x||{});exports.EpigraphNexusAPI=$;exports.HTTPMethod=x;exports.NexusAPIResourceIdentifier=p;exports.NexusAPIRoutes=y;exports.NexusAPIVersions=h;exports.NexusEndpoints=l;
@@ -24,6 +24,7 @@ export declare class EpigraphNexusAPI {
24
24
  getButtonByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
25
25
  getButtonByUpc(upc: string, versionId?: string): Promise<Result>;
26
26
  getButtonByAsin(asin: string, versionId?: string): Promise<Result>;
27
+ getButtonByUuid(uuid: string, versionId?: string): Promise<Result>;
27
28
  /*******************************************************************************************************************
28
29
  * Epigraph Viewer API Calls *
29
30
  ******************************************************************************************************************/
@@ -31,6 +32,7 @@ export declare class EpigraphNexusAPI {
31
32
  getViewerByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
32
33
  getViewerByUpc(upc: string, versionId?: string): Promise<Result>;
33
34
  getViewerByAsin(asin: string, versionId?: string): Promise<Result>;
35
+ getViewerByUuid(uuid: string, versionId?: string): Promise<Result>;
34
36
  /*******************************************************************************************************************
35
37
  * Epigraph Tour API Calls *
36
38
  ******************************************************************************************************************/
@@ -38,6 +40,15 @@ export declare class EpigraphNexusAPI {
38
40
  getTourByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
39
41
  getTourByUpc(upc: string, versionId?: string): Promise<Result>;
40
42
  getTourByAsin(asin: string, versionId?: string): Promise<Result>;
43
+ getTourByUuid(uuid: string, versionId?: string): Promise<Result>;
44
+ /*******************************************************************************************************************
45
+ * Epigraph Customizer API Calls *
46
+ ******************************************************************************************************************/
47
+ getCustomizerBySku(sku: string, versionId?: string): Promise<Result>;
48
+ getCustomizerByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
49
+ getCustomizerByUpc(upc: string, versionId?: string): Promise<Result>;
50
+ getCustomizerByAsin(asin: string, versionId?: string): Promise<Result>;
51
+ getCustomizerByUuid(uuid: string, versionId?: string): Promise<Result>;
41
52
  /*******************************************************************************************************************
42
53
  * Configurator API Calls *
43
54
  ******************************************************************************************************************/
@@ -79,6 +90,7 @@ export type QueryParameters = Record<string, any>;
79
90
  export declare enum NexusEndpoints {
80
91
  PRODUCTION = "https://api.myepigraph.com/api/",
81
92
  STAGING = "https://nexus.epigraph.dev/api/",
93
+ STAGING_CANARY = "https://staging-canary.epigraph.dev/api/",
82
94
  LOCAL = "https://nexus.test/api/"
83
95
  }
84
96
  export declare enum NexusAPIResourceIdentifier {
@@ -88,7 +100,8 @@ export declare enum NexusAPIResourceIdentifier {
88
100
  SKU = "sku",
89
101
  SHOPIFY_VARIANT_ID = "shopify_variant_id",
90
102
  UPC = "upc",
91
- ASIN = "asin"
103
+ ASIN = "asin",
104
+ UUID = "uuid"
92
105
  }
93
106
  export declare enum NexusAPIRoutes {
94
107
  BUTTON = "experience/button",
@@ -1,4 +1,4 @@
1
- import { failureResult as u, successResult as l } from "../EpigraphResultFactory/epigraphResultFactory.js";
1
+ import { failureResult as o, successResult as l } from "../EpigraphResultFactory/epigraphResultFactory.js";
2
2
  class P {
3
3
  /**
4
4
  * Constructs a new instance of the class with the provided parameters.
@@ -69,6 +69,19 @@ class P {
69
69
  /* GET */
70
70
  );
71
71
  }
72
+ async getButtonByUuid(i, t = "") {
73
+ const e = {};
74
+ t !== "" && (e.version_id = t);
75
+ const r = `experience/button/uuid/${i}`, s = this.buildNexusUrl(
76
+ r,
77
+ e
78
+ );
79
+ return await this.callNexusAPI(
80
+ s,
81
+ "GET"
82
+ /* GET */
83
+ );
84
+ }
72
85
  /*******************************************************************************************************************
73
86
  * Epigraph Viewer API Calls *
74
87
  ******************************************************************************************************************/
@@ -124,6 +137,19 @@ class P {
124
137
  /* GET */
125
138
  );
126
139
  }
140
+ async getViewerByUuid(i, t = "") {
141
+ const e = {};
142
+ t !== "" && (e.version_id = t);
143
+ const r = `experience/viewer/uuid/${i}`, s = this.buildNexusUrl(
144
+ r,
145
+ e
146
+ );
147
+ return await this.callNexusAPI(
148
+ s,
149
+ "GET"
150
+ /* GET */
151
+ );
152
+ }
127
153
  /*******************************************************************************************************************
128
154
  * Epigraph Tour API Calls *
129
155
  ******************************************************************************************************************/
@@ -179,6 +205,87 @@ class P {
179
205
  /* GET */
180
206
  );
181
207
  }
208
+ async getTourByUuid(i, t = "") {
209
+ const e = {};
210
+ t !== "" && (e.version_id = t);
211
+ const r = `experience/tour/uuid/${i}`, s = this.buildNexusUrl(
212
+ r,
213
+ e
214
+ );
215
+ return await this.callNexusAPI(
216
+ s,
217
+ "GET"
218
+ /* GET */
219
+ );
220
+ }
221
+ /*******************************************************************************************************************
222
+ * Epigraph Customizer API Calls *
223
+ ******************************************************************************************************************/
224
+ async getCustomizerBySku(i, t = "") {
225
+ const e = {};
226
+ t !== "" && (e.version_id = t);
227
+ const r = `experience/customizer/sku/${i}`, s = this.buildNexusUrl(
228
+ r,
229
+ e
230
+ );
231
+ return await this.callNexusAPI(
232
+ s,
233
+ "GET"
234
+ /* GET */
235
+ );
236
+ }
237
+ async getCustomizerByShopifyVariantId(i, t = "") {
238
+ const e = {};
239
+ t !== "" && (e.version_id = t);
240
+ const r = `experience/customizer/shopify_variant_id/${i}`, s = this.buildNexusUrl(
241
+ r,
242
+ e
243
+ );
244
+ return await this.callNexusAPI(
245
+ s,
246
+ "GET"
247
+ /* GET */
248
+ );
249
+ }
250
+ async getCustomizerByUpc(i, t = "") {
251
+ const e = {};
252
+ t !== "" && (e.version_id = t);
253
+ const r = `experience/customizer/upc/${i}`, s = this.buildNexusUrl(
254
+ r,
255
+ e
256
+ );
257
+ return await this.callNexusAPI(
258
+ s,
259
+ "GET"
260
+ /* GET */
261
+ );
262
+ }
263
+ async getCustomizerByAsin(i, t = "") {
264
+ const e = {};
265
+ t !== "" && (e.version_id = t);
266
+ const r = `experience/customizer/asin/${i}`, s = this.buildNexusUrl(
267
+ r,
268
+ e
269
+ );
270
+ return await this.callNexusAPI(
271
+ s,
272
+ "GET"
273
+ /* GET */
274
+ );
275
+ }
276
+ async getCustomizerByUuid(i, t = "") {
277
+ const e = {};
278
+ t !== "" && (e.version_id = t);
279
+ const r = `experience/customizer/uuid/${i}`, s = this.buildNexusUrl(
280
+ r,
281
+ e
282
+ );
283
+ return await this.callNexusAPI(
284
+ s,
285
+ "GET"
286
+ /* GET */
287
+ );
288
+ }
182
289
  /*******************************************************************************************************************
183
290
  * Configurator API Calls *
184
291
  ******************************************************************************************************************/
@@ -278,14 +385,14 @@ class P {
278
385
  try {
279
386
  const a = await fetch(i, s), c = await a.json();
280
387
  if (!a.ok) {
281
- let o = "Unable to retrieve configurator experience";
282
- return c.message && (o = c.message), Promise.resolve(
283
- u(c, a.status, o)
388
+ let u = "Unable to retrieve configurator experience";
389
+ return c.message && (u = c.message), Promise.resolve(
390
+ o(c, a.status, u)
284
391
  );
285
392
  }
286
393
  return Promise.resolve(l(c, a.status));
287
394
  } catch {
288
- return Promise.resolve(u({}, 500, "Unknown error"));
395
+ return Promise.resolve(o({}, 500, "Unknown error"));
289
396
  }
290
397
  }
291
398
  buildNexusUrl(i, t = {}) {
@@ -307,12 +414,12 @@ class P {
307
414
  return i.has("accept") || i.set("accept", "application/json"), i.has("EPG-Location") || i.set("EPG-location", this.epgLocation), i.has("EPG-Session-ID") || i.set("EPG-Session-ID", this.epigraphSessionId), i.has("EPG-XPATH") || i.set("EPG-XPATH", this.epigraphXPath), i.has("EPG-Version") || i.set("EPG-Version", this.epigraphComponentVersion), i;
308
415
  }
309
416
  }
310
- var p = /* @__PURE__ */ ((n) => (n.PRODUCTION = "https://api.myepigraph.com/api/", n.STAGING = "https://nexus.epigraph.dev/api/", n.LOCAL = "https://nexus.test/api/", n))(p || {}), h = /* @__PURE__ */ ((n) => (n.CLIENT_ACCESS_KEY = "client_access_key", n.EXPERIENCE_ID = "experience_id", n.PROJECT_ID = "project_id", n.SKU = "sku", n.SHOPIFY_VARIANT_ID = "shopify_variant_id", n.UPC = "upc", n.ASIN = "asin", n))(h || {}), y = /* @__PURE__ */ ((n) => (n.BUTTON = "experience/button", n.VIEWER = "experience/viewer", n.TOUR = "experience/tour", n.CUSTOMIZER = "experience/customizer", n.CONFIGURATOR = "experience/configurator", n.CONFIGURATOR_LITE = "experience/configurator-lite", n.EXPERIENCE = "experience", n.SAVE = "save", n))(y || {}), x = /* @__PURE__ */ ((n) => (n.V1 = "v1/", n))(x || {}), $ = /* @__PURE__ */ ((n) => (n.GET = "GET", n.POST = "POST", n.PUT = "PUT", n.DELETE = "DELETE", n))($ || {});
417
+ var p = /* @__PURE__ */ ((n) => (n.PRODUCTION = "https://api.myepigraph.com/api/", n.STAGING = "https://nexus.epigraph.dev/api/", n.STAGING_CANARY = "https://staging-canary.epigraph.dev/api/", n.LOCAL = "https://nexus.test/api/", n))(p || {}), y = /* @__PURE__ */ ((n) => (n.CLIENT_ACCESS_KEY = "client_access_key", n.EXPERIENCE_ID = "experience_id", n.PROJECT_ID = "project_id", n.SKU = "sku", n.SHOPIFY_VARIANT_ID = "shopify_variant_id", n.UPC = "upc", n.ASIN = "asin", n.UUID = "uuid", n))(y || {}), h = /* @__PURE__ */ ((n) => (n.BUTTON = "experience/button", n.VIEWER = "experience/viewer", n.TOUR = "experience/tour", n.CUSTOMIZER = "experience/customizer", n.CONFIGURATOR = "experience/configurator", n.CONFIGURATOR_LITE = "experience/configurator-lite", n.EXPERIENCE = "experience", n.SAVE = "save", n))(h || {}), x = /* @__PURE__ */ ((n) => (n.V1 = "v1/", n))(x || {}), $ = /* @__PURE__ */ ((n) => (n.GET = "GET", n.POST = "POST", n.PUT = "PUT", n.DELETE = "DELETE", n))($ || {});
311
418
  export {
312
419
  P as EpigraphNexusAPI,
313
420
  $ as HTTPMethod,
314
- h as NexusAPIResourceIdentifier,
315
- y as NexusAPIRoutes,
421
+ y as NexusAPIResourceIdentifier,
422
+ h as NexusAPIRoutes,
316
423
  x as NexusAPIVersions,
317
424
  p as NexusEndpoints
318
425
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epigraph/epigraph-std-lib",
3
- "version": "5.0.0-alpha.1",
3
+ "version": "5.0.0-alpha.10",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-std-lib.cjs",
6
6
  "module": "./dist/epigraph-std-lib.js",