@epigraph/solutions 0.0.2-alpha → 0.0.5-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.
@@ -0,0 +1,439 @@
1
+ import { i as x, E as w, x as u, n as c, B as D, as as B, v as n, V as i, bv as I } from "./three.module-CYfxkCtM.js";
2
+ import { B as z, r as _ } from "./baseUiComponent-_PPHqnvV.js";
3
+ import { e as m, A as S, m as b } from "./AppHelpers-DdbyrHJf.js";
4
+ const y = "epg-dimension-label", g = {
5
+ label: {
6
+ name: "label",
7
+ defaultValue: "6.5"
8
+ },
9
+ unitSymbol: {
10
+ name: "unit-symbol",
11
+ defaultValue: "”"
12
+ }
13
+ };
14
+ var v = Object.defineProperty, f = (l, e, s, h) => {
15
+ for (var t = void 0, r = l.length - 1, o; r >= 0; r--)
16
+ (o = l[r]) && (t = o(e, s, t) || t);
17
+ return t && v(e, s, t), t;
18
+ };
19
+ class P extends z {
20
+ constructor() {
21
+ super(...arguments), this.label = g.label.defaultValue.toString(), this.unitSymbol = g.unitSymbol.defaultValue.toString();
22
+ }
23
+ static {
24
+ this.styles = [
25
+ super.styles,
26
+ x`
27
+ :host {
28
+ display: flex;
29
+ font-size: 16px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ border-radius: 6px;
33
+ user-select: none;
34
+ pointer-events: none;
35
+ width: fit-content;
36
+ transition: opacity 0.4s ease-in-out;
37
+ padding: 8px;
38
+ box-sizing: content-box;
39
+ }
40
+
41
+ :host([disabled]) {
42
+ opacity: 0;
43
+ display: flex;
44
+ }
45
+
46
+ :host([size="small"]) {
47
+ font-size: 16px;
48
+ }
49
+
50
+ :host([size="medium"]) {
51
+ font-size: 20px;
52
+ }
53
+
54
+ :host([size="large"]) {
55
+ font-size: 26px;
56
+ }
57
+
58
+ :host([theme="light"]) {
59
+ color: #333;
60
+ background: rgba(255, 255, 255, 0.5);
61
+ box-shadow: 0px 1px 4px 0px rgba(12, 12, 13, 0.1);
62
+ }
63
+
64
+ :host([theme="dark"]) {
65
+ background: rgba(12, 12, 13, 0.8);
66
+ box-shadow: 0px 1px 4px 0px rgba(12, 12, 13, 0.1);
67
+ color: #fff;
68
+ }
69
+ `
70
+ ];
71
+ }
72
+ render() {
73
+ return u`
74
+ <slot name="replace-all">
75
+ ${this.label ? u`<span class="label">${this.label}</span>` : w}
76
+ ${this.unitSymbol ? u`<span class="unit-symbol">${this.unitSymbol}</span>` : w}
77
+ </slot>
78
+
79
+ `;
80
+ }
81
+ }
82
+ f([
83
+ c({ attribute: g.label.name })
84
+ ], P.prototype, "label");
85
+ f([
86
+ c({ attribute: g.unitSymbol.name })
87
+ ], P.prototype, "unitSymbol");
88
+ window.customElements.get(y) || window.customElements.define(y, P);
89
+ var $ = Object.defineProperty, d = (l, e, s, h) => {
90
+ for (var t = void 0, r = l.length - 1, o; r >= 0; r--)
91
+ (o = l[r]) && (t = o(e, s, t) || t);
92
+ return t && $(e, s, t), t;
93
+ };
94
+ const a = class p extends D {
95
+ constructor() {
96
+ super(), this.enabled = !1, this.visualizeBounds = !1, this.dimensionsUnit = m.inch, this.dimensionsUnitSymbol = "", this._boundsVisualizer = void 0, this._currentSceneBounds = new B(), this._dimensionsIndicatorBoundsPadding = 0.08, this._cameraDirection = new n(), this._dimensionsInDisplayUnit = {
97
+ length: 0,
98
+ depth: 0,
99
+ height: 0
100
+ }, this._currentDimensionsState = {
101
+ length: {
102
+ begin: {
103
+ worldPos: new n(),
104
+ screenPos: new i()
105
+ },
106
+ end: {
107
+ worldPos: new n(),
108
+ screenPos: new i()
109
+ },
110
+ midPoint: {
111
+ worldPos: new n(),
112
+ screenPos: new i()
113
+ },
114
+ distance: 0
115
+ },
116
+ depth: {
117
+ begin: {
118
+ worldPos: new n(),
119
+ screenPos: new i()
120
+ },
121
+ end: {
122
+ worldPos: new n(),
123
+ screenPos: new i()
124
+ },
125
+ midPoint: {
126
+ worldPos: new n(),
127
+ screenPos: new i()
128
+ },
129
+ distance: 0
130
+ },
131
+ height: {
132
+ begin: {
133
+ worldPos: new n(),
134
+ screenPos: new i()
135
+ },
136
+ end: {
137
+ worldPos: new n(),
138
+ screenPos: new i()
139
+ },
140
+ midPoint: {
141
+ worldPos: new n(),
142
+ screenPos: new i()
143
+ },
144
+ distance: 0
145
+ }
146
+ }, this._currentDimensionsIndicatorState = {
147
+ length: {
148
+ begin: {
149
+ worldPos: new n(),
150
+ screenPos: new i()
151
+ },
152
+ end: {
153
+ worldPos: new n(),
154
+ screenPos: new i()
155
+ },
156
+ midPoint: {
157
+ worldPos: new n(),
158
+ screenPos: new i()
159
+ },
160
+ distance: 0
161
+ },
162
+ depth: {
163
+ begin: {
164
+ worldPos: new n(),
165
+ screenPos: new i()
166
+ },
167
+ end: {
168
+ worldPos: new n(),
169
+ screenPos: new i()
170
+ },
171
+ midPoint: {
172
+ worldPos: new n(),
173
+ screenPos: new i()
174
+ },
175
+ distance: 0
176
+ },
177
+ height: {
178
+ begin: {
179
+ worldPos: new n(),
180
+ screenPos: new i()
181
+ },
182
+ end: {
183
+ worldPos: new n(),
184
+ screenPos: new i()
185
+ },
186
+ midPoint: {
187
+ worldPos: new n(),
188
+ screenPos: new i()
189
+ },
190
+ distance: 0
191
+ }
192
+ }, this._dimensionIndicatorNormals = {
193
+ length: new n(),
194
+ depth: new n(),
195
+ height: new n()
196
+ };
197
+ }
198
+ static {
199
+ this.webComponentName = "dimensions-manager";
200
+ }
201
+ static {
202
+ this.styles = x`
203
+ :host {
204
+ position: absolute;
205
+ top: 0;
206
+ left: 0;
207
+ width: 100%;
208
+ height: 100%;
209
+ pointer-events: none;
210
+ }
211
+
212
+ .dimensions-label {
213
+ position: absolute;
214
+ transform: translateY(-50%);
215
+ }
216
+
217
+ .dimensions-label.occluded {
218
+ opacity: 0.5;
219
+ }
220
+ `;
221
+ }
222
+ /**
223
+ * Sets up a visualizer gizmo that shows the active bounds for all proxies within scene.
224
+ * This could be useful to debug the calculated values.
225
+ */
226
+ _setupBoundsVisualizer() {
227
+ this._boundsVisualizer = new I(this._renderEngine.sceneHierarchy.proxyGeoGrp, 16711680), this._renderEngine.scene.add(this._boundsVisualizer);
228
+ }
229
+ get _renderEngine() {
230
+ return this.appWcRef.renderEngine;
231
+ }
232
+ /**
233
+ * Since we do not want to define these web component at all times,
234
+ * this method needs to be explicitly called before usage.
235
+ */
236
+ static setupWebComponent() {
237
+ window.customElements.get(p.webComponentName) || window.customElements.define(p.webComponentName, p);
238
+ }
239
+ getCurrentSceneBounds() {
240
+ return this._currentSceneBounds;
241
+ }
242
+ getCurrentDimensionsState() {
243
+ return this._currentDimensionsState;
244
+ }
245
+ getCurrentDimensionsIndicatorState() {
246
+ return this._currentDimensionsIndicatorState;
247
+ }
248
+ firstUpdated() {
249
+ this.visualizeBounds && this._setupBoundsVisualizer();
250
+ }
251
+ updated(e) {
252
+ e.get("enabled") && (this.enabled ? (window.epigraph.logger.info({ title: "Showing Dimensions" }), this.recalculateBoundsAndDimensions(), this.appWcRef.appEvents.dimensionsVisibilityChanged.fire({ visible: this.enabled })) : (window.epigraph.logger.info({ title: "Hiding Dimensions" }), this.appWcRef.appEvents.dimensionsVisibilityChanged.fire({ visible: this.enabled })));
253
+ }
254
+ _updateDimensionsIndicator({ currentBoundSide: e, currentIndicatorSide: s }) {
255
+ e.distance = e.begin.worldPos.distanceTo(e.end.worldPos), e.midPoint.worldPos = S.getPointInBetweenByPercentage(
256
+ e.begin.worldPos,
257
+ e.end.worldPos,
258
+ 0.5
259
+ );
260
+ const h = this.appWcRef.getScreenPositionFromWorld(
261
+ e.midPoint.worldPos
262
+ );
263
+ e.midPoint.screenPos = h, s.midPoint.worldPos = S.getPointInBetweenByPercentage(
264
+ s.begin.worldPos,
265
+ s.end.worldPos,
266
+ 0.5
267
+ );
268
+ const t = this.appWcRef.getScreenPositionFromWorld(s.midPoint.worldPos);
269
+ s.midPoint.screenPos = t;
270
+ }
271
+ /**
272
+ * Recalculates and updates the length component of dimensions.
273
+ */
274
+ _recalculateLength() {
275
+ this._currentDimensionsState.length.begin.worldPos.set(
276
+ this._currentSceneBounds.min.x,
277
+ this._currentSceneBounds.min.y,
278
+ this._currentSceneBounds.max.z
279
+ ), this._currentDimensionsState.length.end.worldPos.set(
280
+ this._currentSceneBounds.max.x,
281
+ this._currentSceneBounds.min.y,
282
+ this._currentSceneBounds.max.z
283
+ ), this._updateDimensionsIndicator({
284
+ currentBoundSide: this._currentDimensionsState.length,
285
+ currentIndicatorSide: this._currentDimensionsIndicatorState.length
286
+ });
287
+ }
288
+ /**
289
+ * Recalculates and updates the depth component of dimensions.
290
+ */
291
+ _recalculateDepth() {
292
+ this._currentDimensionsState.depth.begin.worldPos.set(
293
+ this._currentSceneBounds.min.x,
294
+ this._currentSceneBounds.min.y,
295
+ this._currentSceneBounds.min.z
296
+ ), this._currentDimensionsState.depth.end.worldPos.set(
297
+ this._currentSceneBounds.min.x,
298
+ this._currentSceneBounds.min.y,
299
+ this._currentSceneBounds.max.z
300
+ ), this._updateDimensionsIndicator({
301
+ currentBoundSide: this._currentDimensionsState.depth,
302
+ currentIndicatorSide: this._currentDimensionsIndicatorState.depth
303
+ });
304
+ }
305
+ /**
306
+ * Recalculates and updates the height component of dimensions.
307
+ */
308
+ _recalculateHeight() {
309
+ this._currentDimensionsState.height.begin.worldPos.set(
310
+ this._currentSceneBounds.min.x,
311
+ this._currentSceneBounds.min.y,
312
+ this._currentSceneBounds.max.z
313
+ ), this._currentDimensionsState.height.end.worldPos.set(
314
+ this._currentSceneBounds.min.x,
315
+ this._currentSceneBounds.max.y,
316
+ this._currentSceneBounds.max.z
317
+ ), this._updateDimensionsIndicator({
318
+ currentBoundSide: this._currentDimensionsState.height,
319
+ currentIndicatorSide: this._currentDimensionsIndicatorState.height
320
+ });
321
+ }
322
+ /**
323
+ * Recalculates dimensions within the scene and makes necessary updates.
324
+ */
325
+ recalculateBoundsAndDimensions() {
326
+ if (this._currentSceneBounds.setFromPoints([new n()]), this._renderEngine.sceneHierarchy.proxyGeoGrp.children.length > 0)
327
+ for (const e of this._renderEngine.sceneHierarchy.proxyGeoGrp.children)
328
+ this._currentSceneBounds.expandByObject(e);
329
+ this._boundsVisualizer && this._boundsVisualizer.update(), this.appWcRef.appEvents.dimensionsValueChanged.fire();
330
+ }
331
+ /**
332
+ * Updates world and screen positions of the dimensions lines based on the current camera pose.
333
+ * This method assumes that the bounds calculations would have been performed already.
334
+ * Note: Screen position calculations are only estimates and must be used only for rough updates.
335
+ */
336
+ repopulateDimensionIndicators() {
337
+ const e = this._currentSceneBounds.clone();
338
+ e.expandByScalar(this._dimensionsIndicatorBoundsPadding), this._recalculateLength(), this._recalculateDepth(), this._recalculateHeight();
339
+ const { length: s, depth: h, height: t } = this._currentDimensionsState, r = {
340
+ length: b.convert(s.distance, m.meter, this.dimensionsUnit).value,
341
+ depth: b.convert(h.distance, m.meter, this.dimensionsUnit).value,
342
+ height: b.convert(t.distance, m.meter, this.dimensionsUnit).value
343
+ };
344
+ this._dimensionsInDisplayUnit = JSON.parse(JSON.stringify(r)), this._currentDimensionsIndicatorState.length.begin.worldPos.set(
345
+ e.min.x,
346
+ 0,
347
+ // Clamps at the ground
348
+ e.max.z
349
+ ), this._currentDimensionsIndicatorState.length.end.worldPos.set(
350
+ e.max.x,
351
+ 0,
352
+ e.max.z
353
+ ), this._currentDimensionsIndicatorState.depth.begin.worldPos.set(
354
+ e.min.x,
355
+ 0,
356
+ e.min.z
357
+ ), this._currentDimensionsIndicatorState.depth.end.worldPos.set(
358
+ e.min.x,
359
+ 0,
360
+ e.max.z
361
+ ), this._currentDimensionsIndicatorState.height.begin.worldPos.set(
362
+ e.min.x,
363
+ 0,
364
+ e.max.z
365
+ ), this._currentDimensionsIndicatorState.height.end.worldPos.set(
366
+ e.min.x,
367
+ e.max.y,
368
+ e.max.z
369
+ );
370
+ const o = new n();
371
+ this.appWcRef.dimensionsManager.getCurrentSceneBounds().getCenter(o), this._dimensionIndicatorNormals.length.subVectors(this._currentDimensionsIndicatorState.length.midPoint.worldPos, o), this._dimensionIndicatorNormals.depth.subVectors(this._currentDimensionsIndicatorState.depth.midPoint.worldPos, o), this._dimensionIndicatorNormals.height.subVectors(this._currentDimensionsIndicatorState.height.midPoint.worldPos, o), this.appWcRef.appEvents.dimensionsPositionChanged.fire();
372
+ }
373
+ _isFacingCamera(e) {
374
+ return this.appWcRef.cameraManager.cameras.main.getWorldDirection(this._cameraDirection), e.angleTo(this._cameraDirection) > Math.PI / 2.2;
375
+ }
376
+ render() {
377
+ return this.enabled ? u`
378
+ <div id="dimensionIndicators">
379
+ <epg-dimension-label
380
+ id="dimensionsLabelLength"
381
+ label=${this._dimensionsInDisplayUnit.length.toFixed(2)}
382
+ unit-symbol=${this.dimensionsUnitSymbol}
383
+ class="dimensions-label ${this._isFacingCamera(this._dimensionIndicatorNormals.length) ? "" : "occluded"}"
384
+ theme="dark"
385
+ size="medium"
386
+ ?disabled=${!this.enabled}
387
+ style="left: ${this._currentDimensionsIndicatorState.length.midPoint.screenPos.x}px; top: ${this._currentDimensionsIndicatorState.length.midPoint.screenPos.y}px"
388
+ ></epg-dimension-label>
389
+
390
+ <epg-dimension-label
391
+ id="dimensionsLabelDepth"
392
+ label=${this._dimensionsInDisplayUnit.depth.toFixed(2)}
393
+ unit-symbol=${this.dimensionsUnitSymbol}
394
+ class="dimensions-label ${this._isFacingCamera(this._dimensionIndicatorNormals.depth) ? "" : "occluded"}"
395
+ theme="dark"
396
+ size="medium"
397
+ ?disabled=${!this.enabled}
398
+ style="left: ${this._currentDimensionsIndicatorState.depth.midPoint.screenPos.x}px; top: ${this._currentDimensionsIndicatorState.depth.midPoint.screenPos.y}px;"
399
+ ></epg-dimension-label>
400
+
401
+ <epg-dimension-label
402
+ id="dimensionsLabelHeight"
403
+ label=${this._dimensionsInDisplayUnit.height.toFixed(2)}
404
+ unit-symbol=${this.dimensionsUnitSymbol}
405
+ class="dimensions-label ${this._isFacingCamera(this._dimensionIndicatorNormals.height) ? "" : "occluded"}"
406
+ theme="dark"
407
+ size="medium"
408
+ ?disabled=${!this.enabled}
409
+ style="left: ${this._currentDimensionsIndicatorState.height.midPoint.screenPos.x}px; top: ${this._currentDimensionsIndicatorState.height.midPoint.screenPos.y}px;"
410
+ ></epg-dimension-label>
411
+ </div>
412
+ ` : w;
413
+ }
414
+ };
415
+ d([
416
+ c({ type: Boolean, attribute: "enabled" })
417
+ ], a.prototype, "enabled");
418
+ d([
419
+ c({ type: Boolean, attribute: "visualize-bounds" })
420
+ ], a.prototype, "visualizeBounds");
421
+ d([
422
+ c({ type: String, attribute: "dimensions-unit" })
423
+ ], a.prototype, "dimensionsUnit");
424
+ d([
425
+ c({ type: String, attribute: "dimensions-unit-symbol" })
426
+ ], a.prototype, "dimensionsUnitSymbol");
427
+ d([
428
+ _()
429
+ ], a.prototype, "_dimensionsInDisplayUnit");
430
+ d([
431
+ _()
432
+ ], a.prototype, "_currentDimensionsState");
433
+ d([
434
+ _()
435
+ ], a.prototype, "_currentDimensionsIndicatorState");
436
+ let E = a;
437
+ export {
438
+ E as DimensionsManager
439
+ };
@@ -0,0 +1,72 @@
1
+ import { r as $, i as g, n as c } from "./three.module-CYfxkCtM.js";
2
+ import { g as e, D as r } from "./baseUiComponent-_PPHqnvV.js";
3
+ import { E as m } from "./HotspotsManager-mmFi8qV9.js";
4
+ const s = "epg-button-view-in-your-space", l = {
5
+ label: {
6
+ name: "label",
7
+ defaultValue: "View In Your Space"
8
+ },
9
+ rightIcon: {
10
+ name: "right-icon",
11
+ defaultValue: ""
12
+ }
13
+ };
14
+ var S = Object.defineProperty, b = (t, u, n, v) => {
15
+ for (var o = void 0, a = t.length - 1, d; a >= 0; a--)
16
+ (d = t[a]) && (o = d(u, n, o) || o);
17
+ return o && S(u, n, o), o;
18
+ };
19
+ const p = $(
20
+ `${e(r.Space.Padding.Medium.$value)} ${e(r.Space.Padding.Regular.$value)}`
21
+ );
22
+ class i extends m {
23
+ constructor() {
24
+ super(...arguments), this.label = l.label.defaultValue.toString(), this.rightIcon = l.rightIcon.defaultValue.toString();
25
+ }
26
+ static {
27
+ this.styles = [
28
+ super.styles,
29
+ g`
30
+ :host {
31
+ border: ${e(r.Size.Stroke.Regular.$value)} solid;
32
+ border-radius: ${e(r.Size.Radius.Full.$value)};
33
+ border-color: ${e(
34
+ r.Color.Border.SubtlePrimary.$value
35
+ )};
36
+ background-color: ${e(
37
+ r.Color.Fill.SubtleSecondary.$value
38
+ )};
39
+ color: ${e(r.Color.Text.NeutralPrimary.$value)};
40
+ padding: ${p};
41
+ }
42
+
43
+ :host(:hover) {
44
+ border: ${e(r.Size.Stroke.Thick.$value)} solid;
45
+ border-color: ${e(
46
+ r.Color.Border.SubtlePrimary.$value
47
+ )};
48
+ background-color: ${e(
49
+ r.Color.Fill.SubtlePrimary.$value
50
+ )};
51
+ }
52
+
53
+ :host(:active) {
54
+ border: ${e(r.Size.Stroke.Thick.$value)} solid;
55
+ border-color: ${e(
56
+ r.Color.Border.SubtlePrimary.$value
57
+ )};
58
+ background-color: ${e(
59
+ r.Color.Fill.NeutralTertiary.$value
60
+ )};
61
+ }
62
+ `
63
+ ];
64
+ }
65
+ }
66
+ b([
67
+ c({ attribute: l.label.name })
68
+ ], i.prototype, "label");
69
+ b([
70
+ c({ attribute: l.rightIcon.name })
71
+ ], i.prototype, "rightIcon");
72
+ window.customElements.get(s) || window.customElements.define(s, i);
@@ -0,0 +1,191 @@
1
+ import { i as h, x as d, n as s } from "./three.module-CYfxkCtM.js";
2
+ import { E as g, a as c } from "./epigraph-threed-core-oXi9QFHJ.js";
3
+ import "./epg-button-view-in-your-space-29ehH_AX.js";
4
+ import { P as f, A as _ } from "./AppHelpers-DdbyrHJf.js";
5
+ class m {
6
+ constructor({ nexusApiResultPayload: e }) {
7
+ window.epigraph.logger.info({ title: "nexusApiPayload", details: e }), this._data = e;
8
+ }
9
+ getData() {
10
+ return this._data;
11
+ }
12
+ getExperienceDataSettings() {
13
+ return {};
14
+ }
15
+ getArGlbUrl() {
16
+ return this._data.product_variant.assets.ar_assets.glb.url;
17
+ }
18
+ getArUsdzUrl() {
19
+ return this._data.product_variant.assets.ar_assets.usdz.url;
20
+ }
21
+ getProductVariantIdentifier() {
22
+ return this._data.product_variant.variant_identifier;
23
+ }
24
+ }
25
+ const i = {
26
+ label: {
27
+ name: "label",
28
+ defaultValue: "View In Your Space"
29
+ },
30
+ sku: {
31
+ name: "sku",
32
+ defaultValue: "sku-epigraph-logo-default"
33
+ },
34
+ shopifyVariantId: {
35
+ name: "shopify-variant-id",
36
+ defaultValue: ""
37
+ },
38
+ upc: {
39
+ name: "upc",
40
+ defaultValue: ""
41
+ },
42
+ asin: {
43
+ name: "asin",
44
+ defaultValue: ""
45
+ }
46
+ };
47
+ var w = Object.defineProperty, o = (p, e, t, y) => {
48
+ for (var a = void 0, u = p.length - 1, l; u >= 0; u--)
49
+ (l = p[u]) && (a = l(e, t, a) || a);
50
+ return a && w(e, t, a), a;
51
+ };
52
+ const n = class r extends g {
53
+ constructor() {
54
+ super(), this._loggerContext = "EPIGRAPH BUTTON", this.featuresToEnable = {
55
+ viewer: !1,
56
+ hotspots: !1,
57
+ dimensions: !1,
58
+ viewInYourSpace: !0,
59
+ help: !1
60
+ }, this.epigraphWebsiteRedirectUrls = {
61
+ icon: "https://www.epigraph.us/?utm_source=web&utm_medium=experience&utm_campaign=+button&utm_id=powered-by&utm_content=icon",
62
+ modal: "https://www.epigraph.us/?utm_source=web&utm_medium=experience&utm_campaign=+button&utm_id=powered-by&utm_content=modal"
63
+ }, this.label = i.label.defaultValue.toString(), this.sku = i.sku.defaultValue.toString(), this.shopify_variant_id = i.shopifyVariantId.defaultValue.toString(), this.upc = i.upc.defaultValue.toString(), this.asin = i.asin.defaultValue.toString(), this._identifier = "", this._identifierType = "", window.epigraph.logger.info({
64
+ title: `Initializing ${r.webComponentName}...`,
65
+ contextOverride: this._loggerContext
66
+ });
67
+ }
68
+ static {
69
+ this.webComponentName = "epigraph-button";
70
+ }
71
+ static {
72
+ this.styles = [
73
+ super.styles,
74
+ h`
75
+ :host {
76
+ --ar-button-display: none;
77
+ }
78
+
79
+ model-viewer {
80
+ width: 0;
81
+ height: 0;
82
+ }
83
+ `
84
+ ];
85
+ }
86
+ static setupWebComponent() {
87
+ window.customElements.get(r.webComponentName) || window.customElements.define(r.webComponentName, r);
88
+ }
89
+ get identifier() {
90
+ return this._identifier;
91
+ }
92
+ get identifierType() {
93
+ return this._identifierType;
94
+ }
95
+ getExperienceData() {
96
+ return this._experienceData.getData();
97
+ }
98
+ getExperienceDataSettings() {
99
+ return this._experienceData.getExperienceDataSettings();
100
+ }
101
+ async _fetchDataFromNexus() {
102
+ const e = new f(
103
+ _.resolveNexusEndpoint(this.apiMode),
104
+ window.location.href,
105
+ window.epigraph.epigraphSessionId,
106
+ this.solutionVersion,
107
+ this.xPath
108
+ );
109
+ let t = null;
110
+ switch (this._identifierType) {
111
+ case "sku":
112
+ t = await e.getButtonBySku(this._identifier);
113
+ break;
114
+ case "shopify_variant_id":
115
+ t = await e.getButtonByShopifyVariantId(this._identifier);
116
+ break;
117
+ case "upc":
118
+ t = await e.getButtonByUpc(this._identifier);
119
+ break;
120
+ case "asin":
121
+ t = await e.getButtonByAsin(this._identifier);
122
+ break;
123
+ default:
124
+ return window.epigraph.logger.error({
125
+ title: `Identifier type: '${this._identifierType}' not supported!`,
126
+ contextOverride: this._loggerContext
127
+ }), Promise.reject();
128
+ }
129
+ return t;
130
+ }
131
+ async _onIdentifierOrTypeChange() {
132
+ if (this.isLoading = !0, await this.resolveIdentifierAndType(), window.epigraph.logger.info({ title: "IDENTIFIER CHANGED", details: `${this._identifier} -- ${this._identifierType}` }), !this._identifier || !this._identifierType)
133
+ return;
134
+ const e = await this._fetchDataFromNexus();
135
+ if (!e.success)
136
+ return await this.onAuthenticationFailed(e.message), Promise.reject();
137
+ this._experienceData = new m({ nexusApiResultPayload: e.payload });
138
+ const t = this._experienceData.getArGlbUrl();
139
+ t !== void 0 && (this.viewInYourSpaceManager.glbSrc = t, this.viewInYourSpaceManager.variantName = this._experienceData.getProductVariantIdentifier()), this.isLoading = !1;
140
+ }
141
+ /**
142
+ * The following properties can change the identifier and it's type on this web component.
143
+ */
144
+ async resolveIdentifierAndType() {
145
+ this.sku ? (this._identifierType = "sku", this._identifier = this.sku) : this.shopify_variant_id ? (this._identifierType = "shopify_variant_id", this._identifier = this.shopify_variant_id) : this.upc ? (this._identifierType = "upc", this._identifier = this.upc) : this.asin && (this._identifierType = "asin", this._identifier = this.asin);
146
+ }
147
+ /**
148
+ * What happens when any of the HTML attributes are changed.
149
+ */
150
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
+ updated(e) {
152
+ (e.has("sku") || e.has("shopify_variant_id") || e.has("upc") || e.has("asin")) && this._onIdentifierOrTypeChange();
153
+ }
154
+ renderAppUiElemChildren() {
155
+ return d`
156
+ <epg-button-view-in-your-space
157
+ id="viewInYourSpaceButton"
158
+ @epgonclick=${this.launchAR}
159
+ ?is-loading=${this.isLoading}
160
+ label=${this.label}
161
+ ></epg-button-view-in-your-space>
162
+
163
+ ${this._renderViewInYourSpaceManager()}
164
+ `;
165
+ }
166
+ async setup() {
167
+ window.epigraph.logger.table({ title: "Setting up...", contextOverride: this._loggerContext }), this._appEvents = new c(this), window.epigraph.logger.info({
168
+ title: "All Initializations Complete",
169
+ contextOverride: this._loggerContext
170
+ });
171
+ }
172
+ };
173
+ o([
174
+ s({ type: String, attribute: i.label.name })
175
+ ], n.prototype, "label");
176
+ o([
177
+ s({ type: String, attribute: i.sku.name })
178
+ ], n.prototype, "sku");
179
+ o([
180
+ s({ type: String, attribute: i.shopifyVariantId.name })
181
+ ], n.prototype, "shopify_variant_id");
182
+ o([
183
+ s({ type: String, attribute: i.upc.name })
184
+ ], n.prototype, "upc");
185
+ o([
186
+ s({ type: String, attribute: i.asin.name })
187
+ ], n.prototype, "asin");
188
+ let S = n;
189
+ export {
190
+ S as EpigraphButton
191
+ };