@epigraph/epigraph-std-lib 4.0.2-alpha → 4.2.0
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/dist/Epigraph/epigraph.cjs +1 -0
- package/dist/Epigraph/epigraph.d.ts +10 -3
- package/dist/Epigraph/epigraph.js +33 -20
- package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -0
- package/dist/Epigraph/{epigraphBaseSolution.d.ts → epigraphBaseSolutions.d.ts} +1 -1
- package/dist/{lib/Epigraph/epigraphBaseSolution.js → Epigraph/epigraphBaseSolutions.js} +2 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +16 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +354 -27
- package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -0
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -0
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.d.ts +34 -5
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +229 -64
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +7 -0
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.d.ts +2 -2
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +31 -22
- package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -0
- package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -0
- package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +51 -30
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -0
- package/dist/epigraph-std-lib.cjs +1 -0
- package/dist/epigraph-std-lib.d.ts +9 -1
- package/dist/epigraph-std-lib.js +40 -1
- package/dist/lit-element-C3moVMGu.js +524 -0
- package/dist/lit-element-CYaaFRfk.cjs +19 -0
- package/package.json +4 -35
- package/dist/EpigraphLibs/EpigraphAnalytics/types/index.d.ts +0 -7
- package/dist/lib/Epigraph/constants/enums.js +0 -4
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/consent-plugin-names.js +0 -4
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/one-trust-consent-plugin.js +0 -29
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/node.js +0 -22
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/queue.js +0 -23
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/single-linked-list.js +0 -30
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga3-analytics-plugin.js +0 -87
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.js +0 -121
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.js +0 -45
- package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/conversions.js +0 -26
- package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/enums.js +0 -5
- package/dist/node_modules/lit-html/async-directive.js +0 -67
- package/dist/node_modules/lit-html/directive-helpers.js +0 -10
- package/dist/node_modules/lit-html/directive.js +0 -27
- package/dist/node_modules/lit-html/directives/ref.js +0 -40
- package/dist/node_modules/lit-html/lit-html.js +0 -225
- package/dist/vite-env.d.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),p=require("../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs");var n=(r=>(r.DEVELOPMENT="development",r.STAGING="staging",r.PRODUCTION="production",r))(n||{});class a{constructor(e){if(this._loggerContext="EPIGRAPH",this._isReady=!1,this._logger=new s.EpigraphLogger("EPIGRAPH LOGGER"),this._environment=n.DEVELOPMENT,this._activeComponentsInSession=new Map,this._staleComponentsInSession=new Map,this._isSessionWebGL2Compatible=!1,window.epigraph)return window.epigraph.registerActiveComponent(e),window.epigraph;this._isSessionWebGL2Compatible=this._checkIfWebGL2IsAvailable(),window.epigraph=this,window.epigraph.registerActiveComponent(e),this.logBranding(),this._initializer=e,this._environment=this._initializer.environment;const t=this.getLoggerModeNameFromEnvironment();this._logger.setCurrentMode(t),this._urlProcessor=new p.EpigraphUrlProcessor,this.id=a.safeGenerateUuid();const i=this._urlProcessor.getParameterInUrl(p.QUERY_PARAMETER_NAMES.epigraphSessionId);this._epigraphSessionId=i??a.safeGenerateUuid(),this._logger.info({title:"Epigraph Object Ready!!",details:this,contextOverride:this._loggerContext}),this._isReady=!0}get isReady(){return this._isReady}get logger(){return this._logger}get urlProcessor(){return this._urlProcessor}get epigraphSessionId(){return this._epigraphSessionId}get environment(){return this._environment}get initializer(){return this._initializer}get activeComponentsInSession(){return this._activeComponentsInSession}get staleComponentsInSession(){return this._staleComponentsInSession}isSessionWebGL2Compatible(){return this._isSessionWebGL2Compatible}logBranding(){console.group("Powered by: "),console.log("%cEPIGRAPH","font-weight: bold; font-size: 50px; text-shadow: 3px 3px 0 rgb(100,100,100)"),console.log("Visit for more details: www.epigraph.us"),console.groupEnd()}_checkIfWebGL2IsAvailable(){try{const e=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&e.getContext("webgl2"))}catch{return!1}}registerActiveComponent(e){this._activeComponentsInSession.set(e.uuid,e),this._logger.info({title:"Registered a new Active Component",details:e,contextOverride:this._loggerContext})}deregisterActiveComponent(e){const t=this._activeComponentsInSession.get(e.uuid);t&&(this._staleComponentsInSession.set(t.uuid,t),this._activeComponentsInSession.delete(t.uuid),this._logger.info({title:"Deregistered a new Active Component",details:e,contextOverride:this._loggerContext}))}getLoggerModeNameFromEnvironment(){let e=s.LoggerModeNames.Dev;return this._environment===n.STAGING?e=s.LoggerModeNames.Staging:this._environment===n.PRODUCTION&&(e=s.LoggerModeNames.Release),e}static safeGenerateUuid(){let e="";try{e=crypto.randomUUID()}catch{console.error("crypto not available. Not generating a UUID")}return e}static generateXPath(e){let t="",i=e;for(;i;){let g=1,o=i.previousSibling;for(;o;)o.nodeName===i.nodeName&&g++,o=o.previousSibling;t=`/${i.nodeName.toLowerCase()+(g>1?`[${g}]`:"")}${t}`,i=i.parentNode}return t}}exports.ENVIRONMENT_TYPE=n;exports.Epigraph=a;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EpigraphLogger, LoggerModeNames } from '../EpigraphLibs/EpigraphLogger/epigraphLogger';
|
|
2
2
|
import { ENVIRONMENT_TYPE } from './constants/enums';
|
|
3
3
|
import { EpigraphUrlProcessor } from '../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor';
|
|
4
|
-
import { EpigraphBaseSolutionTypes
|
|
4
|
+
import { EpigraphBaseSolutionTypes } from './epigraphBaseSolutions';
|
|
5
5
|
/**
|
|
6
6
|
* Epigraph component is intended to be a global source of truth/tracker in a given session for all of our components.
|
|
7
7
|
* This object would be responsible for serving/communicating/validating information, wherever necessary
|
|
@@ -21,6 +21,7 @@ export declare class Epigraph {
|
|
|
21
21
|
private _environment;
|
|
22
22
|
private _activeComponentsInSession;
|
|
23
23
|
private _staleComponentsInSession;
|
|
24
|
+
private _isSessionWebGL2Compatible;
|
|
24
25
|
constructor(initializer: EpigraphBaseSolutionTypes);
|
|
25
26
|
get isReady(): boolean;
|
|
26
27
|
get logger(): EpigraphLogger;
|
|
@@ -30,10 +31,17 @@ export declare class Epigraph {
|
|
|
30
31
|
get initializer(): EpigraphBaseSolutionTypes;
|
|
31
32
|
get activeComponentsInSession(): Map<string, EpigraphBaseSolutionTypes>;
|
|
32
33
|
get staleComponentsInSession(): Map<string, EpigraphBaseSolutionTypes>;
|
|
34
|
+
isSessionWebGL2Compatible(): boolean;
|
|
33
35
|
/**
|
|
34
36
|
* Logs Epigraph Branding in the console to help redirect potential interests in the right direction.
|
|
35
37
|
*/
|
|
36
38
|
logBranding(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Used to check if the current session can support WebGL2 or not.
|
|
41
|
+
*
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
private _checkIfWebGL2IsAvailable;
|
|
37
45
|
/**
|
|
38
46
|
* Registers a new component that was initialized on this page.
|
|
39
47
|
* This is optional from the perspective of the initialization flow but highly recommend
|
|
@@ -73,8 +81,7 @@ export declare class Epigraph {
|
|
|
73
81
|
*/
|
|
74
82
|
static generateXPath(element: HTMLElement): string;
|
|
75
83
|
}
|
|
76
|
-
export { ENVIRONMENT_TYPE
|
|
77
|
-
export type { EpigraphBaseSolutionTypes };
|
|
84
|
+
export { ENVIRONMENT_TYPE };
|
|
78
85
|
declare global {
|
|
79
86
|
interface Window {
|
|
80
87
|
epigraph: Epigraph;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { EpigraphLogger as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { EpigraphBaseSolutionHtmlElement as w, EpigraphBaseSolutionLitElement as I } from "../lib/Epigraph/epigraphBaseSolution.js";
|
|
1
|
+
import { EpigraphLogger as l, LoggerModeNames as a } from "../EpigraphLibs/EpigraphLogger/epigraphLogger.js";
|
|
2
|
+
import { EpigraphUrlProcessor as h, QUERY_PARAMETER_NAMES as p } from "../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js";
|
|
3
|
+
var s = /* @__PURE__ */ ((i) => (i.DEVELOPMENT = "development", i.STAGING = "staging", i.PRODUCTION = "production", i))(s || {});
|
|
5
4
|
class g {
|
|
6
5
|
constructor(e) {
|
|
7
|
-
if (this._loggerContext = "EPIGRAPH", this._isReady = !1, this._logger = new
|
|
6
|
+
if (this._loggerContext = "EPIGRAPH", this._isReady = !1, this._logger = new l("EPIGRAPH LOGGER"), this._environment = s.DEVELOPMENT, this._activeComponentsInSession = /* @__PURE__ */ new Map(), this._staleComponentsInSession = /* @__PURE__ */ new Map(), this._isSessionWebGL2Compatible = !1, window.epigraph)
|
|
8
7
|
return window.epigraph.registerActiveComponent(e), window.epigraph;
|
|
9
|
-
window.epigraph = this, window.epigraph.registerActiveComponent(e), this.logBranding(), this._initializer = e, this._environment = this._initializer.environment;
|
|
8
|
+
this._isSessionWebGL2Compatible = this._checkIfWebGL2IsAvailable(), window.epigraph = this, window.epigraph.registerActiveComponent(e), this.logBranding(), this._initializer = e, this._environment = this._initializer.environment;
|
|
10
9
|
const t = this.getLoggerModeNameFromEnvironment();
|
|
11
|
-
this._logger.setCurrentMode(t), this._urlProcessor = new
|
|
12
|
-
const
|
|
13
|
-
this._epigraphSessionId =
|
|
10
|
+
this._logger.setCurrentMode(t), this._urlProcessor = new h(), this.id = g.safeGenerateUuid();
|
|
11
|
+
const n = this._urlProcessor.getParameterInUrl(p.epigraphSessionId);
|
|
12
|
+
this._epigraphSessionId = n ?? g.safeGenerateUuid(), this._logger.info({ title: "Epigraph Object Ready!!", details: this, contextOverride: this._loggerContext }), this._isReady = !0;
|
|
14
13
|
}
|
|
15
14
|
get isReady() {
|
|
16
15
|
return this._isReady;
|
|
@@ -36,12 +35,28 @@ class g {
|
|
|
36
35
|
get staleComponentsInSession() {
|
|
37
36
|
return this._staleComponentsInSession;
|
|
38
37
|
}
|
|
38
|
+
isSessionWebGL2Compatible() {
|
|
39
|
+
return this._isSessionWebGL2Compatible;
|
|
40
|
+
}
|
|
39
41
|
/**
|
|
40
42
|
* Logs Epigraph Branding in the console to help redirect potential interests in the right direction.
|
|
41
43
|
*/
|
|
42
44
|
logBranding() {
|
|
43
45
|
console.group("Powered by: "), console.log("%cEPIGRAPH", "font-weight: bold; font-size: 50px; text-shadow: 3px 3px 0 rgb(100,100,100)"), console.log("Visit for more details: www.epigraph.us"), console.groupEnd();
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Used to check if the current session can support WebGL2 or not.
|
|
49
|
+
*
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
_checkIfWebGL2IsAvailable() {
|
|
53
|
+
try {
|
|
54
|
+
const e = document.createElement("canvas");
|
|
55
|
+
return !!(window.WebGL2RenderingContext && e.getContext("webgl2"));
|
|
56
|
+
} catch {
|
|
57
|
+
return !1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
45
60
|
/**
|
|
46
61
|
* Registers a new component that was initialized on this page.
|
|
47
62
|
* This is optional from the perspective of the initialization flow but highly recommend
|
|
@@ -71,8 +86,8 @@ class g {
|
|
|
71
86
|
* @returns {LoggerModeNames} A valid logger mode name.
|
|
72
87
|
*/
|
|
73
88
|
getLoggerModeNameFromEnvironment() {
|
|
74
|
-
let e =
|
|
75
|
-
return this._environment === s.STAGING ? e =
|
|
89
|
+
let e = a.Dev;
|
|
90
|
+
return this._environment === s.STAGING ? e = a.Staging : this._environment === s.PRODUCTION && (e = a.Release), e;
|
|
76
91
|
}
|
|
77
92
|
/**
|
|
78
93
|
* Generates a random UUID using crypto.randomUUID with a fallback on custom generator,
|
|
@@ -96,19 +111,17 @@ class g {
|
|
|
96
111
|
* @returns {string} The generated XPath.
|
|
97
112
|
*/
|
|
98
113
|
static generateXPath(e) {
|
|
99
|
-
let t = "",
|
|
100
|
-
for (;
|
|
101
|
-
let
|
|
102
|
-
for (;
|
|
103
|
-
|
|
104
|
-
t = `/${
|
|
114
|
+
let t = "", n = e;
|
|
115
|
+
for (; n; ) {
|
|
116
|
+
let r = 1, o = n.previousSibling;
|
|
117
|
+
for (; o; )
|
|
118
|
+
o.nodeName === n.nodeName && r++, o = o.previousSibling;
|
|
119
|
+
t = `/${n.nodeName.toLowerCase() + (r > 1 ? `[${r}]` : "")}${t}`, n = n.parentNode;
|
|
105
120
|
}
|
|
106
121
|
return t;
|
|
107
122
|
}
|
|
108
123
|
}
|
|
109
124
|
export {
|
|
110
125
|
s as ENVIRONMENT_TYPE,
|
|
111
|
-
g as Epigraph
|
|
112
|
-
w as EpigraphBaseSolutionHtmlElement,
|
|
113
|
-
I as EpigraphBaseSolutionLitElement
|
|
126
|
+
g as Epigraph
|
|
114
127
|
};
|
|
@@ -0,0 +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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Epigraph as e } from "
|
|
1
|
+
import { i as s } from "../lit-element-C3moVMGu.js";
|
|
2
|
+
import { Epigraph as e } from "./epigraph.js";
|
|
3
3
|
class h extends HTMLElement {
|
|
4
4
|
constructor(t, i) {
|
|
5
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({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=Symbol("data"),u=Symbol("next"),m=class p{constructor(e){this[g]=e,this[u]=null}get data(){return this[g]}set next(e){if(!(e instanceof p)&&e!==null)throw new Error("This node is not an instance of the custom class 'Node'.");this[u]=e}get next(){return this[u]}};let f=m;const h=Symbol("head");class q{constructor(){this[h]=null}set head(e){this[h]=e}get head(){return this[h]}addToTail(e){let t=this.head;if(t){for(;t.next!==null;)t=t?.next;return t.next=new f(e)}return this.head=new f(e)}removeHead(){const e=this.head;if(e)return this.head=e.next,e.data}}const y=Symbol("queue"),o=Symbol("size");class l{constructor(){this[y]=new q,this[o]=0}get queue(){return this[y]}get size(){return this[o]}enqueue(e){this.queue.addToTail(e),this[o]++}dequeue(){const e=this.queue.removeHead();return this[o]--,e}}class A{constructor(e,t,n,s){this.name=this.pluginName="GA3-PLUGIN",this.trackingID=e,this.verboseLogging=t,this.user=n,this.trackerName=s,this.queue=new l,this.trackerInterval=0,this.trackerCreated=!1}sendEvent(e){if(this.queue.enqueue(e),window.ga!==void 0&&typeof ga=="function")try{this.dequeueAndSendEvents()}catch(t){this.logger(t)}else this.logger("Cannot send Google Analytics 3 event: ga function is not defined.");return!0}dequeueAndSendEvents(){if(this.trackerCreated){let e=this.queue.size;for(let t=0;t<e;t++){const n=this.queue.dequeue();ga(`${this.trackerName}.send`,n.type,n.category,n.action,n.label,n.interaction),this.logger(`Google Analytics 3 event successfully sent: ${n.action}`)}}else this.logger("Cannot sent Google Analytics 3 event: tracker was not created.")}async createTracker(){if(window.ga!==void 0&&typeof ga=="function")try{ga("create",this.trackingID,"auto",this.trackerName,{userId:this.user});const e=new URL(window.location.href);ga(`${this.trackerName}.set`,"page",e.pathname),ga(`${this.trackerName}.set`,"location",e.href),this.trackerCreated=!0,this.logger("Google Analytics 3 tracker successfully created."),this.dequeueAndSendEvents(),window.clearInterval(this.trackerInterval)}catch(e){this.logger(e)}else this.logger("Error: Cannot create tracker, ga function is not defined.")}logger(e){this.verboseLogging&&console.warn(e)}getUniquePluginIdentifier(){return this.pluginName+"-"+this.trackingID}setupPlugin(){var e=0;this.trackerInterval=window.setInterval(()=>{this.createTracker(),++e===10&&(window.clearInterval(this.trackerInterval),this.logger("Error: Failed to create Google Analytics tracker in the allotted timeframe."))},1e3)}}class P{constructor(e,t){this.name=this.pluginName="GA4-PLUGIN",this.trackingID=e,this.verboseLogging=t,this.queue=new l,this.dataLayer=window.dataLayer,this.dataLayerName="dataLayer",this.setupDataLayer(),this.initGtag(this.dataLayerName,this.trackingID)}setupDataLayer(){if(this.dataLayer)return;const t=this.findGA4ScriptInfo(this.trackingID)?.l;t&&(this.dataLayerName=t,this.dataLayer=window[t])}initGtag(e="dataLayer",t){typeof window.gtag!="function"&&(window.gtag=function(){window[e].push(arguments),gtag("js",new Date),gtag("config",t)})}async sendEvent(e,t){this.queue.enqueue(e);let n=!0;if(t&&(n=t.hasConsent()),this.dataLayer!==void 0&&n)try{await this.dequeueAndSendEvents()}catch(s){this.logger(s)}else this.logger("Cannot send Google Analytics 4 event: dataLayer is not defined.")}async dequeueAndSendEvents(){let e=this.queue.size;for(let t=0;t<e;t++){const n=this.queue.dequeue();let s={send_to:this.trackingID,event_action:n.action,event_category:n.category,event_label:n.label,epg_event_tag:""};if("parameters"in n&&Object.assign(s,n.parameters),JSON.stringify(s).length>459)try{let a=await this.sendGA4LongParameters(s);s={send_to:this.trackingID,event_action:n.action,event_category:n.category,event_label:n.label,epg_event_tag:a}}catch{}gtag("event",n.action,s),this.logger(`Google Analytics 4 event successfully sent: ${n.action}`)}}logger(e){this.verboseLogging&&console.warn(e)}getUniquePluginIdentifier(){return this.name+"-"+this.trackingID}setupPlugin(){this.dataLayer!==void 0&&this.dequeueAndSendEvents()}async sendGA4LongParameters(e){const t="https://api.myepigraph.com/api/analytics/ga4/custom",n={parameters:e};try{const s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n)});if(s.ok){const r=await s.json();return r&&r.id?r.id:""}else return""}catch{return""}}findGA4ScriptInfo(e){const t=document.querySelectorAll("script[src]");for(const n of t){const s=n.getAttribute("src");if(s&&s.includes(e)){const r=new URL(s,location.href),a=Object.fromEntries(r.searchParams.entries());return{fullSrc:r.href,id:a.id||void 0,l:a.l||void 0}}}return null}}class S{constructor(e,t,n,s,r=!1){this.sessionId=t,this.xPath=n,this.name=this.pluginName="NEXUS-PLUGIN",this.trackingID=e,this.verboseLogging=s,this.queue=new l,this.url=r?"https://nexus.epigraph.dev/api/analytics/event":"https://api.myepigraph.com/api/analytics/event"}async sendEvent(e,t){this.queue.enqueue(e);let n=!0;t&&(n=t.hasConsent()),n&&await this.dequeueAndSendEvents()}async dequeueAndSendEvents(){for(let e=0;e<this.queue.size;e++){const t=this.queue.dequeue(),n={experience_id:this.trackingID,action:t.action,parameters:t.parameters};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)})).status===204,""}catch{return""}}return""}getUniquePluginIdentifier(){return this.name+"-"+this.trackingID}setupPlugin(){}}class v{constructor(e){this.consentSet=!1,this.consent=!1,this.pluginName="OneTrustConsentPlugin",this.consentIdentifier=e,this.consent=!1,this.addConsentChangedListener()}hasConsent(){if(this.consentSet)return this.consent;if(window.OnetrustActiveGroup!==void 0){let e=window.OnetrustActiveGroup;e!==void 0&&e.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 d=(i=>(i.OneTrust="onetrust",i))(d||{});/**
|
|
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 w;const c=Symbol("analyticsPluginsMap");w=c;class I{constructor(e,t){this[w]=new Map,this._consentPlugin=null,e&&t&&(this._consentPlugin=this.buildConsentPlugin(e,t))}addEventPlugin(e){this[c].has(e.getUniquePluginIdentifier())||(this[c].set(e.getUniquePluginIdentifier(),e),e.setupPlugin())}sendEvent(e){this[c].forEach(t=>{t.sendEvent(e,this._consentPlugin)})}buildConsentPlugin(e,t){return e.toLowerCase()===d.OneTrust.toLowerCase()?new v(t):null}}exports.ConsentPluginNames=d;exports.EpigraphAnalytics=I;exports.GA3AnalyticsPlugin=A;exports.GA4AnalyticsPlugin=P;exports.NexusAnalyticsPlugin=S;exports.OneTrustConsentPlugin=v;
|
|
@@ -1,8 +1,335 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
const d = Symbol("data"), u = Symbol("next"), w = class y {
|
|
2
|
+
constructor(e) {
|
|
3
|
+
this[d] = e, this[u] = null;
|
|
4
|
+
}
|
|
5
|
+
get data() {
|
|
6
|
+
return this[d];
|
|
7
|
+
}
|
|
8
|
+
set next(e) {
|
|
9
|
+
if (!(e instanceof y) && e !== null)
|
|
10
|
+
throw new Error(
|
|
11
|
+
"This node is not an instance of the custom class 'Node'."
|
|
12
|
+
);
|
|
13
|
+
this[u] = e;
|
|
14
|
+
}
|
|
15
|
+
get next() {
|
|
16
|
+
return this[u];
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
let g = w;
|
|
20
|
+
const h = Symbol("head");
|
|
21
|
+
class m {
|
|
22
|
+
constructor() {
|
|
23
|
+
this[h] = null;
|
|
24
|
+
}
|
|
25
|
+
set head(e) {
|
|
26
|
+
this[h] = e;
|
|
27
|
+
}
|
|
28
|
+
get head() {
|
|
29
|
+
return this[h];
|
|
30
|
+
}
|
|
31
|
+
addToTail(e) {
|
|
32
|
+
let t = this.head;
|
|
33
|
+
if (t) {
|
|
34
|
+
for (; t.next !== null; )
|
|
35
|
+
t = t?.next;
|
|
36
|
+
return t.next = new g(e);
|
|
37
|
+
}
|
|
38
|
+
return this.head = new g(e);
|
|
39
|
+
}
|
|
40
|
+
removeHead() {
|
|
41
|
+
const e = this.head;
|
|
42
|
+
if (e)
|
|
43
|
+
return this.head = e.next, e.data;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const f = Symbol("queue"), o = Symbol("size");
|
|
47
|
+
class l {
|
|
48
|
+
constructor() {
|
|
49
|
+
this[f] = new m(), this[o] = 0;
|
|
50
|
+
}
|
|
51
|
+
get queue() {
|
|
52
|
+
return this[f];
|
|
53
|
+
}
|
|
54
|
+
get size() {
|
|
55
|
+
return this[o];
|
|
56
|
+
}
|
|
57
|
+
enqueue(e) {
|
|
58
|
+
this.queue.addToTail(e), this[o]++;
|
|
59
|
+
}
|
|
60
|
+
dequeue() {
|
|
61
|
+
const e = this.queue.removeHead();
|
|
62
|
+
return this[o]--, e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class I {
|
|
66
|
+
constructor(e, t, n, s) {
|
|
67
|
+
this.name = this.pluginName = "GA3-PLUGIN", this.trackingID = e, this.verboseLogging = t, this.user = n, this.trackerName = s, this.queue = new l(), this.trackerInterval = 0, this.trackerCreated = !1;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* This function will send an Event to GA3.
|
|
71
|
+
*
|
|
72
|
+
* @param eventData AnalyticsEvent The event to be tracked
|
|
73
|
+
*/
|
|
74
|
+
sendEvent(e) {
|
|
75
|
+
if (this.queue.enqueue(e), window.ga !== void 0 && typeof ga == "function")
|
|
76
|
+
try {
|
|
77
|
+
this.dequeueAndSendEvents();
|
|
78
|
+
} catch (t) {
|
|
79
|
+
this.logger(t);
|
|
80
|
+
}
|
|
81
|
+
else
|
|
82
|
+
this.logger("Cannot send Google Analytics 3 event: ga function is not defined.");
|
|
83
|
+
return !0;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Send all events that are in the queue
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
dequeueAndSendEvents() {
|
|
90
|
+
if (this.trackerCreated) {
|
|
91
|
+
let e = this.queue.size;
|
|
92
|
+
for (let t = 0; t < e; t++) {
|
|
93
|
+
const n = this.queue.dequeue();
|
|
94
|
+
ga(
|
|
95
|
+
`${this.trackerName}.send`,
|
|
96
|
+
n.type,
|
|
97
|
+
n.category,
|
|
98
|
+
n.action,
|
|
99
|
+
n.label,
|
|
100
|
+
n.interaction
|
|
101
|
+
), this.logger(`Google Analytics 3 event successfully sent: ${n.action}`);
|
|
102
|
+
}
|
|
103
|
+
} else
|
|
104
|
+
this.logger("Cannot sent Google Analytics 3 event: tracker was not created.");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* GA3 requires that a tracker be created prior to being sent. This is called from the constructor. It is
|
|
108
|
+
* important to note that the promise that is inherently returned is ignored in the constructor at this
|
|
109
|
+
* time. This is due to the events that are added will be queued from the page. This script requires
|
|
110
|
+
* that the GA script has been imported on the page already as it does not check for it today.
|
|
111
|
+
*
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
async createTracker() {
|
|
115
|
+
if (window.ga !== void 0 && typeof ga == "function")
|
|
116
|
+
try {
|
|
117
|
+
ga("create", this.trackingID, "auto", this.trackerName, {
|
|
118
|
+
userId: this.user
|
|
119
|
+
});
|
|
120
|
+
const e = new URL(window.location.href);
|
|
121
|
+
ga(`${this.trackerName}.set`, "page", e.pathname), ga(`${this.trackerName}.set`, "location", e.href), this.trackerCreated = !0, this.logger("Google Analytics 3 tracker successfully created."), this.dequeueAndSendEvents(), window.clearInterval(this.trackerInterval);
|
|
122
|
+
} catch (e) {
|
|
123
|
+
this.logger(e);
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
this.logger("Error: Cannot create tracker, ga function is not defined.");
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Checks if verboseLogging is enabled, then logs the error
|
|
130
|
+
* @param err
|
|
131
|
+
*/
|
|
132
|
+
logger(e) {
|
|
133
|
+
this.verboseLogging && console.warn(e);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
137
|
+
*/
|
|
138
|
+
getUniquePluginIdentifier() {
|
|
139
|
+
return this.pluginName + "-" + this.trackingID;
|
|
140
|
+
}
|
|
141
|
+
setupPlugin() {
|
|
142
|
+
var e = 0;
|
|
143
|
+
this.trackerInterval = window.setInterval(() => {
|
|
144
|
+
this.createTracker(), ++e === 10 && (window.clearInterval(this.trackerInterval), this.logger("Error: Failed to create Google Analytics tracker in the allotted timeframe."));
|
|
145
|
+
}, 1e3);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
class A {
|
|
149
|
+
constructor(e, t) {
|
|
150
|
+
this.name = this.pluginName = "GA4-PLUGIN", this.trackingID = e, this.verboseLogging = t, this.queue = new l(), this.dataLayer = window.dataLayer, this.dataLayerName = "dataLayer", this.setupDataLayer(), this.initGtag(this.dataLayerName, this.trackingID);
|
|
151
|
+
}
|
|
152
|
+
setupDataLayer() {
|
|
153
|
+
if (this.dataLayer) return;
|
|
154
|
+
const t = this.findGA4ScriptInfo(this.trackingID)?.l;
|
|
155
|
+
t && (this.dataLayerName = t, this.dataLayer = window[t]);
|
|
156
|
+
}
|
|
157
|
+
initGtag(e = "dataLayer", t) {
|
|
158
|
+
typeof window.gtag != "function" && (window.gtag = function() {
|
|
159
|
+
window[e].push(arguments), gtag("js", /* @__PURE__ */ new Date()), gtag("config", t);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* This function will send an Event to GA3.
|
|
164
|
+
*
|
|
165
|
+
* @param eventData AnalyticsEvent The event to be tracked
|
|
166
|
+
* @param consentPlugin
|
|
167
|
+
*/
|
|
168
|
+
async sendEvent(e, t) {
|
|
169
|
+
this.queue.enqueue(e);
|
|
170
|
+
let n = !0;
|
|
171
|
+
if (t && (n = t.hasConsent()), this.dataLayer !== void 0 && n)
|
|
172
|
+
try {
|
|
173
|
+
await this.dequeueAndSendEvents();
|
|
174
|
+
} catch (s) {
|
|
175
|
+
this.logger(s);
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
this.logger("Cannot send Google Analytics 4 event: dataLayer is not defined.");
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Send all events that are in the queue
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
async dequeueAndSendEvents() {
|
|
185
|
+
let e = this.queue.size;
|
|
186
|
+
for (let t = 0; t < e; t++) {
|
|
187
|
+
const n = this.queue.dequeue();
|
|
188
|
+
let s = {
|
|
189
|
+
send_to: this.trackingID,
|
|
190
|
+
event_action: n.action,
|
|
191
|
+
event_category: n.category,
|
|
192
|
+
event_label: n.label,
|
|
193
|
+
epg_event_tag: ""
|
|
194
|
+
};
|
|
195
|
+
if ("parameters" in n && Object.assign(s, n.parameters), JSON.stringify(s).length > 459)
|
|
196
|
+
try {
|
|
197
|
+
let a = await this.sendGA4LongParameters(s);
|
|
198
|
+
s = {
|
|
199
|
+
send_to: this.trackingID,
|
|
200
|
+
event_action: n.action,
|
|
201
|
+
event_category: n.category,
|
|
202
|
+
event_label: n.label,
|
|
203
|
+
epg_event_tag: a
|
|
204
|
+
};
|
|
205
|
+
} catch {
|
|
206
|
+
}
|
|
207
|
+
gtag("event", n.action, s), this.logger(`Google Analytics 4 event successfully sent: ${n.action}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Checks if verboseLogging is enabled, then logs the error
|
|
212
|
+
* @param err
|
|
213
|
+
*/
|
|
214
|
+
logger(e) {
|
|
215
|
+
this.verboseLogging && console.warn(e);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
219
|
+
*/
|
|
220
|
+
getUniquePluginIdentifier() {
|
|
221
|
+
return this.name + "-" + this.trackingID;
|
|
222
|
+
}
|
|
223
|
+
setupPlugin() {
|
|
224
|
+
this.dataLayer !== void 0 && this.dequeueAndSendEvents();
|
|
225
|
+
}
|
|
226
|
+
async sendGA4LongParameters(e) {
|
|
227
|
+
const t = "https://api.myepigraph.com/api/analytics/ga4/custom", n = {
|
|
228
|
+
parameters: e
|
|
229
|
+
};
|
|
230
|
+
try {
|
|
231
|
+
const s = await fetch(t, {
|
|
232
|
+
method: "POST",
|
|
233
|
+
// Assuming it's a POST request, adjust if necessary
|
|
234
|
+
headers: {
|
|
235
|
+
"Content-Type": "application/json",
|
|
236
|
+
Accept: "application/json"
|
|
237
|
+
},
|
|
238
|
+
body: JSON.stringify(n)
|
|
239
|
+
});
|
|
240
|
+
if (s.ok) {
|
|
241
|
+
const r = await s.json();
|
|
242
|
+
return r && r.id ? r.id : "";
|
|
243
|
+
} else
|
|
244
|
+
return "";
|
|
245
|
+
} catch {
|
|
246
|
+
return "";
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
findGA4ScriptInfo(e) {
|
|
250
|
+
const t = document.querySelectorAll("script[src]");
|
|
251
|
+
for (const n of t) {
|
|
252
|
+
const s = n.getAttribute("src");
|
|
253
|
+
if (s && s.includes(e)) {
|
|
254
|
+
const r = new URL(s, location.href), a = Object.fromEntries(r.searchParams.entries());
|
|
255
|
+
return {
|
|
256
|
+
fullSrc: r.href,
|
|
257
|
+
id: a.id || void 0,
|
|
258
|
+
l: a.l || void 0
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
class L {
|
|
266
|
+
constructor(e, t, n, s, r = !1) {
|
|
267
|
+
this.sessionId = t, this.xPath = n, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = e, this.verboseLogging = s, this.queue = new l(), this.url = r ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event";
|
|
268
|
+
}
|
|
269
|
+
async sendEvent(e, t) {
|
|
270
|
+
this.queue.enqueue(e);
|
|
271
|
+
let n = !0;
|
|
272
|
+
t && (n = t.hasConsent()), n && await this.dequeueAndSendEvents();
|
|
273
|
+
}
|
|
274
|
+
async dequeueAndSendEvents() {
|
|
275
|
+
for (let e = 0; e < this.queue.size; e++) {
|
|
276
|
+
const t = this.queue.dequeue(), n = {
|
|
277
|
+
experience_id: this.trackingID,
|
|
278
|
+
action: t.action,
|
|
279
|
+
parameters: t.parameters
|
|
280
|
+
};
|
|
281
|
+
try {
|
|
282
|
+
return (await fetch(this.url, {
|
|
283
|
+
method: "POST",
|
|
284
|
+
// Assuming it's a POST request, adjust if necessary
|
|
285
|
+
headers: {
|
|
286
|
+
"Content-Type": "application/json",
|
|
287
|
+
Accept: "application/json",
|
|
288
|
+
"EPG-SESSION-ID": this.sessionId,
|
|
289
|
+
"EPG-XPATH": this.xPath,
|
|
290
|
+
Origin: typeof window < "u" ? window.location.origin : ""
|
|
291
|
+
},
|
|
292
|
+
body: JSON.stringify(n)
|
|
293
|
+
})).status === 204, "";
|
|
294
|
+
} catch {
|
|
295
|
+
return "";
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return "";
|
|
299
|
+
}
|
|
300
|
+
getUniquePluginIdentifier() {
|
|
301
|
+
return this.name + "-" + this.trackingID;
|
|
302
|
+
}
|
|
303
|
+
setupPlugin() {
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
class q {
|
|
307
|
+
constructor(e) {
|
|
308
|
+
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Checks to see if the user has consented. If this is false, it will block all analytics
|
|
312
|
+
*/
|
|
313
|
+
hasConsent() {
|
|
314
|
+
if (this.consentSet)
|
|
315
|
+
return this.consent;
|
|
316
|
+
if (window.OnetrustActiveGroup !== void 0) {
|
|
317
|
+
let e = window.OnetrustActiveGroup;
|
|
318
|
+
e !== void 0 && e.split(",").forEach((n) => {
|
|
319
|
+
n === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
return this.consent;
|
|
323
|
+
}
|
|
324
|
+
addConsentChangedListener() {
|
|
325
|
+
window.addEventListener("load", () => {
|
|
326
|
+
this.hasConsent(), window.OneTrust !== void 0 && typeof window.OneTrust == "object" && window.OneTrust.OnConsentChanged(() => {
|
|
327
|
+
this.consentSet = !1, this.hasConsent();
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
var p = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(p || {});
|
|
6
333
|
/**
|
|
7
334
|
* @license
|
|
8
335
|
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
@@ -19,12 +346,12 @@ import { ConsentPluginNames as l } from "../../lib/EpigraphLibs/EpigraphAnalytic
|
|
|
19
346
|
* See the License for the specific language governing permissions and
|
|
20
347
|
* limitations under the License.
|
|
21
348
|
*/
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
class
|
|
26
|
-
constructor(
|
|
27
|
-
this[
|
|
349
|
+
var v;
|
|
350
|
+
const c = Symbol("analyticsPluginsMap");
|
|
351
|
+
v = c;
|
|
352
|
+
class S {
|
|
353
|
+
constructor(e, t) {
|
|
354
|
+
this[v] = /* @__PURE__ */ new Map(), this._consentPlugin = null, e && t && (this._consentPlugin = this.buildConsentPlugin(e, t));
|
|
28
355
|
}
|
|
29
356
|
/**
|
|
30
357
|
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
@@ -33,20 +360,20 @@ class a {
|
|
|
33
360
|
*
|
|
34
361
|
* @param plugin
|
|
35
362
|
*/
|
|
36
|
-
addEventPlugin(
|
|
37
|
-
this[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
),
|
|
363
|
+
addEventPlugin(e) {
|
|
364
|
+
this[c].has(e.getUniquePluginIdentifier()) || (this[c].set(
|
|
365
|
+
e.getUniquePluginIdentifier(),
|
|
366
|
+
e
|
|
367
|
+
), e.setupPlugin());
|
|
41
368
|
}
|
|
42
369
|
/**
|
|
43
370
|
* Send an Event to all plugins
|
|
44
371
|
*
|
|
45
372
|
* @param eventData
|
|
46
373
|
*/
|
|
47
|
-
sendEvent(
|
|
48
|
-
this[
|
|
49
|
-
t.sendEvent(
|
|
374
|
+
sendEvent(e) {
|
|
375
|
+
this[c].forEach((t) => {
|
|
376
|
+
t.sendEvent(e, this._consentPlugin);
|
|
50
377
|
});
|
|
51
378
|
}
|
|
52
379
|
/**
|
|
@@ -55,15 +382,15 @@ class a {
|
|
|
55
382
|
* @param consentIdentifier
|
|
56
383
|
* @private
|
|
57
384
|
*/
|
|
58
|
-
buildConsentPlugin(
|
|
59
|
-
return
|
|
385
|
+
buildConsentPlugin(e, t) {
|
|
386
|
+
return e.toLowerCase() === p.OneTrust.toLowerCase() ? new q(t) : null;
|
|
60
387
|
}
|
|
61
388
|
}
|
|
62
389
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
390
|
+
p as ConsentPluginNames,
|
|
391
|
+
S as EpigraphAnalytics,
|
|
392
|
+
I as GA3AnalyticsPlugin,
|
|
393
|
+
A as GA4AnalyticsPlugin,
|
|
394
|
+
L as NexusAnalyticsPlugin,
|
|
395
|
+
q as OneTrustConsentPlugin
|
|
69
396
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var s=(l=>(l.Release="release",l.Staging="staging",l.Dev="dev",l))(s||{}),t=(l=>(l.Info="info",l.Warn="warn",l.Error="error",l))(t||{});class a{constructor(o){this.context="EPIGRAPH-LOGGER",this._allModes={release:{name:"release",allows:["error"]},staging:{name:"staging",allows:["warn","error"]},dev:{name:"dev",allows:["info","warn","error"]}},this._currentMode="release",o&&(this.context=o.toLocaleUpperCase())}get modes(){return this._allModes}setCurrentMode(o){if(!Object.keys(this._allModes).includes(o)){console.warn(`"${o}": is not a valid logger mode`);return}this._currentMode=o}_isLogTypeAllowedInCurrentMode(o){return this._allModes[this._currentMode].allows.includes(o)}info({title:o,details:r="",contextOverride:e=void 0}){if(!this._isLogTypeAllowedInCurrentMode("info"))return;const n=e||this.context;console.groupCollapsed(`[${n}]: ${o}`),console.log(r),console.groupCollapsed("Traceback..."),console.trace(),console.groupEnd(),console.groupEnd()}warn({title:o,details:r="",contextOverride:e=void 0}){if(!this._isLogTypeAllowedInCurrentMode("warn"))return;const n=e||this.context;console.groupCollapsed(`%c[${n}]: ${o}`,"color: orange;"),console.warn(r),console.groupCollapsed("Traceback..."),console.trace(),console.groupEnd(),console.groupEnd()}error({title:o,details:r="",contextOverride:e=void 0}){if(!this._isLogTypeAllowedInCurrentMode("error"))return;const n=e||this.context;console.groupCollapsed(`%c[${n}]: ${o}`,"color: red;"),console.error(r),console.groupCollapsed("Traceback..."),console.trace(),console.groupEnd(),console.groupEnd()}table({title:o,details:r={},contextOverride:e=void 0,logType:n="info"}){if(!this._isLogTypeAllowedInCurrentMode(n))return;const c=e||this.context;console.groupCollapsed(`[${c}]: ${o}`),console.table(r),console.groupCollapsed("Traceback..."),console.trace(),console.groupEnd(),console.groupEnd()}group({title:o,contextOverride:r=void 0,logType:e="info"}){if(!this._isLogTypeAllowedInCurrentMode(e))return;const n=r||this.context;console.group(`%c ${n} GROUP`,o)}groupCollapsed({title:o,contextOverride:r=void 0,logType:e="info"}){if(!this._isLogTypeAllowedInCurrentMode(e))return;const n=r||this.context;console.groupCollapsed(`%c ${n} GROUP`,o)}groupEnd(){this._isLogTypeAllowedInCurrentMode("info")&&(console.log("----------------------------------"),console.groupEnd())}}exports.EpigraphLogger=a;exports.LogTypes=t;exports.LoggerModeNames=s;
|
|
@@ -0,0 +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;
|