@epigraph/epigraph-std-lib 5.0.0-alpha.14 → 5.0.0-alpha.16
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.
- package/README.md +68 -68
- package/dist/Epigraph/epigraph.cjs +1 -1
- package/dist/Epigraph/epigraph.js +94 -126
- package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -1
- package/dist/Epigraph/epigraphBaseSolutions.js +60 -68
- package/dist/EpigraphLibs/EpigraphAnalytics/consent-plugins/auto-consent-resolver.d.ts +21 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/consent-plugins/one-trust-consent-plugin.d.ts +1 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +1 -16
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts +14 -5
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +2 -1057
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +6 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.d.ts +1 -0
- package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.js +74 -198
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +197 -425
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +1 -7
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +2 -78
- package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js +24 -26
- package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +2 -88
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +44 -75
- package/dist/enums-BSSe4NAs.js +8 -0
- package/dist/enums-PfFMiIoe.cjs +1 -0
- package/dist/epigraph-std-lib.cjs +1 -1
- package/dist/epigraph-std-lib.js +11 -74
- package/dist/epigraphAnalytics-CADAVr-I.cjs +1 -0
- package/dist/epigraphAnalytics-Dv5dGbcW.js +851 -0
- package/dist/epigraphQrCodeGenerator-BXUNL2XK.js +54 -0
- package/dist/epigraphQrCodeGenerator-F2eLrPC_.cjs +7 -0
- package/dist/epigraphUnitsConverter-CwpmWl7p.cjs +1 -0
- package/dist/epigraphUnitsConverter-DsX4Rmsp.js +66 -0
- package/dist/lit--5TUYSGn.js +508 -0
- package/dist/lit-DZtv4Pds.cjs +2 -0
- package/package.json +40 -40
- package/dist/enums-1vqWxJ0i.cjs +0 -1
- package/dist/enums-CvOTKyNu.js +0 -5
- package/dist/lit-element-C3moVMGu.js +0 -524
- package/dist/lit-element-CYaaFRfk.cjs +0 -19
|
@@ -1,16 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("../../enums-1vqWxJ0i.cjs");var o=(e=>(e.UNAVAILABLE="unavailable",e.AVAILABLE="available",e.RESTRICTED="restricted",e))(o||{});const T=Symbol("data"),E=Symbol("next"),M=class x{constructor(t){this[T]=t,this[E]=null}get data(){return this[T]}set next(t){if(!(t instanceof x)&&t!==null)throw new Error("This node is not an instance of the custom class 'Node'.");this[E]=t}get next(){return this[E]}};let P=M;const m=Symbol("head");class b{constructor(){this[m]=null}set head(t){this[m]=t}get head(){return this[m]}addToTail(t){let i=this.head;if(i){for(;i.next!==null;)i=i?.next;return i.next=new P(t)}return this.head=new P(t)}removeHead(){const t=this.head;if(t)return this.head=t.next,t.data}}const L=Symbol("queue"),d=Symbol("size");class f{constructor(){this[L]=new b,this[d]=0}get queue(){return this[L]}get size(){return this[d]}enqueue(t){this.queue.addToTail(t),this[d]++}dequeue(){const t=this.queue.removeHead();return this[d]--,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,h){this._pluginName=t,this._trackingId=i,this._experienceId=n,this._solution=s,this._initializer=r,this._status=h}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 k{constructor({trackingID:t,experienceID:i,solution:n,verboseLogging:s=!1}){this.__status=o.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 f,this.__epigraphNotifier=new u(this.pluginName,this.pluginName,this.experienceID,this.solution,this.__initializationMethod,this.__status),this.initializePlugin()}setTrackingID(t){if(!t)return;const i=this.trackingID!==t;this.trackingID=t,i&&this.__isInitialized&&(this.resetInitialization(),this.initializePlugin())}setExperienceID(t){this.experienceID=t}setSolution(t){this.solution=t}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=o.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")}}resetInitialization(){this.__isInitialized=!1,this.__status=o.UNAVAILABLE,this.dataLayer=void 0,this.dataLayerName=void 0,this.__initializationMethod="NONE",this.__initializationAttempts=0,this.__nexusFailureReported=!1,this.__epigraphNotifier.updateStatus(this.__status)}initializePlugin(){if(this.__isInitialized)return;if(this.__initializationAttempts>=this.__maxInitializationAttempts){this.__nexusFailureReported||(this.reportFailureToNexus("MAX_INITIALIZATION_ATTEMPTS","Maximum initialization attempts reached"),this.__nexusFailureReported=!0,this.__epigraphNotifier.notify(u.ACTION_FAILED_INITIALIZATION,{}));return}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=o.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=([^&]+)/),h=r?r[1]:"dataLayer";return{containerId:s[1],dataLayerName:h}}}}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),h=Object.fromEntries(r.searchParams.entries());return{fullSrc:r.href,id:h.id||void 0,l:h.l||void 0}}}return null}}class ${constructor({trackingID:t,experienceID:i,solution:n,sessionId:s,xPath:r,verboseLogging:h=!1,baseUrl:v=w.NexusEndpoints.PRODUCTION}){this.__status=o.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=h,this.__queue=new f,this.url=`${v}analytics/event`,this.__status=o.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=o.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 V{constructor({productId:t,identifier:i,identifierType:n,experienceType:s,renderMode:r="geo",sessionId:h,xPath:v,solution:z="",verboseLogging:G=!1,baseUrl:q=w.NexusEndpoints.PRODUCTION}){if(this.experienceID="",this.__status=o.UNAVAILABLE,this.__sentEventCount=0,t<=0)throw new Error("NexusSolutionsAnalyticsPlugin requires a valid productId greater than 0.");this.sessionId=h,this.xPath=v,this.name=this.pluginName="NEXUS-SOLUTIONS-PLUGIN",this.verboseLogging=G,this.__queue=new f,this.productId=t,this.identifier=i,this.identifierType=n,this.experienceType=s,this.renderMode=r,this.solution=z,this.trackingID=String(t),this.url=`${q}analytics/event`,this.__status=o.AVAILABLE,this.__epigraphNotifier=new u(this.pluginName,this.trackingID,`${i}@${n}`,this.solution,"NEXUS-SOLUTIONS",this.__status),this.__epigraphNotifier.notify(u.ACTION_INITIALIZED,{})}setProductId(t){t<=0||(this.productId=t,this.trackingID=String(t))}setIdentifier(t){this.identifier=t}setIdentifierType(t){this.identifierType=t}setExperienceType(t){this.experienceType=t}setRenderMode(t){this.renderMode=t}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.sessionId}`}setupPlugin(){}async sendEvent(t,i){if(this.__queue.enqueue(t),!i){this.__status=o.RESTRICTED,this.__epigraphNotifier.updateStatus(this.__status);return}await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(;this.__queue.size>0;){const t=this.__queue.dequeue(),i={action:t.eventName,product_id:this.productId,identifier:this.identifier,identifier_type:this.identifierType,experience_type:this.experienceType,render_mode:this.renderMode,parameters:t.getNexusParameters()};try{(await fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","EPG-SESSION-ID":this.sessionId,"EPG-XPATH":this.xPath,Origin:typeof window<"u"?window.location.origin:""},body:JSON.stringify(i)})).ok&&(this.__sentEventCount++,this.__epigraphNotifier.notify(u.ACTION_SEND_EVENT,i))}catch{return}}}}class R{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 I=(e=>(e.OneTrust="onetrust",e))(I||{});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 N=(e=>(e.VARIANT="variant",e.CATEGORY_VARIANT="category_variant",e.GEOMETRY="geometry",e.CATEGORY_GEOMETRY="category_geometry",e.GLOBAL="global",e))(N||{}),l=(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))(l||{}),y=(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))(y||{}),_=(e=>(e.AUTO="auto",e.BUTTON="button",e.HOTSPOT="hotspot",e.GESTURE="gesture",e))(_||{}),c=(e=>(e.USD="USD",e.EUR="EUR",e.GBP="GBP",e.CAD="CAD",e))(c||{}),A=(e=>(e.AR="ar",e.QR="qr",e.AR_WEBGL2="ar-webgl2",e.QR_WEBGL2="qr-webgl2",e))(A||{}),C=(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))(C||{}),g=(e=>(e.ZOOM="zoom",e.ROTATE="rotate",e.PAN="pan",e))(g||{}),S=(e=>(e.CONFIGURATION="configuration",e.SCENE="scene",e.PRODUCT="product",e))(S||{}),O=(e=>(e.FACEBOOK="facebook",e.TWITTER="twitter",e.EMAIL="email",e.COPY_LINK="copy_link",e.WHATSAPP="whatsapp",e.LINKEDIN="linkedin",e))(O||{});class U extends a{constructor(t){super({eventName:"epigraph_ar_requested",interactiveEvent:!0,customParameters:{items:t}})}}class F extends a{constructor(t){super({eventName:"epigraph_module_loading",interactiveEvent:!1,customParameters:{is_pre_config:t}})}}class j extends a{constructor(t,i){super({eventName:"epigraph_module_ready",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i}})}}class W extends a{static{this.MODULE_FAILED_ERRORS=y}constructor(t,i,n){super({eventName:"epigraph_module_failed",interactiveEvent:!1,customParameters:{is_pre_config:t,load_time_ms:i,error_type:n}})}}class H extends a{constructor(t){super({eventName:"epigraph_module_closed",interactiveEvent:!0,customParameters:{items:t}})}}class J extends a{static{this.SUPPORT_TYPE=A}constructor(t){super({eventName:"epigraph_support_detected",interactiveEvent:!1,customParameters:{support_type:t}})}}class X extends a{static{this.BUTTON_TYPE=C}constructor(t,i){super({eventName:"epigraph_button_click",interactiveEvent:!0,customParameters:{button_type:t,button_name:i}})}}class B extends a{static{this.PANEL_TYPE=l}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 K extends a{static{this.PANEL_TYPE=l}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 Z extends a{constructor(t){super({eventName:"epigraph_add_to_favourites",interactiveEvent:!0,customParameters:{items:t}})}}class Q extends a{static{this.ACTION_PERFORMED=g}constructor(t){super({eventName:"epigraph_keyboard_interaction",interactiveEvent:!0,customParameters:{action_performed:t}})}}class Y extends a{static{this.INTERACTION_TYPE=g}constructor(t){super({eventName:"epigraph_touch_interaction",interactiveEvent:!0,customParameters:{interaction_type:t}})}}class tt extends a{static{this.CURRENCY=c}constructor(t,i,n,s,r){super({eventName:"epigraph_item_added",interactiveEvent:t,customParameters:{items:r,value:i,currency:n,quantity:s}})}}class et extends a{constructor(t){super({eventName:"epigraph_item_moved",interactiveEvent:!0,customParameters:{items:t}})}}class it extends a{static{this.CURRENCY=c}constructor(t,i,n,s){super({eventName:"epigraph_item_removed",interactiveEvent:!0,customParameters:{items:s,value:t,currency:i,quantity:n}})}}class nt extends a{static{this.VARIANT_CHANGE_TYPES=N}constructor(t,i){super({eventName:"epigraph_variant_changed",interactiveEvent:!0,customParameters:{items:i,change_type:t}})}}class st extends a{static{this.CONTENT_TYPES=S}static{this.SHARE_DESTINATIONS=O}constructor(t,i,n){super({eventName:"epigraph_content_shared",interactiveEvent:!0,customParameters:{items:n,content_type:t,share_destination:i}})}}class at extends a{static{this.CURRENCY=c}constructor(t,i,n){super({eventName:"epigraph_checkout",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class rt extends a{static{this.CURRENCY=c}constructor(t,i,n){super({eventName:"epigraph_conversion",interactiveEvent:!0,customParameters:{items:n,value:t,currency:i}})}}class ot extends a{constructor(t){super({eventName:"epigraph_changeRate",interactiveEvent:!1,customParameters:{value:t}})}}class ut extends a{constructor(t){super({eventName:"epigraph_completionRate",interactiveEvent:!1,customParameters:{value:t}})}}class ht extends a{constructor(t){super({eventName:"epigraph_engagementRate",interactiveEvent:!1,customParameters:{value:t}})}}class ct extends a{constructor(t,i,n){super({eventName:t,interactiveEvent:i,customParameters:n})}}/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/var D;const p=Symbol("analyticsPluginsMap");D=p;class pt{constructor(t,i){this[D]=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(o.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()===I.OneTrust.toLowerCase()?new R(i):null}}exports.ACTION_PERFORMED=g;exports.BUTTON_TYPE=C;exports.CONTENT_TYPES=S;exports.CURRENCY=c;exports.ConsentPluginNames=I;exports.EpigraphAddToFavouritesEvent=Z;exports.EpigraphAnalytics=pt;exports.EpigraphArRequestedEvent=U;exports.EpigraphButtonClickEvent=X;exports.EpigraphChangeRateEvent=ot;exports.EpigraphCheckoutEvent=at;exports.EpigraphCompletionRateEvent=ut;exports.EpigraphContentSharedEvent=st;exports.EpigraphConversionEvent=rt;exports.EpigraphCustomEvent=ct;exports.EpigraphEngagementRateEvent=ht;exports.EpigraphItemAddedEvent=tt;exports.EpigraphItemMovedEvent=et;exports.EpigraphItemRemovedEvent=it;exports.EpigraphKeyboardInteractionEvent=Q;exports.EpigraphModuleClosedEvent=H;exports.EpigraphModuleFailedEvent=W;exports.EpigraphModuleLoadingEvent=F;exports.EpigraphModuleReadyEvent=j;exports.EpigraphPanelClosedEvent=K;exports.EpigraphPanelOpenedEvent=B;exports.EpigraphSupportDetectedEvent=J;exports.EpigraphTouchInteractionEvent=Y;exports.EpigraphVariantChangedEvent=nt;exports.GA4AnalyticsPlugin=k;exports.MODULE_FAILED_ERRORS=y;exports.NexusAnalyticsPlugin=$;exports.NexusSolutionsAnalyticsPlugin=V;exports.OneTrustConsentPlugin=R;exports.PANEL_TYPE=l;exports.SHARE_DESTINATIONS=O;exports.SUPPORT_TYPE=A;exports.TRIGGER_SOURCE=_;exports.VARIANT_CHANGE_TYPES=N;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../epigraphAnalytics-CADAVr-I.cjs");exports.ACTION_PERFORMED=e.n,exports.AutoConsentResolver=e.F,exports.BUTTON_TYPE=e.r,exports.CONTENT_TYPES=e.i,exports.CURRENCY=e.a,exports.ConsentPluginNames=e.I,exports.EpigraphAddToFavouritesEvent=e.o,exports.EpigraphAnalytics=e.t,exports.EpigraphArRequestedEvent=e.s,exports.EpigraphButtonClickEvent=e.c,exports.EpigraphChangeRateEvent=e.l,exports.EpigraphCheckoutEvent=e.u,exports.EpigraphCompletionRateEvent=e.d,exports.EpigraphContentSharedEvent=e.f,exports.EpigraphConversionEvent=e.p,exports.EpigraphCustomEvent=e.m,exports.EpigraphEngagementRateEvent=e.h,exports.EpigraphItemAddedEvent=e.g,exports.EpigraphItemMovedEvent=e._,exports.EpigraphItemRemovedEvent=e.v,exports.EpigraphKeyboardInteractionEvent=e.y,exports.EpigraphModuleClosedEvent=e.b,exports.EpigraphModuleFailedEvent=e.x,exports.EpigraphModuleLoadingEvent=e.S,exports.EpigraphModuleReadyEvent=e.C,exports.EpigraphPanelClosedEvent=e.w,exports.EpigraphPanelOpenedEvent=e.T,exports.EpigraphSupportDetectedEvent=e.E,exports.EpigraphTouchInteractionEvent=e.D,exports.EpigraphVariantChangedEvent=e.O,exports.GA4AnalyticsPlugin=e.B,exports.MODULE_FAILED_ERRORS=e.k,exports.NexusAnalyticsPlugin=e.z,exports.NexusSolutionsAnalyticsPlugin=e.R,exports.OneTrustConsentPlugin=e.L,exports.PANEL_TYPE=e.A,exports.SHARE_DESTINATIONS=e.j,exports.SUPPORT_TYPE=e.M,exports.TRIGGER_SOURCE=e.N,exports.VARIANT_CHANGE_TYPES=e.P;
|
|
@@ -5,6 +5,7 @@ import { NexusAnalyticsPlugin } from './plugins/nexus-analytics-plugin';
|
|
|
5
5
|
import { NexusSolutionsAnalyticsPlugin } from './plugins/nexus-solutions-analytics-plugin';
|
|
6
6
|
import { OneTrustConsentPlugin } from './consent-plugins/one-trust-consent-plugin';
|
|
7
7
|
import { ConsentPluginNames } from './consent-plugins/consent-plugin-names';
|
|
8
|
+
import { AutoConsentResolver, ConsentSignal } from './consent-plugins/auto-consent-resolver';
|
|
8
9
|
declare const $analyticsPluginsMap: unique symbol;
|
|
9
10
|
export type AnalyticsTrackerMap = Map<string, IAnalyticsPlugin>;
|
|
10
11
|
export type { IAnalyticsEvent };
|
|
@@ -14,11 +15,17 @@ export { NexusAnalyticsPlugin };
|
|
|
14
15
|
export { NexusSolutionsAnalyticsPlugin };
|
|
15
16
|
export { OneTrustConsentPlugin };
|
|
16
17
|
export { ConsentPluginNames };
|
|
18
|
+
export { AutoConsentResolver };
|
|
19
|
+
export type { ConsentSignal };
|
|
17
20
|
export declare class EpigraphAnalytics {
|
|
18
21
|
private [$analyticsPluginsMap];
|
|
19
22
|
private __consentPlugin;
|
|
20
23
|
private __overrideConsent;
|
|
21
|
-
|
|
24
|
+
private __autoConsentResolver;
|
|
25
|
+
private __defaultConsent;
|
|
26
|
+
constructor(consentPluginName: string | null, consentIdentifier: string | null, options?: {
|
|
27
|
+
defaultConsent?: boolean;
|
|
28
|
+
});
|
|
22
29
|
private __onConsentChangeFromEvent;
|
|
23
30
|
/**
|
|
24
31
|
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
@@ -29,12 +36,14 @@ export declare class EpigraphAnalytics {
|
|
|
29
36
|
*/
|
|
30
37
|
addEventPlugin(plugin: IAnalyticsPlugin): void;
|
|
31
38
|
/**
|
|
32
|
-
* Resolves session consent
|
|
33
|
-
*
|
|
39
|
+
* Resolves session consent, in priority order: the override event, an explicitly configured
|
|
40
|
+
* consent plugin, signals the page itself exposes (Google Consent Mode, known CMPs), and
|
|
41
|
+
* finally the configured default.
|
|
34
42
|
*
|
|
35
|
-
*
|
|
43
|
+
* 'unknown' means nothing on the page has answered yet (e.g. a pending consent banner with
|
|
44
|
+
* defaultConsent disabled) — events are queued rather than sent or dropped.
|
|
36
45
|
*/
|
|
37
|
-
private
|
|
46
|
+
private __resolveConsent;
|
|
38
47
|
/**
|
|
39
48
|
* Send an Event to all plugins
|
|
40
49
|
*
|