@epigraph/epigraph-std-lib 4.0.2-alpha → 4.2.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.
Files changed (43) hide show
  1. package/dist/Epigraph/epigraph.cjs +1 -0
  2. package/dist/Epigraph/epigraph.d.ts +10 -3
  3. package/dist/Epigraph/epigraph.js +33 -20
  4. package/dist/Epigraph/epigraphBaseSolutions.cjs +1 -0
  5. package/dist/Epigraph/{epigraphBaseSolution.d.ts → epigraphBaseSolutions.d.ts} +1 -1
  6. package/dist/{lib/Epigraph/epigraphBaseSolution.js → Epigraph/epigraphBaseSolutions.js} +2 -2
  7. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.cjs +16 -0
  8. package/dist/EpigraphLibs/EpigraphAnalytics/epigraphAnalytics.js +354 -27
  9. package/dist/EpigraphLibs/EpigraphLogger/epigraphLogger.cjs +1 -0
  10. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.cjs +1 -0
  11. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.d.ts +34 -5
  12. package/dist/EpigraphLibs/EpigraphNexusApi/epigraphNexusApi.js +229 -64
  13. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.cjs +7 -0
  14. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.d.ts +2 -2
  15. package/dist/EpigraphLibs/EpigraphQrCodeGenerator/epigraphQrCodeGenerator.js +31 -22
  16. package/dist/EpigraphLibs/EpigraphResultFactory/epigraphResultFactory.cjs +1 -0
  17. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.cjs +1 -0
  18. package/dist/EpigraphLibs/EpigraphUnitsConverter/epigraphUnitsConverter.js +51 -30
  19. package/dist/EpigraphLibs/EpigraphUrlProcessor/epigraphUrlProcessor.cjs +1 -0
  20. package/dist/epigraph-std-lib.cjs +1 -0
  21. package/dist/epigraph-std-lib.d.ts +9 -1
  22. package/dist/epigraph-std-lib.js +40 -1
  23. package/dist/lit-element-C3moVMGu.js +524 -0
  24. package/dist/lit-element-CYaaFRfk.cjs +19 -0
  25. package/package.json +4 -35
  26. package/dist/EpigraphLibs/EpigraphAnalytics/types/index.d.ts +0 -7
  27. package/dist/lib/Epigraph/constants/enums.js +0 -4
  28. package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/consent-plugin-names.js +0 -4
  29. package/dist/lib/EpigraphLibs/EpigraphAnalytics/consent-plugins/one-trust-consent-plugin.js +0 -29
  30. package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/node.js +0 -22
  31. package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/queue.js +0 -23
  32. package/dist/lib/EpigraphLibs/EpigraphAnalytics/generics/single-linked-list.js +0 -30
  33. package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga3-analytics-plugin.js +0 -87
  34. package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/ga4-analytics-plugin.js +0 -121
  35. package/dist/lib/EpigraphLibs/EpigraphAnalytics/plugins/nexus-analytics-plugin.js +0 -45
  36. package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/conversions.js +0 -26
  37. package/dist/lib/EpigraphLibs/EpigraphUnitsConverter/enums.js +0 -5
  38. package/dist/node_modules/lit-html/async-directive.js +0 -67
  39. package/dist/node_modules/lit-html/directive-helpers.js +0 -10
  40. package/dist/node_modules/lit-html/directive.js +0 -27
  41. package/dist/node_modules/lit-html/directives/ref.js +0 -40
  42. package/dist/node_modules/lit-html/lit-html.js +0 -225
  43. package/dist/vite-env.d.ts +0 -1
