@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
|
@@ -722,6 +722,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
722
722
|
function SceneAR() {
|
|
723
723
|
var _this9;
|
|
724
724
|
var sceneID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
725
|
+
var variationSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
725
726
|
_classCallCheck(this, SceneAR);
|
|
726
727
|
_this9 = _super4.call(this);
|
|
727
728
|
// analytics instance
|
|
@@ -730,6 +731,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
730
731
|
throw new Error("SceneAR.constructor(sceneID) - sceneID must be defined");
|
|
731
732
|
}
|
|
732
733
|
_this9._sceneID = sceneID;
|
|
734
|
+
_this9._variationSelection = variationSelection || {};
|
|
733
735
|
_this9._ar = null;
|
|
734
736
|
return _this9;
|
|
735
737
|
}
|
|
@@ -765,6 +767,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
765
767
|
}, {
|
|
766
768
|
key: "_ComposeScene",
|
|
767
769
|
value: function _ComposeScene(scene, output) {
|
|
770
|
+
var _this10 = this;
|
|
768
771
|
return new Promise(function (accept, reject) {
|
|
769
772
|
var sceneProducts = scene.relationships.filter(plattar_api_1.SceneProduct);
|
|
770
773
|
var sceneModels = scene.relationships.filter(plattar_api_1.SceneModel);
|
|
@@ -780,9 +783,23 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
780
783
|
// add our scene products
|
|
781
784
|
sceneProducts.forEach(function (sceneProduct) {
|
|
782
785
|
var product = sceneProduct.relationships.find(plattar_api_1.Product);
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
+
var selection = _this10._variationSelection;
|
|
787
|
+
// we have a specific product selection
|
|
788
|
+
if (sceneProduct.attributes.include_in_augment) {
|
|
789
|
+
// check if this product is the one we want (from selection optionally)
|
|
790
|
+
if (product && product.id === selection.productID && selection.variationID) {
|
|
791
|
+
configurator.addSceneProduct(sceneProduct.id, selection.variationID);
|
|
792
|
+
totalARObjectCount++;
|
|
793
|
+
} else if (product) {
|
|
794
|
+
// check if this scene-product is the one we want (from selection)
|
|
795
|
+
if (sceneProduct.id === selection.sceneProductID && selection.variationID) {
|
|
796
|
+
configurator.addSceneProduct(sceneProduct.id, selection.variationID);
|
|
797
|
+
totalARObjectCount++;
|
|
798
|
+
} else if (product.attributes.product_variation_id) {
|
|
799
|
+
configurator.addSceneProduct(sceneProduct.id, product.attributes.product_variation_id);
|
|
800
|
+
totalARObjectCount++;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
786
803
|
}
|
|
787
804
|
});
|
|
788
805
|
// add our scene models
|
|
@@ -811,18 +828,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
811
828
|
}, {
|
|
812
829
|
key: "init",
|
|
813
830
|
value: function init() {
|
|
814
|
-
var
|
|
831
|
+
var _this11 = this;
|
|
815
832
|
return new Promise(function (accept, reject) {
|
|
816
833
|
if (!util_1.Util.canAugment()) {
|
|
817
834
|
return reject(new Error("SceneAR.init() - cannot proceed as AR not available in context"));
|
|
818
835
|
}
|
|
819
|
-
var scene = new plattar_api_1.Scene(
|
|
836
|
+
var scene = new plattar_api_1.Scene(_this11.sceneID);
|
|
820
837
|
scene.include(plattar_api_1.Project);
|
|
821
838
|
scene.include(plattar_api_1.SceneProduct);
|
|
822
839
|
scene.include(plattar_api_1.SceneProduct.include(plattar_api_1.Product));
|
|
823
840
|
scene.include(plattar_api_1.SceneModel);
|
|
824
841
|
scene.get().then(function (scene) {
|
|
825
|
-
|
|
842
|
+
_this11._SetupAnalytics(scene);
|
|
826
843
|
var sceneOpt = scene.attributes.custom_json || {};
|
|
827
844
|
// we need to define our AR module here
|
|
828
845
|
// we are in Safari/Quicklook mode here
|
|
@@ -831,10 +848,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
831
848
|
// VTO requires Reality Support
|
|
832
849
|
if (sceneOpt.anchor === "face") {
|
|
833
850
|
if (util_1.Util.canRealityViewer()) {
|
|
834
|
-
return
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
return accept(
|
|
851
|
+
return _this11._ComposeScene(scene, "vto").then(function (modelUrl) {
|
|
852
|
+
_this11._ar = new reality_viewer_1["default"]();
|
|
853
|
+
_this11._ar.modelUrl = modelUrl;
|
|
854
|
+
return accept(_this11);
|
|
838
855
|
})["catch"](reject);
|
|
839
856
|
} else {
|
|
840
857
|
return reject(new Error("SceneAR.init() - cannot proceed as VTO AR requires Reality Viewer support"));
|
|
@@ -842,25 +859,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
842
859
|
}
|
|
843
860
|
// otherwise, load the USDZ stuff second if available
|
|
844
861
|
if (util_1.Util.canQuicklook()) {
|
|
845
|
-
return
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
return accept(
|
|
862
|
+
return _this11._ComposeScene(scene, "usdz").then(function (modelUrl) {
|
|
863
|
+
_this11._ar = new quicklook_viewer_1["default"]();
|
|
864
|
+
_this11._ar.modelUrl = modelUrl;
|
|
865
|
+
return accept(_this11);
|
|
849
866
|
})["catch"](reject);
|
|
850
867
|
}
|
|
851
868
|
return reject(new Error("SceneAR.init() - cannot proceed as IOS device does not support AR Mode"));
|
|
852
869
|
}
|
|
853
870
|
// check android
|
|
854
871
|
if (util_1.Util.canSceneViewer()) {
|
|
855
|
-
return
|
|
872
|
+
return _this11._ComposeScene(scene, "glb").then(function (modelUrl) {
|
|
856
873
|
var arviewer = new scene_viewer_1["default"]();
|
|
857
874
|
arviewer.modelUrl = modelUrl;
|
|
858
|
-
arviewer.isVertical =
|
|
875
|
+
arviewer.isVertical = _this11.options.anchor === "vertical" ? true : false;
|
|
859
876
|
if (sceneOpt.anchor === "vertical") {
|
|
860
877
|
arviewer.isVertical = true;
|
|
861
878
|
}
|
|
862
|
-
|
|
863
|
-
return accept(
|
|
879
|
+
_this11._ar = arviewer;
|
|
880
|
+
return accept(_this11);
|
|
864
881
|
})["catch"](reject);
|
|
865
882
|
}
|
|
866
883
|
// otherwise, we didn't have AR available - it should never really reach this stage as this should be caught
|
|
@@ -933,19 +950,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
933
950
|
_inherits(SceneProductAR, _product_ar_1$Product);
|
|
934
951
|
var _super5 = _createSuper(SceneProductAR);
|
|
935
952
|
function SceneProductAR() {
|
|
936
|
-
var
|
|
953
|
+
var _this12;
|
|
937
954
|
var sceneProductID = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
938
955
|
var variationID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
939
956
|
var variationSKU = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
940
957
|
_classCallCheck(this, SceneProductAR);
|
|
941
|
-
|
|
958
|
+
_this12 = _super5.call(this, sceneProductID, variationID, variationSKU);
|
|
942
959
|
// this is evaluated in the init() function
|
|
943
|
-
|
|
960
|
+
_this12._attachedProductID = null;
|
|
944
961
|
if (!sceneProductID) {
|
|
945
962
|
throw new Error("SceneProductAR.constructor(sceneProductID, variationID) - sceneProductID must be defined");
|
|
946
963
|
}
|
|
947
|
-
|
|
948
|
-
return
|
|
964
|
+
_this12._sceneProductID = sceneProductID;
|
|
965
|
+
return _this12;
|
|
949
966
|
}
|
|
950
967
|
_createClass(SceneProductAR, [{
|
|
951
968
|
key: "sceneProductID",
|
|
@@ -963,20 +980,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
963
980
|
}, {
|
|
964
981
|
key: "init",
|
|
965
982
|
value: function init() {
|
|
966
|
-
var
|
|
983
|
+
var _this13 = this;
|
|
967
984
|
return new Promise(function (accept, reject) {
|
|
968
985
|
if (!util_1.Util.canAugment()) {
|
|
969
986
|
return reject(new Error("SceneProductAR.init() - cannot proceed as AR not available in context"));
|
|
970
987
|
}
|
|
971
|
-
var sceneProduct = new plattar_api_1.SceneProduct(
|
|
988
|
+
var sceneProduct = new plattar_api_1.SceneProduct(_this13.sceneProductID);
|
|
972
989
|
sceneProduct.get().then(function (sceneProduct) {
|
|
973
990
|
var productID = sceneProduct.attributes.product_id;
|
|
974
991
|
if (!productID) {
|
|
975
992
|
return reject("SceneProductAR.init() - Scene Product does not have an attached Product instance");
|
|
976
993
|
}
|
|
977
|
-
|
|
994
|
+
_this13._attachedProductID = productID;
|
|
978
995
|
// execute the standard Product AR functionality
|
|
979
|
-
return _get(_getPrototypeOf(SceneProductAR.prototype), "init",
|
|
996
|
+
return _get(_getPrototypeOf(SceneProductAR.prototype), "init", _this13).call(_this13).then(accept)["catch"](reject);
|
|
980
997
|
})["catch"](reject);
|
|
981
998
|
});
|
|
982
999
|
}
|
|
@@ -1027,17 +1044,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1027
1044
|
}, {
|
|
1028
1045
|
key: "startViewerQRCode",
|
|
1029
1046
|
value: function startViewerQRCode(options) {
|
|
1030
|
-
var
|
|
1047
|
+
var _this14 = this;
|
|
1031
1048
|
return new Promise(function (accept, reject) {
|
|
1032
1049
|
// remove the old renderer instance if any
|
|
1033
|
-
|
|
1034
|
-
var sceneID =
|
|
1050
|
+
_this14.removeRenderer();
|
|
1051
|
+
var sceneID = _this14.getAttribute("scene-id");
|
|
1035
1052
|
if (sceneID) {
|
|
1036
|
-
var opt = options ||
|
|
1053
|
+
var opt = options || _this14._GetDefaultQROptions();
|
|
1037
1054
|
var viewer = document.createElement("plattar-qrcode");
|
|
1038
1055
|
// required attributes with defaults for plattar-viewer node
|
|
1039
|
-
var width =
|
|
1040
|
-
var height =
|
|
1056
|
+
var width = _this14.getAttribute("width") || "500px";
|
|
1057
|
+
var height = _this14.getAttribute("height") || "500px";
|
|
1041
1058
|
viewer.setAttribute("width", width);
|
|
1042
1059
|
viewer.setAttribute("height", height);
|
|
1043
1060
|
if (opt.color) {
|
|
@@ -1052,9 +1069,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1052
1069
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1053
1070
|
var dst = plattar_api_1.Server.location().base + "renderer/configurator.html?scene_id=" + sceneID;
|
|
1054
1071
|
// optional attributes
|
|
1055
|
-
var configState =
|
|
1056
|
-
var showAR =
|
|
1057
|
-
var showUI =
|
|
1072
|
+
var configState = _this14.getAttribute("config-state");
|
|
1073
|
+
var showAR = _this14.getAttribute("show-ar");
|
|
1074
|
+
var showUI = _this14.getAttribute("show-ui");
|
|
1058
1075
|
if (showUI && showUI === "true") {
|
|
1059
1076
|
dst = plattar_api_1.Server.location().base + "configurator/dist/index.html?scene_id=" + sceneID;
|
|
1060
1077
|
}
|
|
@@ -1068,10 +1085,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1068
1085
|
viewer.onload = function () {
|
|
1069
1086
|
return accept(viewer);
|
|
1070
1087
|
};
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1088
|
+
_this14.append(viewer);
|
|
1089
|
+
_this14._element = viewer;
|
|
1090
|
+
_this14._state = plattar_controller_1.ControllerState.QRCode;
|
|
1091
|
+
_this14._prevQROpt = opt;
|
|
1075
1092
|
return;
|
|
1076
1093
|
}
|
|
1077
1094
|
return reject(new Error("ConfiguratorController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1080,25 +1097,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1080
1097
|
}, {
|
|
1081
1098
|
key: "startRenderer",
|
|
1082
1099
|
value: function startRenderer() {
|
|
1083
|
-
var
|
|
1100
|
+
var _this15 = this;
|
|
1084
1101
|
return new Promise(function (accept, reject) {
|
|
1085
1102
|
// remove the old renderer instance if any
|
|
1086
|
-
|
|
1087
|
-
var sceneID =
|
|
1103
|
+
_this15.removeRenderer();
|
|
1104
|
+
var sceneID = _this15.getAttribute("scene-id");
|
|
1088
1105
|
if (sceneID) {
|
|
1089
1106
|
// required attributes with defaults for plattar-configurator node
|
|
1090
|
-
var width =
|
|
1091
|
-
var height =
|
|
1092
|
-
var server =
|
|
1107
|
+
var width = _this15.getAttribute("width") || "500px";
|
|
1108
|
+
var height = _this15.getAttribute("height") || "500px";
|
|
1109
|
+
var server = _this15.getAttribute("server") || "production";
|
|
1093
1110
|
var viewer = document.createElement("plattar-configurator");
|
|
1094
1111
|
viewer.setAttribute("width", width);
|
|
1095
1112
|
viewer.setAttribute("height", height);
|
|
1096
1113
|
viewer.setAttribute("server", server);
|
|
1097
1114
|
viewer.setAttribute("scene-id", sceneID);
|
|
1098
1115
|
// optional attributes
|
|
1099
|
-
var configState =
|
|
1100
|
-
var showAR =
|
|
1101
|
-
var showUI =
|
|
1116
|
+
var configState = _this15.getAttribute("config-state");
|
|
1117
|
+
var showAR = _this15.getAttribute("show-ar");
|
|
1118
|
+
var showUI = _this15.getAttribute("show-ui");
|
|
1102
1119
|
if (configState) {
|
|
1103
1120
|
viewer.setAttribute("config-state", configState);
|
|
1104
1121
|
}
|
|
@@ -1111,9 +1128,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1111
1128
|
viewer.onload = function () {
|
|
1112
1129
|
return accept(viewer);
|
|
1113
1130
|
};
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1131
|
+
_this15.append(viewer);
|
|
1132
|
+
_this15._element = viewer;
|
|
1133
|
+
_this15._state = plattar_controller_1.ControllerState.Renderer;
|
|
1117
1134
|
return;
|
|
1118
1135
|
}
|
|
1119
1136
|
return reject(new Error("ConfiguratorController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1122,19 +1139,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1122
1139
|
}, {
|
|
1123
1140
|
key: "initAR",
|
|
1124
1141
|
value: function initAR() {
|
|
1125
|
-
var
|
|
1142
|
+
var _this16 = this;
|
|
1126
1143
|
return new Promise(function (accept, reject) {
|
|
1127
1144
|
if (!util_1.Util.canAugment()) {
|
|
1128
1145
|
return reject(new Error("ConfiguratorController.initAR() - cannot proceed as AR not available in context"));
|
|
1129
1146
|
}
|
|
1130
|
-
var arMode =
|
|
1147
|
+
var arMode = _this16.getAttribute("ar-mode") || "generated";
|
|
1131
1148
|
switch (arMode.toLowerCase()) {
|
|
1132
1149
|
case "inherited":
|
|
1133
|
-
|
|
1150
|
+
_this16._InitARInherited(accept, reject);
|
|
1134
1151
|
return;
|
|
1135
1152
|
case "generated":
|
|
1136
1153
|
default:
|
|
1137
|
-
|
|
1154
|
+
_this16._InitARGenerated(accept, reject);
|
|
1138
1155
|
}
|
|
1139
1156
|
});
|
|
1140
1157
|
}
|
|
@@ -1303,9 +1320,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1303
1320
|
* Initialise and start AR mode if available
|
|
1304
1321
|
*/
|
|
1305
1322
|
function startAR() {
|
|
1306
|
-
var
|
|
1323
|
+
var _this17 = this;
|
|
1307
1324
|
return new Promise(function (accept, reject) {
|
|
1308
|
-
|
|
1325
|
+
_this17.initAR().then(function (launcher) {
|
|
1309
1326
|
launcher.start();
|
|
1310
1327
|
accept();
|
|
1311
1328
|
})["catch"](reject);
|
|
@@ -1336,15 +1353,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1336
1353
|
}, {
|
|
1337
1354
|
key: "startARQRCode",
|
|
1338
1355
|
value: function startARQRCode(options) {
|
|
1339
|
-
var
|
|
1356
|
+
var _this18 = this;
|
|
1340
1357
|
return new Promise(function (accept, reject) {
|
|
1341
1358
|
// remove the old renderer instance if any
|
|
1342
|
-
|
|
1343
|
-
var opt = options ||
|
|
1359
|
+
_this18.removeRenderer();
|
|
1360
|
+
var opt = options || _this18._GetDefaultQROptions();
|
|
1344
1361
|
var viewer = document.createElement("plattar-qrcode");
|
|
1345
1362
|
// required attributes with defaults for plattar-viewer node
|
|
1346
|
-
var width =
|
|
1347
|
-
var height =
|
|
1363
|
+
var width = _this18.getAttribute("width") || "500px";
|
|
1364
|
+
var height = _this18.getAttribute("height") || "500px";
|
|
1348
1365
|
viewer.setAttribute("width", width);
|
|
1349
1366
|
viewer.setAttribute("height", height);
|
|
1350
1367
|
if (opt.color) {
|
|
@@ -1359,14 +1376,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1359
1376
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1360
1377
|
var qrOptions = btoa(JSON.stringify(opt));
|
|
1361
1378
|
var dst = plattar_api_1.Server.location().base + "renderer/launcher.html?qr_options=" + qrOptions;
|
|
1362
|
-
var sceneID =
|
|
1363
|
-
var configState =
|
|
1364
|
-
var embedType =
|
|
1365
|
-
var productID =
|
|
1366
|
-
var sceneProductID =
|
|
1367
|
-
var variationID =
|
|
1368
|
-
var variationSKU =
|
|
1369
|
-
var arMode =
|
|
1379
|
+
var sceneID = _this18.getAttribute("scene-id");
|
|
1380
|
+
var configState = _this18.getAttribute("config-state");
|
|
1381
|
+
var embedType = _this18.getAttribute("embed-type");
|
|
1382
|
+
var productID = _this18.getAttribute("product-id");
|
|
1383
|
+
var sceneProductID = _this18.getAttribute("scene-product-id");
|
|
1384
|
+
var variationID = _this18.getAttribute("variation-id");
|
|
1385
|
+
var variationSKU = _this18.getAttribute("variation-sku");
|
|
1386
|
+
var arMode = _this18.getAttribute("ar-mode");
|
|
1370
1387
|
if (configState) {
|
|
1371
1388
|
dst += "&config_state=" + configState;
|
|
1372
1389
|
}
|
|
@@ -1395,10 +1412,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1395
1412
|
viewer.onload = function () {
|
|
1396
1413
|
return accept(viewer);
|
|
1397
1414
|
};
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1415
|
+
_this18._element = viewer;
|
|
1416
|
+
_this18._state = ControllerState.QRCode;
|
|
1417
|
+
_this18._prevQROpt = opt;
|
|
1418
|
+
_this18.append(viewer);
|
|
1402
1419
|
});
|
|
1403
1420
|
}
|
|
1404
1421
|
/**
|
|
@@ -1483,17 +1500,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1483
1500
|
}, {
|
|
1484
1501
|
key: "startViewerQRCode",
|
|
1485
1502
|
value: function startViewerQRCode(options) {
|
|
1486
|
-
var
|
|
1503
|
+
var _this19 = this;
|
|
1487
1504
|
return new Promise(function (accept, reject) {
|
|
1488
1505
|
// remove the old renderer instance if any
|
|
1489
|
-
|
|
1490
|
-
var productID =
|
|
1506
|
+
_this19.removeRenderer();
|
|
1507
|
+
var productID = _this19.getAttribute("product-id");
|
|
1491
1508
|
if (productID) {
|
|
1492
|
-
var opt = options ||
|
|
1509
|
+
var opt = options || _this19._GetDefaultQROptions();
|
|
1493
1510
|
var viewer = document.createElement("plattar-qrcode");
|
|
1494
1511
|
// required attributes with defaults for plattar-viewer node
|
|
1495
|
-
var width =
|
|
1496
|
-
var height =
|
|
1512
|
+
var width = _this19.getAttribute("width") || "500px";
|
|
1513
|
+
var height = _this19.getAttribute("height") || "500px";
|
|
1497
1514
|
viewer.setAttribute("width", width);
|
|
1498
1515
|
viewer.setAttribute("height", height);
|
|
1499
1516
|
if (opt.color) {
|
|
@@ -1507,9 +1524,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1507
1524
|
}
|
|
1508
1525
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1509
1526
|
// optional attributes
|
|
1510
|
-
var variationID =
|
|
1511
|
-
var variationSKU =
|
|
1512
|
-
var showAR =
|
|
1527
|
+
var variationID = _this19.getAttribute("variation-id");
|
|
1528
|
+
var variationSKU = _this19.getAttribute("variation-sku");
|
|
1529
|
+
var showAR = _this19.getAttribute("show-ar");
|
|
1513
1530
|
var dst = plattar_api_1.Server.location().base + "renderer/product.html?product_id=" + productID;
|
|
1514
1531
|
if (variationID) {
|
|
1515
1532
|
dst += "&variationId=" + variationID;
|
|
@@ -1524,10 +1541,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1524
1541
|
viewer.onload = function () {
|
|
1525
1542
|
return accept(viewer);
|
|
1526
1543
|
};
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1544
|
+
_this19.append(viewer);
|
|
1545
|
+
_this19._element = viewer;
|
|
1546
|
+
_this19._state = plattar_controller_1.ControllerState.QRCode;
|
|
1547
|
+
_this19._prevQROpt = opt;
|
|
1531
1548
|
return;
|
|
1532
1549
|
}
|
|
1533
1550
|
return reject(new Error("ProductController.startQRCode() - minimum required attributes not set, use product-id as a minimum"));
|
|
@@ -1536,25 +1553,25 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1536
1553
|
}, {
|
|
1537
1554
|
key: "startRenderer",
|
|
1538
1555
|
value: function startRenderer() {
|
|
1539
|
-
var
|
|
1556
|
+
var _this20 = this;
|
|
1540
1557
|
return new Promise(function (accept, reject) {
|
|
1541
1558
|
// remove the old renderer instance if any
|
|
1542
|
-
|
|
1543
|
-
var productID =
|
|
1559
|
+
_this20.removeRenderer();
|
|
1560
|
+
var productID = _this20.getAttribute("product-id");
|
|
1544
1561
|
if (productID) {
|
|
1545
1562
|
// required attributes with defaults for plattar-product node
|
|
1546
|
-
var width =
|
|
1547
|
-
var height =
|
|
1548
|
-
var server =
|
|
1563
|
+
var width = _this20.getAttribute("width") || "500px";
|
|
1564
|
+
var height = _this20.getAttribute("height") || "500px";
|
|
1565
|
+
var server = _this20.getAttribute("server") || "production";
|
|
1549
1566
|
var viewer = document.createElement("plattar-product");
|
|
1550
1567
|
viewer.setAttribute("width", width);
|
|
1551
1568
|
viewer.setAttribute("height", height);
|
|
1552
1569
|
viewer.setAttribute("server", server);
|
|
1553
1570
|
viewer.setAttribute("product-id", productID);
|
|
1554
1571
|
// optional attributes
|
|
1555
|
-
var variationID =
|
|
1556
|
-
var variationSKU =
|
|
1557
|
-
var showAR =
|
|
1572
|
+
var variationID = _this20.getAttribute("variation-id");
|
|
1573
|
+
var variationSKU = _this20.getAttribute("variation-sku");
|
|
1574
|
+
var showAR = _this20.getAttribute("show-ar");
|
|
1558
1575
|
if (variationID) {
|
|
1559
1576
|
viewer.setAttribute("variation-id", variationID);
|
|
1560
1577
|
}
|
|
@@ -1567,9 +1584,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1567
1584
|
viewer.onload = function () {
|
|
1568
1585
|
return accept(viewer);
|
|
1569
1586
|
};
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1587
|
+
_this20.append(viewer);
|
|
1588
|
+
_this20._element = viewer;
|
|
1589
|
+
_this20._state = plattar_controller_1.ControllerState.Renderer;
|
|
1573
1590
|
return;
|
|
1574
1591
|
}
|
|
1575
1592
|
return reject(new Error("ProductController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1578,15 +1595,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1578
1595
|
}, {
|
|
1579
1596
|
key: "initAR",
|
|
1580
1597
|
value: function initAR() {
|
|
1581
|
-
var
|
|
1598
|
+
var _this21 = this;
|
|
1582
1599
|
return new Promise(function (accept, reject) {
|
|
1583
1600
|
if (!util_1.Util.canAugment()) {
|
|
1584
1601
|
return reject(new Error("ProductController.initAR() - cannot proceed as AR not available in context"));
|
|
1585
1602
|
}
|
|
1586
|
-
var productID =
|
|
1603
|
+
var productID = _this21.getAttribute("product-id");
|
|
1587
1604
|
if (productID) {
|
|
1588
|
-
var variationID =
|
|
1589
|
-
var variationSKU =
|
|
1605
|
+
var variationID = _this21.getAttribute("variation-id");
|
|
1606
|
+
var variationSKU = _this21.getAttribute("variation-sku");
|
|
1590
1607
|
var product = new product_ar_1.ProductAR(productID, variationID, variationSKU);
|
|
1591
1608
|
return product.init().then(accept)["catch"](reject);
|
|
1592
1609
|
}
|
|
@@ -1667,17 +1684,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1667
1684
|
}, {
|
|
1668
1685
|
key: "startViewerQRCode",
|
|
1669
1686
|
value: function startViewerQRCode(options) {
|
|
1670
|
-
var
|
|
1687
|
+
var _this22 = this;
|
|
1671
1688
|
return new Promise(function (accept, reject) {
|
|
1672
1689
|
// remove the old renderer instance if any
|
|
1673
|
-
|
|
1674
|
-
var sceneID =
|
|
1690
|
+
_this22.removeRenderer();
|
|
1691
|
+
var sceneID = _this22.getAttribute("scene-id");
|
|
1675
1692
|
if (sceneID) {
|
|
1676
|
-
var opt = options ||
|
|
1693
|
+
var opt = options || _this22._GetDefaultQROptions();
|
|
1677
1694
|
var viewer = document.createElement("plattar-qrcode");
|
|
1678
1695
|
// required attributes with defaults for plattar-viewer node
|
|
1679
|
-
var width =
|
|
1680
|
-
var height =
|
|
1696
|
+
var width = _this22.getAttribute("width") || "500px";
|
|
1697
|
+
var height = _this22.getAttribute("height") || "500px";
|
|
1681
1698
|
viewer.setAttribute("width", width);
|
|
1682
1699
|
viewer.setAttribute("height", height);
|
|
1683
1700
|
if (opt.color) {
|
|
@@ -1692,10 +1709,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1692
1709
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1693
1710
|
var dst = plattar_api_1.Server.location().base + "renderer/viewer.html?scene_id=" + sceneID;
|
|
1694
1711
|
// optional attributes
|
|
1695
|
-
var productID =
|
|
1696
|
-
var variationID =
|
|
1697
|
-
var variationSKU =
|
|
1698
|
-
var showAR =
|
|
1712
|
+
var productID = _this22.getAttribute("product-id") || _this22.getAttribute("scene-product-id");
|
|
1713
|
+
var variationID = _this22.getAttribute("variation-id");
|
|
1714
|
+
var variationSKU = _this22.getAttribute("variation-sku");
|
|
1715
|
+
var showAR = _this22.getAttribute("show-ar");
|
|
1699
1716
|
if (productID) {
|
|
1700
1717
|
dst += "&productId=" + productID;
|
|
1701
1718
|
}
|
|
@@ -1712,10 +1729,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1712
1729
|
viewer.onload = function () {
|
|
1713
1730
|
return accept(viewer);
|
|
1714
1731
|
};
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1732
|
+
_this22.append(viewer);
|
|
1733
|
+
_this22._element = viewer;
|
|
1734
|
+
_this22._state = plattar_controller_1.ControllerState.QRCode;
|
|
1735
|
+
_this22._prevQROpt = opt;
|
|
1719
1736
|
return;
|
|
1720
1737
|
}
|
|
1721
1738
|
return reject(new Error("ViewerController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1724,26 +1741,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1724
1741
|
}, {
|
|
1725
1742
|
key: "startRenderer",
|
|
1726
1743
|
value: function startRenderer() {
|
|
1727
|
-
var
|
|
1744
|
+
var _this23 = this;
|
|
1728
1745
|
return new Promise(function (accept, reject) {
|
|
1729
1746
|
// remove the old renderer instance if any
|
|
1730
|
-
|
|
1731
|
-
var sceneID =
|
|
1747
|
+
_this23.removeRenderer();
|
|
1748
|
+
var sceneID = _this23.getAttribute("scene-id");
|
|
1732
1749
|
if (sceneID) {
|
|
1733
1750
|
// required attributes with defaults for plattar-viewer node
|
|
1734
|
-
var width =
|
|
1735
|
-
var height =
|
|
1736
|
-
var server =
|
|
1751
|
+
var width = _this23.getAttribute("width") || "500px";
|
|
1752
|
+
var height = _this23.getAttribute("height") || "500px";
|
|
1753
|
+
var server = _this23.getAttribute("server") || "production";
|
|
1737
1754
|
var viewer = document.createElement("plattar-viewer");
|
|
1738
1755
|
viewer.setAttribute("width", width);
|
|
1739
1756
|
viewer.setAttribute("height", height);
|
|
1740
1757
|
viewer.setAttribute("server", server);
|
|
1741
1758
|
viewer.setAttribute("scene-id", sceneID);
|
|
1742
1759
|
// optional attributes
|
|
1743
|
-
var productID =
|
|
1744
|
-
var variationID =
|
|
1745
|
-
var variationSKU =
|
|
1746
|
-
var showAR =
|
|
1760
|
+
var productID = _this23.getAttribute("product-id") || _this23.getAttribute("scene-product-id");
|
|
1761
|
+
var variationID = _this23.getAttribute("variation-id");
|
|
1762
|
+
var variationSKU = _this23.getAttribute("variation-sku");
|
|
1763
|
+
var showAR = _this23.getAttribute("show-ar");
|
|
1747
1764
|
if (productID) {
|
|
1748
1765
|
viewer.setAttribute("product-id", productID);
|
|
1749
1766
|
}
|
|
@@ -1759,9 +1776,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1759
1776
|
viewer.onload = function () {
|
|
1760
1777
|
return accept(viewer);
|
|
1761
1778
|
};
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1779
|
+
_this23.append(viewer);
|
|
1780
|
+
_this23._element = viewer;
|
|
1781
|
+
_this23._state = plattar_controller_1.ControllerState.Renderer;
|
|
1765
1782
|
return;
|
|
1766
1783
|
}
|
|
1767
1784
|
return reject(new Error("ViewerController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1770,34 +1787,34 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1770
1787
|
}, {
|
|
1771
1788
|
key: "initAR",
|
|
1772
1789
|
value: function initAR() {
|
|
1773
|
-
var
|
|
1790
|
+
var _this24 = this;
|
|
1774
1791
|
return new Promise(function (accept, reject) {
|
|
1775
1792
|
if (!util_1.Util.canAugment()) {
|
|
1776
1793
|
return reject(new Error("ViewerController.initAR() - cannot proceed as AR not available in context"));
|
|
1777
1794
|
}
|
|
1778
|
-
var productID =
|
|
1795
|
+
var productID = _this24.getAttribute("product-id");
|
|
1779
1796
|
// use product-id if available
|
|
1780
1797
|
if (productID) {
|
|
1781
|
-
var variationID =
|
|
1782
|
-
var variationSKU =
|
|
1798
|
+
var variationID = _this24.getAttribute("variation-id");
|
|
1799
|
+
var variationSKU = _this24.getAttribute("variation-sku");
|
|
1783
1800
|
var product = new product_ar_1.ProductAR(productID, variationID, variationSKU);
|
|
1784
1801
|
return product.init().then(accept)["catch"](reject);
|
|
1785
1802
|
}
|
|
1786
|
-
var sceneProductID =
|
|
1803
|
+
var sceneProductID = _this24.getAttribute("scene-product-id");
|
|
1787
1804
|
// use scene-product-id if available
|
|
1788
1805
|
if (sceneProductID) {
|
|
1789
|
-
var _variationID =
|
|
1790
|
-
var _variationSKU =
|
|
1806
|
+
var _variationID = _this24.getAttribute("variation-id");
|
|
1807
|
+
var _variationSKU = _this24.getAttribute("variation-sku");
|
|
1791
1808
|
var _product = new scene_product_ar_1.SceneProductAR(sceneProductID, _variationID, _variationSKU);
|
|
1792
1809
|
return _product.init().then(accept)["catch"](reject);
|
|
1793
1810
|
}
|
|
1794
|
-
var sceneID =
|
|
1811
|
+
var sceneID = _this24.getAttribute("scene-id");
|
|
1795
1812
|
// fallback to using default SceneAR implementation
|
|
1796
1813
|
if (sceneID) {
|
|
1797
1814
|
// special case - check if scene only has a single product, if so
|
|
1798
1815
|
// we need to use provided variation-id or variation-sku to override
|
|
1799
|
-
var _variationID2 =
|
|
1800
|
-
var _variationSKU2 =
|
|
1816
|
+
var _variationID2 = _this24.getAttribute("variation-id");
|
|
1817
|
+
var _variationSKU2 = _this24.getAttribute("variation-sku");
|
|
1801
1818
|
// just do scene-ar if variation ID and variation SKU is not set
|
|
1802
1819
|
if (!_variationID2 && !_variationSKU2) {
|
|
1803
1820
|
var sceneAR = new scene_ar_1.SceneAR(sceneID);
|
|
@@ -1880,17 +1897,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1880
1897
|
}, {
|
|
1881
1898
|
key: "startViewerQRCode",
|
|
1882
1899
|
value: function startViewerQRCode(options) {
|
|
1883
|
-
var
|
|
1900
|
+
var _this25 = this;
|
|
1884
1901
|
return new Promise(function (accept, reject) {
|
|
1885
1902
|
// remove the old renderer instance if any
|
|
1886
|
-
|
|
1887
|
-
var sceneID =
|
|
1903
|
+
_this25.removeRenderer();
|
|
1904
|
+
var sceneID = _this25.getAttribute("scene-id");
|
|
1888
1905
|
if (sceneID) {
|
|
1889
|
-
var opt = options ||
|
|
1906
|
+
var opt = options || _this25._GetDefaultQROptions();
|
|
1890
1907
|
var viewer = document.createElement("plattar-qrcode");
|
|
1891
1908
|
// required attributes with defaults for plattar-viewer node
|
|
1892
|
-
var width =
|
|
1893
|
-
var height =
|
|
1909
|
+
var width = _this25.getAttribute("width") || "500px";
|
|
1910
|
+
var height = _this25.getAttribute("height") || "500px";
|
|
1894
1911
|
viewer.setAttribute("width", width);
|
|
1895
1912
|
viewer.setAttribute("height", height);
|
|
1896
1913
|
if (opt.color) {
|
|
@@ -1905,22 +1922,34 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1905
1922
|
viewer.setAttribute("shorten", opt.shorten && (opt.shorten === true || opt.shorten === "true") ? "true" : "false");
|
|
1906
1923
|
var dst = plattar_api_1.Server.location().base + "renderer/facear.html?scene_id=" + sceneID;
|
|
1907
1924
|
// optional attributes
|
|
1908
|
-
var configState =
|
|
1909
|
-
var showAR =
|
|
1925
|
+
var configState = _this25.getAttribute("config-state");
|
|
1926
|
+
var showAR = _this25.getAttribute("show-ar");
|
|
1927
|
+
var productID = _this25.getAttribute("product-id");
|
|
1928
|
+
var sceneProductID = _this25.getAttribute("scene-product-id");
|
|
1929
|
+
var variationID = _this25.getAttribute("variation-id");
|
|
1910
1930
|
if (configState) {
|
|
1911
1931
|
dst += "&config_state=" + configState;
|
|
1912
1932
|
}
|
|
1913
1933
|
if (showAR) {
|
|
1914
1934
|
dst += "&show_ar=" + showAR;
|
|
1915
1935
|
}
|
|
1936
|
+
if (productID) {
|
|
1937
|
+
dst += "&product_id=" + productID;
|
|
1938
|
+
}
|
|
1939
|
+
if (sceneProductID) {
|
|
1940
|
+
dst += "&scene_product_id=" + sceneProductID;
|
|
1941
|
+
}
|
|
1942
|
+
if (variationID) {
|
|
1943
|
+
dst += "&variation_id=" + variationID;
|
|
1944
|
+
}
|
|
1916
1945
|
viewer.setAttribute("url", opt.url || dst);
|
|
1917
1946
|
viewer.onload = function () {
|
|
1918
1947
|
return accept(viewer);
|
|
1919
1948
|
};
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1949
|
+
_this25.append(viewer);
|
|
1950
|
+
_this25._element = viewer;
|
|
1951
|
+
_this25._state = plattar_controller_1.ControllerState.QRCode;
|
|
1952
|
+
_this25._prevQROpt = opt;
|
|
1924
1953
|
return;
|
|
1925
1954
|
}
|
|
1926
1955
|
return reject(new Error("VTOController.startQRCode() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1929,36 +1958,48 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1929
1958
|
}, {
|
|
1930
1959
|
key: "startRenderer",
|
|
1931
1960
|
value: function startRenderer() {
|
|
1932
|
-
var
|
|
1961
|
+
var _this26 = this;
|
|
1933
1962
|
return new Promise(function (accept, reject) {
|
|
1934
1963
|
// remove the old renderer instance if any
|
|
1935
|
-
|
|
1936
|
-
var sceneID =
|
|
1964
|
+
_this26.removeRenderer();
|
|
1965
|
+
var sceneID = _this26.getAttribute("scene-id");
|
|
1937
1966
|
if (sceneID) {
|
|
1938
1967
|
// required attributes with defaults for plattar-facear node
|
|
1939
|
-
var width =
|
|
1940
|
-
var height =
|
|
1941
|
-
var server =
|
|
1968
|
+
var width = _this26.getAttribute("width") || "500px";
|
|
1969
|
+
var height = _this26.getAttribute("height") || "500px";
|
|
1970
|
+
var server = _this26.getAttribute("server") || "production";
|
|
1942
1971
|
var viewer = document.createElement("plattar-facear");
|
|
1943
1972
|
viewer.setAttribute("width", width);
|
|
1944
1973
|
viewer.setAttribute("height", height);
|
|
1945
1974
|
viewer.setAttribute("server", server);
|
|
1946
1975
|
viewer.setAttribute("scene-id", sceneID);
|
|
1947
1976
|
// optional attributes
|
|
1948
|
-
var configState =
|
|
1949
|
-
var showAR =
|
|
1977
|
+
var configState = _this26.getAttribute("config-state");
|
|
1978
|
+
var showAR = _this26.getAttribute("show-ar");
|
|
1979
|
+
var productID = _this26.getAttribute("product-id");
|
|
1980
|
+
var sceneProductID = _this26.getAttribute("scene-product-id");
|
|
1981
|
+
var variationID = _this26.getAttribute("variation-id");
|
|
1950
1982
|
if (configState) {
|
|
1951
1983
|
viewer.setAttribute("config-state", configState);
|
|
1952
1984
|
}
|
|
1953
1985
|
if (showAR) {
|
|
1954
1986
|
viewer.setAttribute("show-ar", showAR);
|
|
1955
1987
|
}
|
|
1988
|
+
if (productID) {
|
|
1989
|
+
viewer.setAttribute("product-id", productID);
|
|
1990
|
+
}
|
|
1991
|
+
if (sceneProductID) {
|
|
1992
|
+
viewer.setAttribute("scene-product-id", sceneProductID);
|
|
1993
|
+
}
|
|
1994
|
+
if (variationID) {
|
|
1995
|
+
viewer.setAttribute("variation-id", variationID);
|
|
1996
|
+
}
|
|
1956
1997
|
viewer.onload = function () {
|
|
1957
1998
|
return accept(viewer);
|
|
1958
1999
|
};
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
2000
|
+
_this26.append(viewer);
|
|
2001
|
+
_this26._element = viewer;
|
|
2002
|
+
_this26._state = plattar_controller_1.ControllerState.Renderer;
|
|
1962
2003
|
return;
|
|
1963
2004
|
}
|
|
1964
2005
|
return reject(new Error("VTOController.startRenderer() - minimum required attributes not set, use scene-id as a minimum"));
|
|
@@ -1967,7 +2008,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1967
2008
|
}, {
|
|
1968
2009
|
key: "initAR",
|
|
1969
2010
|
value: function initAR() {
|
|
1970
|
-
var
|
|
2011
|
+
var _this27 = this;
|
|
1971
2012
|
return new Promise(function (accept, reject) {
|
|
1972
2013
|
if (!util_1.Util.canAugment()) {
|
|
1973
2014
|
return reject(new Error("VTOController.initAR() - cannot proceed as VTO AR not available in context"));
|
|
@@ -1975,14 +2016,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
1975
2016
|
if (!(util_1.Util.isSafari() || util_1.Util.isChromeOnIOS())) {
|
|
1976
2017
|
return reject(new Error("VTOController.initAR() - cannot proceed as VTO AR only available on IOS Mobile devices"));
|
|
1977
2018
|
}
|
|
1978
|
-
var arMode =
|
|
2019
|
+
var arMode = _this27.getAttribute("ar-mode") || "generated";
|
|
1979
2020
|
switch (arMode.toLowerCase()) {
|
|
1980
2021
|
case "inherited":
|
|
1981
|
-
|
|
2022
|
+
_this27._InitARInherited(accept, reject);
|
|
1982
2023
|
return;
|
|
1983
2024
|
case "generated":
|
|
1984
2025
|
default:
|
|
1985
|
-
|
|
2026
|
+
_this27._InitARGenerated(accept, reject);
|
|
1986
2027
|
}
|
|
1987
2028
|
});
|
|
1988
2029
|
}
|
|
@@ -2062,7 +2103,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2062
2103
|
// otherwise no config-state or viewer is active
|
|
2063
2104
|
// fallback to using default SceneAR implementation
|
|
2064
2105
|
if (sceneID) {
|
|
2065
|
-
var
|
|
2106
|
+
var productID = this.getAttribute("product-id");
|
|
2107
|
+
var sceneProductID = this.getAttribute("scene-product-id");
|
|
2108
|
+
var variationID = this.getAttribute("variation-id");
|
|
2109
|
+
var sceneAR = new __1.SceneAR(sceneID, {
|
|
2110
|
+
productID: productID ? productID : undefined,
|
|
2111
|
+
sceneProductID: sceneProductID ? sceneProductID : undefined,
|
|
2112
|
+
variationID: variationID ? variationID : undefined
|
|
2113
|
+
});
|
|
2066
2114
|
sceneAR.init().then(accept)["catch"](reject);
|
|
2067
2115
|
return;
|
|
2068
2116
|
}
|
|
@@ -2123,13 +2171,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2123
2171
|
_inherits(PlattarEmbed, _HTMLElement);
|
|
2124
2172
|
var _super10 = _createSuper(PlattarEmbed);
|
|
2125
2173
|
function PlattarEmbed() {
|
|
2126
|
-
var
|
|
2174
|
+
var _this28;
|
|
2127
2175
|
_classCallCheck(this, PlattarEmbed);
|
|
2128
|
-
|
|
2176
|
+
_this28 = _super10.call(this);
|
|
2129
2177
|
// this is the current embed type, viewer by default
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
return
|
|
2178
|
+
_this28._currentType = EmbedType.Viewer;
|
|
2179
|
+
_this28._controller = null;
|
|
2180
|
+
return _this28;
|
|
2133
2181
|
}
|
|
2134
2182
|
_createClass(PlattarEmbed, [{
|
|
2135
2183
|
key: "viewer",
|
|
@@ -2139,7 +2187,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2139
2187
|
}, {
|
|
2140
2188
|
key: "connectedCallback",
|
|
2141
2189
|
value: function connectedCallback() {
|
|
2142
|
-
var
|
|
2190
|
+
var _this29 = this;
|
|
2143
2191
|
var embedType = this.hasAttribute("embed-type") ? this.getAttribute("embed-type") : "viewer";
|
|
2144
2192
|
if (embedType) {
|
|
2145
2193
|
switch (embedType.toLowerCase()) {
|
|
@@ -2159,7 +2207,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2159
2207
|
var observer = new MutationObserver(function (mutations) {
|
|
2160
2208
|
mutations.forEach(function (mutation) {
|
|
2161
2209
|
if (mutation.type === "attributes") {
|
|
2162
|
-
|
|
2210
|
+
_this29._OnAttributesUpdated();
|
|
2163
2211
|
}
|
|
2164
2212
|
});
|
|
2165
2213
|
});
|
|
@@ -2194,59 +2242,59 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2194
2242
|
this.startAR().then(function () {
|
|
2195
2243
|
// nothing to do, launched successfully
|
|
2196
2244
|
})["catch"](function (_err) {
|
|
2197
|
-
|
|
2245
|
+
_this29.startQRCode();
|
|
2198
2246
|
});
|
|
2199
2247
|
} else if (init === "ar-fallback-viewer") {
|
|
2200
2248
|
this.startAR().then(function () {
|
|
2201
2249
|
// nothing to do, launched successfully
|
|
2202
2250
|
})["catch"](function (_err) {
|
|
2203
|
-
|
|
2251
|
+
_this29.startViewer();
|
|
2204
2252
|
});
|
|
2205
2253
|
}
|
|
2206
2254
|
}
|
|
2207
2255
|
}, {
|
|
2208
2256
|
key: "initAR",
|
|
2209
2257
|
value: function initAR() {
|
|
2210
|
-
var
|
|
2258
|
+
var _this30 = this;
|
|
2211
2259
|
return new Promise(function (accept, reject) {
|
|
2212
|
-
if (!
|
|
2260
|
+
if (!_this30._controller) {
|
|
2213
2261
|
return reject(new Error("PlattarEmbed.initAR() - cannot execute as controller has not loaded yet"));
|
|
2214
2262
|
}
|
|
2215
|
-
return
|
|
2263
|
+
return _this30._controller.initAR().then(accept)["catch"](reject);
|
|
2216
2264
|
});
|
|
2217
2265
|
}
|
|
2218
2266
|
}, {
|
|
2219
2267
|
key: "startAR",
|
|
2220
2268
|
value: function startAR() {
|
|
2221
|
-
var
|
|
2269
|
+
var _this31 = this;
|
|
2222
2270
|
return new Promise(function (accept, reject) {
|
|
2223
|
-
if (!
|
|
2271
|
+
if (!_this31._controller) {
|
|
2224
2272
|
return reject(new Error("PlattarEmbed.startAR() - cannot execute as controller has not loaded yet"));
|
|
2225
2273
|
}
|
|
2226
|
-
return
|
|
2274
|
+
return _this31._controller.startAR().then(accept)["catch"](reject);
|
|
2227
2275
|
});
|
|
2228
2276
|
}
|
|
2229
2277
|
}, {
|
|
2230
2278
|
key: "startViewer",
|
|
2231
2279
|
value: function startViewer() {
|
|
2232
|
-
var
|
|
2280
|
+
var _this32 = this;
|
|
2233
2281
|
return new Promise(function (accept, reject) {
|
|
2234
|
-
if (!
|
|
2282
|
+
if (!_this32._controller) {
|
|
2235
2283
|
return reject(new Error("PlattarEmbed.startViewer() - cannot execute as controller has not loaded yet"));
|
|
2236
2284
|
}
|
|
2237
|
-
return
|
|
2285
|
+
return _this32._controller.startRenderer().then(accept)["catch"](reject);
|
|
2238
2286
|
});
|
|
2239
2287
|
}
|
|
2240
2288
|
}, {
|
|
2241
2289
|
key: "startQRCode",
|
|
2242
2290
|
value: function startQRCode() {
|
|
2243
|
-
var
|
|
2291
|
+
var _this33 = this;
|
|
2244
2292
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
2245
2293
|
return new Promise(function (accept, reject) {
|
|
2246
|
-
if (!
|
|
2294
|
+
if (!_this33._controller) {
|
|
2247
2295
|
return reject(new Error("PlattarEmbed.startQRCode() - cannot execute as controller has not loaded yet"));
|
|
2248
2296
|
}
|
|
2249
|
-
return
|
|
2297
|
+
return _this33._controller.startQRCode(options).then(accept)["catch"](reject);
|
|
2250
2298
|
});
|
|
2251
2299
|
}
|
|
2252
2300
|
/**
|
|
@@ -2777,7 +2825,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2777
2825
|
Object.defineProperty(exports, "__esModule", {
|
|
2778
2826
|
value: true
|
|
2779
2827
|
});
|
|
2780
|
-
exports["default"] = "1.
|
|
2828
|
+
exports["default"] = "1.139.2";
|
|
2781
2829
|
}, {}],
|
|
2782
2830
|
17: [function (require, module, exports) {
|
|
2783
2831
|
"use strict";
|
|
@@ -2808,13 +2856,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2808
2856
|
_inherits(QuicklookViewer, _ar_viewer_1$default);
|
|
2809
2857
|
var _super11 = _createSuper(QuicklookViewer);
|
|
2810
2858
|
function QuicklookViewer() {
|
|
2811
|
-
var
|
|
2859
|
+
var _this34;
|
|
2812
2860
|
_classCallCheck(this, QuicklookViewer);
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
return
|
|
2861
|
+
_this34 = _super11.call(this);
|
|
2862
|
+
_this34.araction = null;
|
|
2863
|
+
_this34.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
|
|
2864
|
+
_this34.arcallback = function () {};
|
|
2865
|
+
return _this34;
|
|
2818
2866
|
}
|
|
2819
2867
|
_createClass(QuicklookViewer, [{
|
|
2820
2868
|
key: "nodeType",
|
|
@@ -2829,7 +2877,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2829
2877
|
}, {
|
|
2830
2878
|
key: "start",
|
|
2831
2879
|
value: function start() {
|
|
2832
|
-
var
|
|
2880
|
+
var _this35 = this;
|
|
2833
2881
|
if (!this.modelUrl) {
|
|
2834
2882
|
throw new Error("QuicklookViewer.start() - model url not set, use QuicklookViewer.modelUrl");
|
|
2835
2883
|
}
|
|
@@ -2841,7 +2889,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2841
2889
|
if (araction) {
|
|
2842
2890
|
var handleQuicklook = function handleQuicklook(event) {
|
|
2843
2891
|
if (event.data === "_apple_ar_quicklook_button_tapped") {
|
|
2844
|
-
|
|
2892
|
+
_this35.arcallback();
|
|
2845
2893
|
}
|
|
2846
2894
|
document.body.removeChild(anchor);
|
|
2847
2895
|
anchor.removeEventListener("message", handleQuicklook, false);
|
|
@@ -2927,14 +2975,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2927
2975
|
_inherits(SceneViewer, _ar_viewer_1$default3);
|
|
2928
2976
|
var _super13 = _createSuper(SceneViewer);
|
|
2929
2977
|
function SceneViewer() {
|
|
2930
|
-
var
|
|
2978
|
+
var _this36;
|
|
2931
2979
|
_classCallCheck(this, SceneViewer);
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
return
|
|
2980
|
+
_this36 = _super13.call(this);
|
|
2981
|
+
_this36.araction = null;
|
|
2982
|
+
_this36.isVertical = false;
|
|
2983
|
+
_this36.titleHTML = "<b>" + document.title;
|
|
2984
|
+
_this36.isVertical = false;
|
|
2985
|
+
return _this36;
|
|
2938
2986
|
}
|
|
2939
2987
|
_createClass(SceneViewer, [{
|
|
2940
2988
|
key: "nodeType",
|
|
@@ -3031,16 +3079,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3031
3079
|
*/
|
|
3032
3080
|
var Memory = /*#__PURE__*/function () {
|
|
3033
3081
|
function Memory(messengerInstance) {
|
|
3034
|
-
var
|
|
3082
|
+
var _this37 = this;
|
|
3035
3083
|
_classCallCheck(this, Memory);
|
|
3036
3084
|
this._messenger = messengerInstance;
|
|
3037
3085
|
this._tempMemory = new TemporaryMemory(messengerInstance);
|
|
3038
3086
|
this._permMemory = new PermanentMemory(messengerInstance);
|
|
3039
3087
|
this._messenger.self.__memory__set_temp_var = function (name, data) {
|
|
3040
|
-
|
|
3088
|
+
_this37._tempMemory[name] = data;
|
|
3041
3089
|
};
|
|
3042
3090
|
this._messenger.self.__memory__set_perm_var = function (name, data) {
|
|
3043
|
-
|
|
3091
|
+
_this37._permMemory[name] = data;
|
|
3044
3092
|
};
|
|
3045
3093
|
}
|
|
3046
3094
|
_createClass(Memory, [{
|
|
@@ -3487,17 +3535,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3487
3535
|
}, {
|
|
3488
3536
|
key: "exec",
|
|
3489
3537
|
value: function exec() {
|
|
3490
|
-
var
|
|
3538
|
+
var _this38 = this;
|
|
3491
3539
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
3492
3540
|
args[_key3] = arguments[_key3];
|
|
3493
3541
|
}
|
|
3494
3542
|
return new Promise(function (accept, reject) {
|
|
3495
|
-
if (!
|
|
3496
|
-
return reject(new Error("WrappedLocalFunction.exec() function with name " +
|
|
3543
|
+
if (!_this38._value) {
|
|
3544
|
+
return reject(new Error("WrappedLocalFunction.exec() function with name " + _this38._funcName + "() is not defined"));
|
|
3497
3545
|
}
|
|
3498
3546
|
try {
|
|
3499
3547
|
// otherwise execute the function
|
|
3500
|
-
var rObject =
|
|
3548
|
+
var rObject = _this38._execute.apply(_this38, args);
|
|
3501
3549
|
|
|
3502
3550
|
// we need to check if the returned object is a Promise, if so, handle it
|
|
3503
3551
|
// differently. This can happen if the function wants to execute asyn
|
|
@@ -3557,7 +3605,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3557
3605
|
*/
|
|
3558
3606
|
var GlobalEventHandler = /*#__PURE__*/function () {
|
|
3559
3607
|
function GlobalEventHandler() {
|
|
3560
|
-
var
|
|
3608
|
+
var _this39 = this;
|
|
3561
3609
|
_classCallCheck(this, GlobalEventHandler);
|
|
3562
3610
|
this._eventListeners = {};
|
|
3563
3611
|
|
|
@@ -3577,11 +3625,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3577
3625
|
// make sure the event is properly formatted
|
|
3578
3626
|
if (jsonData && jsonData.event && jsonData.data) {
|
|
3579
3627
|
// see if there are any listeners for this
|
|
3580
|
-
if (
|
|
3628
|
+
if (_this39._eventListeners[jsonData.event]) {
|
|
3581
3629
|
var remoteInterface = new RemoteInterface(evt.source, evt.origin);
|
|
3582
3630
|
|
|
3583
3631
|
// loop through and call all the event handlers
|
|
3584
|
-
|
|
3632
|
+
_this39._eventListeners[jsonData.event].forEach(function (callback) {
|
|
3585
3633
|
try {
|
|
3586
3634
|
callback(remoteInterface, jsonData.data);
|
|
3587
3635
|
} catch (e) {
|
|
@@ -3758,33 +3806,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3758
3806
|
}, {
|
|
3759
3807
|
key: "_registerListeners",
|
|
3760
3808
|
value: function _registerListeners() {
|
|
3761
|
-
var
|
|
3809
|
+
var _this40 = this;
|
|
3762
3810
|
GlobalEventHandler.instance().listen("__messenger__child_init", function (src, data) {
|
|
3763
3811
|
var iframeID = src.id;
|
|
3764
3812
|
|
|
3765
3813
|
// check reserved key list
|
|
3766
3814
|
switch (iframeID) {
|
|
3767
3815
|
case undefined:
|
|
3768
|
-
throw new Error("Messenger[" +
|
|
3816
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID cannot be undefined");
|
|
3769
3817
|
case "self":
|
|
3770
|
-
throw new Error("Messenger[" +
|
|
3818
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
3771
3819
|
case "parent":
|
|
3772
|
-
throw new Error("Messenger[" +
|
|
3820
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
3773
3821
|
case "id":
|
|
3774
|
-
throw new Error("Messenger[" +
|
|
3822
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
3775
3823
|
case "onload":
|
|
3776
|
-
throw new Error("Messenger[" +
|
|
3824
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
3777
3825
|
default:
|
|
3778
3826
|
break;
|
|
3779
3827
|
}
|
|
3780
3828
|
|
|
3781
3829
|
// initialise the child iframe as a messenger pipe
|
|
3782
|
-
|
|
3783
|
-
|
|
3830
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3831
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3784
3832
|
|
|
3785
3833
|
// add the interface to the broadcaster
|
|
3786
|
-
|
|
3787
|
-
var callbacks =
|
|
3834
|
+
_this40._broadcaster._push(iframeID);
|
|
3835
|
+
var callbacks = _this40._callbacks;
|
|
3788
3836
|
|
|
3789
3837
|
// we have registered callbacks, begin execution
|
|
3790
3838
|
if (callbacks.has(iframeID)) {
|
|
@@ -3808,26 +3856,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3808
3856
|
// check reserved key list
|
|
3809
3857
|
switch (iframeID) {
|
|
3810
3858
|
case undefined:
|
|
3811
|
-
throw new Error("Messenger[" +
|
|
3859
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID cannot be undefined");
|
|
3812
3860
|
case "self":
|
|
3813
|
-
throw new Error("Messenger[" +
|
|
3861
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
3814
3862
|
case "parent":
|
|
3815
|
-
throw new Error("Messenger[" +
|
|
3863
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
3816
3864
|
case "id":
|
|
3817
|
-
throw new Error("Messenger[" +
|
|
3865
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
3818
3866
|
case "onload":
|
|
3819
|
-
throw new Error("Messenger[" +
|
|
3867
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
3820
3868
|
default:
|
|
3821
3869
|
break;
|
|
3822
3870
|
}
|
|
3823
3871
|
|
|
3824
3872
|
// initialise the child iframe as a messenger pipe
|
|
3825
|
-
|
|
3826
|
-
|
|
3873
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3874
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3827
3875
|
|
|
3828
3876
|
// add the interface to the broadcaster
|
|
3829
|
-
|
|
3830
|
-
var callbacks =
|
|
3877
|
+
_this40._broadcaster._push(iframeID);
|
|
3878
|
+
var callbacks = _this40._callbacks;
|
|
3831
3879
|
|
|
3832
3880
|
// we have registered callbacks, begin execution
|
|
3833
3881
|
if (callbacks.has(iframeID)) {
|
|
@@ -3846,9 +3894,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3846
3894
|
});
|
|
3847
3895
|
GlobalEventHandler.instance().listen("__messenger__parent_init", function (src, data) {
|
|
3848
3896
|
var iframeID = "parent";
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
var callbacks =
|
|
3897
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3898
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3899
|
+
var callbacks = _this40._callbacks;
|
|
3852
3900
|
|
|
3853
3901
|
// we have registered callbacks, begin execution
|
|
3854
3902
|
if (callbacks.has(iframeID)) {
|
|
@@ -3872,9 +3920,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3872
3920
|
*/
|
|
3873
3921
|
GlobalEventHandler.instance().listen("__messenger__parent_init_inv", function (src, data) {
|
|
3874
3922
|
var iframeID = "parent";
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
var callbacks =
|
|
3923
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3924
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3925
|
+
var callbacks = _this40._callbacks;
|
|
3878
3926
|
|
|
3879
3927
|
// we have registered callbacks, begin execution
|
|
3880
3928
|
if (callbacks.has(iframeID)) {
|
|
@@ -4093,7 +4141,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4093
4141
|
*/
|
|
4094
4142
|
var WrappedRemoteFunction = /*#__PURE__*/function () {
|
|
4095
4143
|
function WrappedRemoteFunction(funcName, remoteInterface) {
|
|
4096
|
-
var
|
|
4144
|
+
var _this41 = this;
|
|
4097
4145
|
_classCallCheck(this, WrappedRemoteFunction);
|
|
4098
4146
|
this._funcName = funcName;
|
|
4099
4147
|
this._remoteInterface = remoteInterface;
|
|
@@ -4104,19 +4152,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4104
4152
|
var instanceID = data.instance_id;
|
|
4105
4153
|
|
|
4106
4154
|
// the function name must match
|
|
4107
|
-
if (data.function_name !==
|
|
4155
|
+
if (data.function_name !== _this41._funcName) {
|
|
4108
4156
|
return;
|
|
4109
4157
|
}
|
|
4110
4158
|
|
|
4111
4159
|
// the instance ID must be found, otherwise this is a rogue execution
|
|
4112
4160
|
// that can be ignored (should not happen)
|
|
4113
|
-
if (!
|
|
4161
|
+
if (!_this41._callInstances[instanceID]) {
|
|
4114
4162
|
return;
|
|
4115
4163
|
}
|
|
4116
|
-
var promise =
|
|
4164
|
+
var promise = _this41._callInstances[instanceID];
|
|
4117
4165
|
|
|
4118
4166
|
// remove the old instance
|
|
4119
|
-
delete
|
|
4167
|
+
delete _this41._callInstances[instanceID];
|
|
4120
4168
|
|
|
4121
4169
|
// perform the promise callbacks
|
|
4122
4170
|
if (data.function_status === "success") {
|
|
@@ -4133,7 +4181,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4133
4181
|
_createClass(WrappedRemoteFunction, [{
|
|
4134
4182
|
key: "exec",
|
|
4135
4183
|
value: function exec() {
|
|
4136
|
-
var
|
|
4184
|
+
var _this42 = this;
|
|
4137
4185
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
4138
4186
|
args[_key4] = arguments[_key4];
|
|
4139
4187
|
}
|
|
@@ -4152,15 +4200,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4152
4200
|
// to be executed later
|
|
4153
4201
|
return new Promise(function (accept, reject) {
|
|
4154
4202
|
// save this promise to be executed later
|
|
4155
|
-
|
|
4203
|
+
_this42._callInstances[instanceID] = {
|
|
4156
4204
|
accept: accept,
|
|
4157
4205
|
reject: reject
|
|
4158
4206
|
};
|
|
4159
4207
|
|
|
4160
4208
|
// execute this event in another context
|
|
4161
|
-
|
|
4209
|
+
_this42._remoteInterface.send("__messenger__exec_fnc", {
|
|
4162
4210
|
instance_id: instanceID,
|
|
4163
|
-
function_name:
|
|
4211
|
+
function_name: _this42._funcName,
|
|
4164
4212
|
function_args: args
|
|
4165
4213
|
});
|
|
4166
4214
|
});
|
|
@@ -4293,7 +4341,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4293
4341
|
var google_analytics_1 = require("./google/google-analytics");
|
|
4294
4342
|
var Analytics = /*#__PURE__*/function () {
|
|
4295
4343
|
function Analytics(applicationID) {
|
|
4296
|
-
var
|
|
4344
|
+
var _this43 = this;
|
|
4297
4345
|
_classCallCheck(this, Analytics);
|
|
4298
4346
|
this._pageTime = null;
|
|
4299
4347
|
this.origin = "production";
|
|
@@ -4307,17 +4355,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4307
4355
|
this._ga = new google_analytics_1.GoogleAnalytics();
|
|
4308
4356
|
this._handlePageHide = function () {
|
|
4309
4357
|
if (document.visibilityState === "hidden") {
|
|
4310
|
-
|
|
4311
|
-
} else if (
|
|
4358
|
+
_this43._pageTime = new Date();
|
|
4359
|
+
} else if (_this43._pageTime) {
|
|
4312
4360
|
var time2 = new Date();
|
|
4313
|
-
var diff = time2.getTime() -
|
|
4314
|
-
var data =
|
|
4361
|
+
var diff = time2.getTime() - _this43._pageTime.getTime();
|
|
4362
|
+
var data = _this43.data;
|
|
4315
4363
|
data.push("eventAction", "View Time");
|
|
4316
4364
|
data.push("viewTime", diff);
|
|
4317
4365
|
data.push("eventLabel", diff);
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
document.removeEventListener("visibilitychange",
|
|
4366
|
+
_this43.write();
|
|
4367
|
+
_this43._pageTime = null;
|
|
4368
|
+
document.removeEventListener("visibilitychange", _this43._handlePageHide, false);
|
|
4321
4369
|
}
|
|
4322
4370
|
};
|
|
4323
4371
|
}
|
|
@@ -4329,17 +4377,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4329
4377
|
}, {
|
|
4330
4378
|
key: "query",
|
|
4331
4379
|
value: function query() {
|
|
4332
|
-
var
|
|
4380
|
+
var _this44 = this;
|
|
4333
4381
|
var _query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
4334
4382
|
return new Promise(function (accept, reject) {
|
|
4335
4383
|
if (!_query) {
|
|
4336
4384
|
return reject(new Error("Analytics.query() - provided query was null"));
|
|
4337
4385
|
}
|
|
4338
|
-
var url =
|
|
4386
|
+
var url = _this44.origin === "dev" ? "http://localhost:9000/2015-03-31/functions/function/invocations" : "https://oyywgrj9ki.execute-api.ap-southeast-2.amazonaws.com/main/analytics";
|
|
4339
4387
|
var data = {
|
|
4340
4388
|
type: "read",
|
|
4341
|
-
application_id:
|
|
4342
|
-
event:
|
|
4389
|
+
application_id: _this44._applicationID,
|
|
4390
|
+
event: _this44.event,
|
|
4343
4391
|
data: _query
|
|
4344
4392
|
};
|
|
4345
4393
|
basic_http_1["default"].exec("POST", url, data).then(function (result) {
|
|
@@ -4350,19 +4398,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4350
4398
|
}, {
|
|
4351
4399
|
key: "write",
|
|
4352
4400
|
value: function write() {
|
|
4353
|
-
var
|
|
4401
|
+
var _this45 = this;
|
|
4354
4402
|
return new Promise(function (accept, reject) {
|
|
4355
|
-
var data =
|
|
4356
|
-
var url =
|
|
4357
|
-
data.push("applicationId",
|
|
4403
|
+
var data = _this45._data;
|
|
4404
|
+
var url = _this45.origin === "dev" ? "http://localhost:9000/2015-03-31/functions/function/invocations" : "https://oyywgrj9ki.execute-api.ap-southeast-2.amazonaws.com/main/analytics";
|
|
4405
|
+
data.push("applicationId", _this45._applicationID);
|
|
4358
4406
|
var sendData = {
|
|
4359
4407
|
type: "write",
|
|
4360
|
-
application_id:
|
|
4361
|
-
origin:
|
|
4362
|
-
event:
|
|
4408
|
+
application_id: _this45._applicationID,
|
|
4409
|
+
origin: _this45.origin,
|
|
4410
|
+
event: _this45.event,
|
|
4363
4411
|
data: data.data
|
|
4364
4412
|
};
|
|
4365
|
-
if (
|
|
4413
|
+
if (_this45.isBeacon === false) {
|
|
4366
4414
|
basic_http_1["default"].exec("POST", url, sendData).then(function (result) {
|
|
4367
4415
|
accept(result && result.results ? result.results : {});
|
|
4368
4416
|
})["catch"](reject);
|
|
@@ -4371,7 +4419,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4371
4419
|
accept(result && result.results ? result.results : {});
|
|
4372
4420
|
})["catch"](reject);
|
|
4373
4421
|
}
|
|
4374
|
-
|
|
4422
|
+
_this45.googleAnalytics.write(_this45.event, _this45.data);
|
|
4375
4423
|
});
|
|
4376
4424
|
}
|
|
4377
4425
|
}, {
|
|
@@ -4925,10 +4973,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4925
4973
|
}, {
|
|
4926
4974
|
key: "_get",
|
|
4927
4975
|
value: function _get(opt) {
|
|
4928
|
-
var
|
|
4976
|
+
var _this46 = this;
|
|
4929
4977
|
return new Promise(function (resolve, reject) {
|
|
4930
|
-
var target =
|
|
4931
|
-
var server =
|
|
4978
|
+
var target = _this46.target;
|
|
4979
|
+
var server = _this46.server;
|
|
4932
4980
|
|
|
4933
4981
|
// we cannot perform a GET request without an ID
|
|
4934
4982
|
if (!target.id) {
|
|
@@ -4953,15 +5001,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4953
5001
|
var origin = server.originLocation.api_read;
|
|
4954
5002
|
var auth = server.authToken;
|
|
4955
5003
|
var headers = {
|
|
4956
|
-
'cookie': 'laravel_session=' +
|
|
5004
|
+
'cookie': 'laravel_session=' + _this46.getCookie('laravel_session')
|
|
4957
5005
|
};
|
|
4958
5006
|
Object.assign(headers, auth);
|
|
4959
5007
|
var reqopts = {
|
|
4960
5008
|
method: "GET",
|
|
4961
5009
|
headers: headers
|
|
4962
5010
|
};
|
|
4963
|
-
var includeQuery =
|
|
4964
|
-
var params =
|
|
5011
|
+
var includeQuery = _this46._IncludeQuery;
|
|
5012
|
+
var params = _this46._ParamFor("get");
|
|
4965
5013
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
4966
5014
|
if (includeQuery) {
|
|
4967
5015
|
endpoint = endpoint + "?include=" + includeQuery;
|
|
@@ -4996,10 +5044,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4996
5044
|
}, {
|
|
4997
5045
|
key: "_update",
|
|
4998
5046
|
value: function _update() {
|
|
4999
|
-
var
|
|
5047
|
+
var _this47 = this;
|
|
5000
5048
|
return new Promise(function (resolve, reject) {
|
|
5001
|
-
var target =
|
|
5002
|
-
var server =
|
|
5049
|
+
var target = _this47.target;
|
|
5050
|
+
var server = _this47.server;
|
|
5003
5051
|
|
|
5004
5052
|
// we cannot perform a GET request without an ID
|
|
5005
5053
|
if (!target.id) {
|
|
@@ -5013,7 +5061,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5013
5061
|
var headers = {
|
|
5014
5062
|
'Accept': 'application/json',
|
|
5015
5063
|
'Content-Type': 'application/json',
|
|
5016
|
-
'cookie': 'laravel_session=' +
|
|
5064
|
+
'cookie': 'laravel_session=' + _this47.getCookie('laravel_session')
|
|
5017
5065
|
};
|
|
5018
5066
|
Object.assign(headers, auth);
|
|
5019
5067
|
var reqopts = {
|
|
@@ -5027,7 +5075,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5027
5075
|
meta: target.meta || {}
|
|
5028
5076
|
})
|
|
5029
5077
|
};
|
|
5030
|
-
var params =
|
|
5078
|
+
var params = _this47._ParamFor("update");
|
|
5031
5079
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
5032
5080
|
if (params) {
|
|
5033
5081
|
var appender = "?";
|
|
@@ -5063,10 +5111,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5063
5111
|
}, {
|
|
5064
5112
|
key: "_create",
|
|
5065
5113
|
value: function _create() {
|
|
5066
|
-
var
|
|
5114
|
+
var _this48 = this;
|
|
5067
5115
|
return new Promise(function (resolve, reject) {
|
|
5068
|
-
var target =
|
|
5069
|
-
var server =
|
|
5116
|
+
var target = _this48.target;
|
|
5117
|
+
var server = _this48.server;
|
|
5070
5118
|
|
|
5071
5119
|
// otherwise, proceed with the fetching op
|
|
5072
5120
|
var origin = server.originLocation.api_write;
|
|
@@ -5074,7 +5122,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5074
5122
|
var headers = {
|
|
5075
5123
|
'Accept': 'application/json',
|
|
5076
5124
|
'Content-Type': 'application/json',
|
|
5077
|
-
'cookie': 'laravel_session=' +
|
|
5125
|
+
'cookie': 'laravel_session=' + _this48.getCookie('laravel_session')
|
|
5078
5126
|
};
|
|
5079
5127
|
Object.assign(headers, auth);
|
|
5080
5128
|
var reqopts = {
|
|
@@ -5087,7 +5135,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5087
5135
|
meta: target.meta || {}
|
|
5088
5136
|
})
|
|
5089
5137
|
};
|
|
5090
|
-
var params =
|
|
5138
|
+
var params = _this48._ParamFor("create");
|
|
5091
5139
|
var endpoint = origin + target.type();
|
|
5092
5140
|
if (params) {
|
|
5093
5141
|
var appender = "?";
|
|
@@ -5124,10 +5172,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5124
5172
|
}, {
|
|
5125
5173
|
key: "_delete",
|
|
5126
5174
|
value: function _delete() {
|
|
5127
|
-
var
|
|
5175
|
+
var _this49 = this;
|
|
5128
5176
|
return new Promise(function (resolve, reject) {
|
|
5129
|
-
var target =
|
|
5130
|
-
var server =
|
|
5177
|
+
var target = _this49.target;
|
|
5178
|
+
var server = _this49.server;
|
|
5131
5179
|
|
|
5132
5180
|
// we cannot perform a GET request without an ID
|
|
5133
5181
|
if (!target.id) {
|
|
@@ -5141,7 +5189,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5141
5189
|
var headers = {
|
|
5142
5190
|
'Accept': 'application/json',
|
|
5143
5191
|
'Content-Type': 'application/json',
|
|
5144
|
-
'cookie': 'laravel_session=' +
|
|
5192
|
+
'cookie': 'laravel_session=' + _this49.getCookie('laravel_session')
|
|
5145
5193
|
};
|
|
5146
5194
|
Object.assign(headers, auth);
|
|
5147
5195
|
var reqopts = {
|
|
@@ -5155,7 +5203,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5155
5203
|
meta: target.meta || {}
|
|
5156
5204
|
})
|
|
5157
5205
|
};
|
|
5158
|
-
var params =
|
|
5206
|
+
var params = _this49._ParamFor("delete");
|
|
5159
5207
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
5160
5208
|
if (params) {
|
|
5161
5209
|
var appender = "?";
|
|
@@ -5210,7 +5258,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5210
5258
|
}, {
|
|
5211
5259
|
key: "_include",
|
|
5212
5260
|
value: function _include(args) {
|
|
5213
|
-
var
|
|
5261
|
+
var _this50 = this;
|
|
5214
5262
|
if (!args || args.length <= 0) {
|
|
5215
5263
|
return this;
|
|
5216
5264
|
}
|
|
@@ -5220,20 +5268,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5220
5268
|
if (Array.isArray(obj)) {
|
|
5221
5269
|
obj.forEach(function (strObject) {
|
|
5222
5270
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
5223
|
-
|
|
5271
|
+
_this50._getIncludeQuery.push(strObject);
|
|
5224
5272
|
} else {
|
|
5225
|
-
throw new Error("PlattarQuery." +
|
|
5273
|
+
throw new Error("PlattarQuery." + _this50.target.type() + ".include(...args) - argument of Array must only include Strings");
|
|
5226
5274
|
}
|
|
5227
5275
|
});
|
|
5228
5276
|
} else if (PlattarUtil.isPlattarObject(obj)) {
|
|
5229
5277
|
var type = obj.type();
|
|
5230
5278
|
if (Array.isArray(type)) {
|
|
5231
|
-
|
|
5279
|
+
_this50._include(type);
|
|
5232
5280
|
} else {
|
|
5233
|
-
|
|
5281
|
+
_this50._getIncludeQuery.push(type);
|
|
5234
5282
|
}
|
|
5235
5283
|
} else {
|
|
5236
|
-
throw new Error("PlattarQuery." +
|
|
5284
|
+
throw new Error("PlattarQuery." + _this50.target.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
|
|
5237
5285
|
}
|
|
5238
5286
|
});
|
|
5239
5287
|
return this;
|
|
@@ -5358,12 +5406,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5358
5406
|
}, {
|
|
5359
5407
|
key: "auth",
|
|
5360
5408
|
value: function auth(token, opt) {
|
|
5361
|
-
var
|
|
5409
|
+
var _this51 = this;
|
|
5362
5410
|
var copt = opt || {
|
|
5363
5411
|
validate: false
|
|
5364
5412
|
};
|
|
5365
5413
|
return new Promise(function (resolve, reject) {
|
|
5366
|
-
var server =
|
|
5414
|
+
var server = _this51.originLocation.api_write;
|
|
5367
5415
|
if (!server) {
|
|
5368
5416
|
reject(new Error("Plattar.auth(token) - cannot authenticate as server not set via Plattar.origin(server)"));
|
|
5369
5417
|
return;
|
|
@@ -5373,10 +5421,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5373
5421
|
return;
|
|
5374
5422
|
}
|
|
5375
5423
|
if (!copt.validate) {
|
|
5376
|
-
|
|
5424
|
+
_this51._authToken = {
|
|
5377
5425
|
"plattar-auth-token": token
|
|
5378
5426
|
};
|
|
5379
|
-
resolve(
|
|
5427
|
+
resolve(_this51);
|
|
5380
5428
|
return;
|
|
5381
5429
|
}
|
|
5382
5430
|
var endpoint = server + "plattaruser/xauth/validate";
|
|
@@ -5388,10 +5436,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5388
5436
|
};
|
|
5389
5437
|
fetch(endpoint, options).then(function (res) {
|
|
5390
5438
|
if (res.ok) {
|
|
5391
|
-
|
|
5439
|
+
_this51._authToken = {
|
|
5392
5440
|
"plattar-auth-token": token
|
|
5393
5441
|
};
|
|
5394
|
-
resolve(
|
|
5442
|
+
resolve(_this51);
|
|
5395
5443
|
} else {
|
|
5396
5444
|
reject(new Error("Plattar.auth(token) - failed to validate authentication token at " + endpoint));
|
|
5397
5445
|
}
|
|
@@ -5401,7 +5449,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5401
5449
|
}, {
|
|
5402
5450
|
key: "origin",
|
|
5403
5451
|
value: function origin(server, opt) {
|
|
5404
|
-
var
|
|
5452
|
+
var _this52 = this;
|
|
5405
5453
|
var copt = opt || {
|
|
5406
5454
|
validate: false
|
|
5407
5455
|
};
|
|
@@ -5411,8 +5459,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5411
5459
|
return;
|
|
5412
5460
|
}
|
|
5413
5461
|
if (!copt.validate) {
|
|
5414
|
-
|
|
5415
|
-
resolve(
|
|
5462
|
+
_this52._serverLocation = server;
|
|
5463
|
+
resolve(_this52);
|
|
5416
5464
|
return;
|
|
5417
5465
|
}
|
|
5418
5466
|
var endpoint = server.api_read + "ping";
|
|
@@ -5421,8 +5469,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5421
5469
|
};
|
|
5422
5470
|
fetch(endpoint, options).then(function (res) {
|
|
5423
5471
|
if (res.ok) {
|
|
5424
|
-
|
|
5425
|
-
resolve(
|
|
5472
|
+
_this52._serverLocation = server;
|
|
5473
|
+
resolve(_this52);
|
|
5426
5474
|
} else {
|
|
5427
5475
|
reject(new Error("Plattar.origin(server) - failed to ping server at " + endpoint));
|
|
5428
5476
|
}
|
|
@@ -5744,13 +5792,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5744
5792
|
_inherits(FileBase, _PlattarBase11);
|
|
5745
5793
|
var _super25 = _createSuper(FileBase);
|
|
5746
5794
|
function FileBase(id, server) {
|
|
5747
|
-
var
|
|
5795
|
+
var _this53;
|
|
5748
5796
|
_classCallCheck(this, FileBase);
|
|
5749
|
-
|
|
5750
|
-
if (
|
|
5797
|
+
_this53 = _super25.call(this, id, server || Server["default"]());
|
|
5798
|
+
if (_this53.constructor === FileBase) {
|
|
5751
5799
|
throw new Error("FileBase is abstract and cannot be created");
|
|
5752
5800
|
}
|
|
5753
|
-
return
|
|
5801
|
+
return _this53;
|
|
5754
5802
|
}
|
|
5755
5803
|
_createClass(FileBase, [{
|
|
5756
5804
|
key: "sourcePath",
|
|
@@ -5903,13 +5951,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5903
5951
|
_inherits(PlattarBase, _PlattarObject);
|
|
5904
5952
|
var _super30 = _createSuper(PlattarBase);
|
|
5905
5953
|
function PlattarBase(id, server) {
|
|
5906
|
-
var
|
|
5954
|
+
var _this54;
|
|
5907
5955
|
_classCallCheck(this, PlattarBase);
|
|
5908
|
-
|
|
5909
|
-
if (
|
|
5956
|
+
_this54 = _super30.call(this, id, server || Server["default"]());
|
|
5957
|
+
if (_this54.constructor === PlattarBase) {
|
|
5910
5958
|
throw new Error("PlattarBase is abstract and cannot be created");
|
|
5911
5959
|
}
|
|
5912
|
-
return
|
|
5960
|
+
return _this54;
|
|
5913
5961
|
}
|
|
5914
5962
|
return _createClass(PlattarBase);
|
|
5915
5963
|
}(PlattarObject);
|
|
@@ -5976,7 +6024,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5976
6024
|
}, {
|
|
5977
6025
|
key: "filter",
|
|
5978
6026
|
value: function filter(obj, id) {
|
|
5979
|
-
var
|
|
6027
|
+
var _this55 = this;
|
|
5980
6028
|
if (!obj) {
|
|
5981
6029
|
return [];
|
|
5982
6030
|
}
|
|
@@ -5992,7 +6040,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5992
6040
|
if (Array.isArray(type)) {
|
|
5993
6041
|
var compiledList = [];
|
|
5994
6042
|
type.forEach(function (inObject) {
|
|
5995
|
-
var retArray =
|
|
6043
|
+
var retArray = _this55.filter(inObject, id);
|
|
5996
6044
|
if (retArray.length > 0) {
|
|
5997
6045
|
compiledList = compiledList.concat(retArray);
|
|
5998
6046
|
}
|
|
@@ -6180,7 +6228,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6180
6228
|
}, {
|
|
6181
6229
|
key: "include",
|
|
6182
6230
|
value: function include() {
|
|
6183
|
-
var
|
|
6231
|
+
var _this56 = this;
|
|
6184
6232
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
6185
6233
|
args[_key6] = arguments[_key6];
|
|
6186
6234
|
}
|
|
@@ -6193,15 +6241,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6193
6241
|
if (Array.isArray(obj)) {
|
|
6194
6242
|
obj.forEach(function (strObject) {
|
|
6195
6243
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
6196
|
-
includes.push("".concat(
|
|
6244
|
+
includes.push("".concat(_this56.type(), ".").concat(strObject));
|
|
6197
6245
|
} else {
|
|
6198
|
-
throw new Error("PlattarObject." +
|
|
6246
|
+
throw new Error("PlattarObject." + _this56.type() + ".include(...args) - argument of Array must only include Strings");
|
|
6199
6247
|
}
|
|
6200
6248
|
});
|
|
6201
6249
|
} else if (obj.prototype instanceof PlattarObject) {
|
|
6202
|
-
includes.push("".concat(
|
|
6250
|
+
includes.push("".concat(_this56.type(), ".").concat(obj.type()));
|
|
6203
6251
|
} else {
|
|
6204
|
-
throw new Error("PlattarObject." +
|
|
6252
|
+
throw new Error("PlattarObject." + _this56.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
|
|
6205
6253
|
}
|
|
6206
6254
|
});
|
|
6207
6255
|
return includes;
|
|
@@ -6331,13 +6379,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6331
6379
|
_inherits(CardBase, _PlattarBase17);
|
|
6332
6380
|
var _super36 = _createSuper(CardBase);
|
|
6333
6381
|
function CardBase(id, server) {
|
|
6334
|
-
var
|
|
6382
|
+
var _this57;
|
|
6335
6383
|
_classCallCheck(this, CardBase);
|
|
6336
|
-
|
|
6337
|
-
if (
|
|
6384
|
+
_this57 = _super36.call(this, id, server || Server["default"]());
|
|
6385
|
+
if (_this57.constructor === CardBase) {
|
|
6338
6386
|
throw new Error("CardBase is abstract and cannot be created");
|
|
6339
6387
|
}
|
|
6340
|
-
return
|
|
6388
|
+
return _this57;
|
|
6341
6389
|
}
|
|
6342
6390
|
_createClass(CardBase, null, [{
|
|
6343
6391
|
key: "type",
|
|
@@ -6654,13 +6702,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6654
6702
|
_inherits(ProductBase, _PlattarBase19);
|
|
6655
6703
|
var _super50 = _createSuper(ProductBase);
|
|
6656
6704
|
function ProductBase(id, server) {
|
|
6657
|
-
var
|
|
6705
|
+
var _this58;
|
|
6658
6706
|
_classCallCheck(this, ProductBase);
|
|
6659
|
-
|
|
6660
|
-
if (
|
|
6707
|
+
_this58 = _super50.call(this, id, server || Server["default"]());
|
|
6708
|
+
if (_this58.constructor === ProductBase) {
|
|
6661
6709
|
throw new Error("ProductBase is abstract and cannot be created");
|
|
6662
6710
|
}
|
|
6663
|
-
return
|
|
6711
|
+
return _this58;
|
|
6664
6712
|
}
|
|
6665
6713
|
_createClass(ProductBase, null, [{
|
|
6666
6714
|
key: "type",
|
|
@@ -6770,13 +6818,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6770
6818
|
_inherits(SceneBase, _PlattarBase21);
|
|
6771
6819
|
var _super55 = _createSuper(SceneBase);
|
|
6772
6820
|
function SceneBase(id, server) {
|
|
6773
|
-
var
|
|
6821
|
+
var _this59;
|
|
6774
6822
|
_classCallCheck(this, SceneBase);
|
|
6775
|
-
|
|
6776
|
-
if (
|
|
6823
|
+
_this59 = _super55.call(this, id, server || Server["default"]());
|
|
6824
|
+
if (_this59.constructor === SceneBase) {
|
|
6777
6825
|
throw new Error("SceneBase is abstract and cannot be created");
|
|
6778
6826
|
}
|
|
6779
|
-
return
|
|
6827
|
+
return _this59;
|
|
6780
6828
|
}
|
|
6781
6829
|
_createClass(SceneBase, null, [{
|
|
6782
6830
|
key: "type",
|
|
@@ -7478,15 +7526,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7478
7526
|
_createClass(BaseElement, [{
|
|
7479
7527
|
key: "connectedCallback",
|
|
7480
7528
|
value: function connectedCallback() {
|
|
7481
|
-
var
|
|
7529
|
+
var _this60 = this;
|
|
7482
7530
|
if (this.hasAttribute("url")) {
|
|
7483
7531
|
this.renderQRCode();
|
|
7484
7532
|
}
|
|
7485
7533
|
var observer = new MutationObserver(function (mutations) {
|
|
7486
7534
|
mutations.forEach(function (mutation) {
|
|
7487
7535
|
if (mutation.type === "attributes") {
|
|
7488
|
-
if (
|
|
7489
|
-
|
|
7536
|
+
if (_this60.hasAttribute("url")) {
|
|
7537
|
+
_this60.renderQRCode();
|
|
7490
7538
|
}
|
|
7491
7539
|
}
|
|
7492
7540
|
});
|
|
@@ -7509,7 +7557,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7509
7557
|
}, {
|
|
7510
7558
|
key: "renderQRCode",
|
|
7511
7559
|
value: function renderQRCode() {
|
|
7512
|
-
var
|
|
7560
|
+
var _this61 = this;
|
|
7513
7561
|
var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
7514
7562
|
if (!url) {
|
|
7515
7563
|
console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
|
|
@@ -7613,11 +7661,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7613
7661
|
var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
|
|
7614
7662
|
if (shortenURL && shortenURL.toLowerCase() === "true") {
|
|
7615
7663
|
this._ShortenURL(url).then(function (newURL) {
|
|
7616
|
-
|
|
7664
|
+
_this61._GenerateQRCode(newURL, width, height);
|
|
7617
7665
|
})["catch"](function (_err) {
|
|
7618
7666
|
console.warn(_err);
|
|
7619
7667
|
// ignore error and just generate normal QR Code
|
|
7620
|
-
|
|
7668
|
+
_this61._GenerateQRCode(url, width, height);
|
|
7621
7669
|
});
|
|
7622
7670
|
} else {
|
|
7623
7671
|
this._GenerateQRCode(url, width, height);
|
|
@@ -7668,9 +7716,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7668
7716
|
}, {
|
|
7669
7717
|
key: "_ShortenURL",
|
|
7670
7718
|
value: function _ShortenURL(url) {
|
|
7671
|
-
var
|
|
7719
|
+
var _this62 = this;
|
|
7672
7720
|
return new Promise(function (accept, reject) {
|
|
7673
|
-
if (!
|
|
7721
|
+
if (!_this62._IsFetchAPISupported()) {
|
|
7674
7722
|
return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
|
|
7675
7723
|
}
|
|
7676
7724
|
try {
|
|
@@ -7849,10 +7897,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7849
7897
|
}, {
|
|
7850
7898
|
key: "get",
|
|
7851
7899
|
value: function get() {
|
|
7852
|
-
var
|
|
7900
|
+
var _this63 = this;
|
|
7853
7901
|
return new Promise(function (accept, reject) {
|
|
7854
|
-
|
|
7855
|
-
remote_request_1.RemoteRequest.request(
|
|
7902
|
+
_this63._CalculateHash().then(function () {
|
|
7903
|
+
remote_request_1.RemoteRequest.request(_this63._GetPayload(), _this63.retry < 0 ? 0 : _this63.retry).then(accept)["catch"](reject);
|
|
7856
7904
|
})["catch"](function (_err) {
|
|
7857
7905
|
reject(new Error("Configurator.get() - one of the objects does not exist in Plattar API"));
|
|
7858
7906
|
});
|
|
@@ -7861,12 +7909,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7861
7909
|
}, {
|
|
7862
7910
|
key: "_CalculateHash",
|
|
7863
7911
|
value: function _CalculateHash() {
|
|
7864
|
-
var
|
|
7912
|
+
var _this64 = this;
|
|
7865
7913
|
return new Promise(function (accept, reject) {
|
|
7866
7914
|
var promises = [];
|
|
7867
7915
|
var oldOrigin = plattar_api_1.Server["default"]().originLocation.type;
|
|
7868
|
-
plattar_api_1.Server.create(plattar_api_1.Server.match(
|
|
7869
|
-
|
|
7916
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(_this64.server));
|
|
7917
|
+
_this64._maps.forEach(function (map) {
|
|
7870
7918
|
if (map.productvariation) {
|
|
7871
7919
|
promises.push(new plattar_api_1.ProductVariation(map.productvariation).get());
|
|
7872
7920
|
}
|
|
@@ -7882,7 +7930,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7882
7930
|
});
|
|
7883
7931
|
Promise.all(promises).then(function (values) {
|
|
7884
7932
|
values.forEach(function (value) {
|
|
7885
|
-
|
|
7933
|
+
_this64._attrHash.push(value.attributes);
|
|
7886
7934
|
});
|
|
7887
7935
|
// reset server back
|
|
7888
7936
|
plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
|
|
@@ -7969,12 +8017,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7969
8017
|
}, {
|
|
7970
8018
|
key: "get",
|
|
7971
8019
|
value: function get() {
|
|
7972
|
-
var
|
|
8020
|
+
var _this65 = this;
|
|
7973
8021
|
return new Promise(function (accept, reject) {
|
|
7974
|
-
if (!
|
|
8022
|
+
if (!_this65._model) {
|
|
7975
8023
|
return reject(new Error("ModelConverter.get() - required .model attribute was not set"));
|
|
7976
8024
|
}
|
|
7977
|
-
remote_request_1.RemoteRequest.request(
|
|
8025
|
+
remote_request_1.RemoteRequest.request(_this65._Payload, _this65.retry < 0 ? 0 : _this65.retry).then(accept)["catch"](reject);
|
|
7978
8026
|
});
|
|
7979
8027
|
}
|
|
7980
8028
|
}, {
|
|
@@ -8264,18 +8312,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8264
8312
|
}, {
|
|
8265
8313
|
key: "allMappedAttributes",
|
|
8266
8314
|
get: function get() {
|
|
8267
|
-
var
|
|
8315
|
+
var _this66 = this;
|
|
8268
8316
|
var map = new Map();
|
|
8269
8317
|
var coreAttr = this.coreAttributes;
|
|
8270
8318
|
var optAttr = this.optionalAttributes;
|
|
8271
8319
|
coreAttr.forEach(function (ele) {
|
|
8272
|
-
if (
|
|
8273
|
-
map.set(ele.map,
|
|
8320
|
+
if (_this66.hasAttribute(ele.key)) {
|
|
8321
|
+
map.set(ele.map, _this66.getAttribute(ele.key));
|
|
8274
8322
|
}
|
|
8275
8323
|
});
|
|
8276
8324
|
optAttr.forEach(function (ele) {
|
|
8277
|
-
if (
|
|
8278
|
-
map.set(ele.map,
|
|
8325
|
+
if (_this66.hasAttribute(ele.key)) {
|
|
8326
|
+
map.set(ele.map, _this66.getAttribute(ele.key));
|
|
8279
8327
|
}
|
|
8280
8328
|
});
|
|
8281
8329
|
return map;
|
|
@@ -8374,7 +8422,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8374
8422
|
var IFrameController = require("./iframe-controller.js");
|
|
8375
8423
|
var ElementController = /*#__PURE__*/function () {
|
|
8376
8424
|
function ElementController(element) {
|
|
8377
|
-
var
|
|
8425
|
+
var _this67 = this;
|
|
8378
8426
|
_classCallCheck(this, ElementController);
|
|
8379
8427
|
this._element = element;
|
|
8380
8428
|
|
|
@@ -8387,7 +8435,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8387
8435
|
var mutation = _step8.value;
|
|
8388
8436
|
if (mutation.type === 'attributes' && element.usesCoreAttribute(mutation.attributeName)) {
|
|
8389
8437
|
if (element.hasAllCoreAttributes) {
|
|
8390
|
-
|
|
8438
|
+
_this67._load();
|
|
8391
8439
|
}
|
|
8392
8440
|
}
|
|
8393
8441
|
}
|
|
@@ -8482,7 +8530,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8482
8530
|
var Util = require("../../util/util.js");
|
|
8483
8531
|
var IFrameController = /*#__PURE__*/function () {
|
|
8484
8532
|
function IFrameController(element, src, id) {
|
|
8485
|
-
var
|
|
8533
|
+
var _this68 = this;
|
|
8486
8534
|
var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
8487
8535
|
_classCallCheck(this, IFrameController);
|
|
8488
8536
|
this._iframe = document.createElement("iframe");
|
|
@@ -8492,7 +8540,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8492
8540
|
if (!element.hasAttribute("sameorigin")) {
|
|
8493
8541
|
this._iframe.onload = function () {
|
|
8494
8542
|
if (onelemload) {
|
|
8495
|
-
onelemload(
|
|
8543
|
+
onelemload(_this68._iframe);
|
|
8496
8544
|
}
|
|
8497
8545
|
};
|
|
8498
8546
|
}
|
|
@@ -8609,13 +8657,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8609
8657
|
_inherits(EWallElement, _BaseElement4);
|
|
8610
8658
|
var _super76 = _createSuper(EWallElement);
|
|
8611
8659
|
function EWallElement() {
|
|
8612
|
-
var
|
|
8660
|
+
var _this69;
|
|
8613
8661
|
_classCallCheck(this, EWallElement);
|
|
8614
|
-
|
|
8662
|
+
_this69 = _super76.call(this);
|
|
8615
8663
|
var tag = document.createElement("script");
|
|
8616
8664
|
tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
|
|
8617
8665
|
tag.defer = true;
|
|
8618
|
-
return
|
|
8666
|
+
return _this69;
|
|
8619
8667
|
}
|
|
8620
8668
|
_createClass(EWallElement, [{
|
|
8621
8669
|
key: "connectedCallback",
|