@plattar/plattar-ar-adapter 1.154.1 → 1.155.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 +2064 -1158
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +978 -783
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/configurator-ar.d.ts +29 -0
- package/dist/ar/configurator-ar.js +161 -0
- package/dist/ar/launcher-ar.js +3 -7
- package/dist/ar/model-ar.js +2 -0
- package/dist/ar/product-ar.js +2 -0
- package/dist/ar/raw-ar.js +2 -0
- package/dist/ar/scene-ar.js +2 -0
- package/dist/embed/controllers/configurator-controller.d.ts +4 -2
- package/dist/embed/controllers/configurator-controller.js +171 -179
- package/dist/embed/controllers/plattar-controller.d.ts +21 -1
- package/dist/embed/controllers/plattar-controller.js +138 -67
- package/dist/embed/controllers/product-controller.d.ts +6 -1
- package/dist/embed/controllers/product-controller.js +9 -2
- package/dist/embed/controllers/vto-controller.d.ts +4 -2
- package/dist/embed/controllers/vto-controller.js +190 -194
- package/dist/embed/plattar-embed.d.ts +23 -0
- package/dist/embed/plattar-embed.js +130 -91
- package/dist/util/configurator-state.d.ts +48 -6
- package/dist/util/configurator-state.js +145 -28
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/dist/embed/controllers/viewer-controller.d.ts +0 -14
- package/dist/embed/controllers/viewer-controller.js +0 -193
|
@@ -2,234 +2,229 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VTOController = void 0;
|
|
4
4
|
const plattar_api_1 = require("@plattar/plattar-api");
|
|
5
|
-
const plattar_services_1 = require("@plattar/plattar-services");
|
|
6
5
|
const __1 = require("../..");
|
|
7
|
-
const raw_ar_1 = require("../../ar/raw-ar");
|
|
8
6
|
const util_1 = require("../../util/util");
|
|
9
7
|
const plattar_controller_1 = require("./plattar-controller");
|
|
8
|
+
const configurator_ar_1 = require("../../ar/configurator-ar");
|
|
10
9
|
/**
|
|
11
10
|
* Manages an instance of the <plattar-configurator> HTML Element
|
|
12
11
|
*/
|
|
13
12
|
class VTOController extends plattar_controller_1.PlattarController {
|
|
14
|
-
constructor(
|
|
15
|
-
super(
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this._cachedConfigState = null;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
async getConfiguratorState() {
|
|
18
|
+
if (this._cachedConfigState) {
|
|
19
|
+
return this._cachedConfigState;
|
|
20
|
+
}
|
|
21
|
+
this._cachedConfigState = this.createConfiguratorState();
|
|
22
|
+
return this._cachedConfigState;
|
|
23
|
+
}
|
|
24
|
+
async onAttributesUpdated(attributeName) {
|
|
18
25
|
const state = this._state;
|
|
26
|
+
if (state === plattar_controller_1.ControllerState.Renderer) {
|
|
27
|
+
const viewer = this.element;
|
|
28
|
+
if (viewer) {
|
|
29
|
+
if (attributeName === "variation-id") {
|
|
30
|
+
const variationIDs = this.getAttribute("variation-id");
|
|
31
|
+
const variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
32
|
+
if (variationIDsList.length > 0) {
|
|
33
|
+
await viewer.messenger.selectVariationID(variationIDsList);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (attributeName === "variation-sku") {
|
|
37
|
+
const variationSKUs = this.getAttribute("variation-sku");
|
|
38
|
+
const variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
39
|
+
if (variationSKUList.length > 0) {
|
|
40
|
+
await viewer.messenger.selectVariationSKU(variationSKUList);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
19
46
|
// re-render the QR Code when attributes have changed
|
|
20
47
|
if (state === plattar_controller_1.ControllerState.QRCode) {
|
|
48
|
+
if (attributeName === "variation-id") {
|
|
49
|
+
const configState = await this.getConfiguratorState();
|
|
50
|
+
const variationIDs = this.getAttribute("variation-id");
|
|
51
|
+
const variationIDsList = variationIDs ? variationIDs.split(",") : [];
|
|
52
|
+
variationIDsList.forEach((variationID) => {
|
|
53
|
+
configState.state.setVariationID(variationID);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (attributeName === "variation-sku") {
|
|
57
|
+
const configState = await this.getConfiguratorState();
|
|
58
|
+
const variationSKUs = this.getAttribute("variation-sku");
|
|
59
|
+
const variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
|
|
60
|
+
variationSKUList.forEach((variationSKU) => {
|
|
61
|
+
configState.state.setVariationSKU(variationSKU);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
21
64
|
this.startQRCode(this._prevQROpt);
|
|
22
65
|
return;
|
|
23
66
|
}
|
|
24
67
|
}
|
|
25
|
-
startViewerQRCode(options) {
|
|
68
|
+
async startViewerQRCode(options) {
|
|
69
|
+
// remove the old renderer instance if any
|
|
70
|
+
this.removeRenderer();
|
|
71
|
+
const sceneID = this.getAttribute("scene-id");
|
|
72
|
+
if (!sceneID) {
|
|
73
|
+
throw new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
|
|
74
|
+
}
|
|
75
|
+
const opt = options || this._GetDefaultQROptions();
|
|
76
|
+
const viewer = document.createElement("plattar-qrcode");
|
|
77
|
+
this._element = viewer;
|
|
78
|
+
// required attributes with defaults for plattar-viewer node
|
|
79
|
+
const width = this.getAttribute("width") || "500px";
|
|
80
|
+
const height = this.getAttribute("height") || "500px";
|
|
81
|
+
viewer.setAttribute("width", width);
|
|
82
|
+
viewer.setAttribute("height", height);
|
|
83
|
+
if (opt.color) {
|
|
84
|
+
viewer.setAttribute("color", opt.color);
|
|
85
|
+
}
|
|
86
|
+
if (opt.margin) {
|
|
87
|
+
viewer.setAttribute("margin", "" + opt.margin);
|
|
88
|
+
}
|
|
89
|
+
if (opt.qrType) {
|
|
90
|
+
viewer.setAttribute("qr-type", opt.qrType);
|
|
91
|
+
}
|
|
92
|
+
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
93
|
+
let dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
|
|
94
|
+
// optional attributes
|
|
95
|
+
let configState = null;
|
|
96
|
+
try {
|
|
97
|
+
configState = await this.getConfiguratorState();
|
|
98
|
+
}
|
|
99
|
+
catch (_err) {
|
|
100
|
+
// config state is not available
|
|
101
|
+
configState = null;
|
|
102
|
+
}
|
|
103
|
+
const showAR = this.getAttribute("show-ar");
|
|
104
|
+
const productID = this.getAttribute("product-id");
|
|
105
|
+
const sceneProductID = this.getAttribute("scene-product-id");
|
|
106
|
+
const variationID = this.getAttribute("variation-id");
|
|
107
|
+
if (configState) {
|
|
108
|
+
dst += "&config_state=" + configState.state.encode();
|
|
109
|
+
}
|
|
110
|
+
if (showAR) {
|
|
111
|
+
dst += "&show_ar=" + showAR;
|
|
112
|
+
}
|
|
113
|
+
if (productID) {
|
|
114
|
+
dst += "&product_id=" + productID;
|
|
115
|
+
}
|
|
116
|
+
if (sceneProductID) {
|
|
117
|
+
dst += "&scene_product_id=" + sceneProductID;
|
|
118
|
+
}
|
|
119
|
+
if (variationID) {
|
|
120
|
+
dst += "&variation_id=" + variationID;
|
|
121
|
+
}
|
|
122
|
+
viewer.setAttribute("url", opt.url || dst);
|
|
123
|
+
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
124
|
+
this._prevQROpt = opt;
|
|
26
125
|
return new Promise((accept, reject) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const opt = options || this._GetDefaultQROptions();
|
|
32
|
-
const viewer = document.createElement("plattar-qrcode");
|
|
33
|
-
// required attributes with defaults for plattar-viewer node
|
|
34
|
-
const width = this.getAttribute("width") || "500px";
|
|
35
|
-
const height = this.getAttribute("height") || "500px";
|
|
36
|
-
viewer.setAttribute("width", width);
|
|
37
|
-
viewer.setAttribute("height", height);
|
|
38
|
-
if (opt.color) {
|
|
39
|
-
viewer.setAttribute("color", opt.color);
|
|
40
|
-
}
|
|
41
|
-
if (opt.margin) {
|
|
42
|
-
viewer.setAttribute("margin", "" + opt.margin);
|
|
43
|
-
}
|
|
44
|
-
if (opt.qrType) {
|
|
45
|
-
viewer.setAttribute("qr-type", opt.qrType);
|
|
46
|
-
}
|
|
47
|
-
viewer.setAttribute("shorten", (opt.shorten && (opt.shorten === true || opt.shorten === "true")) ? "true" : "false");
|
|
48
|
-
let dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
|
|
49
|
-
// optional attributes
|
|
50
|
-
const configState = this.getAttribute("config-state");
|
|
51
|
-
const showAR = this.getAttribute("show-ar");
|
|
52
|
-
const productID = this.getAttribute("product-id");
|
|
53
|
-
const sceneProductID = this.getAttribute("scene-product-id");
|
|
54
|
-
const variationID = this.getAttribute("variation-id");
|
|
55
|
-
if (configState) {
|
|
56
|
-
dst += "&config_state=" + configState;
|
|
57
|
-
}
|
|
58
|
-
if (showAR) {
|
|
59
|
-
dst += "&show_ar=" + showAR;
|
|
60
|
-
}
|
|
61
|
-
if (productID) {
|
|
62
|
-
dst += "&product_id=" + productID;
|
|
63
|
-
}
|
|
64
|
-
if (sceneProductID) {
|
|
65
|
-
dst += "&scene_product_id=" + sceneProductID;
|
|
66
|
-
}
|
|
67
|
-
if (variationID) {
|
|
68
|
-
dst += "&variation_id=" + variationID;
|
|
69
|
-
}
|
|
70
|
-
viewer.setAttribute("url", opt.url || dst);
|
|
71
|
-
viewer.onload = () => {
|
|
72
|
-
return accept(viewer);
|
|
73
|
-
};
|
|
74
|
-
this.append(viewer);
|
|
75
|
-
this._element = viewer;
|
|
76
|
-
this._state = plattar_controller_1.ControllerState.QRCode;
|
|
77
|
-
this._prevQROpt = opt;
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
return reject(new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
|
|
126
|
+
viewer.onload = () => {
|
|
127
|
+
return accept(viewer);
|
|
128
|
+
};
|
|
129
|
+
this.append(viewer);
|
|
81
130
|
});
|
|
82
131
|
}
|
|
83
|
-
startRenderer() {
|
|
132
|
+
async startRenderer() {
|
|
133
|
+
// remove the old renderer instance if any
|
|
134
|
+
this.removeRenderer();
|
|
135
|
+
const sceneID = this.getAttribute("scene-id");
|
|
136
|
+
if (!sceneID) {
|
|
137
|
+
throw new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
|
|
138
|
+
}
|
|
139
|
+
// required attributes with defaults for plattar-facear node
|
|
140
|
+
const width = this.getAttribute("width") || "500px";
|
|
141
|
+
const height = this.getAttribute("height") || "500px";
|
|
142
|
+
const server = this.getAttribute("server") || "production";
|
|
143
|
+
const viewer = document.createElement("plattar-facear");
|
|
144
|
+
this._element = viewer;
|
|
145
|
+
viewer.setAttribute("width", width);
|
|
146
|
+
viewer.setAttribute("height", height);
|
|
147
|
+
viewer.setAttribute("server", server);
|
|
148
|
+
viewer.setAttribute("scene-id", sceneID);
|
|
149
|
+
// optional attributes
|
|
150
|
+
let configState = null;
|
|
151
|
+
try {
|
|
152
|
+
configState = await this.getConfiguratorState();
|
|
153
|
+
}
|
|
154
|
+
catch (_err) {
|
|
155
|
+
// config state not available
|
|
156
|
+
configState = null;
|
|
157
|
+
}
|
|
158
|
+
const showAR = this.getAttribute("show-ar");
|
|
159
|
+
const productID = this.getAttribute("product-id");
|
|
160
|
+
const sceneProductID = this.getAttribute("scene-product-id");
|
|
161
|
+
const variationID = this.getAttribute("variation-id");
|
|
162
|
+
if (configState) {
|
|
163
|
+
viewer.setAttribute("config-state", configState.state.encode());
|
|
164
|
+
}
|
|
165
|
+
if (showAR) {
|
|
166
|
+
viewer.setAttribute("show-ar", showAR);
|
|
167
|
+
}
|
|
168
|
+
if (productID) {
|
|
169
|
+
viewer.setAttribute("product-id", productID);
|
|
170
|
+
}
|
|
171
|
+
if (sceneProductID) {
|
|
172
|
+
viewer.setAttribute("scene-product-id", sceneProductID);
|
|
173
|
+
}
|
|
174
|
+
if (variationID) {
|
|
175
|
+
viewer.setAttribute("variation-id", variationID);
|
|
176
|
+
}
|
|
177
|
+
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
84
178
|
return new Promise((accept, reject) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (sceneID) {
|
|
89
|
-
// required attributes with defaults for plattar-facear node
|
|
90
|
-
const width = this.getAttribute("width") || "500px";
|
|
91
|
-
const height = this.getAttribute("height") || "500px";
|
|
92
|
-
const server = this.getAttribute("server") || "production";
|
|
93
|
-
const viewer = document.createElement("plattar-facear");
|
|
94
|
-
viewer.setAttribute("width", width);
|
|
95
|
-
viewer.setAttribute("height", height);
|
|
96
|
-
viewer.setAttribute("server", server);
|
|
97
|
-
viewer.setAttribute("scene-id", sceneID);
|
|
98
|
-
// optional attributes
|
|
99
|
-
const configState = this.getAttribute("config-state");
|
|
100
|
-
const showAR = this.getAttribute("show-ar");
|
|
101
|
-
const productID = this.getAttribute("product-id");
|
|
102
|
-
const sceneProductID = this.getAttribute("scene-product-id");
|
|
103
|
-
const variationID = this.getAttribute("variation-id");
|
|
104
|
-
if (configState) {
|
|
105
|
-
viewer.setAttribute("config-state", configState);
|
|
106
|
-
}
|
|
107
|
-
if (showAR) {
|
|
108
|
-
viewer.setAttribute("show-ar", showAR);
|
|
109
|
-
}
|
|
110
|
-
if (productID) {
|
|
111
|
-
viewer.setAttribute("product-id", productID);
|
|
112
|
-
}
|
|
113
|
-
if (sceneProductID) {
|
|
114
|
-
viewer.setAttribute("scene-product-id", sceneProductID);
|
|
115
|
-
}
|
|
116
|
-
if (variationID) {
|
|
117
|
-
viewer.setAttribute("variation-id", variationID);
|
|
118
|
-
}
|
|
119
|
-
viewer.onload = () => {
|
|
120
|
-
return accept(viewer);
|
|
121
|
-
};
|
|
122
|
-
this.append(viewer);
|
|
123
|
-
this._element = viewer;
|
|
124
|
-
this._state = plattar_controller_1.ControllerState.Renderer;
|
|
125
|
-
return;
|
|
179
|
+
this.append(viewer);
|
|
180
|
+
if (configState) {
|
|
181
|
+
this.setupMessengerObservers(viewer, configState);
|
|
126
182
|
}
|
|
127
|
-
return
|
|
183
|
+
return accept(viewer);
|
|
128
184
|
});
|
|
129
185
|
}
|
|
130
|
-
initAR() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
this._InitARGenerated(accept, reject);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
186
|
+
async initAR() {
|
|
187
|
+
if (!util_1.Util.canAugment()) {
|
|
188
|
+
throw new Error("VTOController.initAR() - cannot proceed as VTO AR not available in context");
|
|
189
|
+
}
|
|
190
|
+
if (!(util_1.Util.isSafari() || util_1.Util.isChromeOnIOS())) {
|
|
191
|
+
throw new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices");
|
|
192
|
+
}
|
|
193
|
+
const arMode = this.getAttribute("ar-mode") || "generated";
|
|
194
|
+
switch (arMode.toLowerCase()) {
|
|
195
|
+
case "inherited":
|
|
196
|
+
return this._InitARInherited();
|
|
197
|
+
case "generated":
|
|
198
|
+
default:
|
|
199
|
+
return this._InitARGenerated();
|
|
200
|
+
}
|
|
148
201
|
}
|
|
149
202
|
/**
|
|
150
203
|
* Private Function - This launches the Static/Inherited AR Mode
|
|
151
204
|
*/
|
|
152
|
-
_InitARInherited(
|
|
205
|
+
async _InitARInherited() {
|
|
153
206
|
const sceneID = this.getAttribute("scene-id");
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
return reject(new Error("VTOController.initAR() - invalid config-state does not have any product states"));
|
|
165
|
-
}
|
|
166
|
-
// otherwise fallback to using scene
|
|
167
|
-
if (sceneID) {
|
|
168
|
-
__1.ConfiguratorState.decodeScene(sceneID).then((state) => {
|
|
169
|
-
const first = state.first();
|
|
170
|
-
if (first) {
|
|
171
|
-
const sceneProductAR = new __1.SceneProductAR(first.scene_product_id, first.product_variation_id);
|
|
172
|
-
return sceneProductAR.init().then(accept).catch(reject);
|
|
173
|
-
}
|
|
174
|
-
return reject(new Error("VTOController.initAR() - invalid Scene does not have any product states"));
|
|
175
|
-
}).catch(reject);
|
|
176
|
-
return;
|
|
207
|
+
if (!sceneID) {
|
|
208
|
+
throw new Error("VTOController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
|
|
209
|
+
}
|
|
210
|
+
const state = (await this.getConfiguratorState()).state;
|
|
211
|
+
const first = state.first();
|
|
212
|
+
if (first) {
|
|
213
|
+
const sceneProductAR = new __1.SceneProductAR(first.scene_product_id, first.product_variation_id);
|
|
214
|
+
return sceneProductAR.init();
|
|
177
215
|
}
|
|
178
|
-
|
|
216
|
+
throw new Error("VTOController.initAR() - invalid decoded config-state does not have any product states");
|
|
179
217
|
}
|
|
180
218
|
/**
|
|
181
219
|
* Private Function - This launches the Dynamic/Generated AR Mode
|
|
182
220
|
*/
|
|
183
|
-
_InitARGenerated(
|
|
184
|
-
// if scene ID is available and the state is a configurator viewer
|
|
185
|
-
// we can use the real-time configurator state to launch the AR view
|
|
186
|
-
const viewer = this.element;
|
|
221
|
+
async _InitARGenerated() {
|
|
187
222
|
const sceneID = this.getAttribute("scene-id");
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
const rawAR = new raw_ar_1.RawAR(result.filename);
|
|
191
|
-
return rawAR.init().then(accept).catch(reject);
|
|
192
|
-
}).catch(reject);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
const configState = this.getAttribute("config-state");
|
|
196
|
-
// otherwise scene ID is available to the viewer is not launched
|
|
197
|
-
// we can use the static configuration state to launch the AR view
|
|
198
|
-
if (sceneID && configState) {
|
|
199
|
-
const state = __1.ConfiguratorState.decode(configState);
|
|
200
|
-
if (state.length > 0) {
|
|
201
|
-
const server = this.getAttribute("server") || "production";
|
|
202
|
-
const configurator = new plattar_services_1.Configurator();
|
|
203
|
-
configurator.server = server;
|
|
204
|
-
configurator.output = "vto";
|
|
205
|
-
state.forEach((productState) => {
|
|
206
|
-
if (productState.meta_data.augment === true) {
|
|
207
|
-
configurator.addSceneProduct(productState.scene_product_id, productState.product_variation_id);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
configurator.get().then((result) => {
|
|
211
|
-
const rawAR = new raw_ar_1.RawAR(result.filename);
|
|
212
|
-
rawAR.init().then(accept).catch(reject);
|
|
213
|
-
}).catch(reject);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
return reject(new Error("VTOController.initAR() - invalid config-state does not have any product states"));
|
|
217
|
-
}
|
|
218
|
-
// otherwise no config-state or viewer is active
|
|
219
|
-
// fallback to using default SceneAR implementation
|
|
220
|
-
if (sceneID) {
|
|
221
|
-
const productID = this.getAttribute("product-id");
|
|
222
|
-
const sceneProductID = this.getAttribute("scene-product-id");
|
|
223
|
-
const variationID = this.getAttribute("variation-id");
|
|
224
|
-
const sceneAR = new __1.SceneAR(sceneID, {
|
|
225
|
-
productID: productID ? productID : undefined,
|
|
226
|
-
sceneProductID: sceneProductID ? sceneProductID : undefined,
|
|
227
|
-
variationID: variationID ? variationID : undefined
|
|
228
|
-
});
|
|
229
|
-
sceneAR.init().then(accept).catch(reject);
|
|
230
|
-
return;
|
|
223
|
+
if (!sceneID) {
|
|
224
|
+
throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
|
|
231
225
|
}
|
|
232
|
-
|
|
226
|
+
const configAR = new configurator_ar_1.ConfiguratorAR(await this.getConfiguratorState());
|
|
227
|
+
return configAR.init();
|
|
233
228
|
}
|
|
234
229
|
removeRenderer() {
|
|
235
230
|
if (this._element) {
|
|
@@ -237,6 +232,7 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
237
232
|
this._element = null;
|
|
238
233
|
return true;
|
|
239
234
|
}
|
|
235
|
+
this.removeMessengerObservers();
|
|
240
236
|
return false;
|
|
241
237
|
}
|
|
242
238
|
get element() {
|
|
@@ -6,9 +6,32 @@ import { LauncherAR } from "../ar/launcher-ar";
|
|
|
6
6
|
export default class PlattarEmbed extends HTMLElement {
|
|
7
7
|
private _currentType;
|
|
8
8
|
private _controller;
|
|
9
|
+
private _currentSceneID;
|
|
10
|
+
private _observer;
|
|
9
11
|
constructor();
|
|
10
12
|
get viewer(): HTMLElement | null;
|
|
13
|
+
/**
|
|
14
|
+
* Begin observing all changes to this DOM element
|
|
15
|
+
*/
|
|
11
16
|
connectedCallback(): void;
|
|
17
|
+
/**
|
|
18
|
+
* creates a brand new instance of this embed
|
|
19
|
+
*/
|
|
20
|
+
create(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Destroys the active instance of this embed and resets internal state to default
|
|
23
|
+
*/
|
|
24
|
+
destroy(): void;
|
|
25
|
+
/**
|
|
26
|
+
* this is only used for backwards-compatible legacy embed types typically
|
|
27
|
+
* embedding products with variations (without a scene-id)
|
|
28
|
+
*/
|
|
29
|
+
private _CreateLegacyEmbed;
|
|
30
|
+
/**
|
|
31
|
+
* creates the embed
|
|
32
|
+
* this can also be called when attributes/state changes so embeds can be re-loaded
|
|
33
|
+
*/
|
|
34
|
+
private _CreateEmbed;
|
|
12
35
|
initAR(): Promise<LauncherAR>;
|
|
13
36
|
startAR(): Promise<void>;
|
|
14
37
|
startViewer(): Promise<HTMLElement>;
|