@plattar/plattar-ar-adapter 1.155.2 → 1.155.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/es2015/plattar-ar-adapter.js +193 -185
- package/build/es2015/plattar-ar-adapter.min.js +1 -1
- package/build/es2019/plattar-ar-adapter.js +13 -5
- package/build/es2019/plattar-ar-adapter.min.js +1 -1
- package/dist/util/configurator-state.js +12 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -3307,12 +3307,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3307
3307
|
_createClass(ConfiguratorState, [{
|
|
3308
3308
|
key: "setVariationSKU",
|
|
3309
3309
|
value: function setVariationSKU(productVariationSKU) {
|
|
3310
|
-
var
|
|
3311
|
-
|
|
3310
|
+
var _this27 = this;
|
|
3311
|
+
var variationIDs = this._mappedVariationSKUValues.get(productVariationSKU);
|
|
3312
|
+
if (!variationIDs) {
|
|
3312
3313
|
console.warn("ConfiguratorState.setVariationSKU() - Variation SKU of " + productVariationSKU + " is not defined in any variations");
|
|
3313
3314
|
return;
|
|
3314
3315
|
}
|
|
3315
|
-
|
|
3316
|
+
variationIDs.forEach(function (variationID) {
|
|
3317
|
+
_this27.setVariationID(variationID);
|
|
3318
|
+
});
|
|
3316
3319
|
}
|
|
3317
3320
|
/**
|
|
3318
3321
|
* Modifyes the SceneProduct that this Variation belongs to and changes for
|
|
@@ -3669,7 +3672,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3669
3672
|
variations.forEach(function (variation) {
|
|
3670
3673
|
configState._mappedVariationIDValues.set(variation.id, sceneProduct.id);
|
|
3671
3674
|
if (variation.attributes.sku) {
|
|
3672
|
-
configState._mappedVariationSKUValues.
|
|
3675
|
+
var existingSKUs = configState._mappedVariationSKUValues.get(variation.attributes.sku);
|
|
3676
|
+
if (existingSKUs) {
|
|
3677
|
+
existingSKUs.push(variation.id);
|
|
3678
|
+
} else {
|
|
3679
|
+
configState._mappedVariationSKUValues.set(variation.attributes.sku, [variation.id]);
|
|
3680
|
+
}
|
|
3673
3681
|
}
|
|
3674
3682
|
});
|
|
3675
3683
|
}
|
|
@@ -3810,7 +3818,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3810
3818
|
Object.defineProperty(exports, "__esModule", {
|
|
3811
3819
|
value: true
|
|
3812
3820
|
});
|
|
3813
|
-
exports["default"] = "1.155.
|
|
3821
|
+
exports["default"] = "1.155.3";
|
|
3814
3822
|
}, {}],
|
|
3815
3823
|
17: [function (require, module, exports) {
|
|
3816
3824
|
"use strict";
|
|
@@ -3841,13 +3849,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3841
3849
|
_inherits(QuicklookViewer, _ar_viewer_1$default);
|
|
3842
3850
|
var _super11 = _createSuper(QuicklookViewer);
|
|
3843
3851
|
function QuicklookViewer() {
|
|
3844
|
-
var
|
|
3852
|
+
var _this28;
|
|
3845
3853
|
_classCallCheck(this, QuicklookViewer);
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
return
|
|
3854
|
+
_this28 = _super11.call(this);
|
|
3855
|
+
_this28.araction = null;
|
|
3856
|
+
_this28.titleHTML = "&checkoutTitle=" + document.title + "&checkoutSubtitle=" + document.title;
|
|
3857
|
+
_this28.arcallback = function () {};
|
|
3858
|
+
return _this28;
|
|
3851
3859
|
}
|
|
3852
3860
|
_createClass(QuicklookViewer, [{
|
|
3853
3861
|
key: "nodeType",
|
|
@@ -3862,7 +3870,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3862
3870
|
}, {
|
|
3863
3871
|
key: "start",
|
|
3864
3872
|
value: function start() {
|
|
3865
|
-
var
|
|
3873
|
+
var _this29 = this;
|
|
3866
3874
|
if (!this.modelUrl) {
|
|
3867
3875
|
throw new Error("QuicklookViewer.start() - model url not set, use QuicklookViewer.modelUrl");
|
|
3868
3876
|
}
|
|
@@ -3874,7 +3882,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3874
3882
|
if (araction) {
|
|
3875
3883
|
var handleQuicklook = function handleQuicklook(event) {
|
|
3876
3884
|
if (event.data === "_apple_ar_quicklook_button_tapped") {
|
|
3877
|
-
|
|
3885
|
+
_this29.arcallback();
|
|
3878
3886
|
}
|
|
3879
3887
|
document.body.removeChild(anchor);
|
|
3880
3888
|
anchor.removeEventListener("message", handleQuicklook, false);
|
|
@@ -3960,14 +3968,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
3960
3968
|
_inherits(SceneViewer, _ar_viewer_1$default3);
|
|
3961
3969
|
var _super13 = _createSuper(SceneViewer);
|
|
3962
3970
|
function SceneViewer() {
|
|
3963
|
-
var
|
|
3971
|
+
var _this30;
|
|
3964
3972
|
_classCallCheck(this, SceneViewer);
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
return
|
|
3973
|
+
_this30 = _super13.call(this);
|
|
3974
|
+
_this30.araction = null;
|
|
3975
|
+
_this30.isVertical = false;
|
|
3976
|
+
_this30.titleHTML = "<b>" + document.title;
|
|
3977
|
+
_this30.isVertical = false;
|
|
3978
|
+
return _this30;
|
|
3971
3979
|
}
|
|
3972
3980
|
_createClass(SceneViewer, [{
|
|
3973
3981
|
key: "nodeType",
|
|
@@ -4064,16 +4072,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4064
4072
|
*/
|
|
4065
4073
|
var Memory = /*#__PURE__*/function () {
|
|
4066
4074
|
function Memory(messengerInstance) {
|
|
4067
|
-
var
|
|
4075
|
+
var _this31 = this;
|
|
4068
4076
|
_classCallCheck(this, Memory);
|
|
4069
4077
|
this._messenger = messengerInstance;
|
|
4070
4078
|
this._tempMemory = new TemporaryMemory(messengerInstance);
|
|
4071
4079
|
this._permMemory = new PermanentMemory(messengerInstance);
|
|
4072
4080
|
this._messenger.self.__memory__set_temp_var = function (name, data) {
|
|
4073
|
-
|
|
4081
|
+
_this31._tempMemory[name] = data;
|
|
4074
4082
|
};
|
|
4075
4083
|
this._messenger.self.__memory__set_perm_var = function (name, data) {
|
|
4076
|
-
|
|
4084
|
+
_this31._permMemory[name] = data;
|
|
4077
4085
|
};
|
|
4078
4086
|
}
|
|
4079
4087
|
_createClass(Memory, [{
|
|
@@ -4520,17 +4528,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4520
4528
|
}, {
|
|
4521
4529
|
key: "exec",
|
|
4522
4530
|
value: function exec() {
|
|
4523
|
-
var
|
|
4531
|
+
var _this32 = this;
|
|
4524
4532
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
4525
4533
|
args[_key3] = arguments[_key3];
|
|
4526
4534
|
}
|
|
4527
4535
|
return new Promise(function (accept, reject) {
|
|
4528
|
-
if (!
|
|
4529
|
-
return reject(new Error("WrappedLocalFunction.exec() function with name " +
|
|
4536
|
+
if (!_this32._value) {
|
|
4537
|
+
return reject(new Error("WrappedLocalFunction.exec() function with name " + _this32._funcName + "() is not defined"));
|
|
4530
4538
|
}
|
|
4531
4539
|
try {
|
|
4532
4540
|
// otherwise execute the function
|
|
4533
|
-
var rObject =
|
|
4541
|
+
var rObject = _this32._execute.apply(_this32, args);
|
|
4534
4542
|
|
|
4535
4543
|
// we need to check if the returned object is a Promise, if so, handle it
|
|
4536
4544
|
// differently. This can happen if the function wants to execute asyn
|
|
@@ -4596,7 +4604,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4596
4604
|
_createClass(FunctionObserver, [{
|
|
4597
4605
|
key: "subscribe",
|
|
4598
4606
|
value: function subscribe(functionName, callback) {
|
|
4599
|
-
var
|
|
4607
|
+
var _this33 = this;
|
|
4600
4608
|
if (!functionName || !Util.isFunction(callback)) {
|
|
4601
4609
|
return function () {};
|
|
4602
4610
|
}
|
|
@@ -4610,7 +4618,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4610
4618
|
}
|
|
4611
4619
|
list.push(callback);
|
|
4612
4620
|
return function () {
|
|
4613
|
-
return
|
|
4621
|
+
return _this33.unsubscribe(functionName, callback);
|
|
4614
4622
|
};
|
|
4615
4623
|
}
|
|
4616
4624
|
|
|
@@ -4677,7 +4685,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4677
4685
|
*/
|
|
4678
4686
|
var GlobalEventHandler = /*#__PURE__*/function () {
|
|
4679
4687
|
function GlobalEventHandler() {
|
|
4680
|
-
var
|
|
4688
|
+
var _this34 = this;
|
|
4681
4689
|
_classCallCheck(this, GlobalEventHandler);
|
|
4682
4690
|
this._eventListeners = {};
|
|
4683
4691
|
|
|
@@ -4697,11 +4705,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4697
4705
|
// make sure the event is properly formatted
|
|
4698
4706
|
if (jsonData && jsonData.event && jsonData.data) {
|
|
4699
4707
|
// see if there are any listeners for this
|
|
4700
|
-
if (
|
|
4708
|
+
if (_this34._eventListeners[jsonData.event]) {
|
|
4701
4709
|
var remoteInterface = new RemoteInterface(evt.source, evt.origin);
|
|
4702
4710
|
|
|
4703
4711
|
// loop through and call all the event handlers
|
|
4704
|
-
|
|
4712
|
+
_this34._eventListeners[jsonData.event].forEach(function (callback) {
|
|
4705
4713
|
try {
|
|
4706
4714
|
callback(remoteInterface, jsonData.data);
|
|
4707
4715
|
} catch (e) {
|
|
@@ -4893,33 +4901,33 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4893
4901
|
}, {
|
|
4894
4902
|
key: "_registerListeners",
|
|
4895
4903
|
value: function _registerListeners() {
|
|
4896
|
-
var
|
|
4904
|
+
var _this35 = this;
|
|
4897
4905
|
GlobalEventHandler.instance().listen("__messenger__child_init", function (src, data) {
|
|
4898
4906
|
var iframeID = src.id;
|
|
4899
4907
|
|
|
4900
4908
|
// check reserved key list
|
|
4901
4909
|
switch (iframeID) {
|
|
4902
4910
|
case undefined:
|
|
4903
|
-
throw new Error("Messenger[" +
|
|
4911
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID cannot be undefined");
|
|
4904
4912
|
case "self":
|
|
4905
|
-
throw new Error("Messenger[" +
|
|
4913
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
4906
4914
|
case "parent":
|
|
4907
|
-
throw new Error("Messenger[" +
|
|
4915
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
4908
4916
|
case "id":
|
|
4909
|
-
throw new Error("Messenger[" +
|
|
4917
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
4910
4918
|
case "onload":
|
|
4911
|
-
throw new Error("Messenger[" +
|
|
4919
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
4912
4920
|
default:
|
|
4913
4921
|
break;
|
|
4914
4922
|
}
|
|
4915
4923
|
|
|
4916
4924
|
// initialise the child iframe as a messenger pipe
|
|
4917
|
-
|
|
4918
|
-
|
|
4925
|
+
_this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
|
|
4926
|
+
_this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
4919
4927
|
|
|
4920
4928
|
// add the interface to the broadcaster
|
|
4921
|
-
|
|
4922
|
-
var callbacks =
|
|
4929
|
+
_this35._broadcaster._push(iframeID);
|
|
4930
|
+
var callbacks = _this35._callbacks;
|
|
4923
4931
|
|
|
4924
4932
|
// we have registered callbacks, begin execution
|
|
4925
4933
|
if (callbacks.has(iframeID)) {
|
|
@@ -4943,26 +4951,26 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4943
4951
|
// check reserved key list
|
|
4944
4952
|
switch (iframeID) {
|
|
4945
4953
|
case undefined:
|
|
4946
|
-
throw new Error("Messenger[" +
|
|
4954
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID cannot be undefined");
|
|
4947
4955
|
case "self":
|
|
4948
|
-
throw new Error("Messenger[" +
|
|
4956
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"self\" cannot be used as the keyword is reserved");
|
|
4949
4957
|
case "parent":
|
|
4950
|
-
throw new Error("Messenger[" +
|
|
4958
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"parent\" cannot be used as the keyword is reserved");
|
|
4951
4959
|
case "id":
|
|
4952
|
-
throw new Error("Messenger[" +
|
|
4960
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"id\" cannot be used as the keyword is reserved");
|
|
4953
4961
|
case "onload":
|
|
4954
|
-
throw new Error("Messenger[" +
|
|
4962
|
+
throw new Error("Messenger[" + _this35._id + "].setup() Component ID of \"onload\" cannot be used as the keyword is reserved");
|
|
4955
4963
|
default:
|
|
4956
4964
|
break;
|
|
4957
4965
|
}
|
|
4958
4966
|
|
|
4959
4967
|
// initialise the child iframe as a messenger pipe
|
|
4960
|
-
|
|
4961
|
-
|
|
4968
|
+
_this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
|
|
4969
|
+
_this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
4962
4970
|
|
|
4963
4971
|
// add the interface to the broadcaster
|
|
4964
|
-
|
|
4965
|
-
var callbacks =
|
|
4972
|
+
_this35._broadcaster._push(iframeID);
|
|
4973
|
+
var callbacks = _this35._callbacks;
|
|
4966
4974
|
|
|
4967
4975
|
// we have registered callbacks, begin execution
|
|
4968
4976
|
if (callbacks.has(iframeID)) {
|
|
@@ -4981,9 +4989,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4981
4989
|
});
|
|
4982
4990
|
GlobalEventHandler.instance().listen("__messenger__parent_init", function (src, data) {
|
|
4983
4991
|
var iframeID = "parent";
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
var callbacks =
|
|
4992
|
+
_this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
|
|
4993
|
+
_this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
4994
|
+
var callbacks = _this35._callbacks;
|
|
4987
4995
|
|
|
4988
4996
|
// we have registered callbacks, begin execution
|
|
4989
4997
|
if (callbacks.has(iframeID)) {
|
|
@@ -5007,9 +5015,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5007
5015
|
*/
|
|
5008
5016
|
GlobalEventHandler.instance().listen("__messenger__parent_init_inv", function (src, data) {
|
|
5009
5017
|
var iframeID = "parent";
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
var callbacks =
|
|
5018
|
+
_this35[iframeID] = new RemoteFunctionList(iframeID, _this35._functionObserver);
|
|
5019
|
+
_this35[iframeID].setup(new RemoteInterface(src.source, src.origin));
|
|
5020
|
+
var callbacks = _this35._callbacks;
|
|
5013
5021
|
|
|
5014
5022
|
// we have registered callbacks, begin execution
|
|
5015
5023
|
if (callbacks.has(iframeID)) {
|
|
@@ -5231,7 +5239,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5231
5239
|
*/
|
|
5232
5240
|
var WrappedRemoteFunction = /*#__PURE__*/function () {
|
|
5233
5241
|
function WrappedRemoteFunction(funcName, remoteInterface, functionObserver) {
|
|
5234
|
-
var
|
|
5242
|
+
var _this36 = this;
|
|
5235
5243
|
_classCallCheck(this, WrappedRemoteFunction);
|
|
5236
5244
|
this._funcName = funcName;
|
|
5237
5245
|
this._remoteInterface = remoteInterface;
|
|
@@ -5243,24 +5251,24 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5243
5251
|
var instanceID = data.instance_id;
|
|
5244
5252
|
|
|
5245
5253
|
// the function name must match
|
|
5246
|
-
if (data.function_name !==
|
|
5254
|
+
if (data.function_name !== _this36._funcName) {
|
|
5247
5255
|
return;
|
|
5248
5256
|
}
|
|
5249
5257
|
|
|
5250
5258
|
// the instance ID must be found, otherwise this is a rogue execution
|
|
5251
5259
|
// that can be ignored (should not happen)
|
|
5252
|
-
if (!
|
|
5260
|
+
if (!_this36._callInstances[instanceID]) {
|
|
5253
5261
|
return;
|
|
5254
5262
|
}
|
|
5255
|
-
var promise =
|
|
5263
|
+
var promise = _this36._callInstances[instanceID];
|
|
5256
5264
|
|
|
5257
5265
|
// remove the old instance
|
|
5258
|
-
delete
|
|
5266
|
+
delete _this36._callInstances[instanceID];
|
|
5259
5267
|
|
|
5260
5268
|
// perform the promise callbacks
|
|
5261
5269
|
if (data.function_status === "success") {
|
|
5262
5270
|
// execute the observers
|
|
5263
|
-
|
|
5271
|
+
_this36._functionObserver.call(_this36._funcName, {
|
|
5264
5272
|
type: "return",
|
|
5265
5273
|
state: "success",
|
|
5266
5274
|
data: data.function_args
|
|
@@ -5268,7 +5276,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5268
5276
|
promise.accept(data.function_args);
|
|
5269
5277
|
} else {
|
|
5270
5278
|
// execute the observers
|
|
5271
|
-
|
|
5279
|
+
_this36._functionObserver.call(_this36._funcName, {
|
|
5272
5280
|
type: "return",
|
|
5273
5281
|
state: "exception",
|
|
5274
5282
|
data: new Error(data.function_args)
|
|
@@ -5284,7 +5292,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5284
5292
|
_createClass(WrappedRemoteFunction, [{
|
|
5285
5293
|
key: "exec",
|
|
5286
5294
|
value: function exec() {
|
|
5287
|
-
var
|
|
5295
|
+
var _this37 = this;
|
|
5288
5296
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
5289
5297
|
args[_key4] = arguments[_key4];
|
|
5290
5298
|
}
|
|
@@ -5303,20 +5311,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5303
5311
|
// to be executed later
|
|
5304
5312
|
return new Promise(function (accept, reject) {
|
|
5305
5313
|
// save this promise to be executed later
|
|
5306
|
-
|
|
5314
|
+
_this37._callInstances[instanceID] = {
|
|
5307
5315
|
accept: accept,
|
|
5308
5316
|
reject: reject
|
|
5309
5317
|
};
|
|
5310
5318
|
|
|
5311
5319
|
// execute this event in another context
|
|
5312
|
-
|
|
5320
|
+
_this37._remoteInterface.send("__messenger__exec_fnc", {
|
|
5313
5321
|
instance_id: instanceID,
|
|
5314
|
-
function_name:
|
|
5322
|
+
function_name: _this37._funcName,
|
|
5315
5323
|
function_args: args
|
|
5316
5324
|
});
|
|
5317
5325
|
|
|
5318
5326
|
// execute the observers
|
|
5319
|
-
|
|
5327
|
+
_this37._functionObserver.call(_this37._funcName, {
|
|
5320
5328
|
type: "call",
|
|
5321
5329
|
state: "success",
|
|
5322
5330
|
data: args
|
|
@@ -5465,7 +5473,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5465
5473
|
var google_analytics_1 = require("./google/google-analytics");
|
|
5466
5474
|
var Analytics = /*#__PURE__*/function () {
|
|
5467
5475
|
function Analytics(applicationID) {
|
|
5468
|
-
var
|
|
5476
|
+
var _this38 = this;
|
|
5469
5477
|
_classCallCheck(this, Analytics);
|
|
5470
5478
|
this._pageTime = null;
|
|
5471
5479
|
this.origin = "production";
|
|
@@ -5479,17 +5487,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5479
5487
|
this._ga = new google_analytics_1.GoogleAnalytics();
|
|
5480
5488
|
this._handlePageHide = function () {
|
|
5481
5489
|
if (document.visibilityState === "hidden") {
|
|
5482
|
-
|
|
5483
|
-
} else if (
|
|
5490
|
+
_this38._pageTime = new Date();
|
|
5491
|
+
} else if (_this38._pageTime) {
|
|
5484
5492
|
var time2 = new Date();
|
|
5485
|
-
var diff = time2.getTime() -
|
|
5486
|
-
var data =
|
|
5493
|
+
var diff = time2.getTime() - _this38._pageTime.getTime();
|
|
5494
|
+
var data = _this38.data;
|
|
5487
5495
|
data.push("eventAction", "View Time");
|
|
5488
5496
|
data.push("viewTime", diff);
|
|
5489
5497
|
data.push("eventLabel", diff);
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
document.removeEventListener("visibilitychange",
|
|
5498
|
+
_this38.write();
|
|
5499
|
+
_this38._pageTime = null;
|
|
5500
|
+
document.removeEventListener("visibilitychange", _this38._handlePageHide, false);
|
|
5493
5501
|
}
|
|
5494
5502
|
};
|
|
5495
5503
|
}
|
|
@@ -5501,18 +5509,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5501
5509
|
}, {
|
|
5502
5510
|
key: "query",
|
|
5503
5511
|
value: function query() {
|
|
5504
|
-
var
|
|
5512
|
+
var _this39 = this;
|
|
5505
5513
|
var _query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
5506
5514
|
return new Promise(function (accept, reject) {
|
|
5507
5515
|
if (!_query) {
|
|
5508
5516
|
return reject(new Error("Analytics.query() - provided query was null"));
|
|
5509
5517
|
}
|
|
5510
|
-
var url =
|
|
5518
|
+
var url = _this39.origin === "dev" ? "https://localhost:3008/v3/read" : "https://analytics.plattar.com/v3/read";
|
|
5511
5519
|
var data = {
|
|
5512
5520
|
data: {
|
|
5513
5521
|
attributes: {
|
|
5514
|
-
application_id:
|
|
5515
|
-
event:
|
|
5522
|
+
application_id: _this39._applicationID,
|
|
5523
|
+
event: _this39.event,
|
|
5516
5524
|
query: _query
|
|
5517
5525
|
}
|
|
5518
5526
|
}
|
|
@@ -5525,22 +5533,22 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5525
5533
|
}, {
|
|
5526
5534
|
key: "write",
|
|
5527
5535
|
value: function write() {
|
|
5528
|
-
var
|
|
5536
|
+
var _this40 = this;
|
|
5529
5537
|
return new Promise(function (accept, reject) {
|
|
5530
|
-
var data =
|
|
5531
|
-
var url =
|
|
5532
|
-
data.push("applicationId",
|
|
5538
|
+
var data = _this40._data;
|
|
5539
|
+
var url = _this40.origin === "dev" ? "https://localhost:3008/v3/write" : "https://analytics.plattar.com/v3/write";
|
|
5540
|
+
data.push("applicationId", _this40._applicationID);
|
|
5533
5541
|
var sendData = {
|
|
5534
5542
|
data: {
|
|
5535
5543
|
attributes: {
|
|
5536
|
-
application_id:
|
|
5537
|
-
event:
|
|
5538
|
-
origin:
|
|
5544
|
+
application_id: _this40._applicationID,
|
|
5545
|
+
event: _this40.event,
|
|
5546
|
+
origin: _this40.origin,
|
|
5539
5547
|
fields: data.data
|
|
5540
5548
|
}
|
|
5541
5549
|
}
|
|
5542
5550
|
};
|
|
5543
|
-
if (
|
|
5551
|
+
if (_this40.isBeacon === false) {
|
|
5544
5552
|
basic_http_1["default"].exec("POST", url, sendData).then(function (result) {
|
|
5545
5553
|
accept(result ? result : {});
|
|
5546
5554
|
})["catch"](reject);
|
|
@@ -5549,7 +5557,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5549
5557
|
accept(result ? result : {});
|
|
5550
5558
|
})["catch"](reject);
|
|
5551
5559
|
}
|
|
5552
|
-
|
|
5560
|
+
_this40.googleAnalytics.write(_this40.event, _this40.data);
|
|
5553
5561
|
});
|
|
5554
5562
|
}
|
|
5555
5563
|
}, {
|
|
@@ -6101,10 +6109,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6101
6109
|
}, {
|
|
6102
6110
|
key: "_get",
|
|
6103
6111
|
value: function _get(opt) {
|
|
6104
|
-
var
|
|
6112
|
+
var _this41 = this;
|
|
6105
6113
|
return new Promise(function (resolve, reject) {
|
|
6106
|
-
var target =
|
|
6107
|
-
var server =
|
|
6114
|
+
var target = _this41.target;
|
|
6115
|
+
var server = _this41.server;
|
|
6108
6116
|
|
|
6109
6117
|
// we cannot perform a GET request without an ID
|
|
6110
6118
|
if (!target.id) {
|
|
@@ -6129,15 +6137,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6129
6137
|
var origin = server.originLocation.api_read;
|
|
6130
6138
|
var auth = server.authToken;
|
|
6131
6139
|
var headers = {
|
|
6132
|
-
'cookie': 'laravel_session=' +
|
|
6140
|
+
'cookie': 'laravel_session=' + _this41.getCookie('laravel_session')
|
|
6133
6141
|
};
|
|
6134
6142
|
Object.assign(headers, auth);
|
|
6135
6143
|
var reqopts = {
|
|
6136
6144
|
method: "GET",
|
|
6137
6145
|
headers: headers
|
|
6138
6146
|
};
|
|
6139
|
-
var includeQuery =
|
|
6140
|
-
var params =
|
|
6147
|
+
var includeQuery = _this41._IncludeQuery;
|
|
6148
|
+
var params = _this41._ParamFor("get");
|
|
6141
6149
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
6142
6150
|
if (includeQuery) {
|
|
6143
6151
|
endpoint = endpoint + "?include=" + includeQuery;
|
|
@@ -6172,10 +6180,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6172
6180
|
}, {
|
|
6173
6181
|
key: "_update",
|
|
6174
6182
|
value: function _update() {
|
|
6175
|
-
var
|
|
6183
|
+
var _this42 = this;
|
|
6176
6184
|
return new Promise(function (resolve, reject) {
|
|
6177
|
-
var target =
|
|
6178
|
-
var server =
|
|
6185
|
+
var target = _this42.target;
|
|
6186
|
+
var server = _this42.server;
|
|
6179
6187
|
|
|
6180
6188
|
// we cannot perform a GET request without an ID
|
|
6181
6189
|
if (!target.id) {
|
|
@@ -6189,7 +6197,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6189
6197
|
var headers = {
|
|
6190
6198
|
'Accept': 'application/json',
|
|
6191
6199
|
'Content-Type': 'application/json',
|
|
6192
|
-
'cookie': 'laravel_session=' +
|
|
6200
|
+
'cookie': 'laravel_session=' + _this42.getCookie('laravel_session')
|
|
6193
6201
|
};
|
|
6194
6202
|
Object.assign(headers, auth);
|
|
6195
6203
|
var reqopts = {
|
|
@@ -6203,7 +6211,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6203
6211
|
meta: target.meta || {}
|
|
6204
6212
|
})
|
|
6205
6213
|
};
|
|
6206
|
-
var params =
|
|
6214
|
+
var params = _this42._ParamFor("update");
|
|
6207
6215
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
6208
6216
|
if (params) {
|
|
6209
6217
|
var appender = "?";
|
|
@@ -6239,10 +6247,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6239
6247
|
}, {
|
|
6240
6248
|
key: "_create",
|
|
6241
6249
|
value: function _create() {
|
|
6242
|
-
var
|
|
6250
|
+
var _this43 = this;
|
|
6243
6251
|
return new Promise(function (resolve, reject) {
|
|
6244
|
-
var target =
|
|
6245
|
-
var server =
|
|
6252
|
+
var target = _this43.target;
|
|
6253
|
+
var server = _this43.server;
|
|
6246
6254
|
|
|
6247
6255
|
// otherwise, proceed with the fetching op
|
|
6248
6256
|
var origin = server.originLocation.api_write;
|
|
@@ -6250,7 +6258,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6250
6258
|
var headers = {
|
|
6251
6259
|
'Accept': 'application/json',
|
|
6252
6260
|
'Content-Type': 'application/json',
|
|
6253
|
-
'cookie': 'laravel_session=' +
|
|
6261
|
+
'cookie': 'laravel_session=' + _this43.getCookie('laravel_session')
|
|
6254
6262
|
};
|
|
6255
6263
|
Object.assign(headers, auth);
|
|
6256
6264
|
var reqopts = {
|
|
@@ -6263,7 +6271,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6263
6271
|
meta: target.meta || {}
|
|
6264
6272
|
})
|
|
6265
6273
|
};
|
|
6266
|
-
var params =
|
|
6274
|
+
var params = _this43._ParamFor("create");
|
|
6267
6275
|
var endpoint = origin + target.type();
|
|
6268
6276
|
if (params) {
|
|
6269
6277
|
var appender = "?";
|
|
@@ -6300,10 +6308,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6300
6308
|
}, {
|
|
6301
6309
|
key: "_delete",
|
|
6302
6310
|
value: function _delete() {
|
|
6303
|
-
var
|
|
6311
|
+
var _this44 = this;
|
|
6304
6312
|
return new Promise(function (resolve, reject) {
|
|
6305
|
-
var target =
|
|
6306
|
-
var server =
|
|
6313
|
+
var target = _this44.target;
|
|
6314
|
+
var server = _this44.server;
|
|
6307
6315
|
|
|
6308
6316
|
// we cannot perform a GET request without an ID
|
|
6309
6317
|
if (!target.id) {
|
|
@@ -6317,7 +6325,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6317
6325
|
var headers = {
|
|
6318
6326
|
'Accept': 'application/json',
|
|
6319
6327
|
'Content-Type': 'application/json',
|
|
6320
|
-
'cookie': 'laravel_session=' +
|
|
6328
|
+
'cookie': 'laravel_session=' + _this44.getCookie('laravel_session')
|
|
6321
6329
|
};
|
|
6322
6330
|
Object.assign(headers, auth);
|
|
6323
6331
|
var reqopts = {
|
|
@@ -6331,7 +6339,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6331
6339
|
meta: target.meta || {}
|
|
6332
6340
|
})
|
|
6333
6341
|
};
|
|
6334
|
-
var params =
|
|
6342
|
+
var params = _this44._ParamFor("delete");
|
|
6335
6343
|
var endpoint = origin + target.type() + "/" + target.id;
|
|
6336
6344
|
if (params) {
|
|
6337
6345
|
var appender = "?";
|
|
@@ -6386,7 +6394,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6386
6394
|
}, {
|
|
6387
6395
|
key: "_include",
|
|
6388
6396
|
value: function _include(args) {
|
|
6389
|
-
var
|
|
6397
|
+
var _this45 = this;
|
|
6390
6398
|
if (!args || args.length <= 0) {
|
|
6391
6399
|
return this;
|
|
6392
6400
|
}
|
|
@@ -6396,20 +6404,20 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6396
6404
|
if (Array.isArray(obj)) {
|
|
6397
6405
|
obj.forEach(function (strObject) {
|
|
6398
6406
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
6399
|
-
|
|
6407
|
+
_this45._getIncludeQuery.push(strObject);
|
|
6400
6408
|
} else {
|
|
6401
|
-
throw new Error("PlattarQuery." +
|
|
6409
|
+
throw new Error("PlattarQuery." + _this45.target.type() + ".include(...args) - argument of Array must only include Strings");
|
|
6402
6410
|
}
|
|
6403
6411
|
});
|
|
6404
6412
|
} else if (PlattarUtil.isPlattarObject(obj)) {
|
|
6405
6413
|
var type = obj.type();
|
|
6406
6414
|
if (Array.isArray(type)) {
|
|
6407
|
-
|
|
6415
|
+
_this45._include(type);
|
|
6408
6416
|
} else {
|
|
6409
|
-
|
|
6417
|
+
_this45._getIncludeQuery.push(type);
|
|
6410
6418
|
}
|
|
6411
6419
|
} else {
|
|
6412
|
-
throw new Error("PlattarQuery." +
|
|
6420
|
+
throw new Error("PlattarQuery." + _this45.target.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
|
|
6413
6421
|
}
|
|
6414
6422
|
});
|
|
6415
6423
|
return this;
|
|
@@ -6544,12 +6552,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6544
6552
|
}, {
|
|
6545
6553
|
key: "auth",
|
|
6546
6554
|
value: function auth(token, opt) {
|
|
6547
|
-
var
|
|
6555
|
+
var _this46 = this;
|
|
6548
6556
|
var copt = opt || {
|
|
6549
6557
|
validate: false
|
|
6550
6558
|
};
|
|
6551
6559
|
return new Promise(function (resolve, reject) {
|
|
6552
|
-
var server =
|
|
6560
|
+
var server = _this46.originLocation.api_write;
|
|
6553
6561
|
if (!server) {
|
|
6554
6562
|
reject(new Error("Plattar.auth(token) - cannot authenticate as server not set via Plattar.origin(server)"));
|
|
6555
6563
|
return;
|
|
@@ -6559,10 +6567,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6559
6567
|
return;
|
|
6560
6568
|
}
|
|
6561
6569
|
if (!copt.validate) {
|
|
6562
|
-
|
|
6570
|
+
_this46._authToken = {
|
|
6563
6571
|
"plattar-auth-token": token
|
|
6564
6572
|
};
|
|
6565
|
-
resolve(
|
|
6573
|
+
resolve(_this46);
|
|
6566
6574
|
return;
|
|
6567
6575
|
}
|
|
6568
6576
|
var endpoint = server + "plattaruser/xauth/validate";
|
|
@@ -6574,10 +6582,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6574
6582
|
};
|
|
6575
6583
|
fetch(endpoint, options).then(function (res) {
|
|
6576
6584
|
if (res.ok) {
|
|
6577
|
-
|
|
6585
|
+
_this46._authToken = {
|
|
6578
6586
|
"plattar-auth-token": token
|
|
6579
6587
|
};
|
|
6580
|
-
resolve(
|
|
6588
|
+
resolve(_this46);
|
|
6581
6589
|
} else {
|
|
6582
6590
|
reject(new Error("Plattar.auth(token) - failed to validate authentication token at " + endpoint));
|
|
6583
6591
|
}
|
|
@@ -6587,7 +6595,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6587
6595
|
}, {
|
|
6588
6596
|
key: "origin",
|
|
6589
6597
|
value: function origin(server, opt) {
|
|
6590
|
-
var
|
|
6598
|
+
var _this47 = this;
|
|
6591
6599
|
var copt = opt || {
|
|
6592
6600
|
validate: false
|
|
6593
6601
|
};
|
|
@@ -6597,8 +6605,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6597
6605
|
return;
|
|
6598
6606
|
}
|
|
6599
6607
|
if (!copt.validate) {
|
|
6600
|
-
|
|
6601
|
-
resolve(
|
|
6608
|
+
_this47._serverLocation = server;
|
|
6609
|
+
resolve(_this47);
|
|
6602
6610
|
return;
|
|
6603
6611
|
}
|
|
6604
6612
|
var endpoint = server.api_read + "ping";
|
|
@@ -6607,8 +6615,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6607
6615
|
};
|
|
6608
6616
|
fetch(endpoint, options).then(function (res) {
|
|
6609
6617
|
if (res.ok) {
|
|
6610
|
-
|
|
6611
|
-
resolve(
|
|
6618
|
+
_this47._serverLocation = server;
|
|
6619
|
+
resolve(_this47);
|
|
6612
6620
|
} else {
|
|
6613
6621
|
reject(new Error("Plattar.origin(server) - failed to ping server at " + endpoint));
|
|
6614
6622
|
}
|
|
@@ -6942,13 +6950,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
6942
6950
|
_inherits(FileBase, _PlattarBase11);
|
|
6943
6951
|
var _super25 = _createSuper(FileBase);
|
|
6944
6952
|
function FileBase(id, server) {
|
|
6945
|
-
var
|
|
6953
|
+
var _this48;
|
|
6946
6954
|
_classCallCheck(this, FileBase);
|
|
6947
|
-
|
|
6948
|
-
if (
|
|
6955
|
+
_this48 = _super25.call(this, id, server || Server["default"]());
|
|
6956
|
+
if (_this48.constructor === FileBase) {
|
|
6949
6957
|
throw new Error("FileBase is abstract and cannot be created");
|
|
6950
6958
|
}
|
|
6951
|
-
return
|
|
6959
|
+
return _this48;
|
|
6952
6960
|
}
|
|
6953
6961
|
_createClass(FileBase, [{
|
|
6954
6962
|
key: "sourcePath",
|
|
@@ -7101,13 +7109,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7101
7109
|
_inherits(PlattarBase, _PlattarObject);
|
|
7102
7110
|
var _super30 = _createSuper(PlattarBase);
|
|
7103
7111
|
function PlattarBase(id, server) {
|
|
7104
|
-
var
|
|
7112
|
+
var _this49;
|
|
7105
7113
|
_classCallCheck(this, PlattarBase);
|
|
7106
|
-
|
|
7107
|
-
if (
|
|
7114
|
+
_this49 = _super30.call(this, id, server || Server["default"]());
|
|
7115
|
+
if (_this49.constructor === PlattarBase) {
|
|
7108
7116
|
throw new Error("PlattarBase is abstract and cannot be created");
|
|
7109
7117
|
}
|
|
7110
|
-
return
|
|
7118
|
+
return _this49;
|
|
7111
7119
|
}
|
|
7112
7120
|
return _createClass(PlattarBase);
|
|
7113
7121
|
}(PlattarObject);
|
|
@@ -7174,7 +7182,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7174
7182
|
}, {
|
|
7175
7183
|
key: "filter",
|
|
7176
7184
|
value: function filter(obj, id) {
|
|
7177
|
-
var
|
|
7185
|
+
var _this50 = this;
|
|
7178
7186
|
if (!obj) {
|
|
7179
7187
|
return [];
|
|
7180
7188
|
}
|
|
@@ -7190,7 +7198,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7190
7198
|
if (Array.isArray(type)) {
|
|
7191
7199
|
var compiledList = [];
|
|
7192
7200
|
type.forEach(function (inObject) {
|
|
7193
|
-
var retArray =
|
|
7201
|
+
var retArray = _this50.filter(inObject, id);
|
|
7194
7202
|
if (retArray.length > 0) {
|
|
7195
7203
|
compiledList = compiledList.concat(retArray);
|
|
7196
7204
|
}
|
|
@@ -7378,7 +7386,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7378
7386
|
}, {
|
|
7379
7387
|
key: "include",
|
|
7380
7388
|
value: function include() {
|
|
7381
|
-
var
|
|
7389
|
+
var _this51 = this;
|
|
7382
7390
|
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
7383
7391
|
args[_key6] = arguments[_key6];
|
|
7384
7392
|
}
|
|
@@ -7391,15 +7399,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7391
7399
|
if (Array.isArray(obj)) {
|
|
7392
7400
|
obj.forEach(function (strObject) {
|
|
7393
7401
|
if (typeof strObject === "string" || strObject instanceof String) {
|
|
7394
|
-
includes.push("".concat(
|
|
7402
|
+
includes.push("".concat(_this51.type(), ".").concat(strObject));
|
|
7395
7403
|
} else {
|
|
7396
|
-
throw new Error("PlattarObject." +
|
|
7404
|
+
throw new Error("PlattarObject." + _this51.type() + ".include(...args) - argument of Array must only include Strings");
|
|
7397
7405
|
}
|
|
7398
7406
|
});
|
|
7399
7407
|
} else if (obj.prototype instanceof PlattarObject) {
|
|
7400
|
-
includes.push("".concat(
|
|
7408
|
+
includes.push("".concat(_this51.type(), ".").concat(obj.type()));
|
|
7401
7409
|
} else {
|
|
7402
|
-
throw new Error("PlattarObject." +
|
|
7410
|
+
throw new Error("PlattarObject." + _this51.type() + ".include(...args) - argument must be of type PlattarObject or Array but was type=" + _typeof(obj) + " value=" + obj);
|
|
7403
7411
|
}
|
|
7404
7412
|
});
|
|
7405
7413
|
return includes;
|
|
@@ -7529,13 +7537,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7529
7537
|
_inherits(CardBase, _PlattarBase17);
|
|
7530
7538
|
var _super36 = _createSuper(CardBase);
|
|
7531
7539
|
function CardBase(id, server) {
|
|
7532
|
-
var
|
|
7540
|
+
var _this52;
|
|
7533
7541
|
_classCallCheck(this, CardBase);
|
|
7534
|
-
|
|
7535
|
-
if (
|
|
7542
|
+
_this52 = _super36.call(this, id, server || Server["default"]());
|
|
7543
|
+
if (_this52.constructor === CardBase) {
|
|
7536
7544
|
throw new Error("CardBase is abstract and cannot be created");
|
|
7537
7545
|
}
|
|
7538
|
-
return
|
|
7546
|
+
return _this52;
|
|
7539
7547
|
}
|
|
7540
7548
|
_createClass(CardBase, null, [{
|
|
7541
7549
|
key: "type",
|
|
@@ -7852,13 +7860,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7852
7860
|
_inherits(ProductBase, _PlattarBase19);
|
|
7853
7861
|
var _super50 = _createSuper(ProductBase);
|
|
7854
7862
|
function ProductBase(id, server) {
|
|
7855
|
-
var
|
|
7863
|
+
var _this53;
|
|
7856
7864
|
_classCallCheck(this, ProductBase);
|
|
7857
|
-
|
|
7858
|
-
if (
|
|
7865
|
+
_this53 = _super50.call(this, id, server || Server["default"]());
|
|
7866
|
+
if (_this53.constructor === ProductBase) {
|
|
7859
7867
|
throw new Error("ProductBase is abstract and cannot be created");
|
|
7860
7868
|
}
|
|
7861
|
-
return
|
|
7869
|
+
return _this53;
|
|
7862
7870
|
}
|
|
7863
7871
|
_createClass(ProductBase, null, [{
|
|
7864
7872
|
key: "type",
|
|
@@ -7968,13 +7976,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
7968
7976
|
_inherits(SceneBase, _PlattarBase21);
|
|
7969
7977
|
var _super55 = _createSuper(SceneBase);
|
|
7970
7978
|
function SceneBase(id, server) {
|
|
7971
|
-
var
|
|
7979
|
+
var _this54;
|
|
7972
7980
|
_classCallCheck(this, SceneBase);
|
|
7973
|
-
|
|
7974
|
-
if (
|
|
7981
|
+
_this54 = _super55.call(this, id, server || Server["default"]());
|
|
7982
|
+
if (_this54.constructor === SceneBase) {
|
|
7975
7983
|
throw new Error("SceneBase is abstract and cannot be created");
|
|
7976
7984
|
}
|
|
7977
|
-
return
|
|
7985
|
+
return _this54;
|
|
7978
7986
|
}
|
|
7979
7987
|
_createClass(SceneBase, null, [{
|
|
7980
7988
|
key: "type",
|
|
@@ -8677,15 +8685,15 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8677
8685
|
_createClass(BaseElement, [{
|
|
8678
8686
|
key: "connectedCallback",
|
|
8679
8687
|
value: function connectedCallback() {
|
|
8680
|
-
var
|
|
8688
|
+
var _this55 = this;
|
|
8681
8689
|
if (this.hasAttribute("url")) {
|
|
8682
8690
|
this.renderQRCode();
|
|
8683
8691
|
}
|
|
8684
8692
|
var observer = new MutationObserver(function (mutations) {
|
|
8685
8693
|
mutations.forEach(function (mutation) {
|
|
8686
8694
|
if (mutation.type === "attributes") {
|
|
8687
|
-
if (
|
|
8688
|
-
|
|
8695
|
+
if (_this55.hasAttribute("url")) {
|
|
8696
|
+
_this55.renderQRCode();
|
|
8689
8697
|
}
|
|
8690
8698
|
}
|
|
8691
8699
|
});
|
|
@@ -8708,7 +8716,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8708
8716
|
}, {
|
|
8709
8717
|
key: "renderQRCode",
|
|
8710
8718
|
value: function renderQRCode() {
|
|
8711
|
-
var
|
|
8719
|
+
var _this56 = this;
|
|
8712
8720
|
var url = this.hasAttribute("url") ? this.getAttribute("url") : undefined;
|
|
8713
8721
|
if (!url) {
|
|
8714
8722
|
console.warn("PlattarQR.renderQRCode() - required attribute \"url\" is missing or invalid, QR Code will not render");
|
|
@@ -8816,11 +8824,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8816
8824
|
var shortenURL = this.hasAttribute("shorten") ? this.getAttribute("shorten") : "false";
|
|
8817
8825
|
if (shortenURL && shortenURL.toLowerCase() === "true") {
|
|
8818
8826
|
this._ShortenURL(url).then(function (newURL) {
|
|
8819
|
-
|
|
8827
|
+
_this56._GenerateQRCode(newURL, width, height);
|
|
8820
8828
|
})["catch"](function (_err) {
|
|
8821
8829
|
console.warn(_err);
|
|
8822
8830
|
// ignore error and just generate normal QR Code
|
|
8823
|
-
|
|
8831
|
+
_this56._GenerateQRCode(url, width, height);
|
|
8824
8832
|
});
|
|
8825
8833
|
} else {
|
|
8826
8834
|
this._GenerateQRCode(url, width, height);
|
|
@@ -8889,9 +8897,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
8889
8897
|
}, {
|
|
8890
8898
|
key: "_ShortenURL",
|
|
8891
8899
|
value: function _ShortenURL(url) {
|
|
8892
|
-
var
|
|
8900
|
+
var _this57 = this;
|
|
8893
8901
|
return new Promise(function (accept, reject) {
|
|
8894
|
-
if (!
|
|
8902
|
+
if (!_this57._IsFetchAPISupported()) {
|
|
8895
8903
|
return reject(new Error("PlattarQR._ShortenURL() - fetch api not supported, cannot proceed"));
|
|
8896
8904
|
}
|
|
8897
8905
|
try {
|
|
@@ -9084,10 +9092,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9084
9092
|
}, {
|
|
9085
9093
|
key: "get",
|
|
9086
9094
|
value: function get() {
|
|
9087
|
-
var
|
|
9095
|
+
var _this58 = this;
|
|
9088
9096
|
return new Promise(function (accept, reject) {
|
|
9089
|
-
|
|
9090
|
-
remote_request_1.RemoteRequest.request(
|
|
9097
|
+
_this58._CalculateHash().then(function () {
|
|
9098
|
+
remote_request_1.RemoteRequest.request(_this58._GetPayload(), _this58.retry < 0 ? 0 : _this58.retry).then(accept)["catch"](reject);
|
|
9091
9099
|
})["catch"](function (_err) {
|
|
9092
9100
|
reject(new Error("Configurator.get() - one of the objects does not exist in Plattar API"));
|
|
9093
9101
|
});
|
|
@@ -9096,12 +9104,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9096
9104
|
}, {
|
|
9097
9105
|
key: "_CalculateHash",
|
|
9098
9106
|
value: function _CalculateHash() {
|
|
9099
|
-
var
|
|
9107
|
+
var _this59 = this;
|
|
9100
9108
|
return new Promise(function (accept, reject) {
|
|
9101
9109
|
var promises = [];
|
|
9102
9110
|
var oldOrigin = plattar_api_1.Server["default"]().originLocation.type;
|
|
9103
|
-
plattar_api_1.Server.create(plattar_api_1.Server.match(
|
|
9104
|
-
|
|
9111
|
+
plattar_api_1.Server.create(plattar_api_1.Server.match(_this59.server));
|
|
9112
|
+
_this59._maps.forEach(function (map) {
|
|
9105
9113
|
if (map.productvariation) {
|
|
9106
9114
|
promises.push(new plattar_api_1.ProductVariation(map.productvariation).get());
|
|
9107
9115
|
}
|
|
@@ -9117,7 +9125,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9117
9125
|
});
|
|
9118
9126
|
Promise.all(promises).then(function (values) {
|
|
9119
9127
|
values.forEach(function (value) {
|
|
9120
|
-
|
|
9128
|
+
_this59._attrHash.push(value.attributes);
|
|
9121
9129
|
});
|
|
9122
9130
|
// reset server back
|
|
9123
9131
|
plattar_api_1.Server.create(plattar_api_1.Server.match(oldOrigin));
|
|
@@ -9204,12 +9212,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
9204
9212
|
}, {
|
|
9205
9213
|
key: "get",
|
|
9206
9214
|
value: function get() {
|
|
9207
|
-
var
|
|
9215
|
+
var _this60 = this;
|
|
9208
9216
|
return new Promise(function (accept, reject) {
|
|
9209
|
-
if (!
|
|
9217
|
+
if (!_this60._model) {
|
|
9210
9218
|
return reject(new Error("ModelConverter.get() - required .model attribute was not set"));
|
|
9211
9219
|
}
|
|
9212
|
-
remote_request_1.RemoteRequest.request(
|
|
9220
|
+
remote_request_1.RemoteRequest.request(_this60._Payload, _this60.retry < 0 ? 0 : _this60.retry).then(accept)["catch"](reject);
|
|
9213
9221
|
});
|
|
9214
9222
|
}
|
|
9215
9223
|
}, {
|
|
@@ -10574,18 +10582,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10574
10582
|
}, {
|
|
10575
10583
|
key: "allMappedAttributes",
|
|
10576
10584
|
get: function get() {
|
|
10577
|
-
var
|
|
10585
|
+
var _this61 = this;
|
|
10578
10586
|
var map = new Map();
|
|
10579
10587
|
var coreAttr = this.coreAttributes;
|
|
10580
10588
|
var optAttr = this.optionalAttributes;
|
|
10581
10589
|
coreAttr.forEach(function (ele) {
|
|
10582
|
-
if (
|
|
10583
|
-
map.set(ele.map,
|
|
10590
|
+
if (_this61.hasAttribute(ele.key)) {
|
|
10591
|
+
map.set(ele.map, _this61.getAttribute(ele.key));
|
|
10584
10592
|
}
|
|
10585
10593
|
});
|
|
10586
10594
|
optAttr.forEach(function (ele) {
|
|
10587
|
-
if (
|
|
10588
|
-
map.set(ele.map,
|
|
10595
|
+
if (_this61.hasAttribute(ele.key)) {
|
|
10596
|
+
map.set(ele.map, _this61.getAttribute(ele.key));
|
|
10589
10597
|
}
|
|
10590
10598
|
});
|
|
10591
10599
|
return map;
|
|
@@ -10685,7 +10693,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10685
10693
|
var IFrameController = require("./iframe-controller.js");
|
|
10686
10694
|
var ElementController = /*#__PURE__*/function () {
|
|
10687
10695
|
function ElementController(element) {
|
|
10688
|
-
var
|
|
10696
|
+
var _this62 = this;
|
|
10689
10697
|
_classCallCheck(this, ElementController);
|
|
10690
10698
|
this._element = element;
|
|
10691
10699
|
|
|
@@ -10698,7 +10706,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10698
10706
|
var mutation = _step8.value;
|
|
10699
10707
|
if (mutation.type === 'attributes' && element.usesAttribute(mutation.attributeName)) {
|
|
10700
10708
|
if (element.hasAllCoreAttributes) {
|
|
10701
|
-
|
|
10709
|
+
_this62._load();
|
|
10702
10710
|
}
|
|
10703
10711
|
}
|
|
10704
10712
|
}
|
|
@@ -10793,7 +10801,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10793
10801
|
var Util = require("../../util/util.js");
|
|
10794
10802
|
var IFrameController = /*#__PURE__*/function () {
|
|
10795
10803
|
function IFrameController(element, src, id) {
|
|
10796
|
-
var
|
|
10804
|
+
var _this63 = this;
|
|
10797
10805
|
var onelemload = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
10798
10806
|
_classCallCheck(this, IFrameController);
|
|
10799
10807
|
this._iframe = document.createElement("iframe");
|
|
@@ -10803,7 +10811,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10803
10811
|
if (!element.hasAttribute("sameorigin")) {
|
|
10804
10812
|
this._iframe.onload = function () {
|
|
10805
10813
|
if (onelemload) {
|
|
10806
|
-
onelemload(
|
|
10814
|
+
onelemload(_this63._iframe);
|
|
10807
10815
|
}
|
|
10808
10816
|
};
|
|
10809
10817
|
}
|
|
@@ -10920,13 +10928,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
10920
10928
|
_inherits(EWallElement, _BaseElement4);
|
|
10921
10929
|
var _super76 = _createSuper(EWallElement);
|
|
10922
10930
|
function EWallElement() {
|
|
10923
|
-
var
|
|
10931
|
+
var _this64;
|
|
10924
10932
|
_classCallCheck(this, EWallElement);
|
|
10925
|
-
|
|
10933
|
+
_this64 = _super76.call(this);
|
|
10926
10934
|
var tag = document.createElement("script");
|
|
10927
10935
|
tag.src = "https://cdn.8thwall.com/web/iframe/iframe.js";
|
|
10928
10936
|
tag.defer = true;
|
|
10929
|
-
return
|
|
10937
|
+
return _this64;
|
|
10930
10938
|
}
|
|
10931
10939
|
_createClass(EWallElement, [{
|
|
10932
10940
|
key: "connectedCallback",
|