@epigraph/epigraph-std-lib 4.1.0 → 4.3.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/README.md +68 -68
- package/dist/Epigraph/epigraph.cjs +1 -1
- package/dist/Epigraph/epigraph.d.ts +8 -0
- package/dist/Epigraph/epigraph.js +32 -16
- package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -1
- package/dist/Epigraph/epigraphBaseSolutions.js +1 -1
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +2 -2
- package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +24 -24
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -1
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.d.ts +34 -5
- package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +229 -64
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +4 -26
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.d.ts +2 -2
- package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +25 -356
- package/dist/lit-element-C3moVMGu.js +524 -0
- package/dist/lit-element-CYaaFRfk.cjs +19 -0
- package/package.json +41 -41
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
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../EpigraphLibs/EpigraphLogger/epigraphLogger.cjs"),p=require("../EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs");var
|
|
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;
|
|
@@ -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
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { EpigraphLogger as
|
|
2
|
-
import { EpigraphUrlProcessor as h, QUERY_PARAMETER_NAMES as
|
|
3
|
-
var
|
|
4
|
-
class
|
|
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 || {});
|
|
4
|
+
class g {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
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)
|
|
7
7
|
return window.epigraph.registerActiveComponent(e), window.epigraph;
|
|
8
|
-
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;
|
|
9
9
|
const t = this.getLoggerModeNameFromEnvironment();
|
|
10
|
-
this._logger.setCurrentMode(t), this._urlProcessor = new h(), this.id =
|
|
11
|
-
const n = this._urlProcessor.getParameterInUrl(
|
|
12
|
-
this._epigraphSessionId = n ??
|
|
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;
|
|
13
13
|
}
|
|
14
14
|
get isReady() {
|
|
15
15
|
return this._isReady;
|
|
@@ -35,12 +35,28 @@ class a {
|
|
|
35
35
|
get staleComponentsInSession() {
|
|
36
36
|
return this._staleComponentsInSession;
|
|
37
37
|
}
|
|
38
|
+
isSessionWebGL2Compatible() {
|
|
39
|
+
return this._isSessionWebGL2Compatible;
|
|
40
|
+
}
|
|
38
41
|
/**
|
|
39
42
|
* Logs Epigraph Branding in the console to help redirect potential interests in the right direction.
|
|
40
43
|
*/
|
|
41
44
|
logBranding() {
|
|
42
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();
|
|
43
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
|
+
}
|
|
44
60
|
/**
|
|
45
61
|
* Registers a new component that was initialized on this page.
|
|
46
62
|
* This is optional from the perspective of the initialization flow but highly recommend
|
|
@@ -70,8 +86,8 @@ class a {
|
|
|
70
86
|
* @returns {LoggerModeNames} A valid logger mode name.
|
|
71
87
|
*/
|
|
72
88
|
getLoggerModeNameFromEnvironment() {
|
|
73
|
-
let e =
|
|
74
|
-
return this._environment ===
|
|
89
|
+
let e = a.Dev;
|
|
90
|
+
return this._environment === s.STAGING ? e = a.Staging : this._environment === s.PRODUCTION && (e = a.Release), e;
|
|
75
91
|
}
|
|
76
92
|
/**
|
|
77
93
|
* Generates a random UUID using crypto.randomUUID with a fallback on custom generator,
|
|
@@ -97,15 +113,15 @@ class a {
|
|
|
97
113
|
static generateXPath(e) {
|
|
98
114
|
let t = "", n = e;
|
|
99
115
|
for (; n; ) {
|
|
100
|
-
let
|
|
116
|
+
let r = 1, o = n.previousSibling;
|
|
101
117
|
for (; o; )
|
|
102
|
-
o.nodeName === n.nodeName &&
|
|
103
|
-
t = `/${n.nodeName.toLowerCase() + (
|
|
118
|
+
o.nodeName === n.nodeName && r++, o = o.previousSibling;
|
|
119
|
+
t = `/${n.nodeName.toLowerCase() + (r > 1 ? `[${r}]` : "")}${t}`, n = n.parentNode;
|
|
104
120
|
}
|
|
105
121
|
return t;
|
|
106
122
|
}
|
|
107
123
|
}
|
|
108
124
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
125
|
+
s as ENVIRONMENT_TYPE,
|
|
126
|
+
g as Epigraph
|
|
111
127
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lit"),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.
|
|
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,4 +1,4 @@
|
|
|
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
|
|
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 l=Symbol("head");class q{constructor(){this[l]=null}set head(e){this[l]=e}get head(){return this[l]}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 h{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 h,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 h,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){window.epgDataLayerName=e,typeof window.gtag!="function"&&(window.gtag=function(){window[window.epgDataLayerName].push(arguments)},window.gtag("js",new Date),window.gtag("config",t,{send_page_view:!1}))}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 r=await this.sendGA4LongParameters(s);s={send_to:this.trackingID,event_action:n.action,event_category:n.category,event_label:n.label,epg_event_tag:r}}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 a=await s.json();return a&&a.id?a.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 a=new URL(s,location.href),r=Object.fromEntries(a.searchParams.entries());return{fullSrc:a.href,id:r.id||void 0,l:r.l||void 0}}}return null}}class L{constructor(e,t,n,s,a=!1){this.sessionId=t,this.xPath=n,this.name=this.pluginName="NEXUS-PLUGIN",this.trackingID=e,this.verboseLogging=s,this.queue=new h,this.url=a?"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 w{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
2
|
* @license
|
|
3
3
|
* Copyright (c) 2023 Epigraph LLC. All Rights Reserved.
|
|
4
4
|
*
|
|
@@ -13,4 +13,4 @@
|
|
|
13
13
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
|
-
*/var
|
|
16
|
+
*/var v;const c=Symbol("analyticsPluginsMap");v=c;class S{constructor(e,t){this[v]=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 w(t):null}}exports.ConsentPluginNames=d;exports.EpigraphAnalytics=S;exports.GA3AnalyticsPlugin=A;exports.GA4AnalyticsPlugin=P;exports.NexusAnalyticsPlugin=L;exports.OneTrustConsentPlugin=w;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const d = Symbol("data"), u = Symbol("next"),
|
|
1
|
+
const d = Symbol("data"), u = Symbol("next"), v = class y {
|
|
2
2
|
constructor(e) {
|
|
3
3
|
this[d] = e, this[u] = null;
|
|
4
4
|
}
|
|
@@ -16,7 +16,7 @@ const d = Symbol("data"), u = Symbol("next"), w = class y {
|
|
|
16
16
|
return this[u];
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
|
-
let g =
|
|
19
|
+
let g = v;
|
|
20
20
|
const h = Symbol("head");
|
|
21
21
|
class m {
|
|
22
22
|
constructor() {
|
|
@@ -62,7 +62,7 @@ class l {
|
|
|
62
62
|
return this[o]--, e;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
class
|
|
65
|
+
class L {
|
|
66
66
|
constructor(e, t, n, s) {
|
|
67
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
68
|
}
|
|
@@ -145,7 +145,7 @@ class I {
|
|
|
145
145
|
}, 1e3);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
class
|
|
148
|
+
class I {
|
|
149
149
|
constructor(e, t) {
|
|
150
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
151
|
}
|
|
@@ -155,9 +155,9 @@ class A {
|
|
|
155
155
|
t && (this.dataLayerName = t, this.dataLayer = window[t]);
|
|
156
156
|
}
|
|
157
157
|
initGtag(e = "dataLayer", t) {
|
|
158
|
-
typeof window.gtag != "function" && (window.gtag = function() {
|
|
159
|
-
window[
|
|
160
|
-
});
|
|
158
|
+
window.epgDataLayerName = e, typeof window.gtag != "function" && (window.gtag = function() {
|
|
159
|
+
window[window.epgDataLayerName].push(arguments);
|
|
160
|
+
}, window.gtag("js", /* @__PURE__ */ new Date()), window.gtag("config", t, { send_page_view: !1 }));
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* This function will send an Event to GA3.
|
|
@@ -194,13 +194,13 @@ class A {
|
|
|
194
194
|
};
|
|
195
195
|
if ("parameters" in n && Object.assign(s, n.parameters), JSON.stringify(s).length > 459)
|
|
196
196
|
try {
|
|
197
|
-
let
|
|
197
|
+
let r = await this.sendGA4LongParameters(s);
|
|
198
198
|
s = {
|
|
199
199
|
send_to: this.trackingID,
|
|
200
200
|
event_action: n.action,
|
|
201
201
|
event_category: n.category,
|
|
202
202
|
event_label: n.label,
|
|
203
|
-
epg_event_tag:
|
|
203
|
+
epg_event_tag: r
|
|
204
204
|
};
|
|
205
205
|
} catch {
|
|
206
206
|
}
|
|
@@ -238,8 +238,8 @@ class A {
|
|
|
238
238
|
body: JSON.stringify(n)
|
|
239
239
|
});
|
|
240
240
|
if (s.ok) {
|
|
241
|
-
const
|
|
242
|
-
return
|
|
241
|
+
const a = await s.json();
|
|
242
|
+
return a && a.id ? a.id : "";
|
|
243
243
|
} else
|
|
244
244
|
return "";
|
|
245
245
|
} catch {
|
|
@@ -251,20 +251,20 @@ class A {
|
|
|
251
251
|
for (const n of t) {
|
|
252
252
|
const s = n.getAttribute("src");
|
|
253
253
|
if (s && s.includes(e)) {
|
|
254
|
-
const
|
|
254
|
+
const a = new URL(s, location.href), r = Object.fromEntries(a.searchParams.entries());
|
|
255
255
|
return {
|
|
256
|
-
fullSrc:
|
|
257
|
-
id:
|
|
258
|
-
l:
|
|
256
|
+
fullSrc: a.href,
|
|
257
|
+
id: r.id || void 0,
|
|
258
|
+
l: r.l || void 0
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
return null;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
class
|
|
266
|
-
constructor(e, t, n, s,
|
|
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 =
|
|
265
|
+
class A {
|
|
266
|
+
constructor(e, t, n, s, a = !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 = a ? "https://nexus.epigraph.dev/api/analytics/event" : "https://api.myepigraph.com/api/analytics/event";
|
|
268
268
|
}
|
|
269
269
|
async sendEvent(e, t) {
|
|
270
270
|
this.queue.enqueue(e);
|
|
@@ -346,12 +346,12 @@ var p = /* @__PURE__ */ ((i) => (i.OneTrust = "onetrust", i))(p || {});
|
|
|
346
346
|
* See the License for the specific language governing permissions and
|
|
347
347
|
* limitations under the License.
|
|
348
348
|
*/
|
|
349
|
-
var
|
|
349
|
+
var w;
|
|
350
350
|
const c = Symbol("analyticsPluginsMap");
|
|
351
|
-
|
|
351
|
+
w = c;
|
|
352
352
|
class S {
|
|
353
353
|
constructor(e, t) {
|
|
354
|
-
this[
|
|
354
|
+
this[w] = /* @__PURE__ */ new Map(), this._consentPlugin = null, e && t && (this._consentPlugin = this.buildConsentPlugin(e, t));
|
|
355
355
|
}
|
|
356
356
|
/**
|
|
357
357
|
* Epigraph Analytics uses plugins to send events to multiple trackers at a time. You can create a customer tracker
|
|
@@ -389,8 +389,8 @@ class S {
|
|
|
389
389
|
export {
|
|
390
390
|
p as ConsentPluginNames,
|
|
391
391
|
S as EpigraphAnalytics,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
L as GA3AnalyticsPlugin,
|
|
393
|
+
I as GA4AnalyticsPlugin,
|
|
394
|
+
A as NexusAnalyticsPlugin,
|
|
395
395
|
q as OneTrustConsentPlugin
|
|
396
396
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
|
@@ -17,6 +17,27 @@ export declare class EpigraphNexusAPI {
|
|
|
17
17
|
* @return {void}
|
|
18
18
|
*/
|
|
19
19
|
constructor(baseUrl: NexusEndpoints | undefined, epgLocation: string, epigraphSessionId: string, epigraphComponentVersion?: string, epigraphXPath?: string, apiVersion?: NexusAPIVersions);
|
|
20
|
+
/*******************************************************************************************************************
|
|
21
|
+
* Epigraph Button API Calls *
|
|
22
|
+
******************************************************************************************************************/
|
|
23
|
+
getButtonBySku(sku: string, versionId?: string): Promise<Result>;
|
|
24
|
+
getButtonByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
|
|
25
|
+
getButtonByUpc(upc: string, versionId?: string): Promise<Result>;
|
|
26
|
+
getButtonByAsin(asin: string, versionId?: string): Promise<Result>;
|
|
27
|
+
/*******************************************************************************************************************
|
|
28
|
+
* Epigraph Viewer API Calls *
|
|
29
|
+
******************************************************************************************************************/
|
|
30
|
+
getViewerBySku(sku: string, versionId?: string): Promise<Result>;
|
|
31
|
+
getViewerByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
|
|
32
|
+
getViewerByUpc(upc: string, versionId?: string): Promise<Result>;
|
|
33
|
+
getViewerByAsin(asin: string, versionId?: string): Promise<Result>;
|
|
34
|
+
/*******************************************************************************************************************
|
|
35
|
+
* Epigraph Tour API Calls *
|
|
36
|
+
******************************************************************************************************************/
|
|
37
|
+
getTourBySku(sku: string, versionId?: string): Promise<Result>;
|
|
38
|
+
getTourByShopifyVariantId(shopify_variant_id: string, versionId?: string): Promise<Result>;
|
|
39
|
+
getTourByUpc(upc: string, versionId?: string): Promise<Result>;
|
|
40
|
+
getTourByAsin(asin: string, versionId?: string): Promise<Result>;
|
|
20
41
|
/*******************************************************************************************************************
|
|
21
42
|
* Configurator API Calls *
|
|
22
43
|
******************************************************************************************************************/
|
|
@@ -63,13 +84,21 @@ export declare enum NexusEndpoints {
|
|
|
63
84
|
export declare enum NexusAPIResourceIdentifier {
|
|
64
85
|
CLIENT_ACCESS_KEY = "client_access_key",
|
|
65
86
|
EXPERIENCE_ID = "experience_id",
|
|
66
|
-
PROJECT_ID = "project_id"
|
|
87
|
+
PROJECT_ID = "project_id",
|
|
88
|
+
SKU = "sku",
|
|
89
|
+
SHOPIFY_VARIANT_ID = "shopify_variant_id",
|
|
90
|
+
UPC = "upc",
|
|
91
|
+
ASIN = "asin"
|
|
67
92
|
}
|
|
68
93
|
export declare enum NexusAPIRoutes {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
BUTTON = "experience/button",
|
|
95
|
+
VIEWER = "experience/viewer",
|
|
96
|
+
TOUR = "experience/tour",
|
|
97
|
+
CUSTOMIZER = "experience/customizer",
|
|
98
|
+
CONFIGURATOR = "experience/configurator",
|
|
99
|
+
CONFIGURATOR_LITE = "experience/configurator-lite",
|
|
100
|
+
EXPERIENCE = "experience",
|
|
101
|
+
SAVE = "save"
|
|
73
102
|
}
|
|
74
103
|
export declare enum NexusAPIVersions {
|
|
75
104
|
V1 = "v1/"
|