hr-design-system-handlebars 1.52.18 → 1.52.19
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/CHANGELOG.md +13 -0
- package/dist/assets/index.css +3 -3
- package/dist/assets/js/components/dataPolicySettings/dataPolicySettingsDs.feature.js +158 -160
- package/dist/assets/js/components/externalService/datapolicyCookie.subfeature.js +1 -1
- package/dist/assets/js/components/externalService/globalSettingsCookie.subfeature.js +41 -0
- package/package.json +1 -1
- package/src/stories/views/components/dataPolicySettings/dataPolicySettingsDs.feature.js +158 -160
- package/src/stories/views/components/externalService/datapolicyCookie.subfeature.js +1 -1
- package/src/stories/views/components/externalService/globalSettingsCookie.subfeature.js +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v1.52.19 (Mon Jan 29 2024)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Dpe 2708 [#814](https://github.com/mumprod/hr-design-system-handlebars/pull/814) ([@Paul-Atreidis](https://github.com/Paul-Atreidis) [@vascoeduardo](https://github.com/vascoeduardo))
|
|
6
|
+
|
|
7
|
+
#### Authors: 2
|
|
8
|
+
|
|
9
|
+
- [@Paul-Atreidis](https://github.com/Paul-Atreidis)
|
|
10
|
+
- Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
1
14
|
# v1.52.18 (Fri Jan 26 2024)
|
|
2
15
|
|
|
3
16
|
#### 🐛 Bug Fix
|
package/dist/assets/index.css
CHANGED
|
@@ -3261,7 +3261,7 @@ a.link {
|
|
|
3261
3261
|
border-bottom-color: var(--color-secondary-ds);
|
|
3262
3262
|
}
|
|
3263
3263
|
.counter-reset {
|
|
3264
|
-
counter-reset:
|
|
3264
|
+
counter-reset: cnt1706545010322;
|
|
3265
3265
|
}
|
|
3266
3266
|
.hyphens-auto {
|
|
3267
3267
|
-webkit-hyphens: auto;
|
|
@@ -3563,7 +3563,7 @@ a.link {
|
|
|
3563
3563
|
--tw-ring-color: rgba(255, 255, 255, 0.5);
|
|
3564
3564
|
}
|
|
3565
3565
|
.-ordered {
|
|
3566
|
-
counter-increment:
|
|
3566
|
+
counter-increment: cnt1706545010322 1;
|
|
3567
3567
|
}
|
|
3568
3568
|
.-ordered::before {
|
|
3569
3569
|
position: absolute;
|
|
@@ -3579,7 +3579,7 @@ a.link {
|
|
|
3579
3579
|
letter-spacing: .0125em;
|
|
3580
3580
|
--tw-text-opacity: 1;
|
|
3581
3581
|
color: rgba(0, 0, 0, var(--tw-text-opacity));
|
|
3582
|
-
content: counter(
|
|
3582
|
+
content: counter(cnt1706545010322);
|
|
3583
3583
|
}
|
|
3584
3584
|
/*! ****************************/
|
|
3585
3585
|
/*! DataPolicy stuff */
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import SettingsCookie from 'components/externalService/globalSettingsCookie.subfeature'
|
|
1
2
|
import DatapolicyCookie from 'components/externalService/datapolicyCookie.subfeature'
|
|
2
3
|
import TrackingCookie from 'components/externalService/trackingCookie.subfeature'
|
|
3
4
|
import { fireEvent, getJSONCookie, hr$, setJSONCookie, listen } from 'hrQuery'
|
|
4
5
|
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
5
6
|
|
|
6
7
|
import A11yDialog from 'a11y-dialog'
|
|
8
|
+
import { deleteCookie } from '../../generic/hrQuery.subfeature'
|
|
7
9
|
|
|
8
10
|
const DataPolicySettings = function (context) {
|
|
9
11
|
const { options } = context,
|
|
@@ -16,204 +18,161 @@ const DataPolicySettings = function (context) {
|
|
|
16
18
|
bodyElement = document.getElementsByTagName('html')[0],
|
|
17
19
|
datapolicyCookie = new DatapolicyCookie(),
|
|
18
20
|
trackingCookie = new TrackingCookie(),
|
|
21
|
+
settingsCookie = new SettingsCookie(),
|
|
19
22
|
toggleSwitches = hr$('.js-toggleSwitch-checkbox', container),
|
|
20
23
|
toggleSwitchesExternal = hr$('.js-toggleSwitch-external', container),
|
|
21
24
|
toggleSwitchesTracking = hr$('.js-toggleSwitch-tracking', container),
|
|
22
25
|
toggleAllSwitch = hr$('.js-toggleSwitch-checkbox-all', container)[0],
|
|
23
|
-
providerTitle = hr$('.js-providerTitle', container)[0]
|
|
24
|
-
trackingCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10
|
|
25
|
-
let isWebview = window.parent.document.documentElement.classList.contains('webview'),
|
|
26
|
-
cookie = {}
|
|
26
|
+
providerTitle = hr$('.js-providerTitle', container)[0]
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
let isWebview = window.parent.document.documentElement.classList.contains('webview'),
|
|
29
|
+
appSettingsCookie = {},
|
|
30
|
+
dataDataPolicyCookie = {},
|
|
31
|
+
dataTrackingCookie = {},
|
|
32
|
+
dataSettingsCookie = {}
|
|
33
|
+
|
|
34
|
+
//Überprüfung ob die alten Cookies zusammengeführt werden müssen
|
|
35
|
+
const checkForExistingCookies = function () {
|
|
36
|
+
if(getJSONCookie('datapolicy') || getJSONCookie('tracking')){
|
|
37
|
+
console.log("hessenschau bisher => Beide Cookies existieren")
|
|
38
|
+
deleteOldCookiesandTransferData()
|
|
39
|
+
}
|
|
40
|
+
else{
|
|
41
|
+
console.log("hessenschau neu => nach der Löschung der beiden alten Cookies muß hier gelesen werden")
|
|
42
|
+
if(getJSONCookie('hrSettings')) {
|
|
43
|
+
getAllToggleValuesFromSettings()
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log("hessenschau neu => wenn kein hrSettings erzeugt wurde")
|
|
47
|
+
let whitelist = ["agf","ati","ard_mediathek","arte_concert","arte_concert_new","datawrapper_cdn"]
|
|
48
|
+
for (let i = 0; i < toggleSwitches.length; ++i) {
|
|
49
|
+
if(toggleSwitches[i].id == "agf" || toggleSwitches[i].id == "ati" || toggleSwitches[i].id == "ard_mediathek" || toggleSwitches[i].id == "arte_concert" || toggleSwitches[i].id == "arte_concert_new" || toggleSwitches[i].id == "datawrapper_cdn"){
|
|
50
|
+
setCookieForSettings(toggleSwitches[i].id, true)
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setCookieForSettings(toggleSwitches[i].id, false)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
setAllToggleValuesFromSettings()
|
|
57
|
+
changeProviderTitle()
|
|
42
58
|
}
|
|
43
|
-
} else {
|
|
44
|
-
settingsButton.style.display = 'inline-flex'
|
|
45
|
-
console.log('Button immer anzeigen, weil nicht App')
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
|
-
const readAppSettingsButtonCookie = function () {
|
|
49
|
-
cookie = getJSONCookie('appSettings') || {}
|
|
50
|
-
}
|
|
51
|
-
const writeAppSettingsButtonCookie = function () {
|
|
52
|
-
cookie = 'true'
|
|
53
|
-
setJSONCookie('hsAppSettingsButton', cookie, trackingCookieLifetime)
|
|
54
|
-
}
|
|
55
61
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const deleteOldCookiesandTransferData = function () {
|
|
63
|
+
dataDataPolicyCookie = getJSONCookie('datapolicy') || {}
|
|
64
|
+
dataTrackingCookie = getJSONCookie('tracking') || {}
|
|
65
|
+
let objMerge
|
|
66
|
+
// Beide bestehenden JSONs aus Tracking und Service werden zusammengeführt.
|
|
67
|
+
objMerge = JSON.stringify(dataTrackingCookie) + JSON.stringify(dataDataPolicyCookie);
|
|
68
|
+
objMerge = objMerge.replace(/\}\{/, ",");
|
|
69
|
+
objMerge = JSON.parse(objMerge);
|
|
70
|
+
let objArray = Object.entries(objMerge);
|
|
71
|
+
objArray.forEach(([key, value]) => {
|
|
72
|
+
//hrSettingsCookie wird geschrieben
|
|
73
|
+
setCookieForSettings(key, value)
|
|
74
|
+
});
|
|
75
|
+
setAllToggleValuesFromSettings()
|
|
76
|
+
changeProviderTitle()
|
|
77
|
+
deleteCookie('datapolicy')
|
|
78
|
+
deleteCookie('tracking')
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (typeof urlParam !== 'undefined' && urlParam === 'true') {
|
|
76
|
-
dialog.show()
|
|
81
|
+
const setCookieForSettings = function (key, value) {
|
|
82
|
+
settingsCookie.setCookieForOptions(key, value)
|
|
83
|
+
if (value) {
|
|
84
|
+
fireEvent('hr:externalService-activate-' + key)
|
|
85
|
+
} else {
|
|
86
|
+
fireEvent('hr:externalService-deactivate-' + key)
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
|
-
const getUrlVars = function () {
|
|
80
|
-
let vars = {}
|
|
81
|
-
const parts = window.location.href.replace(
|
|
82
|
-
/[?&]+([^=&]+)=([^&]*)/gi,
|
|
83
|
-
function (m, key, value) {
|
|
84
|
-
vars[key] = value
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
return vars
|
|
88
|
-
}
|
|
89
|
-
///////////////////
|
|
90
|
-
// OVERLAY END ////
|
|
91
|
-
///////////////////
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
const getAllToggleValuesFromSettings = function () {
|
|
91
|
+
setAllToggleValuesFromSettings()
|
|
92
|
+
changeProviderTitle()
|
|
93
|
+
//initial alles deaktivieren
|
|
94
|
+
//hr-settings schreiben
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
99
|
-
initializeEventListenerForService(i)
|
|
96
|
+
}
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
const setAllToggleValuesFromSettings = function () {
|
|
99
|
+
dataSettingsCookie = getJSONCookie('hrSettings') || {}
|
|
100
|
+
let settingId
|
|
101
|
+
let settingState
|
|
102
|
+
for (let i = 0; i < toggleSwitches.length; ++i) {
|
|
103
|
+
settingId = toggleSwitches[i].id
|
|
104
|
+
settingState = dataSettingsCookie.settingId
|
|
105
|
+
document.getElementById(toggleSwitches[i].id).checked = settingState
|
|
106
|
+
|
|
107
|
+
setAllToggleEventListeners(toggleSwitches[i])
|
|
108
|
+
initializeAllToggleEventListeners(i)
|
|
102
109
|
|
|
103
|
-
if (
|
|
104
|
-
|
|
110
|
+
if (isCookieSetForSettings(toggleSwitches[i].id)) {
|
|
111
|
+
toggleSwitches[i].checked = true
|
|
105
112
|
} else if (
|
|
106
|
-
!
|
|
107
|
-
|
|
113
|
+
!isCookieExistForSettings(toggleSwitches[i].id) &&
|
|
114
|
+
toggleSwitches[i].getAttribute('initial') == 'checked'
|
|
108
115
|
) {
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
toggleSwitches[i].checked = true
|
|
117
|
+
setCookieForSettings(toggleSwitches[i].id,toggleSwitches[i].checked)
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
|
-
|
|
114
|
-
toggleAllSwitch.checked = allTogglesChecked()
|
|
115
|
-
changeProviderTitle()
|
|
120
|
+
toggleAllSwitch.checked = allTogglesExternalServiceChecked()
|
|
116
121
|
}
|
|
117
|
-
const initializeToggleStateTracking = function () {
|
|
118
|
-
for (let i = 0; i < toggleSwitchesTracking.length; ++i) {
|
|
119
|
-
initializeEventListenerForTracking(i)
|
|
120
|
-
|
|
121
|
-
setListenerForTracking(toggleSwitchesTracking[i])
|
|
122
|
-
|
|
123
|
-
if (isCookieSetForTracking(toggleSwitchesTracking[i].id)) {
|
|
124
|
-
toggleSwitchesTracking[i].checked = true
|
|
125
|
-
}
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
toggleSwitchesTracking[i].getAttribute('initial') == 'checked'
|
|
130
|
-
) {
|
|
131
|
-
toggleSwitchesTracking[i].checked = true
|
|
132
|
-
setCookieForTracking(toggleSwitchesTracking[i])
|
|
133
|
-
}
|
|
134
|
-
}
|
|
123
|
+
const isCookieSetForSettings = function (externalService) {
|
|
124
|
+
return settingsCookie.isSettingsCookieAccepted(externalService)
|
|
135
125
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function () {
|
|
140
|
-
toggleSwitchesExternal[serviceId].checked = true
|
|
141
|
-
},
|
|
142
|
-
document
|
|
143
|
-
)
|
|
126
|
+
|
|
127
|
+
const isCookieExistForSettings = function (externalService) {
|
|
128
|
+
return settingsCookie.isSettingsCookieExistent(externalService)
|
|
144
129
|
}
|
|
145
|
-
|
|
130
|
+
|
|
131
|
+
const initializeAllToggleEventListeners = function (serviceId) {
|
|
146
132
|
listen(
|
|
147
|
-
'hr:
|
|
133
|
+
'hr:externalService-activate-' + toggleSwitches[serviceId].id,
|
|
148
134
|
function () {
|
|
149
|
-
|
|
135
|
+
toggleSwitches[serviceId].checked = true
|
|
150
136
|
},
|
|
151
137
|
document
|
|
152
138
|
)
|
|
153
139
|
}
|
|
154
|
-
|
|
140
|
+
|
|
141
|
+
const setAllToggleEventListeners = function (element) {
|
|
155
142
|
listen(
|
|
156
143
|
'change',
|
|
157
144
|
function () {
|
|
158
|
-
|
|
159
|
-
toggleAllSwitch.checked =
|
|
145
|
+
setCookieForSettings(element.id, element.checked)
|
|
146
|
+
toggleAllSwitch.checked = allTogglesExternalServiceChecked()
|
|
160
147
|
changeProviderTitle()
|
|
161
148
|
},
|
|
162
149
|
element
|
|
163
150
|
)
|
|
164
151
|
}
|
|
165
|
-
const setListenerForTracking = function (element) {
|
|
166
|
-
listen(
|
|
167
|
-
'change',
|
|
168
|
-
function () {
|
|
169
|
-
setCookieForTracking(element)
|
|
170
|
-
},
|
|
171
|
-
element
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
const setCookieForService = function (element) {
|
|
175
|
-
datapolicyCookie.setCookieForExternalService(element.id, element.checked)
|
|
176
|
-
if (element.checked) {
|
|
177
|
-
fireEvent('hr:externalService-activate-' + element.id)
|
|
178
|
-
} else {
|
|
179
|
-
console.log('fireEvent: hr:externalService-deactivate-' + element.id)
|
|
180
|
-
fireEvent('hr:externalService-deactivate-' + element.id)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const setCookieForTracking = function (element) {
|
|
184
|
-
trackingCookie.setCookieForTracking(element.id, element.checked)
|
|
185
|
-
if (element.checked) {
|
|
186
|
-
fireEvent('hr:trackingService-activate-' + element.id)
|
|
187
|
-
} else {
|
|
188
|
-
fireEvent('hr:trackingService-deactivate-' + element.id)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const toggleAll = function () {
|
|
192
|
-
console.log('Toggle All' + toggleAllSwitch.checked)
|
|
193
152
|
|
|
153
|
+
const toggleAll = function () {
|
|
194
154
|
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
195
155
|
if (toggleSwitchesExternal[i].checked != toggleAllSwitch.checked) {
|
|
196
156
|
toggleSwitchesExternal[i].checked = toggleAllSwitch.checked
|
|
197
|
-
|
|
157
|
+
setCookieForSettings(toggleSwitchesExternal[i].id, toggleSwitchesExternal[i].checked)
|
|
198
158
|
}
|
|
199
159
|
}
|
|
200
|
-
|
|
201
160
|
changeProviderTitle()
|
|
202
161
|
}
|
|
203
|
-
const allTogglesChecked = function () {
|
|
204
|
-
let allChecked
|
|
205
162
|
|
|
163
|
+
const allTogglesExternalServiceChecked = function () {
|
|
164
|
+
let allChecked
|
|
206
165
|
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
207
166
|
if (toggleSwitchesExternal[i].checked) {
|
|
208
167
|
allChecked = true
|
|
209
168
|
} else {
|
|
210
169
|
allChecked = false
|
|
211
|
-
|
|
212
170
|
break
|
|
213
171
|
}
|
|
214
172
|
}
|
|
215
173
|
return allChecked
|
|
216
174
|
}
|
|
175
|
+
|
|
217
176
|
const changeProviderTitle = function () {
|
|
218
177
|
if (toggleAllSwitch.checked == true) {
|
|
219
178
|
providerTitle.textContent = 'Alle Anbieter deaktivieren'
|
|
@@ -221,35 +180,74 @@ const DataPolicySettings = function (context) {
|
|
|
221
180
|
providerTitle.textContent = 'Alle Anbieter aktivieren'
|
|
222
181
|
}
|
|
223
182
|
}
|
|
224
|
-
|
|
225
|
-
return datapolicyCookie.isDatapolicyAccepted(externalService)
|
|
226
|
-
}
|
|
227
|
-
const isCookieSetForTracking = function (trackingService) {
|
|
228
|
-
return trackingCookie.isTrackingAccepted(trackingService)
|
|
229
|
-
}
|
|
230
|
-
const isCookieExistForService = function (externalService) {
|
|
231
|
-
return datapolicyCookie.isDatapolicyExistent(externalService)
|
|
232
|
-
}
|
|
233
|
-
const isCookieExistForTracking = function (trackingService) {
|
|
234
|
-
return trackingCookie.isTrackingCookieExistent(trackingService)
|
|
235
|
-
}
|
|
183
|
+
|
|
236
184
|
const initializeEventListeners = function () {
|
|
237
185
|
listen('change', toggleAll, toggleAllSwitch)
|
|
238
186
|
listen("show", onDialogShow, container)
|
|
239
187
|
listen("hide", onDialogHide, container)
|
|
240
188
|
}
|
|
241
|
-
// steuert die Darstellung des Buttons für die hs-App ///
|
|
242
|
-
showSettingsButton()
|
|
243
|
-
//// 1. Toggle States aller Switches setzen ////
|
|
244
|
-
//// Cookies setzen usw. ////
|
|
245
|
-
initializeToggleStateExternal()
|
|
246
189
|
|
|
247
|
-
|
|
190
|
+
const readAppSettingsButtonCookie = function () {
|
|
191
|
+
/* Das Cookie 'appSettings' wird in der App-Logik für die Webview erzeugt. Hier nur ausgelesen, um die Option für den Settings-Button abzufragen */
|
|
192
|
+
appSettingsCookie = getJSONCookie('appSettings') || {}
|
|
193
|
+
}
|
|
248
194
|
|
|
249
|
-
|
|
250
|
-
|
|
195
|
+
//Für die hs-App wird der Button ein und ausgeblendet
|
|
196
|
+
const showSettingsButton = function () {
|
|
197
|
+
let settingsButton = document.getElementById('globalSettingsButton')
|
|
198
|
+
if (isWebview) {
|
|
199
|
+
readAppSettingsButtonCookie()
|
|
200
|
+
if (appSettingsCookie['hidePrivacySettingsButton'] === true) {
|
|
201
|
+
settingsButton.style.display = 'none'
|
|
202
|
+
} else {
|
|
203
|
+
settingsButton.style.display = 'inline-flex'
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
settingsButton.style.display = 'inline-flex'
|
|
207
|
+
}
|
|
208
|
+
}
|
|
251
209
|
|
|
210
|
+
const onDialogShow = function (event) {
|
|
211
|
+
bodyElement.classList.add('optionOpen')
|
|
212
|
+
const opener = event.detail == null && event.detail.target.closest('[data-a11y-dialog-show]') ? event.detail.target.closest('[data-a11y-dialog-show]') : null
|
|
213
|
+
const pianoTracking = null != opener && undefined !== opener.dataset.pianoTracking ? JSON.parse(opener.dataset.pianoTracking) : {label:"Datenschutzerklärung"}
|
|
214
|
+
if(undefined !== pianoTracking.secondLevelId){
|
|
215
|
+
console.log(pianoTracking)
|
|
216
|
+
uxAction('Einstellungsdialog geöffnet - ' + pianoTracking.label, pianoTracking.secondLevelId)
|
|
217
|
+
}else{
|
|
218
|
+
console.log(pianoTracking)
|
|
219
|
+
uxAction('Einstellungsdialog geöffnet - ' + pianoTracking.label)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const onDialogHide = function () {
|
|
224
|
+
console.log("Hide")
|
|
225
|
+
bodyElement.classList.remove('optionOpen')
|
|
226
|
+
}
|
|
227
|
+
const shouldDialogBeOpendOnLoad = function () {
|
|
228
|
+
const urlParam = getUrlVars()['openDialog']
|
|
229
|
+
if (typeof urlParam !== 'undefined' && urlParam === 'true') {
|
|
230
|
+
dialog.show()
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const getUrlVars = function () {
|
|
234
|
+
let vars = {}
|
|
235
|
+
const parts = window.location.href.replace(
|
|
236
|
+
/[?&]+([^=&]+)=([^&]*)/gi,
|
|
237
|
+
function (m, key, value) {
|
|
238
|
+
vars[key] = value
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
return vars
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// steuert die Darstellung des Buttons für die hs-App ///
|
|
245
|
+
showSettingsButton()
|
|
246
|
+
// Überprüfen ob die alten Cookies vorhanden sind
|
|
247
|
+
checkForExistingCookies()
|
|
248
|
+
initializeEventListeners()
|
|
252
249
|
shouldDialogBeOpendOnLoad()
|
|
250
|
+
|
|
253
251
|
}
|
|
254
252
|
|
|
255
253
|
export default DataPolicySettings
|
|
@@ -34,7 +34,7 @@ const DataPolicyCookie = function () {
|
|
|
34
34
|
return {
|
|
35
35
|
setCookieForExternalService: setCookieForExternalService,
|
|
36
36
|
isDatapolicyAccepted: isDatapolicyAccepted,
|
|
37
|
-
isDatapolicyExistent: isDatapolicyExistent
|
|
37
|
+
isDatapolicyExistent: isDatapolicyExistent
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getJSONCookie, setJSONCookie } from 'hrQuery'
|
|
2
|
+
|
|
3
|
+
const GlobalSettingsCookie = function () {
|
|
4
|
+
const settingsCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10 /* 10 years */
|
|
5
|
+
let cookie = {}
|
|
6
|
+
|
|
7
|
+
const setCookieForOptions = function (option, state) {
|
|
8
|
+
if (state == null) {
|
|
9
|
+
state = true
|
|
10
|
+
}
|
|
11
|
+
console.log('Schreibe Settings-Cookie: ' + option + ': ' + state)
|
|
12
|
+
readSettingsCookie()
|
|
13
|
+
cookie[option] = state
|
|
14
|
+
writeSettingsCookie()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const isSettingsCookieAccepted = function (externalService) {
|
|
18
|
+
readSettingsCookie()
|
|
19
|
+
return cookie[externalService] === true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const writeSettingsCookie = function () {
|
|
23
|
+
setJSONCookie('hrSettings', cookie, settingsCookieLifetime)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const readSettingsCookie = function () {
|
|
27
|
+
cookie = getJSONCookie('hrSettings') || {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isSettingsCookieExistent = function (option) {
|
|
31
|
+
readSettingsCookie()
|
|
32
|
+
return cookie.hasOwnProperty(option)
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
setCookieForOptions: setCookieForOptions,
|
|
36
|
+
isSettingsCookieExistent: isSettingsCookieExistent,
|
|
37
|
+
isSettingsCookieAccepted: isSettingsCookieAccepted
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default GlobalSettingsCookie
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"repository": "https://github.com/szuelch/hr-design-system-handlebars",
|
|
9
|
-
"version": "1.52.
|
|
9
|
+
"version": "1.52.19",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"storybook": "storybook dev -p 6006 public",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import SettingsCookie from 'components/externalService/globalSettingsCookie.subfeature'
|
|
1
2
|
import DatapolicyCookie from 'components/externalService/datapolicyCookie.subfeature'
|
|
2
3
|
import TrackingCookie from 'components/externalService/trackingCookie.subfeature'
|
|
3
4
|
import { fireEvent, getJSONCookie, hr$, setJSONCookie, listen } from 'hrQuery'
|
|
4
5
|
import { uxAction } from 'base/tracking/pianoHelper.subfeature'
|
|
5
6
|
|
|
6
7
|
import A11yDialog from 'a11y-dialog'
|
|
8
|
+
import { deleteCookie } from '../../generic/hrQuery.subfeature'
|
|
7
9
|
|
|
8
10
|
const DataPolicySettings = function (context) {
|
|
9
11
|
const { options } = context,
|
|
@@ -16,204 +18,161 @@ const DataPolicySettings = function (context) {
|
|
|
16
18
|
bodyElement = document.getElementsByTagName('html')[0],
|
|
17
19
|
datapolicyCookie = new DatapolicyCookie(),
|
|
18
20
|
trackingCookie = new TrackingCookie(),
|
|
21
|
+
settingsCookie = new SettingsCookie(),
|
|
19
22
|
toggleSwitches = hr$('.js-toggleSwitch-checkbox', container),
|
|
20
23
|
toggleSwitchesExternal = hr$('.js-toggleSwitch-external', container),
|
|
21
24
|
toggleSwitchesTracking = hr$('.js-toggleSwitch-tracking', container),
|
|
22
25
|
toggleAllSwitch = hr$('.js-toggleSwitch-checkbox-all', container)[0],
|
|
23
|
-
providerTitle = hr$('.js-providerTitle', container)[0]
|
|
24
|
-
trackingCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10
|
|
25
|
-
let isWebview = window.parent.document.documentElement.classList.contains('webview'),
|
|
26
|
-
cookie = {}
|
|
26
|
+
providerTitle = hr$('.js-providerTitle', container)[0]
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
let isWebview = window.parent.document.documentElement.classList.contains('webview'),
|
|
29
|
+
appSettingsCookie = {},
|
|
30
|
+
dataDataPolicyCookie = {},
|
|
31
|
+
dataTrackingCookie = {},
|
|
32
|
+
dataSettingsCookie = {}
|
|
33
|
+
|
|
34
|
+
//Überprüfung ob die alten Cookies zusammengeführt werden müssen
|
|
35
|
+
const checkForExistingCookies = function () {
|
|
36
|
+
if(getJSONCookie('datapolicy') || getJSONCookie('tracking')){
|
|
37
|
+
console.log("hessenschau bisher => Beide Cookies existieren")
|
|
38
|
+
deleteOldCookiesandTransferData()
|
|
39
|
+
}
|
|
40
|
+
else{
|
|
41
|
+
console.log("hessenschau neu => nach der Löschung der beiden alten Cookies muß hier gelesen werden")
|
|
42
|
+
if(getJSONCookie('hrSettings')) {
|
|
43
|
+
getAllToggleValuesFromSettings()
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.log("hessenschau neu => wenn kein hrSettings erzeugt wurde")
|
|
47
|
+
let whitelist = ["agf","ati","ard_mediathek","arte_concert","arte_concert_new","datawrapper_cdn"]
|
|
48
|
+
for (let i = 0; i < toggleSwitches.length; ++i) {
|
|
49
|
+
if(toggleSwitches[i].id == "agf" || toggleSwitches[i].id == "ati" || toggleSwitches[i].id == "ard_mediathek" || toggleSwitches[i].id == "arte_concert" || toggleSwitches[i].id == "arte_concert_new" || toggleSwitches[i].id == "datawrapper_cdn"){
|
|
50
|
+
setCookieForSettings(toggleSwitches[i].id, true)
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setCookieForSettings(toggleSwitches[i].id, false)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
setAllToggleValuesFromSettings()
|
|
57
|
+
changeProviderTitle()
|
|
42
58
|
}
|
|
43
|
-
} else {
|
|
44
|
-
settingsButton.style.display = 'inline-flex'
|
|
45
|
-
console.log('Button immer anzeigen, weil nicht App')
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
|
-
const readAppSettingsButtonCookie = function () {
|
|
49
|
-
cookie = getJSONCookie('appSettings') || {}
|
|
50
|
-
}
|
|
51
|
-
const writeAppSettingsButtonCookie = function () {
|
|
52
|
-
cookie = 'true'
|
|
53
|
-
setJSONCookie('hsAppSettingsButton', cookie, trackingCookieLifetime)
|
|
54
|
-
}
|
|
55
61
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const deleteOldCookiesandTransferData = function () {
|
|
63
|
+
dataDataPolicyCookie = getJSONCookie('datapolicy') || {}
|
|
64
|
+
dataTrackingCookie = getJSONCookie('tracking') || {}
|
|
65
|
+
let objMerge
|
|
66
|
+
// Beide bestehenden JSONs aus Tracking und Service werden zusammengeführt.
|
|
67
|
+
objMerge = JSON.stringify(dataTrackingCookie) + JSON.stringify(dataDataPolicyCookie);
|
|
68
|
+
objMerge = objMerge.replace(/\}\{/, ",");
|
|
69
|
+
objMerge = JSON.parse(objMerge);
|
|
70
|
+
let objArray = Object.entries(objMerge);
|
|
71
|
+
objArray.forEach(([key, value]) => {
|
|
72
|
+
//hrSettingsCookie wird geschrieben
|
|
73
|
+
setCookieForSettings(key, value)
|
|
74
|
+
});
|
|
75
|
+
setAllToggleValuesFromSettings()
|
|
76
|
+
changeProviderTitle()
|
|
77
|
+
deleteCookie('datapolicy')
|
|
78
|
+
deleteCookie('tracking')
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (typeof urlParam !== 'undefined' && urlParam === 'true') {
|
|
76
|
-
dialog.show()
|
|
81
|
+
const setCookieForSettings = function (key, value) {
|
|
82
|
+
settingsCookie.setCookieForOptions(key, value)
|
|
83
|
+
if (value) {
|
|
84
|
+
fireEvent('hr:externalService-activate-' + key)
|
|
85
|
+
} else {
|
|
86
|
+
fireEvent('hr:externalService-deactivate-' + key)
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
|
-
const getUrlVars = function () {
|
|
80
|
-
let vars = {}
|
|
81
|
-
const parts = window.location.href.replace(
|
|
82
|
-
/[?&]+([^=&]+)=([^&]*)/gi,
|
|
83
|
-
function (m, key, value) {
|
|
84
|
-
vars[key] = value
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
return vars
|
|
88
|
-
}
|
|
89
|
-
///////////////////
|
|
90
|
-
// OVERLAY END ////
|
|
91
|
-
///////////////////
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
const getAllToggleValuesFromSettings = function () {
|
|
91
|
+
setAllToggleValuesFromSettings()
|
|
92
|
+
changeProviderTitle()
|
|
93
|
+
//initial alles deaktivieren
|
|
94
|
+
//hr-settings schreiben
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
99
|
-
initializeEventListenerForService(i)
|
|
96
|
+
}
|
|
100
97
|
|
|
101
|
-
|
|
98
|
+
const setAllToggleValuesFromSettings = function () {
|
|
99
|
+
dataSettingsCookie = getJSONCookie('hrSettings') || {}
|
|
100
|
+
let settingId
|
|
101
|
+
let settingState
|
|
102
|
+
for (let i = 0; i < toggleSwitches.length; ++i) {
|
|
103
|
+
settingId = toggleSwitches[i].id
|
|
104
|
+
settingState = dataSettingsCookie.settingId
|
|
105
|
+
document.getElementById(toggleSwitches[i].id).checked = settingState
|
|
106
|
+
|
|
107
|
+
setAllToggleEventListeners(toggleSwitches[i])
|
|
108
|
+
initializeAllToggleEventListeners(i)
|
|
102
109
|
|
|
103
|
-
if (
|
|
104
|
-
|
|
110
|
+
if (isCookieSetForSettings(toggleSwitches[i].id)) {
|
|
111
|
+
toggleSwitches[i].checked = true
|
|
105
112
|
} else if (
|
|
106
|
-
!
|
|
107
|
-
|
|
113
|
+
!isCookieExistForSettings(toggleSwitches[i].id) &&
|
|
114
|
+
toggleSwitches[i].getAttribute('initial') == 'checked'
|
|
108
115
|
) {
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
toggleSwitches[i].checked = true
|
|
117
|
+
setCookieForSettings(toggleSwitches[i].id,toggleSwitches[i].checked)
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
|
-
|
|
114
|
-
toggleAllSwitch.checked = allTogglesChecked()
|
|
115
|
-
changeProviderTitle()
|
|
120
|
+
toggleAllSwitch.checked = allTogglesExternalServiceChecked()
|
|
116
121
|
}
|
|
117
|
-
const initializeToggleStateTracking = function () {
|
|
118
|
-
for (let i = 0; i < toggleSwitchesTracking.length; ++i) {
|
|
119
|
-
initializeEventListenerForTracking(i)
|
|
120
|
-
|
|
121
|
-
setListenerForTracking(toggleSwitchesTracking[i])
|
|
122
|
-
|
|
123
|
-
if (isCookieSetForTracking(toggleSwitchesTracking[i].id)) {
|
|
124
|
-
toggleSwitchesTracking[i].checked = true
|
|
125
|
-
}
|
|
126
122
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
toggleSwitchesTracking[i].getAttribute('initial') == 'checked'
|
|
130
|
-
) {
|
|
131
|
-
toggleSwitchesTracking[i].checked = true
|
|
132
|
-
setCookieForTracking(toggleSwitchesTracking[i])
|
|
133
|
-
}
|
|
134
|
-
}
|
|
123
|
+
const isCookieSetForSettings = function (externalService) {
|
|
124
|
+
return settingsCookie.isSettingsCookieAccepted(externalService)
|
|
135
125
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
function () {
|
|
140
|
-
toggleSwitchesExternal[serviceId].checked = true
|
|
141
|
-
},
|
|
142
|
-
document
|
|
143
|
-
)
|
|
126
|
+
|
|
127
|
+
const isCookieExistForSettings = function (externalService) {
|
|
128
|
+
return settingsCookie.isSettingsCookieExistent(externalService)
|
|
144
129
|
}
|
|
145
|
-
|
|
130
|
+
|
|
131
|
+
const initializeAllToggleEventListeners = function (serviceId) {
|
|
146
132
|
listen(
|
|
147
|
-
'hr:
|
|
133
|
+
'hr:externalService-activate-' + toggleSwitches[serviceId].id,
|
|
148
134
|
function () {
|
|
149
|
-
|
|
135
|
+
toggleSwitches[serviceId].checked = true
|
|
150
136
|
},
|
|
151
137
|
document
|
|
152
138
|
)
|
|
153
139
|
}
|
|
154
|
-
|
|
140
|
+
|
|
141
|
+
const setAllToggleEventListeners = function (element) {
|
|
155
142
|
listen(
|
|
156
143
|
'change',
|
|
157
144
|
function () {
|
|
158
|
-
|
|
159
|
-
toggleAllSwitch.checked =
|
|
145
|
+
setCookieForSettings(element.id, element.checked)
|
|
146
|
+
toggleAllSwitch.checked = allTogglesExternalServiceChecked()
|
|
160
147
|
changeProviderTitle()
|
|
161
148
|
},
|
|
162
149
|
element
|
|
163
150
|
)
|
|
164
151
|
}
|
|
165
|
-
const setListenerForTracking = function (element) {
|
|
166
|
-
listen(
|
|
167
|
-
'change',
|
|
168
|
-
function () {
|
|
169
|
-
setCookieForTracking(element)
|
|
170
|
-
},
|
|
171
|
-
element
|
|
172
|
-
)
|
|
173
|
-
}
|
|
174
|
-
const setCookieForService = function (element) {
|
|
175
|
-
datapolicyCookie.setCookieForExternalService(element.id, element.checked)
|
|
176
|
-
if (element.checked) {
|
|
177
|
-
fireEvent('hr:externalService-activate-' + element.id)
|
|
178
|
-
} else {
|
|
179
|
-
console.log('fireEvent: hr:externalService-deactivate-' + element.id)
|
|
180
|
-
fireEvent('hr:externalService-deactivate-' + element.id)
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const setCookieForTracking = function (element) {
|
|
184
|
-
trackingCookie.setCookieForTracking(element.id, element.checked)
|
|
185
|
-
if (element.checked) {
|
|
186
|
-
fireEvent('hr:trackingService-activate-' + element.id)
|
|
187
|
-
} else {
|
|
188
|
-
fireEvent('hr:trackingService-deactivate-' + element.id)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const toggleAll = function () {
|
|
192
|
-
console.log('Toggle All' + toggleAllSwitch.checked)
|
|
193
152
|
|
|
153
|
+
const toggleAll = function () {
|
|
194
154
|
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
195
155
|
if (toggleSwitchesExternal[i].checked != toggleAllSwitch.checked) {
|
|
196
156
|
toggleSwitchesExternal[i].checked = toggleAllSwitch.checked
|
|
197
|
-
|
|
157
|
+
setCookieForSettings(toggleSwitchesExternal[i].id, toggleSwitchesExternal[i].checked)
|
|
198
158
|
}
|
|
199
159
|
}
|
|
200
|
-
|
|
201
160
|
changeProviderTitle()
|
|
202
161
|
}
|
|
203
|
-
const allTogglesChecked = function () {
|
|
204
|
-
let allChecked
|
|
205
162
|
|
|
163
|
+
const allTogglesExternalServiceChecked = function () {
|
|
164
|
+
let allChecked
|
|
206
165
|
for (let i = 0; i < toggleSwitchesExternal.length; ++i) {
|
|
207
166
|
if (toggleSwitchesExternal[i].checked) {
|
|
208
167
|
allChecked = true
|
|
209
168
|
} else {
|
|
210
169
|
allChecked = false
|
|
211
|
-
|
|
212
170
|
break
|
|
213
171
|
}
|
|
214
172
|
}
|
|
215
173
|
return allChecked
|
|
216
174
|
}
|
|
175
|
+
|
|
217
176
|
const changeProviderTitle = function () {
|
|
218
177
|
if (toggleAllSwitch.checked == true) {
|
|
219
178
|
providerTitle.textContent = 'Alle Anbieter deaktivieren'
|
|
@@ -221,35 +180,74 @@ const DataPolicySettings = function (context) {
|
|
|
221
180
|
providerTitle.textContent = 'Alle Anbieter aktivieren'
|
|
222
181
|
}
|
|
223
182
|
}
|
|
224
|
-
|
|
225
|
-
return datapolicyCookie.isDatapolicyAccepted(externalService)
|
|
226
|
-
}
|
|
227
|
-
const isCookieSetForTracking = function (trackingService) {
|
|
228
|
-
return trackingCookie.isTrackingAccepted(trackingService)
|
|
229
|
-
}
|
|
230
|
-
const isCookieExistForService = function (externalService) {
|
|
231
|
-
return datapolicyCookie.isDatapolicyExistent(externalService)
|
|
232
|
-
}
|
|
233
|
-
const isCookieExistForTracking = function (trackingService) {
|
|
234
|
-
return trackingCookie.isTrackingCookieExistent(trackingService)
|
|
235
|
-
}
|
|
183
|
+
|
|
236
184
|
const initializeEventListeners = function () {
|
|
237
185
|
listen('change', toggleAll, toggleAllSwitch)
|
|
238
186
|
listen("show", onDialogShow, container)
|
|
239
187
|
listen("hide", onDialogHide, container)
|
|
240
188
|
}
|
|
241
|
-
// steuert die Darstellung des Buttons für die hs-App ///
|
|
242
|
-
showSettingsButton()
|
|
243
|
-
//// 1. Toggle States aller Switches setzen ////
|
|
244
|
-
//// Cookies setzen usw. ////
|
|
245
|
-
initializeToggleStateExternal()
|
|
246
189
|
|
|
247
|
-
|
|
190
|
+
const readAppSettingsButtonCookie = function () {
|
|
191
|
+
/* Das Cookie 'appSettings' wird in der App-Logik für die Webview erzeugt. Hier nur ausgelesen, um die Option für den Settings-Button abzufragen */
|
|
192
|
+
appSettingsCookie = getJSONCookie('appSettings') || {}
|
|
193
|
+
}
|
|
248
194
|
|
|
249
|
-
|
|
250
|
-
|
|
195
|
+
//Für die hs-App wird der Button ein und ausgeblendet
|
|
196
|
+
const showSettingsButton = function () {
|
|
197
|
+
let settingsButton = document.getElementById('globalSettingsButton')
|
|
198
|
+
if (isWebview) {
|
|
199
|
+
readAppSettingsButtonCookie()
|
|
200
|
+
if (appSettingsCookie['hidePrivacySettingsButton'] === true) {
|
|
201
|
+
settingsButton.style.display = 'none'
|
|
202
|
+
} else {
|
|
203
|
+
settingsButton.style.display = 'inline-flex'
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
settingsButton.style.display = 'inline-flex'
|
|
207
|
+
}
|
|
208
|
+
}
|
|
251
209
|
|
|
210
|
+
const onDialogShow = function (event) {
|
|
211
|
+
bodyElement.classList.add('optionOpen')
|
|
212
|
+
const opener = event.detail == null && event.detail.target.closest('[data-a11y-dialog-show]') ? event.detail.target.closest('[data-a11y-dialog-show]') : null
|
|
213
|
+
const pianoTracking = null != opener && undefined !== opener.dataset.pianoTracking ? JSON.parse(opener.dataset.pianoTracking) : {label:"Datenschutzerklärung"}
|
|
214
|
+
if(undefined !== pianoTracking.secondLevelId){
|
|
215
|
+
console.log(pianoTracking)
|
|
216
|
+
uxAction('Einstellungsdialog geöffnet - ' + pianoTracking.label, pianoTracking.secondLevelId)
|
|
217
|
+
}else{
|
|
218
|
+
console.log(pianoTracking)
|
|
219
|
+
uxAction('Einstellungsdialog geöffnet - ' + pianoTracking.label)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const onDialogHide = function () {
|
|
224
|
+
console.log("Hide")
|
|
225
|
+
bodyElement.classList.remove('optionOpen')
|
|
226
|
+
}
|
|
227
|
+
const shouldDialogBeOpendOnLoad = function () {
|
|
228
|
+
const urlParam = getUrlVars()['openDialog']
|
|
229
|
+
if (typeof urlParam !== 'undefined' && urlParam === 'true') {
|
|
230
|
+
dialog.show()
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const getUrlVars = function () {
|
|
234
|
+
let vars = {}
|
|
235
|
+
const parts = window.location.href.replace(
|
|
236
|
+
/[?&]+([^=&]+)=([^&]*)/gi,
|
|
237
|
+
function (m, key, value) {
|
|
238
|
+
vars[key] = value
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
return vars
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// steuert die Darstellung des Buttons für die hs-App ///
|
|
245
|
+
showSettingsButton()
|
|
246
|
+
// Überprüfen ob die alten Cookies vorhanden sind
|
|
247
|
+
checkForExistingCookies()
|
|
248
|
+
initializeEventListeners()
|
|
252
249
|
shouldDialogBeOpendOnLoad()
|
|
250
|
+
|
|
253
251
|
}
|
|
254
252
|
|
|
255
253
|
export default DataPolicySettings
|
|
@@ -34,7 +34,7 @@ const DataPolicyCookie = function () {
|
|
|
34
34
|
return {
|
|
35
35
|
setCookieForExternalService: setCookieForExternalService,
|
|
36
36
|
isDatapolicyAccepted: isDatapolicyAccepted,
|
|
37
|
-
isDatapolicyExistent: isDatapolicyExistent
|
|
37
|
+
isDatapolicyExistent: isDatapolicyExistent
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getJSONCookie, setJSONCookie } from 'hrQuery'
|
|
2
|
+
|
|
3
|
+
const GlobalSettingsCookie = function () {
|
|
4
|
+
const settingsCookieLifetime = 1000 * 60 * 60 * 24 * 365 * 10 /* 10 years */
|
|
5
|
+
let cookie = {}
|
|
6
|
+
|
|
7
|
+
const setCookieForOptions = function (option, state) {
|
|
8
|
+
if (state == null) {
|
|
9
|
+
state = true
|
|
10
|
+
}
|
|
11
|
+
console.log('Schreibe Settings-Cookie: ' + option + ': ' + state)
|
|
12
|
+
readSettingsCookie()
|
|
13
|
+
cookie[option] = state
|
|
14
|
+
writeSettingsCookie()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const isSettingsCookieAccepted = function (externalService) {
|
|
18
|
+
readSettingsCookie()
|
|
19
|
+
return cookie[externalService] === true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const writeSettingsCookie = function () {
|
|
23
|
+
setJSONCookie('hrSettings', cookie, settingsCookieLifetime)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const readSettingsCookie = function () {
|
|
27
|
+
cookie = getJSONCookie('hrSettings') || {}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isSettingsCookieExistent = function (option) {
|
|
31
|
+
readSettingsCookie()
|
|
32
|
+
return cookie.hasOwnProperty(option)
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
setCookieForOptions: setCookieForOptions,
|
|
36
|
+
isSettingsCookieExistent: isSettingsCookieExistent,
|
|
37
|
+
isSettingsCookieAccepted: isSettingsCookieAccepted
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default GlobalSettingsCookie
|