dbm 1.1.7 → 1.1.8
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/flow/index.js +0 -2
- package/flow/updatefunctions/dom/TransformStyle.js +51 -0
- package/flow/updatefunctions/dom/index.js +2 -1
- package/flow/updatefunctions/index.js +2 -1
- package/flow/updatefunctions/thirdparty/index.js +1 -0
- package/flow/updatefunctions/thirdparty/threejs/UpdateObjectPosition.js +48 -0
- package/flow/updatefunctions/thirdparty/threejs/index.js +26 -0
- package/graphapi/webclient/ApiConnection.js +81 -0
- package/graphapi/webclient/CachedRequests.js +107 -0
- package/graphapi/webclient/GraphApi.js +19 -3
- package/graphapi/webclient/WebSocketConnection.js +21 -5
- package/graphapi/webclient/index.js +4 -0
- package/package.json +1 -1
- package/react/BaseObject.js +10 -0
- package/react/cookies/CookieBar.js +47 -9
- package/react/cookies/CookieSettings.js +18 -3
- package/tracking/DataLayerTracker.js +14 -2
package/flow/index.js
CHANGED
|
@@ -67,8 +67,6 @@ export const animateValue = function(aValue, aTime = 0.5, aEasing = null) {
|
|
|
67
67
|
returnObject._internal_addProperty("output", outputProperty);
|
|
68
68
|
|
|
69
69
|
let updateCommand = Dbm.flow.addUpdateCommand(inputProperty, Dbm.commands.callFunction(function(aItem) {
|
|
70
|
-
console.log("animate value");
|
|
71
|
-
|
|
72
70
|
aItem.properties.output.animateValue(aItem.input, aItem.time, aItem.easing);
|
|
73
71
|
}, [returnObject]));
|
|
74
72
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import Dbm from "../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class TransformStyle extends Dbm.flow.updatefunctions.basic.CombineString {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.stringCombiners = [];
|
|
9
|
+
this.input.delimeter = " ";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
addSingleValueOperation(aOperation, aValue, aUnit = "") {
|
|
13
|
+
let newCombineString = new Dbm.flow.updatefunctions.basic.CombineString();
|
|
14
|
+
newCombineString.addParts(aOperation, "(", aValue, aUnit, ")");
|
|
15
|
+
this.stringCombiners.push(newCombineString);
|
|
16
|
+
|
|
17
|
+
this.addPart(newCombineString.output.properties.value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
addDoubleValueOperation(aOperation, aValue1, aUnit1 = "", aValue2, aUnit2 = "") {
|
|
21
|
+
let newCombineString = new Dbm.flow.updatefunctions.basic.CombineString();
|
|
22
|
+
newCombineString.addParts(aOperation, "(", aValue1, aUnit1, ", ", aValue2, aUnit2, ")");
|
|
23
|
+
this.stringCombiners.push(newCombineString);
|
|
24
|
+
|
|
25
|
+
this.addPart(newCombineString.output.properties.value);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
translate(aValue1, aUnit1 = "px", aValue2, aUnit2 = "px") {
|
|
29
|
+
this.addDoubleValueOperation("translate", aValue1, aUnit1, aValue2, aUnit2);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
translateX(aValue, aUnit = "px") {
|
|
33
|
+
this.addSingleValueOperation("translateX", aValue, aUnit);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
translateY(aValue, aUnit = "px") {
|
|
37
|
+
this.addSingleValueOperation("translateY", aValue, aUnit);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
uniformScale(aValue, aUnit = "") {
|
|
41
|
+
this.addDoubleValueOperation("scale", aValue, aUnit, aValue, aUnit);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
rotate(aValue, aUnit = "deg") {
|
|
45
|
+
this.addSingleValueOperation("rotate", aValue, aUnit);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
perspective(aValue, aUnit = "px") {
|
|
49
|
+
this.addSingleValueOperation("perspective", aValue, aUnit);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export {default as ElementSize} from "./ElementSize.js";
|
|
2
2
|
export {default as StyleObject} from "./StyleObject.js";
|
|
3
3
|
export {default as HorizontalFlip} from "./HorizontalFlip.js";
|
|
4
|
-
export {default as ElementPosition} from "./ElementPosition.js";
|
|
4
|
+
export {default as ElementPosition} from "./ElementPosition.js";
|
|
5
|
+
export {default as TransformStyle} from "./TransformStyle.js";
|
|
@@ -2,4 +2,5 @@ export * as logic from "./logic/index.js";
|
|
|
2
2
|
export * as debug from "./debug/index.js";
|
|
3
3
|
export * as react from "./react/index.js";
|
|
4
4
|
export * as basic from "./basic/index.js";
|
|
5
|
-
export * as dom from "./dom/index.js";
|
|
5
|
+
export * as dom from "./dom/index.js";
|
|
6
|
+
export * as thirdparty from "./thirdparty/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as threejs from "./threejs/index.js";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Dbm from "../../../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class UpdateObjectPosition extends Dbm.flow.FlowUpdateFunction {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.input.register("object", null);
|
|
9
|
+
this.input.register("x", 0);
|
|
10
|
+
this.input.register("y", 0);
|
|
11
|
+
this.input.register("z", 0);
|
|
12
|
+
|
|
13
|
+
this.input.register("rotationX", 0);
|
|
14
|
+
this.input.register("rotationY", 0);
|
|
15
|
+
this.input.register("rotationZ", 0);
|
|
16
|
+
|
|
17
|
+
this.input.register("scaleX", 1);
|
|
18
|
+
this.input.register("scaleY", 1);
|
|
19
|
+
this.input.register("scaleZ", 1);
|
|
20
|
+
|
|
21
|
+
this.output.register("dynamicUpdate", 0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_update() {
|
|
25
|
+
//console.log("UpdateObjectPosition::_update");
|
|
26
|
+
|
|
27
|
+
let dynamicUpdate = this.output.dynamicUpdate;
|
|
28
|
+
dynamicUpdate++;
|
|
29
|
+
|
|
30
|
+
let object = this.input.object;
|
|
31
|
+
|
|
32
|
+
if(object) {
|
|
33
|
+
object.position.x = this.input.x;
|
|
34
|
+
object.position.y = this.input.y;
|
|
35
|
+
object.position.z = this.input.z;
|
|
36
|
+
|
|
37
|
+
object.rotation.x = this.input.rotationX;
|
|
38
|
+
object.rotation.y = this.input.rotationY;
|
|
39
|
+
object.rotation.z = this.input.rotationZ;
|
|
40
|
+
|
|
41
|
+
object.scale.x = this.input.scaleX;
|
|
42
|
+
object.scale.y = this.input.scaleY;
|
|
43
|
+
object.scale.z = this.input.scaleY;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this.output.dynamicUpdate = dynamicUpdate;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Dbm from "../../../../index.js";
|
|
2
|
+
|
|
3
|
+
export {default as UpdateObjectPosition} from "./UpdateObjectPosition.js";
|
|
4
|
+
|
|
5
|
+
export const updateObjectPosition = function(aObject, aX = 0, aY = 0, aZ = 0, aRotationX = 0, aRotationY = 0, aRotationZ = 0, aScaleX = 1, aScaleY = 1, aScaleZ = 1) {
|
|
6
|
+
let newUpdateObjectPosition = new Dbm.flow.updatefunctions.thirdparty.threejs.UpdateObjectPosition();
|
|
7
|
+
|
|
8
|
+
let inputProperties = newUpdateObjectPosition.input.properties;
|
|
9
|
+
inputProperties.object.setOrConnect(aObject);
|
|
10
|
+
|
|
11
|
+
inputProperties.x.setOrConnect(aX);
|
|
12
|
+
inputProperties.y.setOrConnect(aY);
|
|
13
|
+
inputProperties.z.setOrConnect(aZ);
|
|
14
|
+
|
|
15
|
+
inputProperties.rotationX.setOrConnect(aRotationX);
|
|
16
|
+
inputProperties.rotationY.setOrConnect(aRotationY);
|
|
17
|
+
inputProperties.rotationZ.setOrConnect(aRotationZ);
|
|
18
|
+
|
|
19
|
+
inputProperties.scaleX.setOrConnect(aScaleX);
|
|
20
|
+
inputProperties.scaleY.setOrConnect(aScaleY);
|
|
21
|
+
inputProperties.scaleZ.setOrConnect(aScaleZ);
|
|
22
|
+
|
|
23
|
+
newUpdateObjectPosition.output.properties.dynamicUpdate.startUpdating();
|
|
24
|
+
|
|
25
|
+
return newUpdateObjectPosition;
|
|
26
|
+
}
|
|
@@ -6,6 +6,8 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
6
6
|
|
|
7
7
|
this._url = null;
|
|
8
8
|
this._setupItemResponseBound = this._setupItemResponse.bind(this);
|
|
9
|
+
this._setupItemsResponseBound = this._setupItemsResponse.bind(this);
|
|
10
|
+
this._setupDataResponseBound = this._setupDataResponse.bind(this);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
setup(aUrl) {
|
|
@@ -26,7 +28,32 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
26
28
|
|
|
27
29
|
requestRange(aSelect, aEncode) {
|
|
28
30
|
let item = this._getRequestItem();
|
|
31
|
+
|
|
32
|
+
let selectArray = [];
|
|
33
|
+
let encodeString = aEncode.join(",");
|
|
34
|
+
let parametersArray = [];
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
let currentArray = aSelect;
|
|
38
|
+
let currentArrayLength = currentArray.length;
|
|
39
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
40
|
+
let currentSelect = currentArray[i];
|
|
41
|
+
selectArray.push(currentSelect.type);
|
|
42
|
+
|
|
43
|
+
for(let objectName in currentSelect) {
|
|
44
|
+
if(objectName !== "type") {
|
|
45
|
+
parametersArray.push(objectName + "=" + encodeURIComponent(currentSelect[objectName]));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
29
50
|
|
|
51
|
+
let fullUrl = this._url + "range/" + selectArray.join(",") + "/" + encodeString + "?" + parametersArray.join("&");
|
|
52
|
+
fetch(fullUrl).then((aRequest) => {
|
|
53
|
+
return aRequest.json();
|
|
54
|
+
}).then((aData) => {
|
|
55
|
+
this._setupItemsResponseBound(item, aData);
|
|
56
|
+
});
|
|
30
57
|
|
|
31
58
|
return item;
|
|
32
59
|
}
|
|
@@ -34,17 +61,41 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
34
61
|
requestItem(aId, aEncode) {
|
|
35
62
|
let item = this._getRequestItem();
|
|
36
63
|
|
|
64
|
+
let encodeString = aEncode.join(",");
|
|
65
|
+
|
|
66
|
+
let fullUrl = this._url + "item/" + aId + "/" + encodeString;
|
|
67
|
+
fetch(fullUrl).then((aRequest) => {
|
|
68
|
+
return aRequest.json();
|
|
69
|
+
}).then((aData) => {
|
|
70
|
+
this._setupItemResponseBound(item, aData);
|
|
71
|
+
});
|
|
37
72
|
|
|
38
73
|
return item;
|
|
39
74
|
}
|
|
40
75
|
|
|
41
76
|
requestData(aFunctionName, aData) {
|
|
42
77
|
let item = this._getRequestItem();
|
|
78
|
+
|
|
79
|
+
let parametersArray = [];
|
|
80
|
+
|
|
81
|
+
for(let objectName in aData) {
|
|
82
|
+
if(objectName !== "type") {
|
|
83
|
+
parametersArray.push(objectName + "=" + encodeURIComponent(aData[objectName]));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
43
86
|
|
|
87
|
+
let fullUrl = this._url + "data/" + aFunctionName + "?" + parametersArray.join("&");
|
|
88
|
+
fetch(fullUrl).then((aRequest) => {
|
|
89
|
+
return aRequest.json();
|
|
90
|
+
}).then((aData) => {
|
|
91
|
+
this._setupDataResponseBound(item, aData);
|
|
92
|
+
});
|
|
44
93
|
|
|
45
94
|
return item;
|
|
46
95
|
}
|
|
47
96
|
|
|
97
|
+
//METODO: action
|
|
98
|
+
|
|
48
99
|
createItem(aTypes, aVisibility = "draft", aChanges = [], aEncode = []) {
|
|
49
100
|
let item = this._getRequestItem();
|
|
50
101
|
|
|
@@ -76,6 +127,22 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
76
127
|
}
|
|
77
128
|
}
|
|
78
129
|
}
|
|
130
|
+
|
|
131
|
+
_setupItemsResponse(aRequestItem, aData) {
|
|
132
|
+
this._updateObjects(aData.objects);
|
|
133
|
+
|
|
134
|
+
let repository = Dbm.getInstance().repository;
|
|
135
|
+
|
|
136
|
+
let ids = aData.data.ids;
|
|
137
|
+
if(ids) {
|
|
138
|
+
aRequestItem.setValue("items", repository.getItems(ids));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
aRequestItem.setValue("items", []);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
aRequestItem.status = 1;
|
|
145
|
+
}
|
|
79
146
|
|
|
80
147
|
_setupItemResponse(aRequestItem, aData) {
|
|
81
148
|
this._updateObjects(aData.objects);
|
|
@@ -93,6 +160,20 @@ export default class ApiConnection extends Dbm.core.BaseObject {
|
|
|
93
160
|
aRequestItem.status = 1;
|
|
94
161
|
}
|
|
95
162
|
|
|
163
|
+
_setupDataResponse(aRequestItem, aData) {
|
|
164
|
+
this._updateObjects(aData.objects);
|
|
165
|
+
|
|
166
|
+
let data = aData.data;
|
|
167
|
+
if(data) {
|
|
168
|
+
aRequestItem.setValue("data", data);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
aRequestItem.setValue("data", null);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
aRequestItem.status = 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
96
177
|
requestUrl(aUrl) {
|
|
97
178
|
|
|
98
179
|
let item = this._getRequestItem();
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
|
|
3
|
+
export default class CachedRequests extends Dbm.core.BaseObject {
|
|
4
|
+
_construct() {
|
|
5
|
+
super._construct();
|
|
6
|
+
|
|
7
|
+
this._ranges = {};
|
|
8
|
+
this._items = {};
|
|
9
|
+
this._data = {};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
_getRangeIdentifier(aSelect, aEncode) {
|
|
13
|
+
let selects = [];
|
|
14
|
+
let paramters = [];
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
let currentArray = aSelect;
|
|
18
|
+
let currentArrayLength = currentArray.length;
|
|
19
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
20
|
+
let currentSelect = currentArray[i];
|
|
21
|
+
selects.push(currentSelect.type);
|
|
22
|
+
|
|
23
|
+
for(let objectName in currentSelect) {
|
|
24
|
+
if(objectName !== "type") {
|
|
25
|
+
paramters.push(objectName + "=" + encodeURIComponent(currentSelect[objectName]));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
selects.sort();
|
|
32
|
+
paramters.sort();
|
|
33
|
+
|
|
34
|
+
let returnString = selects.join(",") + "/" + this._getEncodeIdentifier(aEncode) + "?" + paramters.join("&");
|
|
35
|
+
|
|
36
|
+
return returnString;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_getEncodeIdentifier(aEncode) {
|
|
40
|
+
let encodes = [].concat(aEncode).sort();
|
|
41
|
+
return encodes.join(",");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
requestRange(aSelect, aEncode) {
|
|
45
|
+
console.log("requestRange");
|
|
46
|
+
|
|
47
|
+
let id = this._getRangeIdentifier(aSelect, aEncode);
|
|
48
|
+
console.log(id);
|
|
49
|
+
|
|
50
|
+
if(this._ranges[id]) {
|
|
51
|
+
return this._ranges[id];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
55
|
+
let request = graphApi.requestRange(aSelect, aEncode);
|
|
56
|
+
|
|
57
|
+
this._ranges[id] = request;
|
|
58
|
+
return request;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
requestItem(aId, aEncode) {
|
|
62
|
+
console.log("requestItem");
|
|
63
|
+
|
|
64
|
+
let id = aId + "/" + this._getEncodeIdentifier(aEncode);
|
|
65
|
+
console.log(id);
|
|
66
|
+
|
|
67
|
+
if(this._items[id]) {
|
|
68
|
+
return this._items[id];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
72
|
+
let request = graphApi.requestItem(aId, aEncode);
|
|
73
|
+
|
|
74
|
+
this._items[id] = request;
|
|
75
|
+
return request;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
requestData(aFunctionName, aData) {
|
|
79
|
+
let paramters = [];
|
|
80
|
+
for(let objectName in aData) {
|
|
81
|
+
if(objectName !== "type") {
|
|
82
|
+
paramters.push(objectName + "=" + encodeURIComponent(aData[objectName]));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
paramters.sort();
|
|
87
|
+
|
|
88
|
+
let id = aFunctionName + "?" + paramters.join("&");
|
|
89
|
+
console.log(">>>>>>>>>", id);
|
|
90
|
+
|
|
91
|
+
if(this._data[id]) {
|
|
92
|
+
return this._data[id];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
96
|
+
let request = graphApi.requestData(aFunctionName, aData);
|
|
97
|
+
|
|
98
|
+
this._data[id] = request;
|
|
99
|
+
return request;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
requestUrl(aUrl) {
|
|
103
|
+
//console.log("requestUrl");
|
|
104
|
+
//console.log(aUrl);
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -21,15 +21,31 @@ export default class GraphApi extends Dbm.core.BaseObject {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
requestRange(aSelect, aEncode) {
|
|
24
|
-
|
|
24
|
+
console.log("requestRange");
|
|
25
|
+
|
|
26
|
+
if(this._websocketConnection && this._websocketConnection.item.status === 1) {
|
|
27
|
+
return this._websocketConnection.requestRange(aSelect, aEncode);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return this._apiConnection.requestRange(aSelect, aEncode);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
requestItem(aId, aEncode) {
|
|
28
|
-
|
|
34
|
+
console.log("requestItem");
|
|
35
|
+
|
|
36
|
+
if(this._websocketConnection && this._websocketConnection.item.status === 1) {
|
|
37
|
+
return this._websocketConnection.requestItem(aId, aEncode);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this._apiConnection.requestItem(aId, aEncode);
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
requestData(aFunctionName, aData) {
|
|
32
|
-
|
|
44
|
+
if(this._websocketConnection && this._websocketConnection.item.status === 1) {
|
|
45
|
+
return this._websocketConnection.requestData(aFunctionName, aData);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return this._apiConnection.requestData(aFunctionName, aData);
|
|
33
49
|
}
|
|
34
50
|
|
|
35
51
|
performAction(aFunctionName, aData) {
|
|
@@ -6,6 +6,7 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
|
|
|
6
6
|
|
|
7
7
|
this._url = null;
|
|
8
8
|
this._webSocket = null;
|
|
9
|
+
this._reconnectIfDisconnected = false;
|
|
9
10
|
|
|
10
11
|
this._intervalId = -1;
|
|
11
12
|
this._callback_onOpenBound = this._callback_onOpen.bind(this);
|
|
@@ -28,8 +29,16 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
|
|
|
28
29
|
|
|
29
30
|
_connect() {
|
|
30
31
|
if(this.item.status === 0) {
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
this.item.setValue("status", 2);
|
|
33
|
+
try{
|
|
34
|
+
this._webSocket = new WebSocket(this._url);
|
|
35
|
+
}
|
|
36
|
+
catch(theError) {
|
|
37
|
+
this._webSocket = null;;
|
|
38
|
+
this.item.setValue("status", 0);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
|
|
34
43
|
this._webSocket.onopen = this._callback_onOpenBound;
|
|
35
44
|
this._webSocket.onmessage = this._callback_onMessageBound;
|
|
@@ -128,6 +137,7 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
|
|
|
128
137
|
if(this._intervalId === -1) {
|
|
129
138
|
this._intervalId = setInterval(this._callback_sendHeartbeatBound, 20*1000);
|
|
130
139
|
}
|
|
140
|
+
this._reconnectIfDisconnected = true;
|
|
131
141
|
}
|
|
132
142
|
|
|
133
143
|
_callback_onClose(aEvent) {
|
|
@@ -149,13 +159,19 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
|
|
|
149
159
|
}
|
|
150
160
|
|
|
151
161
|
this.item.setValue("status", 0);
|
|
152
|
-
|
|
162
|
+
|
|
163
|
+
if(this._reconnectIfDisconnected) {
|
|
164
|
+
this._connect();
|
|
165
|
+
}
|
|
153
166
|
}
|
|
154
167
|
|
|
155
168
|
_callback_onError(aEvent) {
|
|
156
|
-
console.log("_callback_onError");
|
|
157
|
-
console.log(aEvent);
|
|
169
|
+
//console.log("_callback_onError");
|
|
170
|
+
//console.log(aEvent);
|
|
158
171
|
|
|
172
|
+
if(this._reconnectIfDisconnected) {
|
|
173
|
+
console.log(aEvent);;
|
|
174
|
+
}
|
|
159
175
|
//MENOTE: do nothing
|
|
160
176
|
}
|
|
161
177
|
|
|
@@ -5,6 +5,7 @@ export {default as WebSocketRequest} from "./WebSocketRequest.js";
|
|
|
5
5
|
export {default as GraphApi} from "./GraphApi.js";
|
|
6
6
|
export {default as ApiConnection} from "./ApiConnection.js";
|
|
7
7
|
export {default as ApiRequest} from "./ApiRequest.js";
|
|
8
|
+
export {default as CachedRequests} from "./CachedRequests.js";
|
|
8
9
|
|
|
9
10
|
export * as decode from "./decode/index.js";
|
|
10
11
|
export * as admin from "./admin/index.js";
|
|
@@ -20,4 +21,7 @@ export const setup = function(aWsPath, aApiPath) {
|
|
|
20
21
|
graphApi.setWebsocketConnection(webSocketConnection);
|
|
21
22
|
graphApi.setApiConnection(apiConnection);
|
|
22
23
|
graphApi.item.register("graphApi");
|
|
24
|
+
|
|
25
|
+
let cachedRequests = new Dbm.graphapi.webclient.CachedRequests();
|
|
26
|
+
cachedRequests.item.register("cachedGraphApi");
|
|
23
27
|
}
|
package/package.json
CHANGED
package/react/BaseObject.js
CHANGED
|
@@ -98,6 +98,16 @@ export default class BaseObject extends Component {
|
|
|
98
98
|
return currentProp;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
getPropValueWithDefault(aName, aDefaultValue) {
|
|
102
|
+
let value = this.getPropValue(aName);
|
|
103
|
+
|
|
104
|
+
if(!value) {
|
|
105
|
+
value = aDefaultValue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
|
|
101
111
|
createRef(aName) {
|
|
102
112
|
let refToProperty = this.item["ref/" + aName];
|
|
103
113
|
|
|
@@ -6,7 +6,24 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
6
6
|
_construct() {
|
|
7
7
|
super._construct();
|
|
8
8
|
|
|
9
|
-
this.getDynamicProp("open", false);
|
|
9
|
+
let openProperty = this.getDynamicProp("open", false);
|
|
10
|
+
this.item.requireProperty("envelope", 0);
|
|
11
|
+
|
|
12
|
+
let stateToEnvelope = Dbm.flow.updatefunctions.logic.switchValue(openProperty).setDefaultValue(100).addCase(true, 0);
|
|
13
|
+
let inDomCase = Dbm.flow.updatefunctions.logic.switchValue(this.item.properties.envelope).setDefaultValue(true).addCase(100, false);
|
|
14
|
+
|
|
15
|
+
this.item.requireProperty("inDom", false).connectInput(inDomCase.output.properties.value);
|
|
16
|
+
|
|
17
|
+
let animation = new Dbm.flow.animateValue(stateToEnvelope.output.properties.value);
|
|
18
|
+
|
|
19
|
+
this.item.properties.envelope.connectInput(animation.properties.output);
|
|
20
|
+
|
|
21
|
+
let transform = new Dbm.flow.updatefunctions.dom.TransformStyle();
|
|
22
|
+
transform.translateY(animation.properties.output, "%");
|
|
23
|
+
|
|
24
|
+
let style = new Dbm.flow.updatefunctions.dom.StyleObject();
|
|
25
|
+
style.addProperty("transform", transform.output.properties.value);
|
|
26
|
+
this.item.requireProperty("style", null).connectInput(style.output.properties.style);
|
|
10
27
|
|
|
11
28
|
let shouldShow = Cookies.get("cookie/hideCookieBar") !== "1";
|
|
12
29
|
|
|
@@ -108,10 +125,25 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
108
125
|
this.item.properties.element.connectInput(layoutSwitch.output.properties.value);
|
|
109
126
|
}
|
|
110
127
|
|
|
128
|
+
_getDomain() {
|
|
129
|
+
|
|
130
|
+
let parts = document.location.hostname.split('.');
|
|
131
|
+
|
|
132
|
+
let length = parts.length;
|
|
133
|
+
if (length === 1) {
|
|
134
|
+
return parts[0];
|
|
135
|
+
}
|
|
136
|
+
else if(parts[length-2] === "co" && parts[length-1] === "uk") {
|
|
137
|
+
return '.' + parts.slice(-3).join('.');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return '.' + parts.slice(-2).join('.');
|
|
141
|
+
}
|
|
142
|
+
|
|
111
143
|
_acceptAll() {
|
|
112
144
|
console.log("_acceptAll");
|
|
113
145
|
|
|
114
|
-
let options = {"expires": 365};
|
|
146
|
+
let options = {"expires": 365, "domain": this._getDomain()};
|
|
115
147
|
|
|
116
148
|
Cookies.set("cookie/allowPreferences", "1", options);
|
|
117
149
|
Cookies.set("cookie/allowStatistics", "1", options);
|
|
@@ -120,7 +152,7 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
120
152
|
|
|
121
153
|
let consentTime = (new Date()).toISOString();
|
|
122
154
|
|
|
123
|
-
Cookies.set("cookie/consentTime", consentTime);
|
|
155
|
+
Cookies.set("cookie/consentTime", consentTime, options);
|
|
124
156
|
|
|
125
157
|
Dbm.getInstance().repository.getItem("trackingController").allowStatistics = true;
|
|
126
158
|
Dbm.getInstance().repository.getItem("trackingController").allowMarketing = true;
|
|
@@ -130,7 +162,7 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
130
162
|
|
|
131
163
|
_rejectAll() {
|
|
132
164
|
|
|
133
|
-
let options = {"expires": 365};
|
|
165
|
+
let options = {"expires": 365, "domain": this._getDomain()};
|
|
134
166
|
|
|
135
167
|
Cookies.set("cookie/allowPreferences", "0", options);
|
|
136
168
|
Cookies.set("cookie/allowStatistics", "0", options);
|
|
@@ -139,7 +171,7 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
139
171
|
|
|
140
172
|
let consentTime = (new Date()).toISOString();
|
|
141
173
|
|
|
142
|
-
Cookies.set("cookie/consentTime", consentTime);
|
|
174
|
+
Cookies.set("cookie/consentTime", consentTime, options);
|
|
143
175
|
|
|
144
176
|
Dbm.getInstance().repository.getItem("trackingController").allowStatistics = false;
|
|
145
177
|
Dbm.getInstance().repository.getItem("trackingController").allowMarketing = false;
|
|
@@ -149,10 +181,16 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
149
181
|
|
|
150
182
|
_renderMainElement() {
|
|
151
183
|
|
|
152
|
-
return this._createMainElement("div", {className: "cookie-bar-position", ref: this.createRef("widthElement")},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
184
|
+
return this._createMainElement("div", {className: "cookie-bar-position no-pointer-events", ref: this.createRef("widthElement")},
|
|
185
|
+
React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.inDom},
|
|
186
|
+
React.createElement("div", {className: "overflow-hidden"},
|
|
187
|
+
React.createElement(Dbm.react.BaseObject, {style: this.item.properties.style},
|
|
188
|
+
React.createElement("div", {className: "all-pointer-events"},
|
|
189
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
190
|
+
)
|
|
191
|
+
)
|
|
192
|
+
)
|
|
193
|
+
)
|
|
156
194
|
);
|
|
157
195
|
}
|
|
158
196
|
}
|
|
@@ -59,11 +59,26 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
59
59
|
return currentItem;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
_getDomain() {
|
|
63
|
+
|
|
64
|
+
let parts = document.location.hostname.split('.');
|
|
65
|
+
|
|
66
|
+
let length = parts.length;
|
|
67
|
+
if (length === 1) {
|
|
68
|
+
return parts[0];
|
|
69
|
+
}
|
|
70
|
+
else if(parts[length-2] === "co" && parts[length-1] === "uk") {
|
|
71
|
+
return '.' + parts.slice(-3).join('.');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return '.' + parts.slice(-2).join('.');
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
_save() {
|
|
63
78
|
console.log("_save");
|
|
64
79
|
|
|
65
80
|
let settings = this.item.settings;
|
|
66
|
-
let options = {"expires": 365};
|
|
81
|
+
let options = {"expires": 365, "domain": this._getDomain()};
|
|
67
82
|
|
|
68
83
|
let currentArray = settings;
|
|
69
84
|
let currentArrayLength = currentArray.length;
|
|
@@ -85,8 +100,8 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
85
100
|
|
|
86
101
|
let consentTime = (new Date()).toISOString();
|
|
87
102
|
|
|
88
|
-
Cookies.set("cookie/consentTime", consentTime)
|
|
89
|
-
this.item.setValue("consentTime", consentTime
|
|
103
|
+
Cookies.set("cookie/consentTime", consentTime, options);
|
|
104
|
+
this.item.setValue("consentTime", consentTime);
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
_renderMainElement() {
|
|
@@ -3,6 +3,9 @@ import Dbm from "../index.js";
|
|
|
3
3
|
export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
4
4
|
_construct() {
|
|
5
5
|
super._construct();
|
|
6
|
+
|
|
7
|
+
this._statisticsTracking = false;
|
|
8
|
+
this._marketingTracking = false;
|
|
6
9
|
}
|
|
7
10
|
|
|
8
11
|
addToDataLayer(aData) {
|
|
@@ -35,6 +38,7 @@ export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
|
35
38
|
|
|
36
39
|
startStatisticsTracking() {
|
|
37
40
|
|
|
41
|
+
this._statisticsTracking = true;
|
|
38
42
|
this._gtag("consent", "update", {
|
|
39
43
|
"analytics_storage": "granted"
|
|
40
44
|
});
|
|
@@ -46,6 +50,7 @@ export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
|
46
50
|
|
|
47
51
|
startMarketingTracking() {
|
|
48
52
|
|
|
53
|
+
this._marketingTracking = true;
|
|
49
54
|
this._gtag("consent", "update", {
|
|
50
55
|
"ad_storage": "granted",
|
|
51
56
|
"ad_user_data": "granted",
|
|
@@ -66,8 +71,15 @@ export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
|
66
71
|
console.log("trackEvent");
|
|
67
72
|
console.log(aEventName, aData);
|
|
68
73
|
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
if(this._statisticsTracking) {
|
|
75
|
+
this.addToDataLayer({"event": "trackEvent", "value": {"name": aEventName, "data": aData}});
|
|
76
|
+
this._gtag("event", aEventName, aData);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if(this._marketingTracking) {
|
|
80
|
+
this.addToDataLayer({"event": "trackMarketingEvent", "value": {"name": aEventName, "data": aData}});
|
|
81
|
+
this._gtag("event", "Marketing / " + aEventName, aData);
|
|
82
|
+
}
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
trackCurrentPage() {
|