@plattar/plattar-ar-adapter 1.139.1 → 1.140.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es2015/plattar-ar-adapter.js +455 -405
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +83 -48
- 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/util/util.d.ts +6 -1
- package/dist/util/util.js +29 -42
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -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
|
/**
|
|
@@ -2682,63 +2730,65 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2682
2730
|
_createClass(Util, null, [{
|
|
2683
2731
|
key: "canAugment",
|
|
2684
2732
|
value: function canAugment() {
|
|
2685
|
-
|
|
2686
|
-
// test google chrome on IOS and standard IOS test
|
|
2687
|
-
if ((/CriOS/i.test(userAgent) || /Macintosh|iPad|iPhone|iPod/.test(userAgent)) && !window.MSStream) {
|
|
2688
|
-
// inside facebook browser
|
|
2689
|
-
if (/\bFB[\w_]+\//.test(userAgent)) {
|
|
2690
|
-
return false;
|
|
2691
|
-
}
|
|
2692
|
-
// inside instagram browser
|
|
2693
|
-
if (/\bInstagram/i.test(userAgent)) {
|
|
2694
|
-
return false;
|
|
2695
|
-
}
|
|
2696
|
-
return Util.canQuicklook();
|
|
2697
|
-
} else if (/android/i.test(userAgent)) {
|
|
2698
|
-
return true;
|
|
2699
|
-
}
|
|
2700
|
-
return false;
|
|
2733
|
+
return Util.canQuicklook() || Util.canSceneViewer();
|
|
2701
2734
|
}
|
|
2702
2735
|
}, {
|
|
2703
2736
|
key: "canQuicklook",
|
|
2704
2737
|
value: function canQuicklook() {
|
|
2705
|
-
|
|
2706
|
-
|
|
2738
|
+
if (Util.isIOS()) {
|
|
2739
|
+
var isWKWebView = Boolean((window && window).webkit && window.webkit.messageHandlers);
|
|
2740
|
+
if (isWKWebView) {
|
|
2741
|
+
return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));
|
|
2742
|
+
}
|
|
2743
|
+
var tempAnchor = document.createElement("a");
|
|
2744
|
+
return tempAnchor.relList && tempAnchor.relList.supports && tempAnchor.relList.supports("ar");
|
|
2745
|
+
}
|
|
2746
|
+
return false;
|
|
2707
2747
|
}
|
|
2708
2748
|
}, {
|
|
2709
2749
|
key: "canSceneViewer",
|
|
2710
2750
|
value: function canSceneViewer() {
|
|
2711
|
-
return Util.
|
|
2751
|
+
return Util.isAndroid() && !Util.isFirefox() && !Util.isOculus();
|
|
2712
2752
|
}
|
|
2713
2753
|
}, {
|
|
2714
2754
|
key: "canRealityViewer",
|
|
2715
2755
|
value: function canRealityViewer() {
|
|
2716
|
-
|
|
2717
|
-
return false;
|
|
2718
|
-
}
|
|
2719
|
-
if (/Macintosh|iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
|
|
2720
|
-
if (Util.isSafari() && Util.getIOSVersion()[0] >= 13) {
|
|
2721
|
-
return true;
|
|
2722
|
-
}
|
|
2723
|
-
}
|
|
2724
|
-
return false;
|
|
2756
|
+
return Util.isIOS() && Util.getIOSVersion()[0] >= 13;
|
|
2725
2757
|
}
|
|
2726
2758
|
}, {
|
|
2727
|
-
key: "
|
|
2728
|
-
value: function
|
|
2729
|
-
|
|
2730
|
-
return navigator.vendor.indexOf("Apple") > -1 && navigator.userAgent.indexOf("CriOS") === -1 && navigator.userAgent.indexOf("FxiOS") === -1;
|
|
2731
|
-
}
|
|
2732
|
-
return false;
|
|
2759
|
+
key: "isSafariOnIOS",
|
|
2760
|
+
value: function isSafariOnIOS() {
|
|
2761
|
+
return Util.isIOS() && Util.isSafari();
|
|
2733
2762
|
}
|
|
2734
2763
|
}, {
|
|
2735
2764
|
key: "isChromeOnIOS",
|
|
2736
2765
|
value: function isChromeOnIOS() {
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2766
|
+
return Util.isIOS() && /CriOS\//.test(navigator.userAgent);
|
|
2767
|
+
}
|
|
2768
|
+
}, {
|
|
2769
|
+
key: "isIOS",
|
|
2770
|
+
value: function isIOS() {
|
|
2771
|
+
return /iPad|iPhone|iPod/.test(navigator.userAgent) && !self.MSStream || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
2772
|
+
}
|
|
2773
|
+
}, {
|
|
2774
|
+
key: "isAndroid",
|
|
2775
|
+
value: function isAndroid() {
|
|
2776
|
+
return /android/i.test(navigator.userAgent);
|
|
2777
|
+
}
|
|
2778
|
+
}, {
|
|
2779
|
+
key: "isFirefox",
|
|
2780
|
+
value: function isFirefox() {
|
|
2781
|
+
return /firefox/i.test(navigator.userAgent);
|
|
2782
|
+
}
|
|
2783
|
+
}, {
|
|
2784
|
+
key: "isOculus",
|
|
2785
|
+
value: function isOculus() {
|
|
2786
|
+
return /OculusBrowser/.test(navigator.userAgent);
|
|
2787
|
+
}
|
|
2788
|
+
}, {
|
|
2789
|
+
key: "isSafari",
|
|
2790
|
+
value: function isSafari() {
|
|
2791
|
+
return /Safari\//.test(navigator.userAgent);
|
|
2742
2792
|
}
|
|
2743
2793
|
}, {
|
|
2744
2794
|
key: "getIOSVersion",
|
|
@@ -2777,7 +2827,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2777
2827
|
Object.defineProperty(exports, "__esModule", {
|
|
2778
2828
|
value: true
|
|
2779
2829
|
});
|
|
2780
|
-
exports["default"] = "1.
|
|
2830
|
+
exports["default"] = "1.140.1";
|
|
2781
2831
|
}, {}],
|
|
2782
2832
|
17: [function (require, module, exports) {
|
|
2783
2833
|
"use strict";
|
|
@@ -2808,13 +2858,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2808
2858
|
_inherits(QuicklookViewer, _ar_viewer_1$default);
|
|
2809
2859
|
var _super11 = _createSuper(QuicklookViewer);
|
|
2810
2860
|
function QuicklookViewer() {
|
|
2811
|
-
var
|
|
2861
|
+
var _this34;
|
|
2812
2862
|
_classCallCheck(this, QuicklookViewer);
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
return
|
|
2863
|
+
_this34 = _super11.call(this);
|
|
2864
|
+
_this34.araction = null;
|
|
2865
|
+
_this34.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
|
|
2866
|
+
_this34.arcallback = function () {};
|
|
2867
|
+
return _this34;
|
|
2818
2868
|
}
|
|
2819
2869
|
_createClass(QuicklookViewer, [{
|
|
2820
2870
|
key: "nodeType",
|
|
@@ -2829,7 +2879,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2829
2879
|
}, {
|
|
2830
2880
|
key: "start",
|
|
2831
2881
|
value: function start() {
|
|
2832
|
-
var
|
|
2882
|
+
var _this35 = this;
|
|
2833
2883
|
if (!this.modelUrl) {
|
|
2834
2884
|
throw new Error("QuicklookViewer.start() - model url not set, use QuicklookViewer.modelUrl");
|
|
2835
2885
|
}
|
|
@@ -2841,7 +2891,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2841
2891
|
if (araction) {
|
|
2842
2892
|
var handleQuicklook = function handleQuicklook(event) {
|
|
2843
2893
|
if (event.data === "_apple_ar_quicklook_button_tapped") {
|
|
2844
|
-
|
|
2894
|
+
_this35.arcallback();
|
|
2845
2895
|
}
|
|
2846
2896
|
document.body.removeChild(anchor);
|
|
2847
2897
|
anchor.removeEventListener("message", handleQuicklook, false);
|
|
@@ -2927,14 +2977,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2927
2977
|
_inherits(SceneViewer, _ar_viewer_1$default3);
|
|
2928
2978
|
var _super13 = _createSuper(SceneViewer);
|
|
2929
2979
|
function SceneViewer() {
|
|
2930
|
-
var
|
|
2980
|
+
var _this36;
|
|
2931
2981
|
_classCallCheck(this, SceneViewer);
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
return
|
|
2982
|
+
_this36 = _super13.call(this);
|
|
2983
|
+
_this36.araction = null;
|
|
2984
|
+
_this36.isVertical = false;
|
|
2985
|
+
_this36.titleHTML = "<b>" + document.title;
|
|
2986
|
+
_this36.isVertical = false;
|
|
2987
|
+
return _this36;
|
|
2938
2988
|
}
|
|
2939
2989
|
_createClass(SceneViewer, [{
|
|
2940
2990
|
key: "nodeType",
|
|
@@ -3031,16 +3081,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3031
3081
|
*/
|
|
3032
3082
|
var Memory = /*#__PURE__*/function () {
|
|
3033
3083
|
function Memory(messengerInstance) {
|
|
3034
|
-
var
|
|
3084
|
+
var _this37 = this;
|
|
3035
3085
|
_classCallCheck(this, Memory);
|
|
3036
3086
|
this._messenger = messengerInstance;
|
|
3037
3087
|
this._tempMemory = new TemporaryMemory(messengerInstance);
|
|
3038
3088
|
this._permMemory = new PermanentMemory(messengerInstance);
|
|
3039
3089
|
this._messenger.self.__memory__set_temp_var = function (name, data) {
|
|
3040
|
-
|
|
3090
|
+
_this37._tempMemory[name] = data;
|
|
3041
3091
|
};
|
|
3042
3092
|
this._messenger.self.__memory__set_perm_var = function (name, data) {
|
|
3043
|
-
|
|
3093
|
+
_this37._permMemory[name] = data;
|
|
3044
3094
|
};
|
|
3045
3095
|
}
|
|
3046
3096
|
_createClass(Memory, [{
|
|
@@ -3487,17 +3537,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3487
3537
|
}, {
|
|
3488
3538
|
key: "exec",
|
|
3489
3539
|
value: function exec() {
|
|
3490
|
-
var
|
|
3540
|
+
var _this38 = this;
|
|
3491
3541
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
3492
3542
|
args[_key3] = arguments[_key3];
|
|
3493
3543
|
}
|
|
3494
3544
|
return new Promise(function (accept, reject) {
|
|
3495
|
-
if (!
|
|
3496
|
-
return reject(new Error("WrappedLocalFunction.exec() function with name " +
|
|
3545
|
+
if (!_this38._value) {
|
|
3546
|
+
return reject(new Error("WrappedLocalFunction.exec() function with name " + _this38._funcName + "() is not defined"));
|
|
3497
3547
|
}
|
|
3498
3548
|
try {
|
|
3499
3549
|
// otherwise execute the function
|
|
3500
|
-
var rObject =
|
|
3550
|
+
var rObject = _this38._execute.apply(_this38, args);
|
|
3501
3551
|
|
|
3502
3552
|
// we need to check if the returned object is a Promise, if so, handle it
|
|
3503
3553
|
// differently. This can happen if the function wants to execute asyn
|
|
@@ -3557,7 +3607,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3557
3607
|
*/
|
|
3558
3608
|
var GlobalEventHandler = /*#__PURE__*/function () {
|
|
3559
3609
|
function GlobalEventHandler() {
|
|
3560
|
-
var
|
|
3610
|
+
var _this39 = this;
|
|
3561
3611
|
_classCallCheck(this, GlobalEventHandler);
|
|
3562
3612
|
this._eventListeners = {};
|
|
3563
3613
|
|
|
@@ -3577,11 +3627,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3577
3627
|
// make sure the event is properly formatted
|
|
3578
3628
|
if (jsonData && jsonData.event && jsonData.data) {
|
|
3579
3629
|
// see if there are any listeners for this
|
|
3580
|
-
if (
|
|
3630
|
+
if (_this39._eventListeners[jsonData.event]) {
|
|
3581
3631
|
var remoteInterface = new RemoteInterface(evt.source, evt.origin);
|
|
3582
3632
|
|
|
3583
3633
|
// loop through and call all the event handlers
|
|
3584
|
-
|
|
3634
|
+
_this39._eventListeners[jsonData.event].forEach(function (callback) {
|
|
3585
3635
|
try {
|
|
3586
3636
|
callback(remoteInterface, jsonData.data);
|
|
3587
3637
|
} catch (e) {
|
|
@@ -3758,33 +3808,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3758
3808
|
}, {
|
|
3759
3809
|
key: "_registerListeners",
|
|
3760
3810
|
value: function _registerListeners() {
|
|
3761
|
-
var
|
|
3811
|
+
var _this40 = this;
|
|
3762
3812
|
GlobalEventHandler.instance().listen("__messenger__child_init", function (src, data) {
|
|
3763
3813
|
var iframeID = src.id;
|
|
3764
3814
|
|
|
3765
3815
|
// check reserved key list
|
|
3766
3816
|
switch (iframeID) {
|
|
3767
3817
|
case undefined:
|
|
3768
|
-
throw new Error("Messenger[" +
|
|
3818
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID cannot be undefined");
|
|
3769
3819
|
case "self":
|
|
3770
|
-
throw new Error("Messenger[" +
|
|
3820
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
3771
3821
|
case "parent":
|
|
3772
|
-
throw new Error("Messenger[" +
|
|
3822
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
3773
3823
|
case "id":
|
|
3774
|
-
throw new Error("Messenger[" +
|
|
3824
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
3775
3825
|
case "onload":
|
|
3776
|
-
throw new Error("Messenger[" +
|
|
3826
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
3777
3827
|
default:
|
|
3778
3828
|
break;
|
|
3779
3829
|
}
|
|
3780
3830
|
|
|
3781
3831
|
// initialise the child iframe as a messenger pipe
|
|
3782
|
-
|
|
3783
|
-
|
|
3832
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3833
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3784
3834
|
|
|
3785
3835
|
// add the interface to the broadcaster
|
|
3786
|
-
|
|
3787
|
-
var callbacks =
|
|
3836
|
+
_this40._broadcaster._push(iframeID);
|
|
3837
|
+
var callbacks = _this40._callbacks;
|
|
3788
3838
|
|
|
3789
3839
|
// we have registered callbacks, begin execution
|
|
3790
3840
|
if (callbacks.has(iframeID)) {
|
|
@@ -3808,26 +3858,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3808
3858
|
// check reserved key list
|
|
3809
3859
|
switch (iframeID) {
|
|
3810
3860
|
case undefined:
|
|
3811
|
-
throw new Error("Messenger[" +
|
|
3861
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID cannot be undefined");
|
|
3812
3862
|
case "self":
|
|
3813
|
-
throw new Error("Messenger[" +
|
|
3863
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
3814
3864
|
case "parent":
|
|
3815
|
-
throw new Error("Messenger[" +
|
|
3865
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
3816
3866
|
case "id":
|
|
3817
|
-
throw new Error("Messenger[" +
|
|
3867
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
3818
3868
|
case "onload":
|
|
3819
|
-
throw new Error("Messenger[" +
|
|
3869
|
+
throw new Error("Messenger[" + _this40._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
3820
3870
|
default:
|
|
3821
3871
|
break;
|
|
3822
3872
|
}
|
|
3823
3873
|
|
|
3824
3874
|
// initialise the child iframe as a messenger pipe
|
|
3825
|
-
|
|
3826
|
-
|
|
3875
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3876
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3827
3877
|
|
|
3828
3878
|
// add the interface to the broadcaster
|
|
3829
|
-
|
|
3830
|
-
var callbacks =
|
|
3879
|
+
_this40._broadcaster._push(iframeID);
|
|
3880
|
+
var callbacks = _this40._callbacks;
|
|
3831
3881
|
|
|
3832
3882
|
// we have registered callbacks, begin execution
|
|
3833
3883
|
if (callbacks.has(iframeID)) {
|
|
@@ -3846,9 +3896,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3846
3896
|
});
|
|
3847
3897
|
GlobalEventHandler.instance().listen("__messenger__parent_init", function (src, data) {
|
|
3848
3898
|
var iframeID = "parent";
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
var callbacks =
|
|
3899
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3900
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3901
|
+
var callbacks = _this40._callbacks;
|
|
3852
3902
|
|
|
3853
3903
|
// we have registered callbacks, begin execution
|
|
3854
3904
|
if (callbacks.has(iframeID)) {
|
|
@@ -3872,9 +3922,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3872
3922
|
*/
|
|
3873
3923
|
GlobalEventHandler.instance().listen("__messenger__parent_init_inv", function (src, data) {
|
|
3874
3924
|
var iframeID = "parent";
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
var callbacks =
|
|
3925
|
+
_this40[iframeID] = new RemoteFunctionList(iframeID);
|
|
3926
|
+
_this40[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
3927
|
+
var callbacks = _this40._callbacks;
|
|
3878
3928
|
|
|
3879
3929
|
// we have registered callbacks, begin execution
|
|
3880
3930
|
if (callbacks.has(iframeID)) {
|
|
@@ -4093,7 +4143,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4093
4143
|
*/
|
|
4094
4144
|
var WrappedRemoteFunction = /*#__PURE__*/function () {
|
|
4095
4145
|
function WrappedRemoteFunction(funcName, remoteInterface) {
|
|
4096
|
-
var
|
|
4146
|
+
var _this41 = this;
|
|
4097
4147
|
_classCallCheck(this, WrappedRemoteFunction);
|
|
4098
4148
|
this._funcName = funcName;
|
|
4099
4149
|
this._remoteInterface = remoteInterface;
|
|
@@ -4104,19 +4154,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4104
4154
|
var instanceID = data.instance_id;
|
|
4105
4155
|
|
|
4106
4156
|
// the function name must match
|
|
4107
|
-
if (data.function_name !==
|
|
4157
|
+
if (data.function_name !== _this41._funcName) {
|
|
4108
4158
|
return;
|
|
4109
4159
|
}
|
|
4110
4160
|
|
|
4111
4161
|
// the instance ID must be found, otherwise this is a rogue execution
|
|
4112
4162
|
// that can be ignored (should not happen)
|
|
4113
|
-
if (!
|
|
4163
|
+
if (!_this41._callInstances[instanceID]) {
|
|
4114
4164
|
return;
|
|
4115
4165
|
}
|
|
4116
|
-
var promise =
|
|
4166
|
+
var promise = _this41._callInstances[instanceID];
|
|
4117
4167
|
|
|
4118
4168
|
// remove the old instance
|
|
4119
|
-
delete
|
|
4169
|
+
delete _this41._callInstances[instanceID];
|
|
4120
4170
|
|
|
4121
4171
|
// perform the promise callbacks
|
|
4122
4172
|
if (data.function_status === "success") {
|
|
@@ -4133,7 +4183,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4133
4183
|
_createClass(WrappedRemoteFunction, [{
|
|
4134
4184
|
key: "exec",
|
|
4135
4185
|
value: function exec() {
|
|
4136
|
-
var
|
|
4186
|
+
var _this42 = this;
|
|
4137
4187
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
4138
4188
|
args[_key4] = arguments[_key4];
|
|
4139
4189
|
}
|
|
@@ -4152,15 +4202,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4152
4202
|
// to be executed later
|
|
4153
4203
|
return new Promise(function (accept, reject) {
|
|
4154
4204
|
// save this promise to be executed later
|
|
4155
|
-
|
|
4205
|
+
_this42._callInstances[instanceID] = {
|
|
4156
4206
|
accept: accept,
|
|
4157
4207
|
reject: reject
|
|
4158
4208
|
};
|
|
4159
4209
|
|
|
4160
4210
|
// execute this event in another context
|
|
4161
|
-
|
|
4211
|
+
_this42._remoteInterface.send("__messenger__exec_fnc", {
|
|
4162
4212
|
instance_id: instanceID,
|
|
4163
|
-
function_name:
|
|
4213
|
+
function_name: _this42._funcName,
|
|
4164
4214
|
function_args: args
|
|
4165
4215
|
});
|
|
4166
4216
|
});
|
|
@@ -4293,7 +4343,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4293
4343
|
var google_analytics_1 = require("./google/google-analytics");
|
|
4294
4344
|
var Analytics = /*#__PURE__*/function () {
|
|
4295
4345
|
function Analytics(applicationID) {
|
|
4296
|
-
var
|
|
4346
|
+
var _this43 = this;
|
|
4297
4347
|
_classCallCheck(this, Analytics);
|
|
4298
4348
|
this._pageTime = null;
|
|
4299
4349
|
this.origin = "production";
|
|
@@ -4307,17 +4357,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4307
4357
|
this._ga = new google_analytics_1.GoogleAnalytics();
|
|
4308
4358
|
this._handlePageHide = function () {
|
|
4309
4359
|
if (document.visibilityState === "hidden") {
|
|
4310
|
-
|
|
4311
|
-
} else if (
|
|
4360
|
+
_this43._pageTime = new Date();
|
|
4361
|
+
} else if (_this43._pageTime) {
|
|
4312
4362
|
var time2 = new Date();
|
|
4313
|
-
var diff = time2.getTime() -
|
|
4314
|
-
var data =
|
|
4363
|
+
var diff = time2.getTime() - _this43._pageTime.getTime();
|
|
4364
|
+
var data = _this43.data;
|
|
4315
4365
|
data.push("eventAction", "View Time");
|
|
4316
4366
|
data.push("viewTime", diff);
|
|
4317
4367
|
data.push("eventLabel", diff);
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
document.removeEventListener("visibilitychange",
|
|
4368
|
+
_this43.write();
|
|
4369
|
+
_this43._pageTime = null;
|
|
4370
|
+
document.removeEventListener("visibilitychange", _this43._handlePageHide, false);
|
|
4321
4371
|
}
|
|
4322
4372
|
};
|
|
4323
4373
|
}
|
|
@@ -4329,17 +4379,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4329
4379
|
}, {
|
|
4330
4380
|
key: "query",
|
|
4331
4381
|
value: function query() {
|
|
4332
|
-
var
|
|
4382
|
+
var _this44 = this;
|
|
4333
4383
|
var _query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
4334
4384
|
return new Promise(function (accept, reject) {
|
|
4335
4385
|
if (!_query) {
|
|
4336
4386
|
return reject(new Error("Analytics.query() - provided query was null"));
|
|
4337
4387
|
}
|
|
4338
|
-
var url =
|
|
4388
|
+
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
4389
|
var data = {
|
|
4340
4390
|
type: "read",
|
|
4341
|
-
application_id:
|
|
4342
|
-
event:
|
|
4391
|
+
application_id: _this44._applicationID,
|
|
4392
|
+
event: _this44.event,
|
|
4343
4393
|
data: _query
|
|
4344
4394
|
};
|
|
4345
4395
|
basic_http_1["default"].exec("POST", url, data).then(function (result) {
|
|
@@ -4350,19 +4400,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4350
4400
|
}, {
|
|
4351
4401
|
key: "write",
|
|
4352
4402
|
value: function write() {
|
|
4353
|
-
var
|
|
4403
|
+
var _this45 = this;
|
|
4354
4404
|
return new Promise(function (accept, reject) {
|
|
4355
|
-
var data =
|
|
4356
|
-
var url =
|
|
4357
|
-
data.push("applicationId",
|
|
4405
|
+
var data = _this45._data;
|
|
4406
|
+
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";
|
|
4407
|
+
data.push("applicationId", _this45._applicationID);
|
|
4358
4408
|
var sendData = {
|
|
4359
4409
|
type: "write",
|
|
4360
|
-
application_id:
|
|
4361
|
-
origin:
|
|
4362
|
-
event:
|
|
4410
|
+
application_id: _this45._applicationID,
|
|
4411
|
+
origin: _this45.origin,
|
|
4412
|
+
event: _this45.event,
|
|
4363
4413
|
data: data.data
|
|
4364
4414
|
};
|
|
4365
|
-
if (
|
|
4415
|
+
if (_this45.isBeacon === false) {
|
|
4366
4416
|
basic_http_1["default"].exec("POST", url, sendData).then(function (result) {
|
|
4367
4417
|
accept(result && result.results ? result.results : {});
|
|
4368
4418
|
})["catch"](reject);
|
|
@@ -4371,7 +4421,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4371
4421
|
accept(result && result.results ? result.results : {});
|
|
4372
4422
|
})["catch"](reject);
|
|
4373
4423
|
}
|
|
4374
|
-
|
|
4424
|
+
_this45.googleAnalytics.write(_this45.event, _this45.data);
|
|
4375
4425
|
});
|
|
4376
4426
|
}
|
|
4377
4427
|
}, {
|
|
@@ -4925,10 +4975,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4925
4975
|
}, {
|
|
4926
4976
|
key: "_get",
|
|
4927
4977
|
value: function _get(opt) {
|
|
4928
|
-
var
|
|
4978
|
+
var _this46 = this;
|
|
4929
4979
|
return new Promise(function (resolve, reject) {
|
|
4930
|
-
var target =
|
|
4931
|
-
var server =
|
|
4980
|
+
var target = _this46.target;
|
|
4981
|
+
var server = _this46.server;
|
|
4932
4982
|
|
|
4933
4983
|
// we cannot perform a GET request without an ID
|
|
4934
4984
|
if (!target.id) {
|
|
@@ -4953,15 +5003,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4953
5003
|
var origin = server.originLocation.api_read;
|
|
4954
5004
|
var auth = server.authToken;
|
|
4955
5005
|
var headers = {
|
|
4956
|
-
'cookie': 'laravel_session=' +
|
|
5006
|
+
'cookie': 'laravel_session=' + _this46.getCookie('laravel_session')
|
|
4957
5007
|
};
|
|
4958
5008
|
Object.assign(headers, auth);
|
|
4959
5009
|
var reqopts = {
|
|
4960
5010
|
method: "GET",
|
|
4961
5011
|
headers: headers
|
|
4962
5012
|
};
|
|
4963
|
-
var includeQuery =
|
|
4964
|
-
var params =
|
|
5013
|
+
var includeQuery = _this46._IncludeQuery;
|
|
5014
|
+
var params = _this46._ParamFor("get");
|
|
4965
5015
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
4966
5016
|
if (includeQuery) {
|
|
4967
5017
|
endpoint = endpoint + "?include=" + includeQuery;
|
|
@@ -4996,10 +5046,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4996
5046
|
}, {
|
|
4997
5047
|
key: "_update",
|
|
4998
5048
|
value: function _update() {
|
|
4999
|
-
var
|
|
5049
|
+
var _this47 = this;
|
|
5000
5050
|
return new Promise(function (resolve, reject) {
|
|
5001
|
-
var target =
|
|
5002
|
-
var server =
|
|
5051
|
+
var target = _this47.target;
|
|
5052
|
+
var server = _this47.server;
|
|
5003
5053
|
|
|
5004
5054
|
// we cannot perform a GET request without an ID
|
|
5005
5055
|
if (!target.id) {
|
|
@@ -5013,7 +5063,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5013
5063
|
var headers = {
|
|
5014
5064
|
'Accept': 'application/json',
|
|
5015
5065
|
'Content-Type': 'application/json',
|
|
5016
|
-
'cookie': 'laravel_session=' +
|
|
5066
|
+
'cookie': 'laravel_session=' + _this47.getCookie('laravel_session')
|
|
5017
5067
|
};
|
|
5018
5068
|
Object.assign(headers, auth);
|
|
5019
5069
|
var reqopts = {
|
|
@@ -5027,7 +5077,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5027
5077
|
meta: target.meta || {}
|
|
5028
5078
|
})
|
|
5029
5079
|
};
|
|
5030
|
-
var params =
|
|
5080
|
+
var params = _this47._ParamFor("update");
|
|
5031
5081
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
5032
5082
|
if (params) {
|
|
5033
5083
|
var appender = "?";
|
|
@@ -5063,10 +5113,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5063
5113
|
}, {
|
|
5064
5114
|
key: "_create",
|
|
5065
5115
|
value: function _create() {
|
|
5066
|
-
var
|
|
5116
|
+
var _this48 = this;
|
|
5067
5117
|
return new Promise(function (resolve, reject) {
|
|
5068
|
-
var target =
|
|
5069
|
-
var server =
|
|
5118
|
+
var target = _this48.target;
|
|
5119
|
+
var server = _this48.server;
|
|
5070
5120
|
|
|
5071
5121
|
// otherwise, proceed with the fetching op
|
|
5072
5122
|
var origin = server.originLocation.api_write;
|
|
@@ -5074,7 +5124,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5074
5124
|
var headers = {
|
|
5075
5125
|
'Accept': 'application/json',
|
|
5076
5126
|
'Content-Type': 'application/json',
|
|
5077
|
-
'cookie': 'laravel_session=' +
|
|
5127
|
+
'cookie': 'laravel_session=' + _this48.getCookie('laravel_session')
|
|
5078
5128
|
};
|
|
5079
5129
|
Object.assign(headers, auth);
|
|
5080
5130
|
var reqopts = {
|
|
@@ -5087,7 +5137,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5087
5137
|
meta: target.meta || {}
|
|
5088
5138
|
})
|
|
5089
5139
|
};
|
|
5090
|
-
var params =
|
|
5140
|
+
var params = _this48._ParamFor("create");
|
|
5091
5141
|
var endpoint = origin + target.type();
|
|
5092
5142
|
if (params) {
|
|
5093
5143
|
var appender = "?";
|
|
@@ -5124,10 +5174,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5124
5174
|
}, {
|
|
5125
5175
|
key: "_delete",
|
|
5126
5176
|
value: function _delete() {
|
|
5127
|
-
var
|
|
5177
|
+
var _this49 = this;
|
|
5128
5178
|
return new Promise(function (resolve, reject) {
|
|
5129
|
-
var target =
|
|
5130
|
-
var server =
|
|
5179
|
+
var target = _this49.target;
|
|
5180
|
+
var server = _this49.server;
|
|
5131
5181
|
|
|
5132
5182
|
// we cannot perform a GET request without an ID
|
|
5133
5183
|
if (!target.id) {
|
|
@@ -5141,7 +5191,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5141
5191
|
var headers = {
|
|
5142
5192
|
'Accept': 'application/json',
|
|
5143
5193
|
'Content-Type': 'application/json',
|
|
5144
|
-
'cookie': 'laravel_session=' +
|
|
5194
|
+
'cookie': 'laravel_session=' + _this49.getCookie('laravel_session')
|
|
5145
5195
|
};
|
|
5146
5196
|
Object.assign(headers, auth);
|
|
5147
5197
|
var reqopts = {
|
|
@@ -5155,7 +5205,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5155
5205
|
meta: target.meta || {}
|
|
5156
5206
|
})
|
|
5157
5207
|
};
|
|
5158
|
-
var params =
|
|
5208
|
+
var params = _this49._ParamFor("delete");
|
|
5159
5209
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
5160
5210
|
if (params) {
|
|
5161
5211
|
var appender = "?";
|
|
@@ -5210,7 +5260,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5210
5260
|
}, {
|
|
5211
5261
|
key: "_include",
|
|
5212
5262
|
value: function _include(args) {
|
|
5213
|
-
var
|
|
5263
|
+
var _this50 = this;
|
|
5214
5264
|
if (!args || args.length <= 0) {
|
|
5215
5265
|
return this;
|
|
5216
5266
|
}
|
|
@@ -5220,20 +5270,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5220
5270
|
if (Array.isArray(obj)) {
|
|
5221
5271
|
obj.forEach(function (strObject) {
|
|
5222
5272
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
5223
|
-
|
|
5273
|
+
_this50._getIncludeQuery.push(strObject);
|
|
5224
5274
|
} else {
|
|
5225
|
-
throw new Error("PlattarQuery." +
|
|
5275
|
+
throw new Error("PlattarQuery." + _this50.target.type() + ".include(...args) - argument of Array must only include Strings");
|
|
5226
5276
|
}
|
|
5227
5277
|
});
|
|
5228
5278
|
} else if (PlattarUtil.isPlattarObject(obj)) {
|
|
5229
5279
|
var type = obj.type();
|
|
5230
5280
|
if (Array.isArray(type)) {
|
|
5231
|
-
|
|
5281
|
+
_this50._include(type);
|
|
5232
5282
|
} else {
|
|
5233
|
-
|
|
5283
|
+
_this50._getIncludeQuery.push(type);
|
|
5234
5284
|
}
|
|
5235
5285
|
} else {
|
|
5236
|
-
throw new Error("PlattarQuery." +
|
|
5286
|
+
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
5287
|
}
|
|
5238
5288
|
});
|
|
5239
5289
|
return this;
|
|
@@ -5358,12 +5408,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5358
5408
|
}, {
|
|
5359
5409
|
key: "auth",
|
|
5360
5410
|
value: function auth(token, opt) {
|
|
5361
|
-
var
|
|
5411
|
+
var _this51 = this;
|
|
5362
5412
|
var copt = opt || {
|
|
5363
5413
|
validate: false
|
|
5364
5414
|
};
|
|
5365
5415
|
return new Promise(function (resolve, reject) {
|
|
5366
|
-
var server =
|
|
5416
|
+
var server = _this51.originLocation.api_write;
|
|
5367
5417
|
if (!server) {
|
|
5368
5418
|
reject(new Error("Plattar.auth(token) - cannot authenticate as server not set via Plattar.origin(server)"));
|
|
5369
5419
|
return;
|
|
@@ -5373,10 +5423,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5373
5423
|
return;
|
|
5374
5424
|
}
|
|
5375
5425
|
if (!copt.validate) {
|
|
5376
|
-
|
|
5426
|
+
_this51._authToken = {
|
|
5377
5427
|
"plattar-auth-token": token
|
|
5378
5428
|
};
|
|
5379
|
-
resolve(
|
|
5429
|
+
resolve(_this51);
|
|
5380
5430
|
return;
|
|
5381
5431
|
}
|
|
5382
5432
|
var endpoint = server + "plattaruser/xauth/validate";
|
|
@@ -5388,10 +5438,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5388
5438
|
};
|
|
5389
5439
|
fetch(endpoint, options).then(function (res) {
|
|
5390
5440
|
if (res.ok) {
|
|
5391
|
-
|
|
5441
|
+
_this51._authToken = {
|
|
5392
5442
|
"plattar-auth-token": token
|
|
5393
5443
|
};
|
|
5394
|
-
resolve(
|
|
5444
|
+
resolve(_this51);
|
|
5395
5445
|
} else {
|
|
5396
5446
|
reject(new Error("Plattar.auth(token) - failed to validate authentication token at " + endpoint));
|
|
5397
5447
|
}
|
|
@@ -5401,7 +5451,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5401
5451
|
}, {
|
|
5402
5452
|
key: "origin",
|
|
5403
5453
|
value: function origin(server, opt) {
|
|
5404
|
-
var
|
|
5454
|
+
var _this52 = this;
|
|
5405
5455
|
var copt = opt || {
|
|
5406
5456
|
validate: false
|
|
5407
5457
|
};
|
|
@@ -5411,8 +5461,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5411
5461
|
return;
|
|
5412
5462
|
}
|
|
5413
5463
|
if (!copt.validate) {
|
|
5414
|
-
|
|
5415
|
-
resolve(
|
|
5464
|
+
_this52._serverLocation = server;
|
|
5465
|
+
resolve(_this52);
|
|
5416
5466
|
return;
|
|
5417
5467
|
}
|
|
5418
5468
|
var endpoint = server.api_read + "ping";
|
|
@@ -5421,8 +5471,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5421
5471
|
};
|
|
5422
5472
|
fetch(endpoint, options).then(function (res) {
|
|
5423
5473
|
if (res.ok) {
|
|
5424
|
-
|
|
5425
|
-
resolve(
|
|
5474
|
+
_this52._serverLocation = server;
|
|
5475
|
+
resolve(_this52);
|
|
5426
5476
|
} else {
|
|
5427
5477
|
reject(new Error("Plattar.origin(server) - failed to ping server at " + endpoint));
|
|
5428
5478
|
}
|
|
@@ -5744,13 +5794,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5744
5794
|
_inherits(FileBase, _PlattarBase11);
|
|
5745
5795
|
var _super25 = _createSuper(FileBase);
|
|
5746
5796
|
function FileBase(id, server) {
|
|
5747
|
-
var
|
|
5797
|
+
var _this53;
|
|
5748
5798
|
_classCallCheck(this, FileBase);
|
|
5749
|
-
|
|
5750
|
-
if (
|
|
5799
|
+
_this53 = _super25.call(this, id, server || Server["default"]());
|
|
5800
|
+
if (_this53.constructor === FileBase) {
|
|
5751
5801
|
throw new Error("FileBase is abstract and cannot be created");
|
|
5752
5802
|
}
|
|
5753
|
-
return
|
|
5803
|
+
return _this53;
|
|
5754
5804
|
}
|
|
5755
5805
|
_createClass(FileBase, [{
|
|
5756
5806
|
key: "sourcePath",
|
|
@@ -5903,13 +5953,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5903
5953
|
_inherits(PlattarBase, _PlattarObject);
|
|
5904
5954
|
var _super30 = _createSuper(PlattarBase);
|
|
5905
5955
|
function PlattarBase(id, server) {
|
|
5906
|
-
var
|
|
5956
|
+
var _this54;
|
|
5907
5957
|
_classCallCheck(this, PlattarBase);
|
|
5908
|
-
|
|
5909
|
-
if (
|
|
5958
|
+
_this54 = _super30.call(this, id, server || Server["default"]());
|
|
5959
|
+
if (_this54.constructor === PlattarBase) {
|
|
5910
5960
|
throw new Error("PlattarBase is abstract and cannot be created");
|
|
5911
5961
|
}
|
|
5912
|
-
return
|
|
5962
|
+
return _this54;
|
|
5913
5963
|
}
|
|
5914
5964
|
return _createClass(PlattarBase);
|
|
5915
5965
|
}(PlattarObject);
|
|
@@ -5976,7 +6026,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5976
6026
|
}, {
|
|
5977
6027
|
key: "filter",
|
|
5978
6028
|
value: function filter(obj, id) {
|
|
5979
|
-
var
|
|
6029
|
+
var _this55 = this;
|
|
5980
6030
|
if (!obj) {
|
|
5981
6031
|
return [];
|
|
5982
6032
|
}
|
|
@@ -5992,7 +6042,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5992
6042
|
if (Array.isArray(type)) {
|
|
5993
6043
|
var compiledList = [];
|
|
5994
6044
|
type.forEach(function (inObject) {
|
|
5995
|
-
var retArray =
|
|
6045
|
+
var retArray = _this55.filter(inObject, id);
|
|
5996
6046
|
if (retArray.length > 0) {
|
|
5997
6047
|
compiledList = compiledList.concat(retArray);
|
|
5998
6048
|
}
|
|
@@ -6180,7 +6230,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6180
6230
|
}, {
|
|
6181
6231
|
key: "include",
|
|
6182
6232
|
value: function include() {
|
|
6183
|
-
var
|
|
6233
|
+
var _this56 = this;
|
|
6184
6234
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
6185
6235
|
args[_key6] = arguments[_key6];
|
|
6186
6236
|
}
|
|
@@ -6193,15 +6243,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6193
6243
|
if (Array.isArray(obj)) {
|
|
6194
6244
|
obj.forEach(function (strObject) {
|
|
6195
6245
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
6196
|
-
includes.push("".concat(
|
|
6246
|
+
includes.push("".concat(_this56.type(), ".").concat(strObject));
|
|
6197
6247
|
} else {
|
|
6198
|
-
throw new Error("PlattarObject." +
|
|
6248
|
+
throw new Error("PlattarObject." + _this56.type() + ".include(...args) - argument of Array must only include Strings");
|
|
6199
6249
|
}
|
|
6200
6250
|
});
|
|
6201
6251
|
} else if (obj.prototype instanceof PlattarObject) {
|
|
6202
|
-
includes.push("".concat(
|
|
6252
|
+
includes.push("".concat(_this56.type(), ".").concat(obj.type()));
|
|
6203
6253
|
} else {
|
|
6204
|
-
throw new Error("PlattarObject." +
|
|
6254
|
+
throw new Error("PlattarObject." + _this56.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
|
|
6205
6255
|
}
|
|
6206
6256
|
});
|
|
6207
6257
|
return includes;
|
|
@@ -6331,13 +6381,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6331
6381
|
_inherits(CardBase, _PlattarBase17);
|
|
6332
6382
|
var _super36 = _createSuper(CardBase);
|
|
6333
6383
|
function CardBase(id, server) {
|
|
6334
|
-
var
|
|
6384
|
+
var _this57;
|
|
6335
6385
|
_classCallCheck(this, CardBase);
|
|
6336
|
-
|
|
6337
|
-
if (
|
|
6386
|
+
_this57 = _super36.call(this, id, server || Server["default"]());
|
|
6387
|
+
if (_this57.constructor === CardBase) {
|
|
6338
6388
|
throw new Error("CardBase is abstract and cannot be created");
|
|
6339
6389
|
}
|
|
6340
|
-
return
|
|
6390
|
+
return _this57;
|
|
6341
6391
|
}
|
|
6342
6392
|
_createClass(CardBase, null, [{
|
|
6343
6393
|
key: "type",
|
|
@@ -6654,13 +6704,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6654
6704
|
_inherits(ProductBase, _PlattarBase19);
|
|
6655
6705
|
var _super50 = _createSuper(ProductBase);
|
|
6656
6706
|
function ProductBase(id, server) {
|
|
6657
|
-
var
|
|
6707
|
+
var _this58;
|
|
6658
6708
|
_classCallCheck(this, ProductBase);
|
|
6659
|
-
|
|
6660
|
-
if (
|
|
6709
|
+
_this58 = _super50.call(this, id, server || Server["default"]());
|
|
6710
|
+
if (_this58.constructor === ProductBase) {
|
|
6661
6711
|
throw new Error("ProductBase is abstract and cannot be created");
|
|
6662
6712
|
}
|
|
6663
|
-
return
|
|
6713
|
+
return _this58;
|
|
6664
6714
|
}
|
|
6665
6715
|
_createClass(ProductBase, null, [{
|
|
6666
6716
|
key: "type",
|
|
@@ -6770,13 +6820,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6770
6820
|
_inherits(SceneBase, _PlattarBase21);
|
|
6771
6821
|
var _super55 = _createSuper(SceneBase);
|
|
6772
6822
|
function SceneBase(id, server) {
|
|
6773
|
-
var
|
|
6823
|
+
var _this59;
|
|
6774
6824
|
_classCallCheck(this, SceneBase);
|
|
6775
|
-
|
|
6776
|
-
if (
|
|
6825
|
+
_this59 = _super55.call(this, id, server || Server["default"]());
|
|
6826
|
+
if (_this59.constructor === SceneBase) {
|
|
6777
6827
|
throw new Error("SceneBase is abstract and cannot be created");
|
|
6778
6828
|
}
|
|
6779
|
-
return
|
|
6829
|
+
return _this59;
|
|
6780
6830
|
}
|
|
6781
6831
|
_createClass(SceneBase, null, [{
|
|
6782
6832
|
key: "type",
|
|
@@ -7478,15 +7528,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7478
7528
|
_createClass(BaseElement, [{
|
|
7479
7529
|
key: "connectedCallback",
|
|
7480
7530
|
value: function connectedCallback() {
|
|
7481
|
-
var
|
|
7531
|
+
var _this60 = this;
|
|
7482
7532
|
if (this.hasAttribute("url")) {
|
|
7483
7533
|
this.renderQRCode();
|
|
7484
7534
|
}
|
|
7485
7535
|
var observer = new MutationObserver(function (mutations) {
|
|
7486
7536
|
mutations.forEach(function (mutation) {
|
|
7487
7537
|
if (mutation.type === "attributes") {
|
|
7488
|
-
if (
|
|
7489
|
-
|
|
7538
|
+
if (_this60.hasAttribute("url")) {
|
|
7539
|
+
_this60.renderQRCode();
|
|
7490
7540
|
}
|
|
7491
7541
|
}
|
|
7492
7542
|
});
|
|
@@ -7509,7 +7559,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7509
7559
|
}, {
|
|
7510
7560
|
key: "renderQRCode",
|
|
7511
7561
|
value: function renderQRCode() {
|
|
7512
|
-
var
|
|
7562
|
+
var _this61 = this;
|
|
7513
7563
|
var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
7514
7564
|
if (!url) {
|
|
7515
7565
|
console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
|
|
@@ -7613,11 +7663,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7613
7663
|
var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
|
|
7614
7664
|
if (shortenURL && shortenURL.toLowerCase() === "true") {
|
|
7615
7665
|
this._ShortenURL(url).then(function (newURL) {
|
|
7616
|
-
|
|
7666
|
+
_this61._GenerateQRCode(newURL, width, height);
|
|
7617
7667
|
})["catch"](function (_err) {
|
|
7618
7668
|
console.warn(_err);
|
|
7619
7669
|
// ignore error and just generate normal QR Code
|
|
7620
|
-
|
|
7670
|
+
_this61._GenerateQRCode(url, width, height);
|
|
7621
7671
|
});
|
|
7622
7672
|
} else {
|
|
7623
7673
|
this._GenerateQRCode(url, width, height);
|
|
@@ -7668,9 +7718,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7668
7718
|
}, {
|
|
7669
7719
|
key: "_ShortenURL",
|
|
7670
7720
|
value: function _ShortenURL(url) {
|
|
7671
|
-
var
|
|
7721
|
+
var _this62 = this;
|
|
7672
7722
|
return new Promise(function (accept, reject) {
|
|
7673
|
-
if (!
|
|
7723
|
+
if (!_this62._IsFetchAPISupported()) {
|
|
7674
7724
|
return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
|
|
7675
7725
|
}
|
|
7676
7726
|
try {
|
|
@@ -7849,10 +7899,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7849
7899
|
}, {
|
|
7850
7900
|
key: "get",
|
|
7851
7901
|
value: function get() {
|
|
7852
|
-
var
|
|
7902
|
+
var _this63 = this;
|
|
7853
7903
|
return new Promise(function (accept, reject) {
|
|
7854
|
-
|
|
7855
|
-
remote_request_1.RemoteRequest.request(
|
|
7904
|
+
_this63._CalculateHash().then(function () {
|
|
7905
|
+
remote_request_1.RemoteRequest.request(_this63._GetPayload(), _this63.retry < 0 ? 0 : _this63.retry).then(accept)["catch"](reject);
|
|
7856
7906
|
})["catch"](function (_err) {
|
|
7857
7907
|
reject(new Error("Configurator.get() - one of the objects does not exist in Plattar API"));
|
|
7858
7908
|
});
|
|
@@ -7861,12 +7911,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7861
7911
|
}, {
|
|
7862
7912
|
key: "_CalculateHash",
|
|
7863
7913
|
value: function _CalculateHash() {
|
|
7864
|
-
var
|
|
7914
|
+
var _this64 = this;
|
|
7865
7915
|
return new Promise(function (accept, reject) {
|
|
7866
7916
|
var promises = [];
|
|
7867
7917
|
var oldOrigin = plattar_api_1.Server["default"]().originLocation.type;
|
|
7868
|
-
plattar_api_1.Server.create(plattar_api_1.Server.match(
|
|
7869
|
-
|
|
7918
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(_this64.server));
|
|
7919
|
+
_this64._maps.forEach(function (map) {
|
|
7870
7920
|
if (map.productvariation) {
|
|
7871
7921
|
promises.push(new plattar_api_1.ProductVariation(map.productvariation).get());
|
|
7872
7922
|
}
|
|
@@ -7882,7 +7932,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7882
7932
|
});
|
|
7883
7933
|
Promise.all(promises).then(function (values) {
|
|
7884
7934
|
values.forEach(function (value) {
|
|
7885
|
-
|
|
7935
|
+
_this64._attrHash.push(value.attributes);
|
|
7886
7936
|
});
|
|
7887
7937
|
// reset server back
|
|
7888
7938
|
plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
|
|
@@ -7969,12 +8019,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7969
8019
|
}, {
|
|
7970
8020
|
key: "get",
|
|
7971
8021
|
value: function get() {
|
|
7972
|
-
var
|
|
8022
|
+
var _this65 = this;
|
|
7973
8023
|
return new Promise(function (accept, reject) {
|
|
7974
|
-
if (!
|
|
8024
|
+
if (!_this65._model) {
|
|
7975
8025
|
return reject(new Error("ModelConverter.get() - required .model attribute was not set"));
|
|
7976
8026
|
}
|
|
7977
|
-
remote_request_1.RemoteRequest.request(
|
|
8027
|
+
remote_request_1.RemoteRequest.request(_this65._Payload, _this65.retry < 0 ? 0 : _this65.retry).then(accept)["catch"](reject);
|
|
7978
8028
|
});
|
|
7979
8029
|
}
|
|
7980
8030
|
}, {
|
|
@@ -8264,18 +8314,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8264
8314
|
}, {
|
|
8265
8315
|
key: "allMappedAttributes",
|
|
8266
8316
|
get: function get() {
|
|
8267
|
-
var
|
|
8317
|
+
var _this66 = this;
|
|
8268
8318
|
var map = new Map();
|
|
8269
8319
|
var coreAttr = this.coreAttributes;
|
|
8270
8320
|
var optAttr = this.optionalAttributes;
|
|
8271
8321
|
coreAttr.forEach(function (ele) {
|
|
8272
|
-
if (
|
|
8273
|
-
map.set(ele.map,
|
|
8322
|
+
if (_this66.hasAttribute(ele.key)) {
|
|
8323
|
+
map.set(ele.map, _this66.getAttribute(ele.key));
|
|
8274
8324
|
}
|
|
8275
8325
|
});
|
|
8276
8326
|
optAttr.forEach(function (ele) {
|
|
8277
|
-
if (
|
|
8278
|
-
map.set(ele.map,
|
|
8327
|
+
if (_this66.hasAttribute(ele.key)) {
|
|
8328
|
+
map.set(ele.map, _this66.getAttribute(ele.key));
|
|
8279
8329
|
}
|
|
8280
8330
|
});
|
|
8281
8331
|
return map;
|
|
@@ -8374,7 +8424,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8374
8424
|
var IFrameController = require("./iframe-controller.js");
|
|
8375
8425
|
var ElementController = /*#__PURE__*/function () {
|
|
8376
8426
|
function ElementController(element) {
|
|
8377
|
-
var
|
|
8427
|
+
var _this67 = this;
|
|
8378
8428
|
_classCallCheck(this, ElementController);
|
|
8379
8429
|
this._element = element;
|
|
8380
8430
|
|
|
@@ -8387,7 +8437,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8387
8437
|
var mutation = _step8.value;
|
|
8388
8438
|
if (mutation.type === 'attributes' && element.usesCoreAttribute(mutation.attributeName)) {
|
|
8389
8439
|
if (element.hasAllCoreAttributes) {
|
|
8390
|
-
|
|
8440
|
+
_this67._load();
|
|
8391
8441
|
}
|
|
8392
8442
|
}
|
|
8393
8443
|
}
|
|
@@ -8482,7 +8532,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8482
8532
|
var Util = require("../../util/util.js");
|
|
8483
8533
|
var IFrameController = /*#__PURE__*/function () {
|
|
8484
8534
|
function IFrameController(element, src, id) {
|
|
8485
|
-
var
|
|
8535
|
+
var _this68 = this;
|
|
8486
8536
|
var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
8487
8537
|
_classCallCheck(this, IFrameController);
|
|
8488
8538
|
this._iframe = document.createElement("iframe");
|
|
@@ -8492,7 +8542,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8492
8542
|
if (!element.hasAttribute("sameorigin")) {
|
|
8493
8543
|
this._iframe.onload = function () {
|
|
8494
8544
|
if (onelemload) {
|
|
8495
|
-
onelemload(
|
|
8545
|
+
onelemload(_this68._iframe);
|
|
8496
8546
|
}
|
|
8497
8547
|
};
|
|
8498
8548
|
}
|
|
@@ -8609,13 +8659,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8609
8659
|
_inherits(EWallElement, _BaseElement4);
|
|
8610
8660
|
var _super76 = _createSuper(EWallElement);
|
|
8611
8661
|
function EWallElement() {
|
|
8612
|
-
var
|
|
8662
|
+
var _this69;
|
|
8613
8663
|
_classCallCheck(this, EWallElement);
|
|
8614
|
-
|
|
8664
|
+
_this69 = _super76.call(this);
|
|
8615
8665
|
var tag = document.createElement("script");
|
|
8616
8666
|
tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
|
|
8617
8667
|
tag.defer = true;
|
|
8618
|
-
return
|
|
8668
|
+
return _this69;
|
|
8619
8669
|
}
|
|
8620
8670
|
_createClass(EWallElement, [{
|
|
8621
8671
|
key: "connectedCallback",
|