@plattar/plattar-ar-adapter 1.130.2 → 1.132.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es2015/plattar-ar-adapter.js +175 -59
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +128 -60
- package/build/es2019/plattar-ar-adapter.min.js +1 -9
- package/dist/ar/product-ar.d.ts +4 -2
- package/dist/ar/product-ar.js +24 -7
- package/dist/ar/scene-product-ar.d.ts +1 -1
- package/dist/ar/scene-product-ar.js +2 -2
- package/dist/embed/controllers/configurator-controller.js +10 -1
- package/dist/embed/controllers/plattar-controller.d.ts +1 -1
- package/dist/embed/controllers/plattar-controller.js +10 -4
- package/dist/embed/controllers/product-controller.js +13 -3
- package/dist/embed/controllers/viewer-controller.js +33 -6
- package/dist/embed/controllers/vto-controller.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
|
@@ -24,17 +24,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
24
24
|
|
|
25
25
|
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
26
26
|
|
|
27
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
27
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
28
28
|
|
|
29
29
|
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
30
30
|
|
|
31
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
31
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
32
32
|
|
|
33
33
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
34
34
|
|
|
35
35
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
36
36
|
|
|
37
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
37
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
38
38
|
|
|
39
39
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
40
40
|
|
|
@@ -44,7 +44,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
44
44
|
|
|
45
45
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
46
46
|
|
|
47
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
47
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
48
48
|
|
|
49
49
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
50
50
|
|
|
@@ -394,6 +394,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
394
394
|
|
|
395
395
|
var productID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
396
396
|
var variationID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
397
|
+
var variationSKU = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
397
398
|
|
|
398
399
|
_classCallCheck(this, ProductAR);
|
|
399
400
|
|
|
@@ -406,7 +407,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
406
407
|
}
|
|
407
408
|
|
|
408
409
|
_this4._productID = productID;
|
|
409
|
-
_this4.
|
|
410
|
+
_this4._variationSKU = variationSKU;
|
|
411
|
+
_this4._variationID = variationID ? variationID : variationSKU ? null : "default";
|
|
410
412
|
_this4._ar = null;
|
|
411
413
|
return _this4;
|
|
412
414
|
}
|
|
@@ -421,6 +423,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
421
423
|
get: function get() {
|
|
422
424
|
return this._variationID;
|
|
423
425
|
}
|
|
426
|
+
}, {
|
|
427
|
+
key: "variationSKU",
|
|
428
|
+
get: function get() {
|
|
429
|
+
return this._variationSKU;
|
|
430
|
+
}
|
|
424
431
|
}, {
|
|
425
432
|
key: "_SetupAnalytics",
|
|
426
433
|
value: function _SetupAnalytics(product, variation) {
|
|
@@ -478,16 +485,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
478
485
|
product.include(plattar_api_1.Scene.include(plattar_api_1.Project));
|
|
479
486
|
product.get().then(function (product) {
|
|
480
487
|
// find the required variation from our product
|
|
481
|
-
var variationID = _this5.variationID ? _this5.variationID === "default" ? product.attributes.product_variation_id : _this5.variationID :
|
|
488
|
+
var variationID = _this5.variationID ? _this5.variationID === "default" ? product.attributes.product_variation_id : _this5.variationID : null;
|
|
489
|
+
var variationSKU = _this5.variationSKU;
|
|
482
490
|
|
|
483
|
-
if (!variationID) {
|
|
484
|
-
return reject(new Error("ProductAR.init() - cannot proceed as variation was not
|
|
491
|
+
if (!variationID && !variationSKU) {
|
|
492
|
+
return reject(new Error("ProductAR.init() - cannot proceed as variation-id or variation-sku was not set correctly"));
|
|
485
493
|
}
|
|
486
494
|
|
|
487
|
-
var variation =
|
|
495
|
+
var variation = undefined;
|
|
496
|
+
|
|
497
|
+
if (variationID) {
|
|
498
|
+
variation = product.relationships.find(plattar_api_1.ProductVariation, variationID);
|
|
499
|
+
} // if no variation was found with variationID - try searching variation sku
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
if (!variation && variationSKU) {
|
|
503
|
+
var variations = product.relationships.filter(plattar_api_1.ProductVariation);
|
|
504
|
+
|
|
505
|
+
if (variations) {
|
|
506
|
+
variation = variations.find(function (element) {
|
|
507
|
+
return element.attributes.sku === variationSKU;
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
} // make sure our variation is actually available before moving forward
|
|
511
|
+
|
|
488
512
|
|
|
489
513
|
if (!variation) {
|
|
490
|
-
return reject(new Error("ProductAR.init() - cannot proceed as variation with id " + variationID + " cannot be found"));
|
|
514
|
+
return reject(new Error("ProductAR.init() - cannot proceed as variation with id " + variationID + " or sku " + variationSKU + " cannot be found"));
|
|
491
515
|
} // otherwise both the product and variation are available
|
|
492
516
|
// we need to figure out if we can actually do AR though
|
|
493
517
|
// check if variation has a model file defined
|
|
@@ -1044,10 +1068,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1044
1068
|
|
|
1045
1069
|
var sceneProductID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1046
1070
|
var variationID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1071
|
+
var variationSKU = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
1047
1072
|
|
|
1048
1073
|
_classCallCheck(this, SceneProductAR);
|
|
1049
1074
|
|
|
1050
|
-
_this10 = _super5.call(this, sceneProductID, variationID); // this is evaluated in the init() function
|
|
1075
|
+
_this10 = _super5.call(this, sceneProductID, variationID, variationSKU); // this is evaluated in the init() function
|
|
1051
1076
|
|
|
1052
1077
|
_this10._attachedProductID = null;
|
|
1053
1078
|
|
|
@@ -1169,7 +1194,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1169
1194
|
var sceneID = _this12.getAttribute("scene-id");
|
|
1170
1195
|
|
|
1171
1196
|
if (sceneID) {
|
|
1172
|
-
var opt = options ||
|
|
1197
|
+
var opt = options || _this12._GetDefaultQROptions();
|
|
1198
|
+
|
|
1173
1199
|
var viewer = document.createElement("plattar-qrcode"); // required attributes with defaults for plattar-viewer node
|
|
1174
1200
|
|
|
1175
1201
|
var width = _this12.getAttribute("width") || "500px";
|
|
@@ -1189,12 +1215,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1189
1215
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
1190
1216
|
}
|
|
1191
1217
|
|
|
1218
|
+
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1192
1219
|
var dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID; // optional attributes
|
|
1193
1220
|
|
|
1194
1221
|
var configState = _this12.getAttribute("config-state");
|
|
1195
1222
|
|
|
1196
1223
|
var showAR = _this12.getAttribute("show-ar");
|
|
1197
1224
|
|
|
1225
|
+
var showUI = _this12.getAttribute("show-ui");
|
|
1226
|
+
|
|
1227
|
+
if (showUI && showUI === "true") {
|
|
1228
|
+
dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1198
1231
|
if (configState) {
|
|
1199
1232
|
dst += "&config_state=" + configState;
|
|
1200
1233
|
}
|
|
@@ -1246,6 +1279,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1246
1279
|
|
|
1247
1280
|
var showAR = _this13.getAttribute("show-ar");
|
|
1248
1281
|
|
|
1282
|
+
var showUI = _this13.getAttribute("show-ui");
|
|
1283
|
+
|
|
1249
1284
|
if (configState) {
|
|
1250
1285
|
viewer.setAttribute("config-state", configState);
|
|
1251
1286
|
}
|
|
@@ -1254,6 +1289,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1254
1289
|
viewer.setAttribute("show-ar", showAR);
|
|
1255
1290
|
}
|
|
1256
1291
|
|
|
1292
|
+
if (showUI) {
|
|
1293
|
+
viewer.setAttribute("show-ui", showUI);
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1257
1296
|
viewer.onload = function () {
|
|
1258
1297
|
return accept(viewer);
|
|
1259
1298
|
};
|
|
@@ -1474,6 +1513,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1474
1513
|
|
|
1475
1514
|
|
|
1476
1515
|
_createClass(PlattarController, [{
|
|
1516
|
+
key: "_GetDefaultQROptions",
|
|
1517
|
+
value: function _GetDefaultQROptions() {
|
|
1518
|
+
return {
|
|
1519
|
+
color: this.getAttribute("qr-color") || "#101721",
|
|
1520
|
+
qrType: this.getAttribute("qr-style") || "default",
|
|
1521
|
+
shorten: this.getAttribute("qr-shorten") || false,
|
|
1522
|
+
margin: 0
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
}, {
|
|
1477
1526
|
key: "startAR",
|
|
1478
1527
|
value:
|
|
1479
1528
|
/**
|
|
@@ -1524,7 +1573,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1524
1573
|
// remove the old renderer instance if any
|
|
1525
1574
|
_this16.removeRenderer();
|
|
1526
1575
|
|
|
1527
|
-
var opt = options ||
|
|
1576
|
+
var opt = options || _this16._GetDefaultQROptions();
|
|
1577
|
+
|
|
1528
1578
|
var viewer = document.createElement("plattar-qrcode"); // required attributes with defaults for plattar-viewer node
|
|
1529
1579
|
|
|
1530
1580
|
var width = _this16.getAttribute("width") || "500px";
|
|
@@ -1544,6 +1594,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1544
1594
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
1545
1595
|
}
|
|
1546
1596
|
|
|
1597
|
+
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1547
1598
|
var qrOptions = btoa(JSON.stringify(opt));
|
|
1548
1599
|
var dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
|
|
1549
1600
|
|
|
@@ -1559,6 +1610,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1559
1610
|
|
|
1560
1611
|
var variationID = _this16.getAttribute("variation-id");
|
|
1561
1612
|
|
|
1613
|
+
var variationSKU = _this16.getAttribute("variation-sku");
|
|
1614
|
+
|
|
1562
1615
|
var arMode = _this16.getAttribute("ar-mode");
|
|
1563
1616
|
|
|
1564
1617
|
if (configState) {
|
|
@@ -1581,6 +1634,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1581
1634
|
dst += "&variation_id=" + variationID;
|
|
1582
1635
|
}
|
|
1583
1636
|
|
|
1637
|
+
if (variationSKU) {
|
|
1638
|
+
dst += "&variation_sku=" + variationSKU;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1584
1641
|
if (arMode) {
|
|
1585
1642
|
dst += "&ar_mode=" + arMode;
|
|
1586
1643
|
}
|
|
@@ -1635,15 +1692,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1635
1692
|
});
|
|
1636
1693
|
shadow.append(element);
|
|
1637
1694
|
}
|
|
1638
|
-
}], [{
|
|
1639
|
-
key: "DEFAULT_QR_OPTIONS",
|
|
1640
|
-
get: function get() {
|
|
1641
|
-
return {
|
|
1642
|
-
color: "#101721",
|
|
1643
|
-
qrType: "default",
|
|
1644
|
-
margin: 0
|
|
1645
|
-
};
|
|
1646
|
-
}
|
|
1647
1695
|
}]);
|
|
1648
1696
|
|
|
1649
1697
|
return PlattarController;
|
|
@@ -1721,7 +1769,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1721
1769
|
var productID = _this17.getAttribute("product-id");
|
|
1722
1770
|
|
|
1723
1771
|
if (productID) {
|
|
1724
|
-
var opt = options ||
|
|
1772
|
+
var opt = options || _this17._GetDefaultQROptions();
|
|
1773
|
+
|
|
1725
1774
|
var viewer = document.createElement("plattar-qrcode"); // required attributes with defaults for plattar-viewer node
|
|
1726
1775
|
|
|
1727
1776
|
var width = _this17.getAttribute("width") || "500px";
|
|
@@ -1739,17 +1788,24 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1739
1788
|
|
|
1740
1789
|
if (opt.qrType) {
|
|
1741
1790
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
1742
|
-
}
|
|
1791
|
+
}
|
|
1743
1792
|
|
|
1793
|
+
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false"); // optional attributes
|
|
1744
1794
|
|
|
1745
1795
|
var variationID = _this17.getAttribute("variation-id");
|
|
1746
1796
|
|
|
1797
|
+
var variationSKU = _this17.getAttribute("variation-sku");
|
|
1798
|
+
|
|
1747
1799
|
var showAR = _this17.getAttribute("show-ar");
|
|
1748
1800
|
|
|
1749
1801
|
var dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + productID;
|
|
1750
1802
|
|
|
1751
1803
|
if (variationID) {
|
|
1752
|
-
dst += "&
|
|
1804
|
+
dst += "&variationId=" + variationID;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (variationSKU) {
|
|
1808
|
+
dst += "&variationSku=" + variationSKU;
|
|
1753
1809
|
}
|
|
1754
1810
|
|
|
1755
1811
|
if (showAR) {
|
|
@@ -1797,12 +1853,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1797
1853
|
|
|
1798
1854
|
var variationID = _this18.getAttribute("variation-id");
|
|
1799
1855
|
|
|
1856
|
+
var variationSKU = _this18.getAttribute("variation-sku");
|
|
1857
|
+
|
|
1800
1858
|
var showAR = _this18.getAttribute("show-ar");
|
|
1801
1859
|
|
|
1802
1860
|
if (variationID) {
|
|
1803
1861
|
viewer.setAttribute("variation-id", variationID);
|
|
1804
1862
|
}
|
|
1805
1863
|
|
|
1864
|
+
if (variationSKU) {
|
|
1865
|
+
viewer.setAttribute("variation-sku", variationSKU);
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1806
1868
|
if (showAR) {
|
|
1807
1869
|
viewer.setAttribute("show-ar", showAR);
|
|
1808
1870
|
}
|
|
@@ -1836,7 +1898,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1836
1898
|
if (productID) {
|
|
1837
1899
|
var variationID = _this19.getAttribute("variation-id");
|
|
1838
1900
|
|
|
1839
|
-
var
|
|
1901
|
+
var variationSKU = _this19.getAttribute("variation-sku");
|
|
1902
|
+
|
|
1903
|
+
var product = new product_ar_1.ProductAR(productID, variationID, variationSKU);
|
|
1840
1904
|
return product.init().then(accept)["catch"](reject);
|
|
1841
1905
|
}
|
|
1842
1906
|
|
|
@@ -1888,6 +1952,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1888
1952
|
|
|
1889
1953
|
var scene_product_ar_1 = require("../../ar/scene-product-ar");
|
|
1890
1954
|
|
|
1955
|
+
var configurator_state_1 = require("../../util/configurator-state");
|
|
1956
|
+
|
|
1891
1957
|
var util_1 = require("../../util/util");
|
|
1892
1958
|
|
|
1893
1959
|
var plattar_controller_1 = require("./plattar-controller");
|
|
@@ -1945,7 +2011,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1945
2011
|
var sceneID = _this20.getAttribute("scene-id");
|
|
1946
2012
|
|
|
1947
2013
|
if (sceneID) {
|
|
1948
|
-
var opt = options ||
|
|
2014
|
+
var opt = options || _this20._GetDefaultQROptions();
|
|
2015
|
+
|
|
1949
2016
|
var viewer = document.createElement("plattar-qrcode"); // required attributes with defaults for plattar-viewer node
|
|
1950
2017
|
|
|
1951
2018
|
var width = _this20.getAttribute("width") || "500px";
|
|
@@ -1965,12 +2032,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1965
2032
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
1966
2033
|
}
|
|
1967
2034
|
|
|
2035
|
+
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1968
2036
|
var dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + sceneID; // optional attributes
|
|
1969
2037
|
|
|
1970
2038
|
var productID = _this20.getAttribute("product-id") || _this20.getAttribute("scene-product-id");
|
|
1971
2039
|
|
|
1972
2040
|
var variationID = _this20.getAttribute("variation-id");
|
|
1973
2041
|
|
|
2042
|
+
var variationSKU = _this20.getAttribute("variation-sku");
|
|
2043
|
+
|
|
1974
2044
|
var showAR = _this20.getAttribute("show-ar");
|
|
1975
2045
|
|
|
1976
2046
|
if (productID) {
|
|
@@ -1981,6 +2051,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1981
2051
|
dst += "&variationId=" + variationID;
|
|
1982
2052
|
}
|
|
1983
2053
|
|
|
2054
|
+
if (variationSKU) {
|
|
2055
|
+
dst += "&variationSku=" + variationSKU;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
1984
2058
|
if (showAR) {
|
|
1985
2059
|
dst += "&show_ar=" + showAR;
|
|
1986
2060
|
}
|
|
@@ -2028,6 +2102,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2028
2102
|
|
|
2029
2103
|
var variationID = _this21.getAttribute("variation-id");
|
|
2030
2104
|
|
|
2105
|
+
var variationSKU = _this21.getAttribute("variation-sku");
|
|
2106
|
+
|
|
2031
2107
|
var showAR = _this21.getAttribute("show-ar");
|
|
2032
2108
|
|
|
2033
2109
|
if (productID) {
|
|
@@ -2038,6 +2114,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2038
2114
|
viewer.setAttribute("variation-id", variationID);
|
|
2039
2115
|
}
|
|
2040
2116
|
|
|
2117
|
+
if (variationSKU) {
|
|
2118
|
+
viewer.setAttribute("variation-sku", variationSKU);
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2041
2121
|
if (showAR) {
|
|
2042
2122
|
viewer.setAttribute("show-ar", showAR);
|
|
2043
2123
|
}
|
|
@@ -2072,7 +2152,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2072
2152
|
if (productID) {
|
|
2073
2153
|
var variationID = _this22.getAttribute("variation-id");
|
|
2074
2154
|
|
|
2075
|
-
var
|
|
2155
|
+
var variationSKU = _this22.getAttribute("variation-sku");
|
|
2156
|
+
|
|
2157
|
+
var product = new product_ar_1.ProductAR(productID, variationID, variationSKU);
|
|
2076
2158
|
return product.init().then(accept)["catch"](reject);
|
|
2077
2159
|
}
|
|
2078
2160
|
|
|
@@ -2082,7 +2164,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2082
2164
|
if (sceneProductID) {
|
|
2083
2165
|
var _variationID = _this22.getAttribute("variation-id");
|
|
2084
2166
|
|
|
2085
|
-
var
|
|
2167
|
+
var _variationSKU = _this22.getAttribute("variation-sku");
|
|
2168
|
+
|
|
2169
|
+
var _product = new scene_product_ar_1.SceneProductAR(sceneProductID, _variationID, _variationSKU);
|
|
2086
2170
|
|
|
2087
2171
|
return _product.init().then(accept)["catch"](reject);
|
|
2088
2172
|
}
|
|
@@ -2091,9 +2175,29 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2091
2175
|
|
|
2092
2176
|
|
|
2093
2177
|
if (sceneID) {
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2178
|
+
// special case - check if scene only has a single product, if so
|
|
2179
|
+
// we need to use provided variation-id or variation-sku to override
|
|
2180
|
+
var _variationID2 = _this22.getAttribute("variation-id");
|
|
2181
|
+
|
|
2182
|
+
var _variationSKU2 = _this22.getAttribute("variation-sku"); // just do scene-ar if variation ID and variation SKU is not set
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
if (!_variationID2 && !_variationSKU2) {
|
|
2186
|
+
var sceneAR = new scene_ar_1.SceneAR(sceneID);
|
|
2187
|
+
return sceneAR.init().then(accept)["catch"](reject);
|
|
2188
|
+
} // otherwise decode scene
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
return configurator_state_1.ConfiguratorState.decodeScene(sceneID).then(function (state) {
|
|
2192
|
+
var firstProduct = state.first();
|
|
2193
|
+
|
|
2194
|
+
if (state.length > 1 || !firstProduct) {
|
|
2195
|
+
return reject(new Error("ViewerController.initAR() - single product required to override variation-id or variation-sku"));
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
var product = new scene_product_ar_1.SceneProductAR(firstProduct.scene_product_id, _variationID2, _variationSKU2);
|
|
2199
|
+
return product.init().then(accept)["catch"](reject);
|
|
2200
|
+
})["catch"](reject);
|
|
2097
2201
|
}
|
|
2098
2202
|
|
|
2099
2203
|
return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -2126,6 +2230,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2126
2230
|
"../../ar/product-ar": 3,
|
|
2127
2231
|
"../../ar/scene-ar": 5,
|
|
2128
2232
|
"../../ar/scene-product-ar": 6,
|
|
2233
|
+
"../../util/configurator-state": 14,
|
|
2129
2234
|
"../../util/util": 15,
|
|
2130
2235
|
"./plattar-controller": 8,
|
|
2131
2236
|
"@plattar/plattar-api": 42
|
|
@@ -2187,7 +2292,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2187
2292
|
var sceneID = _this23.getAttribute("scene-id");
|
|
2188
2293
|
|
|
2189
2294
|
if (sceneID) {
|
|
2190
|
-
var opt = options ||
|
|
2295
|
+
var opt = options || _this23._GetDefaultQROptions();
|
|
2296
|
+
|
|
2191
2297
|
var viewer = document.createElement("plattar-qrcode"); // required attributes with defaults for plattar-viewer node
|
|
2192
2298
|
|
|
2193
2299
|
var width = _this23.getAttribute("width") || "500px";
|
|
@@ -2207,6 +2313,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2207
2313
|
viewer.setAttribute("qr-type", opt.qrType);
|
|
2208
2314
|
}
|
|
2209
2315
|
|
|
2316
|
+
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
2210
2317
|
var dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID; // optional attributes
|
|
2211
2318
|
|
|
2212
2319
|
var configState = _this23.getAttribute("config-state");
|
|
@@ -3244,7 +3351,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3244
3351
|
Object.defineProperty(exports, "__esModule", {
|
|
3245
3352
|
value: true
|
|
3246
3353
|
});
|
|
3247
|
-
exports["default"] = "1.
|
|
3354
|
+
exports["default"] = "1.132.1";
|
|
3248
3355
|
}, {}],
|
|
3249
3356
|
17: [function (require, module, exports) {
|
|
3250
3357
|
"use strict";
|
|
@@ -9603,6 +9710,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9603
9710
|
exports["default"] = "1.120.1";
|
|
9604
9711
|
}, {}],
|
|
9605
9712
|
115: [function (require, module, exports) {
|
|
9713
|
+
var Util = require("../../util/util");
|
|
9714
|
+
|
|
9606
9715
|
var ElementController = require("../controllers/element-controller");
|
|
9607
9716
|
|
|
9608
9717
|
var BaseElement = /*#__PURE__*/function (_HTMLElement3) {
|
|
@@ -9767,6 +9876,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9767
9876
|
get: function get() {
|
|
9768
9877
|
return "none";
|
|
9769
9878
|
}
|
|
9879
|
+
}, {
|
|
9880
|
+
key: "elementLocation",
|
|
9881
|
+
get: function get() {
|
|
9882
|
+
return Util.getElementLocation(this.elementType);
|
|
9883
|
+
}
|
|
9770
9884
|
}]);
|
|
9771
9885
|
|
|
9772
9886
|
return BaseElement;
|
|
@@ -9774,6 +9888,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9774
9888
|
|
|
9775
9889
|
module.exports = BaseElement;
|
|
9776
9890
|
}, {
|
|
9891
|
+
"../../util/util": 128,
|
|
9777
9892
|
"../controllers/element-controller": 117
|
|
9778
9893
|
}],
|
|
9779
9894
|
116: [function (require, module, exports) {
|
|
@@ -9800,6 +9915,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9800
9915
|
get: function get() {
|
|
9801
9916
|
return "configurator";
|
|
9802
9917
|
}
|
|
9918
|
+
}, {
|
|
9919
|
+
key: "elementLocation",
|
|
9920
|
+
get: function get() {
|
|
9921
|
+
if (this.hasAttribute("show-ui")) {
|
|
9922
|
+
var state = this.getAttribute("show-ui");
|
|
9923
|
+
return state === "true" ? "configurator/dist/index.html" : _get(_getPrototypeOf(ConfiguratorElement.prototype), "elementLocation", this);
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9926
|
+
return _get(_getPrototypeOf(ConfiguratorElement.prototype), "elementLocation", this);
|
|
9927
|
+
}
|
|
9803
9928
|
}, {
|
|
9804
9929
|
key: "optionalAttributes",
|
|
9805
9930
|
get: function get() {
|
|
@@ -9884,7 +10009,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9884
10009
|
throw new Error("ElementController - attribute \"server\" must be one of \"production\", \"staging\" or \"dev\"");
|
|
9885
10010
|
}
|
|
9886
10011
|
|
|
9887
|
-
var embedLocation =
|
|
10012
|
+
var embedLocation = element.elementLocation;
|
|
9888
10013
|
|
|
9889
10014
|
if (embedLocation === undefined) {
|
|
9890
10015
|
throw new Error("ElementController - element named \"" + elementType + "\" is invalid");
|
|
@@ -9992,7 +10117,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9992
10117
|
|
|
9993
10118
|
if (element.hasAttribute("fullscreen")) {
|
|
9994
10119
|
var style = document.createElement('style');
|
|
9995
|
-
style.textContent = "
|
|
10120
|
+
style.textContent = "._PlattarFullScreen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }";
|
|
9996
10121
|
this._iframe.className = "_PlattarFullScreen";
|
|
9997
10122
|
shadow.append(style);
|
|
9998
10123
|
this._fsStyle = style;
|
|
@@ -10180,6 +10305,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10180
10305
|
return [{
|
|
10181
10306
|
key: "variation-id",
|
|
10182
10307
|
map: "variationId"
|
|
10308
|
+
}, {
|
|
10309
|
+
key: "variation-sku",
|
|
10310
|
+
map: "variationSku"
|
|
10183
10311
|
}, {
|
|
10184
10312
|
key: "product-id",
|
|
10185
10313
|
map: "productId"
|
|
@@ -10279,6 +10407,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10279
10407
|
return [{
|
|
10280
10408
|
key: "variation-id",
|
|
10281
10409
|
map: "variation_id"
|
|
10410
|
+
}, {
|
|
10411
|
+
key: "variation-sku",
|
|
10412
|
+
map: "variationSku"
|
|
10282
10413
|
}, {
|
|
10283
10414
|
key: "show-ar",
|
|
10284
10415
|
map: "show_ar"
|
|
@@ -10356,6 +10487,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10356
10487
|
return [{
|
|
10357
10488
|
key: "variation-id",
|
|
10358
10489
|
map: "variationId"
|
|
10490
|
+
}, {
|
|
10491
|
+
key: "variation-sku",
|
|
10492
|
+
map: "variationSku"
|
|
10359
10493
|
}, {
|
|
10360
10494
|
key: "product-id",
|
|
10361
10495
|
map: "productId"
|
|
@@ -10492,13 +10626,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10492
10626
|
value: function getServerLocation(server) {
|
|
10493
10627
|
switch (server) {
|
|
10494
10628
|
case "production":
|
|
10495
|
-
return "https://app.plattar.com/
|
|
10629
|
+
return "https://app.plattar.com/";
|
|
10496
10630
|
|
|
10497
10631
|
case "staging":
|
|
10498
|
-
return "https://staging.plattar.space/
|
|
10632
|
+
return "https://staging.plattar.space/";
|
|
10499
10633
|
|
|
10500
10634
|
case "dev":
|
|
10501
|
-
return "https://localhost/
|
|
10635
|
+
return "https://localhost/";
|
|
10502
10636
|
|
|
10503
10637
|
default:
|
|
10504
10638
|
return undefined;
|
|
@@ -10510,25 +10644,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10510
10644
|
var isValid = Util.isValidType(etype);
|
|
10511
10645
|
|
|
10512
10646
|
if (isValid) {
|
|
10513
|
-
return etype + ".html";
|
|
10514
|
-
}
|
|
10515
|
-
|
|
10516
|
-
return undefined;
|
|
10517
|
-
}
|
|
10518
|
-
}, {
|
|
10519
|
-
key: "getElementBundleLocation",
|
|
10520
|
-
value: function getElementBundleLocation(etype, server) {
|
|
10521
|
-
var location = Util.getServerLocation(server);
|
|
10522
|
-
|
|
10523
|
-
if (!location) {
|
|
10524
|
-
return undefined;
|
|
10525
|
-
}
|
|
10526
|
-
|
|
10527
|
-
var isValid = Util.isValidType(etype);
|
|
10528
|
-
|
|
10529
|
-
if (isValid) {
|
|
10530
|
-
var isMinified = location === "dev" ? false : true;
|
|
10531
|
-
return isMinified ? etype + "-bundle.min.js" : etype + "-bundle.js";
|
|
10647
|
+
return "renderer/" + etype + ".html";
|
|
10532
10648
|
}
|
|
10533
10649
|
|
|
10534
10650
|
return undefined;
|
|
@@ -10580,7 +10696,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10580
10696
|
module.exports = Util;
|
|
10581
10697
|
}, {}],
|
|
10582
10698
|
129: [function (require, module, exports) {
|
|
10583
|
-
module.exports = "1.
|
|
10699
|
+
module.exports = "1.131.1";
|
|
10584
10700
|
}, {}],
|
|
10585
10701
|
130: [function (require, module, exports) {
|
|
10586
10702
|
(function (global) {
|