@epigraph/epigraph-std-lib 3.3.1-alpha → 4.0.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -6
- package/dist/Epigraph/epigraph.d.ts +2 -2
- package/dist/Epigraph/epigraph.js +178 -0
- package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.d.ts +3 -4
- package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.d.ts +1 -1
- package/dist/EpigraphLibs/epigraphAnalytics.js +399 -0
- package/dist/EpigraphLibs/epigraphLogger.js +199 -0
- package/dist/EpigraphLibs/epigraphNexusApi.js +153 -0
- package/dist/EpigraphLibs/epigraphQrCodeGenerator.js +938 -0
- package/dist/EpigraphLibs/epigraphResultFactory.js +28 -0
- package/dist/EpigraphLibs/epigraphUnitsConverter.js +88 -0
- package/dist/EpigraphLibs/epigraphUrlProcessor.js +76 -0
- package/dist/ThirdPartyLibs/modelViewer.d.ts +2 -0
- package/dist/ThirdPartyLibs/modelViewer.js +8608 -0
- package/dist/ThirdPartyLibs/{thirdPartyLibs.d.ts → threejs.d.ts} +0 -2
- package/dist/ThirdPartyLibs/threejs.js +800 -0
- package/dist/chunks/VerticalBlurShader.B0rdEBFu.js +26381 -0
- package/dist/epigraph-std-lib.d.ts +1 -3
- package/dist/epigraph-std-lib.js +0 -37462
- package/package.json +76 -11
- package/dist/EpigraphLibs/epigraphLibs.d.ts +0 -9
- /package/dist/EpigraphLibs/EpigraphAnalytics/{EpigraphAnalytics.d.ts → epigraphAnalytics.d.ts} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
var t = /* @__PURE__ */ ((l) => (l.Release = "release", l.Staging = "staging", l.Dev = "dev", l))(t || {}), c = /* @__PURE__ */ ((l) => (l.Info = "info", l.Warn = "warn", l.Error = "error", l))(c || {});
|
|
2
|
+
class a {
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} [context="EPIGRAPH-LOGGER"] Used to categorise each message within
|
|
5
|
+
* the console.
|
|
6
|
+
* @example,CORE, UI
|
|
7
|
+
*/
|
|
8
|
+
constructor(o) {
|
|
9
|
+
this.context = "EPIGRAPH-LOGGER", this._allModes = {
|
|
10
|
+
release: { name: "release", allows: [
|
|
11
|
+
"error"
|
|
12
|
+
/* Error */
|
|
13
|
+
] },
|
|
14
|
+
staging: {
|
|
15
|
+
name: "staging",
|
|
16
|
+
allows: [
|
|
17
|
+
"warn",
|
|
18
|
+
"error"
|
|
19
|
+
/* Error */
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
dev: {
|
|
23
|
+
name: "dev",
|
|
24
|
+
allows: [
|
|
25
|
+
"info",
|
|
26
|
+
"warn",
|
|
27
|
+
"error"
|
|
28
|
+
/* Error */
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}, this._currentMode = "release", o && (this.context = o.toLocaleUpperCase());
|
|
32
|
+
}
|
|
33
|
+
get modes() {
|
|
34
|
+
return this._allModes;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {LoggerModeNames} newValue Sets the logger mode of the current instance.
|
|
39
|
+
*/
|
|
40
|
+
setCurrentMode(o) {
|
|
41
|
+
if (!Object.keys(this._allModes).includes(o)) {
|
|
42
|
+
console.warn(`"${o}": is not a valid logger mode`);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this._currentMode = o;
|
|
46
|
+
}
|
|
47
|
+
_isLogTypeAllowedInCurrentMode(o) {
|
|
48
|
+
return this._allModes[this._currentMode].allows.includes(o);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A log type that doesn't necessarily need to be looked at by the end user.
|
|
52
|
+
* This can be any generic log that would be ignored in most logger modes except verbose.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} title A short title for this log.
|
|
55
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
56
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
57
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
58
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
59
|
+
* that was provided at the time of initialisation of this class.
|
|
60
|
+
*/
|
|
61
|
+
info({ title: o, details: n = "", contextOverride: e = void 0 }) {
|
|
62
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
63
|
+
"info"
|
|
64
|
+
/* Info */
|
|
65
|
+
))
|
|
66
|
+
return;
|
|
67
|
+
const r = e || this.context;
|
|
68
|
+
console.groupCollapsed(`[${r}]: ${o}`), console.log(n), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A warning log type that let's the user know that some action that could be dangerous was just
|
|
72
|
+
* performed and might need attention.
|
|
73
|
+
*
|
|
74
|
+
* @param {string} title A short title for this log.
|
|
75
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
76
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
77
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
78
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
79
|
+
* that was provided at the time of initialisation of this class.
|
|
80
|
+
*/
|
|
81
|
+
warn({ title: o, details: n = "", contextOverride: e = void 0 }) {
|
|
82
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
83
|
+
"warn"
|
|
84
|
+
/* Warn */
|
|
85
|
+
))
|
|
86
|
+
return;
|
|
87
|
+
const r = e || this.context;
|
|
88
|
+
console.groupCollapsed(`%c[${r}]: ${o}`, "color: orange;"), console.warn(n), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A critical error log type that let's the user know that some action that was unexpected and required immediate attention.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} title A short title for this log.
|
|
94
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
95
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
96
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
97
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
98
|
+
* that was provided at the time of initialisation of this class.
|
|
99
|
+
*/
|
|
100
|
+
error({ title: o, details: n = "", contextOverride: e = void 0 }) {
|
|
101
|
+
if (!this._isLogTypeAllowedInCurrentMode(
|
|
102
|
+
"error"
|
|
103
|
+
/* Error */
|
|
104
|
+
))
|
|
105
|
+
return;
|
|
106
|
+
const r = e || this.context;
|
|
107
|
+
console.groupCollapsed(`%c[${r}]: ${o}`, "color: red;"), console.error(n), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A table log type that can show an object in an organised manner within the console.
|
|
111
|
+
* This is primarily for the visual purposes and doesn't provide any additional functionality
|
|
112
|
+
* that other log types cannot provide.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} title A short title for this log.
|
|
115
|
+
* @param {any} details Any optional detail that would be shown if this log was expanded in the console.
|
|
116
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
117
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
118
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
119
|
+
* that was provided at the time of initialisation of this class.
|
|
120
|
+
* @param {LogTypes} logType A
|
|
121
|
+
*/
|
|
122
|
+
table({
|
|
123
|
+
title: o,
|
|
124
|
+
details: n = {},
|
|
125
|
+
contextOverride: e = void 0,
|
|
126
|
+
logType: r = "info"
|
|
127
|
+
/* Info */
|
|
128
|
+
}) {
|
|
129
|
+
if (!this._isLogTypeAllowedInCurrentMode(r))
|
|
130
|
+
return;
|
|
131
|
+
const s = e || this.context;
|
|
132
|
+
console.groupCollapsed(`[${s}]: ${o}`), console.table(n), console.groupCollapsed("Traceback..."), console.trace(), console.groupEnd(), console.groupEnd();
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Begins an expanded group with the browser's console window.
|
|
136
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
137
|
+
*
|
|
138
|
+
* @param {string} title A short title for this group.
|
|
139
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
140
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
141
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
142
|
+
* that was provided at the time of initialisation of this class.
|
|
143
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
144
|
+
* info but this parameter allows the user to override this.
|
|
145
|
+
* @returns {void}
|
|
146
|
+
*/
|
|
147
|
+
group({
|
|
148
|
+
title: o,
|
|
149
|
+
contextOverride: n = void 0,
|
|
150
|
+
logType: e = "info"
|
|
151
|
+
/* Info */
|
|
152
|
+
}) {
|
|
153
|
+
if (!this._isLogTypeAllowedInCurrentMode(e))
|
|
154
|
+
return;
|
|
155
|
+
const r = n || this.context;
|
|
156
|
+
console.group(`%c ${r} GROUP`, o);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Begins a collapsed group with the browser's console window.
|
|
160
|
+
* NOTE: Please remember to close this group once done using EpigraphLogger.groupEnd();
|
|
161
|
+
*
|
|
162
|
+
* @param {string} title A short title for this group.
|
|
163
|
+
* @param {string | undefined} contextOverride Allows the user to specify where this log
|
|
164
|
+
* was recorded from. For eg. Core and Ui can pass in different values for this
|
|
165
|
+
* paramater to make it easy to debug. If not provided, the default context would be used
|
|
166
|
+
* that was provided at the time of initialisation of this class.
|
|
167
|
+
* @param {LogTypes} logType A group can implictly of any log type, by default it is of type
|
|
168
|
+
* info but this parameter allows the user to override this.
|
|
169
|
+
* @returns {void}
|
|
170
|
+
*/
|
|
171
|
+
groupCollapsed({
|
|
172
|
+
title: o,
|
|
173
|
+
contextOverride: n = void 0,
|
|
174
|
+
logType: e = "info"
|
|
175
|
+
/* Info */
|
|
176
|
+
}) {
|
|
177
|
+
if (!this._isLogTypeAllowedInCurrentMode(e))
|
|
178
|
+
return;
|
|
179
|
+
const r = n || this.context;
|
|
180
|
+
console.groupCollapsed(`%c ${r} GROUP`, o);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Similar to the console.groupEnd(). Useful for ending either a group or
|
|
184
|
+
* groupCollapse that was initialised by this logger.
|
|
185
|
+
*
|
|
186
|
+
* @returns {void}
|
|
187
|
+
*/
|
|
188
|
+
groupEnd() {
|
|
189
|
+
this._isLogTypeAllowedInCurrentMode(
|
|
190
|
+
"info"
|
|
191
|
+
/* Info */
|
|
192
|
+
) && (console.log("----------------------------------"), console.groupEnd());
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
export {
|
|
196
|
+
a as EpigraphLogger,
|
|
197
|
+
c as LogTypes,
|
|
198
|
+
t as LoggerModeNames
|
|
199
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { failureResult as p, successResult as u } from "./epigraphResultFactory.js";
|
|
2
|
+
class x {
|
|
3
|
+
/**
|
|
4
|
+
* Constructs a new instance of the class with the provided parameters.
|
|
5
|
+
*
|
|
6
|
+
* @param {NexusEndpoints} [baseUrl=NexusEndpoints.PRODUCTION] - The base URL endpoint for the API, defaulting to the production environment.
|
|
7
|
+
* @param {string} epgLocation - The window.location.href associated with the epigraph data.
|
|
8
|
+
* @param {string} epigraphSessionId - The session identifier for the epigraph session.
|
|
9
|
+
* @param {string} epigraphComponentVersion - The version of the Epigraph Component(1.x.x or 1.2.1, etc.).
|
|
10
|
+
* @param {string} [epigraphXPath=""] - The XPath expression for epigraph data processing, defaults to an empty string.
|
|
11
|
+
* @param {NexusAPIVersions} [apiVersion=NexusAPIVersions.V1] - The API version to use, defaulting to version 1.
|
|
12
|
+
* @return {void}
|
|
13
|
+
*/
|
|
14
|
+
constructor(e = "https://api.myepigraph.com/api/", i, r, s = "", n = "", a = "v1/") {
|
|
15
|
+
this.epigraphXPath = "", this.epigraphComponentVersion = s, this.epigraphSessionId = r, this.epigraphXPath = n, this.baseUrl = e + a, this.epgLocation = i;
|
|
16
|
+
}
|
|
17
|
+
/*******************************************************************************************************************
|
|
18
|
+
* Configurator API Calls *
|
|
19
|
+
******************************************************************************************************************/
|
|
20
|
+
async getConfiguratorByExperienceId(e, i = "") {
|
|
21
|
+
const r = {};
|
|
22
|
+
i !== "" && (r.version_id = i);
|
|
23
|
+
const s = `experience/configurator/experience_id/${e}`, n = this.buildNexusUrl(
|
|
24
|
+
s,
|
|
25
|
+
r
|
|
26
|
+
);
|
|
27
|
+
return await this.callNexusAPI(
|
|
28
|
+
n,
|
|
29
|
+
"GET"
|
|
30
|
+
/* GET */
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
async getConfiguratorByClientAccessKey(e, i = "") {
|
|
34
|
+
const r = {};
|
|
35
|
+
i !== "" && (r.version_id = i);
|
|
36
|
+
const s = `experience/configurator/client_access_key/${e}`, n = this.buildNexusUrl(
|
|
37
|
+
s,
|
|
38
|
+
r
|
|
39
|
+
);
|
|
40
|
+
return await this.callNexusAPI(
|
|
41
|
+
n,
|
|
42
|
+
"GET"
|
|
43
|
+
/* GET */
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
/*******************************************************************************************************************
|
|
47
|
+
* ConfiguratorLite API Calls *
|
|
48
|
+
******************************************************************************************************************/
|
|
49
|
+
async getConfiguratorLiteByExperienceId(e, i = "") {
|
|
50
|
+
const r = {};
|
|
51
|
+
i !== "" && (r.version_id = i);
|
|
52
|
+
const s = `experience/configurator-lite/experience_id/${e}`, n = this.buildNexusUrl(
|
|
53
|
+
s,
|
|
54
|
+
r
|
|
55
|
+
);
|
|
56
|
+
return await this.callNexusAPI(
|
|
57
|
+
n,
|
|
58
|
+
"GET"
|
|
59
|
+
/* GET */
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
async getConfiguratorLiteByProjectId(e, i = "") {
|
|
63
|
+
const r = {};
|
|
64
|
+
i !== "" && (r.version_id = i);
|
|
65
|
+
const s = `experience/configurator-lite/project_id/${e}`, n = this.buildNexusUrl(
|
|
66
|
+
s,
|
|
67
|
+
r
|
|
68
|
+
);
|
|
69
|
+
return await this.callNexusAPI(
|
|
70
|
+
n,
|
|
71
|
+
"GET"
|
|
72
|
+
/* GET */
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
/*******************************************************************************************************************
|
|
76
|
+
* Save & Share Calls *
|
|
77
|
+
******************************************************************************************************************/
|
|
78
|
+
async postExperienceSaveAndShare(e, i) {
|
|
79
|
+
const r = "experience/" + e + "/save/", s = this.buildNexusUrl(
|
|
80
|
+
r
|
|
81
|
+
), n = {
|
|
82
|
+
save_data: JSON.stringify(i)
|
|
83
|
+
}, a = new Headers();
|
|
84
|
+
return a.set("Content-Type", "application/json"), await this.callNexusAPI(s, "POST", JSON.stringify(n), a);
|
|
85
|
+
}
|
|
86
|
+
async getExperienceSaveAndShare(e, i) {
|
|
87
|
+
const r = "experience/" + e + "/save/" + i, s = this.buildNexusUrl(
|
|
88
|
+
r
|
|
89
|
+
);
|
|
90
|
+
return await this.callNexusAPI(
|
|
91
|
+
s,
|
|
92
|
+
"GET"
|
|
93
|
+
/* GET */
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Makes a call to the Nexus API and ensures the response is returned in JSON format.
|
|
98
|
+
* Automatically appends the `application/json` accept header if not already provided.
|
|
99
|
+
*
|
|
100
|
+
* @param {URL} url - The URL of the Nexus API endpoint to call.
|
|
101
|
+
* @param method
|
|
102
|
+
* @param body
|
|
103
|
+
* @param headers
|
|
104
|
+
* @return {Promise<Result>} A promise that resolves with the API response, encapsulated in a success or failure result format.
|
|
105
|
+
*/
|
|
106
|
+
async callNexusAPI(e, i = "GET", r, s = new Headers()) {
|
|
107
|
+
s = this.addRequiredHeaders(s);
|
|
108
|
+
const n = {
|
|
109
|
+
method: i,
|
|
110
|
+
body: r,
|
|
111
|
+
headers: s
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
const a = await fetch(e, n), c = await a.json();
|
|
115
|
+
if (!a.ok) {
|
|
116
|
+
let o = "Unable to retrieve configurator experience";
|
|
117
|
+
return c.message && (o = c.message), Promise.resolve(
|
|
118
|
+
p(c, a.status, o)
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return Promise.resolve(u(c, a.status));
|
|
122
|
+
} catch {
|
|
123
|
+
return Promise.resolve(p({}, 500, "Unknown error"));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
buildNexusUrl(e, i = {}) {
|
|
127
|
+
let r = new URL(this.baseUrl);
|
|
128
|
+
r.pathname += e;
|
|
129
|
+
for (const [s, n] of Object.entries(i))
|
|
130
|
+
r.searchParams.set(s, n);
|
|
131
|
+
return r;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Adds required headers to the provided headers object if they are not already present.
|
|
135
|
+
* Ensures that the headers include "accept", "EPG-Location", "EPG-Session-ID",
|
|
136
|
+
* and "EPG-XPATH" with their respective values.
|
|
137
|
+
*
|
|
138
|
+
* @param {Headers} headers - The headers object to which the required headers will be added.
|
|
139
|
+
* @return {Headers} The updated headers object containing all required headers.
|
|
140
|
+
*/
|
|
141
|
+
addRequiredHeaders(e) {
|
|
142
|
+
return e.has("accept") || e.set("accept", "application/json"), e.has("EPG-Location") || e.set("EPG-location", this.epgLocation), e.has("EPG-Session-ID") || e.set("EPG-Session-ID", this.epigraphSessionId), e.has("EPG-XPATH") || e.set("EPG-XPATH", this.epigraphXPath), e.has("EPG-Version") || e.set("EPG-Version", this.epigraphComponentVersion), e;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
var l = /* @__PURE__ */ ((t) => (t.PRODUCTION = "https://api.myepigraph.com/api/", t.STAGING = "https://nexus.epigraph.dev/api/", t.LOCAL = "https://nexus.test/api/", t))(l || {}), h = /* @__PURE__ */ ((t) => (t.CLIENT_ACCESS_KEY = "client_access_key", t.EXPERIENCE_ID = "experience_id", t.PROJECT_ID = "project_id", t))(h || {}), E = /* @__PURE__ */ ((t) => (t.CONFIGURATOR = "experience/configurator/", t.CONFIGURATOR_LITE = "experience/configurator-lite/", t.EXPERIENCE = "experience/", t.SAVE = "save/", t))(E || {}), g = /* @__PURE__ */ ((t) => (t.V1 = "v1/", t))(g || {}), P = /* @__PURE__ */ ((t) => (t.GET = "GET", t.POST = "POST", t.PUT = "PUT", t.DELETE = "DELETE", t))(P || {});
|
|
146
|
+
export {
|
|
147
|
+
x as EpigraphNexusAPI,
|
|
148
|
+
P as HTTPMethod,
|
|
149
|
+
h as NexusAPIResourceIdentifier,
|
|
150
|
+
E as NexusAPIRoutes,
|
|
151
|
+
g as NexusAPIVersions,
|
|
152
|
+
l as NexusEndpoints
|
|
153
|
+
};
|