@plattar/plattar-ar-adapter 1.138.1 → 1.139.2
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 +414 -366
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +54 -6
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/ar/scene-ar.d.ts +7 -1
- package/dist/ar/scene-ar.js +21 -4
- package/dist/embed/controllers/vto-controller.js +32 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -509,7 +509,7 @@ const launcher_ar_1 = require("./launcher-ar");
|
|
|
509
509
|
* Performs AR functionality related to Plattar Scenes
|
|
510
510
|
*/
|
|
511
511
|
class SceneAR extends launcher_ar_1.LauncherAR {
|
|
512
|
-
constructor(sceneID = null) {
|
|
512
|
+
constructor(sceneID = null, variationSelection = null) {
|
|
513
513
|
super();
|
|
514
514
|
// analytics instance
|
|
515
515
|
this._analytics = null;
|
|
@@ -517,6 +517,7 @@ class SceneAR extends launcher_ar_1.LauncherAR {
|
|
|
517
517
|
throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
|
|
518
518
|
}
|
|
519
519
|
this._sceneID = sceneID;
|
|
520
|
+
this._variationSelection = variationSelection || {};
|
|
520
521
|
this._ar = null;
|
|
521
522
|
}
|
|
522
523
|
get sceneID() {
|
|
@@ -560,9 +561,25 @@ class SceneAR extends launcher_ar_1.LauncherAR {
|
|
|
560
561
|
// add our scene products
|
|
561
562
|
sceneProducts.forEach((sceneProduct) => {
|
|
562
563
|
const product = sceneProduct.relationships.find(plattar_api_1.Product);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
564
|
+
const selection = this._variationSelection;
|
|
565
|
+
// we have a specific product selection
|
|
566
|
+
if (sceneProduct.attributes.include_in_augment) {
|
|
567
|
+
// check if this product is the one we want (from selection optionally)
|
|
568
|
+
if (product && (product.id === selection.productID) && selection.variationID) {
|
|
569
|
+
configurator.addSceneProduct(sceneProduct.id, selection.variationID);
|
|
570
|
+
totalARObjectCount++;
|
|
571
|
+
}
|
|
572
|
+
else if (product) {
|
|
573
|
+
// check if this scene-product is the one we want (from selection)
|
|
574
|
+
if ((sceneProduct.id === selection.sceneProductID) && selection.variationID) {
|
|
575
|
+
configurator.addSceneProduct(sceneProduct.id, selection.variationID);
|
|
576
|
+
totalARObjectCount++;
|
|
577
|
+
}
|
|
578
|
+
else if (product.attributes.product_variation_id) {
|
|
579
|
+
configurator.addSceneProduct(sceneProduct.id, product.attributes.product_variation_id);
|
|
580
|
+
totalARObjectCount++;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
566
583
|
}
|
|
567
584
|
});
|
|
568
585
|
// add our scene models
|
|
@@ -1510,12 +1527,24 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
1510
1527
|
// optional attributes
|
|
1511
1528
|
const configState = this.getAttribute("config-state");
|
|
1512
1529
|
const showAR = this.getAttribute("show-ar");
|
|
1530
|
+
const productID = this.getAttribute("product-id");
|
|
1531
|
+
const sceneProductID = this.getAttribute("scene-product-id");
|
|
1532
|
+
const variationID = this.getAttribute("variation-id");
|
|
1513
1533
|
if (configState) {
|
|
1514
1534
|
dst += "&config_state=" + configState;
|
|
1515
1535
|
}
|
|
1516
1536
|
if (showAR) {
|
|
1517
1537
|
dst += "&show_ar=" + showAR;
|
|
1518
1538
|
}
|
|
1539
|
+
if (productID) {
|
|
1540
|
+
dst += "&product_id=" + productID;
|
|
1541
|
+
}
|
|
1542
|
+
if (sceneProductID) {
|
|
1543
|
+
dst += "&scene_product_id=" + sceneProductID;
|
|
1544
|
+
}
|
|
1545
|
+
if (variationID) {
|
|
1546
|
+
dst += "&variation_id=" + variationID;
|
|
1547
|
+
}
|
|
1519
1548
|
viewer.setAttribute("url", opt.url || dst);
|
|
1520
1549
|
viewer.onload = () => {
|
|
1521
1550
|
return accept(viewer);
|
|
@@ -1547,12 +1576,24 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
1547
1576
|
// optional attributes
|
|
1548
1577
|
const configState = this.getAttribute("config-state");
|
|
1549
1578
|
const showAR = this.getAttribute("show-ar");
|
|
1579
|
+
const productID = this.getAttribute("product-id");
|
|
1580
|
+
const sceneProductID = this.getAttribute("scene-product-id");
|
|
1581
|
+
const variationID = this.getAttribute("variation-id");
|
|
1550
1582
|
if (configState) {
|
|
1551
1583
|
viewer.setAttribute("config-state", configState);
|
|
1552
1584
|
}
|
|
1553
1585
|
if (showAR) {
|
|
1554
1586
|
viewer.setAttribute("show-ar", showAR);
|
|
1555
1587
|
}
|
|
1588
|
+
if (productID) {
|
|
1589
|
+
viewer.setAttribute("product-id", productID);
|
|
1590
|
+
}
|
|
1591
|
+
if (sceneProductID) {
|
|
1592
|
+
viewer.setAttribute("scene-product-id", sceneProductID);
|
|
1593
|
+
}
|
|
1594
|
+
if (variationID) {
|
|
1595
|
+
viewer.setAttribute("variation-id", variationID);
|
|
1596
|
+
}
|
|
1556
1597
|
viewer.onload = () => {
|
|
1557
1598
|
return accept(viewer);
|
|
1558
1599
|
};
|
|
@@ -1655,7 +1696,14 @@ class VTOController extends plattar_controller_1.PlattarController {
|
|
|
1655
1696
|
// otherwise no config-state or viewer is active
|
|
1656
1697
|
// fallback to using default SceneAR implementation
|
|
1657
1698
|
if (sceneID) {
|
|
1658
|
-
const
|
|
1699
|
+
const productID = this.getAttribute("product-id");
|
|
1700
|
+
const sceneProductID = this.getAttribute("scene-product-id");
|
|
1701
|
+
const variationID = this.getAttribute("variation-id");
|
|
1702
|
+
const sceneAR = new __1.SceneAR(sceneID, {
|
|
1703
|
+
productID: productID ? productID : undefined,
|
|
1704
|
+
sceneProductID: sceneProductID ? sceneProductID : undefined,
|
|
1705
|
+
variationID: variationID ? variationID : undefined
|
|
1706
|
+
});
|
|
1659
1707
|
sceneAR.init().then(accept).catch(reject);
|
|
1660
1708
|
return;
|
|
1661
1709
|
}
|
|
@@ -2206,7 +2254,7 @@ exports.Util = Util;
|
|
|
2206
2254
|
},{}],16:[function(require,module,exports){
|
|
2207
2255
|
"use strict";
|
|
2208
2256
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2209
|
-
exports.default = "1.
|
|
2257
|
+
exports.default = "1.139.2";
|
|
2210
2258
|
|
|
2211
2259
|
},{}],17:[function(require,module,exports){
|
|
2212
2260
|
"use strict";
|