@epigraph/epigraph-std-lib 5.0.0-alpha.13 → 5.0.0-alpha.14

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.
Files changed (39) hide show
  1. package/README.md +68 -68
  2. package/dist/Epigraph/epigraph.cjs +1 -1
  3. package/dist/Epigraph/epigraph.js +126 -94
  4. package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -1
  5. package/dist/Epigraph/epigraphBaseSolutions.js +68 -60
  6. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +16 -1
  7. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.d.ts +2 -0
  8. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +1057 -2
  9. package/dist/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.d.ts +11 -6
  10. package/dist/EpigraphLibs/EpigraphAnalytics/plugins/nexus-solutions-analytics-plugin.d.ts +50 -0
  11. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -1
  12. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.js +198 -74
  13. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -1
  14. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +425 -197
  15. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +7 -1
  16. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +78 -2
  17. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -1
  18. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.js +26 -24
  19. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -1
  20. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +88 -2
  21. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -1
  22. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js +75 -44
  23. package/dist/enums-1vqWxJ0i.cjs +1 -0
  24. package/dist/enums-CvOTKyNu.js +5 -0
  25. package/dist/epigraph-std-lib.cjs +1 -1
  26. package/dist/epigraph-std-lib.js +74 -11
  27. package/dist/lit-element-C3moVMGu.js +524 -0
  28. package/dist/lit-element-CYaaFRfk.cjs +19 -0
  29. package/package.json +40 -40
  30. package/dist/enums-BSSe4NAs.js +0 -8
  31. package/dist/enums-PfFMiIoe.cjs +0 -1
  32. package/dist/epigraphAnalytics-CF9Czp8C.js +0 -722
  33. package/dist/epigraphAnalytics-H3EZRDUh.cjs +0 -1
  34. package/dist/epigraphQrCodeGenerator-BXUNL2XK.js +0 -54
  35. package/dist/epigraphQrCodeGenerator-F2eLrPC_.cjs +0 -7
  36. package/dist/epigraphUnitsConverter-CwpmWl7p.cjs +0 -1
  37. package/dist/epigraphUnitsConverter-DsX4Rmsp.js +0 -66
  38. package/dist/lit--5TUYSGn.js +0 -508
  39. package/dist/lit-DZtv4Pds.cjs +0 -2
