dbm 1.1.22 → 1.1.23
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/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class AnchorPosition extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
return React.createElement("div", {"id": this.context.blockData.linkName});
|
|
11
|
+
}
|
|
12
|
+
}
|
package/react/blocks/index.js
CHANGED
|
@@ -215,6 +215,15 @@ export let registerAllBlocks = function() {
|
|
|
215
215
|
registerBlock("content/contentBlock", "Content block", createElement(Dbm.react.blocks.content.ContentBlock, {}), editor, {}, {});
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
{
|
|
219
|
+
let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
|
|
220
|
+
createElement(Dbm.react.form.LabelledArea, {label: "Link name"},
|
|
221
|
+
createElement(Dbm.react.admin.editor.fields.TextField, {name: "linkName"})
|
|
222
|
+
)
|
|
223
|
+
);
|
|
224
|
+
registerBlock("content/anchorPosition", "Anchor position", createElement(Dbm.react.blocks.content.AnchorPosition, {}), editor, {}, {});
|
|
225
|
+
}
|
|
226
|
+
|
|
218
227
|
{
|
|
219
228
|
let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
|
|
220
229
|
createElement(Dbm.react.form.LabelledArea, {label: "Initial sections"},
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
import Cookies from "js-cookie";
|
|
4
|
+
|
|
5
|
+
export default class CookieOverlayMessage extends Dbm.react.BaseObject {
|
|
6
|
+
_construct() {
|
|
7
|
+
super._construct();
|
|
8
|
+
|
|
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);
|
|
27
|
+
|
|
28
|
+
let shouldShow = Cookies.get("cookie/hideCookieBar") !== "1";
|
|
29
|
+
|
|
30
|
+
this.getDynamicProp("open").getMostUpstreamProperty().setValue(shouldShow);
|
|
31
|
+
|
|
32
|
+
this.item.setValue("widthElement", null);
|
|
33
|
+
|
|
34
|
+
let elementSize = new Dbm.flow.updatefunctions.dom.ElementSize();
|
|
35
|
+
this.item.setValue("elementSize", elementSize);
|
|
36
|
+
|
|
37
|
+
elementSize.input.properties.element.connectInput(this.item.properties.widthElement);
|
|
38
|
+
elementSize.start();
|
|
39
|
+
|
|
40
|
+
let layoutSwitch = new Dbm.flow.updatefunctions.logic.RangeSwitch();
|
|
41
|
+
layoutSwitch.input.properties.value.connectInput(elementSize.output.properties.width);
|
|
42
|
+
|
|
43
|
+
layoutSwitch.input.defaultValue = React.createElement("div", {},
|
|
44
|
+
React.createElement("div", {className: "cookie-bar cookie-bar-padding all-pointer-events"},
|
|
45
|
+
|
|
46
|
+
React.createElement("div", {},
|
|
47
|
+
React.createElement("div", {"className": "cookie-bar-title"},
|
|
48
|
+
"Your privacy is important to us"
|
|
49
|
+
),
|
|
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."
|
|
52
|
+
)
|
|
53
|
+
),
|
|
54
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
55
|
+
React.createElement("div", {"className": "standard-button standard-button-padding big text-align-center", onClick: () => this._acceptAll()}, "Allow all"),
|
|
56
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
57
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()}, "Only necessary"),
|
|
58
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
59
|
+
React.createElement("div", {"className": "cookie-overlay-message-divider"}),
|
|
60
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
61
|
+
React.createElement("div", {"className": "text-align-center"},
|
|
62
|
+
"Take full control over how we use cookies:"
|
|
63
|
+
),
|
|
64
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
65
|
+
React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
66
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"}, "Settings")
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
let desktopLayout = React.createElement("div", {className: "centered-site"},
|
|
73
|
+
React.createElement("div", {className: "cookie-overlay-message-box cookie-overlay-message-box-padding all-pointer-events"},
|
|
74
|
+
React.createElement("div", {"className": "flex-row small-item-spacing"},
|
|
75
|
+
React.createElement("div", {"className": "flex-row-item half"},
|
|
76
|
+
React.createElement("div", {"className": "cookie-bar-title"},
|
|
77
|
+
"Your privacy is important to us"
|
|
78
|
+
),
|
|
79
|
+
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."
|
|
81
|
+
)
|
|
82
|
+
),
|
|
83
|
+
React.createElement("div", {"className": "flex-row-item quarter"}),
|
|
84
|
+
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()}, "Allow all"),
|
|
86
|
+
React.createElement("div", {"className": "spacing medium"}),
|
|
87
|
+
React.createElement("div", {"className": "secondary-button standard-button-padding full-width text-align-center", onClick: () => this._rejectAll()}, "Only necessary")
|
|
88
|
+
|
|
89
|
+
)
|
|
90
|
+
),
|
|
91
|
+
React.createElement("div", {"className": "spacing standard"}),
|
|
92
|
+
React.createElement("div", {"className": "cookie-overlay-message-divider"}),
|
|
93
|
+
React.createElement("div", {"className": "spacing standard"}),
|
|
94
|
+
React.createElement("div", {"className": "flex-row small-item-spacing justify-between"},
|
|
95
|
+
React.createElement("div", {"className": "flex-row-item"},
|
|
96
|
+
"Take full control over how we use cookies:"
|
|
97
|
+
),
|
|
98
|
+
React.createElement("div", {"className": "flex-row-item"},
|
|
99
|
+
React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
|
|
100
|
+
React.createElement("div", {"className": "cookie-settings-link"}, "Settings >")
|
|
101
|
+
)
|
|
102
|
+
),
|
|
103
|
+
)
|
|
104
|
+
),
|
|
105
|
+
React.createElement("div", {"className": "spacing double"}),
|
|
106
|
+
React.createElement("div", {"className": "spacing double"}),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
layoutSwitch.addValueForRange(desktopLayout, 700);
|
|
110
|
+
|
|
111
|
+
this.item.setValue("element", null);
|
|
112
|
+
this.item.properties.element.connectInput(layoutSwitch.output.properties.value);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_getDomain() {
|
|
116
|
+
|
|
117
|
+
let parts = document.location.hostname.split('.');
|
|
118
|
+
|
|
119
|
+
let length = parts.length;
|
|
120
|
+
if (length === 1) {
|
|
121
|
+
return parts[0];
|
|
122
|
+
}
|
|
123
|
+
else if(parts[length-2] === "co" && parts[length-1] === "uk") {
|
|
124
|
+
return '.' + parts.slice(-3).join('.');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return '.' + parts.slice(-2).join('.');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
_acceptAll() {
|
|
131
|
+
console.log("_acceptAll");
|
|
132
|
+
|
|
133
|
+
let options = {"expires": 365, "domain": this._getDomain()};
|
|
134
|
+
|
|
135
|
+
Cookies.set("cookie/allowPreferences", "1", options);
|
|
136
|
+
Cookies.set("cookie/allowStatistics", "1", options);
|
|
137
|
+
Cookies.set("cookie/allowMarketing", "1", options);
|
|
138
|
+
Cookies.set("cookie/hideCookieBar", "1", options);
|
|
139
|
+
|
|
140
|
+
let consentTime = (new Date()).toISOString();
|
|
141
|
+
|
|
142
|
+
Cookies.set("cookie/consentTime", consentTime, options);
|
|
143
|
+
|
|
144
|
+
Dbm.getInstance().repository.getItem("trackingController").allowStatistics = true;
|
|
145
|
+
Dbm.getInstance().repository.getItem("trackingController").allowMarketing = true;
|
|
146
|
+
|
|
147
|
+
Dbm.getInstance().repository.getItem("userSettings").setValue("hideCookieBar", true);
|
|
148
|
+
|
|
149
|
+
this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
_rejectAll() {
|
|
153
|
+
|
|
154
|
+
let options = {"expires": 365, "domain": this._getDomain()};
|
|
155
|
+
|
|
156
|
+
Cookies.set("cookie/allowPreferences", "0", options);
|
|
157
|
+
Cookies.set("cookie/allowStatistics", "0", options);
|
|
158
|
+
Cookies.set("cookie/allowMarketing", "0", options);
|
|
159
|
+
Cookies.set("cookie/hideCookieBar", "1", options);
|
|
160
|
+
|
|
161
|
+
let consentTime = (new Date()).toISOString();
|
|
162
|
+
|
|
163
|
+
Cookies.set("cookie/consentTime", consentTime, options);
|
|
164
|
+
|
|
165
|
+
Dbm.getInstance().repository.getItem("trackingController").allowStatistics = false;
|
|
166
|
+
Dbm.getInstance().repository.getItem("trackingController").allowMarketing = false;
|
|
167
|
+
|
|
168
|
+
Dbm.getInstance().repository.getItem("userSettings").setValue("hideCookieBar", true);
|
|
169
|
+
|
|
170
|
+
this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
_renderMainElement() {
|
|
174
|
+
|
|
175
|
+
return this._createMainElement("div", {className: "cookie-bar-position no-pointer-events cookie-overlay-message-layer", ref: this.createRef("widthElement")},
|
|
176
|
+
React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.inDom},
|
|
177
|
+
React.createElement("div", {className: "overflow-hidden"},
|
|
178
|
+
React.createElement(Dbm.react.BaseObject, {style: this.item.properties.style},
|
|
179
|
+
React.createElement("div", {},
|
|
180
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
package/react/cookies/index.js
CHANGED
package/site/SiteNavigation.js
CHANGED
|
@@ -127,6 +127,11 @@ export default class SiteNavigation extends Dbm.core.BaseObject {
|
|
|
127
127
|
if(hardNavigation) {
|
|
128
128
|
shouldSkip = true;
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
let target = currentNode.getAttribute("target");
|
|
132
|
+
if(target === "_blank") {
|
|
133
|
+
shouldSkip = true;
|
|
134
|
+
}
|
|
130
135
|
break;
|
|
131
136
|
}
|
|
132
137
|
}
|