@plattar/plattar-ar-adapter 1.155.3 → 1.155.4-b2
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.
- package/build/es2015/plattar-ar-adapter.js +551 -309
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +211 -39
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/embed/controllers/configurator-controller.d.ts +1 -0
- package/dist/embed/controllers/configurator-controller.js +91 -19
- package/dist/embed/controllers/plattar-controller.d.ts +11 -3
- package/dist/embed/controllers/plattar-controller.js +12 -1
- package/dist/embed/controllers/product-controller.d.ts +0 -1
- package/dist/embed/controllers/product-controller.js +0 -5
- package/dist/embed/plattar-embed.d.ts +11 -1
- package/dist/embed/plattar-embed.js +35 -11
- package/dist/util/configurator-state.d.ts +13 -1
- package/dist/util/configurator-state.js +72 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1432,23 +1432,110 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1432
1432
|
return onAttributesUpdated;
|
|
1433
1433
|
}()
|
|
1434
1434
|
}, {
|
|
1435
|
-
key: "
|
|
1435
|
+
key: "startARQRCode",
|
|
1436
1436
|
value: function () {
|
|
1437
|
-
var
|
|
1438
|
-
var
|
|
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
|
-
|
|
1498
|
+
_context7.next = 4;
|
|
1448
1499
|
break;
|
|
1449
1500
|
}
|
|
1450
|
-
throw new Error("ConfiguratorController.
|
|
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;
|
|
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
|
|
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
|
|
1578
|
+
case 46:
|
|
1506
1579
|
case "end":
|
|
1507
|
-
return
|
|
1580
|
+
return _context7.stop();
|
|
1508
1581
|
}
|
|
1509
|
-
},
|
|
1582
|
+
}, _callee7, this, [[5, 22]]);
|
|
1510
1583
|
}));
|
|
1511
|
-
function startViewerQRCode(
|
|
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
|
|
1592
|
+
var _startRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
1520
1593
|
var _this16 = this;
|
|
1521
|
-
var sceneID, width, height, server, viewer,
|
|
1522
|
-
return _regeneratorRuntime().wrap(function
|
|
1523
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
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
|
|
1672
|
+
case 41:
|
|
1579
1673
|
case "end":
|
|
1580
|
-
return
|
|
1674
|
+
return _context8.stop();
|
|
1581
1675
|
}
|
|
1582
|
-
},
|
|
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
|
|
1593
|
-
var arMode;
|
|
1594
|
-
return _regeneratorRuntime().wrap(function
|
|
1595
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1605
|
-
|
|
1729
|
+
_context9.t1 = arMode.toLowerCase();
|
|
1730
|
+
_context9.next = _context9.t1 === "inherited" ? 24 : _context9.t1 === "generated" ? 25 : 25;
|
|
1606
1731
|
break;
|
|
1607
|
-
case
|
|
1608
|
-
return
|
|
1609
|
-
case
|
|
1610
|
-
return
|
|
1611
|
-
case
|
|
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
|
|
1738
|
+
return _context9.stop();
|
|
1614
1739
|
}
|
|
1615
|
-
},
|
|
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
|
|
1753
|
+
var _InitARInherited2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
1629
1754
|
var sceneID, state, first, sceneProductAR;
|
|
1630
|
-
return _regeneratorRuntime().wrap(function
|
|
1631
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1765
|
+
_context10.next = 5;
|
|
1641
1766
|
return this.getConfiguratorState();
|
|
1642
1767
|
case 5:
|
|
1643
|
-
state =
|
|
1768
|
+
state = _context10.sent.state;
|
|
1644
1769
|
first = state.first();
|
|
1645
1770
|
if (!first) {
|
|
1646
|
-
|
|
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
|
|
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
|
|
1780
|
+
return _context10.stop();
|
|
1656
1781
|
}
|
|
1657
|
-
},
|
|
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
|
|
1795
|
+
var _InitARGenerated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
1671
1796
|
var sceneID, configAR;
|
|
1672
|
-
return _regeneratorRuntime().wrap(function
|
|
1673
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1683
|
-
|
|
1807
|
+
_context11.t0 = configurator_ar_1.ConfiguratorAR;
|
|
1808
|
+
_context11.next = 6;
|
|
1684
1809
|
return this.getConfiguratorState();
|
|
1685
1810
|
case 6:
|
|
1686
|
-
|
|
1687
|
-
configAR = new
|
|
1688
|
-
return
|
|
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
|
|
1816
|
+
return _context11.stop();
|
|
1692
1817
|
}
|
|
1693
|
-
},
|
|
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
|
|
1900
|
+
var _createConfiguratorState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
1776
1901
|
var sceneID, configState, variationIDs, variationSKUs, decodedState, variationIDList, variationSKUList;
|
|
1777
|
-
return _regeneratorRuntime().wrap(function
|
|
1778
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
1917
|
+
_context12.next = 12;
|
|
1793
1918
|
break;
|
|
1794
1919
|
}
|
|
1795
|
-
|
|
1920
|
+
_context12.next = 9;
|
|
1796
1921
|
return configurator_state_1.ConfiguratorState.decodeState(sceneID, configState);
|
|
1797
1922
|
case 9:
|
|
1798
|
-
|
|
1799
|
-
|
|
1923
|
+
_context12.t0 = _context12.sent;
|
|
1924
|
+
_context12.next = 15;
|
|
1800
1925
|
break;
|
|
1801
1926
|
case 12:
|
|
1802
|
-
|
|
1927
|
+
_context12.next = 14;
|
|
1803
1928
|
return configurator_state_1.ConfiguratorState.decodeScene(sceneID);
|
|
1804
1929
|
case 14:
|
|
1805
|
-
|
|
1930
|
+
_context12.t0 = _context12.sent;
|
|
1806
1931
|
case 15:
|
|
1807
|
-
decodedState =
|
|
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
|
|
1943
|
+
return _context12.abrupt("return", decodedState);
|
|
1819
1944
|
case 21:
|
|
1820
1945
|
case "end":
|
|
1821
|
-
return
|
|
1946
|
+
return _context12.stop();
|
|
1822
1947
|
}
|
|
1823
|
-
},
|
|
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
|
|
2002
|
+
var _startAR = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
1878
2003
|
var launcher;
|
|
1879
|
-
return _regeneratorRuntime().wrap(function
|
|
1880
|
-
while (1) switch (
|
|
2004
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
2005
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
1881
2006
|
case 0:
|
|
1882
|
-
|
|
2007
|
+
_context13.next = 2;
|
|
1883
2008
|
return this.initAR();
|
|
1884
2009
|
case 2:
|
|
1885
|
-
launcher =
|
|
1886
|
-
return
|
|
2010
|
+
launcher = _context13.sent;
|
|
2011
|
+
return _context13.abrupt("return", launcher.start());
|
|
1887
2012
|
case 4:
|
|
1888
2013
|
case "end":
|
|
1889
|
-
return
|
|
2014
|
+
return _context13.stop();
|
|
1890
2015
|
}
|
|
1891
|
-
},
|
|
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
|
|
2031
|
+
var _startQRCode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(options) {
|
|
1907
2032
|
var qrType;
|
|
1908
|
-
return _regeneratorRuntime().wrap(function
|
|
1909
|
-
while (1) switch (
|
|
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
|
-
|
|
1913
|
-
|
|
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
|
|
2041
|
+
return _context14.abrupt("return", this.startARQRCode(options));
|
|
1917
2042
|
case 5:
|
|
1918
|
-
return
|
|
2043
|
+
return _context14.abrupt("return", this.startViewerQRCode(options));
|
|
1919
2044
|
case 6:
|
|
1920
2045
|
case "end":
|
|
1921
|
-
return
|
|
2046
|
+
return _context14.stop();
|
|
1922
2047
|
}
|
|
1923
|
-
},
|
|
2048
|
+
}, _callee14, this);
|
|
1924
2049
|
}));
|
|
1925
|
-
function startQRCode(
|
|
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
|
|
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
|
|
1942
|
-
while (1) switch (
|
|
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
|
-
|
|
1975
|
-
|
|
2099
|
+
_context15.prev = 22;
|
|
2100
|
+
_context15.next = 25;
|
|
1976
2101
|
return this.getConfiguratorState();
|
|
1977
2102
|
case 25:
|
|
1978
|
-
configState =
|
|
1979
|
-
|
|
2103
|
+
configState = _context15.sent.state.encode();
|
|
2104
|
+
_context15.next = 31;
|
|
1980
2105
|
break;
|
|
1981
2106
|
case 28:
|
|
1982
|
-
|
|
1983
|
-
|
|
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
|
|
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
|
|
2147
|
+
return _context15.stop();
|
|
2023
2148
|
}
|
|
2024
|
-
},
|
|
2149
|
+
}, _callee15, this, [[22, 28]]);
|
|
2025
2150
|
}));
|
|
2026
|
-
function startARQRCode(
|
|
2027
|
-
return
|
|
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
|
|
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(
|
|
2227
|
+
function ProductController() {
|
|
2090
2228
|
_classCallCheck(this, ProductController);
|
|
2091
|
-
|
|
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
|
|
2099
|
-
return _regeneratorRuntime().wrap(function
|
|
2100
|
-
while (1) switch (
|
|
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
|
|
2241
|
+
return _context16.stop();
|
|
2106
2242
|
}
|
|
2107
|
-
},
|
|
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
|
|
2253
|
+
var _onAttributesUpdated2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(attributeName) {
|
|
2118
2254
|
var state, viewer, variationID;
|
|
2119
|
-
return _regeneratorRuntime().wrap(function
|
|
2120
|
-
while (1) switch (
|
|
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
|
-
|
|
2260
|
+
_context17.next = 4;
|
|
2125
2261
|
break;
|
|
2126
2262
|
}
|
|
2127
2263
|
this.startQRCode(this._prevQROpt);
|
|
2128
|
-
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
|
|
2278
|
+
return _context17.stop();
|
|
2143
2279
|
}
|
|
2144
|
-
},
|
|
2280
|
+
}, _callee17, this);
|
|
2145
2281
|
}));
|
|
2146
|
-
function onAttributesUpdated(
|
|
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
|
|
2391
|
-
return _regeneratorRuntime().wrap(function
|
|
2392
|
-
while (1) switch (
|
|
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
|
-
|
|
2531
|
+
_context18.next = 2;
|
|
2396
2532
|
break;
|
|
2397
2533
|
}
|
|
2398
|
-
return
|
|
2534
|
+
return _context18.abrupt("return", this._cachedConfigState);
|
|
2399
2535
|
case 2:
|
|
2400
2536
|
this._cachedConfigState = this.createConfiguratorState();
|
|
2401
|
-
return
|
|
2537
|
+
return _context18.abrupt("return", this._cachedConfigState);
|
|
2402
2538
|
case 4:
|
|
2403
2539
|
case "end":
|
|
2404
|
-
return
|
|
2540
|
+
return _context18.stop();
|
|
2405
2541
|
}
|
|
2406
|
-
},
|
|
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
|
|
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
|
|
2419
|
-
while (1) switch (
|
|
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
|
-
|
|
2559
|
+
_context19.next = 17;
|
|
2424
2560
|
break;
|
|
2425
2561
|
}
|
|
2426
2562
|
viewer = this.element;
|
|
2427
2563
|
if (!viewer) {
|
|
2428
|
-
|
|
2564
|
+
_context19.next = 16;
|
|
2429
2565
|
break;
|
|
2430
2566
|
}
|
|
2431
2567
|
if (!(attributeName === "variation-id")) {
|
|
2432
|
-
|
|
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
|
-
|
|
2574
|
+
_context19.next = 10;
|
|
2439
2575
|
break;
|
|
2440
2576
|
}
|
|
2441
|
-
|
|
2577
|
+
_context19.next = 10;
|
|
2442
2578
|
return viewer.messenger.selectVariationID(variationIDsList);
|
|
2443
2579
|
case 10:
|
|
2444
2580
|
if (!(attributeName === "variation-sku")) {
|
|
2445
|
-
|
|
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
|
-
|
|
2587
|
+
_context19.next = 16;
|
|
2452
2588
|
break;
|
|
2453
2589
|
}
|
|
2454
|
-
|
|
2590
|
+
_context19.next = 16;
|
|
2455
2591
|
return viewer.messenger.selectVariationSKU(variationSKUList);
|
|
2456
2592
|
case 16:
|
|
2457
|
-
return
|
|
2593
|
+
return _context19.abrupt("return");
|
|
2458
2594
|
case 17:
|
|
2459
2595
|
if (!(state === plattar_controller_1.ControllerState.QRCode)) {
|
|
2460
|
-
|
|
2596
|
+
_context19.next = 34;
|
|
2461
2597
|
break;
|
|
2462
2598
|
}
|
|
2463
2599
|
if (!(attributeName === "variation-id")) {
|
|
2464
|
-
|
|
2600
|
+
_context19.next = 25;
|
|
2465
2601
|
break;
|
|
2466
2602
|
}
|
|
2467
|
-
|
|
2603
|
+
_context19.next = 21;
|
|
2468
2604
|
return this.getConfiguratorState();
|
|
2469
2605
|
case 21:
|
|
2470
|
-
configState =
|
|
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
|
-
|
|
2614
|
+
_context19.next = 32;
|
|
2479
2615
|
break;
|
|
2480
2616
|
}
|
|
2481
|
-
|
|
2617
|
+
_context19.next = 28;
|
|
2482
2618
|
return this.getConfiguratorState();
|
|
2483
2619
|
case 28:
|
|
2484
|
-
_configState2 =
|
|
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
|
|
2628
|
+
return _context19.abrupt("return");
|
|
2493
2629
|
case 34:
|
|
2494
2630
|
case "end":
|
|
2495
|
-
return
|
|
2631
|
+
return _context19.stop();
|
|
2496
2632
|
}
|
|
2497
|
-
},
|
|
2633
|
+
}, _callee19, this);
|
|
2498
2634
|
}));
|
|
2499
|
-
function onAttributesUpdated(
|
|
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
|
|
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
|
|
2511
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
2543
|
-
|
|
2678
|
+
_context20.prev = 17;
|
|
2679
|
+
_context20.next = 20;
|
|
2544
2680
|
return this.getConfiguratorState();
|
|
2545
2681
|
case 20:
|
|
2546
|
-
configState =
|
|
2547
|
-
|
|
2682
|
+
configState = _context20.sent;
|
|
2683
|
+
_context20.next = 26;
|
|
2548
2684
|
break;
|
|
2549
2685
|
case 23:
|
|
2550
|
-
|
|
2551
|
-
|
|
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
|
|
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
|
|
2721
|
+
return _context20.stop();
|
|
2586
2722
|
}
|
|
2587
|
-
},
|
|
2723
|
+
}, _callee20, this, [[17, 23]]);
|
|
2588
2724
|
}));
|
|
2589
|
-
function startViewerQRCode(
|
|
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
|
|
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
|
|
2601
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
2625
|
-
|
|
2760
|
+
_context21.prev = 14;
|
|
2761
|
+
_context21.next = 17;
|
|
2626
2762
|
return this.getConfiguratorState();
|
|
2627
2763
|
case 17:
|
|
2628
|
-
configState =
|
|
2629
|
-
|
|
2764
|
+
configState = _context21.sent;
|
|
2765
|
+
_context21.next = 23;
|
|
2630
2766
|
break;
|
|
2631
2767
|
case 20:
|
|
2632
|
-
|
|
2633
|
-
|
|
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
|
|
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
|
|
2802
|
+
return _context21.stop();
|
|
2667
2803
|
}
|
|
2668
|
-
},
|
|
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
|
|
2814
|
+
var _initAR2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
2679
2815
|
var arMode;
|
|
2680
|
-
return _regeneratorRuntime().wrap(function
|
|
2681
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2697
|
-
|
|
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
|
|
2836
|
+
return _context22.abrupt("return", this._InitARInherited());
|
|
2701
2837
|
case 9:
|
|
2702
|
-
return
|
|
2838
|
+
return _context22.abrupt("return", this._InitARGenerated());
|
|
2703
2839
|
case 10:
|
|
2704
2840
|
case "end":
|
|
2705
|
-
return
|
|
2841
|
+
return _context22.stop();
|
|
2706
2842
|
}
|
|
2707
|
-
},
|
|
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
|
|
2856
|
+
var _InitARInherited3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
2721
2857
|
var sceneID, state, first, sceneProductAR;
|
|
2722
|
-
return _regeneratorRuntime().wrap(function
|
|
2723
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
2868
|
+
_context23.next = 5;
|
|
2733
2869
|
return this.getConfiguratorState();
|
|
2734
2870
|
case 5:
|
|
2735
|
-
state =
|
|
2871
|
+
state = _context23.sent.state;
|
|
2736
2872
|
first = state.first();
|
|
2737
2873
|
if (!first) {
|
|
2738
|
-
|
|
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
|
|
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
|
|
2883
|
+
return _context23.stop();
|
|
2748
2884
|
}
|
|
2749
|
-
},
|
|
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
|
|
2898
|
+
var _InitARGenerated3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
2763
2899
|
var sceneID, configAR;
|
|
2764
|
-
return _regeneratorRuntime().wrap(function
|
|
2765
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
-
|
|
2775
|
-
|
|
2910
|
+
_context24.t0 = configurator_ar_1.ConfiguratorAR;
|
|
2911
|
+
_context24.next = 6;
|
|
2776
2912
|
return this.getConfiguratorState();
|
|
2777
2913
|
case 6:
|
|
2778
|
-
|
|
2779
|
-
configAR = new
|
|
2780
|
-
return
|
|
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
|
|
2919
|
+
return _context24.stop();
|
|
2784
2920
|
}
|
|
2785
|
-
},
|
|
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
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
_this26.
|
|
2887
|
-
|
|
2888
|
-
|
|
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
|
|
3000
|
-
return _regeneratorRuntime().wrap(function
|
|
3001
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
3173
|
+
return _context25.abrupt("return", this._controller.initAR());
|
|
3010
3174
|
case 3:
|
|
3011
3175
|
case "end":
|
|
3012
|
-
return
|
|
3176
|
+
return _context25.stop();
|
|
3013
3177
|
}
|
|
3014
|
-
},
|
|
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
|
|
3025
|
-
return _regeneratorRuntime().wrap(function
|
|
3026
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
3198
|
+
return _context26.abrupt("return", this._controller.startAR());
|
|
3035
3199
|
case 3:
|
|
3036
3200
|
case "end":
|
|
3037
|
-
return
|
|
3201
|
+
return _context26.stop();
|
|
3038
3202
|
}
|
|
3039
|
-
},
|
|
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
|
|
3050
|
-
return _regeneratorRuntime().wrap(function
|
|
3051
|
-
while (1) switch (
|
|
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
|
-
|
|
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
|
|
3223
|
+
return _context27.abrupt("return", this._controller.startRenderer());
|
|
3060
3224
|
case 3:
|
|
3061
3225
|
case "end":
|
|
3062
|
-
return
|
|
3226
|
+
return _context27.stop();
|
|
3063
3227
|
}
|
|
3064
|
-
},
|
|
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
|
|
3238
|
+
var _startQRCode2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
3075
3239
|
var options,
|
|
3076
|
-
|
|
3077
|
-
return _regeneratorRuntime().wrap(function
|
|
3078
|
-
while (1) switch (
|
|
3240
|
+
_args28 = arguments;
|
|
3241
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
3242
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
3079
3243
|
case 0:
|
|
3080
|
-
options =
|
|
3244
|
+
options = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : null;
|
|
3081
3245
|
if (this._controller) {
|
|
3082
|
-
|
|
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
|
|
3251
|
+
return _context28.abrupt("return", this._controller.startQRCode(options));
|
|
3088
3252
|
case 4:
|
|
3089
3253
|
case "end":
|
|
3090
|
-
return
|
|
3254
|
+
return _context28.stop();
|
|
3091
3255
|
}
|
|
3092
|
-
},
|
|
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
|
}
|
|
@@ -3377,6 +3543,38 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3377
3543
|
newData[meta.meta_index] = metaData;
|
|
3378
3544
|
}
|
|
3379
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
|
+
}
|
|
3380
3578
|
/**
|
|
3381
3579
|
* Adds a new Scene Product/Variation combo with meta-data into the Configurator State
|
|
3382
3580
|
*
|
|
@@ -3534,6 +3732,37 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3534
3732
|
}
|
|
3535
3733
|
return null;
|
|
3536
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 && productState[meta.meta_index].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
|
+
}
|
|
3537
3766
|
}, {
|
|
3538
3767
|
key: "length",
|
|
3539
3768
|
get: function get() {
|
|
@@ -3569,20 +3798,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3569
3798
|
}, {
|
|
3570
3799
|
key: "decodeState",
|
|
3571
3800
|
value: function () {
|
|
3572
|
-
var _decodeState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3801
|
+
var _decodeState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
3573
3802
|
var sceneID,
|
|
3574
3803
|
state,
|
|
3575
3804
|
configState,
|
|
3576
3805
|
fscene,
|
|
3577
3806
|
scene,
|
|
3578
|
-
|
|
3579
|
-
return _regeneratorRuntime().wrap(function
|
|
3580
|
-
while (1) switch (
|
|
3807
|
+
_args29 = arguments;
|
|
3808
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
3809
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
3581
3810
|
case 0:
|
|
3582
|
-
sceneID =
|
|
3583
|
-
state =
|
|
3811
|
+
sceneID = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : null;
|
|
3812
|
+
state = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : null;
|
|
3584
3813
|
if (!(!sceneID || !state)) {
|
|
3585
|
-
|
|
3814
|
+
_context29.next = 4;
|
|
3586
3815
|
break;
|
|
3587
3816
|
}
|
|
3588
3817
|
throw new Error("ConfiguratorState.decodeState(sceneID, state) - sceneID and state must be defined");
|
|
@@ -3590,22 +3819,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3590
3819
|
configState = new ConfiguratorState(state);
|
|
3591
3820
|
fscene = new plattar_api_1.Scene(sceneID);
|
|
3592
3821
|
fscene.include(plattar_api_1.Project);
|
|
3822
|
+
fscene.include(plattar_api_1.Product);
|
|
3593
3823
|
fscene.include(plattar_api_1.SceneProduct);
|
|
3594
3824
|
fscene.include(plattar_api_1.SceneModel);
|
|
3595
3825
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
3596
|
-
|
|
3826
|
+
_context29.next = 13;
|
|
3597
3827
|
return fscene.get();
|
|
3598
|
-
case
|
|
3599
|
-
scene =
|
|
3600
|
-
return
|
|
3828
|
+
case 13:
|
|
3829
|
+
scene = _context29.sent;
|
|
3830
|
+
return _context29.abrupt("return", {
|
|
3601
3831
|
scene: scene,
|
|
3602
3832
|
state: configState
|
|
3603
3833
|
});
|
|
3604
|
-
case
|
|
3834
|
+
case 15:
|
|
3605
3835
|
case "end":
|
|
3606
|
-
return
|
|
3836
|
+
return _context29.stop();
|
|
3607
3837
|
}
|
|
3608
|
-
},
|
|
3838
|
+
}, _callee29);
|
|
3609
3839
|
}));
|
|
3610
3840
|
function decodeState() {
|
|
3611
3841
|
return _decodeState.apply(this, arguments);
|
|
@@ -3621,20 +3851,21 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3621
3851
|
}, {
|
|
3622
3852
|
key: "decodeScene",
|
|
3623
3853
|
value: function () {
|
|
3624
|
-
var _decodeScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3854
|
+
var _decodeScene = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
3625
3855
|
var sceneID,
|
|
3626
3856
|
configState,
|
|
3627
3857
|
fscene,
|
|
3628
3858
|
scene,
|
|
3629
3859
|
sceneProducts,
|
|
3630
3860
|
sceneModels,
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3861
|
+
products,
|
|
3862
|
+
_args30 = arguments;
|
|
3863
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
3864
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
3634
3865
|
case 0:
|
|
3635
|
-
sceneID =
|
|
3866
|
+
sceneID = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : null;
|
|
3636
3867
|
if (sceneID) {
|
|
3637
|
-
|
|
3868
|
+
_context30.next = 3;
|
|
3638
3869
|
break;
|
|
3639
3870
|
}
|
|
3640
3871
|
throw new Error("ConfiguratorState.decodeScene(sceneID) - sceneID must be defined");
|
|
@@ -3644,20 +3875,31 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3644
3875
|
fscene.include(plattar_api_1.Project);
|
|
3645
3876
|
fscene.include(plattar_api_1.SceneProduct);
|
|
3646
3877
|
fscene.include(plattar_api_1.SceneModel);
|
|
3878
|
+
fscene.include(plattar_api_1.Product);
|
|
3647
3879
|
fscene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product.include(plattar_api_1.ProductVariation)));
|
|
3648
|
-
|
|
3880
|
+
_context30.next = 12;
|
|
3649
3881
|
return fscene.get();
|
|
3650
|
-
case
|
|
3651
|
-
scene =
|
|
3882
|
+
case 12:
|
|
3883
|
+
scene = _context30.sent;
|
|
3652
3884
|
sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
3653
|
-
sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
3885
|
+
sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
3886
|
+
products = scene.relationships.filter(plattar_api_1.Product); // add our scene models
|
|
3654
3887
|
sceneModels.forEach(function (sceneModel) {
|
|
3655
3888
|
configState.setSceneModel(sceneModel.id, {
|
|
3656
3889
|
augment: sceneModel.attributes.include_in_augment,
|
|
3657
3890
|
type: "scenemodel"
|
|
3658
3891
|
});
|
|
3659
3892
|
});
|
|
3660
|
-
// add
|
|
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
|
|
3661
3903
|
sceneProducts.forEach(function (sceneProduct) {
|
|
3662
3904
|
var product = sceneProduct.relationships.find(plattar_api_1.Product);
|
|
3663
3905
|
if (product) {
|
|
@@ -3682,15 +3924,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3682
3924
|
});
|
|
3683
3925
|
}
|
|
3684
3926
|
});
|
|
3685
|
-
return
|
|
3927
|
+
return _context30.abrupt("return", {
|
|
3686
3928
|
scene: scene,
|
|
3687
3929
|
state: configState
|
|
3688
3930
|
});
|
|
3689
|
-
case
|
|
3931
|
+
case 20:
|
|
3690
3932
|
case "end":
|
|
3691
|
-
return
|
|
3933
|
+
return _context30.stop();
|
|
3692
3934
|
}
|
|
3693
|
-
},
|
|
3935
|
+
}, _callee30);
|
|
3694
3936
|
}));
|
|
3695
3937
|
function decodeScene() {
|
|
3696
3938
|
return _decodeScene.apply(this, arguments);
|
|
@@ -3818,7 +4060,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3818
4060
|
Object.defineProperty(exports, "__esModule", {
|
|
3819
4061
|
value: true
|
|
3820
4062
|
});
|
|
3821
|
-
exports["default"] = "1.155.
|
|
4063
|
+
exports["default"] = "1.155.4-b2";
|
|
3822
4064
|
}, {}],
|
|
3823
4065
|
17: [function (require, module, exports) {
|
|
3824
4066
|
"use strict";
|