@plattar/plattar-ar-adapter 1.122.4 → 1.123.1
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/build/es2015/plattar-ar-adapter.js +1608 -1163
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +768 -487
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/embed/controllers/configurator-controller.d.ts +18 -0
- package/dist/embed/controllers/configurator-controller.js +186 -0
- package/dist/embed/controllers/plattar-controller.d.ts +62 -0
- package/dist/embed/controllers/plattar-controller.js +51 -0
- package/dist/embed/controllers/product-controller.d.ts +18 -0
- package/dist/embed/controllers/product-controller.js +141 -0
- package/dist/embed/controllers/viewer-controller.d.ts +18 -0
- package/dist/embed/controllers/viewer-controller.js +155 -0
- package/dist/embed/plattar-embed.d.ts +1 -10
- package/dist/embed/plattar-embed.js +33 -347
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const plattar_api_1 = require("@plattar/plattar-api");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const raw_ar_1 = require("../ar/raw-ar");
|
|
8
|
-
/**
|
|
9
|
-
* This tracks the current state of the Embed
|
|
10
|
-
*/
|
|
11
|
-
var EmbedState;
|
|
12
|
-
(function (EmbedState) {
|
|
13
|
-
EmbedState[EmbedState["None"] = 0] = "None";
|
|
14
|
-
EmbedState[EmbedState["SceneViewer"] = 1] = "SceneViewer";
|
|
15
|
-
EmbedState[EmbedState["ProductViewer"] = 2] = "ProductViewer";
|
|
16
|
-
EmbedState[EmbedState["ConfiguratorViewer"] = 3] = "ConfiguratorViewer";
|
|
17
|
-
EmbedState[EmbedState["ProductAR"] = 4] = "ProductAR";
|
|
18
|
-
EmbedState[EmbedState["QRCode"] = 5] = "QRCode";
|
|
19
|
-
})(EmbedState || (EmbedState = {}));
|
|
4
|
+
const product_controller_1 = require("./controllers/product-controller");
|
|
5
|
+
const viewer_controller_1 = require("./controllers/viewer-controller");
|
|
6
|
+
const configurator_controller_1 = require("./controllers/configurator-controller");
|
|
20
7
|
/**
|
|
21
8
|
* This tracks the current embed type
|
|
22
9
|
*/
|
|
@@ -32,26 +19,12 @@ var EmbedType;
|
|
|
32
19
|
class PlattarEmbed extends HTMLElement {
|
|
33
20
|
constructor() {
|
|
34
21
|
super();
|
|
35
|
-
// this is the current state of the embed, none by default
|
|
36
|
-
this._currentState = EmbedState.None;
|
|
37
22
|
// this is the current embed type, viewer by default
|
|
38
23
|
this._currentType = EmbedType.Viewer;
|
|
39
|
-
this.
|
|
40
|
-
color: "#101721",
|
|
41
|
-
qrType: "default",
|
|
42
|
-
margin: 0
|
|
43
|
-
};
|
|
44
|
-
this._sceneID = null;
|
|
45
|
-
this._productID = null;
|
|
46
|
-
this._variationID = null;
|
|
47
|
-
this._isReady = false;
|
|
48
|
-
this._width = "500px";
|
|
49
|
-
this._height = "500px";
|
|
50
|
-
this._server = "production";
|
|
51
|
-
this._viewer = null;
|
|
24
|
+
this._controller = null;
|
|
52
25
|
}
|
|
53
26
|
get viewer() {
|
|
54
|
-
return this.
|
|
27
|
+
return this._controller ? this._controller.element : null;
|
|
55
28
|
}
|
|
56
29
|
connectedCallback() {
|
|
57
30
|
const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "viewer";
|
|
@@ -70,26 +43,7 @@ class PlattarEmbed extends HTMLElement {
|
|
|
70
43
|
const observer = new MutationObserver((mutations) => {
|
|
71
44
|
mutations.forEach((mutation) => {
|
|
72
45
|
if (mutation.type === "attributes") {
|
|
73
|
-
|
|
74
|
-
const productID = this.hasAttribute("product-id") ? this.getAttribute("product-id") : null;
|
|
75
|
-
const variationID = this.hasAttribute("variation-id") ? this.getAttribute("variation-id") : null;
|
|
76
|
-
let updated = false;
|
|
77
|
-
if (sceneID !== this._sceneID) {
|
|
78
|
-
this._sceneID = sceneID;
|
|
79
|
-
updated = true;
|
|
80
|
-
}
|
|
81
|
-
if (productID !== this._productID) {
|
|
82
|
-
this._productID = productID;
|
|
83
|
-
updated = true;
|
|
84
|
-
}
|
|
85
|
-
if (variationID !== this._variationID) {
|
|
86
|
-
this._variationID = variationID;
|
|
87
|
-
updated = true;
|
|
88
|
-
}
|
|
89
|
-
if (updated) {
|
|
90
|
-
// re-render based on internal state
|
|
91
|
-
this._OnAttributesUpdated();
|
|
92
|
-
}
|
|
46
|
+
this._OnAttributesUpdated();
|
|
93
47
|
}
|
|
94
48
|
});
|
|
95
49
|
});
|
|
@@ -98,21 +52,21 @@ class PlattarEmbed extends HTMLElement {
|
|
|
98
52
|
});
|
|
99
53
|
const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
|
|
100
54
|
plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
55
|
+
const sceneID = this.hasAttribute("scene-id") ? this.getAttribute("scene-id") : null;
|
|
56
|
+
const productID = this.hasAttribute("product-id") ? this.getAttribute("product-id") : null;
|
|
57
|
+
// decide which controller to initialise
|
|
58
|
+
if (this._currentType === EmbedType.Viewer) {
|
|
59
|
+
// initialise product if scene-id is missing but product-id is defined
|
|
60
|
+
if (!sceneID && productID) {
|
|
61
|
+
this._controller = new product_controller_1.ProductController(this);
|
|
62
|
+
}
|
|
63
|
+
else if (sceneID) {
|
|
64
|
+
this._controller = new viewer_controller_1.ViewerController(this);
|
|
65
|
+
}
|
|
111
66
|
}
|
|
112
|
-
if (
|
|
113
|
-
this.
|
|
67
|
+
else if (this._currentType === EmbedType.Configurator) {
|
|
68
|
+
this._controller = new configurator_controller_1.ConfiguratorController(this);
|
|
114
69
|
}
|
|
115
|
-
this._isReady = true;
|
|
116
70
|
const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
|
|
117
71
|
if (init === "ar") {
|
|
118
72
|
this.startAR();
|
|
@@ -140,279 +94,34 @@ class PlattarEmbed extends HTMLElement {
|
|
|
140
94
|
}
|
|
141
95
|
initAR() {
|
|
142
96
|
return new Promise((accept, reject) => {
|
|
143
|
-
if (!this.
|
|
144
|
-
return reject(new Error("PlattarEmbed.initAR() - cannot execute as
|
|
145
|
-
}
|
|
146
|
-
if (!util_1.Util.canAugment()) {
|
|
147
|
-
return reject(new Error("PlattarEmbed.initAR() - cannot proceed as AR not available in context"));
|
|
148
|
-
}
|
|
149
|
-
if (this._currentType === EmbedType.Viewer) {
|
|
150
|
-
// if scene is not set but product is, then use ProductAR
|
|
151
|
-
if (!this._sceneID && this._productID) {
|
|
152
|
-
const product = new product_ar_1.ProductAR(this._productID, this._variationID);
|
|
153
|
-
return product.init().then(accept).catch(reject);
|
|
154
|
-
}
|
|
155
|
-
// If Product is set (under any scenario) then use ProductAR
|
|
156
|
-
// NOTE: At some point this should check for Scenes when SceneAR
|
|
157
|
-
// is implemented
|
|
158
|
-
if (this._productID) {
|
|
159
|
-
const product = new product_ar_1.ProductAR(this._productID, this._variationID);
|
|
160
|
-
return product.init().then(accept).catch(reject);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (this._currentType === EmbedType.Configurator) {
|
|
164
|
-
// if scene ID is available and the state is a configurator viewer
|
|
165
|
-
// we can use the real-time configurator state to launch the AR view
|
|
166
|
-
const viewer = this.viewer;
|
|
167
|
-
if (viewer && this._sceneID && this._currentState === EmbedState.ConfiguratorViewer) {
|
|
168
|
-
let output = "glb";
|
|
169
|
-
if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
|
|
170
|
-
output = "usdz";
|
|
171
|
-
}
|
|
172
|
-
viewer.messenger.getARFile(output).then((result) => {
|
|
173
|
-
const rawAR = new raw_ar_1.RawAR(result.filename);
|
|
174
|
-
return rawAR.init().then(accept).catch(reject);
|
|
175
|
-
}).catch(reject);
|
|
176
|
-
}
|
|
177
|
-
const configState = this.hasAttribute("config-state") ? this.getAttribute("config-state") : null;
|
|
178
|
-
// otherwise scene ID is available to the viewer is not launched
|
|
179
|
-
// we can use the static configuration state to launch the AR view
|
|
180
|
-
if (this._sceneID && configState) {
|
|
181
|
-
try {
|
|
182
|
-
const decodedb64State = atob(configState);
|
|
183
|
-
const state = JSON.parse(decodedb64State);
|
|
184
|
-
if (state.meta) {
|
|
185
|
-
const sceneProductIndex = state.meta.scene_product_index || 0;
|
|
186
|
-
const variationIndex = state.meta.product_variation_index || 1;
|
|
187
|
-
const states = state.states || [];
|
|
188
|
-
if (states.length > 0) {
|
|
189
|
-
const configurator = new plattar_services_1.Configurator();
|
|
190
|
-
states.forEach((productState) => {
|
|
191
|
-
configurator.addSceneProduct(productState[sceneProductIndex], productState[variationIndex]);
|
|
192
|
-
});
|
|
193
|
-
if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
|
|
194
|
-
configurator.output = "usdz";
|
|
195
|
-
}
|
|
196
|
-
if (util_1.Util.canSceneViewer()) {
|
|
197
|
-
configurator.output = "glb";
|
|
198
|
-
}
|
|
199
|
-
configurator.server = this._server;
|
|
200
|
-
return configurator.get().then((result) => {
|
|
201
|
-
const rawAR = new raw_ar_1.RawAR(result.filename);
|
|
202
|
-
rawAR.init().then(accept).catch(reject);
|
|
203
|
-
}).catch(reject);
|
|
204
|
-
}
|
|
205
|
-
return reject(new Error("PlattarEmbed.initAR() - invalid config-state does not have any product states"));
|
|
206
|
-
}
|
|
207
|
-
return reject(new Error("PlattarEmbed.initAR() - invalid config-state for configurator"));
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
return reject(err);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
97
|
+
if (!this._controller) {
|
|
98
|
+
return reject(new Error("PlattarEmbed.initAR() - cannot execute as controller has not loaded yet"));
|
|
213
99
|
}
|
|
214
|
-
|
|
215
|
-
if (this._sceneID) {
|
|
216
|
-
return reject(new Error("PlattarEmbed.initAR() - scene-id not yet supported"));
|
|
217
|
-
}
|
|
218
|
-
return reject(new Error("PlattarEmbed.initAR() - minimum required attributes not set, use scene-id or product-id as a minimum"));
|
|
100
|
+
return this._controller.initAR().then(accept).catch(reject);
|
|
219
101
|
});
|
|
220
102
|
}
|
|
221
103
|
startAR() {
|
|
222
104
|
return new Promise((accept, reject) => {
|
|
223
|
-
if (!this.
|
|
224
|
-
return reject(new Error("PlattarEmbed.startAR() - cannot execute as
|
|
105
|
+
if (!this._controller) {
|
|
106
|
+
return reject(new Error("PlattarEmbed.startAR() - cannot execute as controller has not loaded yet"));
|
|
225
107
|
}
|
|
226
|
-
this.
|
|
227
|
-
launcher.start();
|
|
228
|
-
accept();
|
|
229
|
-
}).catch(reject);
|
|
108
|
+
return this._controller.startAR().then(accept).catch(reject);
|
|
230
109
|
});
|
|
231
110
|
}
|
|
232
111
|
startViewer() {
|
|
233
112
|
return new Promise((accept, reject) => {
|
|
234
|
-
if (!this.
|
|
235
|
-
return reject(new Error("PlattarEmbed.startViewer() - cannot execute as
|
|
236
|
-
}
|
|
237
|
-
if (this._viewer) {
|
|
238
|
-
this._viewer.remove();
|
|
239
|
-
this._viewer = null;
|
|
240
|
-
}
|
|
241
|
-
// if scene is set and embed is a viewer type, we use <plattar-viewer /> node from plattar-web
|
|
242
|
-
if (this._sceneID && this._currentType === EmbedType.Viewer) {
|
|
243
|
-
const viewer = document.createElement("plattar-viewer");
|
|
244
|
-
viewer.setAttribute("width", this._width);
|
|
245
|
-
viewer.setAttribute("height", this._height);
|
|
246
|
-
viewer.setAttribute("server", this._server);
|
|
247
|
-
viewer.setAttribute("scene-id", this._sceneID);
|
|
248
|
-
if (this._productID) {
|
|
249
|
-
viewer.setAttribute("product-id", this._productID);
|
|
250
|
-
}
|
|
251
|
-
if (this._variationID) {
|
|
252
|
-
viewer.setAttribute("variation-id", this._variationID);
|
|
253
|
-
}
|
|
254
|
-
viewer.onload = () => {
|
|
255
|
-
return accept(viewer);
|
|
256
|
-
};
|
|
257
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
258
|
-
shadow.append(viewer);
|
|
259
|
-
this._viewer = viewer;
|
|
260
|
-
this._currentState = EmbedState.SceneViewer;
|
|
261
|
-
return;
|
|
113
|
+
if (!this._controller) {
|
|
114
|
+
return reject(new Error("PlattarEmbed.startViewer() - cannot execute as controller has not loaded yet"));
|
|
262
115
|
}
|
|
263
|
-
|
|
264
|
-
if (this._sceneID && this._currentType === EmbedType.Configurator) {
|
|
265
|
-
const viewer = document.createElement("plattar-configurator");
|
|
266
|
-
viewer.setAttribute("width", this._width);
|
|
267
|
-
viewer.setAttribute("height", this._height);
|
|
268
|
-
viewer.setAttribute("server", this._server);
|
|
269
|
-
viewer.setAttribute("scene-id", this._sceneID);
|
|
270
|
-
const configState = this.hasAttribute("config-state") ? this.getAttribute("config-state") : null;
|
|
271
|
-
const showAR = this.hasAttribute("show-ar") ? this.getAttribute("show-ar") : null;
|
|
272
|
-
if (configState) {
|
|
273
|
-
viewer.setAttribute("config-state", configState);
|
|
274
|
-
}
|
|
275
|
-
if (showAR) {
|
|
276
|
-
viewer.setAttribute("show-ar", showAR);
|
|
277
|
-
}
|
|
278
|
-
viewer.onload = () => {
|
|
279
|
-
return accept(viewer);
|
|
280
|
-
};
|
|
281
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
282
|
-
shadow.append(viewer);
|
|
283
|
-
this._viewer = viewer;
|
|
284
|
-
this._currentState = EmbedState.ConfiguratorViewer;
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
// if product is set, we use <plattar-product /> node from plattar-web
|
|
288
|
-
if (this._productID) {
|
|
289
|
-
const viewer = document.createElement("plattar-product");
|
|
290
|
-
viewer.setAttribute("width", this._width);
|
|
291
|
-
viewer.setAttribute("height", this._height);
|
|
292
|
-
viewer.setAttribute("server", this._server);
|
|
293
|
-
viewer.setAttribute("product-id", this._productID);
|
|
294
|
-
if (this._variationID) {
|
|
295
|
-
viewer.setAttribute("variation-id", this._variationID);
|
|
296
|
-
}
|
|
297
|
-
viewer.onload = () => {
|
|
298
|
-
return accept(viewer);
|
|
299
|
-
};
|
|
300
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
301
|
-
shadow.append(viewer);
|
|
302
|
-
this._viewer = viewer;
|
|
303
|
-
this._currentState = EmbedState.ProductViewer;
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
return reject(new Error("PlattarEmbed.startViewer() - minimum required attributes not set, use scene-id or product-id as a minimum"));
|
|
116
|
+
return this._controller.startRenderer().then(accept).catch(reject);
|
|
307
117
|
});
|
|
308
118
|
}
|
|
309
119
|
startQRCode(options = null) {
|
|
310
120
|
return new Promise((accept, reject) => {
|
|
311
|
-
if (!this.
|
|
312
|
-
return reject(new Error("PlattarEmbed.startQRCode() - cannot execute as
|
|
313
|
-
}
|
|
314
|
-
const opt = options || this._qrCodeOptions;
|
|
315
|
-
// reset instance for later use
|
|
316
|
-
this._qrCodeOptions = opt;
|
|
317
|
-
if (this._viewer) {
|
|
318
|
-
this._viewer.remove();
|
|
319
|
-
this._viewer = null;
|
|
121
|
+
if (!this._controller) {
|
|
122
|
+
return reject(new Error("PlattarEmbed.startQRCode() - cannot execute as controller has not loaded yet"));
|
|
320
123
|
}
|
|
321
|
-
|
|
322
|
-
// we embed a QR code that takes us to viewer.html
|
|
323
|
-
if (this._sceneID && this._currentType == EmbedType.Viewer) {
|
|
324
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
325
|
-
viewer.setAttribute("width", this._width);
|
|
326
|
-
viewer.setAttribute("height", this._height);
|
|
327
|
-
if (opt.color) {
|
|
328
|
-
viewer.setAttribute("color", opt.color);
|
|
329
|
-
}
|
|
330
|
-
if (opt.margin) {
|
|
331
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
332
|
-
}
|
|
333
|
-
if (opt.qrType) {
|
|
334
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
335
|
-
}
|
|
336
|
-
let dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + this._sceneID;
|
|
337
|
-
if (this._productID) {
|
|
338
|
-
dst += "&productId=" + this._productID;
|
|
339
|
-
}
|
|
340
|
-
if (this._variationID) {
|
|
341
|
-
dst += "&variationId=" + this._variationID;
|
|
342
|
-
}
|
|
343
|
-
viewer.setAttribute("url", opt.url || dst);
|
|
344
|
-
viewer.onload = () => {
|
|
345
|
-
return accept(viewer);
|
|
346
|
-
};
|
|
347
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
348
|
-
shadow.append(viewer);
|
|
349
|
-
this._viewer = viewer;
|
|
350
|
-
this._currentState = EmbedState.QRCode;
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
// if scene is set and embed type is configurator
|
|
354
|
-
// we embed a QR code that takes us to configurator.html
|
|
355
|
-
if (this._sceneID && this._currentType == EmbedType.Configurator) {
|
|
356
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
357
|
-
viewer.setAttribute("width", this._width);
|
|
358
|
-
viewer.setAttribute("height", this._height);
|
|
359
|
-
if (opt.color) {
|
|
360
|
-
viewer.setAttribute("color", opt.color);
|
|
361
|
-
}
|
|
362
|
-
if (opt.margin) {
|
|
363
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
364
|
-
}
|
|
365
|
-
if (opt.qrType) {
|
|
366
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
367
|
-
}
|
|
368
|
-
let dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + this._sceneID;
|
|
369
|
-
const configState = this.hasAttribute("config-state") ? this.getAttribute("config-state") : null;
|
|
370
|
-
const showAR = this.hasAttribute("show-ar") ? this.getAttribute("show-ar") : null;
|
|
371
|
-
if (configState) {
|
|
372
|
-
dst += "&config_state=" + configState;
|
|
373
|
-
}
|
|
374
|
-
if (showAR) {
|
|
375
|
-
dst += "&show_ar=" + showAR;
|
|
376
|
-
}
|
|
377
|
-
viewer.setAttribute("url", opt.url || dst);
|
|
378
|
-
viewer.onload = () => {
|
|
379
|
-
return accept(viewer);
|
|
380
|
-
};
|
|
381
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
382
|
-
shadow.append(viewer);
|
|
383
|
-
this._viewer = viewer;
|
|
384
|
-
this._currentState = EmbedState.QRCode;
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
// if product is set, we embed a QR code that takes us to product.html
|
|
388
|
-
if (this._productID) {
|
|
389
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
390
|
-
viewer.setAttribute("width", this._width);
|
|
391
|
-
viewer.setAttribute("height", this._height);
|
|
392
|
-
if (opt.color) {
|
|
393
|
-
viewer.setAttribute("color", opt.color);
|
|
394
|
-
}
|
|
395
|
-
if (opt.margin) {
|
|
396
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
397
|
-
}
|
|
398
|
-
if (opt.qrType) {
|
|
399
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
400
|
-
}
|
|
401
|
-
let dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + this._productID;
|
|
402
|
-
if (this._variationID) {
|
|
403
|
-
dst += "&variation_id=" + this._variationID;
|
|
404
|
-
}
|
|
405
|
-
viewer.setAttribute("url", opt.url || dst);
|
|
406
|
-
viewer.onload = () => {
|
|
407
|
-
return accept(viewer);
|
|
408
|
-
};
|
|
409
|
-
const shadow = this.shadowRoot || this.attachShadow({ mode: 'open' });
|
|
410
|
-
shadow.append(viewer);
|
|
411
|
-
this._viewer = viewer;
|
|
412
|
-
this._currentState = EmbedState.QRCode;
|
|
413
|
-
return;
|
|
414
|
-
}
|
|
415
|
-
return reject(new Error("PlattarEmbed.startQRCode() - minimum required attributes not set, use scene-id or product-id as a minimum"));
|
|
124
|
+
return this._controller.startQRCode(options).then(accept).catch(reject);
|
|
416
125
|
});
|
|
417
126
|
}
|
|
418
127
|
/**
|
|
@@ -420,31 +129,8 @@ class PlattarEmbed extends HTMLElement {
|
|
|
420
129
|
* based on the state of the embed, we update the internal structure accordingly
|
|
421
130
|
*/
|
|
422
131
|
_OnAttributesUpdated() {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this._currentState === EmbedState.ProductAR ||
|
|
426
|
-
this._currentState === EmbedState.ConfiguratorViewer) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
// re-render the QR Code when attributes have changed
|
|
430
|
-
if (this._currentState === EmbedState.QRCode) {
|
|
431
|
-
this.startQRCode(this._qrCodeOptions);
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
// use the messenger function to change variation when attributes have changed
|
|
435
|
-
if (this._currentState === EmbedState.SceneViewer) {
|
|
436
|
-
const viewer = this.viewer;
|
|
437
|
-
if (viewer) {
|
|
438
|
-
viewer.messenger.selectVariation(this._productID, this._variationID);
|
|
439
|
-
}
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
if (this._currentState === EmbedState.ProductViewer) {
|
|
443
|
-
const viewer = this.viewer;
|
|
444
|
-
if (viewer) {
|
|
445
|
-
viewer.messenger.selectVariation(this._variationID);
|
|
446
|
-
}
|
|
447
|
-
return;
|
|
132
|
+
if (this._controller) {
|
|
133
|
+
this._controller.onAttributesUpdated();
|
|
448
134
|
}
|
|
449
135
|
}
|
|
450
136
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.
|
|
1
|
+
declare const _default: "1.123.1";
|
|
2
2
|
export default _default;
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plattar/plattar-ar-adapter",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.123.1",
|
|
4
4
|
"description": "Plattar AR Adapter for interfacing with Google & Apple WebAR",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@plattar/plattar-analytics": "^1.117.2",
|
|
41
41
|
"@plattar/plattar-api": "^1.120.1",
|
|
42
|
-
"@plattar/plattar-qrcode": "1.
|
|
42
|
+
"@plattar/plattar-qrcode": "1.122.1",
|
|
43
43
|
"@plattar/plattar-services": "^1.120.1",
|
|
44
44
|
"@plattar/plattar-web": "^1.122.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@babel/cli": "^7.
|
|
48
|
-
"@babel/core": "^7.
|
|
47
|
+
"@babel/cli": "^7.17.0",
|
|
48
|
+
"@babel/core": "^7.17.0",
|
|
49
49
|
"@babel/preset-env": "^7.16.11",
|
|
50
50
|
"browserify": "^17.0.0",
|
|
51
51
|
"typescript": "^4.5.5",
|