@plattar/plattar-ar-adapter 1.167.11 → 1.167.13

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.
@@ -1651,16 +1651,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1651
1651
  case 4:
1652
1652
  // optional attributes
1653
1653
  configState = null;
1654
- _context8.prev = 5;
1655
- _context8.next = 8;
1654
+ this._state = plattar_controller_1.ControllerState.Renderer;
1655
+ _context8.prev = 6;
1656
+ _context8.next = 9;
1656
1657
  return this.getConfiguratorState();
1657
- case 8:
1658
+ case 9:
1658
1659
  dState = _context8.sent;
1659
1660
  // if this is declared, we have a furniture scene that we need to re-create the embed
1660
1661
  // with new attributes
1661
1662
  product = dState.state.firstOfType("product");
1662
1663
  if (!product) {
1663
- _context8.next = 20;
1664
+ _context8.next = 21;
1664
1665
  break;
1665
1666
  }
1666
1667
  this.parent.lockObserver();
@@ -1670,22 +1671,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1670
1671
  this.parent.unlockObserver();
1671
1672
  controller = this.parent.create();
1672
1673
  if (!controller) {
1673
- _context8.next = 19;
1674
+ _context8.next = 20;
1674
1675
  break;
1675
1676
  }
1676
1677
  return _context8.abrupt("return", controller.startRenderer());
1677
- case 19:
1678
- return _context8.abrupt("return", Promise.reject(new Error("ConfiguratorController.startRenderer() - legacy product transition failed")));
1679
1678
  case 20:
1679
+ return _context8.abrupt("return", Promise.reject(new Error("ConfiguratorController.startRenderer() - legacy product transition failed")));
1680
+ case 21:
1680
1681
  configState = dState;
1681
- _context8.next = 26;
1682
+ _context8.next = 27;
1682
1683
  break;
1683
- case 23:
1684
- _context8.prev = 23;
1685
- _context8.t0 = _context8["catch"](5);
1684
+ case 24:
1685
+ _context8.prev = 24;
1686
+ _context8.t0 = _context8["catch"](6);
1686
1687
  // config state is not available
1687
1688
  configState = null;
1688
- case 26:
1689
+ case 27:
1689
1690
  // required attributes with defaults for plattar-configurator node
1690
1691
  width = this.getAttribute("width") || "500px";
1691
1692
  height = this.getAttribute("height") || "500px";
@@ -1707,7 +1708,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1707
1708
  if (showUI) {
1708
1709
  viewer.setAttribute("show-ui", showUI);
1709
1710
  }
1710
- this._state = plattar_controller_1.ControllerState.Renderer;
1711
1711
  return _context8.abrupt("return", new Promise(function (accept, reject) {
1712
1712
  _this16.append(viewer);
1713
1713
  if (configState) {
@@ -1719,7 +1719,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
1719
1719
  case "end":
1720
1720
  return _context8.stop();
1721
1721
  }
1722
- }, _callee8, this, [[5, 23]]);
1722
+ }, _callee8, this, [[6, 24]]);
1723
1723
  }));