@@ -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
- CONFIGURATOR = "experience/configurator/",
70
- CONFIGURATOR_LITE = "experience/configurator-lite/",
71
- EXPERIENCE = "experience/",
72
- SAVE = "save/"
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/"
@@ -1,5 +1,5 @@
1
- import { failureResult as p, successResult as u } from "../EpigraphResultFactory/epigraphResultFactory.js";
2
- class x {
1
+ import { failureResult as u, successResult as l } from "../EpigraphResultFactory/epigraphResultFactory.js";
2
+ class P {
3
3
  /**
4
4
  * Constructs a new instance of the class with the provided parameters.
5
5
  *
@@ -11,63 +11,228 @@ class x {
11
11
  * @param {NexusAPIVersions} [apiVersion=NexusAPIVersions.V1] - The API version to use, defaulting to version 1.
12
12
  * @return {void}
13
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;
14
+ constructor(i = "https://api.myepigraph.com/api/", t, e, r = "", s = "", a = "v1/") {
15
+ this.epigraphXPath = "", this.epigraphComponentVersion = r, this.epigraphSessionId = e, this.epigraphXPath = s, this.baseUrl = i + a, this.epgLocation = t;
16
16
  }
17
17
  /*******************************************************************************************************************
18
- * Configurator API Calls *
18
+ * Epigraph Button API Calls *
19
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(
20
+ async getButtonBySku(i, t = "") {
21
+ const e = {};
22
+ t !== "" && (e.version_id = t);
23
+ const r = `experience/button/sku/${i}`, s = this.buildNexusUrl(
24
+ r,
25
+ e
26
+ );
27
+ return await this.callNexusAPI(
24
28
  s,
25
- r
29
+ "GET"
30
+ /* GET */
31
+ );
32
+ }
33
+ async getButtonByShopifyVariantId(i, t = "") {
34
+ const e = {};
35
+ t !== "" && (e.version_id = t);
36
+ const r = `experience/button/shopify_variant_id/${i}`, s = this.buildNexusUrl(
37
+ r,
38
+ e
26
39
  );
27
40
  return await this.callNexusAPI(
28
- n,
41
+ s,
29
42
  "GET"
30
43
  /* GET */
31
44
  );
32
45
  }
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(
46
+ async getButtonByUpc(i, t = "") {
47
+ const e = {};
48
+ t !== "" && (e.version_id = t);
49
+ const r = `experience/button/upc/${i}`, s = this.buildNexusUrl(
50
+ r,
51
+ e
52
+ );
53
+ return await this.callNexusAPI(
37
54
  s,
38
- r
55
+ "GET"
56
+ /* GET */
57
+ );
58
+ }
59
+ async getButtonByAsin(i, t = "") {
60
+ const e = {};
61
+ t !== "" && (e.version_id = t);
62
+ const r = `experience/button/asin/${i}`, s = this.buildNexusUrl(
63
+ r,
64
+ e
39
65
  );
40
66
  return await this.callNexusAPI(
41
- n,
67
+ s,
42
68
  "GET"
43
69
  /* GET */
44
70
  );
45
71
  }
46
72
  /*******************************************************************************************************************
47
- * ConfiguratorLite API Calls *
73
+ * Epigraph Viewer API Calls *
48
74
  ******************************************************************************************************************/
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(
75
+ async getViewerBySku(i, t = "") {
76
+ const e = {};
77
+ t !== "" && (e.version_id = t);
78
+ const r = `experience/viewer/sku/${i}`, s = this.buildNexusUrl(
79
+ r,
80
+ e
81
+ );
82
+ return await this.callNexusAPI(
53
83
  s,
54
- r
84
+ "GET"
85
+ /* GET */
86
+ );
87
+ }
88
+ async getViewerByShopifyVariantId(i, t = "") {
89
+ const e = {};
90
+ t !== "" && (e.version_id = t);
91
+ const r = `experience/viewer/shopify_variant_id/${i}`, s = this.buildNexusUrl(
92
+ r,
93
+ e
55
94
  );
56
95
  return await this.callNexusAPI(
57
- n,
96
+ s,
58
97
  "GET"
59
98
  /* GET */
60
99
  );
61
100
  }
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(
101
+ async getViewerByUpc(i, t = "") {
102
+ const e = {};
103
+ t !== "" && (e.version_id = t);
104
+ const r = `experience/viewer/upc/${i}`, s = this.buildNexusUrl(
105
+ r,
106
+ e
107
+ );
108
+ return await this.callNexusAPI(
66
109
  s,
67
- r
110
+ "GET"
111
+ /* GET */
112
+ );
113
+ }
114
+ async getViewerByAsin(i, t = "") {
115
+ const e = {};
116
+ t !== "" && (e.version_id = t);
117
+ const r = `experience/viewer/asin/${i}`, s = this.buildNexusUrl(
118
+ r,
119
+ e
68
120
  );
69
121
  return await this.callNexusAPI(
70
- n,
122
+ s,
123
+ "GET"
124
+ /* GET */
125
+ );
126
+ }
127
+ /*******************************************************************************************************************
128
+ * Epigraph Tour API Calls *
129
+ ******************************************************************************************************************/
130
+ async getTourBySku(i, t = "") {
131
+ const e = {};
132
+ t !== "" && (e.version_id = t);
133
+ const r = `experience/tour/sku/${i}`, s = this.buildNexusUrl(
134
+ r,
135
+ e
136
+ );
137
+ return await this.callNexusAPI(
138
+ s,
139
+ "GET"
140
+ /* GET */
141
+ );
142
+ }
143
+ async getTourByShopifyVariantId(i, t = "") {
144
+ const e = {};
145
+ t !== "" && (e.version_id = t);
146
+ const r = `experience/tour/shopify_variant_id/${i}`, s = this.buildNexusUrl(
147
+ r,
148
+ e
149
+ );
150
+ return await this.callNexusAPI(
151
+ s,
152
+ "GET"
153
+ /* GET */
154
+ );
155
+ }
156
+ async getTourByUpc(i, t = "") {
157
+ const e = {};
158
+ t !== "" && (e.version_id = t);
159
+ const r = `experience/tour/upc/${i}`, s = this.buildNexusUrl(
160
+ r,
161
+ e
162
+ );
163
+ return await this.callNexusAPI(
164
+ s,
165
+ "GET"
166
+ /* GET */
167
+ );
168
+ }
169
+ async getTourByAsin(i, t = "") {
170
+ const e = {};
171
+ t !== "" && (e.version_id = t);
172
+ const r = `experience/tour/asin/${i}`, s = this.buildNexusUrl(
173
+ r,
174
+ e
175
+ );
176
+ return await this.callNexusAPI(
177
+ s,
178
+ "GET"
179
+ /* GET */
180
+ );
181
+ }
182
+ /*******************************************************************************************************************
183
+ * Configurator API Calls *
184
+ ******************************************************************************************************************/
185
+ async getConfiguratorByExperienceId(i, t = "") {
186
+ const e = {};
187
+ t !== "" && (e.version_id = t);
188
+ const r = `experience/configurator/experience_id/${i}`, s = this.buildNexusUrl(
189
+ r,
190
+ e
191
+ );
192
+ return await this.callNexusAPI(
193
+ s,
194
+ "GET"
195
+ /* GET */
196
+ );
197
+ }
198
+ async getConfiguratorByClientAccessKey(i, t = "") {
199
+ const e = {};
200
+ t !== "" && (e.version_id = t);
201
+ const r = `experience/configurator/client_access_key/${i}`, s = this.buildNexusUrl(
202
+ r,
203
+ e
204
+ );
205
+ return await this.callNexusAPI(
206
+ s,
207
+ "GET"
208
+ /* GET */
209
+ );
210
+ }
211
+ /*******************************************************************************************************************
212
+ * ConfiguratorLite API Calls *
213
+ ******************************************************************************************************************/
214
+ async getConfiguratorLiteByExperienceId(i, t = "") {
215
+ const e = {};
216
+ t !== "" && (e.version_id = t);
217
+ const r = `experience/configurator-lite/experience_id/${i}`, s = this.buildNexusUrl(
218
+ r,
219
+ e
220
+ );
221
+ return await this.callNexusAPI(
222
+ s,
223
+ "GET"
224
+ /* GET */
225
+ );
226
+ }
227
+ async getConfiguratorLiteByProjectId(i, t = "") {
228
+ const e = {};
229
+ t !== "" && (e.version_id = t);
230
+ const r = `experience/configurator-lite/project_id/${i}`, s = this.buildNexusUrl(
231
+ r,
232
+ e
233
+ );
234
+ return await this.callNexusAPI(
235
+ s,
71
236
  "GET"
72
237
  /* GET */
73
238
  );
@@ -75,20 +240,20 @@ class x {
75
240
  /*******************************************************************************************************************
76
241
  * Save & Share Calls *
77
242
  ******************************************************************************************************************/
78
- async postExperienceSaveAndShare(e, i) {
79
- const r = "experience/" + e + "/save/", s = this.buildNexusUrl(
80
- r
81
- ), n = {
82
- save_data: JSON.stringify(i)
243
+ async postExperienceSaveAndShare(i, t) {
244
+ const e = `experience/${i}/save`, r = this.buildNexusUrl(
245
+ e
246
+ ), s = {
247
+ save_data: JSON.stringify(t)
83
248
  }, a = new Headers();
84
- return a.set("Content-Type", "application/json"), await this.callNexusAPI(s, "POST", JSON.stringify(n), a);
249
+ return a.set("Content-Type", "application/json"), await this.callNexusAPI(r, "POST", JSON.stringify(s), a);
85
250
  }
86
- async getExperienceSaveAndShare(e, i) {
87
- const r = "experience/" + e + "/save/" + i, s = this.buildNexusUrl(
88
- r
251
+ async getExperienceSaveAndShare(i, t) {
252
+ const e = `experience/${i}/save/${t}`, r = this.buildNexusUrl(
253
+ e
89
254
  );
90
255
  return await this.callNexusAPI(
91
- s,
256
+ r,
92
257
  "GET"
93
258
  /* GET */
94
259
  );
@@ -103,32 +268,32 @@ class x {
103
268
  * @param headers
104
269
  * @return {Promise<Result>} A promise that resolves with the API response, encapsulated in a success or failure result format.
105
270
  */
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
271
+ async callNexusAPI(i, t = "GET", e, r = new Headers()) {
272
+ r = this.addRequiredHeaders(r);
273
+ const s = {
274
+ method: t,
275
+ body: e,
276
+ headers: r
112
277
  };
113
278
  try {
114
- const a = await fetch(e, n), c = await a.json();
279
+ const a = await fetch(i, s), c = await a.json();
115
280
  if (!a.ok) {
116
281
  let o = "Unable to retrieve configurator experience";
117
282
  return c.message && (o = c.message), Promise.resolve(
118
- p(c, a.status, o)
283
+ u(c, a.status, o)
119
284
  );
120
285
  }
121
- return Promise.resolve(u(c, a.status));
286
+ return Promise.resolve(l(c, a.status));
122
287
  } catch {
123
- return Promise.resolve(p({}, 500, "Unknown error"));
288
+ return Promise.resolve(u({}, 500, "Unknown error"));
124
289
  }
125
290
  }
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;
291
+ buildNexusUrl(i, t = {}) {
292
+ let e = new URL(this.baseUrl);
293
+ e.pathname += i;
294
+ for (const [r, s] of Object.entries(t))
295
+ e.searchParams.set(r, s);
296
+ return e;
132
297
  }
133
298
  /**
134
299
  * Adds required headers to the provided headers object if they are not already present.
@@ -138,16 +303,16 @@ class x {
138
303
  * @param {Headers} headers - The headers object to which the required headers will be added.
139
304
  * @return {Headers} The updated headers object containing all required headers.
140
305
  */
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;
306
+ addRequiredHeaders(i) {
307
+ 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;
143
308
  }
144
309
  }
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 || {});
310
+ var p = /* @__PURE__ */ ((n) => (n.PRODUCTION = "https://api.myepigraph.com/api/", n.STAGING = "https://nexus.epigraph.dev/api/", n.LOCAL = "https://nexus.test/api/", n))(p || {}), h = /* @__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))(h || {}), y = /* @__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))(y || {}), x = /* @__PURE__ */ ((n) => (n.V1 = "v1/", n))(x || {}), $ = /* @__PURE__ */ ((n) => (n.GET = "GET", n.POST = "POST", n.PUT = "PUT", n.DELETE = "DELETE", n))($ || {});
146
311
  export {
147
- x as EpigraphNexusAPI,
148
- P as HTTPMethod,
312
+ P as EpigraphNexusAPI,
313
+ $ as HTTPMethod,
149
314
  h as NexusAPIResourceIdentifier,
150
- E as NexusAPIRoutes,
151
- g as NexusAPIVersions,
152
- l as NexusEndpoints
315
+ y as NexusAPIRoutes,
316
+ x as NexusAPIVersions,
317
+ p as NexusEndpoints
153
318
  };
@@ -0,0 +1,7 @@
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;
@@ -1,10 +1,10 @@
1
1
  import { LitElement } from 'lit';
2
- import { Ref } from 'lit/directives/ref.js';
3
2
  import { default as QrCreator } from 'qr-creator';
4
3
  export declare class EpigraphQrCodeGenerator extends LitElement {
5
4
  static webComponentName: string;
6
- _qrCodeGenCanvasRef: Ref<HTMLCanvasElement>;
5
+ _qrCodeGenCanvasRef: HTMLCanvasElement;
7
6
  static styles: import('lit').CSSResult;
7
+ get qrCodeGenCanvasRef(): HTMLCanvasElement;
8
8
  /**
9
9
  * Converts any given data uri to a blob.
10
10
  *
@@ -1,31 +1,37 @@
1
- import { LitElement as s, css as i, html as l } from "lit";
2
- import { createRef as c, ref as m } from "../../node_modules/lit-html/directives/ref.js";
3
- import d from "qr-creator";
4
- class a extends s {
5
- constructor() {
6
- super(...arguments), this._qrCodeGenCanvasRef = c();
7
- }
1
+ import { i as d, a as l, x as C } from "../../lit-element-C3moVMGu.js";
2
+ import { query as p } from "lit/decorators.js";
3
+ import m from "qr-creator";
4
+ var f = Object.defineProperty, c = (i, t, e, n) => {
5
+ for (var r = void 0, a = i.length - 1, o; a >= 0; a--)
6
+ (o = i[a]) && (r = o(t, e, r) || r);
7
+ return r && f(t, e, r), r;
8
+ };
9
+ class s extends d {
8
10
  static {
9
11
  this.webComponentName = "epigraph-qr-code-generator";
10
12
  }
11
13
  static {
12
- this.styles = i`
14
+ this.styles = l`
13
15
  :host {
14
16
  display: none;
15
17
  }
16
18
  `;
17
19
  }
20
+ get qrCodeGenCanvasRef() {
21
+ return this._qrCodeGenCanvasRef;
22
+ }
18
23
  /**
19
24
  * Converts any given data uri to a blob.
20
25
  *
21
26
  * @param {string} dataUri Raw data URI, either fetched from an HTML Canvas or any other valid source.
22
27
  * @returns {Blob} The generate blob.
23
28
  */
24
- dataUritoBlob(e) {
25
- const t = atob(e.split(",")[1]), r = e.split(",")[0].split(":")[1].split(";")[0], o = [];
26
- for (let n = 0; n < t.length; n++)
27
- o.push(t.charCodeAt(n));
28
- return new Blob([new Uint8Array(o)], { type: r });
29
+ dataUritoBlob(t) {
30
+ const e = t.split(",");
31
+ if (e.length !== 2)
32
+ throw new Error("Invalid data URI format");
33
+ const n = e[0].split(":")[1].split(";")[0], r = atob(e[1]), a = new Uint8Array(Array.from(r, (o) => o.charCodeAt(0)));
34
+ return new Blob([a], { type: n });
29
35
  }
30
36
  /**
31
37
  * Generates a QR code as image data url for the qrCodeContent provided.
@@ -33,7 +39,7 @@ class a extends s {
33
39
  * @param {string} qrCodeContent The content to be embedded in the QR code.
34
40
  * @returns {string} Session data URL for the generated QR code.
35
41
  */
36
- generateQrCode(e = {
42
+ generateQrCode(t = {
37
43
  text: "www.epigraph.us",
38
44
  radius: 0.5,
39
45
  // 0.0 to 0.5
@@ -46,11 +52,11 @@ class a extends s {
46
52
  size: 256
47
53
  // in pixels
48
54
  }) {
49
- if (!this._qrCodeGenCanvasRef.value)
55
+ if (!this._qrCodeGenCanvasRef)
50
56
  return "";
51
- d.render(e, this._qrCodeGenCanvasRef.value);
52
- const t = this._qrCodeGenCanvasRef.value.toDataURL(), r = this.dataUritoBlob(t);
53
- return URL.createObjectURL(r);
57
+ m.render(t, this._qrCodeGenCanvasRef);
58
+ const e = this._qrCodeGenCanvasRef.toDataURL(), n = this.dataUritoBlob(e);
59
+ return URL.createObjectURL(n);
54
60
  }
55
61
  /**
56
62
  * Override for the LitElement's render method.
@@ -58,12 +64,15 @@ class a extends s {
58
64
  * @returns {html} HTML to be rendered by this component.
59
65
  */
60
66
  render() {
61
- return l`
62
- <canvas id="qrCode" ${m(this._qrCodeGenCanvasRef)}></canvas>
67
+ return C`
68
+ <canvas id="qrCodeCanvas"></canvas>
63
69
  `;
64
70
  }
65
71
  }
66
- window.customElements.get(a.webComponentName) === void 0 && window.customElements.define(a.webComponentName, a);
72
+ c([
73
+ p("#qrCodeCanvas")
74
+ ], s.prototype, "_qrCodeGenCanvasRef");
75
+ window.customElements.get(s.webComponentName) === void 0 && window.customElements.define(s.webComponentName, s);
67
76
  export {
68
- a as EpigraphQrCodeGenerator
77
+ s as EpigraphQrCodeGenerator
69
78
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class u{constructor(s,t,r,a=""){this._success=s,this._payload=t,this._status=r,this._message=a}get success(){return this._success}get payload(){return this._payload}get status(){return this._status}get message(){return this._message}}function c(e,s,t=""){return new u(!0,e,s,t)}function l(e,s,t=""){return new u(!1,e,s,t)}exports.Result=u;exports.failureResult=l;exports.successResult=c;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var n=(r=>(r.RAW="raw",r.DISTANCE="distance",r.WEIGHT="weight",r))(n||{}),e=(r=>(r.millimeter="mm",r.centimeter="cm",r.decimeter="dm",r.meter="m",r.decameter="dam",r.hectometer="hm",r.kilometer="km",r.inch="in",r.foot="ft",r.yard="yd",r.mile="mi",r))(e||{});let t={};t[`${e.millimeter}-${e.meter}`]=.001;t[`${e.meter}-${e.millimeter}`]=1e3;t[`${e.centimeter}-${e.meter}`]=.01;t[`${e.meter}-${e.centimeter}`]=100;t[`${e.decimeter}-${e.meter}`]=.1;t[`${e.meter}-${e.decimeter}`]=10;t[`${e.meter}-${e.meter}`]=1;t[`${e.decameter}-${e.meter}`]=10;t[`${e.meter}-${e.decameter}`]=.1;t[`${e.hectometer}-${e.meter}`]=100;t[`${e.meter}-${e.hectometer}`]=.01;t[`${e.kilometer}-${e.meter}`]=1e3;t[`${e.meter}-${e.kilometer}`]=.001;t[`${e.inch}-${e.meter}`]=.0254;t[`${e.meter}-${e.inch}`]=39.3701;t[`${e.foot}-${e.meter}`]=.3048;t[`${e.meter}-${e.foot}`]=3.28084;t[`${e.yard}-${e.meter}`]=.9144;t[`${e.meter}-${e.yard}`]=1.09361;t[`${e.mile}-${e.meter}`]=1609.34;t[`${e.meter}-${e.mile}`]=621371e-9;class m{constructor(l,i){if(this._type=n.DISTANCE,this._rawValue=l,this._rawValueUnit=i,i!==e.meter){const u=m.convert(this._rawValue,i,e.meter);this._rawValue=u.value,this._rawValueUnit=u.valueUnit}}get type(){return this._type}static buildConvertedUnitResult(l,i){return{value:l,valueUnit:i,valueWithUnit:`${l.toFixed(2)}${i}`}}static convert(l,i,u){let a=l,o=u;if(i===u)return m.buildConvertedUnitResult(a,o);const $=t[`${i}-${u}`];return a=l*$,m.buildConvertedUnitResult(a,o)}get inMillimeters(){return m.convert(this._rawValue,this._rawValueUnit,e.millimeter)}get inCentimeters(){return m.convert(this._rawValue,this._rawValueUnit,e.centimeter)}get inDecimeters(){return m.convert(this._rawValue,this._rawValueUnit,e.decimeter)}get inMeters(){return m.convert(this._rawValue,this._rawValueUnit,e.meter)}get inDecameters(){return m.convert(this._rawValue,this._rawValueUnit,e.decameter)}get inHectometers(){return m.convert(this._rawValue,this._rawValueUnit,e.hectometer)}get inKilometers(){return m.convert(this._rawValue,this._rawValueUnit,e.kilometer)}get inInches(){return m.convert(this._rawValue,this._rawValueUnit,e.inch)}get inFeet(){return m.convert(this._rawValue,this._rawValueUnit,e.foot)}get inYard(){return m.convert(this._rawValue,this._rawValueUnit,e.yard)}get inMiles(){return m.convert(this._rawValue,this._rawValueUnit,e.mile)}}exports.Distance=m;exports.DistanceUnits=e;exports.UnitTypes=n;