@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.
@@ -1263,6 +1263,15 @@ class ConfiguratorController extends plattar_controller_1.PlattarController {
1263
1263
  const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
1264
1264
  return configAR.init();
1265
1265
  }
1266
+ removeRenderer() {
1267
+ if (this._element) {
1268
+ this._element.remove();
1269
+ this._element = null;
1270
+ return true;
1271
+ }
1272
+ this.removeMessengerObservers();
1273
+ return false;
1274
+ }
1266
1275
  get element() {
1267
1276
  return this._element;
1268
1277
  }
@@ -1473,23 +1482,6 @@ class PlattarController {
1473
1482
  };
1474
1483
  });
1475
1484
  }
1476
- /**
1477
- * Removes the currently active renderer view from the DOM
1478
- */
1479
- removeRenderer() {
1480
- // remove all other children
1481
- const shadow = this.parent.shadowRoot;
1482
- if (shadow) {
1483
- let child = shadow.lastElementChild;
1484
- while (child) {
1485
- shadow.removeChild(child);
1486
- child = shadow.lastElementChild;
1487
- }
1488
- }
1489
- this._element = null;
1490
- this.removeMessengerObservers();
1491
- return true;
1492
- }
1493
1485
  /**
1494
1486
  * Returns the Parent Instance
1495
1487
  */
@@ -1541,16 +1533,6 @@ class PlattarController {
1541
1533
  const shadow = this.parent.shadowRoot || this.parent.attachShadow({ mode: 'open' });
1542
1534
  shadow.append(element);
1543
1535
  }
1544
- /**
1545
- *
1546
- * @param element
1547
- */
1548
- removeChild(element) {
1549
- const shadow = this.parent.shadowRoot;
1550
- if (shadow) {
1551
- shadow.removeChild(element);
1552
- }
1553
- }
1554
1536
  }
1555
1537
  exports.PlattarController = PlattarController;
1556
1538
 
@@ -1774,6 +1756,14 @@ class ProductController extends plattar_controller_1.PlattarController {
1774
1756
  return reject(new Error("ProductController.initAR() - minimum required attributes not set, use product-id as a minimum"));
1775
1757
  });
1776
1758
  }
1759
+ removeRenderer() {
1760
+ if (this._element) {
1761
+ this._element.remove();
1762
+ this._element = null;
1763
+ return true;
1764
+ }
1765
+ return false;
1766
+ }
1777
1767
  get element() {
1778
1768
  return this._element;
1779
1769
  }
@@ -2014,6 +2004,15 @@ class VTOController extends plattar_controller_1.PlattarController {
2014
2004
  const configAR = new configurator_ar_1.ConfiguratorAR({ state: await this.getConfiguratorState(), useARBanner: this.getBooleanAttribute("show-ar-banner") });
2015
2005
  return configAR.init();
2016
2006
  }
2007
+ removeRenderer() {
2008
+ if (this._element) {
2009
+ this._element.remove();
2010
+ this._element = null;
2011
+ return true;
2012
+ }
2013
+ this.removeMessengerObservers();
2014
+ return false;
2015
+ }
2017
2016
  get element() {
2018
2017
  return this._element;
2019
2018
  }
@@ -2057,7 +2056,6 @@ class PlattarEmbed extends HTMLElement {
2057
2056
  this._observerState = ObserverState.Unlocked;
2058
2057
  this._controller = null;
2059
2058
  this._currentSceneID = null;
2060
- this._currentServer = null;
2061
2059
  this._observer = null;
2062
2060
  }
2063
2061
  get viewer() {
@@ -2073,6 +2071,9 @@ class PlattarEmbed extends HTMLElement {
2073
2071
  * creates a brand new instance of this embed
2074
2072
  */
2075
2073
  create() {
2074
+ // server cannot be changed once its set - defaults to production
2075
+ const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2076
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
2076
2077
  if (!this._observer) {
2077
2078
  this._observer = new MutationObserver((mutations) => {
2078
2079
  if (this._observerState === ObserverState.Unlocked) {
@@ -2129,9 +2130,6 @@ class PlattarEmbed extends HTMLElement {
2129
2130
  * embedding products with variations (without a scene-id)
2130
2131
  */
2131
2132
  _CreateLegacyEmbed() {
2132
- // server cannot be changed once its set - defaults to production
2133
- const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2134
- plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
2135
2133
  this._controller = new product_controller_1.ProductController(this);
2136
2134
  const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
2137
2135
  switch (init) {
@@ -2148,17 +2146,6 @@ class PlattarEmbed extends HTMLElement {
2148
2146
  * this can also be called when attributes/state changes so embeds can be re-loaded
2149
2147
  */
2150
2148
  _CreateEmbed(attributeName) {
2151
- // check if controller needs to be destroyed due to server change
2152
- const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2153
- if (this._currentServer !== serverAttribute) {
2154
- this._currentSceneID = serverAttribute || "production";
2155
- // reset the controller if any
2156
- if (this._controller) {
2157
- this._controller.removeRenderer();
2158
- this._controller = null;
2159
- }
2160
- }
2161
- plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
2162
2149
  const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
2163
2150
  const currentEmbed = this._currentType;
2164
2151
  if (embedType) {
@@ -2832,7 +2819,7 @@ exports.Util = Util;
2832
2819
  },{}],16:[function(require,module,exports){
2833
2820
  "use strict";
2834
2821
  Object.defineProperty(exports, "__esModule", { value: true });
2835
- exports.default = "1.167.5";
2822
+ exports.default = "1.167.6";
2836
2823
 
2837
2824
  },{}],17:[function(require,module,exports){
2838
2825
  "use strict";
@@ -6783,21 +6770,11 @@ class BaseElement extends HTMLElement {
6783
6770
 
6784
6771
  if (shortenURL && shortenURL.toLowerCase() === "true") {
6785
6772
  this._ShortenURL(url).then((newURL) => {
6786
- // make sure by time promise is resolved that the original url hasn't been updated
6787
- const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
6788
-
6789
- if (updatedURL === url) {
6790
- this._GenerateQRCode(newURL, width, height);
6791
- }
6773
+ this._GenerateQRCode(newURL, width, height);
6792
6774
  }).catch((_err) => {
6793
6775
  console.warn(_err);
6794
6776
  // ignore error and just generate normal QR Code
6795
- // make sure by time promise is resolved that the original url hasn't been updated
6796
- const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
6797
-
6798
- if (updatedURL === url) {
6799
- this._GenerateQRCode(url, width, height);
6800
- }
6777
+ this._GenerateQRCode(url, width, height);
6801
6778
  });
6802
6779
  }
6803
6780
  else {
@@ -6947,7 +6924,7 @@ module.exports = {
6947
6924
  version: Version
6948
6925
  };
6949
6926
  },{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
6950
- module.exports = "1.165.1";
6927
+ module.exports = "1.160.1";
6951
6928
 
6952
6929
  },{}],112:[function(require,module,exports){
6953
6930
  "use strict";
@@ -8045,8 +8022,9 @@ class Util {
8045
8022
 
8046
8023
  module.exports = Util;
8047
8024
  },{}],131:[function(require,module,exports){
8048
- arguments[4][111][0].apply(exports,arguments)
8049
- },{"dup":111}],132:[function(require,module,exports){
8025
+ module.exports = "1.165.1";
8026
+
8027
+ },{}],132:[function(require,module,exports){
8050
8028
  (function (global){(function (){
8051
8029
  "use strict";
8052
8030