@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
@@ -1,197 +1,425 @@
1
- import { n as e } from "../../enums-BSSe4NAs.js";
2
- import { failureResult as t, successResult as n } from "../EpigraphResultFactory/epigraphResultFactory.js";
3
- //#region lib/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.ts
4
- var r = class {
5
- constructor(t = e.PRODUCTION, n, r, i = "", a = "", o = "v1/") {
6
- this.epigraphXPath = "", this.epigraphComponentVersion = i, this.epigraphSessionId = r, this.epigraphXPath = a, this.baseUrl = t + o, this.epgLocation = n;
7
- }
8
- async getButtonBySku(e, t = "") {
9
- let n = {};
10
- t !== "" && (n.version_id = t);
11
- let r = `experience/button/sku/${e}`, i = this.buildNexusUrl(r, n);
12
- return await this.callNexusAPI(i, "GET");
13
- }
14
- async getButtonByShopifyVariantId(e, t = "") {
15
- let n = {};
16
- t !== "" && (n.version_id = t);
17
- let r = `experience/button/shopify_variant_id/${e}`, i = this.buildNexusUrl(r, n);
18
- return await this.callNexusAPI(i, "GET");
19
- }
20
- async getButtonByUpc(e, t = "") {
21
- let n = {};
22
- t !== "" && (n.version_id = t);
23
- let r = `experience/button/upc/${e}`, i = this.buildNexusUrl(r, n);
24
- return await this.callNexusAPI(i, "GET");
25
- }
26
- async getButtonByAsin(e, t = "") {
27
- let n = {};
28
- t !== "" && (n.version_id = t);
29
- let r = `experience/button/asin/${e}`, i = this.buildNexusUrl(r, n);
30
- return await this.callNexusAPI(i, "GET");
31
- }
32
- async getButtonByUuid(e, t = "") {
33
- let n = {};
34
- t !== "" && (n.version_id = t);
35
- let r = `experience/button/uuid/${e}`, i = this.buildNexusUrl(r, n);
36
- return await this.callNexusAPI(i, "GET");
37
- }
38
- async getViewerBySku(e, t = "") {
39
- let n = {};
40
- t !== "" && (n.version_id = t);
41
- let r = `experience/viewer/sku/${e}`, i = this.buildNexusUrl(r, n);
42
- return await this.callNexusAPI(i, "GET");
43
- }
44
- async getViewerByShopifyVariantId(e, t = "") {
45
- let n = {};
46
- t !== "" && (n.version_id = t);
47
- let r = `experience/viewer/shopify_variant_id/${e}`, i = this.buildNexusUrl(r, n);
48
- return await this.callNexusAPI(i, "GET");
49
- }
50
- async getViewerByUpc(e, t = "") {
51
- let n = {};
52
- t !== "" && (n.version_id = t);
53
- let r = `experience/viewer/upc/${e}`, i = this.buildNexusUrl(r, n);
54
- return await this.callNexusAPI(i, "GET");
55
- }
56
- async getViewerByAsin(e, t = "") {
57
- let n = {};
58
- t !== "" && (n.version_id = t);
59
- let r = `experience/viewer/asin/${e}`, i = this.buildNexusUrl(r, n);
60
- return await this.callNexusAPI(i, "GET");
61
- }
62
- async getViewerByUuid(e, t = "") {
63
- let n = {};
64
- t !== "" && (n.version_id = t);
65
- let r = `experience/viewer/uuid/${e}`, i = this.buildNexusUrl(r, n);
66
- return await this.callNexusAPI(i, "GET");
67
- }
68
- async getTourBySku(e, t = "") {
69
- let n = {};
70
- t !== "" && (n.version_id = t);
71
- let r = `experience/tour/sku/${e}`, i = this.buildNexusUrl(r, n);
72
- return await this.callNexusAPI(i, "GET");
73
- }
74
- async getTourByShopifyVariantId(e, t = "") {
75
- let n = {};
76
- t !== "" && (n.version_id = t);
77
- let r = `experience/tour/shopify_variant_id/${e}`, i = this.buildNexusUrl(r, n);
78
- return await this.callNexusAPI(i, "GET");
79
- }
80
- async getTourByUpc(e, t = "") {
81
- let n = {};
82
- t !== "" && (n.version_id = t);
83
- let r = `experience/tour/upc/${e}`, i = this.buildNexusUrl(r, n);
84
- return await this.callNexusAPI(i, "GET");
85
- }
86
- async getTourByAsin(e, t = "") {
87
- let n = {};
88
- t !== "" && (n.version_id = t);
89
- let r = `experience/tour/asin/${e}`, i = this.buildNexusUrl(r, n);
90
- return await this.callNexusAPI(i, "GET");
91
- }
92
- async getTourByUuid(e, t = "") {
93
- let n = {};
94
- t !== "" && (n.version_id = t);
95
- let r = `experience/tour/uuid/${e}`, i = this.buildNexusUrl(r, n);
96
- return await this.callNexusAPI(i, "GET");
97
- }
98
- async getCustomizerBySku(e, t = "") {
99
- let n = {};
100
- t !== "" && (n.version_id = t);
101
- let r = `experience/customizer/sku/${e}`, i = this.buildNexusUrl(r, n);
102
- return await this.callNexusAPI(i, "GET");
103
- }
104
- async getCustomizerByShopifyVariantId(e, t = "") {
105
- let n = {};
106
- t !== "" && (n.version_id = t);
107
- let r = `experience/customizer/shopify_variant_id/${e}`, i = this.buildNexusUrl(r, n);
108
- return await this.callNexusAPI(i, "GET");
109
- }
110
- async getCustomizerByUpc(e, t = "") {
111
- let n = {};
112
- t !== "" && (n.version_id = t);
113
- let r = `experience/customizer/upc/${e}`, i = this.buildNexusUrl(r, n);
114
- return await this.callNexusAPI(i, "GET");
115
- }
116
- async getCustomizerByAsin(e, t = "") {
117
- let n = {};
118
- t !== "" && (n.version_id = t);
119
- let r = `experience/customizer/asin/${e}`, i = this.buildNexusUrl(r, n);
120
- return await this.callNexusAPI(i, "GET");
121
- }
122
- async getCustomizerByUuid(e, t = "") {
123
- let n = {};
124
- t !== "" && (n.version_id = t);
125
- let r = `experience/customizer/uuid/${e}`, i = this.buildNexusUrl(r, n);
126
- return await this.callNexusAPI(i, "GET");
127
- }
128
- async getConfiguratorByExperienceId(e, t = "") {
129
- let n = {};
130
- t !== "" && (n.version_id = t);
131
- let r = `experience/configurator/experience_id/${e}`, i = this.buildNexusUrl(r, n);
132
- return await this.callNexusAPI(i, "GET");
133
- }
134
- async getConfiguratorByClientAccessKey(e, t = "") {
135
- let n = {};
136
- t !== "" && (n.version_id = t);
137
- let r = `experience/configurator/client_access_key/${e}`, i = this.buildNexusUrl(r, n);
138
- return await this.callNexusAPI(i, "GET");
139
- }
140
- async getConfiguratorLiteByExperienceId(e, t = "") {
141
- let n = {};
142
- t !== "" && (n.version_id = t);
143
- let r = `experience/configurator-lite/experience_id/${e}`, i = this.buildNexusUrl(r, n);
144
- return await this.callNexusAPI(i, "GET");
145
- }
146
- async getConfiguratorLiteByProjectId(e, t = "") {
147
- let n = {};
148
- t !== "" && (n.version_id = t);
149
- let r = `experience/configurator-lite/project_id/${e}`, i = this.buildNexusUrl(r, n);
150
- return await this.callNexusAPI(i, "GET");
151
- }
152
- async postExperienceSaveAndShare(e, t) {
153
- let n = `experience/${e}/save`, r = this.buildNexusUrl(n), i = { save_data: JSON.stringify(t) }, a = new Headers();
154
- return a.set("Content-Type", "application/json"), await this.callNexusAPI(r, "POST", JSON.stringify(i), a);
155
- }
156
- async getExperienceSaveAndShare(e, t) {
157
- let n = `experience/${e}/save/${t}`, r = this.buildNexusUrl(n);
158
- return await this.callNexusAPI(r, "GET");
159
- }
160
- async callNexusAPI(e, r = "GET", i, a = new Headers()) {
161
- a = this.addRequiredHeaders(a);
162
- let o = {
163
- method: r,
164
- body: i,
165
- headers: a
166
- };
167
- try {
168
- let r = await fetch(e, o), i = await r.json();
169
- if (!r.ok) {
170
- let e = "Unable to retrieve configurator experience";
171
- return i.message && (e = i.message), Promise.resolve(t(i, r.status, e));
172
- }
173
- return Promise.resolve(n(i, r.status));
174
- } catch {
175
- return Promise.resolve(t({}, 500, "Unknown error"));
176
- }
177
- }
178
- buildNexusUrl(e, t = {}) {
179
- let n = new URL(this.baseUrl);
180
- n.pathname += e;
181
- for (let [e, r] of Object.entries(t)) n.searchParams.set(e, r);
182
- return n;
183
- }
184
- addRequiredHeaders(e) {
185
- 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;
186
- }
187
- }, i = /* @__PURE__ */ function(e) {
188
- return e.CLIENT_ACCESS_KEY = "client_access_key", e.EXPERIENCE_ID = "experience_id", e.PROJECT_ID = "project_id", e.SKU = "sku", e.SHOPIFY_VARIANT_ID = "shopify_variant_id", e.UPC = "upc", e.ASIN = "asin", e.UUID = "uuid", e;
189
- }({}), a = /* @__PURE__ */ function(e) {
190
- return e.BUTTON = "experience/button", e.VIEWER = "experience/viewer", e.TOUR = "experience/tour", e.CUSTOMIZER = "experience/customizer", e.CONFIGURATOR = "experience/configurator", e.CONFIGURATOR_LITE = "experience/configurator-lite", e.EXPERIENCE = "experience", e.SAVE = "save", e;
191
- }({}), o = /* @__PURE__ */ function(e) {
192
- return e.V1 = "v1/", e;
193
- }({}), s = /* @__PURE__ */ function(e) {
194
- return e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.DELETE = "DELETE", e;
195
- }({});
196
- //#endregion
197
- export { r as EpigraphNexusAPI, s as HTTPMethod, i as NexusAPIResourceIdentifier, a as NexusAPIRoutes, o as NexusAPIVersions };
1
+ import { N as l } from "../../enums-CvOTKyNu.js";
2
+ import { failureResult as o, successResult as p } from "../EpigraphResultFactory/epigraphResultFactory.js";
3
+ class P {
4
+ /**
5
+ * Constructs a new instance of the class with the provided parameters.
6
+ *
7
+ * @param {NexusEndpoints} [baseUrl=NexusEndpoints.PRODUCTION] - The base URL endpoint for the API, defaulting to the production environment.
8
+ * @param {string} epgLocation - The window.location.href associated with the epigraph data.
9
+ * @param {string} epigraphSessionId - The session identifier for the epigraph session.
10
+ * @param {string} epigraphComponentVersion - The version of the Epigraph Component(1.x.x or 1.2.1, etc.).
11
+ * @param {string} [epigraphXPath=""] - The XPath expression for epigraph data processing, defaults to an empty string.
12
+ * @param {NexusAPIVersions} [apiVersion=NexusAPIVersions.V1] - The API version to use, defaulting to version 1.
13
+ * @return {void}
14
+ */
15
+ constructor(i = l.PRODUCTION, t, e, r = "", s = "", a = "v1/") {
16
+ this.epigraphXPath = "", this.epigraphComponentVersion = r, this.epigraphSessionId = e, this.epigraphXPath = s, this.baseUrl = i + a, this.epgLocation = t;
17
+ }
18
+ /*******************************************************************************************************************
19
+ * Epigraph Button API Calls *
20
+ ******************************************************************************************************************/
21
+ async getButtonBySku(i, t = "") {
22
+ const e = {};
23
+ t !== "" && (e.version_id = t);
24
+ const r = `experience/button/sku/${i}`, s = this.buildNexusUrl(
25
+ r,
26
+ e
27
+ );
28
+ return await this.callNexusAPI(
29
+ s,
30
+ "GET"
31
+ /* GET */
32
+ );
33
+ }
34
+ async getButtonByShopifyVariantId(i, t = "") {
35
+ const e = {};
36
+ t !== "" && (e.version_id = t);
37
+ const r = `experience/button/shopify_variant_id/${i}`, s = this.buildNexusUrl(
38
+ r,
39
+ e
40
+ );
41
+ return await this.callNexusAPI(
42
+ s,
43
+ "GET"
44
+ /* GET */
45
+ );
46
+ }
47
+ async getButtonByUpc(i, t = "") {
48
+ const e = {};
49
+ t !== "" && (e.version_id = t);
50
+ const r = `experience/button/upc/${i}`, s = this.buildNexusUrl(
51
+ r,
52
+ e
53
+ );
54
+ return await this.callNexusAPI(
55
+ s,
56
+ "GET"
57
+ /* GET */
58
+ );
59
+ }
60
+ async getButtonByAsin(i, t = "") {
61
+ const e = {};
62
+ t !== "" && (e.version_id = t);
63
+ const r = `experience/button/asin/${i}`, s = this.buildNexusUrl(
64
+ r,
65
+ e
66
+ );
67
+ return await this.callNexusAPI(
68
+ s,
69
+ "GET"
70
+ /* GET */
71
+ );
72
+ }
73
+ async getButtonByUuid(i, t = "") {
74
+ const e = {};
75
+ t !== "" && (e.version_id = t);
76
+ const r = `experience/button/uuid/${i}`, s = this.buildNexusUrl(
77
+ r,
78
+ e
79
+ );
80
+ return await this.callNexusAPI(
81
+ s,
82
+ "GET"
83
+ /* GET */
84
+ );
85
+ }
86
+ /*******************************************************************************************************************
87
+ * Epigraph Viewer API Calls *
88
+ ******************************************************************************************************************/
89
+ async getViewerBySku(i, t = "") {
90
+ const e = {};
91
+ t !== "" && (e.version_id = t);
92
+ const r = `experience/viewer/sku/${i}`, s = this.buildNexusUrl(
93
+ r,
94
+ e
95
+ );
96
+ return await this.callNexusAPI(
97
+ s,
98
+ "GET"
99
+ /* GET */
100
+ );
101
+ }
102
+ async getViewerByShopifyVariantId(i, t = "") {
103
+ const e = {};
104
+ t !== "" && (e.version_id = t);
105
+ const r = `experience/viewer/shopify_variant_id/${i}`, s = this.buildNexusUrl(
106
+ r,
107
+ e
108
+ );
109
+ return await this.callNexusAPI(
110
+ s,
111
+ "GET"
112
+ /* GET */
113
+ );
114
+ }
115
+ async getViewerByUpc(i, t = "") {
116
+ const e = {};
117
+ t !== "" && (e.version_id = t);
118
+ const r = `experience/viewer/upc/${i}`, s = this.buildNexusUrl(
119
+ r,
120
+ e
121
+ );
122
+ return await this.callNexusAPI(
123
+ s,
124
+ "GET"
125
+ /* GET */
126
+ );
127
+ }
128
+ async getViewerByAsin(i, t = "") {
129
+ const e = {};
130
+ t !== "" && (e.version_id = t);
131
+ const r = `experience/viewer/asin/${i}`, s = this.buildNexusUrl(
132
+ r,
133
+ e
134
+ );
135
+ return await this.callNexusAPI(
136
+ s,
137
+ "GET"
138
+ /* GET */
139
+ );
140
+ }
141
+ async getViewerByUuid(i, t = "") {
142
+ const e = {};
143
+ t !== "" && (e.version_id = t);
144
+ const r = `experience/viewer/uuid/${i}`, s = this.buildNexusUrl(
145
+ r,
146
+ e
147
+ );
148
+ return await this.callNexusAPI(
149
+ s,
150
+ "GET"
151
+ /* GET */
152
+ );
153
+ }
154
+ /*******************************************************************************************************************
155
+ * Epigraph Tour API Calls *
156
+ ******************************************************************************************************************/
157
+ async getTourBySku(i, t = "") {
158
+ const e = {};
159
+ t !== "" && (e.version_id = t);
160
+ const r = `experience/tour/sku/${i}`, s = this.buildNexusUrl(
161
+ r,
162
+ e
163
+ );
164
+ return await this.callNexusAPI(
165
+ s,
166
+ "GET"
167
+ /* GET */
168
+ );
169
+ }
170
+ async getTourByShopifyVariantId(i, t = "") {
171
+ const e = {};
172
+ t !== "" && (e.version_id = t);
173
+ const r = `experience/tour/shopify_variant_id/${i}`, s = this.buildNexusUrl(
174
+ r,
175
+ e
176
+ );
177
+ return await this.callNexusAPI(
178
+ s,
179
+ "GET"
180
+ /* GET */
181
+ );
182
+ }
183
+ async getTourByUpc(i, t = "") {
184
+ const e = {};
185
+ t !== "" && (e.version_id = t);
186
+ const r = `experience/tour/upc/${i}`, s = this.buildNexusUrl(
187
+ r,
188
+ e
189
+ );
190
+ return await this.callNexusAPI(
191
+ s,
192
+ "GET"
193
+ /* GET */
194
+ );
195
+ }
196
+ async getTourByAsin(i, t = "") {
197
+ const e = {};
198
+ t !== "" && (e.version_id = t);
199
+ const r = `experience/tour/asin/${i}`, s = this.buildNexusUrl(
200
+ r,
201
+ e
202
+ );
203
+ return await this.callNexusAPI(
204
+ s,
205
+ "GET"
206
+ /* GET */
207
+ );
208
+ }
209
+ async getTourByUuid(i, t = "") {
210
+ const e = {};
211
+ t !== "" && (e.version_id = t);
212
+ const r = `experience/tour/uuid/${i}`, s = this.buildNexusUrl(
213
+ r,
214
+ e
215
+ );
216
+ return await this.callNexusAPI(
217
+ s,
218
+ "GET"
219
+ /* GET */
220
+ );
221
+ }
222
+ /*******************************************************************************************************************
223
+ * Epigraph Customizer API Calls *
224
+ ******************************************************************************************************************/
225
+ async getCustomizerBySku(i, t = "") {
226
+ const e = {};
227
+ t !== "" && (e.version_id = t);
228
+ const r = `experience/customizer/sku/${i}`, s = this.buildNexusUrl(
229
+ r,
230
+ e
231
+ );
232
+ return await this.callNexusAPI(
233
+ s,
234
+ "GET"
235
+ /* GET */
236
+ );
237
+ }
238
+ async getCustomizerByShopifyVariantId(i, t = "") {
239
+ const e = {};
240
+ t !== "" && (e.version_id = t);
241
+ const r = `experience/customizer/shopify_variant_id/${i}`, s = this.buildNexusUrl(
242
+ r,
243
+ e
244
+ );
245
+ return await this.callNexusAPI(
246
+ s,
247
+ "GET"
248
+ /* GET */
249
+ );
250
+ }
251
+ async getCustomizerByUpc(i, t = "") {
252
+ const e = {};
253
+ t !== "" && (e.version_id = t);
254
+ const r = `experience/customizer/upc/${i}`, s = this.buildNexusUrl(
255
+ r,
256
+ e
257
+ );
258
+ return await this.callNexusAPI(
259
+ s,
260
+ "GET"
261
+ /* GET */
262
+ );
263
+ }
264
+ async getCustomizerByAsin(i, t = "") {
265
+ const e = {};
266
+ t !== "" && (e.version_id = t);
267
+ const r = `experience/customizer/asin/${i}`, s = this.buildNexusUrl(
268
+ r,
269
+ e
270
+ );
271
+ return await this.callNexusAPI(
272
+ s,
273
+ "GET"
274
+ /* GET */
275
+ );
276
+ }
277
+ async getCustomizerByUuid(i, t = "") {
278
+ const e = {};
279
+ t !== "" && (e.version_id = t);
280
+ const r = `experience/customizer/uuid/${i}`, s = this.buildNexusUrl(
281
+ r,
282
+ e
283
+ );
284
+ return await this.callNexusAPI(
285
+ s,
286
+ "GET"
287
+ /* GET */
288
+ );
289
+ }
290
+ /*******************************************************************************************************************
291
+ * Configurator API Calls *
292
+ ******************************************************************************************************************/
293
+ async getConfiguratorByExperienceId(i, t = "") {
294
+ const e = {};
295
+ t !== "" && (e.version_id = t);
296
+ const r = `experience/configurator/experience_id/${i}`, s = this.buildNexusUrl(
297
+ r,
298
+ e
299
+ );
300
+ return await this.callNexusAPI(
301
+ s,
302
+ "GET"
303
+ /* GET */
304
+ );
305
+ }
306
+ async getConfiguratorByClientAccessKey(i, t = "") {
307
+ const e = {};
308
+ t !== "" && (e.version_id = t);
309
+ const r = `experience/configurator/client_access_key/${i}`, s = this.buildNexusUrl(
310
+ r,
311
+ e
312
+ );
313
+ return await this.callNexusAPI(
314
+ s,
315
+ "GET"
316
+ /* GET */
317
+ );
318
+ }
319
+ /*******************************************************************************************************************
320
+ * ConfiguratorLite API Calls *
321
+ ******************************************************************************************************************/
322
+ async getConfiguratorLiteByExperienceId(i, t = "") {
323
+ const e = {};
324
+ t !== "" && (e.version_id = t);
325
+ const r = `experience/configurator-lite/experience_id/${i}`, s = this.buildNexusUrl(
326
+ r,
327
+ e
328
+ );
329
+ return await this.callNexusAPI(
330
+ s,
331
+ "GET"
332
+ /* GET */
333
+ );
334
+ }
335
+ async getConfiguratorLiteByProjectId(i, t = "") {
336
+ const e = {};
337
+ t !== "" && (e.version_id = t);
338
+ const r = `experience/configurator-lite/project_id/${i}`, s = this.buildNexusUrl(
339
+ r,
340
+ e
341
+ );
342
+ return await this.callNexusAPI(
343
+ s,
344
+ "GET"
345
+ /* GET */
346
+ );
347
+ }
348
+ /*******************************************************************************************************************
349
+ * Save & Share Calls *
350
+ ******************************************************************************************************************/
351
+ async postExperienceSaveAndShare(i, t) {
352
+ const e = `experience/${i}/save`, r = this.buildNexusUrl(
353
+ e
354
+ ), s = {
355
+ save_data: JSON.stringify(t)
356
+ }, a = new Headers();
357
+ return a.set("Content-Type", "application/json"), await this.callNexusAPI(r, "POST", JSON.stringify(s), a);
358
+ }
359
+ async getExperienceSaveAndShare(i, t) {
360
+ const e = `experience/${i}/save/${t}`, r = this.buildNexusUrl(
361
+ e
362
+ );
363
+ return await this.callNexusAPI(
364
+ r,
365
+ "GET"
366
+ /* GET */
367
+ );
368
+ }
369
+ /**
370
+ * Makes a call to the Nexus API and ensures the response is returned in JSON format.
371
+ * Automatically appends the `application/json` accept header if not already provided.
372
+ *
373
+ * @param {URL} url - The URL of the Nexus API endpoint to call.
374
+ * @param method
375
+ * @param body
376
+ * @param headers
377
+ * @return {Promise<Result>} A promise that resolves with the API response, encapsulated in a success or failure result format.
378
+ */
379
+ async callNexusAPI(i, t = "GET", e, r = new Headers()) {
380
+ r = this.addRequiredHeaders(r);
381
+ const s = {
382
+ method: t,
383
+ body: e,
384
+ headers: r
385
+ };
386
+ try {
387
+ const a = await fetch(i, s), u = await a.json();
388
+ if (!a.ok) {
389
+ let c = "Unable to retrieve configurator experience";
390
+ return u.message && (c = u.message), Promise.resolve(
391
+ o(u, a.status, c)
392
+ );
393
+ }
394
+ return Promise.resolve(p(u, a.status));
395
+ } catch {
396
+ return Promise.resolve(o({}, 500, "Unknown error"));
397
+ }
398
+ }
399
+ buildNexusUrl(i, t = {}) {
400
+ let e = new URL(this.baseUrl);
401
+ e.pathname += i;
402
+ for (const [r, s] of Object.entries(t))
403
+ e.searchParams.set(r, s);
404
+ return e;
405
+ }
406
+ /**
407
+ * Adds required headers to the provided headers object if they are not already present.
408
+ * Ensures that the headers include "accept", "EPG-Location", "EPG-Session-ID",
409
+ * and "EPG-XPATH" with their respective values.
410
+ *
411
+ * @param {Headers} headers - The headers object to which the required headers will be added.
412
+ * @return {Headers} The updated headers object containing all required headers.
413
+ */
414
+ addRequiredHeaders(i) {
415
+ 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;
416
+ }
417
+ }
418
+ var y = /* @__PURE__ */ ((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.UUID = "uuid", n))(y || {}), x = /* @__PURE__ */ ((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))(x || {}), h = /* @__PURE__ */ ((n) => (n.V1 = "v1/", n))(h || {}), $ = /* @__PURE__ */ ((n) => (n.GET = "GET", n.POST = "POST", n.PUT = "PUT", n.DELETE = "DELETE", n))($ || {});
419
+ export {
420
+ P as EpigraphNexusAPI,
421
+ $ as HTTPMethod,
422
+ y as NexusAPIResourceIdentifier,
423
+ x as NexusAPIRoutes,
424
+ h as NexusAPIVersions
425
+ };
@@ -1 +1,7 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../epigraphQrCodeGenerator-F2eLrPC_.cjs");exports.EpigraphQrCodeGenerator=e.t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../lit-element-CYaaFRfk.cjs"),l=require("lit/decorators.js"),c=require("qr-creator");var C=Object.defineProperty,p=(i,t,e,o)=>{for(var r=void 0,n=i.length-1,s;n>=0;n--)(s=i[n])&&(r=s(t,e,r)||r);return r&&C(t,e,r),r};class a extends d.i{static{this.webComponentName="epigraph-qr-code-generator"}static{this.styles=d.i$1`
2
+ :host {
3
+ display: none;
4
+ }
5
+ `}get qrCodeGenCanvasRef(){return this._qrCodeGenCanvasRef}dataUritoBlob(t){const e=t.split(",");if(e.length!==2)throw new Error("Invalid data URI format");const o=e[0].split(":")[1].split(";")[0],r=atob(e[1]),n=new Uint8Array(Array.from(r,s=>s.charCodeAt(0)));return new Blob([n],{type:o})}generateQrCode(t={text:"www.epigraph.us",radius:.5,ecLevel:"H",fill:"black",background:null,size:256}){if(!this._qrCodeGenCanvasRef)return"";c.render(t,this._qrCodeGenCanvasRef);const e=this._qrCodeGenCanvasRef.toDataURL(),o=this.dataUritoBlob(e);return URL.createObjectURL(o)}render(){return d.x`
6
+ <canvas id="qrCodeCanvas"></canvas>
7
+ `}}p([l.query("#qrCodeCanvas")],a.prototype,"_qrCodeGenCanvasRef");window.customElements.get(a.webComponentName)===void 0&&window.customElements.define(a.webComponentName,a);exports.EpigraphQrCodeGenerator=a;