@plattar/plattar-ar-adapter 1.122.4 → 1.123.4

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 (35) hide show
  1. package/build/es2015/plattar-ar-adapter.js +2296 -1346
  2. package/build/es2015/plattar-ar-adapter.min.js +1 -1
  3. package/build/es2019/plattar-ar-adapter.js +1218 -560
  4. package/build/es2019/plattar-ar-adapter.min.js +9 -1
  5. package/dist/ar/launcher-ar.d.ts +8 -1
  6. package/dist/ar/launcher-ar.js +12 -0
  7. package/dist/ar/model-ar.d.ts +0 -5
  8. package/dist/ar/model-ar.js +1 -12
  9. package/dist/ar/product-ar.d.ts +1 -6
  10. package/dist/ar/product-ar.js +3 -14
  11. package/dist/ar/raw-ar.d.ts +0 -5
  12. package/dist/ar/raw-ar.js +0 -12
  13. package/dist/ar/scene-ar.d.ts +21 -1
  14. package/dist/ar/scene-ar.js +148 -5
  15. package/dist/embed/controllers/configurator-controller.d.ts +17 -0
  16. package/dist/embed/controllers/configurator-controller.js +178 -0
  17. package/dist/embed/controllers/plattar-controller.d.ts +62 -0
  18. package/dist/embed/controllers/plattar-controller.js +62 -0
  19. package/dist/embed/controllers/product-controller.d.ts +17 -0
  20. package/dist/embed/controllers/product-controller.js +133 -0
  21. package/dist/embed/controllers/viewer-controller.d.ts +17 -0
  22. package/dist/embed/controllers/viewer-controller.js +147 -0
  23. package/dist/embed/controllers/vto-controller.d.ts +17 -0
  24. package/dist/embed/controllers/vto-controller.js +169 -0
  25. package/dist/embed/plattar-embed.d.ts +7 -10
  26. package/dist/embed/plattar-embed.js +51 -346
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.js +3 -3
  29. package/dist/util/configurator-state.d.ts +26 -0
  30. package/dist/util/configurator-state.js +92 -0
  31. package/dist/version.d.ts +1 -1
  32. package/dist/version.js +1 -1
  33. package/package.json +6 -6
  34. package/dist/ar/configurator-ar.d.ts +0 -9
  35. package/dist/ar/configurator-ar.js +0 -19
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlattarController = exports.ControllerState = void 0;
4
+ var ControllerState;
5
+ (function (ControllerState) {
6
+ ControllerState[ControllerState["None"] = 0] = "None";
7
+ ControllerState[ControllerState["Renderer"] = 1] = "Renderer";
8
+ ControllerState[ControllerState["QRCode"] = 2] = "QRCode";
9
+ })(ControllerState = exports.ControllerState || (exports.ControllerState = {}));
10
+ /**
11
+ * All Plattar Controllers are derived from the same interface
12
+ */
13
+ class PlattarController {
14
+ constructor(parent) {
15
+ this._parent = parent;
16
+ }
17
+ /**
18
+ * Default QR Code rendering options
19
+ */
20
+ static get DEFAULT_QR_OPTIONS() {
21
+ return {
22
+ color: "#101721",
23
+ qrType: "default",
24
+ margin: 0
25
+ };
26
+ }
27
+ ;
28
+ /**
29
+ * Initialise and start AR mode if available
30
+ */
31
+ startAR() {
32
+ return new Promise((accept, reject) => {
33
+ this.initAR().then((launcher) => {
34
+ launcher.start();
35
+ accept();
36
+ }).catch(reject);
37
+ });
38
+ }
39
+ /**
40
+ * Returns the Parent Instance
41
+ */
42
+ get parent() {
43
+ return this._parent;
44
+ }
45
+ /**
46
+ * Returns the specified attribute from the parent
47
+ * @param attribute - The name of thhe attribute
48
+ * @returns - The attribute value or null
49
+ */
50
+ getAttribute(attribute) {
51
+ return this.parent ? (this.parent.hasAttribute(attribute) ? this.parent.getAttribute(attribute) : null) : null;
52
+ }
53
+ /**
54
+ * Appends the provided element into the shadow-root of the parent element
55
+ * @param element - The element to append
56
+ */
57
+ append(element) {
58
+ const shadow = this.parent.shadowRoot || this.parent.attachShadow({ mode: 'open' });
59
+ shadow.append(element);
60
+ }
61
+ }
62
+ exports.PlattarController = PlattarController;
@@ -0,0 +1,17 @@
1
+ import { LauncherAR } from "../../ar/launcher-ar";
2
+ import { PlattarController } from "./plattar-controller";
3
+ /**
4
+ * Manages an instance of the <plattar-product> HTML Element
5
+ */
6
+ export declare class ProductController extends PlattarController {
7
+ private _state;
8
+ private _element;
9
+ private _prevQROpt;
10
+ constructor(parent: HTMLElement);
11
+ onAttributesUpdated(): void;
12
+ startQRCode(options: any): Promise<HTMLElement>;
13
+ startRenderer(): Promise<HTMLElement>;
14
+ initAR(): Promise<LauncherAR>;
15
+ removeRenderer(): boolean;
16
+ get element(): HTMLElement | null;
17
+ }
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductController = void 0;
4
+ const plattar_api_1 = require("@plattar/plattar-api");
5
+ const product_ar_1 = require("../../ar/product-ar");
6
+ const util_1 = require("../../util/util");
7
+ const plattar_controller_1 = require("./plattar-controller");
8
+ /**
9
+ * Manages an instance of the <plattar-product> HTML Element
10
+ */
11
+ class ProductController extends plattar_controller_1.PlattarController {
12
+ constructor(parent) {
13
+ super(parent);
14
+ this._state = plattar_controller_1.ControllerState.None;
15
+ this._element = null;
16
+ this._prevQROpt = null;
17
+ }
18
+ onAttributesUpdated() {
19
+ const state = this._state;
20
+ // re-render the QR Code when attributes have changed
21
+ if (state === plattar_controller_1.ControllerState.QRCode) {
22
+ this.startQRCode(this._prevQROpt);
23
+ return;
24
+ }
25
+ // use the messenger function to change variation when attributes have changed
26
+ if (state === plattar_controller_1.ControllerState.Renderer) {
27
+ const viewer = this._element;
28
+ if (viewer) {
29
+ const variationID = this.getAttribute("variation-id");
30
+ viewer.messenger.selectVariation(variationID);
31
+ }
32
+ return;
33
+ }
34
+ }
35
+ startQRCode(options) {
36
+ return new Promise((accept, reject) => {
37
+ // remove the old renderer instance if any
38
+ this.removeRenderer();
39
+ const productID = this.getAttribute("product-id");
40
+ if (productID) {
41
+ const opt = options || plattar_controller_1.PlattarController.DEFAULT_QR_OPTIONS;
42
+ const viewer = document.createElement("plattar-qrcode");
43
+ // required attributes with defaults for plattar-viewer node
44
+ const width = this.getAttribute("width") || "500px";
45
+ const height = this.getAttribute("height") || "500px";
46
+ viewer.setAttribute("width", width);
47
+ viewer.setAttribute("height", height);
48
+ if (opt.color) {
49
+ viewer.setAttribute("color", opt.color);
50
+ }
51
+ if (opt.margin) {
52
+ viewer.setAttribute("margin", "" + opt.margin);
53
+ }
54
+ if (opt.qrType) {
55
+ viewer.setAttribute("qr-type", opt.qrType);
56
+ }
57
+ // optional attributes
58
+ const variationID = this.getAttribute("variation-id");
59
+ let dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + productID;
60
+ if (variationID) {
61
+ dst += "&variation_id=" + variationID;
62
+ }
63
+ viewer.setAttribute("url", opt.url || dst);
64
+ viewer.onload = () => {
65
+ return accept(viewer);
66
+ };
67
+ this.append(viewer);
68
+ this._element = viewer;
69
+ this._state = plattar_controller_1.ControllerState.QRCode;
70
+ this._prevQROpt = opt;
71
+ return;
72
+ }
73
+ return reject(new Error("ProductController.startQRCode() - minimum required attributes not set, use product-id as a minimum"));
74
+ });
75
+ }
76
+ startRenderer() {
77
+ return new Promise((accept, reject) => {
78
+ // remove the old renderer instance if any
79
+ this.removeRenderer();
80
+ const productID = this.getAttribute("product-id");
81
+ if (productID) {
82
+ // required attributes with defaults for plattar-product node
83
+ const width = this.getAttribute("width") || "500px";
84
+ const height = this.getAttribute("height") || "500px";
85
+ const server = this.getAttribute("server") || "production";
86
+ const viewer = document.createElement("plattar-product");
87
+ viewer.setAttribute("width", width);
88
+ viewer.setAttribute("height", height);
89
+ viewer.setAttribute("server", server);
90
+ viewer.setAttribute("product-id", productID);
91
+ // optional attributes
92
+ const variationID = this.getAttribute("variation-id");
93
+ if (variationID) {
94
+ viewer.setAttribute("variation-id", variationID);
95
+ }
96
+ viewer.onload = () => {
97
+ return accept(viewer);
98
+ };
99
+ this.append(viewer);
100
+ this._element = viewer;
101
+ this._state = plattar_controller_1.ControllerState.Renderer;
102
+ return;
103
+ }
104
+ return reject(new Error("ProductController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
105
+ });
106
+ }
107
+ initAR() {
108
+ return new Promise((accept, reject) => {
109
+ if (!util_1.Util.canAugment()) {
110
+ return reject(new Error("ProductController.initAR() - cannot proceed as AR not available in context"));
111
+ }
112
+ const productID = this.getAttribute("product-id");
113
+ if (productID) {
114
+ const variationID = this.getAttribute("variation-id");
115
+ const product = new product_ar_1.ProductAR(productID, variationID);
116
+ return product.init().then(accept).catch(reject);
117
+ }
118
+ return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
119
+ });
120
+ }
121
+ removeRenderer() {
122
+ if (this._element) {
123
+ this._element.remove();
124
+ this._element = null;
125
+ return true;
126
+ }
127
+ return false;
128
+ }
129
+ get element() {
130
+ return this._element;
131
+ }
132
+ }
133
+ exports.ProductController = ProductController;
@@ -0,0 +1,17 @@
1
+ import { LauncherAR } from "../../ar/launcher-ar";
2
+ import { PlattarController } from "./plattar-controller";
3
+ /**
4
+ * Manages an instance of the <plattar-viewer> HTML Element
5
+ */
6
+ export declare class ViewerController extends PlattarController {
7
+ private _state;
8
+ private _element;
9
+ private _prevQROpt;
10
+ constructor(parent: HTMLElement);
11
+ onAttributesUpdated(): void;
12
+ startQRCode(options: any): Promise<HTMLElement>;
13
+ startRenderer(): Promise<HTMLElement>;
14
+ initAR(): Promise<LauncherAR>;
15
+ removeRenderer(): boolean;
16
+ get element(): HTMLElement | null;
17
+ }
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewerController = void 0;
4
+ const plattar_api_1 = require("@plattar/plattar-api");
5
+ const product_ar_1 = require("../../ar/product-ar");
6
+ const util_1 = require("../../util/util");
7
+ const plattar_controller_1 = require("./plattar-controller");
8
+ /**
9
+ * Manages an instance of the <plattar-viewer> HTML Element
10
+ */
11
+ class ViewerController extends plattar_controller_1.PlattarController {
12
+ constructor(parent) {
13
+ super(parent);
14
+ this._state = plattar_controller_1.ControllerState.None;
15
+ this._element = null;
16
+ this._prevQROpt = null;
17
+ }
18
+ onAttributesUpdated() {
19
+ const state = this._state;
20
+ // re-render the QR Code when attributes have changed
21
+ if (state === plattar_controller_1.ControllerState.QRCode) {
22
+ this.startQRCode(this._prevQROpt);
23
+ return;
24
+ }
25
+ // use the messenger function to change variation when attributes have changed
26
+ if (state === plattar_controller_1.ControllerState.Renderer) {
27
+ const viewer = this._element;
28
+ if (viewer) {
29
+ const productID = this.getAttribute("product-id");
30
+ const variationID = this.getAttribute("variation-id");
31
+ viewer.messenger.selectVariation(productID, variationID);
32
+ }
33
+ return;
34
+ }
35
+ }
36
+ startQRCode(options) {
37
+ return new Promise((accept, reject) => {
38
+ // remove the old renderer instance if any
39
+ this.removeRenderer();
40
+ const sceneID = this.getAttribute("scene-id");
41
+ if (sceneID) {
42
+ const opt = options || plattar_controller_1.PlattarController.DEFAULT_QR_OPTIONS;
43
+ const viewer = document.createElement("plattar-qrcode");
44
+ // required attributes with defaults for plattar-viewer node
45
+ const width = this.getAttribute("width") || "500px";
46
+ const height = this.getAttribute("height") || "500px";
47
+ viewer.setAttribute("width", width);
48
+ viewer.setAttribute("height", height);
49
+ if (opt.color) {
50
+ viewer.setAttribute("color", opt.color);
51
+ }
52
+ if (opt.margin) {
53
+ viewer.setAttribute("margin", "" + opt.margin);
54
+ }
55
+ if (opt.qrType) {
56
+ viewer.setAttribute("qr-type", opt.qrType);
57
+ }
58
+ let dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + sceneID;
59
+ // optional attributes
60
+ const productID = this.getAttribute("product-id");
61
+ const variationID = this.getAttribute("variation-id");
62
+ if (productID) {
63
+ dst += "&productId=" + productID;
64
+ }
65
+ if (variationID) {
66
+ dst += "&variationId=" + variationID;
67
+ }
68
+ viewer.setAttribute("url", opt.url || dst);
69
+ viewer.onload = () => {
70
+ return accept(viewer);
71
+ };
72
+ this.append(viewer);
73
+ this._element = viewer;
74
+ this._state = plattar_controller_1.ControllerState.QRCode;
75
+ this._prevQROpt = opt;
76
+ return;
77
+ }
78
+ return reject(new Error("ViewerController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
79
+ });
80
+ }
81
+ startRenderer() {
82
+ return new Promise((accept, reject) => {
83
+ // remove the old renderer instance if any
84
+ this.removeRenderer();
85
+ const sceneID = this.getAttribute("scene-id");
86
+ if (sceneID) {
87
+ // required attributes with defaults for plattar-viewer node
88
+ const width = this.getAttribute("width") || "500px";
89
+ const height = this.getAttribute("height") || "500px";
90
+ const server = this.getAttribute("server") || "production";
91
+ const viewer = document.createElement("plattar-viewer");
92
+ viewer.setAttribute("width", width);
93
+ viewer.setAttribute("height", height);
94
+ viewer.setAttribute("server", server);
95
+ viewer.setAttribute("scene-id", sceneID);
96
+ // optional attributes
97
+ const productID = this.getAttribute("product-id");
98
+ const variationID = this.getAttribute("variation-id");
99
+ if (productID) {
100
+ viewer.setAttribute("product-id", productID);
101
+ }
102
+ if (variationID) {
103
+ viewer.setAttribute("variation-id", variationID);
104
+ }
105
+ viewer.onload = () => {
106
+ return accept(viewer);
107
+ };
108
+ this.append(viewer);
109
+ this._element = viewer;
110
+ this._state = plattar_controller_1.ControllerState.Renderer;
111
+ return;
112
+ }
113
+ return reject(new Error("ViewerController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
114
+ });
115
+ }
116
+ initAR() {
117
+ return new Promise((accept, reject) => {
118
+ if (!util_1.Util.canAugment()) {
119
+ return reject(new Error("ViewerController.initAR() - cannot proceed as AR not available in context"));
120
+ }
121
+ const productID = this.getAttribute("product-id");
122
+ if (productID) {
123
+ const variationID = this.getAttribute("variation-id");
124
+ const product = new product_ar_1.ProductAR(productID, variationID);
125
+ return product.init().then(accept).catch(reject);
126
+ }
127
+ const sceneID = this.getAttribute("scene-id");
128
+ // otherwise, scene was set so use SceneAR
129
+ if (sceneID) {
130
+ return reject(new Error("ViewerController.initAR() - AR mode for scene-id not yet supported, use product-id"));
131
+ }
132
+ return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id or product-id as a minimum"));
133
+ });
134
+ }
135
+ removeRenderer() {
136
+ if (this._element) {
137
+ this._element.remove();
138
+ this._element = null;
139
+ return true;
140
+ }
141
+ return false;
142
+ }
143
+ get element() {
144
+ return this._element;
145
+ }
146
+ }
147
+ exports.ViewerController = ViewerController;
@@ -0,0 +1,17 @@
1
+ import { LauncherAR } from "../../ar/launcher-ar";
2
+ import { PlattarController } from "./plattar-controller";
3
+ /**
4
+ * Manages an instance of the <plattar-configurator> HTML Element
5
+ */
6
+ export declare class VTOController extends PlattarController {
7
+ private _state;
8
+ private _element;
9
+ private _prevQROpt;
10
+ constructor(parent: HTMLElement);
11
+ onAttributesUpdated(): void;
12
+ startQRCode(options: any): Promise<HTMLElement>;
13
+ startRenderer(): Promise<HTMLElement>;
14
+ initAR(): Promise<LauncherAR>;
15
+ removeRenderer(): boolean;
16
+ get element(): HTMLElement | null;
17
+ }
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VTOController = void 0;
4
+ const plattar_api_1 = require("@plattar/plattar-api");
5
+ const plattar_services_1 = require("@plattar/plattar-services");
6
+ const __1 = require("../..");
7
+ const raw_ar_1 = require("../../ar/raw-ar");
8
+ const util_1 = require("../../util/util");
9
+ const plattar_controller_1 = require("./plattar-controller");
10
+ /**
11
+ * Manages an instance of the <plattar-configurator> HTML Element
12
+ */
13
+ class VTOController extends plattar_controller_1.PlattarController {
14
+ constructor(parent) {
15
+ super(parent);
16
+ this._state = plattar_controller_1.ControllerState.None;
17
+ this._element = null;
18
+ this._prevQROpt = null;
19
+ }
20
+ onAttributesUpdated() {
21
+ const state = this._state;
22
+ // re-render the QR Code when attributes have changed
23
+ if (state === plattar_controller_1.ControllerState.QRCode) {
24
+ this.startQRCode(this._prevQROpt);
25
+ return;
26
+ }
27
+ }
28
+ startQRCode(options) {
29
+ return new Promise((accept, reject) => {
30
+ // remove the old renderer instance if any
31
+ this.removeRenderer();
32
+ const sceneID = this.getAttribute("scene-id");
33
+ if (sceneID) {
34
+ const opt = options || plattar_controller_1.PlattarController.DEFAULT_QR_OPTIONS;
35
+ const viewer = document.createElement("plattar-qrcode");
36
+ // required attributes with defaults for plattar-viewer node
37
+ const width = this.getAttribute("width") || "500px";
38
+ const height = this.getAttribute("height") || "500px";
39
+ viewer.setAttribute("width", width);
40
+ viewer.setAttribute("height", height);
41
+ if (opt.color) {
42
+ viewer.setAttribute("color", opt.color);
43
+ }
44
+ if (opt.margin) {
45
+ viewer.setAttribute("margin", "" + opt.margin);
46
+ }
47
+ if (opt.qrType) {
48
+ viewer.setAttribute("qr-type", opt.qrType);
49
+ }
50
+ let dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
51
+ // optional attributes
52
+ const configState = this.getAttribute("config-state");
53
+ const showAR = this.getAttribute("show-ar");
54
+ if (configState) {
55
+ dst += "&config_state=" + configState;
56
+ }
57
+ if (showAR) {
58
+ dst += "&show_ar=" + showAR;
59
+ }
60
+ viewer.setAttribute("url", opt.url || dst);
61
+ viewer.onload = () => {
62
+ return accept(viewer);
63
+ };
64
+ this.append(viewer);
65
+ this._element = viewer;
66
+ this._state = plattar_controller_1.ControllerState.QRCode;
67
+ this._prevQROpt = opt;
68
+ return;
69
+ }
70
+ return reject(new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
71
+ });
72
+ }
73
+ startRenderer() {
74
+ return new Promise((accept, reject) => {
75
+ // remove the old renderer instance if any
76
+ this.removeRenderer();
77
+ const sceneID = this.getAttribute("scene-id");
78
+ if (sceneID) {
79
+ // required attributes with defaults for plattar-facear node
80
+ const width = this.getAttribute("width") || "500px";
81
+ const height = this.getAttribute("height") || "500px";
82
+ const server = this.getAttribute("server") || "production";
83
+ const viewer = document.createElement("plattar-facear");
84
+ viewer.setAttribute("width", width);
85
+ viewer.setAttribute("height", height);
86
+ viewer.setAttribute("server", server);
87
+ viewer.setAttribute("scene-id", sceneID);
88
+ // optional attributes
89
+ const configState = this.getAttribute("config-state");
90
+ const showAR = this.getAttribute("show-ar");
91
+ if (configState) {
92
+ viewer.setAttribute("config-state", configState);
93
+ }
94
+ if (showAR) {
95
+ viewer.setAttribute("show-ar", showAR);
96
+ }
97
+ viewer.onload = () => {
98
+ return accept(viewer);
99
+ };
100
+ this.append(viewer);
101
+ this._element = viewer;
102
+ this._state = plattar_controller_1.ControllerState.Renderer;
103
+ return;
104
+ }
105
+ return reject(new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
106
+ });
107
+ }
108
+ initAR() {
109
+ return new Promise((accept, reject) => {
110
+ if (!util_1.Util.canAugment()) {
111
+ return reject(new Error("VTOController.initAR() - cannot proceed as VTO AR not available in context"));
112
+ }
113
+ if (!(util_1.Util.isSafari() || util_1.Util.isChromeOnIOS())) {
114
+ return reject(new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices"));
115
+ }
116
+ // if scene ID is available and the state is a configurator viewer
117
+ // we can use the real-time configurator state to launch the AR view
118
+ const viewer = this.element;
119
+ const sceneID = this.getAttribute("scene-id");
120
+ if (viewer && sceneID) {
121
+ return viewer.messenger.getARFile("vto").then((result) => {
122
+ const rawAR = new raw_ar_1.RawAR(result.filename);
123
+ return rawAR.init().then(accept).catch(reject);
124
+ }).catch(reject);
125
+ }
126
+ const configState = this.getAttribute("config-state");
127
+ // otherwise scene ID is available to the viewer is not launched
128
+ // we can use the static configuration state to launch the AR view
129
+ if (sceneID && configState) {
130
+ const state = __1.ConfiguratorState.decode(configState);
131
+ if (state.length > 0) {
132
+ const server = this.getAttribute("server") || "production";
133
+ const configurator = new plattar_services_1.Configurator();
134
+ configurator.server = server;
135
+ configurator.output = "vto";
136
+ state.forEach((productState) => {
137
+ if (productState.meta_data.augment === true) {
138
+ configurator.addSceneProduct(productState.scene_product_id, productState.product_variation_id);
139
+ }
140
+ });
141
+ return configurator.get().then((result) => {
142
+ const rawAR = new raw_ar_1.RawAR(result.filename);
143
+ rawAR.init().then(accept).catch(reject);
144
+ }).catch(reject);
145
+ }
146
+ return reject(new Error("VTOController.initAR() - invalid config-state does not have any product states"));
147
+ }
148
+ // otherwise no config-state or viewer is active
149
+ // fallback to using default SceneAR implementation
150
+ if (sceneID) {
151
+ const sceneAR = new __1.SceneAR(sceneID);
152
+ return sceneAR.init().then(accept).catch(reject);
153
+ }
154
+ return reject(new Error("VTOController.initAR() - minimum required attributes not set, use scene-id as a minimum"));
155
+ });
156
+ }
157
+ removeRenderer() {
158
+ if (this._element) {
159
+ this._element.remove();
160
+ this._element = null;
161
+ return true;
162
+ }
163
+ return false;
164
+ }
165
+ get element() {
166
+ return this._element;
167
+ }
168
+ }
169
+ exports.VTOController = VTOController;
@@ -4,17 +4,8 @@ import { LauncherAR } from "../ar/launcher-ar";
4
4
  * of Plattar related content
5
5
  */
6
6
  export default class PlattarEmbed extends HTMLElement {
7
- private _currentState;
8
7
  private _currentType;
9
- private _qrCodeOptions;
10
- private _sceneID;
11
- private _productID;
12
- private _variationID;
13
- private _width;
14
- private _height;
15
- private _isReady;
16
- private _server;
17
- private _viewer;
8
+ private _controller;
18
9
  constructor();
19
10
  get viewer(): HTMLElement | null;
20
11
  connectedCallback(): void;
@@ -22,6 +13,12 @@ export default class PlattarEmbed extends HTMLElement {
22
13
  startAR(): Promise<void>;
23
14
  startViewer(): Promise<HTMLElement>;
24
15
  startQRCode(options?: any | undefined | null): Promise<HTMLElement>;
16
+ /**
17
+ * This will remove the currently active Renderer
18
+ *
19
+ * @returns - true if removed successfully, false otherwise
20
+ */
21
+ removeRenderer(): boolean;
25
22
  /**
26
23
  * This is called by the observer if any of the embed attributes have changed
27
24
  * based on the state of the embed, we update the internal structure accordingly