@plattar/plattar-ar-adapter 1.167.5 → 1.167.6

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.
@@ -20,5 +20,6 @@ export declare class ConfiguratorController extends PlattarController {
20
20
  * Private Function - This launches the Dynamic/Generated AR Mode
21
21
  */
22
22
  private _InitARGenerated;
23
+ removeRenderer(): boolean;
23
24
  get element(): HTMLElement | null;
24
25
  }
@@ -293,6 +293,15 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
293
293
  const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
294
294
  return configAR.init();
295
295
  }
296
+ removeRenderer() {
297
+ if (this._element) {
298
+ this._element.remove();
299
+ this._element = null;
300
+ return true;
301
+ }
302
+ this.removeMessengerObservers();
303
+ return false;
304
+ }
296
305
  get element() {
297
306
  return this._element;
298
307
  }
@@ -75,7 +75,7 @@ export declare abstract class PlattarController {
75
75
  /**
76
76
  * Removes the currently active renderer view from the DOM
77
77
  */
78
- removeRenderer(): boolean;
78
+ abstract removeRenderer(): boolean;
79
79
  /**
80
80
  * Get the underlying renderer component (if any)
81
81
  */
@@ -114,9 +114,4 @@ export declare abstract class PlattarController {
114
114
  * @param element - The element to append
115
115
  */
116
116
  append(element: HTMLElement): void;
117
- /**
118
- *
119
- * @param element
120
- */
121
- removeChild(element: HTMLElement): void;
122
117
  }
@@ -201,23 +201,6 @@ class PlattarController {
201
201
  };
202
202
  });
203
203
  }
204
- /**
205
- * Removes the currently active renderer view from the DOM
206
- */
207
- removeRenderer() {
208
- // remove all other children
209
- const shadow = this.parent.shadowRoot;
210
- if (shadow) {
211
- let child = shadow.lastElementChild;
212
- while (child) {
213
- shadow.removeChild(child);
214
- child = shadow.lastElementChild;
215
- }
216
- }
217
- this._element = null;
218
- this.removeMessengerObservers();
219
- return true;
220
- }
221
204
  /**
222
205
  * Returns the Parent Instance
223
206
  */
@@ -269,15 +252,5 @@ class PlattarController {
269
252
  const shadow = this.parent.shadowRoot || this.parent.attachShadow({ mode: 'open' });
270
253
  shadow.append(element);
271
254
  }
272
- /**
273
- *
274
- * @param element
275
- */
276
- removeChild(element) {
277
- const shadow = this.parent.shadowRoot;
278
- if (shadow) {
279
- shadow.removeChild(element);
280
- }
281
- }
282
255
  }
283
256
  exports.PlattarController = PlattarController;
@@ -19,5 +19,6 @@ export declare class ProductController extends PlattarController {
19
19
  startARQRCode(options: any): Promise<HTMLElement>;
20
20
  startRenderer(): Promise<HTMLElement>;
21
21
  initAR(): Promise<LauncherAR>;
22
+ removeRenderer(): boolean;
22
23
  get element(): HTMLElement | null;
23
24
  }
@@ -217,6 +217,14 @@ class ProductController extends plattar_controller_1.PlattarController {
217
217
  return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
218
218
  });
219
219
  }
220
+ removeRenderer() {
221
+ if (this._element) {
222
+ this._element.remove();
223
+ this._element = null;
224
+ return true;
225
+ }
226
+ return false;
227
+ }
220
228
  get element() {
221
229
  return this._element;
222
230
  }
@@ -19,5 +19,6 @@ export declare class VTOController extends PlattarController {
19
19
  * Private Function - This launches the Dynamic/Generated AR Mode
20
20
  */
21
21
  private _InitARGenerated;
22
+ removeRenderer(): boolean;
22
23
  get element(): HTMLElement | null;
23
24
  }
@@ -231,6 +231,15 @@ class VTOController extends plattar_controller_1.PlattarController {
231
231
  const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
232
232
  return configAR.init();
233
233
  }