1724
1724
  function startRenderer() {
1725
1725
  return _startRenderer.apply(this, arguments);
@@ -2289,9 +2289,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2289
2289
  }, {
2290
2290
  key: "append",
2291
2291
  value: function append(element) {
2292
+ if (this._element !== element) {
2293
+ return;
2294
+ }
2295
+ // ensure append only allows a single element in the shadow DOM
2292
2296
  var shadow = this.parent.shadowRoot || this.parent.attachShadow({
2293
2297
  mode: 'open'
2294
2298
  });
2299
+ if (shadow) {
2300
+ var child = shadow.lastElementChild;
2301
+ while (child) {
2302
+ shadow.removeChild(child);
2303
+ child = shadow.lastElementChild;
2304
+ }
2305
+ }
2295
2306
  shadow.append(element);
2296
2307
  }
2297
2308
  /**
@@ -2434,14 +2445,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2434
2445
  dst += "&show_ar=" + showAR;
2435
2446
  }
2436
2447
  viewer.setAttribute("url", opt.url || dst);
2437
- viewer.onload = function () {
2438
- return accept(viewer);
2439
- };
2440
- _this18.append(viewer);
2441
2448
  _this18._element = viewer;
2442
2449
  _this18._state = plattar_controller_1.ControllerState.QRCode;
2443
2450
  _this18._prevQROpt = opt;
2444
- return;
2451
+ return new Promise(function (accept, reject) {
2452
+ viewer.onload = function () {
2453
+ return accept(viewer);
2454
+ };
2455
+ _this18.append(viewer);
2456
+ });
2445
2457
  }
2446
2458
  return reject(new Error("ProductController.startQRCode() - minimum required attributes not set, use product-id as a minimum"));
2447
2459
  });
@@ -2514,13 +2526,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2514
2526
  dst += "&show_ar_banner=" + showBanner;
2515
2527
  }
2516
2528
  viewer.setAttribute("url", opt.url || dst);
2517
- viewer.onload = function () {
2518
- return accept(viewer);
2519
- };
2520
2529
  _this19._element = viewer;
2521
2530
  _this19._state = plattar_controller_1.ControllerState.QRCode;
2522
2531
  _this19._prevQROpt = opt;
2523
- _this19.append(viewer);
2532
+ return new Promise(function (accept, reject) {
2533
+ viewer.onload = function () {
2534
+ return accept(viewer);
2535
+ };
2536
+ _this19.append(viewer);
2537
+ });
2524
2538
  });
2525
2539
  }
2526
2540
  }, {
@@ -2554,13 +2568,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2554
2568
  if (showAR) {
2555
2569
  viewer.setAttribute("show-ar", showAR);
2556
2570
  }
2557
- viewer.onload = function () {
2558
- return accept(viewer);
2559
- };
2560
- _this20.append(viewer);
2561
2571
  _this20._element = viewer;
2562
2572
  _this20._state = plattar_controller_1.ControllerState.Renderer;
2563
- return;
2573
+ return new Promise(function (accept, reject) {
2574
+ viewer.onload = function () {
2575
+ return accept(viewer);
2576
+ };
2577
+ _this20.append(viewer);
2578
+ });
2564
2579
  }
2565
2580
  return reject(new Error("ProductController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
2566
2581
  });
@@ -2853,6 +2868,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2853
2868
  }
2854
2869
  throw new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
2855
2870
  case 4:
2871
+ this._state = plattar_controller_1.ControllerState.Renderer;
2856
2872
  // required attributes with defaults for plattar-facear node
2857
2873
  width = this.getAttribute("width") || "500px";
2858
2874
  height = this.getAttribute("height") || "500px";
@@ -2865,19 +2881,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2865
2881
  viewer.setAttribute("scene-id", sceneID);
2866
2882
  // optional attributes
2867
2883
  configState = null;
2868
- _context21.prev = 14;
2869
- _context21.next = 17;
2884
+ _context21.prev = 15;
2885
+ _context21.next = 18;
2870
2886
  return this.getConfiguratorState();
2871
- case 17:
2887
+ case 18:
2872
2888
  configState = _context21.sent;
2873
- _context21.next = 23;
2889
+ _context21.next = 24;
2874
2890
  break;
2875
- case 20:
2876
- _context21.prev = 20;
2877
- _context21.t0 = _context21["catch"](14);
2891
+ case 21:
2892
+ _context21.prev = 21;
2893
+ _context21.t0 = _context21["catch"](15);
2878
2894
  // config state not available
2879
2895
  configState = null;
2880
- case 23:
2896
+ case 24:
2881
2897
  showAR = this.getAttribute("show-ar");
2882
2898
  productID = this.getAttribute("product-id");
2883
2899
  sceneProductID = this.getAttribute("scene-product-id");
@@ -2897,7 +2913,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2897
2913
  if (variationID) {
2898
2914
  viewer.setAttribute("variation-id", variationID);
2899
2915
  }
2900
- this._state = plattar_controller_1.ControllerState.Renderer;
2901
2916
  return _context21.abrupt("return", new Promise(function (accept, reject) {
2902
2917
  _this24.append(viewer);
2903
2918
  if (configState) {
@@ -2909,7 +2924,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2909
2924
  case "end":
2910
2925
  return _context21.stop();
2911
2926
  }
2912
- }, _callee21, this, [[14, 20]]);
2927
+ }, _callee21, this, [[15, 21]]);
2913
2928
  }));
2914
2929
  function startRenderer() {
2915
2930
  return _startRenderer2.apply(this, arguments);
@@ -4235,7 +4250,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4235
4250
  Object.defineProperty(exports, "__esModule", {
4236
4251
  value: true
4237
4252
  });
4238
- exports["default"] = "1.167.11";
4253
+ exports["default"] = "1.167.13";
4239
4254
  }, {}],
4240
4255
  17: [function (require, module, exports) {
4241
4256
  "use strict";