@plattar/plattar-ar-adapter 1.167.2 → 1.167.3

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.
@@ -1885,7 +1885,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1885
1885
  key: "removeRenderer",
1886
1886
  value: function removeRenderer() {
1887
1887
  if (this._element) {
1888
- this._element.remove();
1888
+ this.removeChild(this._element);
1889
1889
  this._element = null;
1890
1890
  return true;
1891
1891
  }
@@ -2286,6 +2286,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2286
2286
  });
2287
2287
  shadow.append(element);
2288
2288
  }
2289
+ /**
2290
+ *
2291
+ * @param element
2292
+ */
2293
+ }, {
2294
+ key: "removeChild",
2295
+ value: function removeChild(element) {
2296
+ var shadow = this.parent.shadowRoot;
2297
+ if (shadow) {
2298
+ shadow.removeChild(element);
2299
+ }
2300
+ }
2289
2301
  }]);
2290
2302
  return PlattarController;
2291
2303
  }();
@@ -2573,7 +2585,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2573
2585
  key: "removeRenderer",
2574
2586
  value: function removeRenderer() {
2575
2587
  if (this._element) {
2576
- this._element.remove();
2588
+ this.removeChild(this._element);
2577
2589
  this._element = null;
2578
2590
  return true;
2579
2591
  }
@@ -3038,7 +3050,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3038
3050
  key: "removeRenderer",
3039
3051
  value: function removeRenderer() {
3040
3052
  if (this._element) {
3041
- this._element.remove();
3053
+ this.removeChild(this._element);
3042
3054
  this._element = null;
3043
3055
  return true;
3044
3056
  }
@@ -3104,6 +3116,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3104
3116
  _this25._observerState = ObserverState.Unlocked;
3105
3117
  _this25._controller = null;
3106
3118
  _this25._currentSceneID = null;
3119
+ _this25._currentServer = null;
3107
3120
  _this25._observer = null;
3108
3121
  return _this25;
3109
3122
  }
@@ -3127,9 +3140,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3127
3140
  key: "create",
3128
3141
  value: function create() {
3129
3142
  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
3143
  if (!this._observer) {
3134
3144
  this._observer = new MutationObserver(function (mutations) {
3135
3145
  if (_this26._observerState === ObserverState.Unlocked) {
@@ -3193,6 +3203,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3193
3203
  }, {
3194
3204
  key: "_CreateLegacyEmbed",
3195
3205
  value: function _CreateLegacyEmbed() {
3206
+ // server cannot be changed once its set - defaults to production
3207
+ var server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3208
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
3196
3209
  this._controller = new product_controller_1.ProductController(this);
3197
3210
  var init = this.hasAttribute("init") ? this.getAttribute("init") : null;
3198
3211
  switch (init) {
@@ -3211,6 +3224,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
3211
3224
  }, {
3212
3225
  key: "_CreateEmbed",
3213
3226
  value: function _CreateEmbed(attributeName) {
3227
+ // check if controller needs to be destroyed due to server change
3228
+ var serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
3229
+ if (this._currentServer !== serverAttribute) {
3230
+ this._currentSceneID = serverAttribute || "production";
3231
+ // reset the controller if any
3232
+ if (this._controller) {
3233
+ this._controller.removeRenderer();
3234
+ this._controller = null;
3235
+ }
3236
+ }
3237
+ plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
3214
3238
  var embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
3215
3239
  var currentEmbed = this._currentType;
3216
3240
  if (embedType) {
@@ -4188,7 +4212,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4188
4212
  Object.defineProperty(exports, "__esModule", {
4189
4213
  value: true
4190
4214
  });
4191
- exports["default"] = "1.167.2";
4215
+ exports["default"] = "1.167.3";
4192
4216
  }, {}],
4193
4217
  17: [function (require, module, exports) {
4194
4218
  "use strict";
@@ -9111,11 +9135,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
9111
9135
  var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
9112
9136
  if (shortenURL && shortenURL.toLowerCase() === "true") {
9113
9137
  this._ShortenURL(url).then(function (newURL) {
9114
- _this56._GenerateQRCode(newURL, width, height);
9138
+ // make sure by time promise is resolved that the original url hasn't been updated
9139
+ var updatedURL = _this56.hasAttribute("url") ? _this56.getAttribute("url") : undefined;
9140
+ if (updatedURL === url) {
9141
+ _this56._GenerateQRCode(newURL, width, height);
9142
+ }
9115
9143
  })["catch"](function (_err) {
9116
9144
  console.warn(_err);
9117
9145
  // ignore error and just generate normal QR Code
9118
- _this56._GenerateQRCode(url, width, height);
9146
+ // make sure by time promise is resolved that the original url hasn't been updated
9147
+ var updatedURL = _this56.hasAttribute("url") ? _this56.getAttribute("url") : undefined;
9148
+ if (updatedURL === url) {
9149
+ _this56._GenerateQRCode(url, width, height);
9150
+ }
9119
9151
  });
9120
9152
  } else {
9121
9153
  this._GenerateQRCode(url, width, height);
@@ -9261,7 +9293,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
9261
9293
  "./version": 111
9262
9294
  }],
9263
9295
  111: [function (require, module, exports) {
9264
- module.exports = "1.160.1";
9296
+ module.exports = "1.165.1";
9265
9297
  }, {}],
9266
9298
  112: [function (require, module, exports) {
9267
9299
  "use strict";
@@ -10566,8 +10598,10 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
10566
10598
  module.exports = Util;
10567
10599
  }, {}],
10568
10600
  131: [function (require, module, exports) {
10569
- module.exports = "1.165.1";
10570
- }, {}],
10601
+ arguments[4][111][0].apply(exports, arguments);
10602
+ }, {
10603
+ "dup": 111
10604
+ }],
10571
10605
  132: [function (require, module, exports) {
10572
10606
  (function (global) {
10573
10607
  (function () {