234
+ removeRenderer() {
235
+ if (this._element) {
236
+ this._element.remove();
237
+ this._element = null;
238
+ return true;
239
+ }
240
+ this.removeMessengerObservers();
241
+ return false;
242
+ }
234
243
  get element() {
235
244
  return this._element;
236
245
  }
@@ -9,7 +9,6 @@ export default class PlattarEmbed extends HTMLElement {
9
9
  private _observerState;
10
10
  private _controller;
11
11
  private _currentSceneID;
12
- private _currentServer;
13
12
  private _observer;
14
13
  constructor();
15
14
  get viewer(): HTMLElement | null;
@@ -34,7 +34,6 @@ class PlattarEmbed extends HTMLElement {
34
34
  this._observerState = ObserverState.Unlocked;
35
35
  this._controller = null;
36
36
  this._currentSceneID = null;
37
- this._currentServer = null;
38
37
  this._observer = null;
39
38
  }
40
39
  get viewer() {
@@ -50,6 +49,9 @@ class PlattarEmbed extends HTMLElement {
50
49
  * creates a brand new instance of this embed
51
50
  */
52
51
  create() {
52
+ // server cannot be changed once its set - defaults to production
53
+ const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
54
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
53
55
  if (!this._observer) {
54
56
  this._observer = new MutationObserver((mutations) => {
55
57
  if (this._observerState === ObserverState.Unlocked) {
@@ -106,9 +108,6 @@ class PlattarEmbed extends HTMLElement {
106
108
  * embedding products with variations (without a scene-id)
107
109
  */
108
110
  _CreateLegacyEmbed() {
109
- // server cannot be changed once its set - defaults to production
110
- const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
111
- plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
112
111
  this._controller = new product_controller_1.ProductController(this);
113
112
  const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
114
113
  switch (init) {
@@ -125,17 +124,6 @@ class PlattarEmbed extends HTMLElement {
125
124
  * this can also be called when attributes/state changes so embeds can be re-loaded
126
125
  */
127
126
  _CreateEmbed(attributeName) {
128
- // check if controller needs to be destroyed due to server change
129
- const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
130
- if (this._currentServer !== serverAttribute) {
131
- this._currentSceneID = serverAttribute || "production";
132
- // reset the controller if any
133
- if (this._controller) {
134
- this._controller.removeRenderer();
135
- this._controller = null;
136
- }
137
- }
138
- plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
139
127
  const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
140
128
  const currentEmbed = this._currentType;
141
129
  if (embedType) {
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.167.5";
1
+ declare const _default: "1.167.6";
2
2
  export default _default;
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = "1.167.5";
3
+ exports.default = "1.167.6";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plattar/plattar-ar-adapter",
3
- "version": "1.167.5",
3
+ "version": "1.167.6",
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,16 +39,16 @@
39
39
  "dependencies": {
40
40
  "@plattar/plattar-analytics": "^1.152.2",
41
41
  "@plattar/plattar-api": "^1.159.1",
42
- "@plattar/plattar-qrcode": "1.165.1",
42
+ "@plattar/plattar-qrcode": "1.160.1",
43
43
  "@plattar/plattar-services": "^1.157.1",
44
- "@plattar/plattar-web": "^1.165.1"
44
+ "@plattar/plattar-web": "^1.154.3"
45
45
  },
46
46
  "devDependencies": {
47
- "@babel/cli": "^7.23.9",
48
- "@babel/core": "^7.23.9",
49
- "@babel/preset-env": "^7.23.9",
47
+ "@babel/cli": "^7.23.4",
48
+ "@babel/core": "^7.23.3",
49
+ "@babel/preset-env": "^7.23.3",
50
50
  "browserify": "^17.0.0",
51
- "typescript": "^5.3.3",
51
+ "typescript": "^5.3.2",
52
52
  "uglify-js": "^3.17.4"
53
53
  },
54
54
  "publishConfig": {