@plattar/plattar-ar-adapter 1.155.2 → 1.155.4-b1

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.
@@ -1432,23 +1432,110 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1432
1432
  return onAttributesUpdated;
1433
1433
  }()
1434
1434
  }, {
1435
- key: "startViewerQRCode",
1435
+ key: "startARQRCode",
1436
1436
  value: function () {
1437
- var _startViewerQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(options) {
1438
- var _this15 = this;
1439
- var sceneID, opt, viewer, width, height, dst, configState, showAR, showUI;
1437
+ var _startARQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(options) {
1438
+ var dState, product, controller;
1440
1439
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1441
1440
  while (1) switch (_context6.prev = _context6.next) {
1441
+ case 0:
1442
+ _context6.prev = 0;
1443
+ _context6.next = 3;
1444
+ return this.getConfiguratorState();
1445
+ case 3:
1446
+ dState = _context6.sent;
1447
+ // if this is declared, we have a furniture scene that we need to re-create the embed
1448
+ // with new attributes
1449
+ product = dState.state.firstOfType("product");
1450
+ if (!product) {
1451
+ _context6.next = 14;
1452
+ break;
1453
+ }
1454
+ this.parent.lockObserver();
1455
+ this.parent.destroy();
1456
+ this.setAttribute("product-id", product.scene_product_id);
1457
+ this.parent.unlockObserver();
1458
+ controller = this.parent.create();
1459
+ if (!controller) {
1460
+ _context6.next = 13;
1461
+ break;
1462
+ }
1463
+ return _context6.abrupt("return", controller.startARQRCode(options));
1464
+ case 13:
1465
+ return _context6.abrupt("return", Promise.reject(new Error("ConfiguratorController.startARQRCode() - legacy product transition failed")));
1466
+ case 14:
1467
+ _context6.next = 18;
1468
+ break;
1469
+ case 16:
1470
+ _context6.prev = 16;
1471
+ _context6.t0 = _context6["catch"](0);
1472
+ case 18:
1473
+ return _context6.abrupt("return", _get(_getPrototypeOf(ConfiguratorController.prototype), "startARQRCode", this).call(this, options));
1474
+ case 19:
1475
+ case "end":
1476
+ return _context6.stop();
1477
+ }
1478
+ }, _callee6, this, [[0, 16]]);
1479
+ }));
1480
+ function startARQRCode(_x3) {
1481
+ return _startARQRCode.apply(this, arguments);
1482
+ }
1483
+ return startARQRCode;
1484
+ }()
1485
+ }, {
1486
+ key: "startViewerQRCode",
1487
+ value: function () {
1488
+ var _startViewerQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(options) {
1489
+ var _this15 = this;
1490
+ var sceneID, configState, dState, product, controller, opt, viewer, width, height, dst, showAR, showUI;
1491
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1492
+ while (1) switch (_context7.prev = _context7.next) {
1442
1493
  case 0:
1443
1494
  // remove the old renderer instance if any
1444
1495
  this.removeRenderer();
1445
1496
  sceneID = this.getAttribute("scene-id");
1446
1497
  if (sceneID) {
1447
- _context6.next = 4;
1498
+ _context7.next = 4;
1448
1499
  break;
1449
1500
  }
1450
- throw new Error("ConfiguratorController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
1501
+ throw new Error("ConfiguratorController.startViewerQRCode() - minimum required attributes not set, use scene-id as a minimum");
1451
1502
  case 4:
1503
+ // optional attributes
1504
+ configState = null;
1505
+ _context7.prev = 5;
1506
+ _context7.next = 8;
1507
+ return this.getConfiguratorState();
1508
+ case 8:
1509
+ dState = _context7.sent;
1510
+ // if this is declared, we have a furniture scene that we need to re-create the embed
1511
+ // with new attributes
1512
+ product = dState.state.firstOfType("product");
1513
+ if (!product) {
1514
+ _context7.next = 19;
1515
+ break;
1516
+ }
1517
+ this.parent.lockObserver();
1518
+ this.parent.destroy();
1519
+ this.setAttribute("product-id", product.scene_product_id);
1520
+ this.parent.unlockObserver();
1521
+ controller = this.parent.create();
1522
+ if (!controller) {
1523
+ _context7.next = 18;
1524
+ break;
1525
+ }
1526
+ return _context7.abrupt("return", controller.startViewerQRCode(options));
1527
+ case 18:
1528
+ return _context7.abrupt("return", Promise.reject(new Error("ConfiguratorController.startViewerQRCode() - legacy product transition failed")));
1529
+ case 19:
1530
+ configState = dState.state.encode();
1531
+ _context7.next = 25;
1532
+ break;
1533
+ case 22:
1534
+ _context7.prev = 22;
1535
+ _context7.t0 = _context7["catch"](5);
1536
+ // config state is not available
1537
+ configState = null;
1538
+ case 25:
1452
1539
  opt = options || this._GetDefaultQROptions();
1453
1540
  viewer = document.createElement("plattar-qrcode");
1454
1541
  this._element = viewer;
@@ -1467,23 +1554,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1467
1554
  viewer.setAttribute("qr-type", opt.qrType);
1468
1555
  }
1469
1556
  viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
1470
- dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID; // optional attributes
1471
- configState = null;
1557
+ dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
1472
1558
  showAR = this.getAttribute("show-ar");
1473
1559
  showUI = this.getAttribute("show-ui");
1474
- _context6.prev = 19;
1475
- _context6.next = 22;
1476
- return this.getConfiguratorState();
1477
- case 22:
1478
- configState = _context6.sent.state.encode();
1479
- _context6.next = 28;
1480
- break;
1481
- case 25:
1482
- _context6.prev = 25;
1483
- _context6.t0 = _context6["catch"](19);
1484
- // config state is not available
1485
- configState = null;
1486
- case 28:
1487
1560
  if (showUI && showUI === "true") {
1488
1561
  dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
1489
1562
  }
@@ -1496,19 +1569,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1496
1569
  viewer.setAttribute("url", opt.url || dst);
1497
1570
  this._state = plattar_controller_1.ControllerState.QRCode;
1498
1571
  this._prevQROpt = opt;
1499
- return _context6.abrupt("return", new Promise(function (accept, reject) {
1572
+ return _context7.abrupt("return", new Promise(function (accept, reject) {
1500
1573
  viewer.onload = function () {
1501
1574
  return accept(viewer);
1502
1575
  };
1503
1576
  _this15.append(viewer);
1504
1577
  }));
1505
- case 35:
1578
+ case 46:
1506
1579
  case "end":
1507
- return _context6.stop();
1580
+ return _context7.stop();
1508
1581
  }
1509
- }, _callee6, this, [[19, 25]]);
1582
+ }, _callee7, this, [[5, 22]]);
1510
1583
  }));
1511
- function startViewerQRCode(_x3) {
1584
+ function startViewerQRCode(_x4) {
1512
1585
  return _startViewerQRCode.apply(this, arguments);
1513
1586
  }
1514
1587
  return startViewerQRCode;
@@ -1516,21 +1589,57 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1516
1589
  }, {
1517
1590
  key: "startRenderer",
1518
1591
  value: function () {
1519
- var _startRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1592
+ var _startRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1520
1593
  var _this16 = this;
1521
- var sceneID, width, height, server, viewer, configState, showAR, showUI;
1522
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1523
- while (1) switch (_context7.prev = _context7.next) {
1594
+ var sceneID, configState, dState, product, controller, width, height, server, viewer, showAR, showUI;
1595
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1596
+ while (1) switch (_context8.prev = _context8.next) {
1524
1597
  case 0:
1525
1598
  // remove the old renderer instance if any
1526
1599
  this.removeRenderer();
1527
1600
  sceneID = this.getAttribute("scene-id");
1528
1601
  if (sceneID) {
1529
- _context7.next = 4;
1602
+ _context8.next = 4;
1530
1603
  break;
1531
1604
  }
1532
1605
  throw new Error("ConfiguratorController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
1533
1606
  case 4:
1607
+ // optional attributes
1608
+ configState = null;
1609
+ _context8.prev = 5;
1610
+ _context8.next = 8;
1611
+ return this.getConfiguratorState();
1612
+ case 8:
1613
+ dState = _context8.sent;
1614
+ // if this is declared, we have a furniture scene that we need to re-create the embed
1615
+ // with new attributes
1616
+ product = dState.state.firstOfType("product");
1617
+ if (!product) {
1618
+ _context8.next = 19;
1619
+ break;
1620
+ }
1621
+ this.parent.lockObserver();
1622
+ this.parent.destroy();
1623
+ this.setAttribute("product-id", product.scene_product_id);
1624
+ this.parent.unlockObserver();
1625
+ controller = this.parent.create();
1626
+ if (!controller) {
1627
+ _context8.next = 18;
1628
+ break;
1629
+ }
1630
+ return _context8.abrupt("return", controller.startRenderer());
1631
+ case 18:
1632
+ return _context8.abrupt("return", Promise.reject(new Error("ConfiguratorController.startRenderer() - legacy product transition failed")));
1633
+ case 19:
1634
+ configState = dState;
1635
+ _context8.next = 25;
1636
+ break;
1637
+ case 22:
1638
+ _context8.prev = 22;
1639
+ _context8.t0 = _context8["catch"](5);
1640
+ // config state is not available
1641
+ configState = null;
1642
+ case 25:
1534
1643
  // required attributes with defaults for plattar-configurator node
1535
1644
  width = this.getAttribute("width") || "500px";
1536
1645
  height = this.getAttribute("height") || "500px";
@@ -1541,21 +1650,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1541
1650
  viewer.setAttribute("height", height);
1542
1651
  viewer.setAttribute("server", server);
1543
1652
  viewer.setAttribute("scene-id", sceneID);
1544
- // optional attributes
1545
- configState = null;
1546
- _context7.prev = 14;
1547
- _context7.next = 17;
1548
- return this.getConfiguratorState();
1549
- case 17:
1550
- configState = _context7.sent;
1551
- _context7.next = 23;
1552
- break;
1553
- case 20:
1554
- _context7.prev = 20;
1555
- _context7.t0 = _context7["catch"](14);
1556
- // config state is not available
1557
- configState = null;
1558
- case 23:
1559
1653
  showAR = this.getAttribute("show-ar");
1560
1654
  showUI = this.getAttribute("show-ui");
1561
1655
  if (configState) {
@@ -1568,18 +1662,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1568
1662
  viewer.setAttribute("show-ui", showUI);
1569
1663
  }
1570
1664
  this._state = plattar_controller_1.ControllerState.Renderer;
1571
- return _context7.abrupt("return", new Promise(function (accept, reject) {
1665
+ return _context8.abrupt("return", new Promise(function (accept, reject) {
1572
1666
  _this16.append(viewer);
1573
1667
  if (configState) {
1574
1668
  _this16.setupMessengerObservers(viewer, configState);
1575
1669
  }
1576
1670
  return accept(viewer);
1577
1671
  }));
1578
- case 30:
1672
+ case 41:
1579
1673
  case "end":
1580
- return _context7.stop();
1674
+ return _context8.stop();
1581
1675
  }
1582
- }, _callee7, this, [[14, 20]]);
1676
+ }, _callee8, this, [[5, 22]]);
1583
1677
  }));
1584
1678
  function startRenderer() {
1585
1679
  return _startRenderer.apply(this, arguments);
@@ -1589,30 +1683,61 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1589
1683
  }, {
1590
1684
  key: "initAR",
1591
1685
  value: function () {
1592
- var _initAR = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1593
- var arMode;
1594
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1595
- while (1) switch (_context8.prev = _context8.next) {
1686
+ var _initAR = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1687
+ var dState, product, controller, arMode;
1688
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1689
+ while (1) switch (_context9.prev = _context9.next) {
1596
1690
  case 0:
1597
1691
  if (util_1.Util.canAugment()) {
1598
- _context8.next = 2;
1692
+ _context9.next = 2;
1599
1693
  break;
1600
1694
  }
1601
1695
  throw new Error("ConfiguratorController.initAR() - cannot proceed as AR not available in context");
1602
1696
  case 2:
1697
+ _context9.prev = 2;
1698
+ _context9.next = 5;
1699
+ return this.getConfiguratorState();
1700
+ case 5:
1701
+ dState = _context9.sent;
1702
+ // if this is declared, we have a furniture scene that we need to re-create the embed
1703
+ // with new attributes
1704
+ product = dState.state.firstOfType("product");
1705
+ if (!product) {
1706
+ _context9.next = 16;
1707
+ break;
1708
+ }
1709
+ this.parent.lockObserver();
1710
+ this.parent.destroy();
1711
+ this.setAttribute("product-id", product.scene_product_id);
1712
+ this.parent.unlockObserver();
1713
+ controller = this.parent.create();
1714
+ if (!controller) {
1715
+ _context9.next = 15;
1716
+ break;
1717
+ }
1718
+ return _context9.abrupt("return", controller.initAR());
1719
+ case 15:
1720
+ return _context9.abrupt("return", Promise.reject(new Error("ConfiguratorController.initAR() - legacy product transition failed")));
1721
+ case 16:
1722
+ _context9.next = 20;
1723
+ break;
1724
+ case 18:
1725
+ _context9.prev = 18;
1726
+ _context9.t0 = _context9["catch"](2);
1727
+ case 20:
1603
1728
  arMode = this.getAttribute("ar-mode") || "generated";
1604
- _context8.t0 = arMode.toLowerCase();
1605
- _context8.next = _context8.t0 === "inherited" ? 6 : _context8.t0 === "generated" ? 7 : 7;
1729
+ _context9.t1 = arMode.toLowerCase();
1730
+ _context9.next = _context9.t1 === "inherited" ? 24 : _context9.t1 === "generated" ? 25 : 25;
1606
1731
  break;
1607
- case 6:
1608
- return _context8.abrupt("return", this._InitARInherited());
1609
- case 7:
1610
- return _context8.abrupt("return", this._InitARGenerated());
1611
- case 8:
1732
+ case 24:
1733
+ return _context9.abrupt("return", this._InitARInherited());
1734
+ case 25:
1735
+ return _context9.abrupt("return", this._InitARGenerated());
1736
+ case 26:
1612
1737
  case "end":
1613
- return _context8.stop();
1738
+ return _context9.stop();
1614
1739
  }
1615
- }, _callee8, this);
1740
+ }, _callee9, this, [[2, 18]]);
1616
1741
  }));
