dbm 1.4.8 → 1.4.9
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/commands/IncreaseProperty.js +19 -0
- package/commands/index.js +9 -0
- package/ecommerce/Cart.js +31 -25
- package/ecommerce/CartLineItem.js +22 -2
- package/ecommerce/LocalStorageCartLoader.js +23 -2
- package/graphapi/webclient/admin/ItemEditor.js +1 -1
- package/package.json +1 -1
- package/react/admin/editor/fields/EditorBlocks.js +62 -0
- package/react/admin/editor/fields/index.js +2 -1
- package/react/area/ResponsiveLayout.js +1 -1
- package/react/area/RowOrStacked.js +74 -0
- package/react/area/SelectResponsiveLayout.js +77 -0
- package/react/area/index.js +2 -0
- package/react/context/AddItemToContext.js +1 -1
- package/react/cookies/CookieBar.js +42 -22
- package/react/cookies/CookieOverlayMessage.js +30 -16
- package/react/cookies/CookieSettings.js +39 -23
- package/repository/index.js +4 -0
- package/site/index.js +2 -0
- package/tracking/Controller.js +27 -42
- package/tracking/DataLayerTracker.js +18 -2
- package/utils/ArrayFunctions.js +41 -0
- package/utils/KeywordReplace.js +1 -2
- package/utils/LocalCache.js +36 -0
- package/utils/NamedArray.js +91 -0
- package/utils/index.js +2 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
import CommandBaseObject from "./CommandBaseObject.js"
|
|
3
|
+
|
|
4
|
+
export default class IncreaseProperty extends CommandBaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.setValue("property", null);
|
|
9
|
+
this.item.setValue("value", 1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
perform(aFromObject, aData) {
|
|
13
|
+
|
|
14
|
+
let value = this.getInputFrom("value", aFromObject, aData);
|
|
15
|
+
|
|
16
|
+
let property = this._resolveSourceWithoutFlow(this.item.property, aFromObject, aData);
|
|
17
|
+
property.getMostUpstreamProperty().value = property.value + value;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/commands/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import Dbm from "../index.js";
|
|
|
3
3
|
export {default as CommandBaseObject} from "./CommandBaseObject.js";
|
|
4
4
|
export {default as CallFunction} from "./CallFunction.js";
|
|
5
5
|
export {default as SetProperty} from "./SetProperty.js";
|
|
6
|
+
export {default as IncreaseProperty} from "./IncreaseProperty.js";
|
|
6
7
|
export {default as ResolvePromise} from "./ResolvePromise.js";
|
|
7
8
|
export {default as TrackEvent} from "./TrackEvent.js";
|
|
8
9
|
|
|
@@ -39,6 +40,14 @@ export const setProperty = function(aProperty, aValue) {
|
|
|
39
40
|
return newCommand;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
export const increaseProperty = function(aProperty, aValue = 1) {
|
|
44
|
+
let newCommand = new Dbm.commands.SetProperty();
|
|
45
|
+
newCommand.item.setValue("property", aProperty);
|
|
46
|
+
newCommand.item.setValue("value", aValue);
|
|
47
|
+
|
|
48
|
+
return newCommand;
|
|
49
|
+
}
|
|
50
|
+
|
|
42
51
|
export const trackEvent = function(aEventName, aAdditionalData = {}) {
|
|
43
52
|
let newCommand = new Dbm.commands.TrackEvent();
|
|
44
53
|
newCommand.item.setValue("eventName", aEventName);
|
package/ecommerce/Cart.js
CHANGED
|
@@ -12,48 +12,54 @@ export default class Cart extends Dbm.core.BaseObject {
|
|
|
12
12
|
this.item.setValue("numberOfLines", 0);
|
|
13
13
|
|
|
14
14
|
this.item.setValue("changeCount", 0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
createLineItem(aType, aQuantity = 0, aMeta = null) {
|
|
18
|
+
|
|
19
|
+
let id = "lineItem" + Dbm.getInstance().getNextId();
|
|
20
|
+
let lineItem = new Dbm.ecommerce.CartLineItem();
|
|
21
|
+
lineItem.item.setId(id);
|
|
22
|
+
lineItem.item.type = aType;
|
|
23
|
+
lineItem.setQuantity(aQuantity);
|
|
24
|
+
lineItem.setCart(this.item);
|
|
25
|
+
|
|
26
|
+
if(aMeta) {
|
|
27
|
+
for(let objectName in aMeta) {
|
|
28
|
+
lineItem.setMeta(objectName, aMeta[objectName]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
15
31
|
|
|
16
|
-
|
|
32
|
+
Dbm.flow.addUpdateCommand(lineItem.item.properties.quantity, this._changeCommand);
|
|
33
|
+
|
|
34
|
+
this.item.addToArray("lineItems", lineItem.item);
|
|
35
|
+
|
|
36
|
+
return lineItem;
|
|
17
37
|
}
|
|
18
38
|
|
|
19
39
|
addProduct(aProduct, aQuantity = 1, aMeta = null) {
|
|
20
40
|
//console.log("addProduct");
|
|
21
41
|
//console.log(aQuantity);
|
|
22
42
|
|
|
23
|
-
let
|
|
24
|
-
let lineItem;
|
|
25
|
-
let index = Dbm.utils.ArrayFunctions.getItemIndexByIfExists(lineItems, "product", aProduct);
|
|
43
|
+
let lineItem = Dbm.utils.ArrayFunctions.getItemBy(this.item.lineItems, "product", aProduct);
|
|
26
44
|
|
|
27
|
-
if(
|
|
28
|
-
lineItem = lineItems[index].controller;
|
|
45
|
+
if(lineItem) {
|
|
29
46
|
lineItem.increaseQuantity(aQuantity);
|
|
30
|
-
|
|
47
|
+
|
|
31
48
|
if(aMeta) {
|
|
32
49
|
for(let objectName in aMeta) {
|
|
33
50
|
lineItem.setMeta(objectName, aMeta[objectName]);
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
let id = "lineItem" + Dbm.getInstance().getNextId();
|
|
39
|
-
lineItem = new Dbm.ecommerce.CartLineItem();
|
|
40
|
-
lineItem.item.setId(id);
|
|
41
|
-
lineItem.setProduct(aProduct);
|
|
42
|
-
lineItem.setQuantity(aQuantity);
|
|
43
|
-
lineItem.setCart(this.item);
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
lineItem.setMeta(objectName, aMeta[objectName]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
54
|
+
return lineItem;
|
|
55
|
+
}
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
return this.addProductAsSeparateLineItem(aProduct, aQuantity, aMeta);
|
|
58
|
+
}
|
|
52
59
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
60
|
+
addProductAsSeparateLineItem(aProduct, aQuantity = 1, aMeta = null) {
|
|
61
|
+
let lineItem = this.createLineItem("product", aQuantity, aMeta);
|
|
62
|
+
lineItem.setProduct(aProduct);
|
|
57
63
|
|
|
58
64
|
return lineItem;
|
|
59
65
|
}
|
|
@@ -5,9 +5,13 @@ export default class CartLineItem extends Dbm.core.BaseObject {
|
|
|
5
5
|
super._construct();
|
|
6
6
|
|
|
7
7
|
this.item.setValue("cart", null);
|
|
8
|
+
|
|
9
|
+
this.item.setValue("type", null);
|
|
8
10
|
this.item.setValue("product", null);
|
|
9
11
|
this.item.setValue("quantity", 0);
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
let meta = new Dbm.utils.NamedArray();
|
|
14
|
+
this.item.setValue("meta", meta.item);
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
setCart(aItem) {
|
|
@@ -32,7 +36,9 @@ export default class CartLineItem extends Dbm.core.BaseObject {
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
setMeta(aKey, aValue) {
|
|
35
|
-
|
|
39
|
+
//console.log("setMeta");
|
|
40
|
+
//console.log(aKey, aValue);
|
|
41
|
+
this.item.meta.controller.setValue(aKey, aValue);
|
|
36
42
|
|
|
37
43
|
return this;
|
|
38
44
|
}
|
|
@@ -48,4 +54,18 @@ export default class CartLineItem extends Dbm.core.BaseObject {
|
|
|
48
54
|
|
|
49
55
|
return this;
|
|
50
56
|
}
|
|
57
|
+
|
|
58
|
+
getAsObject() {
|
|
59
|
+
let returnObject = {
|
|
60
|
+
"type": this.item.type,
|
|
61
|
+
"quantity": this.item.quantity,
|
|
62
|
+
"meta": this.item.meta.controller.getAsObject()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if(this.item.product) {
|
|
66
|
+
returnObject["product"] = this.item.product.id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return returnObject;
|
|
70
|
+
}
|
|
51
71
|
}
|
|
@@ -33,7 +33,21 @@ export default class LocalStorageCartLoader extends Dbm.core.BaseObject {
|
|
|
33
33
|
for(let i = 0; i < currentArrayLength; i++) {
|
|
34
34
|
let currentData = currentArray[i];
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
if(!currentData["type"]) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let product = null;
|
|
41
|
+
if(currentData["product"]) {
|
|
42
|
+
product = repository.getItem(currentData["product"]);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
//METODO: encode links in meta
|
|
46
|
+
let lineItem = this.item.cart.controller.createLineItem(currentData["type"], currentData["quantity"], currentData["meta"]);
|
|
47
|
+
|
|
48
|
+
if(product) {
|
|
49
|
+
lineItem.setProduct(product);
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
}
|
|
@@ -58,10 +72,17 @@ export default class LocalStorageCartLoader extends Dbm.core.BaseObject {
|
|
|
58
72
|
for(let i = 0; i < currentArrayLength; i++) {
|
|
59
73
|
let currentData = currentArray[i];
|
|
60
74
|
|
|
61
|
-
let
|
|
75
|
+
let meta = currentData.meta.controller.getAsObject();
|
|
76
|
+
//METODO: links in meta
|
|
77
|
+
let encodedData = {"type": currentData.type, "quantity": currentData.quantity, "meta": meta};
|
|
78
|
+
if(currentData.product) {
|
|
79
|
+
encodedData["product"] = currentData.product.id;
|
|
80
|
+
}
|
|
62
81
|
encodedLineItems.push(encodedData);
|
|
63
82
|
}
|
|
64
83
|
|
|
84
|
+
console.log(encodedLineItems);
|
|
85
|
+
|
|
65
86
|
try {
|
|
66
87
|
let cartDataString = localStorage.setItem(this.item.storageKey, JSON.stringify({"lineItems": encodedLineItems}));
|
|
67
88
|
}
|
|
@@ -160,7 +160,7 @@ export default class ItemEditor extends Dbm.core.BaseObject {
|
|
|
160
160
|
let name = "out_" + aType + "_" + aObjectType;
|
|
161
161
|
let valueEditor = this.item["editor_multipleRelations_" + name];
|
|
162
162
|
if(!valueEditor) {
|
|
163
|
-
let relations = Dbm.utils.ArrayFunctions.filterByField(Dbm.objectPath(this.item.editedItem, "relations/
|
|
163
|
+
let relations = Dbm.utils.ArrayFunctions.filterByField(Dbm.objectPath(this.item.editedItem, "relations/out." + aType + ".objects"), "objectTypes", aObjectType, "arrayContains");
|
|
164
164
|
let ids = Dbm.utils.ArrayFunctions.mapField(relations, "id");
|
|
165
165
|
|
|
166
166
|
valueEditor = this.addMultipleOutgoingRelationsEditor(aType, aObjectType, ids, "relations");
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class EditorBlocks extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._valueChangedBound = this._valueChanged.bind(this);
|
|
9
|
+
this._objectChangedBound = this._objectChanged.bind(this);
|
|
10
|
+
|
|
11
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("value", this._getObjectData()), Dbm.commands.callFunction(this._valueChangedBound));
|
|
12
|
+
|
|
13
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
14
|
+
Dbm.flow.addUpdateCommand(editorData.properties.data, Dbm.commands.callFunction(this._objectChangedBound));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
_getObjectData() {
|
|
19
|
+
let fieldName = this.getPropValue("name");
|
|
20
|
+
|
|
21
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
22
|
+
|
|
23
|
+
let returnData = editorData.data[fieldName];
|
|
24
|
+
if(!returnData) {
|
|
25
|
+
returnData = {};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
console.log(editorData, returnData);
|
|
29
|
+
|
|
30
|
+
return returnData;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_valueChanged() {
|
|
34
|
+
console.log("EditorBlock::_valueChanged");
|
|
35
|
+
|
|
36
|
+
let fieldName = this.getPropValue("name");
|
|
37
|
+
let newValue = {...this.item.value};
|
|
38
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
39
|
+
|
|
40
|
+
let newData = {...editorData.data};
|
|
41
|
+
newData[fieldName] = newValue;
|
|
42
|
+
|
|
43
|
+
editorData.data = newData;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_objectChanged() {
|
|
47
|
+
//console.log("_objectChanged");
|
|
48
|
+
|
|
49
|
+
let newValue = this._getObjectData();
|
|
50
|
+
if(JSON.stringify(newValue) !== JSON.stringify(this.item.value)) {
|
|
51
|
+
this.item.value = newValue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
_renderMainElement() {
|
|
58
|
+
return this._createMainElement("div", {},
|
|
59
|
+
React.createElement(Dbm.react.admin.editor.Editor, {value: this.item.properties.value})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -5,4 +5,5 @@ export {default as CheckboxField} from "./CheckboxField.js";
|
|
|
5
5
|
export {default as SelectObjectField} from "./SelectObjectField.js";
|
|
6
6
|
export {default as SelectObjectsField} from "./SelectObjectsField.js";
|
|
7
7
|
export {default as SelectionField} from "./SelectionField.js";
|
|
8
|
-
export {default as ArrayField} from "./ArrayField.js";
|
|
8
|
+
export {default as ArrayField} from "./ArrayField.js";
|
|
9
|
+
export {default as EditorBlocks} from "./EditorBlocks.js";
|
|
@@ -16,7 +16,7 @@ export default class ResponsiveLayout extends Dbm.core.BaseObject {
|
|
|
16
16
|
let layoutSwitch = new Dbm.flow.updatefunctions.logic.RangeSwitch();
|
|
17
17
|
layoutSwitch.input.properties.value.connectInput(elementSize.output.properties.width);
|
|
18
18
|
|
|
19
|
-
this.item.setValue("layoutSwitch", layoutSwitch)
|
|
19
|
+
this.item.setValue("layoutSwitch", layoutSwitch);
|
|
20
20
|
|
|
21
21
|
this.item.setValue("element", null);
|
|
22
22
|
this.item.properties.element.connectInput(layoutSwitch.output.properties.value);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class RowOrStacked extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.setValue("stackedChildren", []);
|
|
9
|
+
this.item.setValue("rowChildren", []);
|
|
10
|
+
this.item.requireProperty("spacingElement", null)
|
|
11
|
+
|
|
12
|
+
let list = React.createElement(Dbm.react.area.List, {"items": this.item.properties.stackedChildren, "as": "element"},
|
|
13
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": Dbm.react.source.contextVariable("element")}),
|
|
14
|
+
React.createElement(Dbm.react.area.InsertElement, {"data-slot": "spacing", "element": this.item.properties.spacingElement})
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
let responsiveLayout = new Dbm.react.area.responsiveLayout(React.createElement("div", {}, list));
|
|
18
|
+
|
|
19
|
+
let breakpoint = this.getPropValueWithDefault("breakpoint", 600);
|
|
20
|
+
let rowClasses = "flex-row" + " " + this.getPropValueWithDefault("rowClassName", "");
|
|
21
|
+
|
|
22
|
+
let rowList = React.createElement(Dbm.react.area.List, {"items": this.item.properties.rowChildren, "as": "element"},
|
|
23
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": Dbm.react.source.contextVariable("element")})
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
responsiveLayout.addLayout(React.createElement("div", {"className": rowClasses}, rowList), breakpoint);
|
|
27
|
+
|
|
28
|
+
this.item.setValue("responsiveLayout", responsiveLayout);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
let childrenProperty = this.getDynamicPropWithoutState("children", []);
|
|
32
|
+
Dbm.flow.addUpdateCommand(childrenProperty, Dbm.commands.callFunction(this._updateSlots.bind(this)));
|
|
33
|
+
|
|
34
|
+
this._updateSlots();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_updateSlots() {
|
|
38
|
+
let children = Dbm.utils.ArrayFunctions.singleOrArray(this.getPropValue("children"));
|
|
39
|
+
|
|
40
|
+
let slots = Dbm.react.ChildFunctions.splitIntoSlots(children);
|
|
41
|
+
|
|
42
|
+
let spacing = slots["spacing"];
|
|
43
|
+
this.item.stackedChildren = slots.main;
|
|
44
|
+
|
|
45
|
+
let rowClasses = Dbm.utils.ArrayFunctions.arrayOrSeparatedString(this.getPropValueWithDefault("rowClasses", []), ",", true);
|
|
46
|
+
let rowClassesLength = rowClasses.length;
|
|
47
|
+
|
|
48
|
+
let rowElements = [];
|
|
49
|
+
let currentArray = slots.main;
|
|
50
|
+
if(currentArray) {
|
|
51
|
+
let currentArrayLength = currentArray.length;
|
|
52
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
53
|
+
|
|
54
|
+
let rowClass = (i < rowClassesLength) ? rowClasses[i] : "";
|
|
55
|
+
|
|
56
|
+
rowElements.push(
|
|
57
|
+
React.createElement("div", {"className": "flex-row-item" + " " + rowClass},
|
|
58
|
+
currentArray[i]
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
this.item.rowChildren = rowElements;
|
|
66
|
+
|
|
67
|
+
this.item.spacingElement = spacing ? spacing : React.createElement(React.Fragment);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
_renderMainElement() {
|
|
71
|
+
return this.item.responsiveLayout.mainElement;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class SelectResponsiveLayout extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let defaultLayout = this.getPropValueWithDefault("defaultLayout", "mobile");
|
|
9
|
+
|
|
10
|
+
this.item.requireProperty("widthElement", null);
|
|
11
|
+
|
|
12
|
+
let elementSize = new Dbm.flow.updatefunctions.dom.ElementSize();
|
|
13
|
+
this.item.setValue("elementSize", elementSize);
|
|
14
|
+
|
|
15
|
+
elementSize.input.properties.element.connectInput(this.item.properties.widthElement);
|
|
16
|
+
elementSize.start();
|
|
17
|
+
|
|
18
|
+
let layoutSwitch = new Dbm.flow.updatefunctions.logic.RangeSwitch();
|
|
19
|
+
layoutSwitch.input.properties.value.connectInput(elementSize.output.properties.width);
|
|
20
|
+
this.item.setValue("layoutSwitch", layoutSwitch);
|
|
21
|
+
|
|
22
|
+
layoutSwitch.input.defaultValue = defaultLayout;
|
|
23
|
+
|
|
24
|
+
let layouts = Dbm.utils.ArrayFunctions.arrayOrSeparatedString(this.getPropValueWithDefault("layouts", "600:desktop"), ",", true);
|
|
25
|
+
console.log(layouts);
|
|
26
|
+
|
|
27
|
+
let encodedLayouts = [];
|
|
28
|
+
{
|
|
29
|
+
let currentEncodedLayout = null;
|
|
30
|
+
|
|
31
|
+
let currentArray = layouts;
|
|
32
|
+
let currentArrayLength = currentArray.length;
|
|
33
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
34
|
+
let tempArray = currentArray[i].split(":");
|
|
35
|
+
let size = 1*tempArray[0];
|
|
36
|
+
let name = tempArray[1];
|
|
37
|
+
|
|
38
|
+
if(currentEncodedLayout) {
|
|
39
|
+
currentEncodedLayout["max"] = size;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
currentEncodedLayout = {
|
|
43
|
+
"name": name,
|
|
44
|
+
"min": size,
|
|
45
|
+
"max": null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
encodedLayouts.push(currentEncodedLayout);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
let currentArray = encodedLayouts;
|
|
54
|
+
let currentArrayLength = currentArray.length;
|
|
55
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
56
|
+
let currentEncodedLayout = currentArray[i];
|
|
57
|
+
this.item.layoutSwitch.addValueForRange(currentEncodedLayout["name"], currentEncodedLayout["min"], currentEncodedLayout["max"]);
|
|
58
|
+
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
this.item.requireProperty("layout", defaultLayout).connectInput(layoutSwitch.output.properties.value);
|
|
66
|
+
this.item.properties.layout
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_renderMainElement() {
|
|
70
|
+
return React.createElement("div", {ref: this.createRef("widthElement")},
|
|
71
|
+
React.createElement(Dbm.react.context.AddContextVariables, {"values": {"layout": this.item.properties.layout}},
|
|
72
|
+
this.getPropValue("children")
|
|
73
|
+
)
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
package/react/area/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export {default as List} from "./List.js";
|
|
|
11
11
|
export {default as FixedWidthInfiniteSlideshow} from "./FixedWidthInfiniteSlideshow.js";
|
|
12
12
|
export {default as SwitchableArea} from "./SwitchableArea.js";
|
|
13
13
|
export {default as PopoverLayer} from "./PopoverLayer.js";
|
|
14
|
+
export {default as RowOrStacked} from "./RowOrStacked.js";
|
|
15
|
+
export {default as SelectResponsiveLayout} from "./SelectResponsiveLayout.js";
|
|
14
16
|
|
|
15
17
|
export const responsiveLayout = function(aDefaultLayout) {
|
|
16
18
|
let newResponsiveLayout = new Dbm.react.area.ResponsiveLayout();
|
|
@@ -19,6 +19,6 @@ export default class AddItemToContext extends Dbm.react.BaseObject {
|
|
|
19
19
|
let values = {};
|
|
20
20
|
values[as] = item;
|
|
21
21
|
|
|
22
|
-
return React.createElement(Dbm.react.context.AddContextVariables, {"values": values, "key": id}, this.
|
|
22
|
+
return React.createElement(Dbm.react.context.AddContextVariables, {"values": values, "key": id}, this.getPropValue("children"));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -44,19 +44,25 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
44
44
|
|
|
45
45
|
React.createElement("div", {},
|
|
46
46
|
React.createElement("div", {"className": "cookie-bar-title"},
|
|
47
|
-
"Your privacy is important to us"
|
|
47
|
+
Dbm.react.text.translatedText("Your privacy is important to us", "text/title")
|
|
48
48
|
),
|
|
49
49
|
React.createElement("div", {"className": "cookie-bar-description"},
|
|
50
|
-
"We use cookies to improve your experience on our site."
|
|
50
|
+
Dbm.react.text.translatedText("We use cookies to improve your experience on our site.", "text/description")
|
|
51
51
|
)
|
|
52
52
|
),
|
|
53
53
|
React.createElement("div", {"className": "spacing small"}),
|
|
54
|
-
React.createElement("div", {"className": "standard-button standard-button-padding text-align-center", onClick: () => this._acceptAll()},
|
|
54
|
+
React.createElement("div", {"className": "standard-button standard-button-padding text-align-center", onClick: () => this._acceptAll()},
|
|
55
|
+
Dbm.react.text.translatedText("Allow all", "allowAll")
|
|
56
|
+
),
|
|
55
57
|
React.createElement("div", {"className": "spacing small"}),
|
|
56
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()},
|
|
58
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()},
|
|
59
|
+
Dbm.react.text.translatedText("Only necessary", "onlyNecessary")
|
|
60
|
+
),
|
|
57
61
|
React.createElement("div", {"className": "spacing small"}),
|
|
58
|
-
React.createElement(
|
|
59
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"},
|
|
62
|
+
React.createElement(Dbm.react.text.Link, {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
63
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"},
|
|
64
|
+
Dbm.react.text.translatedText("Settings", "settings")
|
|
65
|
+
)
|
|
60
66
|
)
|
|
61
67
|
|
|
62
68
|
);
|
|
@@ -65,25 +71,31 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
65
71
|
|
|
66
72
|
React.createElement("div", {},
|
|
67
73
|
React.createElement("div", {"className": "cookie-bar-title"},
|
|
68
|
-
"Your privacy is important to us"
|
|
74
|
+
Dbm.react.text.translatedText("Your privacy is important to us", "text/title")
|
|
69
75
|
),
|
|
70
76
|
React.createElement("div", {"className": "cookie-bar-description"},
|
|
71
|
-
"We use cookies to improve your experience on our site."
|
|
77
|
+
Dbm.react.text.translatedText("We use cookies to improve your experience on our site.", "text/description")
|
|
72
78
|
)
|
|
73
79
|
),
|
|
74
80
|
React.createElement("div", {"className": "spacing small"}),
|
|
75
81
|
|
|
76
82
|
React.createElement("div", {"className": "flex-row small-item-spacing"},
|
|
77
83
|
React.createElement("div", {"className": "flex-row-item"},
|
|
78
|
-
React.createElement(
|
|
79
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding"},
|
|
84
|
+
React.createElement(Dbm.react.text.Link, {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
85
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding"},
|
|
86
|
+
Dbm.react.text.translatedText("Settings", "settings")
|
|
87
|
+
)
|
|
80
88
|
)
|
|
81
89
|
),
|
|
82
90
|
React.createElement("div", {"className": "flex-row-item"},
|
|
83
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()},
|
|
91
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()},
|
|
92
|
+
Dbm.react.text.translatedText("Only necessary", "onlyNecessary")
|
|
93
|
+
)
|
|
84
94
|
),
|
|
85
95
|
React.createElement("div", {"className": "flex-row-item"},
|
|
86
|
-
React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()},
|
|
96
|
+
React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()},
|
|
97
|
+
Dbm.react.text.translatedText("Allow all", "allowAll")
|
|
98
|
+
)
|
|
87
99
|
)
|
|
88
100
|
)
|
|
89
101
|
);
|
|
@@ -94,24 +106,30 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
94
106
|
React.createElement("div", {"className": "flex-row small-item-spacing justify-between"},
|
|
95
107
|
React.createElement("div", {"className": "flex-row-item"},
|
|
96
108
|
React.createElement("div", {"className": "cookie-bar-title"},
|
|
97
|
-
"Your privacy is important to us"
|
|
109
|
+
Dbm.react.text.translatedText("Your privacy is important to us", "text/title")
|
|
98
110
|
),
|
|
99
111
|
React.createElement("div", {"className": "cookie-bar-description"},
|
|
100
|
-
"We use cookies to improve your experience on our site."
|
|
112
|
+
Dbm.react.text.translatedText("We use cookies to improve your experience on our site.", "text/description")
|
|
101
113
|
)
|
|
102
114
|
),
|
|
103
115
|
React.createElement("div", {"className": "flex-row-item"},
|
|
104
116
|
React.createElement("div", {"className": "flex-row small-item-spacing"},
|
|
105
117
|
React.createElement("div", {"className": "flex-row-item"},
|
|
106
|
-
React.createElement(
|
|
107
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding"},
|
|
118
|
+
React.createElement(Dbm.react.text.Link, {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
119
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding"},
|
|
120
|
+
Dbm.react.text.translatedText("Settings", "settings")
|
|
121
|
+
)
|
|
108
122
|
)
|
|
109
123
|
),
|
|
110
124
|
React.createElement("div", {"className": "flex-row-item"},
|
|
111
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()},
|
|
125
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()},
|
|
126
|
+
Dbm.react.text.translatedText("Only necessary", "onlyNecessary")
|
|
127
|
+
)
|
|
112
128
|
),
|
|
113
129
|
React.createElement("div", {"className": "flex-row-item"},
|
|
114
|
-
React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()},
|
|
130
|
+
React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()},
|
|
131
|
+
Dbm.react.text.translatedText("Allow all", "allowAll")
|
|
132
|
+
)
|
|
115
133
|
)
|
|
116
134
|
)
|
|
117
135
|
)
|
|
@@ -186,10 +204,12 @@ export default class CookieBar extends Dbm.react.BaseObject {
|
|
|
186
204
|
|
|
187
205
|
return this._createMainElement("div", {className: "cookie-bar-position no-pointer-events", "data-non-static": 1, ref: this.createRef("widthElement")},
|
|
188
206
|
React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.inDom},
|
|
189
|
-
React.createElement(
|
|
190
|
-
React.createElement(
|
|
191
|
-
React.createElement(
|
|
192
|
-
React.createElement(
|
|
207
|
+
React.createElement(Dbm.react.text.TranslationGroup, {"path": "cookies/notice/bar"},
|
|
208
|
+
React.createElement("div", {className: "overflow-hidden"},
|
|
209
|
+
React.createElement(Dbm.react.BaseObject, {style: this.item.properties.style},
|
|
210
|
+
React.createElement("div", {className: "all-pointer-events"},
|
|
211
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
212
|
+
)
|
|
193
213
|
)
|
|
194
214
|
)
|
|
195
215
|
)
|
|
@@ -45,25 +45,31 @@ export default class CookieOverlayMessage extends Dbm.react.BaseObject {
|
|
|
45
45
|
|
|
46
46
|
React.createElement("div", {},
|
|
47
47
|
React.createElement("div", {"className": "cookie-bar-title"},
|
|
48
|
-
"Your privacy is important to us"
|
|
48
|
+
Dbm.react.text.translatedText("Your privacy is important to us", "text/title")
|
|
49
49
|
),
|
|
50
50
|
React.createElement("div", {"className": "cookie-bar-description"},
|
|
51
|
-
"We use cookies to make our site work properly and to improve your experience. You can choose to accept all cookies, allow only those that are necessary, or manage your preferences in the settings."
|
|
51
|
+
Dbm.react.text.translatedText("We use cookies to make our site work properly and to improve your experience. You can choose to accept all cookies, allow only those that are necessary, or manage your preferences in the settings.", "text/description")
|
|
52
52
|
)
|
|
53
53
|
),
|
|
54
54
|
React.createElement("div", {"className": "spacing small"}),
|
|
55
|
-
React.createElement("div", {"className": "standard-button standard-button-padding big text-align-center", onClick: () => this._acceptAll()},
|
|
55
|
+
React.createElement("div", {"className": "standard-button standard-button-padding big text-align-center", onClick: () => this._acceptAll()},
|
|
56
|
+
Dbm.react.text.translatedText("Allow all", "allowAll")
|
|
57
|
+
),
|
|
56
58
|
React.createElement("div", {"className": "spacing small"}),
|
|
57
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()},
|
|
59
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()},
|
|
60
|
+
Dbm.react.text.translatedText("Only necessary", "onlyNecessary")
|
|
61
|
+
),
|
|
58
62
|
React.createElement("div", {"className": "spacing small"}),
|
|
59
63
|
React.createElement("div", {"className": "cookie-overlay-message-divider"}),
|
|
60
64
|
React.createElement("div", {"className": "spacing small"}),
|
|
61
65
|
React.createElement("div", {"className": "text-align-center"},
|
|
62
|
-
"Take full control over how we use cookies:"
|
|
66
|
+
Dbm.react.text.translatedText("Take full control over how we use cookies:", "text/settingsLinkDescription")
|
|
63
67
|
),
|
|
64
68
|
React.createElement("div", {"className": "spacing small"}),
|
|
65
69
|
React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
66
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"},
|
|
70
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"},
|
|
71
|
+
Dbm.react.text.translatedText("Settings", "settings")
|
|
72
|
+
)
|
|
67
73
|
)
|
|
68
74
|
|
|
69
75
|
)
|
|
@@ -74,17 +80,21 @@ export default class CookieOverlayMessage extends Dbm.react.BaseObject {
|
|
|
74
80
|
React.createElement("div", {"className": "flex-row small-item-spacing"},
|
|
75
81
|
React.createElement("div", {"className": "flex-row-item half"},
|
|
76
82
|
React.createElement("div", {"className": "cookie-bar-title"},
|
|
77
|
-
"Your privacy is important to us"
|
|
83
|
+
Dbm.react.text.translatedText("Your privacy is important to us", "text/title")
|
|
78
84
|
),
|
|
79
85
|
React.createElement("div", {"className": "cookie-bar-description"},
|
|
80
|
-
"We use cookies to make our site work properly and to improve your experience. You can choose to accept all cookies, allow only those that are necessary, or manage your preferences in the settings."
|
|
86
|
+
Dbm.react.text.translatedText("We use cookies to make our site work properly and to improve your experience. You can choose to accept all cookies, allow only those that are necessary, or manage your preferences in the settings.", "text/description")
|
|
81
87
|
)
|
|
82
88
|
),
|
|
83
89
|
React.createElement("div", {"className": "flex-row-item quarter"}),
|
|
84
90
|
React.createElement("div", {"className": "flex-row-item quarter"},
|
|
85
|
-
React.createElement("div", {"className": "standard-button standard-button-padding big full-width text-align-center", onClick: () => this._acceptAll()},
|
|
91
|
+
React.createElement("div", {"className": "standard-button standard-button-padding big full-width text-align-center", onClick: () => this._acceptAll()},
|
|
92
|
+
Dbm.react.text.translatedText("Allow all", "allowAll")
|
|
93
|
+
),
|
|
86
94
|
React.createElement("div", {"className": "spacing medium"}),
|
|
87
|
-
React.createElement("div", {"className": "secondary-button standard-button-padding full-width text-align-center", onClick: () => this._rejectAll()},
|
|
95
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding full-width text-align-center", onClick: () => this._rejectAll()},
|
|
96
|
+
Dbm.react.text.translatedText("Only necessary", "onlyNecessary")
|
|
97
|
+
)
|
|
88
98
|
|
|
89
99
|
)
|
|
90
100
|
),
|
|
@@ -93,11 +103,13 @@ export default class CookieOverlayMessage extends Dbm.react.BaseObject {
|
|
|
93
103
|
React.createElement("div", {"className": "spacing standard"}),
|
|
94
104
|
React.createElement("div", {"className": "flex-row small-item-spacing justify-between"},
|
|
95
105
|
React.createElement("div", {"className": "flex-row-item"},
|
|
96
|
-
"Take full control over how we use cookies:"
|
|
106
|
+
Dbm.react.text.translatedText("Take full control over how we use cookies:", "text/settingsLinkDescription")
|
|
97
107
|
),
|
|
98
108
|
React.createElement("div", {"className": "flex-row-item"},
|
|
99
109
|
React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
100
|
-
React.createElement("div", {"className": "cookie-settings-link"},
|
|
110
|
+
React.createElement("div", {"className": "cookie-settings-link"},
|
|
111
|
+
Dbm.react.text.translatedText("Settings", "settings")
|
|
112
|
+
)
|
|
101
113
|
)
|
|
102
114
|
),
|
|
103
115
|
)
|
|
@@ -174,10 +186,12 @@ export default class CookieOverlayMessage extends Dbm.react.BaseObject {
|
|
|
174
186
|
|
|
175
187
|
return this._createMainElement("div", {className: "cookie-bar-position no-pointer-events cookie-overlay-message-layer", ref: this.createRef("widthElement")},
|
|
176
188
|
React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.inDom},
|
|
177
|
-
React.createElement(
|
|
178
|
-
React.createElement(
|
|
179
|
-
React.createElement(
|
|
180
|
-
React.createElement(
|
|
189
|
+
React.createElement(Dbm.react.text.TranslationGroup, {"path": "cookies/notice/overlay"},
|
|
190
|
+
React.createElement("div", {className: "overflow-hidden"},
|
|
191
|
+
React.createElement(Dbm.react.BaseObject, {style: this.item.properties.style},
|
|
192
|
+
React.createElement("div", {},
|
|
193
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
194
|
+
)
|
|
181
195
|
)
|
|
182
196
|
)
|
|
183
197
|
)
|
|
@@ -9,22 +9,22 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
9
9
|
let settings = [];
|
|
10
10
|
|
|
11
11
|
{
|
|
12
|
-
let currentItem = this._createSetting("
|
|
12
|
+
let currentItem = this._createSetting("allowPreferences", "Preferences cookies", "These cookies allow a website to remember choices you have made in the past.");
|
|
13
13
|
settings.push(currentItem);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
{
|
|
17
|
-
let currentItem = this._createSetting("
|
|
17
|
+
let currentItem = this._createSetting("allowStatistics", "Statistics cookies", "These cookies collect information about how you use a website, like which pages you visited and which links you clicked on. None of this information can be used to identify you. It is all aggregated and, therefore, anonymized. Their sole purpose is to improve website functions.");
|
|
18
18
|
settings.push(currentItem);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
{
|
|
22
|
-
let currentItem = this._createSetting("
|
|
22
|
+
let currentItem = this._createSetting("allowMarketing", "Marketing cookies", "These cookies track your online activity to help advertisers deliver more relevant advertising or to limit how many times you see an ad. These cookies can share that information with other organizations or advertisers.");
|
|
23
23
|
settings.push(currentItem);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
{
|
|
27
|
-
let currentItem = this._createSetting("
|
|
27
|
+
let currentItem = this._createSetting("hideCookieBar", "Hide cookie information when websites load", "Hides the cookie information and links that is displayed every time the website is loaded.");
|
|
28
28
|
settings.push(currentItem);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -38,9 +38,9 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
38
38
|
|
|
39
39
|
let fieldName = "field" + Dbm.getInstance().getNextId();
|
|
40
40
|
|
|
41
|
-
currentItem.setValue("name", aName);
|
|
41
|
+
currentItem.setValue("name", "cookie/" + aName);
|
|
42
42
|
|
|
43
|
-
let currentValue = Cookies.get(aName) === "1";
|
|
43
|
+
let currentValue = Cookies.get("cookie/" + aName) === "1";
|
|
44
44
|
currentItem.setValue("value", currentValue);
|
|
45
45
|
|
|
46
46
|
let element = React.createElement("div", {"className": "flex-row small-item-spacing", "key": aName},
|
|
@@ -48,9 +48,15 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
48
48
|
React.createElement(Dbm.react.form.Checkbox, {"type": "checkbox", "checked": currentItem.properties.value, "id": fieldName})
|
|
49
49
|
),
|
|
50
50
|
React.createElement("div", {"className": "flex-row-item"},
|
|
51
|
-
React.createElement(
|
|
52
|
-
React.createElement("
|
|
53
|
-
|
|
51
|
+
React.createElement(Dbm.react.text.TranslationGroup, {"path": aName},
|
|
52
|
+
React.createElement("label", {"htmlFor": fieldName},
|
|
53
|
+
React.createElement("div", {"className": "cookie-settings-title"},
|
|
54
|
+
Dbm.react.text.translatedText(aTitle, "text/title")
|
|
55
|
+
),
|
|
56
|
+
React.createElement("div", {"className": "small-description cookie-description"},
|
|
57
|
+
Dbm.react.text.translatedText(aDescription, "text/description")
|
|
58
|
+
)
|
|
59
|
+
)
|
|
54
60
|
),
|
|
55
61
|
)
|
|
56
62
|
);
|
|
@@ -110,22 +116,32 @@ export default class CookieSettings extends Dbm.react.BaseObject {
|
|
|
110
116
|
return aSetting.element;
|
|
111
117
|
})
|
|
112
118
|
|
|
113
|
-
return this._createMainElement("div", {"className": "content-narrow"},
|
|
114
|
-
React.createElement(
|
|
115
|
-
React.createElement("div", {
|
|
116
|
-
React.createElement("div", {"className": "flex-row-item"},
|
|
117
|
-
React.createElement("
|
|
119
|
+
return this._createMainElement("div", {"className": "content-narrow"},
|
|
120
|
+
React.createElement(Dbm.react.text.TranslationGroup, {"path": "cookies/settings"},
|
|
121
|
+
React.createElement("div", {className: "body-text"},
|
|
122
|
+
React.createElement("div", {"className": "flex-row small-item-spacing"},
|
|
123
|
+
React.createElement("div", {"className": "flex-row-item"},
|
|
124
|
+
React.createElement("input", {"type": "checkbox", "checked": true, "disabled": true})
|
|
125
|
+
),
|
|
126
|
+
React.createElement("div", {"className": "flex-row-item"},
|
|
127
|
+
React.createElement(Dbm.react.text.TranslationGroup, {"path": "strictlyNecessary"},
|
|
128
|
+
React.createElement("div", {"className": "cookie-settings-title"},
|
|
129
|
+
Dbm.react.text.translatedText("Strictly necessary cookies", "text/title")
|
|
130
|
+
),
|
|
131
|
+
React.createElement("div", {"className": "small-description cookie-description"},
|
|
132
|
+
Dbm.react.text.translatedText("These cookies are essential for you to browse the website and use its features, such as accessing secure areas of the site.", "text/description")
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
)
|
|
118
136
|
),
|
|
119
|
-
|
|
120
|
-
React.createElement("div", {"className": "cookie-settings-title"}, "Strictly necessary cookies"),
|
|
121
|
-
React.createElement("div", {"className": "small-description cookie-description"}, "These cookies are essential for you to browse the website and use its features, such as accessing secure areas of the site.")
|
|
122
|
-
)
|
|
137
|
+
elements
|
|
123
138
|
),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
React.createElement("div", {"className": "spacing standard"}),
|
|
140
|
+
React.createElement("div", {"className": "flex-row justify-center"},
|
|
141
|
+
React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._save()},
|
|
142
|
+
Dbm.react.text.translatedText("Save", "save")
|
|
143
|
+
)
|
|
144
|
+
)
|
|
129
145
|
)
|
|
130
146
|
);
|
|
131
147
|
}
|
package/repository/index.js
CHANGED
|
@@ -7,6 +7,10 @@ export const getItem = function(aName) {
|
|
|
7
7
|
return Dbm.getInstance().repository.getItem(aName);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
export const getItems = function(aNames) {
|
|
11
|
+
return Dbm.getInstance().repository.getItems(aNames);
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
export const getItemIfExists = function(aName) {
|
|
11
15
|
return Dbm.getInstance().repository.getItemIfExists(aName);
|
|
12
16
|
}
|
package/site/index.js
CHANGED
|
@@ -15,6 +15,8 @@ export const setupAndStart = function(aTitleSuffix) {
|
|
|
15
15
|
Dbm.getRepositoryItem("site").requireProperty("currentUser", null);
|
|
16
16
|
Dbm.getRepositoryItem("site").requireProperty("checkedUser", false);
|
|
17
17
|
|
|
18
|
+
Dbm.getRepositoryItem("site/translations").requireProperty("data", {});
|
|
19
|
+
|
|
18
20
|
let siteDataLoader = new Dbm.site.SiteDataLoader();
|
|
19
21
|
siteDataLoader.item.register("siteDataLoader");
|
|
20
22
|
siteDataLoader.item.properties.url.connectInput(siteNavigation.item.properties.url);
|
package/tracking/Controller.js
CHANGED
|
@@ -176,79 +176,51 @@ export default class Controller extends Dbm.core.BaseObject {
|
|
|
176
176
|
|
|
177
177
|
trackProductView(aProduct) {
|
|
178
178
|
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
let data = {
|
|
182
|
-
currency: this.item.currency,
|
|
183
|
-
value: this._getValueFromItems(items),
|
|
184
|
-
items: items
|
|
185
|
-
}
|
|
179
|
+
let data = this.createProductItemsSummary(aProduct);
|
|
186
180
|
|
|
187
181
|
this.trackEvent("Product view", data, "ecommerce");
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
trackAddedToCart(aProductOrProducts) {
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
let data = {
|
|
194
|
-
currency: this.item.currency,
|
|
195
|
-
value: this._getValueFromItems(items),
|
|
196
|
-
items: items
|
|
197
|
-
}
|
|
185
|
+
let data = this.createProductItemsSummary(aProductOrProducts);
|
|
198
186
|
|
|
199
187
|
this.trackEvent("Added to cart", data, "ecommerce");
|
|
200
188
|
|
|
201
189
|
}
|
|
202
190
|
|
|
203
191
|
trackCheckoutStarted(aProductOrProducts) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
let data = {
|
|
207
|
-
currency: this.item.currency,
|
|
208
|
-
value: this._getValueFromItems(items),
|
|
209
|
-
items: items
|
|
210
|
-
}
|
|
192
|
+
|
|
193
|
+
let data = this.createProductItemsSummary(aProductOrProducts);
|
|
211
194
|
|
|
212
195
|
this.trackEvent("Checkout started", data, "ecommerce");
|
|
213
196
|
}
|
|
214
197
|
|
|
215
198
|
trackAddShipping(aProductOrProducts) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
let data = {
|
|
219
|
-
currency: this.item.currency,
|
|
220
|
-
value: this._getValueFromItems(items),
|
|
221
|
-
items: items
|
|
222
|
-
}
|
|
199
|
+
|
|
200
|
+
let data = this.createProductItemsSummary(aProductOrProducts);
|
|
223
201
|
|
|
224
202
|
this.trackEvent("Add shipping", data, "ecommerce");
|
|
225
203
|
}
|
|
226
204
|
|
|
227
205
|
trackAddPayment(aProductOrProducts) {
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
let data = {
|
|
231
|
-
currency: this.item.currency,
|
|
232
|
-
value: this._getValueFromItems(items),
|
|
233
|
-
items: items
|
|
234
|
-
}
|
|
206
|
+
let data = this.createProductItemsSummary(aProductOrProducts);
|
|
235
207
|
|
|
236
208
|
this.trackEvent("Add payment", data, "ecommerce");
|
|
237
209
|
}
|
|
238
210
|
|
|
239
211
|
trackPurchase(aTransactionId, aProductOrProducts) {
|
|
240
|
-
let items = Dbm.utils.ArrayFunctions.singleOrArray(aProductOrProducts);
|
|
241
212
|
|
|
242
|
-
let data = {
|
|
243
|
-
transaction_id: aTransactionId,
|
|
244
|
-
currency: this.item.currency,
|
|
245
|
-
value: this._getValueFromItems(items),
|
|
246
|
-
items: items
|
|
247
|
-
}
|
|
213
|
+
let data = this.createProductItemsSummary(aProductOrProducts, {"transaction_id": aTransactionId});
|
|
248
214
|
|
|
249
215
|
this.trackEvent("Purchase", data, "ecommerce");
|
|
250
216
|
}
|
|
251
217
|
|
|
218
|
+
trackEcommerce(aEventName, aProductOrProducts, aAddtionalData = {}) {
|
|
219
|
+
let data = this.createProductItemsSummary(aProductOrProducts, aAddtionalData = {});
|
|
220
|
+
|
|
221
|
+
this.trackEvent(aEventName, data, "ecommerce");
|
|
222
|
+
}
|
|
223
|
+
|
|
252
224
|
createProductItemData(aId, aName, aPrice, aQuantity = 1, aAddtionalData = {}) {
|
|
253
225
|
|
|
254
226
|
let returnObject = {
|
|
@@ -262,4 +234,17 @@ export default class Controller extends Dbm.core.BaseObject {
|
|
|
262
234
|
|
|
263
235
|
return returnObject;
|
|
264
236
|
}
|
|
237
|
+
|
|
238
|
+
createProductItemsSummary(aProductOrProducts, aAddtionalData = {}) {
|
|
239
|
+
let items = Dbm.utils.ArrayFunctions.singleOrArray(aProductOrProducts);
|
|
240
|
+
|
|
241
|
+
let data = {
|
|
242
|
+
...aAddtionalData,
|
|
243
|
+
currency: this.item.currency,
|
|
244
|
+
value: this._getValueFromItems(items),
|
|
245
|
+
items: items
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return data;
|
|
249
|
+
}
|
|
265
250
|
}
|
|
@@ -81,7 +81,15 @@ export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
|
81
81
|
|
|
82
82
|
if(this._statisticsTracking) {
|
|
83
83
|
this.addToDataLayer({"event": "trackEvent", "value": {"name": aEventName, "data": aData}});
|
|
84
|
-
if(aDataStructure === "
|
|
84
|
+
if(aDataStructure === "raw") {
|
|
85
|
+
let adjustedData = {
|
|
86
|
+
...aData,
|
|
87
|
+
"event": aEventName
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
this.addToDataLayer(adjustedData);
|
|
91
|
+
}
|
|
92
|
+
else if(aDataStructure === "ecommerce" && this.item.ecommerceDataWrapper) {
|
|
85
93
|
this.addToDataLayer({"event": aEventName, [this.item.ecommerceDataWrapper]: aData});
|
|
86
94
|
}
|
|
87
95
|
else {
|
|
@@ -92,7 +100,15 @@ export default class DataLayerTracker extends Dbm.core.BaseObject {
|
|
|
92
100
|
|
|
93
101
|
if(this._marketingTracking) {
|
|
94
102
|
this.addToDataLayer({"event": "trackMarketingEvent", "value": {"name": aEventName, "data": aData}});
|
|
95
|
-
if(aDataStructure === "
|
|
103
|
+
if(aDataStructure === "raw") {
|
|
104
|
+
let adjustedData = {
|
|
105
|
+
...aData,
|
|
106
|
+
"event": "Marketing / " + aEventName
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.addToDataLayer(adjustedData);
|
|
110
|
+
}
|
|
111
|
+
else if(aDataStructure === "ecommerce" && this.item.ecommerceDataWrapper) {
|
|
96
112
|
this.addToDataLayer({"event": "Marketing / " + aEventName, [this.item.ecommerceDataWrapper]: aData});
|
|
97
113
|
}
|
|
98
114
|
else {
|
package/utils/ArrayFunctions.js
CHANGED
|
@@ -313,6 +313,19 @@ export const sortOnNumericField = function(aArray, aField) {
|
|
|
313
313
|
return sortOnField(aArray, aField, compareFunction);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
export const getInOrder = function(aArray, aOrderIndexes) {
|
|
317
|
+
|
|
318
|
+
let currentArray = aOrderIndexes;
|
|
319
|
+
let currentArrayLength = currentArray.length;
|
|
320
|
+
let returnArray = new Array(currentArrayLength);
|
|
321
|
+
|
|
322
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
323
|
+
returnArray[i] = aArray[currentArray[i]];
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return returnArray;
|
|
327
|
+
}
|
|
328
|
+
|
|
316
329
|
export const naturalSortOnField = function(aArray, aField, aLanguageCode = null) {
|
|
317
330
|
|
|
318
331
|
if(!aLanguageCode) {
|
|
@@ -483,5 +496,33 @@ export const mapObjectToArrayWithoutKey = function(aObject) {
|
|
|
483
496
|
returnArray.push(aObject[objectName]);
|
|
484
497
|
}
|
|
485
498
|
|
|
499
|
+
return returnArray;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export const anyOverlap = function(aArray1, aArray2) {
|
|
503
|
+
let currentArray = aArray1;
|
|
504
|
+
let currentArrayLength = currentArray.length;
|
|
505
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
506
|
+
if(aArray2.indexOf(currentArray[i]) !== -1) {
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
return false;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export const overlap = function(aArray1, aArray2) {
|
|
515
|
+
|
|
516
|
+
let returnArray = [];
|
|
517
|
+
|
|
518
|
+
let currentArray = aArray1;
|
|
519
|
+
let currentArrayLength = currentArray.length;
|
|
520
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
521
|
+
let currentItem = currentArray[i];
|
|
522
|
+
if(aArray2.indexOf(currentItem) !== -1) {
|
|
523
|
+
returnArray.push(currentItem);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
486
527
|
return returnArray;
|
|
487
528
|
}
|
package/utils/KeywordReplace.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const set = function(aKey, aData, aIdentifier = "default") {
|
|
2
|
+
try {
|
|
3
|
+
let currentTime = (new Date()).valueOf();
|
|
4
|
+
let storeObject = {
|
|
5
|
+
identifier: aIdentifier,
|
|
6
|
+
time: currentTime,
|
|
7
|
+
data: aData
|
|
8
|
+
}
|
|
9
|
+
localStorage.setItem("cache/" + aKey, JSON.stringify(storeObject));
|
|
10
|
+
}
|
|
11
|
+
catch(theError) {
|
|
12
|
+
console.error("Unable to set cache " + aKey);
|
|
13
|
+
console.log(theError);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const get = function(aKey, aIdentifier = "default", aMaxAge = 3600) {
|
|
18
|
+
let dataString = localStorage.getItem("cache/" + aKey);
|
|
19
|
+
|
|
20
|
+
if(dataString) {
|
|
21
|
+
try {
|
|
22
|
+
let data = JSON.parse(dataString);
|
|
23
|
+
let currentTime = (new Date()).valueOf();
|
|
24
|
+
if(aIdentifier === data.identifier && currentTime < data.time+(aMaxAge*1000)) {
|
|
25
|
+
console.log(data.data);
|
|
26
|
+
return data.data;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch(theError) {
|
|
30
|
+
console.error("Unable to get cache " + aKey);
|
|
31
|
+
console.log(theError);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import Dbm from "../index.js";
|
|
2
|
+
|
|
3
|
+
export default class NamedArray extends Dbm.core.BaseObject {
|
|
4
|
+
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.requireProperty("allRecords", []);
|
|
9
|
+
this.item.requireProperty("records", new Dbm.repository.Item());
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
let updateFunction = Dbm.flow.updatefunctions.basic.transformValue(this.item.properties.allRecords, this._transform_updateKeys.bind(this));
|
|
13
|
+
this.item.requireProperty("keys", []).connectInput(updateFunction.output.properties.value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
let updateFunction = Dbm.flow.updatefunctions.basic.transformValue(this.item.properties.allRecords, this._transform_updateValueProperties.bind(this));
|
|
18
|
+
this.item.requireProperty("valueProperties", []).connectInput(updateFunction.output.properties.value);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
{
|
|
22
|
+
let updateFunction = Dbm.flow.updatefunctions.basic.transformValue(this.item.properties.valueProperties, this._transform_updateValues.bind(this));
|
|
23
|
+
updateFunction.input.register("_valueChange", 0).connectInput(this.item.requireProperty("_valueChange", 0));
|
|
24
|
+
this.item.requireProperty("values", []).connectInput(updateFunction.output.properties.value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this._valueUpdateCommand = Dbm.commands.increaseProperty(this.item.properties._valueChange);
|
|
28
|
+
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_transform_updateKeys(aRecords) {
|
|
33
|
+
return Dbm.utils.ArrayFunctions.mapField(aRecords, "key");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_transform_updateValueProperties(aRecords) {
|
|
37
|
+
return Dbm.utils.ArrayFunctions.mapField(aRecords, "value");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_transform_updateValues(aProperties) {
|
|
41
|
+
return Dbm.utils.ArrayFunctions.mapField(aProperties, "value");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
addValue(aKey, aValue) {
|
|
45
|
+
|
|
46
|
+
let property = this.item.records.requireProperty(aKey);
|
|
47
|
+
property.setOrConnect(aValue);
|
|
48
|
+
property.addUpdate(this._valueUpdateCommand);
|
|
49
|
+
|
|
50
|
+
let record = {key: aKey, value: property};
|
|
51
|
+
|
|
52
|
+
this.item.addToArray("allRecords", record);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
addUnnamedValue(aValue) {
|
|
56
|
+
let key = "internal/" + Dbm.getInstance().getNextId();
|
|
57
|
+
this.addValue(key, aValue);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
setValue(aKey, aValue) {
|
|
61
|
+
let existingRecord = Dbm.utils.ArrayFunctions.getItemByIfExists(this.item.allRecords, "key", aKey);
|
|
62
|
+
if(existingRecord) {
|
|
63
|
+
existingRecord.value.value = aValue;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.addValue(aKey, aValue);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
removeValue() {
|
|
71
|
+
//METODO
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getAsObject() {
|
|
75
|
+
console.log("getAsObject");
|
|
76
|
+
let returnObject = {};
|
|
77
|
+
|
|
78
|
+
let currentArray = this.item.allRecords;
|
|
79
|
+
let currentArrayLength = currentArray.length;
|
|
80
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
81
|
+
let currentRecord = currentArray[i];
|
|
82
|
+
|
|
83
|
+
console.log(currentRecord["key"], currentRecord["value"].value);
|
|
84
|
+
returnObject[currentRecord["key"]] = currentRecord["value"].value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(returnObject);
|
|
88
|
+
|
|
89
|
+
return returnObject;
|
|
90
|
+
}
|
|
91
|
+
}
|
package/utils/index.js
CHANGED
|
@@ -6,10 +6,12 @@ export * as CompareFunctions from "./CompareFunctions.js";
|
|
|
6
6
|
export * as TranslationFunctions from "./TranslationFunctions.js";
|
|
7
7
|
export * as LevenshteinDistance from "./LevenshteinDistance.js";
|
|
8
8
|
export * as ObjectFunctions from "./ObjectFunctions.js";
|
|
9
|
+
export * as LocalCache from "./LocalCache.js";
|
|
9
10
|
|
|
10
11
|
export {default as MultidimensionalArrayHolder} from "./MultidimensionalArrayHolder.js";
|
|
11
12
|
export {default as ArrayOperationResult} from "./ArrayOperationResult.js";
|
|
12
13
|
export {default as KeywordReplace} from "./KeywordReplace.js";
|
|
14
|
+
export {default as NamedArray} from "./NamedArray.js";
|
|
13
15
|
|
|
14
16
|
export * as thirdparty from "./thirdparty/index.js";
|
|
15
17
|
export * as svg from "./svg/index.js";
|