@plattar/plattar-ar-adapter 1.163.1 → 1.167.1

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.
@@ -2056,6 +2056,7 @@ class PlattarEmbed extends HTMLElement {
2056
2056
  this._observerState = ObserverState.Unlocked;
2057
2057
  this._controller = null;
2058
2058
  this._currentSceneID = null;
2059
+ this._currentServer = null;
2059
2060
  this._observer = null;
2060
2061
  }
2061
2062
  get viewer() {
@@ -2071,9 +2072,6 @@ class PlattarEmbed extends HTMLElement {
2071
2072
  * creates a brand new instance of this embed
2072
2073
  */
2073
2074
  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"));
2077
2075
  if (!this._observer) {
2078
2076
  this._observer = new MutationObserver((mutations) => {
2079
2077
  if (this._observerState === ObserverState.Unlocked) {
@@ -2130,6 +2128,9 @@ class PlattarEmbed extends HTMLElement {
2130
2128
  * embedding products with variations (without a scene-id)
2131
2129
  */
2132
2130
  _CreateLegacyEmbed() {
2131
+ // server cannot be changed once its set - defaults to production
2132
+ const server = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2133
+ plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
2133
2134
  this._controller = new product_controller_1.ProductController(this);
2134
2135
  const init = this.hasAttribute("init") ? this.getAttribute("init") : null;
2135
2136
  switch (init) {
@@ -2146,6 +2147,17 @@ class PlattarEmbed extends HTMLElement {
2146
2147
  * this can also be called when attributes/state changes so embeds can be re-loaded
2147
2148
  */
2148
2149
  _CreateEmbed(attributeName) {
2150
+ // check if controller needs to be destroyed due to server change
2151
+ const serverAttribute = this.hasAttribute("server") ? this.getAttribute("server") : "production";
2152
+ if (this._currentServer !== serverAttribute) {
2153
+ this._currentSceneID = serverAttribute || "production";
2154
+ // reset the controller if any
2155
+ if (this._controller) {
2156
+ this._controller.removeRenderer();
2157
+ this._controller = null;
2158
+ }
2159
+ }
2160
+ plattar_api_1.Server.create(plattar_api_1.Server.match(this._currentServer || "production"));
2149
2161
  const embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "configurator";
2150
2162
  const currentEmbed = this._currentType;
2151
2163
  if (embedType) {
@@ -2819,7 +2831,7 @@ exports.Util = Util;
2819
2831
  },{}],16:[function(require,module,exports){
2820
2832
  "use strict";
2821
2833
  Object.defineProperty(exports, "__esModule", { value: true });
2822
- exports.default = "1.163.1";
2834
+ exports.default = "1.167.1";
2823
2835
 
2824
2836
  },{}],17:[function(require,module,exports){
2825
2837
  "use strict";
@@ -6770,11 +6782,21 @@ class BaseElement extends HTMLElement {
6770
6782
 
6771
6783
  if (shortenURL && shortenURL.toLowerCase() === "true") {
6772
6784
  this._ShortenURL(url).then((newURL) => {
6773
- this._GenerateQRCode(newURL, width, height);
6785
+ // make sure by time promise is resolved that the original url hasn't been updated
6786
+ const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
6787
+
6788
+ if (updatedURL === url) {
6789
+ this._GenerateQRCode(newURL, width, height);
6790
+ }
6774
6791
  }).catch((_err) => {
6775
6792
  console.warn(_err);
6776
6793
  // ignore error and just generate normal QR Code
6777
- this._GenerateQRCode(url, width, height);
6794
+ // make sure by time promise is resolved that the original url hasn't been updated
6795
+ const updatedURL = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
6796
+
6797
+ if (updatedURL === url) {
6798
+ this._GenerateQRCode(url, width, height);
6799
+ }
6778
6800
  });
6779
6801
  }
6780
6802
  else {
@@ -6924,7 +6946,7 @@ module.exports = {
6924
6946
  version: Version
6925
6947
  };
6926
6948
  },{"./elements/qrcode-element.js":109,"./version":111}],111:[function(require,module,exports){
6927
- module.exports = "1.160.1";
6949
+ module.exports = "1.165.1";
6928
6950
 
6929
6951
  },{}],112:[function(require,module,exports){
6930
6952
  "use strict";
@@ -7844,6 +7866,16 @@ class StudioElement extends BaseElement {
7844
7866
  get elementType() {
7845
7867
  return "studio";
7846
7868
  }
7869
+
7870
+ get optionalAttributes() {
7871
+ return [{
7872
+ key: "variation-id",
7873
+ map: "variationId"
7874
+ }, {
7875
+ key: "variation-sku",
7876
+ map: "variationSku"
7877
+ }];
7878
+ }
7847
7879
  }
7848
7880
 
7849
7881
  module.exports = StudioElement;
@@ -8012,9 +8044,8 @@ class Util {
8012
8044
 
8013
8045
  module.exports = Util;
8014
8046
  },{}],131:[function(require,module,exports){
8015
- module.exports = "1.154.3";
8016
-
8017
- },{}],132:[function(require,module,exports){
8047
+ arguments[4][111][0].apply(exports,arguments)
8048
+ },{"dup":111}],132:[function(require,module,exports){
8018
8049
  (function (global){(function (){
8019
8050
  "use strict";
8020
8051