1617
1742
  function initAR() {
1618
1743
  return _initAR.apply(this, arguments);
@@ -1625,36 +1750,36 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1625
1750
  }, {
1626
1751
  key: "_InitARInherited",
1627
1752
  value: function () {
1628
- var _InitARInherited2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1753
+ var _InitARInherited2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1629
1754
  var sceneID, state, first, sceneProductAR;
1630
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1631
- while (1) switch (_context9.prev = _context9.next) {
1755
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1756
+ while (1) switch (_context10.prev = _context10.next) {
1632
1757
  case 0:
1633
1758
  sceneID = this.getAttribute("scene-id");
1634
1759
  if (sceneID) {
1635
- _context9.next = 3;
1760
+ _context10.next = 3;
1636
1761
  break;
1637
1762
  }
1638
1763
  throw new Error("ConfiguratorController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
1639
1764
  case 3:
1640
- _context9.next = 5;
1765
+ _context10.next = 5;
1641
1766
  return this.getConfiguratorState();
1642
1767
  case 5:
1643
- state = _context9.sent.state;
1768
+ state = _context10.sent.state;
1644
1769
  first = state.first();
1645
1770
  if (!first) {
1646
- _context9.next = 10;
1771
+ _context10.next = 10;
1647
1772
  break;
1648
1773
  }
1649
1774
  sceneProductAR = new scene_product_ar_1.SceneProductAR(first.scene_product_id, first.product_variation_id);
1650
- return _context9.abrupt("return", sceneProductAR.init());
1775
+ return _context10.abrupt("return", sceneProductAR.init());
1651
1776
  case 10:
1652
1777
  throw new Error("ConfiguratorController.initAR() - invalid decoded config-state does not have any product states");
1653
1778
  case 11:
1654
1779
  case "end":
1655
- return _context9.stop();
1780
+ return _context10.stop();
1656
1781
  }
1657
- }, _callee9, this);
1782
+ }, _callee10, this);
1658
1783
  }));
1659
1784
  function _InitARInherited() {
1660
1785
  return _InitARInherited2.apply(this, arguments);
@@ -1667,30 +1792,30 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1667
1792
  }, {
1668
1793
  key: "_InitARGenerated",
1669
1794
  value: function () {
1670
- var _InitARGenerated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1795
+ var _InitARGenerated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1671
1796
  var sceneID, configAR;
1672
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1673
- while (1) switch (_context10.prev = _context10.next) {
1797
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1798
+ while (1) switch (_context11.prev = _context11.next) {
1674
1799
  case 0:
1675
1800
  sceneID = this.getAttribute("scene-id");
1676
1801
  if (sceneID) {
1677
- _context10.next = 3;
1802
+ _context11.next = 3;
1678
1803
  break;
1679
1804
  }
1680
1805
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
1681
1806
  case 3:
1682
- _context10.t0 = configurator_ar_1.ConfiguratorAR;
1683
- _context10.next = 6;
1807
+ _context11.t0 = configurator_ar_1.ConfiguratorAR;
1808
+ _context11.next = 6;
1684
1809
  return this.getConfiguratorState();
1685
1810
  case 6:
1686
- _context10.t1 = _context10.sent;
1687
- configAR = new _context10.t0(_context10.t1);
1688
- return _context10.abrupt("return", configAR.init());
1811
+ _context11.t1 = _context11.sent;
1812
+ configAR = new _context11.t0(_context11.t1);
1813
+ return _context11.abrupt("return", configAR.init());
1689
1814
  case 9:
1690
1815
  case "end":
1691
- return _context10.stop();
1816
+ return _context11.stop();
1692
1817
  }
1693
- }, _callee10, this);
1818
+ }, _callee11, this);
1694
1819
  }));
1695
1820
  function _InitARGenerated() {
1696
1821
  return _InitARGenerated2.apply(this, arguments);
@@ -1772,15 +1897,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1772
1897
  }, {
1773
1898
  key: "createConfiguratorState",
1774
1899
  value: function () {
1775
- var _createConfiguratorState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
1900
+ var _createConfiguratorState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
1776
1901
  var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList;
1777
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
1778
- while (1) switch (_context11.prev = _context11.next) {
1902
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1903
+ while (1) switch (_context12.prev = _context12.next) {
1779
1904
  case 0:
1780
1905
  // get our Scene ID
1781
1906
  sceneID = this.getAttribute("scene-id");
1782
1907
  if (sceneID) {
1783
- _context11.next = 3;
1908
+ _context12.next = 3;
1784
1909
  break;
1785
1910
  }
1786
1911
  throw new Error("PlattarController.createConfiguratorState() - cannot create as required attribute scene-id is not defined");
@@ -1789,22 +1914,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1789
1914
  variationIDs = this.getAttribute("variation-id"); // get a list of variation SKU's to use for initialising
1790
1915
  variationSKUs = this.getAttribute("variation-sku"); // generate the decoded configurator state
1791
1916
  if (!configState) {
1792
- _context11.next = 12;
1917
+ _context12.next = 12;
1793
1918
  break;
1794
1919
  }
1795
- _context11.next = 9;
1920
+ _context12.next = 9;
1796
1921
  return configurator_state_1.ConfiguratorState.decodeState(sceneID, configState);
1797
1922
  case 9:
1798
- _context11.t0 = _context11.sent;
1799
- _context11.next = 15;
1923
+ _context12.t0 = _context12.sent;
1924
+ _context12.next = 15;
1800
1925
  break;
1801
1926
  case 12:
1802
- _context11.next = 14;
1927
+ _context12.next = 14;
1803
1928
  return configurator_state_1.ConfiguratorState.decodeScene(sceneID);
1804
1929
  case 14:
1805
- _context11.t0 = _context11.sent;
1930
+ _context12.t0 = _context12.sent;
1806
1931
  case 15:
1807
- decodedState = _context11.t0;
1932
+ decodedState = _context12.t0;
1808
1933
  // change the ID's and SKU's (if any) of the default configuration state
1809
1934
  variationIDList = variationIDs ? variationIDs.split(",") : [];
1810
1935
  variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
@@ -1815,12 +1940,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1815
1940
  decodedState.state.setVariationSKU(variationSKU);
1816
1941
  });
1817
1942
  // return fully modified configuration state
1818
- return _context11.abrupt("return", decodedState);
1943
+ return _context12.abrupt("return", decodedState);
1819
1944
  case 21:
1820
1945
  case "end":
1821
- return _context11.stop();
1946
+ return _context12.stop();
1822
1947
  }
1823
- }, _callee11, this);
1948
+ }, _callee12, this);
1824
1949
  }));
1825
1950
  function createConfiguratorState() {
1826
1951
  return _createConfiguratorState.apply(this, arguments);
@@ -1874,21 +1999,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1874
1999
  }, {
1875
2000
  key: "startAR",
1876
2001
  value: function () {
1877
- var _startAR = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
2002
+ var _startAR = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
1878
2003
  var launcher;
1879
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1880
- while (1) switch (_context12.prev = _context12.next) {
2004
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
2005
+ while (1) switch (_context13.prev = _context13.next) {
1881
2006
  case 0:
1882
- _context12.next = 2;
2007
+ _context13.next = 2;
1883
2008
  return this.initAR();
1884
2009
  case 2:
1885
- launcher = _context12.sent;
1886
- return _context12.abrupt("return", launcher.start());
2010
+ launcher = _context13.sent;
2011
+ return _context13.abrupt("return", launcher.start());
1887
2012
  case 4:
1888
2013
  case "end":
1889
- return _context12.stop();
2014
+ return _context13.stop();
1890
2015
  }
1891
- }, _callee12, this);
2016
+ }, _callee13, this);
1892
2017
  }));
1893
2018
  function startAR() {
1894
2019
  return _startAR.apply(this, arguments);
@@ -1903,26 +2028,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1903
2028
  }, {
1904
2029
  key: "startQRCode",
1905
2030
  value: function () {
1906
- var _startQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(options) {
2031
+ var _startQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(options) {
1907
2032
  var qrType;
1908
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1909
- while (1) switch (_context13.prev = _context13.next) {
2033
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
2034
+ while (1) switch (_context14.prev = _context14.next) {
1910
2035
  case 0:
1911
2036
  qrType = this.getAttribute("qr-type") || "viewer";
1912
- _context13.t0 = qrType.toLowerCase();
1913
- _context13.next = _context13.t0 === "ar" ? 4 : _context13.t0 === "viewer" ? 5 : 5;
2037
+ _context14.t0 = qrType.toLowerCase();
2038
+ _context14.next = _context14.t0 === "ar" ? 4 : _context14.t0 === "viewer" ? 5 : 5;
1914
2039
  break;
1915
2040
  case 4:
1916
- return _context13.abrupt("return", this.startARQRCode(options));
2041
+ return _context14.abrupt("return", this.startARQRCode(options));
1917
2042
  case 5:
1918
- return _context13.abrupt("return", this.startViewerQRCode(options));
2043
+ return _context14.abrupt("return", this.startViewerQRCode(options));
1919
2044
  case 6:
1920
2045
  case "end":
1921
- return _context13.stop();
2046
+ return _context14.stop();
1922
2047
  }
1923
- }, _callee13, this);
2048
+ }, _callee14, this);
1924
2049
  }));
