@plattar/plattar-ar-adapter 1.129.1 → 1.130.3
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 +110 -49
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +87 -57
- package/build/es2019/plattar-ar-adapter.min.js +1 -9
- package/dist/ar/launcher-ar.d.ts +8 -0
- package/dist/ar/launcher-ar.js +11 -1
- package/dist/ar/model-ar.js +4 -2
- package/dist/ar/product-ar.js +11 -2
- package/dist/ar/raw-ar.js +4 -2
- package/dist/ar/scene-ar.js +7 -2
- package/dist/embed/controllers/configurator-controller.js +8 -0
- package/dist/embed/controllers/viewer-controller.js +5 -10
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -120,6 +120,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
120
120
|
var LauncherAR = /*#__PURE__*/function () {
|
|
121
121
|
function LauncherAR() {
|
|
122
122
|
_classCallCheck(this, LauncherAR);
|
|
123
|
+
|
|
124
|
+
this._opt = {
|
|
125
|
+
anchor: "horizontal_vertical"
|
|
126
|
+
};
|
|
123
127
|
}
|
|
124
128
|
/**
|
|
125
129
|
* Initialise and launch with a single function call. this is mostly for convenience.
|
|
@@ -139,6 +143,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
139
143
|
})["catch"](reject);
|
|
140
144
|
});
|
|
141
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* AR Options used for launching AR
|
|
148
|
+
*/
|
|
149
|
+
|
|
150
|
+
}, {
|
|
151
|
+
key: "options",
|
|
152
|
+
get: function get() {
|
|
153
|
+
return this._opt;
|
|
154
|
+
}
|
|
142
155
|
}]);
|
|
143
156
|
|
|
144
157
|
return LauncherAR;
|
|
@@ -272,8 +285,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
272
285
|
|
|
273
286
|
|
|
274
287
|
if (util_1.Util.canSceneViewer()) {
|
|
275
|
-
|
|
276
|
-
|
|
288
|
+
var arviewer = new scene_viewer_1["default"]();
|
|
289
|
+
arviewer.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.original_filename;
|
|
290
|
+
arviewer.isVertical = _this3.options.anchor === "vertical" ? true : false;
|
|
291
|
+
_this3._ar = arviewer;
|
|
277
292
|
return accept(_this3);
|
|
278
293
|
} // otherwise, we didn't have AR available - it should never really reach this stage as this should be caught
|
|
279
294
|
// earlier in the process
|
|
@@ -516,8 +531,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
516
531
|
|
|
517
532
|
|
|
518
533
|
if (util_1.Util.canSceneViewer()) {
|
|
519
|
-
|
|
520
|
-
|
|
534
|
+
var arviewer = new scene_viewer_1["default"]();
|
|
535
|
+
arviewer.modelUrl = plattar_api_1.Server.location().cdn + model.attributes.path + model.attributes.original_filename;
|
|
536
|
+
arviewer.isVertical = _this5.options.anchor === "vertical" ? true : false;
|
|
537
|
+
var scene = product.relationships.find(plattar_api_1.Scene);
|
|
538
|
+
|
|
539
|
+
if (scene) {
|
|
540
|
+
var sceneOpt = scene.attributes.custom_json || {};
|
|
541
|
+
|
|
542
|
+
if (sceneOpt.anchor === "vertical") {
|
|
543
|
+
arviewer.isVertical = true;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
_this5._ar = arviewer;
|
|
521
548
|
return accept(_this5);
|
|
522
549
|
} // otherwise, we didn't have AR available - it should never really reach this stage as this should be caught
|
|
523
550
|
// earlier in the process
|
|
@@ -687,8 +714,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
687
714
|
|
|
688
715
|
if (util_1.Util.canSceneViewer()) {
|
|
689
716
|
if (lowerLoc.endsWith("glb") || lowerLoc.endsWith("gltf")) {
|
|
690
|
-
|
|
691
|
-
|
|
717
|
+
var arviewer = new scene_viewer_1["default"]();
|
|
718
|
+
arviewer.modelUrl = modelLocation;
|
|
719
|
+
arviewer.isVertical = _this7.options.anchor === "vertical" ? true : false;
|
|
720
|
+
_this7._ar = arviewer;
|
|
692
721
|
return accept(_this7);
|
|
693
722
|
}
|
|
694
723
|
|
|
@@ -916,8 +945,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
916
945
|
|
|
917
946
|
if (util_1.Util.canSceneViewer()) {
|
|
918
947
|
return _this9._ComposeScene(scene, "glb").then(function (modelUrl) {
|
|
919
|
-
|
|
920
|
-
|
|
948
|
+
var arviewer = new scene_viewer_1["default"]();
|
|
949
|
+
arviewer.modelUrl = modelUrl;
|
|
950
|
+
arviewer.isVertical = _this9.options.anchor === "vertical" ? true : false;
|
|
951
|
+
|
|
952
|
+
if (sceneOpt.anchor === "vertical") {
|
|
953
|
+
arviewer.isVertical = true;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
_this9._ar = arviewer;
|
|
921
957
|
return accept(_this9);
|
|
922
958
|
})["catch"](reject);
|
|
923
959
|
} // otherwise, we didn't have AR available - it should never really reach this stage as this should be caught
|
|
@@ -1159,6 +1195,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1159
1195
|
|
|
1160
1196
|
var showAR = _this12.getAttribute("show-ar");
|
|
1161
1197
|
|
|
1198
|
+
var showUI = _this12.getAttribute("show-ui");
|
|
1199
|
+
|
|
1200
|
+
if (showUI && showUI === "true") {
|
|
1201
|
+
dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1162
1204
|
if (configState) {
|
|
1163
1205
|
dst += "&config_state=" + configState;
|
|
1164
1206
|
}
|
|
@@ -1210,6 +1252,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1210
1252
|
|
|
1211
1253
|
var showAR = _this13.getAttribute("show-ar");
|
|
1212
1254
|
|
|
1255
|
+
var showUI = _this13.getAttribute("show-ui");
|
|
1256
|
+
|
|
1213
1257
|
if (configState) {
|
|
1214
1258
|
viewer.setAttribute("config-state", configState);
|
|
1215
1259
|
}
|
|
@@ -1218,6 +1262,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1218
1262
|
viewer.setAttribute("show-ar", showAR);
|
|
1219
1263
|
}
|
|
1220
1264
|
|
|
1265
|
+
if (showUI) {
|
|
1266
|
+
viewer.setAttribute("show-ui", showUI);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1221
1269
|
viewer.onload = function () {
|
|
1222
1270
|
return accept(viewer);
|
|
1223
1271
|
};
|
|
@@ -1848,9 +1896,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1848
1896
|
|
|
1849
1897
|
var product_ar_1 = require("../../ar/product-ar");
|
|
1850
1898
|
|
|
1851
|
-
var
|
|
1899
|
+
var scene_ar_1 = require("../../ar/scene-ar");
|
|
1852
1900
|
|
|
1853
|
-
var
|
|
1901
|
+
var scene_product_ar_1 = require("../../ar/scene-product-ar");
|
|
1854
1902
|
|
|
1855
1903
|
var util_1 = require("../../util/util");
|
|
1856
1904
|
|
|
@@ -2051,20 +2099,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2051
2099
|
return _product.init().then(accept)["catch"](reject);
|
|
2052
2100
|
}
|
|
2053
2101
|
|
|
2054
|
-
var sceneID = _this22.getAttribute("scene-id"); //
|
|
2102
|
+
var sceneID = _this22.getAttribute("scene-id"); // fallback to using default SceneAR implementation
|
|
2055
2103
|
|
|
2056
2104
|
|
|
2057
2105
|
if (sceneID) {
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
if (first) {
|
|
2062
|
-
var sceneProductAR = new scene_product_ar_1.SceneProductAR(first.scene_product_id, first.product_variation_id);
|
|
2063
|
-
return sceneProductAR.init().then(accept)["catch"](reject);
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
return reject(new Error("ViewerController.initAR() - your scene does not contain any valid products"));
|
|
2067
|
-
})["catch"](reject);
|
|
2106
|
+
var sceneAR = new scene_ar_1.SceneAR(sceneID);
|
|
2107
|
+
sceneAR.init().then(accept)["catch"](reject);
|
|
2108
|
+
return;
|
|
2068
2109
|
}
|
|
2069
2110
|
|
|
2070
2111
|
return reject(new Error("ViewerController.initAR() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -2095,8 +2136,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2095
2136
|
exports.ViewerController = ViewerController;
|
|
2096
2137
|
}, {
|
|
2097
2138
|
"../../ar/product-ar": 3,
|
|
2139
|
+
"../../ar/scene-ar": 5,
|
|
2098
2140
|
"../../ar/scene-product-ar": 6,
|
|
2099
|
-
"../../util/configurator-state": 14,
|
|
2100
2141
|
"../../util/util": 15,
|
|
2101
2142
|
"./plattar-controller": 8,
|
|
2102
2143
|
"@plattar/plattar-api": 42
|
|
@@ -2691,11 +2732,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2691
2732
|
Object.defineProperty(exports, "__esModule", {
|
|
2692
2733
|
value: true
|
|
2693
2734
|
});
|
|
2694
|
-
exports.ConfiguratorState = exports.Util = exports.RawAR = exports.ModelAR = exports.SceneAR = exports.SceneProductAR = exports.ProductAR = exports.version = exports.PlattarQRCode = exports.PlattarWeb = void 0;
|
|
2735
|
+
exports.ConfiguratorState = exports.Util = exports.RawAR = exports.ModelAR = exports.SceneAR = exports.SceneProductAR = exports.ProductAR = exports.LauncherAR = exports.version = exports.PlattarQRCode = exports.PlattarWeb = void 0;
|
|
2695
2736
|
exports.PlattarWeb = __importStar(require("@plattar/plattar-web"));
|
|
2696
2737
|
exports.PlattarQRCode = __importStar(require("@plattar/plattar-qrcode"));
|
|
2697
2738
|
exports.version = __importStar(require("./version"));
|
|
2698
2739
|
|
|
2740
|
+
var launcher_ar_1 = require("./ar/launcher-ar");
|
|
2741
|
+
|
|
2742
|
+
Object.defineProperty(exports, "LauncherAR", {
|
|
2743
|
+
enumerable: true,
|
|
2744
|
+
get: function get() {
|
|
2745
|
+
return launcher_ar_1.LauncherAR;
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2748
|
+
|
|
2699
2749
|
var product_ar_1 = require("./ar/product-ar");
|
|
2700
2750
|
|
|
2701
2751
|
Object.defineProperty(exports, "ProductAR", {
|
|
@@ -2771,6 +2821,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2771
2821
|
|
|
2772
2822
|
console.log("using @plattar/plattar-ar-adapter v" + version_1["default"]);
|
|
2773
2823
|
}, {
|
|
2824
|
+
"./ar/launcher-ar": 1,
|
|
2774
2825
|
"./ar/model-ar": 2,
|
|
2775
2826
|
"./ar/product-ar": 3,
|
|
2776
2827
|
"./ar/raw-ar": 4,
|
|
@@ -3205,7 +3256,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3205
3256
|
Object.defineProperty(exports, "__esModule", {
|
|
3206
3257
|
value: true
|
|
3207
3258
|
});
|
|
3208
|
-
exports["default"] = "1.
|
|
3259
|
+
exports["default"] = "1.130.3";
|
|
3209
3260
|
}, {}],
|
|
3210
3261
|
17: [function (require, module, exports) {
|
|
3211
3262
|
"use strict";
|
|
@@ -9564,6 +9615,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9564
9615
|
exports["default"] = "1.120.1";
|
|
9565
9616
|
}, {}],
|
|
9566
9617
|
115: [function (require, module, exports) {
|
|
9618
|
+
var Util = require("../../util/util");
|
|
9619
|
+
|
|
9567
9620
|
var ElementController = require("../controllers/element-controller");
|
|
9568
9621
|
|
|
9569
9622
|
var BaseElement = /*#__PURE__*/function (_HTMLElement3) {
|
|
@@ -9602,6 +9655,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9602
9655
|
get: function get() {
|
|
9603
9656
|
return this._controller ? this._controller.context : undefined;
|
|
9604
9657
|
}
|
|
9658
|
+
}, {
|
|
9659
|
+
key: "parent",
|
|
9660
|
+
get: function get() {
|
|
9661
|
+
return this._controller ? this._controller.parent : undefined;
|
|
9662
|
+
}
|
|
9605
9663
|
}, {
|
|
9606
9664
|
key: "element",
|
|
9607
9665
|
get: function get() {
|
|
@@ -9723,6 +9781,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9723
9781
|
get: function get() {
|
|
9724
9782
|
return "none";
|
|
9725
9783
|
}
|
|
9784
|
+
}, {
|
|
9785
|
+
key: "elementLocation",
|
|
9786
|
+
get: function get() {
|
|
9787
|
+
return Util.getElementLocation(this.elementType);
|
|
9788
|
+
}
|
|
9726
9789
|
}]);
|
|
9727
9790
|
|
|
9728
9791
|
return BaseElement;
|
|
@@ -9730,6 +9793,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9730
9793
|
|
|
9731
9794
|
module.exports = BaseElement;
|
|
9732
9795
|
}, {
|
|
9796
|
+
"../../util/util": 128,
|
|
9733
9797
|
"../controllers/element-controller": 117
|
|
9734
9798
|
}],
|
|
9735
9799
|
116: [function (require, module, exports) {
|
|
@@ -9756,6 +9820,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9756
9820
|
get: function get() {
|
|
9757
9821
|
return "configurator";
|
|
9758
9822
|
}
|
|
9823
|
+
}, {
|
|
9824
|
+
key: "elementLocation",
|
|
9825
|
+
get: function get() {
|
|
9826
|
+
if (this.hasAttribute("show-ui")) {
|
|
9827
|
+
var state = this.getAttribute("show-ui");
|
|
9828
|
+
return state === "true" ? "configurator/dist/index.html" : _get(_getPrototypeOf(ConfiguratorElement.prototype), "elementLocation", this);
|
|
9829
|
+
}
|
|
9830
|
+
|
|
9831
|
+
return _get(_getPrototypeOf(ConfiguratorElement.prototype), "elementLocation", this);
|
|
9832
|
+
}
|
|
9759
9833
|
}, {
|
|
9760
9834
|
key: "optionalAttributes",
|
|
9761
9835
|
get: function get() {
|
|
@@ -9840,7 +9914,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9840
9914
|
throw new Error("ElementController - attribute \"server\" must be one of \"production\", \"staging\" or \"dev\"");
|
|
9841
9915
|
}
|
|
9842
9916
|
|
|
9843
|
-
var embedLocation =
|
|
9917
|
+
var embedLocation = element.elementLocation;
|
|
9844
9918
|
|
|
9845
9919
|
if (embedLocation === undefined) {
|
|
9846
9920
|
throw new Error("ElementController - element named \"" + elementType + "\" is invalid");
|
|
@@ -9881,6 +9955,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9881
9955
|
get: function get() {
|
|
9882
9956
|
return messenger.self;
|
|
9883
9957
|
}
|
|
9958
|
+
}, {
|
|
9959
|
+
key: "parent",
|
|
9960
|
+
get: function get() {
|
|
9961
|
+
return messenger.parent;
|
|
9962
|
+
}
|
|
9884
9963
|
}, {
|
|
9885
9964
|
key: "controller",
|
|
9886
9965
|
get: function get() {
|
|
@@ -9943,7 +10022,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9943
10022
|
|
|
9944
10023
|
if (element.hasAttribute("fullscreen")) {
|
|
9945
10024
|
var style = document.createElement('style');
|
|
9946
|
-
style.textContent = "
|
|
10025
|
+
style.textContent = "._PlattarFullScreen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }";
|
|
9947
10026
|
this._iframe.className = "_PlattarFullScreen";
|
|
9948
10027
|
shadow.append(style);
|
|
9949
10028
|
this._fsStyle = style;
|
|
@@ -10443,13 +10522,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10443
10522
|
value: function getServerLocation(server) {
|
|
10444
10523
|
switch (server) {
|
|
10445
10524
|
case "production":
|
|
10446
|
-
return "https://app.plattar.com/
|
|
10525
|
+
return "https://app.plattar.com/";
|
|
10447
10526
|
|
|
10448
10527
|
case "staging":
|
|
10449
|
-
return "https://staging.plattar.space/
|
|
10528
|
+
return "https://staging.plattar.space/";
|
|
10450
10529
|
|
|
10451
10530
|
case "dev":
|
|
10452
|
-
return "https://localhost/
|
|
10531
|
+
return "https://localhost/";
|
|
10453
10532
|
|
|
10454
10533
|
default:
|
|
10455
10534
|
return undefined;
|
|
@@ -10461,25 +10540,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10461
10540
|
var isValid = Util.isValidType(etype);
|
|
10462
10541
|
|
|
10463
10542
|
if (isValid) {
|
|
10464
|
-
return etype + ".html";
|
|
10465
|
-
}
|
|
10466
|
-
|
|
10467
|
-
return undefined;
|
|
10468
|
-
}
|
|
10469
|
-
}, {
|
|
10470
|
-
key: "getElementBundleLocation",
|
|
10471
|
-
value: function getElementBundleLocation(etype, server) {
|
|
10472
|
-
var location = Util.getServerLocation(server);
|
|
10473
|
-
|
|
10474
|
-
if (!location) {
|
|
10475
|
-
return undefined;
|
|
10476
|
-
}
|
|
10477
|
-
|
|
10478
|
-
var isValid = Util.isValidType(etype);
|
|
10479
|
-
|
|
10480
|
-
if (isValid) {
|
|
10481
|
-
var isMinified = location === "dev" ? false : true;
|
|
10482
|
-
return isMinified ? etype + "-bundle.min.js" : etype + "-bundle.js";
|
|
10543
|
+
return "renderer/" + etype + ".html";
|
|
10483
10544
|
}
|
|
10484
10545
|
|
|
10485
10546
|
return undefined;
|
|
@@ -10531,7 +10592,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10531
10592
|
module.exports = Util;
|
|
10532
10593
|
}, {}],
|
|
10533
10594
|
129: [function (require, module, exports) {
|
|
10534
|
-
module.exports = "1.
|
|
10595
|
+
module.exports = "1.130.1";
|
|
10535
10596
|
}, {}],
|
|
10536
10597
|
130: [function (require, module, exports) {
|
|
10537
10598
|
(function (global) {
|