@plattar/plattar-ar-adapter 1.167.4 → 1.167.5

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.
@@ -1881,17 +1881,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1881
1881
  }
1882
1882
  return _InitARGenerated;
1883
1883
  }())
1884
- }, {
1885
- key: "removeRenderer",
1886
- value: function removeRenderer() {
1887
- if (this._element) {
1888
- this._element.remove();
1889
- this._element = null;
1890
- return true;
1891
- }
1892
- this.removeMessengerObservers();
1893
- return false;
1894
- }
1895
1884
  }, {
1896
1885
  key: "element",
1897
1886
  get: function get() {
@@ -2220,9 +2209,28 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2220
2209
  return startARQRCode;
2221
2210
  }()
2222
2211
  /**
2223
- * Returns the Parent Instance
2212
+ * Removes the currently active renderer view from the DOM
2224
2213
  */
2225
2214
  )
2215
+ }, {
2216
+ key: "removeRenderer",
2217
+ value: function removeRenderer() {
2218
+ // remove all other children
2219
+ var shadow = this.parent.shadowRoot;
2220
+ if (shadow) {
2221
+ var child = shadow.lastElementChild;
2222
+ while (child) {
2223
+ shadow.removeChild(child);
2224
+ child = shadow.lastElementChild;
2225
+ }
2226
+ }
2227
+ this._element = null;
2228
+ this.removeMessengerObservers();
2229
+ return true;
2230
+ }
2231
+ /**
2232
+ * Returns the Parent Instance
2233
+ */
2226
2234
  }, {
2227
2235
  key: "parent",
2228
2236
  get: function get() {
@@ -2286,6 +2294,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2286
2294
  });
2287
2295
  shadow.append(element);
2288
2296
  }
2297
+ /**
2298
+ *
2299
+ * @param element
2300
+ */
2301
+ }, {
2302
+ key: "removeChild",
2303
+ value: function removeChild(element) {
2304
+ var shadow = this.parent.shadowRoot;
2305
+ if (shadow) {
2306
+ shadow.removeChild(element);
2307
+ }
2308
+ }
2289
2309
  }]);
2290
2310
  return PlattarController;
2291
2311
  }();
@@ -2569,16 +2589,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2569
2589
  return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
2570
2590
  });
2571
2591
  }
2572
- }, {
2573
- key: "removeRenderer",
2574
- value: function removeRenderer() {
2575
- if (this._element) {
2576
- this._element.remove();
2577
- this._element = null;
2578
- return true;
2579
- }
2580
- return false;
2581
- }
2582
2592
  }, {
2583
2593
  key: "element",
2584
2594
  get: function get() {
@@ -3034,17 +3044,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3034
3044
  }
3035
3045
  return _InitARGenerated;
3036
3046
  }())
3037
- }, {
3038
- key: "removeRenderer",
3039
- value: function removeRenderer() {
3040
- if (this._element) {
3041
- this._element.remove();
3042
- this._element = null;
3043
- return true;
3044
- }
3045
- this.removeMessengerObservers();
3046
- return false;
3047
- }
3048
3047
  }, {
3049
3048
  key: "element",
3050
3049
  get: function get() {
@@ -3104,6 +3103,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3104
3103
  _this25._observerState = ObserverState.Unlocked;
3105
3104
  _this25._controller = null;
3106
3105
  _this25._currentSceneID = null;
3106
+ _this25._currentServer = null;
3107
3107
  _this25._observer = null;
3108
3108
  return _this25;
3109
3109
  }
@@ -3127,9 +3127,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3127
3127
  key: "create",
3128
3128
  value: function create() {
3129
3129
  var _this26 = this;
3130
- // server cannot be changed once its set - defaults to production
3131
- var server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3132
- plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
3133
3130
  if (!this._observer) {
3134
3131
  this._observer = new MutationObserver(function (mutations) {
3135
3132
  if (_this26._observerState === ObserverState.Unlocked) {
@@ -3193,6 +3190,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3193
3190
  }, {
3194
3191
  key: "_CreateLegacyEmbed",
3195
3192
  value: function _CreateLegacyEmbed() {
3193
+ // server cannot be changed once its set - defaults to production
3194
+ var server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3195
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
3196
3196
  this._controller = new product_controller_1.ProductController(this);
3197
3197
  var init = this.hasAttribute("init") ? this.getAttribute("init") : null;
3198
3198
  switch (init) {
@@ -3211,6 +3211,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3211
3211
  }, {
3212
3212
  key: "_CreateEmbed",
3213
3213
  value: function _CreateEmbed(attributeName) {
3214
+ // check if controller needs to be destroyed due to server change
3215
+ var serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3216
+ if (this._currentServer !== serverAttribute) {
3217
+ this._currentSceneID = serverAttribute || "production";
3218
+ // reset the controller if any
3219
+ if (this._controller) {
3220
+ this._controller.removeRenderer();
3221
+ this._controller = null;
3222
+ }
3223
+ }
3224
+ plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
3214
3225
  var embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
3215
3226
  var currentEmbed = this._currentType;
3216
3227
  if (embedType) {
@@ -4188,7 +4199,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4188
4199
  Object.defineProperty(exports, "__esModule", {
4189
4200
  value: true
4190
4201
  });
4191
- exports["default"] = "1.167.4";
4202
+ exports["default"] = "1.167.5";
4192
4203
  }, {}],
4193
4204
  17: [function (require, module, exports) {
4194
4205
  "use strict";
@@ -9111,11 +9122,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
9111
9122
  var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
9112
9123
  if (shortenURL && shortenURL.toLowerCase() === "true") {
9113
9124
  this._ShortenURL(url).then(function (newURL) {
9114
- _this56._GenerateQRCode(newURL, width, height);
9125
+ // make sure by time promise is resolved that the original url hasn't been updated
9126
+ var updatedURL = _this56.hasAttribute("url") ? _this56.getAttribute("url") : undefined;
9127
+ if (updatedURL === url) {
9128
+ _this56._GenerateQRCode(newURL, width, height);
9129
+ }
9115
9130
  })["catch"](function (_err) {
9116
9131
  console.warn(_err);
9117
9132
  // ignore error and just generate normal QR Code
9118
- _this56._GenerateQRCode(url, width, height);
9133
+ // make sure by time promise is resolved that the original url hasn't been updated
9134
+ var updatedURL = _this56.hasAttribute("url") ? _this56.getAttribute("url") : undefined;
9135
+ if (updatedURL === url) {
9136
+ _this56._GenerateQRCode(url, width, height);
9137
+ }
9119
9138
  });
9120
9139
  } else {
9121
9140
  this._GenerateQRCode(url, width, height);
@@ -9261,7 +9280,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
9261
9280
  "./version": 111
9262
9281
  }],
9263
9282
  111: [function (require, module, exports) {
9264
- module.exports = "1.160.1";
9283
+ module.exports = "1.165.1";
9265
9284
  }, {}],
9266
9285
  112: [function (require, module, exports) {
9267
9286
  "use strict";
@@ -10566,8 +10585,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
10566
10585
  module.exports = Util;
10567
10586
  }, {}],
10568
10587
  131: [function (require, module, exports) {
10569
- module.exports = "1.165.1";
10570
- }, {}],
10588
+ arguments[4][111][0].apply(exports, arguments);
10589
+ }, {
10590
+ "dup": 111
10591
+ }],
10571
10592
  132: [function (require, module, exports) {
10572
10593
  (function (global) {
10573
10594
  (function () {