package/README.md CHANGED
@@ -1,68 +1,68 @@
1
- # INTRODUCTION
2
-
3
- Epigraph Standard Library or epigraph-std-lib is a collection of standards that we follow across our solutions. The idea is to have a single source of truth across solutions while ensuring that the dependencies are always up to date with the industry standards.
4
-
5
- ### EPIGRAPH
6
- A global object that must only be initialized once per session and provides some common functionalities across solutions in that session.
7
-
8
- ### EPIGRAPH LIBRARY EXPORTS
9
-
10
- | Name | Description |
11
- |---|---|
12
- | EpigraphBaseSolutionHtmlElement | A base class intended to enforce some common functionalities across our solutions, built by extending the HTMLElement |
13
- | EpigraphBaseSolutionLitElement | A base class intended to enforce some common functionalities across our solutions, built by extending the LitElement |
14
- | EpigraphLogger | A logger class that provides a convenient way for logging info, warning or errors in any given session |
15
- | EpigraphQrCoreGenerator | A Utility class that allows the generation of a QR code from a give string input |
16
- | EpigraphUnitsConverter | |
17
- | EpigraphUrlProcessor | |
18
-
19
-
20
- # HOW TO:
21
-
22
- ### Add a new EpigraphLibrary:
23
- 1. Create a new directory under lib/EpigraphLibs/`<MyEpigraphLibrary>`
24
- 2. Create the module file/s. Ensure that the names of these files are in camelCase.
25
- 3. Write a test for this Library under tests/<MyEpigraphLibrary.test.ts>
26
- 4. Add the module that you wish to export as an entry in vite.config.ts > defineConfig > build > entry, similar to other entries in there. This will bundle the new module on build.
27
- 5. Go to package.json:
28
- - Add the new module entry under exports similar to other entries in that field.
29
- - Add the new module entry under typesVersions similar to other entries in that field.
30
-
31
- ### Use the library
32
- This library exports the module into submodules to allow for better tree shaking when bundling the final product. Here is how you can import the submodules individually.
33
-
34
- ```javascript
35
- // Epigraph Object
36
- import { Epigraph } from "@epigraph/epigraph-std-lib/dist/Epigraph/epigraph";
37
-
38
- // Epigraph libs
39
- import { EpigraphAnalytics } from "@epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphAnalytics";
40
-
41
- ```
42
-
43
- Exported Submodules:
44
- | Name | Description |
45
- |---|---|
46
- | @epigraph/epigraph-std-lib/dist/Epigraph/epigraph | A base class intended to enforce some common functionalities across our solutions, built by extending the HTMLElement |
47
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphAnalytics | An Analytics modules that exports handy ways to log analytics across our solutions |
48
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphLogger | A Logger modules that exports handy ways to log across our solutions |
49
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphNexusApi | A Nexus API modules that exports handy ways to interact with the Nexus API across our solutions |
50
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphQrCodeGenerator | A QR Code generator modules that exports handy ways to generate QR Codes across our solutions |
51
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphResultFactory | A Result Factory modules that exports handy ways to generate Result objects across our solutions |
52
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphUnitsConverter | A Utility class that allows conversion between different standard unit, including but not limited to Distance, Color, etc. |
53
- | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphUrlProcessor | A Utility class that provides various methods to generate, process, manipulate URLs |
54
-
55
-
56
- ### Write a test:
57
- We use [vitest](https://vitest.dev/guide/) to write tests in this repository using [happy-dom](https://www.npmjs.com/package/happy-dom) to support some but not all browser functionalities. In order to write a new test:
58
-
59
- 1. Create a new file for a specific test under tests/ as `<MyEpigraphLibrary>`.test.ts
60
- 2. Write a test following the instructions and samples [here](https://vitest.dev/guide/#writing-tests)
61
- 3. Make sure to import the library from "../dist/epigraph-std-lib" to avoid any issues that might come up after bundling.
62
- 4. Open a terminal and execute "npm run test". This will build all the libraries under dist/ and then run tests using those.
63
-
64
-
65
- # REFERENCES
66
- A huge thanks to everyone who inspired the setup for this repository:
67
- 1. [Andreas Riedmuller's Article](https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma)
68
- 2. [Vitest Docs](https://vitest.dev/guide/)
1
+ # INTRODUCTION
2
+
3
+ Epigraph Standard Library or epigraph-std-lib is a collection of standards that we follow across our solutions. The idea is to have a single source of truth across solutions while ensuring that the dependencies are always up to date with the industry standards.
4
+
5
+ ### EPIGRAPH
6
+ A global object that must only be initialized once per session and provides some common functionalities across solutions in that session.
7
+
8
+ ### EPIGRAPH LIBRARY EXPORTS
9
+
10
+ | Name | Description |
11
+ |---|---|
12
+ | EpigraphBaseSolutionHtmlElement | A base class intended to enforce some common functionalities across our solutions, built by extending the HTMLElement |
13
+ | EpigraphBaseSolutionLitElement | A base class intended to enforce some common functionalities across our solutions, built by extending the LitElement |
14
+ | EpigraphLogger | A logger class that provides a convenient way for logging info, warning or errors in any given session |
15
+ | EpigraphQrCoreGenerator | A Utility class that allows the generation of a QR code from a give string input |
16
+ | EpigraphUnitsConverter | |
17
+ | EpigraphUrlProcessor | |
18
+
19
+
20
+ # HOW TO:
21
+
22
+ ### Add a new EpigraphLibrary:
23
+ 1. Create a new directory under lib/EpigraphLibs/`<MyEpigraphLibrary>`
24
+ 2. Create the module file/s. Ensure that the names of these files are in camelCase.
25
+ 3. Write a test for this Library under tests/<MyEpigraphLibrary.test.ts>
26
+ 4. Add the module that you wish to export as an entry in vite.config.ts > defineConfig > build > entry, similar to other entries in there. This will bundle the new module on build.
27
+ 5. Go to package.json:
28
+ - Add the new module entry under exports similar to other entries in that field.
29
+ - Add the new module entry under typesVersions similar to other entries in that field.
30
+
31
+ ### Use the library
32
+ This library exports the module into submodules to allow for better tree shaking when bundling the final product. Here is how you can import the submodules individually.
33
+
34
+ ```javascript
35
+ // Epigraph Object
36
+ import { Epigraph } from "@epigraph/epigraph-std-lib/dist/Epigraph/epigraph";
37
+
38
+ // Epigraph libs
39
+ import { EpigraphAnalytics } from "@epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphAnalytics";
40
+
41
+ ```
42
+
43
+ Exported Submodules:
44
+ | Name | Description |
45
+ |---|---|
46
+ | @epigraph/epigraph-std-lib/dist/Epigraph/epigraph | A base class intended to enforce some common functionalities across our solutions, built by extending the HTMLElement |
47
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphAnalytics | An Analytics modules that exports handy ways to log analytics across our solutions |
48
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphLogger | A Logger modules that exports handy ways to log across our solutions |
49
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphNexusApi | A Nexus API modules that exports handy ways to interact with the Nexus API across our solutions |
50
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphQrCodeGenerator | A QR Code generator modules that exports handy ways to generate QR Codes across our solutions |
51
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphResultFactory | A Result Factory modules that exports handy ways to generate Result objects across our solutions |
52
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphUnitsConverter | A Utility class that allows conversion between different standard unit, including but not limited to Distance, Color, etc. |
53
+ | @epigraph/epigraph-std-lib/dist/EpigraphLibs/epigraphUrlProcessor | A Utility class that provides various methods to generate, process, manipulate URLs |
54
+
55
+
56
+ ### Write a test:
57
+ We use [vitest](https://vitest.dev/guide/) to write tests in this repository using [happy-dom](https://www.npmjs.com/package/happy-dom) to support some but not all browser functionalities. In order to write a new test:
58
+
59
+ 1. Create a new file for a specific test under tests/ as `<MyEpigraphLibrary>`.test.ts
60
+ 2. Write a test following the instructions and samples [here](https://vitest.dev/guide/#writing-tests)
61
+ 3. Make sure to import the library from "../dist/epigraph-std-lib" to avoid any issues that might come up after bundling.
62
+ 4. Open a terminal and execute "npm run test". This will build all the libraries under dist/ and then run tests using those.
63
+
64
+
65
+ # REFERENCES
66
+ A huge thanks to everyone who inspired the setup for this repository:
67
+ 1. [Andreas Riedmuller's Article](https://dev.to/receter/how-to-create-a-react-component-library-using-vites-library-mode-4lma)
68
+ 2. [Vitest Docs](https://vitest.dev/guide/)
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),t=require("../enums-PfFMiIoe.cjs"),n=require("../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs");var r=class r{constructor(i){if(this._loggerContext=`EPIGRAPH`,this._isReady=!1,this._logger=new e.EpigraphLogger(`EPIGRAPH LOGGER`),this._environment=t.t.DEVELOPMENT,this._activeComponentsInSession=new Map,this._staleComponentsInSession=new Map,this._isSessionWebGL2Compatible=!1,window.epigraph)return window.epigraph.registerActiveComponent(i),window.epigraph;this._isSessionWebGL2Compatible=this._checkIfWebGL2IsAvailable(),window.epigraph=this,window.epigraph.registerActiveComponent(i),this.logBranding(),this._initializer=i,this._environment=this._initializer.environment;let a=this.getLoggerModeNameFromEnvironment();this._logger.setCurrentMode(a),this._urlProcessor=new n.EpigraphUrlProcessor,this.id=r.safeGenerateUuid();let o=this._urlProcessor.getParameterInUrl(n.QUERY_PARAMETER_NAMES.epigraphSessionId);this._epigraphSessionId=o??r.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{let 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){let 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 n=e.LoggerModeNames.Dev;return this._environment===t.t.STAGING?n=e.LoggerModeNames.Staging:this._environment===t.t.PRODUCTION&&(n=e.LoggerModeNames.Release),n}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=``,n=e;for(;n;){let e=1,r=n.previousSibling;for(;r;)r.nodeName===n.nodeName&&e++,r=r.previousSibling;t=`/${n.nodeName.toLowerCase()+(e>1?`[${e}]`:``)}${t}`,n=n.parentNode}return t}};exports.ENVIRONMENT_TYPE=t.t,exports.Epigraph=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),s=require("../enums-1vqWxJ0i.cjs"),g=require("../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs");class o{constructor(e){if(this._loggerContext="EPIGRAPH",this._isReady=!1,this._logger=new r.EpigraphLogger("EPIGRAPH LOGGER"),this._environment=s.ENVIRONMENT_TYPE.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 g.EpigraphUrlProcessor,this.id=o.safeGenerateUuid();const i=this._urlProcessor.getParameterInUrl(g.QUERY_PARAMETER_NAMES.epigraphSessionId);this._epigraphSessionId=i??o.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=r.LoggerModeNames.Dev;return this._environment===s.ENVIRONMENT_TYPE.STAGING?e=r.LoggerModeNames.Staging:this._environment===s.ENVIRONMENT_TYPE.PRODUCTION&&(e=r.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 a=1,n=i.previousSibling;for(;n;)n.nodeName===i.nodeName&&a++,n=n.previousSibling;t=`/${i.nodeName.toLowerCase()+(a>1?`[${a}]`:"")}${t}`,i=i.parentNode}return t}}exports.ENVIRONMENT_TYPE=s.ENVIRONMENT_TYPE;exports.Epigraph=o;
@@ -1,95 +1,127 @@
1
- import { EpigraphLogger as e, LoggerModeNames as t } from "../EpigraphLibs/EpigraphLogger/epigraphLogger.js";
2
- import { t as n } from "../enums-BSSe4NAs.js";
3
- import { EpigraphUrlProcessor as r, QUERY_PARAMETER_NAMES as i } from "../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js";
4
- //#region lib/Epigraph/epigraph.ts
5
- var a = class a {
6
- constructor(t) {
7
- if (this._loggerContext = "EPIGRAPH", this._isReady = !1, this._logger = new e("EPIGRAPH LOGGER"), this._environment = n.DEVELOPMENT, this._activeComponentsInSession = /* @__PURE__ */ new Map(), this._staleComponentsInSession = /* @__PURE__ */ new Map(), this._isSessionWebGL2Compatible = !1, window.epigraph) return window.epigraph.registerActiveComponent(t), window.epigraph;
8
- this._isSessionWebGL2Compatible = this._checkIfWebGL2IsAvailable(), window.epigraph = this, window.epigraph.registerActiveComponent(t), this.logBranding(), this._initializer = t, this._environment = this._initializer.environment;
9
- let o = this.getLoggerModeNameFromEnvironment();
10
- this._logger.setCurrentMode(o), this._urlProcessor = new r(), this.id = a.safeGenerateUuid();
11
- let s = this._urlProcessor.getParameterInUrl(i.epigraphSessionId);
12
- this._epigraphSessionId = s ?? a.safeGenerateUuid(), this._logger.info({
13
- title: "Epigraph Object Ready!!",
14
- details: this,
15
- contextOverride: this._loggerContext
16
- }), this._isReady = !0;
17
- }
18
- get isReady() {
19
- return this._isReady;
20
- }
21
- get logger() {
22
- return this._logger;
23
- }
24
- get urlProcessor() {
25
- return this._urlProcessor;
26
- }
27
- get epigraphSessionId() {
28
- return this._epigraphSessionId;
29
- }
30
- get environment() {
31
- return this._environment;
32
- }
33
- get initializer() {
34
- return this._initializer;
35
- }
36
- get activeComponentsInSession() {
37
- return this._activeComponentsInSession;
38
- }
39
- get staleComponentsInSession() {
40
- return this._staleComponentsInSession;
41
- }
42
- isSessionWebGL2Compatible() {
43
- return this._isSessionWebGL2Compatible;
44
- }
45
- logBranding() {
46
- 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();
47
- }
48
- _checkIfWebGL2IsAvailable() {
49
- try {
50
- let e = document.createElement("canvas");
51
- return !!(window.WebGL2RenderingContext && e.getContext("webgl2"));
52
- } catch {
53
- return !1;
54
- }
55
- }
56
- registerActiveComponent(e) {
57
- this._activeComponentsInSession.set(e.uuid, e), this._logger.info({
58
- title: "Registered a new Active Component",
59
- details: e,
60
- contextOverride: this._loggerContext
61
- });
62
- }
63
- deregisterActiveComponent(e) {
64
- let t = this._activeComponentsInSession.get(e.uuid);
65
- t && (this._staleComponentsInSession.set(t.uuid, t), this._activeComponentsInSession.delete(t.uuid), this._logger.info({
66
- title: "Deregistered a new Active Component",
67
- details: e,
68
- contextOverride: this._loggerContext
69
- }));
70
- }
71
- getLoggerModeNameFromEnvironment() {
72
- let e = t.Dev;
73
- return this._environment === n.STAGING ? e = t.Staging : this._environment === n.PRODUCTION && (e = t.Release), e;
74
- }
75
- static safeGenerateUuid() {
76
- let e = "";
77
- try {
78
- e = crypto.randomUUID();
79
- } catch {
80
- console.error("crypto not available. Not generating a UUID");
81
- }
82
- return e;
83
- }
84
- static generateXPath(e) {
85
- let t = "", n = e;
86
- for (; n;) {
87
- let e = 1, r = n.previousSibling;
88
- for (; r;) r.nodeName === n.nodeName && e++, r = r.previousSibling;
89
- t = `/${n.nodeName.toLowerCase() + (e > 1 ? `[${e}]` : "")}${t}`, n = n.parentNode;
90
- }
91
- return t;
92
- }
1
+ import { EpigraphLogger as g, LoggerModeNames as s } from "../EpigraphLibs/EpigraphLogger/epigraphLogger.js";
2
+ import { E as r } from "../enums-CvOTKyNu.js";
3
+ import { EpigraphUrlProcessor as l, QUERY_PARAMETER_NAMES as h } from "../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.js";
4
+ class a {
5
+ constructor(e) {
6
+ if (this._loggerContext = "EPIGRAPH", this._isReady = !1, this._logger = new g("EPIGRAPH LOGGER"), this._environment = r.DEVELOPMENT, this._activeComponentsInSession = /* @__PURE__ */ new Map(), this._staleComponentsInSession = /* @__PURE__ */ new Map(), this._isSessionWebGL2Compatible = !1, window.epigraph)
7
+ return window.epigraph.registerActiveComponent(e), window.epigraph;
8
+ this._isSessionWebGL2Compatible = this._checkIfWebGL2IsAvailable(), window.epigraph = this, window.epigraph.registerActiveComponent(e), this.logBranding(), this._initializer = e, this._environment = this._initializer.environment;
9
+ const t = this.getLoggerModeNameFromEnvironment();
10
+ this._logger.setCurrentMode(t), this._urlProcessor = new l(), this.id = a.safeGenerateUuid();
11
+ const i = this._urlProcessor.getParameterInUrl(h.epigraphSessionId);
12
+ this._epigraphSessionId = i ?? a.safeGenerateUuid(), this._logger.info({ title: "Epigraph Object Ready!!", details: this, contextOverride: this._loggerContext }), this._isReady = !0;
13
+ }
14
+ get isReady() {
15
+ return this._isReady;
16
+ }
17
+ get logger() {
18
+ return this._logger;
19
+ }
20
+ get urlProcessor() {
21
+ return this._urlProcessor;
22
+ }
23
+ get epigraphSessionId() {
24
+ return this._epigraphSessionId;
25
+ }
26
+ get environment() {
27
+ return this._environment;
28
+ }
29
+ get initializer() {
30
+ return this._initializer;
31
+ }
32
+ get activeComponentsInSession() {
33
+ return this._activeComponentsInSession;
34
+ }
35
+ get staleComponentsInSession() {
36
+ return this._staleComponentsInSession;
37
+ }
38
+ isSessionWebGL2Compatible() {
39
+ return this._isSessionWebGL2Compatible;
40
+ }
41
+ /**
42
+ * Logs Epigraph Branding in the console to help redirect potential interests in the right direction.
43
+ */
44
+ logBranding() {
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();
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
+ }
60
+ /**
61
+ * Registers a new component that was initialized on this page.
62
+ * This is optional from the perspective of the initialization flow but highly recommend
63
+ * registering any component that gets initialized in this session.
64
+ * Any component that inherits from EpigraphBaseSolution should automatically register itself on initialization.
65
+ *
66
+ * @param {EpigraphBaseSolutionTypes} solutionRef A type of Epigraph base component that is initialized in the session.
67
+ */
68
+ registerActiveComponent(e) {
69
+ this._activeComponentsInSession.set(e.uuid, e), this._logger.info({ title: "Registered a new Active Component", details: e, contextOverride: this._loggerContext });
70
+ }
71
+ /**
72
+ * De-Registers a component that was initialized on this page.
73
+ * This is optional from the perspective of the unmount flow but highly recommend
74
+ * de-registering any component that gets removed in this session.
75
+ * Any component that inherits from EpigraphBaseSolution should automatically de-register itself on unmount.
76
+ *
77
+ * @param {EpigraphBaseSolutionTypes} solutionRef A type of Epigraph base component that is initialized in the session.
78
+ */
79
+ deregisterActiveComponent(e) {
80
+ const t = this._activeComponentsInSession.get(e.uuid);
81
+ 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 }));
82
+ }
83
+ /**
84
+ * Gets the mode that the logger should be executed in, based on the runtime environment.
85
+ *
86
+ * @returns {LoggerModeNames} A valid logger mode name.
87
+ */
88
+ getLoggerModeNameFromEnvironment() {
89
+ let e = s.Dev;
90
+ return this._environment === r.STAGING ? e = s.Staging : this._environment === r.PRODUCTION && (e = s.Release), e;
91
+ }
92
+ /**
93
+ * Generates a random UUID using crypto.randomUUID with a fallback on custom generator,
94
+ * if the first option fails for any reason in an environment.1
95
+ *
96
+ * @returns {string} A random generated ID.
97
+ */
98
+ static safeGenerateUuid() {
99
+ let e = "";
100
+ try {
101
+ e = crypto.randomUUID();
102
+ } catch {
103
+ console.error("crypto not available. Not generating a UUID");
104
+ }
105
+ return e;
106
+ }
107
+ /**
108
+ * Generates an XPath based on a DOM nodes location on the page.
109
+ *
110
+ * @param {HTMLElement} element The element that we need the XPath for.
111
+ * @returns {string} The generated XPath.
112
+ */
113
+ static generateXPath(e) {
114
+ let t = "", i = e;
115
+ for (; i; ) {
116
+ let o = 1, n = i.previousSibling;
117
+ for (; n; )
118
+ n.nodeName === i.nodeName && o++, n = n.previousSibling;
119
+ t = `/${i.nodeName.toLowerCase() + (o > 1 ? `[${o}]` : "")}${t}`, i = i.parentNode;
120
+ }
121
+ return t;
122
+ }
123
+ }
124
+ export {
125
+ r as ENVIRONMENT_TYPE,
126
+ a as Epigraph
93
127
  };
94
- //#endregion
95
- export { n as ENVIRONMENT_TYPE, a as Epigraph };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./epigraph.cjs"),t=require("../lit-DZtv4Pds.cjs");var n=class extends HTMLElement{constructor(t,n){super(),this._isReady=!1,this._elementName=`epigraph-base-solution-html`,this._solutionVersion=``,this._loggerContextOverride=`[EPIGRAPH BASE SOLUTION]`,this.attachShadow({mode:`open`}),this.__environment=n,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)}},r=class extends t.t{constructor(t,n){super(),this._isReady=!1,this._elementName=`epigraph-base-solution-lit`,this._solutionVersion=``,this._loggerContextOverride=`[EPIGRAPH BASE SOLUTION]`,this._environment=n,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=n,exports.EpigraphBaseSolutionLitElement=r;
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,62 +1,70 @@
1
+ import { i as s } from "../lit-element-C3moVMGu.js";
1
2
  import { Epigraph as e } from "./epigraph.js";
2
- import { t } from "../lit--5TUYSGn.js";
3
- //#region lib/Epigraph/epigraphBaseSolutions.ts
4
- var n = class extends HTMLElement {
5
- constructor(t, n) {
6
- super(), this._isReady = !1, this._elementName = "epigraph-base-solution-html", this._solutionVersion = "", this._loggerContextOverride = "[EPIGRAPH BASE SOLUTION]", this.attachShadow({ mode: "open" }), this.__environment = n, this._solutionVersion = t, this.__xPath = e.generateXPath(this), this.__uuid = e.safeGenerateUuid() ?? this.__xPath, new e(this), window.epigraph.logger.info({
7
- title: "Epigraph Base Solution Ready",
8
- contextOverride: this._loggerContextOverride
9
- });
10
- }
11
- get isReady() {
12
- return this._isReady;
13
- }
14
- get environment() {
15
- return this.__environment;
16
- }
17
- get elementName() {
18
- return this._elementName;
19
- }
20
- get solutionVersion() {
21
- return this._solutionVersion;
22
- }
23
- get uuid() {
24
- return this.__uuid;
25
- }
26
- get xPath() {
27
- return this.__xPath;
28
- }
29
- disconnectedCallback() {
30
- window.epigraph.deregisterActiveComponent(this);
31
- }
32
- }, r = class extends t {
33
- constructor(t, n) {
34
- super(), this._isReady = !1, this._elementName = "epigraph-base-solution-lit", this._solutionVersion = "", this._loggerContextOverride = "[EPIGRAPH BASE SOLUTION]", this._environment = n, this._solutionVersion = t, this._xPath = e.generateXPath(this), this._uuid = e.safeGenerateUuid() ?? this._xPath, new e(this), this._isReady = !0, window.epigraph.logger.info({
35
- title: "Epigraph Base Solution Ready",
36
- contextOverride: this._loggerContextOverride
37
- });
38
- }
39
- get isReady() {
40
- return this._isReady;
41
- }
42
- get environment() {
43
- return this._environment;
44
- }
45
- get elementName() {
46
- return this._elementName;
47
- }
48
- get solutionVersion() {
49
- return this._solutionVersion;
50
- }
51
- get uuid() {
52
- return this._uuid;
53
- }
54
- get xPath() {
55
- return this._xPath;
56
- }
57
- disconnectedCallback() {
58
- window.epigraph.deregisterActiveComponent(this);
59
- }
3
+ class h extends HTMLElement {
4
+ constructor(t, i) {
5
+ super(), this._isReady = !1, this._elementName = "epigraph-base-solution-html", this._solutionVersion = "", this._loggerContextOverride = "[EPIGRAPH BASE SOLUTION]", this.attachShadow({ mode: "open" }), this.__environment = i, this._solutionVersion = t, this.__xPath = e.generateXPath(this), this.__uuid = e.safeGenerateUuid() ?? this.__xPath, new e(this), window.epigraph.logger.info({
6
+ title: "Epigraph Base Solution Ready",
7
+ contextOverride: this._loggerContextOverride
8
+ });
9
+ }
10
+ get isReady() {
11
+ return this._isReady;
12
+ }
13
+ get environment() {
14
+ return this.__environment;
15
+ }
16
+ get elementName() {
17
+ return this._elementName;
18
+ }
19
+ /**
20
+ * This is the npm package version of this solution.
21
+ */
22
+ get solutionVersion() {
23
+ return this._solutionVersion;
24
+ }
25
+ get uuid() {
26
+ return this.__uuid;
27
+ }
28
+ get xPath() {
29
+ return this.__xPath;
30
+ }
31
+ disconnectedCallback() {
32
+ window.epigraph.deregisterActiveComponent(this);
33
+ }
34
+ }
35
+ class a extends s {
36
+ constructor(t, i) {
37
+ 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.generateXPath(this), this._uuid = e.safeGenerateUuid() ?? this._xPath, new e(this), this._isReady = !0, window.epigraph.logger.info({
38
+ title: "Epigraph Base Solution Ready",
39
+ contextOverride: this._loggerContextOverride
40
+ });
41
+ }
42
+ get isReady() {
43
+ return this._isReady;
44
+ }
45
+ get environment() {
46
+ return this._environment;
47
+ }
48
+ get elementName() {
49
+ return this._elementName;
50
+ }
51
+ /**
52
+ * This is the npm package version of this solution.
53
+ */
54
+ get solutionVersion() {
55
+ return this._solutionVersion;
56
+ }
57
+ get uuid() {
58
+ return this._uuid;
59
+ }
60
+ get xPath() {
61
+ return this._xPath;
62
+ }
63
+ disconnectedCallback() {
64
+ window.epigraph.deregisterActiveComponent(this);
65
+ }
66
+ }
67
+ export {
68
+ h as EpigraphBaseSolutionHtmlElement,
69
+ a as EpigraphBaseSolutionLitElement
60
70
  };
61
- //#endregion
62
- export { n as EpigraphBaseSolutionHtmlElement, r as EpigraphBaseSolutionLitElement };
@@ -1 +1,16 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../epigraphAnalytics-H3EZRDUh.cjs");exports.ACTION_PERFORMED=e.n,exports.BUTTON_TYPE=e.r,exports.CONTENT_TYPES=e.i,exports.CURRENCY=e.a,exports.ConsentPluginNames=e.F,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.R,exports.MODULE_FAILED_ERRORS=e.k,exports.NexusAnalyticsPlugin=e.L,exports.OneTrustConsentPlugin=e.I,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;
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;
@@ -2,6 +2,7 @@ import { IAnalyticsPlugin } from './analytics-plugin-interface';
2
2
  import { IAnalyticsEvent } from './analytics-event-interface';
3
3
  import { GA4AnalyticsPlugin } from './plugins/ga4-analytics-plugin';
4
4
  import { NexusAnalyticsPlugin } from './plugins/nexus-analytics-plugin';
5
+ import { NexusSolutionsAnalyticsPlugin } from './plugins/nexus-solutions-analytics-plugin';
5
6
  import { OneTrustConsentPlugin } from './consent-plugins/one-trust-consent-plugin';
6
7
  import { ConsentPluginNames } from './consent-plugins/consent-plugin-names';
7
8
  declare const $analyticsPluginsMap: unique symbol;
@@ -10,6 +11,7 @@ export type { IAnalyticsEvent };
10
11
  export * from './epigraphAnalyticsEventLibrary';
11
12
  export { GA4AnalyticsPlugin };
12
13
  export { NexusAnalyticsPlugin };
14
+ export { NexusSolutionsAnalyticsPlugin };
13
15
  export { OneTrustConsentPlugin };
14
16
  export { ConsentPluginNames };
15
17
  export declare class EpigraphAnalytics {