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

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,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){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 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];
@@ -511,7 +511,7 @@ class a {
511
511
  return t = Object.assign(t, JSON.parse(JSON.stringify(this.customParameters))), t;
512
512
  }
513
513
  }
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 || {});
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.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
515
  class M extends a {
516
516
  constructor(t) {
517
517
  super({
@@ -621,7 +621,7 @@ class W extends a {
621
621
  });
622
622
  }
623
623
  }
624
- class J extends a {
624
+ class U extends a {
625
625
  static {
626
626
  this.PANEL_TYPE = g;
627
627
  }
@@ -640,7 +640,7 @@ class J extends a {
640
640
  });
641
641
  }
642
642
  }
643
- class U extends a {
643
+ class J extends a {
644
644
  constructor(t) {
645
645
  super({
646
646
  eventName: "epigraph_add_to_favourites",
@@ -910,7 +910,7 @@ export {
910
910
  S as CONTENT_TYPES,
911
911
  l as CURRENCY,
912
912
  A as ConsentPluginNames,
913
- U as EpigraphAddToFavouritesEvent,
913
+ J as EpigraphAddToFavouritesEvent,
914
914
  rt as EpigraphAnalytics,
915
915
  M as EpigraphArRequestedEvent,
916
916
  j as EpigraphButtonClickEvent,
@@ -929,7 +929,7 @@ export {
929
929
  $ as EpigraphModuleFailedEvent,
930
930
  b as EpigraphModuleLoadingEvent,
931
931
  k as EpigraphModuleReadyEvent,
932
- J as EpigraphPanelClosedEvent,
932
+ U as EpigraphPanelClosedEvent,
933
933
  W as EpigraphPanelOpenedEvent,
934
934
  F as EpigraphSupportDetectedEvent,
935
935
  K as EpigraphTouchInteractionEvent,
@@ -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);
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;
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.3",
4
4
  "type": "module",
5
5
  "main": "./dist/epigraph-std-lib.cjs",
6
6
  "module": "./dist/epigraph-std-lib.js",