1925
- function startQRCode(_x4) {
2050
+ function startQRCode(_x5) {
1926
2051
  return _startQRCode.apply(this, arguments);
1927
2052
  }
1928
2053
  return startQRCode;
@@ -1935,11 +2060,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1935
2060
  }, {
1936
2061
  key: "startARQRCode",
1937
2062
  value: function () {
1938
- var _startARQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(options) {
2063
+ var _startARQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(options) {
1939
2064
  var _this17 = this;
1940
2065
  var opt, viewer, width, height, qrOptions, dst, configState, sceneID, embedType, productID, sceneProductID, variationID, variationSKU, arMode;
1941
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1942
- while (1) switch (_context14.prev = _context14.next) {
2066
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2067
+ while (1) switch (_context15.prev = _context15.next) {
1943
2068
  case 0:
1944
2069
  // remove the old renderer instance if any
1945
2070
  this.removeRenderer();
@@ -1971,16 +2096,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
1971
2096
  variationID = this.getAttribute("variation-id");
1972
2097
  variationSKU = this.getAttribute("variation-sku");
1973
2098
  arMode = this.getAttribute("ar-mode");
1974
- _context14.prev = 22;
1975
- _context14.next = 25;
2099
+ _context15.prev = 22;
2100
+ _context15.next = 25;
1976
2101
  return this.getConfiguratorState();
1977
2102
  case 25:
1978
- configState = _context14.sent.state.encode();
1979
- _context14.next = 31;
2103
+ configState = _context15.sent.state.encode();
2104
+ _context15.next = 31;
1980
2105
  break;
1981
2106
  case 28:
1982
- _context14.prev = 28;
1983
- _context14.t0 = _context14["catch"](22);
2107
+ _context15.prev = 28;
2108
+ _context15.t0 = _context15["catch"](22);
1984
2109
  // config state not available for some reason
1985
2110
  configState = null;
1986
2111
  case 31:
@@ -2011,7 +2136,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2011
2136
  viewer.setAttribute("url", opt.url || dst);
2012
2137
  this._state = ControllerState.QRCode;
2013
2138
  this._prevQROpt = opt;
2014
- return _context14.abrupt("return", new Promise(function (accept, reject) {
2139
+ return _context15.abrupt("return", new Promise(function (accept, reject) {
2015
2140
  _this17.append(viewer);
2016
2141
  viewer.onload = function () {
2017
2142
  return accept(viewer);
@@ -2019,12 +2144,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2019
2144
  }));
2020
2145
  case 43:
2021
2146
  case "end":
2022
- return _context14.stop();
2147
+ return _context15.stop();
2023
2148
  }
2024
- }, _callee14, this, [[22, 28]]);
2149
+ }, _callee15, this, [[22, 28]]);
2025
2150
  }));
2026
- function startARQRCode(_x5) {
2027
- return _startARQRCode.apply(this, arguments);
2151
+ function startARQRCode(_x6) {
2152
+ return _startARQRCode2.apply(this, arguments);
2028
2153
  }
2029
2154
  return startARQRCode;
2030
2155
  }()
@@ -2038,7 +2163,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2038
2163
  }
2039
2164
  /**
2040
2165
  * Returns the specified attribute from the parent
2041
- * @param attribute - The name of thhe attribute
2166
+ * @param attribute - The name of the attribute
2042
2167
  * @returns - The attribute value or null
2043
2168
  */
2044
2169
  }, {
@@ -2046,6 +2171,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2046
2171
  value: function getAttribute(attribute) {
2047
2172
  return this.parent ? this.parent.hasAttribute(attribute) ? this.parent.getAttribute(attribute) : null : null;
2048
2173
  }
2174
+ /**
2175
+ * Sets a particular attribute into the HTML DOM
2176
+ *
2177
+ * @param attribute - The name of the attribute
2178
+ * @param value - The value of the attribute
2179
+ */
2180
+ }, {
2181
+ key: "setAttribute",
2182
+ value: function setAttribute(attribute, value) {
2183
+ if (this.parent) {
2184
+ this.parent.setAttribute(attribute, value);
2185
+ }
2186
+ }
2049
2187
  /**
2050
2188
  * Appends the provided element into the shadow-root of the parent element
2051
2189
  * @param element - The element to append
@@ -2086,25 +2224,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2086
2224
  var ProductController = /*#__PURE__*/function (_plattar_controller_2) {
2087
2225
  _inherits(ProductController, _plattar_controller_2);
2088
2226
  var _super8 = _createSuper(ProductController);
2089
- function ProductController(parent) {
2227
+ function ProductController() {
2090
2228
  _classCallCheck(this, ProductController);
2091
- // this is a hack against DecodedConfiguratorState that's now stored in PlattarController
2092
- // this is not used in legacy mode
2093
- return _super8.call(this, parent);
2229
+ return _super8.apply(this, arguments);
2094
2230
  }
2095
2231
  _createClass(ProductController, [{
2096
2232
  key: "getConfiguratorState",
2097
2233
  value: function () {
2098
- var _getConfiguratorState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
2099
- return _regeneratorRuntime().wrap(function _callee15$(_context15) {
2100
- while (1) switch (_context15.prev = _context15.next) {
2234
+ var _getConfiguratorState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
2235
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2236
+ while (1) switch (_context16.prev = _context16.next) {
2101
2237
  case 0:
2102
2238
  throw new Error("ProductController.getConfiguratorState() - legacy embeds do not support configurator states");
2103
2239
  case 1:
2104
2240
  case "end":
2105
- return _context15.stop();
2241
+ return _context16.stop();
2106
2242
  }
2107
- }, _callee15);
2243
+ }, _callee16);
2108
2244
  }));
2109
2245
  function getConfiguratorState() {
2110
2246
  return _getConfiguratorState2.apply(this, arguments);
@@ -2114,18 +2250,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2114
2250
  }, {
2115
2251
  key: "onAttributesUpdated",
2116
2252
  value: function () {
2117
- var _onAttributesUpdated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(attributeName) {
2253
+ var _onAttributesUpdated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(attributeName) {
2118
2254
  var state, viewer, variationID;
2119
- return _regeneratorRuntime().wrap(function _callee16$(_context16) {
2120
- while (1) switch (_context16.prev = _context16.next) {
2255
+ return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2256
+ while (1) switch (_context17.prev = _context17.next) {
2121
2257
  case 0:
2122
2258
  state = this._state; // re-render the QR Code when attributes have changed
2123
2259
  if (!(state === plattar_controller_1.ControllerState.QRCode)) {
2124
- _context16.next = 4;
2260
+ _context17.next = 4;
2125
2261
  break;
2126
2262
  }
2127
2263
  this.startQRCode(this._prevQROpt);
2128
- return _context16.abrupt("return");
2264
+ return _context17.abrupt("return");
2129
2265
  case 4:
2130
2266
  // use the messenger function to change variation when attributes have changed
2131
2267
  if (state === plattar_controller_1.ControllerState.Renderer) {
@@ -2139,11 +2275,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2139
2275
  }
2140
2276
  case 5:
2141
2277
  case "end":
2142
- return _context16.stop();
2278
+ return _context17.stop();
2143
2279
  }
2144
- }, _callee16, this);
2280
+ }, _callee17, this);
2145
2281
  }));
2146
- function onAttributesUpdated(_x6) {
2282
+ function onAttributesUpdated(_x7) {
2147
2283
  return _onAttributesUpdated2.apply(this, arguments);
2148
2284
  }
2149
2285
  return onAttributesUpdated;
@@ -2387,23 +2523,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2387
2523
  _createClass(VTOController, [{
2388
2524
  key: "getConfiguratorState",
2389
2525
  value: function () {
2390
- var _getConfiguratorState3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
2391
- return _regeneratorRuntime().wrap(function _callee17$(_context17) {
2392
- while (1) switch (_context17.prev = _context17.next) {
2526
+ var _getConfiguratorState3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
2527
+ return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2528
+ while (1) switch (_context18.prev = _context18.next) {
2393
2529
  case 0:
2394
2530
  if (!this._cachedConfigState) {
2395
- _context17.next = 2;
2531
+ _context18.next = 2;
2396
2532
  break;
2397
2533
  }
2398
- return _context17.abrupt("return", this._cachedConfigState);
2534
+ return _context18.abrupt("return", this._cachedConfigState);
2399
2535
  case 2:
2400
2536
  this._cachedConfigState = this.createConfiguratorState();
2401
- return _context17.abrupt("return", this._cachedConfigState);
2537
+ return _context18.abrupt("return", this._cachedConfigState);
2402
2538
  case 4:
2403
2539
  case "end":
2404
- return _context17.stop();
2540
+ return _context18.stop();
2405
2541
  }
2406
- }, _callee17, this);
2542
+ }, _callee18, this);
2407
2543
  }));
2408
2544
  function getConfiguratorState() {
2409
2545
  return _getConfiguratorState3.apply(this, arguments);
@@ -2413,61 +2549,61 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2413
2549
  }, {
2414
2550
  key: "onAttributesUpdated",
2415
2551
  value: function () {
2416
- var _onAttributesUpdated3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(attributeName) {
2552
+ var _onAttributesUpdated3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(attributeName) {
2417
2553
  var state, viewer, variationIDs, variationIDsList, variationSKUs, variationSKUList, configState, _variationIDs2, _variationIDsList2, _configState2, _variationSKUs2, _variationSKUList2;
2418
- return _regeneratorRuntime().wrap(function _callee18$(_context18) {
2419
- while (1) switch (_context18.prev = _context18.next) {
2554
+ return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2555
+ while (1) switch (_context19.prev = _context19.next) {
2420
2556
  case 0:
2421
2557
  state = this._state;
2422
2558
  if (!(state === plattar_controller_1.ControllerState.Renderer)) {
2423
- _context18.next = 17;
2559
+ _context19.next = 17;
2424
2560
  break;
2425
2561
  }
2426
2562
  viewer = this.element;
2427
2563
  if (!viewer) {
2428
- _context18.next = 16;
2564
+ _context19.next = 16;
2429
2565
  break;
2430
2566
  }
2431
2567
  if (!(attributeName === "variation-id")) {
2432
- _context18.next = 10;
2568
+ _context19.next = 10;
2433
2569
  break;
2434
2570
  }
2435
2571
  variationIDs = this.getAttribute("variation-id");
2436
2572
  variationIDsList = variationIDs ? variationIDs.split(",") : [];
2437
2573
  if (!(variationIDsList.length > 0)) {
2438
- _context18.next = 10;
2574
+ _context19.next = 10;
2439
2575
  break;
2440
2576
  }
2441
- _context18.next = 10;
2577
+ _context19.next = 10;
2442
2578
  return viewer.messenger.selectVariationID(variationIDsList);
2443
2579
  case 10:
2444
2580
  if (!(attributeName === "variation-sku")) {
2445
- _context18.next = 16;
2581
+ _context19.next = 16;
2446
2582
  break;
2447
2583
  }
2448
2584
  variationSKUs = this.getAttribute("variation-sku");
2449
2585
  variationSKUList = variationSKUs ? variationSKUs.split(",") : [];
2450
2586
  if (!(variationSKUList.length > 0)) {
2451
- _context18.next = 16;
2587
+ _context19.next = 16;
2452
2588
  break;
2453
2589
  }
2454
- _context18.next = 16;
2590
+ _context19.next = 16;
2455
2591
  return viewer.messenger.selectVariationSKU(variationSKUList);
2456
2592
  case 16:
2457
- return _context18.abrupt("return");
2593
+ return _context19.abrupt("return");
2458
2594
  case 17:
2459
2595
  if (!(state === plattar_controller_1.ControllerState.QRCode)) {
2460
- _context18.next = 34;
2596
+ _context19.next = 34;
2461
2597
  break;
2462
2598
  }
2463
2599
  if (!(attributeName === "variation-id")) {
2464
- _context18.next = 25;
2600
+ _context19.next = 25;
2465
2601
  break;
2466
2602
  }
2467
- _context18.next = 21;
2603
+ _context19.next = 21;
2468
2604
  return this.getConfiguratorState();
2469
2605
  case 21:
2470
- configState = _context18.sent;
2606
+ configState = _context19.sent;
2471
2607
  _variationIDs2 = this.getAttribute("variation-id");
2472
2608
  _variationIDsList2 = _variationIDs2 ? _variationIDs2.split(",") : [];
2473
2609
  _variationIDsList2.forEach(function (variationID) {
@@ -2475,13 +2611,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2475
2611
  });
2476
2612
  case 25:
2477
2613
  if (!(attributeName === "variation-sku")) {
2478
- _context18.next = 32;
2614
+ _context19.next = 32;
2479
2615
  break;
2480
2616
  }
2481
- _context18.next = 28;
2617
+ _context19.next = 28;
2482
2618
  return this.getConfiguratorState();
2483
2619
  case 28:
2484
- _configState2 = _context18.sent;
2620
+ _configState2 = _context19.sent;
2485
2621
  _variationSKUs2 = this.getAttribute("variation-sku");
2486
2622
  _variationSKUList2 = _variationSKUs2 ? _variationSKUs2.split(",") : [];
2487
2623
  _variationSKUList2.forEach(function (variationSKU) {
@@ -2489,14 +2625,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2489
2625
  });
2490
2626
  case 32:
2491
2627
  this.startQRCode(this._prevQROpt);
2492
- return _context18.abrupt("return");
2628
+ return _context19.abrupt("return");
2493
2629
  case 34:
2494
2630
  case "end":
2495
- return _context18.stop();
2631
+ return _context19.stop();
2496
2632
  }
2497
- }, _callee18, this);
2633
+ }, _callee19, this);
2498
2634
  }));
2499
- function onAttributesUpdated(_x7) {
2635
+ function onAttributesUpdated(_x8) {
2500
2636
  return _onAttributesUpdated3.apply(this, arguments);
2501
2637
  }
2502
2638
  return onAttributesUpdated;
@@ -2504,17 +2640,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2504
2640
  }, {
2505
2641
  key: "startViewerQRCode",
2506
2642
  value: function () {
2507
- var _startViewerQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(options) {
2643
+ var _startViewerQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(options) {
2508
2644
  var _this23 = this;
2509
2645
  var sceneID, opt, viewer, width, height, dst, configState, showAR, productID, sceneProductID, variationID;
2510
- return _regeneratorRuntime().wrap(function _callee19$(_context19) {
2511
- while (1) switch (_context19.prev = _context19.next) {
2646
+ return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2647
+ while (1) switch (_context20.prev = _context20.next) {
2512
2648
  case 0:
2513
2649
  // remove the old renderer instance if any
2514
2650
  this.removeRenderer();
2515
2651
  sceneID = this.getAttribute("scene-id");
2516
2652
  if (sceneID) {
2517
- _context19.next = 4;
2653
+ _context20.next = 4;
2518
2654
  break;
2519
2655
  }
2520
2656
  throw new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum");
@@ -2539,16 +2675,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2539
2675
  viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
2540
2676
  dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID; // optional attributes
2541
2677
  configState = null;
2542
- _context19.prev = 17;
2543
- _context19.next = 20;
2678
+ _context20.prev = 17;
2679
+ _context20.next = 20;
2544
2680
  return this.getConfiguratorState();
2545
2681
  case 20:
2546
- configState = _context19.sent;
2547
- _context19.next = 26;
2682
+ configState = _context20.sent;
2683
+ _context20.next = 26;
2548
2684
  break;
2549
2685
  case 23:
2550
- _context19.prev = 23;
2551
- _context19.t0 = _context19["catch"](17);
2686
+ _context20.prev = 23;
2687
+ _context20.t0 = _context20["catch"](17);
2552
2688
  // config state is not available
2553
2689
  configState = null;
2554
2690
  case 26:
@@ -2574,7 +2710,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2574
2710
  viewer.setAttribute("url", opt.url || dst);
2575
2711
  this._state = plattar_controller_1.ControllerState.QRCode;
2576
2712
  this._prevQROpt = opt;
2577
- return _context19.abrupt("return", new Promise(function (accept, reject) {
2713
+ return _context20.abrupt("return", new Promise(function (accept, reject) {
2578
2714
  viewer.onload = function () {
2579
2715
  return accept(viewer);
2580
2716
  };
@@ -2582,11 +2718,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2582
2718
  }));
2583
2719
  case 39:
2584
2720
  case "end":
2585
- return _context19.stop();
2721
+ return _context20.stop();
2586
2722
  }
2587
- }, _callee19, this, [[17, 23]]);
2723
+ }, _callee20, this, [[17, 23]]);
2588
2724
  }));
2589
- function startViewerQRCode(_x8) {
2725
+ function startViewerQRCode(_x9) {
2590
2726
  return _startViewerQRCode2.apply(this, arguments);
2591
2727
  }
2592
2728
  return startViewerQRCode;
@@ -2594,17 +2730,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2594
2730
  }, {
2595
2731
  key: "startRenderer",
2596
2732
  value: function () {
2597
- var _startRenderer2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
2733
+ var _startRenderer2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2598
2734
  var _this24 = this;
2599
2735
  var sceneID, width, height, server, viewer, configState, showAR, productID, sceneProductID, variationID;
2600
- return _regeneratorRuntime().wrap(function _callee20$(_context20) {
2601
- while (1) switch (_context20.prev = _context20.next) {
2736
+ return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2737
+ while (1) switch (_context21.prev = _context21.next) {
2602
2738
  case 0:
2603
2739
  // remove the old renderer instance if any
2604
2740
  this.removeRenderer();
2605
2741
  sceneID = this.getAttribute("scene-id");
2606
2742
  if (sceneID) {
2607
- _context20.next = 4;
2743
+ _context21.next = 4;
2608
2744
  break;
2609
2745
  }
2610
2746
  throw new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum");
@@ -2621,16 +2757,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2621
2757
  viewer.setAttribute("scene-id", sceneID);
2622
2758
  // optional attributes
2623
2759
  configState = null;
2624
- _context20.prev = 14;
2625
- _context20.next = 17;
2760
+ _context21.prev = 14;
2761
+ _context21.next = 17;
2626
2762
  return this.getConfiguratorState();
2627
2763
  case 17:
2628
- configState = _context20.sent;
2629
- _context20.next = 23;
2764
+ configState = _context21.sent;
2765
+ _context21.next = 23;
2630
2766
  break;
2631
2767
  case 20:
2632
- _context20.prev = 20;
2633
- _context20.t0 = _context20["catch"](14);
2768
+ _context21.prev = 20;
2769
+ _context21.t0 = _context21["catch"](14);
2634
2770
  // config state not available
2635
2771
  configState = null;
2636
2772
  case 23:
@@ -2654,7 +2790,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2654
2790
  viewer.setAttribute("variation-id", variationID);
2655
2791
  }
2656
2792
  this._state = plattar_controller_1.ControllerState.Renderer;
2657
- return _context20.abrupt("return", new Promise(function (accept, reject) {
2793
+ return _context21.abrupt("return", new Promise(function (accept, reject) {
2658
2794
  _this24.append(viewer);
2659
2795
  if (configState) {
2660
2796
  _this24.setupMessengerObservers(viewer, configState);
@@ -2663,9 +2799,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2663
2799
  }));
2664
2800
  case 34:
2665
2801
  case "end":
2666
- return _context20.stop();
2802
+ return _context21.stop();
2667
2803
  }
2668
- }, _callee20, this, [[14, 20]]);
2804
+ }, _callee21, this, [[14, 20]]);
2669
2805
  }));
2670
2806
  function startRenderer() {
2671
2807
  return _startRenderer2.apply(this, arguments);
@@ -2675,36 +2811,36 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2675
2811
  }, {
2676
2812
  key: "initAR",
2677
2813
  value: function () {
2678
- var _initAR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
2814
+ var _initAR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2679
2815
  var arMode;
2680
- return _regeneratorRuntime().wrap(function _callee21$(_context21) {
2681
- while (1) switch (_context21.prev = _context21.next) {
2816
+ return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2817
+ while (1) switch (_context22.prev = _context22.next) {
2682
2818
  case 0:
2683
2819
  if (util_1.Util.canAugment()) {
2684
- _context21.next = 2;
2820
+ _context22.next = 2;
2685
2821
  break;
2686
2822
  }
2687
2823
  throw new Error("VTOController.initAR() - cannot proceed as VTO AR not available in context");
2688
2824
  case 2:
2689
2825
  if (util_1.Util.isSafari() || util_1.Util.isChromeOnIOS()) {
2690
- _context21.next = 4;
2826
+ _context22.next = 4;
2691
2827
  break;
2692
2828
  }
2693
2829
  throw new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices");
2694
2830
  case 4:
2695
2831
  arMode = this.getAttribute("ar-mode") || "generated";
2696
- _context21.t0 = arMode.toLowerCase();
2697
- _context21.next = _context21.t0 === "inherited" ? 8 : _context21.t0 === "generated" ? 9 : 9;
2832
+ _context22.t0 = arMode.toLowerCase();
2833
+ _context22.next = _context22.t0 === "inherited" ? 8 : _context22.t0 === "generated" ? 9 : 9;
2698
2834
  break;
2699
2835
  case 8:
2700
- return _context21.abrupt("return", this._InitARInherited());
2836
+ return _context22.abrupt("return", this._InitARInherited());
2701
2837
  case 9:
2702
- return _context21.abrupt("return", this._InitARGenerated());
2838
+ return _context22.abrupt("return", this._InitARGenerated());
2703
2839
  case 10:
2704
2840
  case "end":
2705
- return _context21.stop();
2841
+ return _context22.stop();
2706
2842
  }
2707
- }, _callee21, this);
2843
+ }, _callee22, this);
2708
2844
  }));
2709
2845
  function initAR() {
2710
2846
  return _initAR2.apply(this, arguments);
@@ -2717,36 +2853,36 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2717
2853
  }, {
2718
2854
  key: "_InitARInherited",
2719
2855
  value: function () {
2720
- var _InitARInherited3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
2856
+ var _InitARInherited3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2721
2857
  var sceneID, state, first, sceneProductAR;
2722
- return _regeneratorRuntime().wrap(function _callee22$(_context22) {
2723
- while (1) switch (_context22.prev = _context22.next) {
2858
+ return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2859
+ while (1) switch (_context23.prev = _context23.next) {
2724
2860
  case 0:
2725
2861
  sceneID = this.getAttribute("scene-id");
2726
2862
  if (sceneID) {
2727
- _context22.next = 3;
2863
+ _context23.next = 3;
2728
2864
  break;
2729
2865
  }
2730
2866
  throw new Error("VTOController.initAR() - inherited AR minimum required attributes not set, use scene-id as a minimum");
2731
2867
  case 3:
2732
- _context22.next = 5;
2868
+ _context23.next = 5;
2733
2869
  return this.getConfiguratorState();
2734
2870
  case 5:
2735
- state = _context22.sent.state;
2871
+ state = _context23.sent.state;
2736
2872
  first = state.first();
2737
2873
  if (!first) {
2738
- _context22.next = 10;
2874
+ _context23.next = 10;
2739
2875
  break;
2740
2876
  }
2741
2877
  sceneProductAR = new __1.SceneProductAR(first.scene_product_id, first.product_variation_id);
2742
- return _context22.abrupt("return", sceneProductAR.init());
2878
+ return _context23.abrupt("return", sceneProductAR.init());
2743
2879
  case 10:
2744
2880
  throw new Error("VTOController.initAR() - invalid decoded config-state does not have any product states");
2745
2881
  case 11:
2746
2882
  case "end":
2747
- return _context22.stop();
2883
+ return _context23.stop();
2748
2884
  }
2749
- }, _callee22, this);
2885
+ }, _callee23, this);
2750
2886
  }));
2751
2887
  function _InitARInherited() {
2752
2888
  return _InitARInherited3.apply(this, arguments);
@@ -2759,30 +2895,30 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2759
2895
  }, {
2760
2896
  key: "_InitARGenerated",
2761
2897
  value: function () {
2762
- var _InitARGenerated3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
2898
+ var _InitARGenerated3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
2763
2899
  var sceneID, configAR;
2764
- return _regeneratorRuntime().wrap(function _callee23$(_context23) {
2765
- while (1) switch (_context23.prev = _context23.next) {
2900
+ return _regeneratorRuntime().wrap(function _callee24$(_context24) {
2901
+ while (1) switch (_context24.prev = _context24.next) {
2766
2902
  case 0:
2767
2903
  sceneID = this.getAttribute("scene-id");
2768
2904
  if (sceneID) {
2769
- _context23.next = 3;
2905
+ _context24.next = 3;
2770
2906
  break;
2771
2907
  }
2772
2908
  throw new Error("VTOController.initAR() - generated AR minimum required attributes not set, use scene-id as a minimum");
2773
2909
  case 3:
2774
- _context23.t0 = configurator_ar_1.ConfiguratorAR;
2775
- _context23.next = 6;
2910
+ _context24.t0 = configurator_ar_1.ConfiguratorAR;
2911
+ _context24.next = 6;
2776
2912
  return this.getConfiguratorState();
2777
2913
  case 6:
2778
- _context23.t1 = _context23.sent;
2779
- configAR = new _context23.t0(_context23.t1);
2780
- return _context23.abrupt("return", configAR.init());
2914
+ _context24.t1 = _context24.sent;
2915
+ configAR = new _context24.t0(_context24.t1);
2916
+ return _context24.abrupt("return", configAR.init());
2781
2917
  case 9:
2782
2918
  case "end":
2783
- return _context23.stop();
2919
+ return _context24.stop();
2784
2920
  }
2785
- }, _callee23, this);
2921
+ }, _callee24, this);
2786
2922
  }));
2787
2923
  function _InitARGenerated() {
2788
2924
  return _InitARGenerated3.apply(this, arguments);
@@ -2836,6 +2972,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2836
2972
  EmbedType[EmbedType["VTO"] = 2] = "VTO";
2837
2973
  EmbedType[EmbedType["None"] = 3] = "None";
2838
2974
  })(EmbedType || (EmbedType = {}));
2975
+ /**
2976
+ * Controls the state of the observer
2977
+ */
2978
+ var ObserverState;
2979
+ (function (ObserverState) {
2980
+ ObserverState[ObserverState["Locked"] = 0] = "Locked";
2981
+ ObserverState[ObserverState["Unlocked"] = 1] = "Unlocked";
2982
+ })(ObserverState || (ObserverState = {}));
2839
2983
  /**
2840
2984
  * This is the primary <plattar-embed /> node that allows easy embedding
2841
2985
  * of Plattar related content
@@ -2849,6 +2993,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2849
2993
  _this25 = _super10.call(this);
2850
2994
  // this is the current embed type, viewer by default
2851
2995
  _this25._currentType = EmbedType.None;
2996
+ _this25._observerState = ObserverState.Unlocked;
2852
2997
  _this25._controller = null;
2853
2998
  _this25._currentSceneID = null;
2854
2999
  _this25._observer = null;
@@ -2879,16 +3024,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2879
3024
  plattar_api_1.Server.create(plattar_api_1.Server.match(server || "production"));
2880
3025
  if (!this._observer) {
2881
3026
  this._observer = new MutationObserver(function (mutations) {
2882
- mutations.forEach(function (mutation) {
2883
- if (mutation.type === "attributes") {
2884
- var attributeName = mutation.attributeName ? mutation.attributeName : "none";
2885
- if (_this26._currentType !== EmbedType.Legacy) {
2886
- _this26._CreateEmbed(attributeName);
2887
- } else {
2888
- _this26._OnAttributesUpdated(attributeName);
3027
+ if (_this26._observerState === ObserverState.Unlocked) {
3028
+ mutations.forEach(function (mutation) {
3029
+ if (mutation.type === "attributes") {
3030
+ var attributeName = mutation.attributeName ? mutation.attributeName : "none";
3031
+ if (_this26._currentType !== EmbedType.Legacy) {
3032
+ _this26._CreateEmbed(attributeName);
3033
+ } else {
3034
+ _this26._OnAttributesUpdated(attributeName);
3035
+ }
2889
3036
  }
2890
- }
2891
- });
3037
+ });
3038
+ }
2892
3039
  });
2893
3040
  this._observer.observe(this, {
2894
3041
  attributes: true
@@ -2898,9 +3045,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2898
3045
  if (productID) {
2899
3046
  this._currentType = EmbedType.Legacy;
2900
3047
  this._CreateLegacyEmbed();
2901
- return;
3048
+ return this._controller;
2902
3049
  }
2903
3050
  this._CreateEmbed("none");
3051
+ return this._controller;
3052
+ }
3053
+ /**
3054
+ * Locks the observer so attribute changes do not trigger anything
3055
+ */
3056
+ }, {
3057
+ key: "lockObserver",
3058
+ value: function lockObserver() {
3059
+ this._observerState = ObserverState.Locked;
3060
+ }
3061
+ /**
3062
+ * Unlocks the observer so attribute changes will start to re-trigger properly
3063
+ */
3064
+ }, {
3065
+ key: "unlockObserver",
3066
+ value: function unlockObserver() {
3067
+ this._observerState = ObserverState.Unlocked;
2904
3068
  }
2905
3069
  /**
2906
3070
  * Destroys the active instance of this embed and resets internal state to default
@@ -2996,22 +3160,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
2996
3160
  }, {
2997
3161
  key: "initAR",
2998
3162
  value: function () {
2999
- var _initAR3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
3000
- return _regeneratorRuntime().wrap(function _callee24$(_context24) {
3001
- while (1) switch (_context24.prev = _context24.next) {
3163
+ var _initAR3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
3164
+ return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3165
+ while (1) switch (_context25.prev = _context25.next) {
3002
3166
  case 0:
3003
3167
  if (this._controller) {
3004
- _context24.next = 2;
3168
+ _context25.next = 2;
3005
3169
  break;
3006
3170
  }
3007
3171
  throw new Error("PlattarEmbed.initAR() - cannot execute as controller has not loaded yet");
3008
3172
  case 2:
3009
- return _context24.abrupt("return", this._controller.initAR());
3173
+ return _context25.abrupt("return", this._controller.initAR());
3010
3174
  case 3:
3011
3175
  case "end":
3012
- return _context24.stop();
3176
+ return _context25.stop();
3013
3177
  }
3014
- }, _callee24, this);
3178
+ }, _callee25, this);
3015
3179
  }));
3016
3180
  function initAR() {
3017
3181
  return _initAR3.apply(this, arguments);
@@ -3021,22 +3185,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3021
3185
  }, {
3022
3186
  key: "startAR",
3023
3187
  value: function () {
3024
- var _startAR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
3025
- return _regeneratorRuntime().wrap(function _callee25$(_context25) {
3026
- while (1) switch (_context25.prev = _context25.next) {
3188
+ var _startAR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3189
+ return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3190
+ while (1) switch (_context26.prev = _context26.next) {
3027
3191
  case 0:
3028
3192
  if (this._controller) {
3029
- _context25.next = 2;
3193
+ _context26.next = 2;
3030
3194
  break;
3031
3195
  }
3032
3196
  throw new Error("PlattarEmbed.startAR() - cannot execute as controller has not loaded yet");
3033
3197
  case 2:
3034
- return _context25.abrupt("return", this._controller.startAR());
3198
+ return _context26.abrupt("return", this._controller.startAR());
3035
3199
  case 3:
3036
3200
  case "end":
3037
- return _context25.stop();
3201
+ return _context26.stop();
3038
3202
  }
3039
- }, _callee25, this);
3203
+ }, _callee26, this);
3040
3204
  }));
3041
3205
  function startAR() {
3042
3206
  return _startAR2.apply(this, arguments);
@@ -3046,22 +3210,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3046
3210
  }, {
3047
3211
  key: "startViewer",
3048
3212
  value: function () {
3049
- var _startViewer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
3050
- return _regeneratorRuntime().wrap(function _callee26$(_context26) {
3051
- while (1) switch (_context26.prev = _context26.next) {
3213
+ var _startViewer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3214
+ return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3215
+ while (1) switch (_context27.prev = _context27.next) {
3052
3216
  case 0:
3053
3217
  if (this._controller) {
3054
- _context26.next = 2;
3218
+ _context27.next = 2;
3055
3219
  break;
3056
3220
  }
3057
3221
  throw new Error("PlattarEmbed.startViewer() - cannot execute as controller has not loaded yet");
3058
3222
  case 2:
3059
- return _context26.abrupt("return", this._controller.startRenderer());
3223
+ return _context27.abrupt("return", this._controller.startRenderer());
3060
3224
  case 3:
3061
3225
  case "end":
3062
- return _context26.stop();
3226
+ return _context27.stop();
3063
3227
  }
3064
- }, _callee26, this);
3228
+ }, _callee27, this);
3065
3229
  }));
3066
3230
  function startViewer() {
3067
3231
  return _startViewer.apply(this, arguments);
@@ -3071,25 +3235,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3071
3235
  }, {
3072
3236
  key: "startQRCode",
3073
3237
  value: function () {
3074
- var _startQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
3238
+ var _startQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3075
3239
  var options,
3076
- _args27 = arguments;
3077
- return _regeneratorRuntime().wrap(function _callee27$(_context27) {
3078
- while (1) switch (_context27.prev = _context27.next) {
3240
+ _args28 = arguments;
3241
+ return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3242
+ while (1) switch (_context28.prev = _context28.next) {
3079
3243
  case 0:
3080
- options = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : null;
3244
+ options = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : null;
3081
3245
  if (this._controller) {
3082
- _context27.next = 3;
3246
+ _context28.next = 3;
3083
3247
  break;
3084
3248
  }
3085
3249
  throw new Error("PlattarEmbed.startQRCode() - cannot execute as controller has not loaded yet");
3086
3250
  case 3:
3087
- return _context27.abrupt("return", this._controller.startQRCode(options));
3251
+ return _context28.abrupt("return", this._controller.startQRCode(options));
3088
3252
  case 4:
3089
3253
  case "end":
3090
- return _context27.stop();
3254
+ return _context28.stop();
3091
3255
  }
3092
- }, _callee27, this);
3256
+ }, _callee28, this);
3093
3257
  }));
3094
3258
  function startQRCode() {
3095
3259
  return _startQRCode2.apply(this, arguments);
@@ -3276,6 +3440,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3276
3440
  meta: {
3277
3441
  scene_product_index: 0,
3278
3442
  scene_model_index: 0,
3443
+ product_index: 0,
3279
3444
  product_variation_index: 1,
3280
3445
  meta_index: 2
3281
3446
  },
@@ -3289,6 +3454,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3289
3454
  if (parsedState.meta) {
3290
3455
  defaultState.meta.scene_product_index = parsedState.meta.scene_product_index || 0;
3291
3456
  defaultState.meta.scene_model_index = parsedState.meta.scene_model_index || 0;
3457
+ defaultState.meta.product_index = parsedState.meta.product_index || 0;
3292
3458
  defaultState.meta.product_variation_index = parsedState.meta.product_variation_index || 1;
3293
3459
  defaultState.meta.meta_index = parsedState.meta.meta_index || 2;
3294
3460
  }
@@ -3307,12 +3473,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3307
3473
  _createClass(ConfiguratorState, [{
3308
3474
  key: "setVariationSKU",
3309
3475
  value: function setVariationSKU(productVariationSKU) {
3310
- var variationID = this._mappedVariationSKUValues.get(productVariationSKU);
3311
- if (!variationID) {
3476
+ var _this27 = this;
3477
+ var variationIDs = this._mappedVariationSKUValues.get(productVariationSKU);
3478
+ if (!variationIDs) {
3312
3479
  console.warn("ConfiguratorState.setVariationSKU() - Variation SKU of " + productVariationSKU + " is not defined in any variations");
3313
3480
  return;
3314
3481
  }
3315
- this.setVariationID(variationID);
3482
+ variationIDs.forEach(function (variationID) {
3483
+ _this27.setVariationID(variationID);
3484
+ });
3316
3485
  }
3317
3486
  /**
3318
3487
  * Modifyes the SceneProduct that this Variation belongs to and changes for
@@ -3374,6 +3543,38 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3374
3543
  newData[meta.meta_index] = metaData;
3375
3544
  }
3376
3545
  }
3546
+ /**
3547
+ * Adds a new Product with meta-data into the Configurator State
3548
+ *
3549
+ * @param productID - The Product ID to add
3550
+ * @param metaData - Arbitrary meta-data that can be used against certain operaions
3551
+ */
3552
+ }, {
3553
+ key: "setProduct",
3554
+ value: function setProduct(productID, productVariationID) {
3555
+ var metaData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
3556
+ if (productID && productVariationID) {
3557
+ metaData = metaData || {
3558
+ augment: true,
3559
+ type: "product"
3560
+ };
3561
+ metaData.type = "product";
3562
+ var states = this._state.states;
3563
+ var meta = this._state.meta;
3564
+ var newData = null;
3565
+ var existingData = this.findSceneProductIndex(productID);
3566
+ if (existingData) {
3567
+ newData = existingData;
3568
+ } else {
3569
+ newData = [];
3570
+ // push the new data into the stack
3571
+ states.push(newData);
3572
+ }
3573
+ newData[meta.product_index] = productID;
3574
+ newData[meta.product_variation_index] = productVariationID;
3575
+ newData[meta.meta_index] = metaData;
3576
+ }
3577
+ }
3377
3578
  /**
3378
3579
  * Adds a new Scene Product/Variation combo with meta-data into the Configurator State
3379
3580
  *
@@ -3531,6 +3732,37 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3531
3732
  }
3532
3733
  return null;
3533
3734
  }
3735
+ /**
3736
+ * @returns Returns the first reference of data in the stack that matches a type, otherwise returns null
3737
+ */
3738
+ }, {
3739
+ key: "firstOfType",
3740
+ value: function firstOfType(type) {
3741
+ var states = this._state.states;
3742
+ if (states.length > 0) {
3743
+ var meta = this._state.meta;
3744
+ var found = states.find(function (productState) {
3745
+ var check = productState[meta.scene_product_index];
3746
+ if (check !== null && check !== undefined) {
3747
+ return productState.length === 3 && data.meta_data.type === type;
3748
+ }
3749
+ return false;
3750
+ });
3751
+ if (!found) {
3752
+ return null;
3753
+ }
3754
+ var data = {
3755
+ scene_product_id: found[meta.scene_product_index],
3756
+ product_variation_id: found[meta.product_variation_index],
3757
+ meta_data: {
3758
+ augment: found[meta.meta_index].augment || true,
3759
+ type: found[meta.meta_index].type || type
3760
+ }
3761
+ };
3762
+ return data;
3763
+ }
3764
+ return null;
3765
+ }
3534
3766
  }, {
3535
3767
  key: "length",
3536
3768
  get: function get() {
@@ -3566,20 +3798,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3566
3798
  }, {
3567
3799
  key: "decodeState",
3568
3800
  value: function () {
3569
- var _decodeState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
3801
+ var _decodeState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3570
3802
  var sceneID,
3571
3803
  state,
3572
3804
  configState,
3573
3805
  fscene,
3574
3806
  scene,
3575
- _args28 = arguments;
3576
- return _regeneratorRuntime().wrap(function _callee28$(_context28) {
3577
- while (1) switch (_context28.prev = _context28.next) {
3807
+ _args29 = arguments;
3808
+ return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3809
+ while (1) switch (_context29.prev = _context29.next) {
3578
3810
  case 0:
3579
- sceneID = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : null;
3580
- state = _args28.length > 1 && _args28[1] !== undefined ? _args28[1] : null;
3811
+ sceneID = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : null;
3812
+ state = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : null;
3581
3813
  if (!(!sceneID || !state)) {
3582
- _context28.next = 4;
3814
+ _context29.next = 4;
3583
3815
  break;
3584
3816
  }
3585
3817
  throw new Error("ConfiguratorState.decodeState(sceneID, state) - sceneID and state must be defined");
@@ -3587,22 +3819,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3587
3819
  configState = new ConfiguratorState(state);
3588
3820
  fscene = new plattar_api_1.Scene(sceneID);
3589
3821
  fscene.include(plattar_api_1.Project);
3822
+ fscene.include(plattar_api_1.Product);
3590
3823
  fscene.include(plattar_api_1.SceneProduct);
3591
3824
  fscene.include(plattar_api_1.SceneModel);
3592
3825
  fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
3593
- _context28.next = 12;
3826
+ _context29.next = 13;
3594
3827
  return fscene.get();
3595
- case 12:
3596
- scene = _context28.sent;
3597
- return _context28.abrupt("return", {
3828
+ case 13:
3829
+ scene = _context29.sent;
3830
+ return _context29.abrupt("return", {
3598
3831
  scene: scene,
3599
3832
  state: configState
3600
3833
  });
3601
- case 14:
3834
+ case 15:
3602
3835
  case "end":
3603
- return _context28.stop();
3836
+ return _context29.stop();
3604
3837
  }
3605
- }, _callee28);
3838
+ }, _callee29);
3606
3839
  }));
3607
3840
  function decodeState() {
3608
3841
  return _decodeState.apply(this, arguments);
@@ -3618,20 +3851,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3618
3851
  }, {
3619
3852
  key: "decodeScene",
3620
3853
  value: function () {
3621
- var _decodeScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
3854
+ var _decodeScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
3622
3855
  var sceneID,
3623
3856
  configState,
3624
3857
  fscene,
3625
3858
  scene,
3626
3859
  sceneProducts,
3627
3860
  sceneModels,
3628
- _args29 = arguments;
3629
- return _regeneratorRuntime().wrap(function _callee29$(_context29) {
3630
- while (1) switch (_context29.prev = _context29.next) {
3861
+ products,
3862
+ _args30 = arguments;
3863
+ return _regeneratorRuntime().wrap(function _callee30$(_context30) {
3864
+ while (1) switch (_context30.prev = _context30.next) {
3631
3865
  case 0:
3632
- sceneID = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : null;
3866
+ sceneID = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : null;
3633
3867
  if (sceneID) {
3634
- _context29.next = 3;
3868
+ _context30.next = 3;
3635
3869
  break;
3636
3870
  }
3637
3871
  throw new Error("ConfiguratorState.decodeScene(sceneID) - sceneID must be defined");
@@ -3641,20 +3875,31 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3641
3875
  fscene.include(plattar_api_1.Project);
3642
3876
  fscene.include(plattar_api_1.SceneProduct);
3643
3877
  fscene.include(plattar_api_1.SceneModel);
3878
+ fscene.include(plattar_api_1.Product);
3644
3879
  fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
3645
- _context29.next = 11;
3880
+ _context30.next = 12;
3646
3881
  return fscene.get();
3647
- case 11:
3648
- scene = _context29.sent;
3882
+ case 12:
3883
+ scene = _context30.sent;
3649
3884
  sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
3650
- sceneModels = scene.relationships.filter(plattar_api_1.SceneModel); // add out scene models
3885
+ sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
3886
+ products = scene.relationships.filter(plattar_api_1.Product); // add our scene models
3651
3887
  sceneModels.forEach(function (sceneModel) {
3652
3888
  configState.setSceneModel(sceneModel.id, {
3653
3889
  augment: sceneModel.attributes.include_in_augment,
3654
3890
  type: "scenemodel"
3655
3891
  });
3656
3892
  });
3657
- // add out scene products
3893
+ // add our products - this is used when scene == furniture
3894
+ products.forEach(function (product) {
3895
+ if (product.attributes.product_variation_id) {
3896
+ configState.setProduct(product.id, product.attributes.product_variation_id, {
3897
+ augment: true,
3898
+ type: "product"
3899
+ });
3900
+ }
3901
+ });
3902
+ // add our scene products
3658
3903
  sceneProducts.forEach(function (sceneProduct) {
3659
3904
  var product = sceneProduct.relationships.find(plattar_api_1.Product);
3660
3905
  if (product) {
@@ -3669,20 +3914,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3669
3914
  variations.forEach(function (variation) {
3670
3915
  configState._mappedVariationIDValues.set(variation.id, sceneProduct.id);
3671
3916
  if (variation.attributes.sku) {
3672
- configState._mappedVariationSKUValues.set(variation.attributes.sku, variation.id);
3917
+ var existingSKUs = configState._mappedVariationSKUValues.get(variation.attributes.sku);
3918
+ if (existingSKUs) {
3919
+ existingSKUs.push(variation.id);
3920
+ } else {
3921
+ configState._mappedVariationSKUValues.set(variation.attributes.sku, [variation.id]);
3922
+ }
3673
3923
  }
3674
3924
  });
3675
3925
  }
3676
3926
  });
3677
- return _context29.abrupt("return", {
3927
+ return _context30.abrupt("return", {
3678
3928
  scene: scene,
3679
3929
  state: configState
3680
3930
  });
3681
- case 17:
3931
+ case 20:
3682
3932
  case "end":
3683
- return _context29.stop();
3933
+ return _context30.stop();
3684
3934
  }
3685
- }, _callee29);
3935
+ }, _callee30);
3686
3936
  }));
3687
3937
  function decodeScene() {
3688
3938
  return _decodeScene.apply(this, arguments);
@@ -3810,7 +4060,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3810
4060
  Object.defineProperty(exports, "__esModule", {
3811
4061
  value: true
3812
4062
  });
3813
- exports["default"] = "1.155.2";
4063
+ exports["default"] = "1.155.4-b1";
3814
4064
  }, {}],
3815
4065
  17: [function (require, module, exports) {
3816
4066
  "use strict";
@@ -3841,13 +4091,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3841
4091
  _inherits(QuicklookViewer, _ar_viewer_1$default);
3842
4092
  var _super11 = _createSuper(QuicklookViewer);
3843
4093
  function QuicklookViewer() {
3844
- var _this27;
4094
+ var _this28;
3845
4095
  _classCallCheck(this, QuicklookViewer);
3846
- _this27 = _super11.call(this);
3847
- _this27.araction = null;
3848
- _this27.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
3849
- _this27.arcallback = function () {};
3850
- return _this27;
4096
+ _this28 = _super11.call(this);
4097
+ _this28.araction = null;
4098
+ _this28.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
4099
+ _this28.arcallback = function () {};
4100
+ return _this28;
3851
4101
  }
3852
4102
  _createClass(QuicklookViewer, [{
3853
4103
  key: "nodeType",
@@ -3862,7 +4112,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3862
4112
  }, {
3863
4113
  key: "start",
3864
4114
  value: function start() {
3865
- var _this28 = this;
4115
+ var _this29 = this;
3866
4116
  if (!this.modelUrl) {
3867
4117
  throw new Error("QuicklookViewer.start() - model url not set, use QuicklookViewer.modelUrl");
3868
4118
  }
@@ -3874,7 +4124,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3874
4124
  if (araction) {
3875
4125
  var handleQuicklook = function handleQuicklook(event) {
3876
4126
  if (event.data === "_apple_ar_quicklook_button_tapped") {
3877
- _this28.arcallback();
4127
+ _this29.arcallback();
3878
4128
  }
3879
4129
  document.body.removeChild(anchor);
3880
4130
  anchor.removeEventListener("message", handleQuicklook, false);
@@ -3960,14 +4210,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
3960
4210
  _inherits(SceneViewer, _ar_viewer_1$default3);
3961
4211
  var _super13 = _createSuper(SceneViewer);
3962
4212
  function SceneViewer() {
3963
- var _this29;
4213
+ var _this30;
3964
4214
  _classCallCheck(this, SceneViewer);
3965
- _this29 = _super13.call(this);
3966
- _this29.araction = null;
3967
- _this29.isVertical = false;
3968
- _this29.titleHTML = "<b>" + document.title;
3969
- _this29.isVertical = false;
3970
- return _this29;
4215
+ _this30 = _super13.call(this);
4216
+ _this30.araction = null;
4217
+ _this30.isVertical = false;
4218
+ _this30.titleHTML = "<b>" + document.title;
4219
+ _this30.isVertical = false;
4220
+ return _this30;
3971
4221
  }
3972
4222
  _createClass(SceneViewer, [{
3973
4223
  key: "nodeType",
@@ -4064,16 +4314,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4064
4314
  */
4065
4315
  var Memory = /*#__PURE__*/function () {
4066
4316
  function Memory(messengerInstance) {
4067
- var _this30 = this;
4317
+ var _this31 = this;
4068
4318
  _classCallCheck(this, Memory);
4069
4319
  this._messenger = messengerInstance;
4070
4320
  this._tempMemory = new TemporaryMemory(messengerInstance);
4071
4321
  this._permMemory = new PermanentMemory(messengerInstance);
4072
4322
  this._messenger.self.__memory__set_temp_var = function (name, data) {
4073
- _this30._tempMemory[name] = data;
4323
+ _this31._tempMemory[name] = data;
4074
4324
  };
4075
4325
  this._messenger.self.__memory__set_perm_var = function (name, data) {
4076
- _this30._permMemory[name] = data;
4326
+ _this31._permMemory[name] = data;
4077
4327
  };
4078
4328
  }
4079
4329
  _createClass(Memory, [{
@@ -4520,17 +4770,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4520
4770
  }, {
4521
4771
  key: "exec",
4522
4772
  value: function exec() {
4523
- var _this31 = this;
4773
+ var _this32 = this;
4524
4774
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
4525
4775
  args[_key3] = arguments[_key3];
4526
4776
  }
4527
4777
  return new Promise(function (accept, reject) {
4528
- if (!_this31._value) {
4529
- return reject(new Error("WrappedLocalFunction.exec() function with name " + _this31._funcName + "() is not defined"));
4778
+ if (!_this32._value) {
4779
+ return reject(new Error("WrappedLocalFunction.exec() function with name " + _this32._funcName + "() is not defined"));
4530
4780
  }
4531
4781
  try {
4532
4782
  // otherwise execute the function
4533
- var rObject = _this31._execute.apply(_this31, args);
4783
+ var rObject = _this32._execute.apply(_this32, args);
4534
4784
 
4535
4785
  // we need to check if the returned object is a Promise, if so, handle it
4536
4786
  // differently. This can happen if the function wants to execute asyn
@@ -4596,7 +4846,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4596
4846
  _createClass(FunctionObserver, [{
4597
4847
  key: "subscribe",
4598
4848
  value: function subscribe(functionName, callback) {
4599
- var _this32 = this;
4849
+ var _this33 = this;
4600
4850
  if (!functionName || !Util.isFunction(callback)) {
4601
4851
  return function () {};
4602
4852
  }
@@ -4610,7 +4860,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4610
4860
  }
4611
4861
  list.push(callback);
4612
4862
  return function () {
4613
- return _this32.unsubscribe(functionName, callback);
4863
+ return _this33.unsubscribe(functionName, callback);
4614
4864
  };
4615
4865
  }
4616
4866
 
@@ -4677,7 +4927,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4677
4927
  */
4678
4928
  var GlobalEventHandler = /*#__PURE__*/function () {
4679
4929
  function GlobalEventHandler() {
4680
- var _this33 = this;
4930
+ var _this34 = this;
4681
4931
  _classCallCheck(this, GlobalEventHandler);
4682
4932
  this._eventListeners = {};
4683
4933
 
@@ -4697,11 +4947,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4697
4947
  // make sure the event is properly formatted
4698
4948
  if (jsonData && jsonData.event && jsonData.data) {
4699
4949
  // see if there are any listeners for this
4700
- if (_this33._eventListeners[jsonData.event]) {
4950
+ if (_this34._eventListeners[jsonData.event]) {
4701
4951
  var remoteInterface = new RemoteInterface(evt.source, evt.origin);
4702
4952
 
4703
4953
  // loop through and call all the event handlers
4704
- _this33._eventListeners[jsonData.event].forEach(function (callback) {
4954
+ _this34._eventListeners[jsonData.event].forEach(function (callback) {
4705
4955
  try {
4706
4956
  callback(remoteInterface, jsonData.data);
4707
4957
  } catch (e) {
@@ -4893,33 +5143,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4893
5143
  }, {
4894
5144
  key: "_registerListeners",
4895
5145
  value: function _registerListeners() {
4896
- var _this34 = this;
5146
+ var _this35 = this;
4897
5147
  GlobalEventHandler.instance().listen("__messenger__child_init", function (src, data) {
4898
5148
  var iframeID = src.id;
4899
5149
 
4900
5150
  // check reserved key list
4901
5151
  switch (iframeID) {
4902
5152
  case undefined:
4903
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID cannot be undefined");
5153
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID cannot be undefined");
4904
5154
  case "self":
4905
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
5155
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
4906
5156
  case "parent":
4907
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
5157
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
4908
5158
  case "id":
4909
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
5159
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
4910
5160
  case "onload":
4911
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
5161
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
4912
5162
  default:
4913
5163
  break;
4914
5164
  }
4915
5165
 
4916
5166
  // initialise the child iframe as a messenger pipe
4917
- _this34[iframeID] = new RemoteFunctionList(iframeID, _this34._functionObserver);
4918
- _this34[iframeID].setup(new RemoteInterface(src.source, src.origin));
5167
+ _this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
5168
+ _this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
4919
5169
 
4920
5170
  // add the interface to the broadcaster
4921
- _this34._broadcaster._push(iframeID);
4922
- var callbacks = _this34._callbacks;
5171
+ _this35._broadcaster._push(iframeID);
5172
+ var callbacks = _this35._callbacks;
4923
5173
 
4924
5174
  // we have registered callbacks, begin execution
4925
5175
  if (callbacks.has(iframeID)) {
@@ -4943,26 +5193,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4943
5193
  // check reserved key list
4944
5194
  switch (iframeID) {
4945
5195
  case undefined:
4946
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID cannot be undefined");
5196
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID cannot be undefined");
4947
5197
  case "self":
4948
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
5198
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
4949
5199
  case "parent":
4950
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
5200
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
4951
5201
  case "id":
4952
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
5202
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
4953
5203
  case "onload":
4954
- throw new Error("Messenger[" + _this34._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
5204
+ throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
4955
5205
  default:
4956
5206
  break;
4957
5207
  }
4958
5208
 
4959
5209
  // initialise the child iframe as a messenger pipe
4960
- _this34[iframeID] = new RemoteFunctionList(iframeID, _this34._functionObserver);
4961
- _this34[iframeID].setup(new RemoteInterface(src.source, src.origin));
5210
+ _this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
5211
+ _this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
4962
5212
 
4963
5213
  // add the interface to the broadcaster
4964
- _this34._broadcaster._push(iframeID);
4965
- var callbacks = _this34._callbacks;
5214
+ _this35._broadcaster._push(iframeID);
5215
+ var callbacks = _this35._callbacks;
4966
5216
 
4967
5217
  // we have registered callbacks, begin execution
4968
5218
  if (callbacks.has(iframeID)) {
@@ -4981,9 +5231,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4981
5231
  });
4982
5232
  GlobalEventHandler.instance().listen("__messenger__parent_init", function (src, data) {
4983
5233
  var iframeID = "parent";
4984
- _this34[iframeID] = new RemoteFunctionList(iframeID, _this34._functionObserver);
4985
- _this34[iframeID].setup(new RemoteInterface(src.source, src.origin));
4986
- var callbacks = _this34._callbacks;
5234
+ _this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
5235
+ _this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
5236
+ var callbacks = _this35._callbacks;
4987
5237
 
4988
5238
  // we have registered callbacks, begin execution
4989
5239
  if (callbacks.has(iframeID)) {
@@ -5007,9 +5257,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5007
5257
  */
5008
5258
  GlobalEventHandler.instance().listen("__messenger__parent_init_inv", function (src, data) {
5009
5259
  var iframeID = "parent";
5010
- _this34[iframeID] = new RemoteFunctionList(iframeID, _this34._functionObserver);
5011
- _this34[iframeID].setup(new RemoteInterface(src.source, src.origin));
5012
- var callbacks = _this34._callbacks;
5260
+ _this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
5261
+ _this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
5262
+ var callbacks = _this35._callbacks;
5013
5263
 
5014
5264
  // we have registered callbacks, begin execution
5015
5265
  if (callbacks.has(iframeID)) {
@@ -5231,7 +5481,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5231
5481
  */
5232
5482
  var WrappedRemoteFunction = /*#__PURE__*/function () {
5233
5483
  function WrappedRemoteFunction(funcName, remoteInterface, functionObserver) {
5234
- var _this35 = this;
5484
+ var _this36 = this;
5235
5485
  _classCallCheck(this, WrappedRemoteFunction);
5236
5486
  this._funcName = funcName;
5237
5487
  this._remoteInterface = remoteInterface;
@@ -5243,24 +5493,24 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5243
5493
  var instanceID = data.instance_id;
5244
5494
 
5245
5495
  // the function name must match
5246
- if (data.function_name !== _this35._funcName) {
5496
+ if (data.function_name !== _this36._funcName) {
5247
5497
  return;
5248
5498
  }
5249
5499
 
5250
5500
  // the instance ID must be found, otherwise this is a rogue execution
5251
5501
  // that can be ignored (should not happen)
5252
- if (!_this35._callInstances[instanceID]) {
5502
+ if (!_this36._callInstances[instanceID]) {
5253
5503
  return;
5254
5504
  }
5255
- var promise = _this35._callInstances[instanceID];
5505
+ var promise = _this36._callInstances[instanceID];
5256
5506
 
5257
5507
  // remove the old instance
5258
- delete _this35._callInstances[instanceID];
5508
+ delete _this36._callInstances[instanceID];
5259
5509
 
5260
5510
  // perform the promise callbacks
5261
5511
  if (data.function_status === "success") {
5262
5512
  // execute the observers
5263
- _this35._functionObserver.call(_this35._funcName, {
5513
+ _this36._functionObserver.call(_this36._funcName, {
5264
5514
  type: "return",
5265
5515
  state: "success",
5266
5516
  data: data.function_args
@@ -5268,7 +5518,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5268
5518
  promise.accept(data.function_args);
5269
5519
  } else {
5270
5520
  // execute the observers
5271
- _this35._functionObserver.call(_this35._funcName, {
5521
+ _this36._functionObserver.call(_this36._funcName, {
5272
5522
  type: "return",
5273
5523
  state: "exception",
5274
5524
  data: new Error(data.function_args)
@@ -5284,7 +5534,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5284
5534
  _createClass(WrappedRemoteFunction, [{
5285
5535
  key: "exec",
5286
5536
  value: function exec() {
5287
- var _this36 = this;
5537
+ var _this37 = this;
5288
5538
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
5289
5539
  args[_key4] = arguments[_key4];
5290
5540
  }
@@ -5303,20 +5553,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5303
5553
  // to be executed later
5304
5554
  return new Promise(function (accept, reject) {
5305
5555
  // save this promise to be executed later
5306
- _this36._callInstances[instanceID] = {
5556
+ _this37._callInstances[instanceID] = {
5307
5557
  accept: accept,
5308
5558
  reject: reject
5309
5559
  };
5310
5560
 
5311
5561
  // execute this event in another context
5312
- _this36._remoteInterface.send("__messenger__exec_fnc", {
5562
+ _this37._remoteInterface.send("__messenger__exec_fnc", {
5313
5563
  instance_id: instanceID,
5314
- function_name: _this36._funcName,
5564
+ function_name: _this37._funcName,
5315
5565
  function_args: args
5316
5566
  });
5317
5567
 
5318
5568
  // execute the observers
5319
- _this36._functionObserver.call(_this36._funcName, {
5569
+ _this37._functionObserver.call(_this37._funcName, {
5320
5570
  type: "call",
5321
5571
  state: "success",
5322
5572
  data: args
@@ -5465,7 +5715,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5465
5715
  var google_analytics_1 = require("./google/google-analytics");
5466
5716
  var Analytics = /*#__PURE__*/function () {
5467
5717
  function Analytics(applicationID) {
5468
- var _this37 = this;
5718
+ var _this38 = this;
5469
5719
  _classCallCheck(this, Analytics);
5470
5720
  this._pageTime = null;
5471
5721
  this.origin = "production";
@@ -5479,17 +5729,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5479
5729
  this._ga = new google_analytics_1.GoogleAnalytics();
5480
5730
  this._handlePageHide = function () {
5481
5731
  if (document.visibilityState === "hidden") {
5482
- _this37._pageTime = new Date();
5483
- } else if (_this37._pageTime) {
5732
+ _this38._pageTime = new Date();
5733
+ } else if (_this38._pageTime) {
5484
5734
  var time2 = new Date();
5485
- var diff = time2.getTime() - _this37._pageTime.getTime();
5486
- var data = _this37.data;
5735
+ var diff = time2.getTime() - _this38._pageTime.getTime();
5736
+ var data = _this38.data;
5487
5737
  data.push("eventAction", "View Time");
5488
5738
  data.push("viewTime", diff);
5489
5739
  data.push("eventLabel", diff);
5490
- _this37.write();
5491
- _this37._pageTime = null;
5492
- document.removeEventListener("visibilitychange", _this37._handlePageHide, false);
5740
+ _this38.write();
5741
+ _this38._pageTime = null;
5742
+ document.removeEventListener("visibilitychange", _this38._handlePageHide, false);
5493
5743
  }
5494
5744
  };
5495
5745
  }
@@ -5501,18 +5751,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5501
5751
  }, {
5502
5752
  key: "query",
5503
5753
  value: function query() {
5504
- var _this38 = this;
5754
+ var _this39 = this;
5505
5755
  var _query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
5506
5756
  return new Promise(function (accept, reject) {
5507
5757
  if (!_query) {
5508
5758
  return reject(new Error("Analytics.query() - provided query was null"));
5509
5759
  }
5510
- var url = _this38.origin === "dev" ? "https://localhost:3008/v3/read" : "https://analytics.plattar.com/v3/read";
5760
+ var url = _this39.origin === "dev" ? "https://localhost:3008/v3/read" : "https://analytics.plattar.com/v3/read";
5511
5761
  var data = {
5512
5762
  data: {
5513
5763
  attributes: {
5514
- application_id: _this38._applicationID,
5515
- event: _this38.event,
5764
+ application_id: _this39._applicationID,
5765
+ event: _this39.event,
5516
5766
  query: _query
5517
5767
  }
5518
5768
  }
@@ -5525,22 +5775,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5525
5775
  }, {
5526
5776
  key: "write",
5527
5777
  value: function write() {
5528
- var _this39 = this;
5778
+ var _this40 = this;
5529
5779
  return new Promise(function (accept, reject) {
5530
- var data = _this39._data;
5531
- var url = _this39.origin === "dev" ? "https://localhost:3008/v3/write" : "https://analytics.plattar.com/v3/write";
5532
- data.push("applicationId", _this39._applicationID);
5780
+ var data = _this40._data;
5781
+ var url = _this40.origin === "dev" ? "https://localhost:3008/v3/write" : "https://analytics.plattar.com/v3/write";
5782
+ data.push("applicationId", _this40._applicationID);
5533
5783
  var sendData = {
5534
5784
  data: {
5535
5785
  attributes: {
5536
- application_id: _this39._applicationID,
5537
- event: _this39.event,
5538
- origin: _this39.origin,
5786
+ application_id: _this40._applicationID,
5787
+ event: _this40.event,
5788
+ origin: _this40.origin,
5539
5789
  fields: data.data
5540
5790
  }
5541
5791
  }
5542
5792
  };
5543
- if (_this39.isBeacon === false) {
5793
+ if (_this40.isBeacon === false) {
5544
5794
  basic_http_1["default"].exec("POST", url, sendData).then(function (result) {
5545
5795
  accept(result ? result : {});
5546
5796
  })["catch"](reject);
@@ -5549,7 +5799,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5549
5799
  accept(result ? result : {});
5550
5800
  })["catch"](reject);
5551
5801
  }
5552
- _this39.googleAnalytics.write(_this39.event, _this39.data);
5802
+ _this40.googleAnalytics.write(_this40.event, _this40.data);
5553
5803
  });
5554
5804
  }
5555
5805
  }, {
@@ -6101,10 +6351,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6101
6351
  }, {
6102
6352
  key: "_get",
6103
6353
  value: function _get(opt) {
6104
- var _this40 = this;
6354
+ var _this41 = this;
6105
6355
  return new Promise(function (resolve, reject) {
6106
- var target = _this40.target;
6107
- var server = _this40.server;
6356
+ var target = _this41.target;
6357
+ var server = _this41.server;
6108
6358
 
6109
6359
  // we cannot perform a GET request without an ID
6110
6360
  if (!target.id) {
@@ -6129,15 +6379,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6129
6379
  var origin = server.originLocation.api_read;
6130
6380
  var auth = server.authToken;
6131
6381
  var headers = {
6132
- 'cookie': 'laravel_session=' + _this40.getCookie('laravel_session')
6382
+ 'cookie': 'laravel_session=' + _this41.getCookie('laravel_session')
6133
6383
  };
6134
6384
  Object.assign(headers, auth);
6135
6385
  var reqopts = {
6136
6386
  method: "GET",
6137
6387
  headers: headers
6138
6388
  };
6139
- var includeQuery = _this40._IncludeQuery;
6140
- var params = _this40._ParamFor("get");
6389
+ var includeQuery = _this41._IncludeQuery;
6390
+ var params = _this41._ParamFor("get");
6141
6391
  var endpoint = origin + target.type() + "/" + target.id;
6142
6392
  if (includeQuery) {
6143
6393
  endpoint = endpoint + "?include=" + includeQuery;
@@ -6172,10 +6422,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6172
6422
  }, {
6173
6423
  key: "_update",
6174
6424
  value: function _update() {
6175
- var _this41 = this;
6425
+ var _this42 = this;
6176
6426
  return new Promise(function (resolve, reject) {
6177
- var target = _this41.target;
6178
- var server = _this41.server;
6427
+ var target = _this42.target;
6428
+ var server = _this42.server;
6179
6429
 
6180
6430
  // we cannot perform a GET request without an ID
6181
6431
  if (!target.id) {
@@ -6189,7 +6439,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6189
6439
  var headers = {
6190
6440
  'Accept': 'application/json',
6191
6441
  'Content-Type': 'application/json',
6192
- 'cookie': 'laravel_session=' + _this41.getCookie('laravel_session')
6442
+ 'cookie': 'laravel_session=' + _this42.getCookie('laravel_session')
6193
6443
  };
6194
6444
  Object.assign(headers, auth);
6195
6445
  var reqopts = {
@@ -6203,7 +6453,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6203
6453
  meta: target.meta || {}
6204
6454
  })
6205
6455
  };
6206
- var params = _this41._ParamFor("update");
6456
+ var params = _this42._ParamFor("update");
6207
6457
  var endpoint = origin + target.type() + "/" + target.id;
6208
6458
  if (params) {
6209
6459
  var appender = "?";
@@ -6239,10 +6489,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6239
6489
  }, {
6240
6490
  key: "_create",
6241
6491
  value: function _create() {
6242
- var _this42 = this;
6492
+ var _this43 = this;
6243
6493
  return new Promise(function (resolve, reject) {
6244
- var target = _this42.target;
6245
- var server = _this42.server;
6494
+ var target = _this43.target;
6495
+ var server = _this43.server;
6246
6496
 
6247
6497
  // otherwise, proceed with the fetching op
6248
6498
  var origin = server.originLocation.api_write;
@@ -6250,7 +6500,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6250
6500
  var headers = {
6251
6501
  'Accept': 'application/json',
6252
6502
  'Content-Type': 'application/json',
6253
- 'cookie': 'laravel_session=' + _this42.getCookie('laravel_session')
6503
+ 'cookie': 'laravel_session=' + _this43.getCookie('laravel_session')
6254
6504
  };
6255
6505
  Object.assign(headers, auth);
6256
6506
  var reqopts = {
@@ -6263,7 +6513,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6263
6513
  meta: target.meta || {}
6264
6514
  })
6265
6515
  };
6266
- var params = _this42._ParamFor("create");
6516
+ var params = _this43._ParamFor("create");
6267
6517
  var endpoint = origin + target.type();
6268
6518
  if (params) {
6269
6519
  var appender = "?";
@@ -6300,10 +6550,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6300
6550
  }, {
6301
6551
  key: "_delete",
6302
6552
  value: function _delete() {
6303
- var _this43 = this;
6553
+ var _this44 = this;
6304
6554
  return new Promise(function (resolve, reject) {
6305
- var target = _this43.target;
6306
- var server = _this43.server;
6555
+ var target = _this44.target;
6556
+ var server = _this44.server;
6307
6557
 
6308
6558
  // we cannot perform a GET request without an ID
6309
6559
  if (!target.id) {
@@ -6317,7 +6567,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6317
6567
  var headers = {
6318
6568
  'Accept': 'application/json',
6319
6569
  'Content-Type': 'application/json',
6320
- 'cookie': 'laravel_session=' + _this43.getCookie('laravel_session')
6570
+ 'cookie': 'laravel_session=' + _this44.getCookie('laravel_session')
6321
6571
  };
6322
6572
  Object.assign(headers, auth);
6323
6573
  var reqopts = {
@@ -6331,7 +6581,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6331
6581
  meta: target.meta || {}
6332
6582
  })
6333
6583
  };
6334
- var params = _this43._ParamFor("delete");
6584
+ var params = _this44._ParamFor("delete");
6335
6585
  var endpoint = origin + target.type() + "/" + target.id;
6336
6586
  if (params) {
6337
6587
  var appender = "?";
@@ -6386,7 +6636,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6386
6636
  }, {
6387
6637
  key: "_include",
6388
6638
  value: function _include(args) {
6389
- var _this44 = this;
6639
+ var _this45 = this;
6390
6640
  if (!args || args.length <= 0) {
6391
6641
  return this;
6392
6642
  }
@@ -6396,20 +6646,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6396
6646
  if (Array.isArray(obj)) {
6397
6647
  obj.forEach(function (strObject) {
6398
6648
  if (typeof strObject === "string" || strObject instanceof String) {
6399
- _this44._getIncludeQuery.push(strObject);
6649
+ _this45._getIncludeQuery.push(strObject);
6400
6650
  } else {
6401
- throw new Error("PlattarQuery." + _this44.target.type() + ".include(...args) - argument of Array must only include Strings");
6651
+ throw new Error("PlattarQuery." + _this45.target.type() + ".include(...args) - argument of Array must only include Strings");
6402
6652
  }
6403
6653
  });
6404
6654
  } else if (PlattarUtil.isPlattarObject(obj)) {
6405
6655
  var type = obj.type();
6406
6656
  if (Array.isArray(type)) {
6407
- _this44._include(type);
6657
+ _this45._include(type);
6408
6658
  } else {
6409
- _this44._getIncludeQuery.push(type);
6659
+ _this45._getIncludeQuery.push(type);
6410
6660
  }
6411
6661
  } else {
6412
- throw new Error("PlattarQuery." + _this44.target.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
6662
+ throw new Error("PlattarQuery." + _this45.target.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
6413
6663
  }
6414
6664
  });
6415
6665
  return this;
@@ -6544,12 +6794,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6544
6794
  }, {
6545
6795
  key: "auth",
6546
6796
  value: function auth(token, opt) {
6547
- var _this45 = this;
6797
+ var _this46 = this;
6548
6798
  var copt = opt || {
6549
6799
  validate: false
6550
6800
  };
6551
6801
  return new Promise(function (resolve, reject) {
6552
- var server = _this45.originLocation.api_write;
6802
+ var server = _this46.originLocation.api_write;
6553
6803
  if (!server) {
6554
6804
  reject(new Error("Plattar.auth(token) - cannot authenticate as server not set via Plattar.origin(server)"));
6555
6805
  return;
@@ -6559,10 +6809,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6559
6809
  return;
6560
6810
  }
6561
6811
  if (!copt.validate) {
6562
- _this45._authToken = {
6812
+ _this46._authToken = {
6563
6813
  "plattar-auth-token": token
6564
6814
  };
6565
- resolve(_this45);
6815
+ resolve(_this46);
6566
6816
  return;
6567
6817
  }
6568
6818
  var endpoint = server + "plattaruser/xauth/validate";
@@ -6574,10 +6824,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6574
6824
  };
6575
6825
  fetch(endpoint, options).then(function (res) {
6576
6826
  if (res.ok) {
6577
- _this45._authToken = {
6827
+ _this46._authToken = {
6578
6828
  "plattar-auth-token": token
6579
6829
  };
6580
- resolve(_this45);
6830
+ resolve(_this46);
6581
6831
  } else {
6582
6832
  reject(new Error("Plattar.auth(token) - failed to validate authentication token at " + endpoint));
6583
6833
  }
@@ -6587,7 +6837,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6587
6837
  }, {
6588
6838
  key: "origin",
6589
6839
  value: function origin(server, opt) {
6590
- var _this46 = this;
6840
+ var _this47 = this;
6591
6841
  var copt = opt || {
6592
6842
  validate: false
6593
6843
  };
@@ -6597,8 +6847,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6597
6847
  return;
6598
6848
  }
6599
6849
  if (!copt.validate) {
6600
- _this46._serverLocation = server;
6601
- resolve(_this46);
6850
+ _this47._serverLocation = server;
6851
+ resolve(_this47);
6602
6852
  return;
6603
6853
  }
6604
6854
  var endpoint = server.api_read + "ping";
@@ -6607,8 +6857,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6607
6857
  };
6608
6858
  fetch(endpoint, options).then(function (res) {
6609
6859
  if (res.ok) {
6610
- _this46._serverLocation = server;
6611
- resolve(_this46);
6860
+ _this47._serverLocation = server;
6861
+ resolve(_this47);
6612
6862
  } else {
6613
6863
  reject(new Error("Plattar.origin(server) - failed to ping server at " + endpoint));
6614
6864
  }
@@ -6942,13 +7192,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
6942
7192
  _inherits(FileBase, _PlattarBase11);
6943
7193
  var _super25 = _createSuper(FileBase);
6944
7194
  function FileBase(id, server) {
6945
- var _this47;
7195
+ var _this48;
6946
7196
  _classCallCheck(this, FileBase);
6947
- _this47 = _super25.call(this, id, server || Server["default"]());
6948
- if (_this47.constructor === FileBase) {
7197
+ _this48 = _super25.call(this, id, server || Server["default"]());
7198
+ if (_this48.constructor === FileBase) {
6949
7199
  throw new Error("FileBase is abstract and cannot be created");
6950
7200
  }
6951
- return _this47;
7201
+ return _this48;
6952
7202
  }
6953
7203
  _createClass(FileBase, [{
6954
7204
  key: "sourcePath",
@@ -7101,13 +7351,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7101
7351
  _inherits(PlattarBase, _PlattarObject);
7102
7352
  var _super30 = _createSuper(PlattarBase);
7103
7353
  function PlattarBase(id, server) {
7104
- var _this48;
7354
+ var _this49;
7105
7355
  _classCallCheck(this, PlattarBase);
7106
- _this48 = _super30.call(this, id, server || Server["default"]());
7107
- if (_this48.constructor === PlattarBase) {
7356
+ _this49 = _super30.call(this, id, server || Server["default"]());
7357
+ if (_this49.constructor === PlattarBase) {
7108
7358
  throw new Error("PlattarBase is abstract and cannot be created");
7109
7359
  }
7110
- return _this48;
7360
+ return _this49;
7111
7361
  }
7112
7362
  return _createClass(PlattarBase);
7113
7363
  }(PlattarObject);
@@ -7174,7 +7424,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7174
7424
  }, {
7175
7425
  key: "filter",
7176
7426
  value: function filter(obj, id) {
7177
- var _this49 = this;
7427
+ var _this50 = this;
7178
7428
  if (!obj) {
7179
7429
  return [];
7180
7430
  }
@@ -7190,7 +7440,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7190
7440
  if (Array.isArray(type)) {
7191
7441
  var compiledList = [];
7192
7442
  type.forEach(function (inObject) {
7193
- var retArray = _this49.filter(inObject, id);
7443
+ var retArray = _this50.filter(inObject, id);
7194
7444
  if (retArray.length > 0) {
7195
7445
  compiledList = compiledList.concat(retArray);
7196
7446
  }
@@ -7378,7 +7628,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7378
7628
  }, {
7379
7629
  key: "include",
7380
7630
  value: function include() {
7381
- var _this50 = this;
7631
+ var _this51 = this;
7382
7632
  for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
7383
7633
  args[_key6] = arguments[_key6];
7384
7634
  }
@@ -7391,15 +7641,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7391
7641
  if (Array.isArray(obj)) {
7392
7642
  obj.forEach(function (strObject) {
7393
7643
  if (typeof strObject === "string" || strObject instanceof String) {
7394
- includes.push("".concat(_this50.type(), ".").concat(strObject));
7644
+ includes.push("".concat(_this51.type(), ".").concat(strObject));
7395
7645
  } else {
7396
- throw new Error("PlattarObject." + _this50.type() + ".include(...args) - argument of Array must only include Strings");
7646
+ throw new Error("PlattarObject." + _this51.type() + ".include(...args) - argument of Array must only include Strings");
7397
7647
  }
7398
7648
  });
7399
7649
  } else if (obj.prototype instanceof PlattarObject) {
7400
- includes.push("".concat(_this50.type(), ".").concat(obj.type()));
7650
+ includes.push("".concat(_this51.type(), ".").concat(obj.type()));
7401
7651
  } else {
7402
- throw new Error("PlattarObject." + _this50.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
7652
+ throw new Error("PlattarObject." + _this51.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
7403
7653
  }
7404
7654
  });
7405
7655
  return includes;
@@ -7529,13 +7779,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7529
7779
  _inherits(CardBase, _PlattarBase17);
7530
7780
  var _super36 = _createSuper(CardBase);
7531
7781
  function CardBase(id, server) {
7532
- var _this51;
7782
+ var _this52;
7533
7783
  _classCallCheck(this, CardBase);
7534
- _this51 = _super36.call(this, id, server || Server["default"]());
7535
- if (_this51.constructor === CardBase) {
7784
+ _this52 = _super36.call(this, id, server || Server["default"]());
7785
+ if (_this52.constructor === CardBase) {
7536
7786
  throw new Error("CardBase is abstract and cannot be created");
7537
7787
  }
7538
- return _this51;
7788
+ return _this52;
7539
7789
  }
7540
7790
  _createClass(CardBase, null, [{
7541
7791
  key: "type",
@@ -7852,13 +8102,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7852
8102
  _inherits(ProductBase, _PlattarBase19);
7853
8103
  var _super50 = _createSuper(ProductBase);
7854
8104
  function ProductBase(id, server) {
7855
- var _this52;
8105
+ var _this53;
7856
8106
  _classCallCheck(this, ProductBase);
7857
- _this52 = _super50.call(this, id, server || Server["default"]());
7858
- if (_this52.constructor === ProductBase) {
8107
+ _this53 = _super50.call(this, id, server || Server["default"]());
8108
+ if (_this53.constructor === ProductBase) {
7859
8109
  throw new Error("ProductBase is abstract and cannot be created");
7860
8110
  }
7861
- return _this52;
8111
+ return _this53;
7862
8112
  }
7863
8113
  _createClass(ProductBase, null, [{
7864
8114
  key: "type",
@@ -7968,13 +8218,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
7968
8218
  _inherits(SceneBase, _PlattarBase21);
7969
8219
  var _super55 = _createSuper(SceneBase);
7970
8220
  function SceneBase(id, server) {
7971
- var _this53;
8221
+ var _this54;
7972
8222
  _classCallCheck(this, SceneBase);
7973
- _this53 = _super55.call(this, id, server || Server["default"]());
7974
- if (_this53.constructor === SceneBase) {
8223
+ _this54 = _super55.call(this, id, server || Server["default"]());
8224
+ if (_this54.constructor === SceneBase) {
7975
8225
  throw new Error("SceneBase is abstract and cannot be created");
7976
8226
  }
7977
- return _this53;
8227
+ return _this54;
7978
8228
  }
7979
8229
  _createClass(SceneBase, null, [{
7980
8230
  key: "type",
@@ -8677,15 +8927,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8677
8927
  _createClass(BaseElement, [{
8678
8928
  key: "connectedCallback",
8679
8929
  value: function connectedCallback() {
8680
- var _this54 = this;
8930
+ var _this55 = this;
8681
8931
  if (this.hasAttribute("url")) {
8682
8932
  this.renderQRCode();
8683
8933
  }
8684
8934
  var observer = new MutationObserver(function (mutations) {
8685
8935
  mutations.forEach(function (mutation) {
8686
8936
  if (mutation.type === "attributes") {
8687
- if (_this54.hasAttribute("url")) {
8688
- _this54.renderQRCode();
8937
+ if (_this55.hasAttribute("url")) {
8938
+ _this55.renderQRCode();
8689
8939
  }
8690
8940
  }
8691
8941
  });
@@ -8708,7 +8958,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8708
8958
  }, {
8709
8959
  key: "renderQRCode",
8710
8960
  value: function renderQRCode() {
8711
- var _this55 = this;
8961
+ var _this56 = this;
8712
8962
  var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
8713
8963
  if (!url) {
8714
8964
  console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
@@ -8816,11 +9066,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8816
9066
  var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
8817
9067
  if (shortenURL && shortenURL.toLowerCase() === "true") {
8818
9068
  this._ShortenURL(url).then(function (newURL) {
8819
- _this55._GenerateQRCode(newURL, width, height);
9069
+ _this56._GenerateQRCode(newURL, width, height);
8820
9070
  })["catch"](function (_err) {
8821
9071
  console.warn(_err);
8822
9072
  // ignore error and just generate normal QR Code
8823
- _this55._GenerateQRCode(url, width, height);
9073
+ _this56._GenerateQRCode(url, width, height);
8824
9074
  });
8825
9075
  } else {
8826
9076
  this._GenerateQRCode(url, width, height);
@@ -8889,9 +9139,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
8889
9139
  }, {
8890
9140
  key: "_ShortenURL",
8891
9141
  value: function _ShortenURL(url) {
8892
- var _this56 = this;
9142
+ var _this57 = this;
8893
9143
  return new Promise(function (accept, reject) {
8894
- if (!_this56._IsFetchAPISupported()) {
9144
+ if (!_this57._IsFetchAPISupported()) {
8895
9145
  return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
8896
9146
  }
8897
9147
  try {
@@ -9084,10 +9334,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
9084
9334
  }, {
9085
9335
  key: "get",
9086
9336
  value: function get() {
9087
- var _this57 = this;
9337
+ var _this58 = this;
9088
9338
  return new Promise(function (accept, reject) {
9089
- _this57._CalculateHash().then(function () {
9090
- remote_request_1.RemoteRequest.request(_this57._GetPayload(), _this57.retry < 0 ? 0 : _this57.retry).then(accept)["catch"](reject);
9339
+ _this58._CalculateHash().then(function () {
9340
+ remote_request_1.RemoteRequest.request(_this58._GetPayload(), _this58.retry < 0 ? 0 : _this58.retry).then(accept)["catch"](reject);
9091
9341
  })["catch"](function (_err) {
9092
9342
  reject(new Error("Configurator.get() - one of the objects does not exist in Plattar API"));
9093
9343
  });
@@ -9096,12 +9346,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
9096
9346
  }, {
9097
9347
  key: "_CalculateHash",
9098
9348
  value: function _CalculateHash() {
9099
- var _this58 = this;
9349
+ var _this59 = this;
9100
9350
  return new Promise(function (accept, reject) {
9101
9351
  var promises = [];
9102
9352
  var oldOrigin = plattar_api_1.Server["default"]().originLocation.type;
9103
- plattar_api_1.Server.create(plattar_api_1.Server.match(_this58.server));
9104
- _this58._maps.forEach(function (map) {
9353
+ plattar_api_1.Server.create(plattar_api_1.Server.match(_this59.server));
9354
+ _this59._maps.forEach(function (map) {
9105
9355
  if (map.productvariation) {
9106
9356
  promises.push(new plattar_api_1.ProductVariation(map.productvariation).get());
9107
9357
  }
@@ -9117,7 +9367,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
9117
9367
  });
9118
9368
  Promise.all(promises).then(function (values) {
9119
9369
  values.forEach(function (value) {
9120
- _this58._attrHash.push(value.attributes);
9370
+ _this59._attrHash.push(value.attributes);
9121
9371
  });
9122
9372
  // reset server back
9123
9373
  plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
@@ -9204,12 +9454,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
9204
9454
  }, {
9205
9455
  key: "get",
9206
9456
  value: function get() {
9207
- var _this59 = this;
9457
+ var _this60 = this;
9208
9458
  return new Promise(function (accept, reject) {
9209
- if (!_this59._model) {
9459
+ if (!_this60._model) {
9210
9460
  return reject(new Error("ModelConverter.get() - required .model attribute was not set"));
9211
9461
  }
9212
- remote_request_1.RemoteRequest.request(_this59._Payload, _this59.retry < 0 ? 0 : _this59.retry).then(accept)["catch"](reject);
9462
+ remote_request_1.RemoteRequest.request(_this60._Payload, _this60.retry < 0 ? 0 : _this60.retry).then(accept)["catch"](reject);
9213
9463
  });
9214
9464
  }
9215
9465
  }, {
@@ -10574,18 +10824,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10574
10824
  }, {
10575
10825
  key: "allMappedAttributes",
10576
10826
  get: function get() {
10577
- var _this60 = this;
10827
+ var _this61 = this;
10578
10828
  var map = new Map();
10579
10829
  var coreAttr = this.coreAttributes;
10580
10830
  var optAttr = this.optionalAttributes;
10581
10831
  coreAttr.forEach(function (ele) {
10582
- if (_this60.hasAttribute(ele.key)) {
10583
- map.set(ele.map, _this60.getAttribute(ele.key));
10832
+ if (_this61.hasAttribute(ele.key)) {
10833
+ map.set(ele.map, _this61.getAttribute(ele.key));
10584
10834
  }
10585
10835
  });
10586
10836
  optAttr.forEach(function (ele) {
10587
- if (_this60.hasAttribute(ele.key)) {
10588
- map.set(ele.map, _this60.getAttribute(ele.key));
10837
+ if (_this61.hasAttribute(ele.key)) {
10838
+ map.set(ele.map, _this61.getAttribute(ele.key));
10589
10839
  }
10590
10840
  });
10591
10841
  return map;
@@ -10685,7 +10935,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10685
10935
  var IFrameController = require("./iframe-controller.js");
10686
10936
  var ElementController = /*#__PURE__*/function () {
10687
10937
  function ElementController(element) {
10688
- var _this61 = this;
10938
+ var _this62 = this;
10689
10939
  _classCallCheck(this, ElementController);
10690
10940
  this._element = element;
10691
10941
 
@@ -10698,7 +10948,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10698
10948
  var mutation = _step8.value;
10699
10949
  if (mutation.type === 'attributes' && element.usesAttribute(mutation.attributeName)) {
10700
10950
  if (element.hasAllCoreAttributes) {
10701
- _this61._load();
10951
+ _this62._load();
10702
10952
  }
10703
10953
  }
10704
10954
  }
@@ -10793,7 +11043,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10793
11043
  var Util = require("../../util/util.js");
10794
11044
  var IFrameController = /*#__PURE__*/function () {
10795
11045
  function IFrameController(element, src, id) {
10796
- var _this62 = this;
11046
+ var _this63 = this;
10797
11047
  var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
10798
11048
  _classCallCheck(this, IFrameController);
10799
11049
  this._iframe = document.createElement("iframe");
@@ -10803,7 +11053,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10803
11053
  if (!element.hasAttribute("sameorigin")) {
10804
11054
  this._iframe.onload = function () {
10805
11055
  if (onelemload) {
10806
- onelemload(_this62._iframe);
11056
+ onelemload(_this63._iframe);
10807
11057
  }
10808
11058
  };
10809
11059
  }
@@ -10920,13 +11170,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
10920
11170
  _inherits(EWallElement, _BaseElement4);
10921
11171
  var _super76 = _createSuper(EWallElement);
10922
11172
  function EWallElement() {
10923
- var _this63;
11173
+ var _this64;
10924
11174
  _classCallCheck(this, EWallElement);
10925
- _this63 = _super76.call(this);
11175
+ _this64 = _super76.call(this);
10926
11176
  var tag = document.createElement("script");
10927
11177
  tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
10928
11178
  tag.defer = true;
10929
- return _this63;
11179
+ return _this64;
10930
11180
  }
10931
11181
  _createClass(EWallElement, [{
10932
11182
  key: "connectedCallback",