@epigraph/epigraph-std-lib 4.0.0-alpha → 4.0.2-alpha
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 +0 -14
- package/dist/Epigraph/epigraph.js +20 -84
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +69 -0
- package/dist/EpigraphLibs/EpigraphAnalytics/generics/queue.d.ts +3 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/types/index.d.ts +7 -0
- package/dist/EpigraphLibs/{epigraphLogger.js → EpigraphLogger/epigraphLogger.js} +19 -19
- package/dist/EpigraphLibs/{epigraphNexusApi.js → EpigraphNexusApi/epigraphNexusApi.js} +1 -1
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +69 -0
- package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +67 -0
- package/dist/lib/Epigraph/constants/enums.js +4 -0
- package/dist/lib/Epigraph/epigraphBaseSolution.js +70 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/consent-plugin-names.js +4 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/one-trust-consent-plugin.js +29 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/node.js +22 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/queue.js +23 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/single-linked-list.js +30 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga3-analytics-plugin.js +87 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.js +121 -0
- package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.js +45 -0
- package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/conversions.js +26 -0
- package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/enums.js +5 -0
- package/dist/node_modules/lit-html/async-directive.js +67 -0
- package/dist/node_modules/lit-html/directive-helpers.js +10 -0
- package/dist/node_modules/lit-html/directive.js +27 -0
- package/dist/node_modules/lit-html/directives/ref.js +40 -0
- package/dist/node_modules/lit-html/lit-html.js +225 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +41 -74
- package/dist/EpigraphLibs/epigraphAnalytics.js +0 -399
- package/dist/EpigraphLibs/epigraphQrCodeGenerator.js +0 -938
- package/dist/EpigraphLibs/epigraphUnitsConverter.js +0 -88
- package/dist/ThirdPartyLibs/modelViewer.d.ts +0 -2
- package/dist/ThirdPartyLibs/modelViewer.js +0 -8608
- package/dist/ThirdPartyLibs/three-gltf-extensions/exporters/KHR_materials_variants/KHR_materials_variants_exporter.d.ts +0 -9
- package/dist/ThirdPartyLibs/three-gltf-extensions/loaders/KHR_materials_variants/KHR_materials_variants.d.ts +0 -6
- package/dist/ThirdPartyLibs/threejs.d.ts +0 -13
- package/dist/ThirdPartyLibs/threejs.js +0 -800
- package/dist/chunks/VerticalBlurShader.B0rdEBFu.js +0 -26381
- /package/dist/EpigraphLibs/{epigraphResultFactory.js → EpigraphResultFactory/epigraphResultFactory.js} +0 -0
- /package/dist/EpigraphLibs/{epigraphUrlProcessor.js → EpigraphUrlProcessor/epigraphUrlProcessor.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,75 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epigraph/epigraph-std-lib",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2-alpha",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"main": "./dist/epigraph-std-lib.js",
|
|
6
|
+
"module": "./dist/epigraph-std-lib.js",
|
|
5
7
|
"files": [
|
|
6
|
-
"dist"
|
|
8
|
+
"dist",
|
|
9
|
+
"dist/**/*"
|
|
7
10
|
],
|
|
8
11
|
"types": "./dist/epigraph-std-lib.d.ts",
|
|
9
|
-
"typesVersions": {
|
|
10
|
-
"*": {
|
|
11
|
-
"epigraph": [
|
|
12
|
-
"./dist/Epigraph/epigraph.d.ts"
|
|
13
|
-
],
|
|
14
|
-
"epigraphAnalytics": [
|
|
15
|
-
"./dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts"
|
|
16
|
-
],
|
|
17
|
-
"epigraphLogger": [
|
|
18
|
-
"./dist/EpigraphLibs/EpigraphLogger/epigrpahLogger.d.ts"
|
|
19
|
-
],
|
|
20
|
-
"epigraphNexusApi": [
|
|
21
|
-
"./dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.d.ts"
|
|
22
|
-
],
|
|
23
|
-
"epigraphQrCodeGenerator": [
|
|
24
|
-
"./dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.d.ts"
|
|
25
|
-
],
|
|
26
|
-
"epigraphResultFactory": [
|
|
27
|
-
"./dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.d.ts"
|
|
28
|
-
],
|
|
29
|
-
"epigraphUnitsConverter": [
|
|
30
|
-
"./dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.d.ts"
|
|
31
|
-
],
|
|
32
|
-
"epigraphUrlProcessor": [
|
|
33
|
-
"./dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.d.ts"
|
|
34
|
-
],
|
|
35
|
-
"threejs": [
|
|
36
|
-
"./dist/ThirdPartyLibs/threejs.d.ts"
|
|
37
|
-
],
|
|
38
|
-
"modelViewer": [
|
|
39
|
-
"./dist/ThirdPartyLibs/modelViewer.d.ts"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
12
|
"exports": {
|
|
44
|
-
"
|
|
45
|
-
"import": "./dist/
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/epigraph-std-lib.js",
|
|
15
|
+
"types": "./dist/epigraph-std-lib.d.ts"
|
|
46
16
|
},
|
|
47
|
-
"./
|
|
48
|
-
"import": "./dist/
|
|
17
|
+
"./epigraph": {
|
|
18
|
+
"import": "./dist/Epigraph/epigraph.js",
|
|
19
|
+
"types": "./dist/Epigraph/epigraph.d.ts"
|
|
49
20
|
},
|
|
50
|
-
"./
|
|
51
|
-
"import": "./dist/EpigraphLibs/
|
|
21
|
+
"./epigraphAnalytics": {
|
|
22
|
+
"import": "./dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js",
|
|
23
|
+
"types": "./dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts"
|
|
52
24
|
},
|
|
53
|
-
"./
|
|
54
|
-
"import": "./dist/EpigraphLibs/
|
|
25
|
+
"./epigraphLogger": {
|
|
26
|
+
"import": "./dist/EpigraphLibs/EpigraphLogger/epigraphLogger.js",
|
|
27
|
+
"types": "./dist/EpigraphLibs/EpigraphLogger/epigraphLogger.d.ts"
|
|
55
28
|
},
|
|
56
|
-
"./
|
|
57
|
-
"import": "./dist/EpigraphLibs/
|
|
29
|
+
"./epigraphNexusApi": {
|
|
30
|
+
"import": "./dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js",
|
|
31
|
+
"types": "./dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.d.ts"
|
|
58
32
|
},
|
|
59
|
-
"./
|
|
60
|
-
"import": "./dist/EpigraphLibs/
|
|
33
|
+
"./epigraphQrCodeGenerator": {
|
|
34
|
+
"import": "./dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js",
|
|
35
|
+
"types": "./dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.d.ts"
|
|
61
36
|
},
|
|
62
|
-
"./
|
|
63
|
-
"import": "./dist/EpigraphLibs/
|
|
37
|
+
"./epigraphResultFactory": {
|
|
38
|
+
"import": "./dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js",
|
|
39
|
+
"types": "./dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.d.ts"
|
|
64
40
|
},
|
|
65
|
-
"./
|
|
66
|
-
"import": "./dist/EpigraphLibs/
|
|
41
|
+
"./epigraphUnitsConverter": {
|
|
42
|
+
"import": "./dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js",
|
|
43
|
+
"types": "./dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.d.ts"
|
|
67
44
|
},
|
|
68
|
-
"./
|
|
69
|
-
"import": "./dist/
|
|
70
|
-
|
|
71
|
-
"./dist/ThirdPartyLibs/modelViewer": {
|
|
72
|
-
"import": "./dist/ThirdPartyLibs/modelViewer.js"
|
|
45
|
+
"./epigraphUrlProcessor": {
|
|
46
|
+
"import": "./dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js",
|
|
47
|
+
"types": "./dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.d.ts"
|
|
73
48
|
}
|
|
74
49
|
},
|
|
75
50
|
"scripts": {
|
|
@@ -77,29 +52,21 @@
|
|
|
77
52
|
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
78
53
|
"preview": "vite preview",
|
|
79
54
|
"prepublishOnly": "npm run build",
|
|
80
|
-
"test": "npm run build && vitest"
|
|
81
|
-
"update-three-gltf-extensions": "npm install three-gltf-extensions && npm run generate-declarations-materials-variants-loader && npm run generate-declarations-materials-variants-exporter && node ./npm-scripts/copyUpdatedThreeGltfExtensions.js && npm uninstall three-gltf-extensions",
|
|
82
|
-
"generate-declarations-materials-variants-loader": "tsc --allowJs -d --emitDeclarationOnly ./node_modules/three-gltf-extensions/loaders/KHR_materials_variants/KHR_materials_variants.js",
|
|
83
|
-
"generate-declarations-materials-variants-exporter": "tsc --allowJs -d --emitDeclarationOnly ./node_modules/three-gltf-extensions/exporters/KHR_materials_variants/KHR_materials_variants_exporter.js"
|
|
84
|
-
},
|
|
85
|
-
"dependencies": {
|
|
86
|
-
"@google/model-viewer": "^4.1.0",
|
|
87
|
-
"@types/google.analytics": "^0.0.42",
|
|
88
|
-
"@types/gtag.js": "^0.0.20",
|
|
89
|
-
"@types/node": "^22.13.0",
|
|
90
|
-
"@types/three": "^0.172.0",
|
|
91
|
-
"qr-creator": "^1.0.0"
|
|
55
|
+
"test": "npm run build && vitest"
|
|
92
56
|
},
|
|
57
|
+
"dependencies": {},
|
|
93
58
|
"peerDependencies": {
|
|
94
|
-
"
|
|
95
|
-
"
|
|
59
|
+
"lit": "^3.2.1",
|
|
60
|
+
"qr-creator": "^1.0.0"
|
|
96
61
|
},
|
|
97
62
|
"devDependencies": {
|
|
63
|
+
"@types/node": "^22.13.0",
|
|
64
|
+
"happy-dom": "^16.8.1",
|
|
98
65
|
"typescript": "^5.8.2",
|
|
99
66
|
"vite": "^6.0.5",
|
|
100
67
|
"vite-plugin-dts": "^4.5.0",
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
68
|
+
"vitest": "^3.0.5",
|
|
69
|
+
"@types/google.analytics": "^0.0.42",
|
|
70
|
+
"@types/gtag.js": "^0.0.20"
|
|
104
71
|
}
|
|
105
72
|
}
|
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
const l = Symbol("data"), u = Symbol("next"), v = class y {
|
|
2
|
-
constructor(e) {
|
|
3
|
-
this[l] = e, this[u] = null;
|
|
4
|
-
}
|
|
5
|
-
get data() {
|
|
6
|
-
return this[l];
|
|
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 = v;
|
|
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 == null ? void 0 : 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 d {
|
|
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 d(), 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 d(), 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 e = this.findGA4ScriptInfo(this.trackingID), t = e == null ? void 0 : e.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 && (s = {
|
|
196
|
-
...s,
|
|
197
|
-
...n.parameters
|
|
198
|
-
}), JSON.stringify(s).length > 459)
|
|
199
|
-
try {
|
|
200
|
-
let a = await this.sendGA4LongParameters(s);
|
|
201
|
-
s = {
|
|
202
|
-
send_to: this.trackingID,
|
|
203
|
-
event_action: n.action,
|
|
204
|
-
event_category: n.category,
|
|
205
|
-
event_label: n.label,
|
|
206
|
-
epg_event_tag: a
|
|
207
|
-
};
|
|
208
|
-
} catch {
|
|
209
|
-
}
|
|
210
|
-
gtag("event", n.action, s), this.logger(`Google Analytics 4 event successfully sent: ${n.action}`);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Checks if verboseLogging is enabled, then logs the error
|
|
215
|
-
* @param err
|
|
216
|
-
*/
|
|
217
|
-
logger(e) {
|
|
218
|
-
this.verboseLogging && console.warn(e);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Returns a unique plugin identifier so that tracking ID's can be the same across multiple plugins.
|
|
222
|
-
*/
|
|
223
|
-
getUniquePluginIdentifier() {
|
|
224
|
-
return this.name + "-" + this.trackingID;
|
|
225
|
-
}
|
|
226
|
-
setupPlugin() {
|
|
227
|
-
this.dataLayer !== void 0 && this.dequeueAndSendEvents();
|
|
228
|
-
}
|
|
229
|
-
async sendGA4LongParameters(e) {
|
|
230
|
-
const t = "https://api.myepigraph.com/api/analytics/ga4/custom", n = {
|
|
231
|
-
parameters: e
|
|
232
|
-
};
|
|
233
|
-
try {
|
|
234
|
-
const s = await fetch(t, {
|
|
235
|
-
method: "POST",
|
|
236
|
-
// Assuming it's a POST request, adjust if necessary
|
|
237
|
-
headers: {
|
|
238
|
-
"Content-Type": "application/json",
|
|
239
|
-
Accept: "application/json"
|
|
240
|
-
},
|
|
241
|
-
body: JSON.stringify(n)
|
|
242
|
-
});
|
|
243
|
-
if (s.ok) {
|
|
244
|
-
const r = await s.json();
|
|
245
|
-
return r && r.id ? r.id : "";
|
|
246
|
-
} else
|
|
247
|
-
return "";
|
|
248
|
-
} catch {
|
|
249
|
-
return "";
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
findGA4ScriptInfo(e) {
|
|
253
|
-
const t = document.querySelectorAll("script[src]");
|
|
254
|
-
for (const n of t) {
|
|
255
|
-
const s = n.getAttribute("src");
|
|
256
|
-
if (s && s.includes(e)) {
|
|
257
|
-
const r = new URL(s, location.href), a = Object.fromEntries(r.searchParams.entries());
|
|
258
|
-
return {
|
|
259
|
-
fullSrc: r.href,
|
|
260
|
-
id: a.id || void 0,
|
|
261
|
-
l: a.l || void 0
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
class L {
|
|
269
|
-
constructor(e, t, n, s, r = !1) {
|
|
270
|
-
this.sessionId = t, this.xPath = n, this.name = this.pluginName = "NEXUS-PLUGIN", this.trackingID = e, this.verboseLogging = s, this.queue = new d(), this.url = r ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event";
|
|
271
|
-
}
|
|
272
|
-
async sendEvent(e, t) {
|
|
273
|
-
this.queue.enqueue(e);
|
|
274
|
-
let n = !0;
|
|
275
|
-
t && (n = t.hasConsent()), n && await this.dequeueAndSendEvents();
|
|
276
|
-
}
|
|
277
|
-
async dequeueAndSendEvents() {
|
|
278
|
-
for (let e = 0; e < this.queue.size; e++) {
|
|
279
|
-
const t = this.queue.dequeue(), n = {
|
|
280
|
-
experience_id: this.trackingID,
|
|
281
|
-
action: t.action,
|
|
282
|
-
parameters: t.parameters
|
|
283
|
-
};
|
|
284
|
-
try {
|
|
285
|
-
return (await fetch(this.url, {
|
|
286
|
-
method: "POST",
|
|
287
|
-
// Assuming it's a POST request, adjust if necessary
|
|
288
|
-
headers: {
|
|
289
|
-
"Content-Type": "application/json",
|
|
290
|
-
Accept: "application/json",
|
|
291
|
-
"EPG-SESSION-ID": this.sessionId,
|
|
292
|
-
"EPG-XPATH": this.xPath,
|
|
293
|
-
Origin: typeof window < "u" ? window.location.origin : ""
|
|
294
|
-
},
|
|
295
|
-
body: JSON.stringify(n)
|
|
296
|
-
})).status === 204, "";
|
|
297
|
-
} catch {
|
|
298
|
-
return "";
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return "";
|
|
302
|
-
}
|
|
303
|
-
getUniquePluginIdentifier() {
|
|
304
|
-
return this.name + "-" + this.trackingID;
|
|
305
|
-
}
|
|
306
|
-
setupPlugin() {
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
class q {
|
|
310
|
-
constructor(e) {
|
|
311
|
-
this.consentSet = !1, this.consent = !1, this.pluginName = "OneTrustConsentPlugin", this.consentIdentifier = e, this.consent = !1, this.addConsentChangedListener();
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Checks to see if the user has consented. If this is false, it will block all analytics
|
|
315
|
-
*/
|
|
316
|
-
hasConsent() {
|
|
317
|
-
if (this.consentSet)
|
|
318
|
-
return this.consent;
|
|
319
|
-
if (window.OnetrustActiveGroup !== void 0) {
|
|
320
|
-
let e = window.OnetrustActiveGroup;
|
|
321
|
-
e !== void 0 && e.split(",").forEach((n) => {
|
|
322
|
-
n === this.consentIdentifier && (this.consent = !0, this.consentSet = !0);
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
return this.consent;
|
|
326
|
-
}
|
|
327
|
-
addConsentChangedListener() {
|
|
328
|
-
window.addEventListener("load", () => {
|
|
329
|
-
this.hasConsent(), window.OneTrust !== void 0 && typeof window.OneTrust == "object" && window.OneTrust.OnConsentChanged(() => {
|
|
330
|
-
this.consentSet = !1, this.hasConsent();
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
var p = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(p || {});
|
|
336
|
-
/**
|
|
337
|
-
* @license
|
|
338
|
-
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
339
|
-
*
|
|
340
|
-
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
341
|
-
* you may not use this file except in compliance with the License.
|
|
342
|
-
* You may obtain a copy of the License at
|
|
343
|
-
*
|
|
344
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
345
|
-
*
|
|
346
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
347
|
-
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
348
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
349
|
-
* See the License for the specific language governing permissions and
|
|
350
|
-
* limitations under the License.
|
|
351
|
-
*/
|
|
352
|
-
var w;
|
|
353
|
-
const c = Symbol("analyticsPluginsMap");
|
|
354
|
-
w = c;
|
|
355
|
-
class S {
|
|
356
|
-
constructor(e, t) {
|
|
357
|
-
this[w] = /* @__PURE__ */ new Map(), this._consentPlugin = null, e && t && (this._consentPlugin = this.buildConsentPlugin(e, t));
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
361
|
-
* by implementing the IAnalyticsPlugin and then adding it via this function. This will also hold only a single
|
|
362
|
-
* instance of a plugin with a given Tracking Identifier.
|
|
363
|
-
*
|
|
364
|
-
* @param plugin
|
|
365
|
-
*/
|
|
366
|
-
addEventPlugin(e) {
|
|
367
|
-
this[c].has(e.getUniquePluginIdentifier()) || (this[c].set(
|
|
368
|
-
e.getUniquePluginIdentifier(),
|
|
369
|
-
e
|
|
370
|
-
), e.setupPlugin());
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Send an Event to all plugins
|
|
374
|
-
*
|
|
375
|
-
* @param eventData
|
|
376
|
-
*/
|
|
377
|
-
sendEvent(e) {
|
|
378
|
-
this[c].forEach((t) => {
|
|
379
|
-
t.sendEvent(e, this._consentPlugin);
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Returns an IConsentPlugin if something is passed to it. Returns null if we can't find the plugin named.
|
|
384
|
-
* @param consentPluginName
|
|
385
|
-
* @param consentIdentifier
|
|
386
|
-
* @private
|
|
387
|
-
*/
|
|
388
|
-
buildConsentPlugin(e, t) {
|
|
389
|
-
return e.toLowerCase() === p.OneTrust.toLowerCase() ? new q(t) : null;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
export {
|
|
393
|
-
p as ConsentPluginNames,
|
|
394
|
-
S as EpigraphAnalytics,
|
|
395
|
-
I as GA3AnalyticsPlugin,
|
|
396
|
-
A as GA4AnalyticsPlugin,
|
|
397
|
-
L as NexusAnalyticsPlugin,
|
|
398
|
-
q as OneTrustConsentPlugin
|
|
399
|
-
};
|