hr-design-system-handlebars 1.82.8 → 1.82.10

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.
Files changed (24) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/assets/index.css +3 -3
  3. package/dist/assets/js/components/dataPolicySettings/dataPolicySettingsDs.feature.js +25 -12
  4. package/dist/assets/js/components/externalService/createWahlErgebnisGemeinde.subfeature.js +157 -0
  5. package/dist/assets/js/components/externalService/externalServiceDs.feature.js +15 -196
  6. package/dist/views/components/externalService/components/external_service_data_policy.hbs +1 -1
  7. package/dist/views/components/externalService/components/external_service_settings_button.hbs +1 -1
  8. package/dist/views/components/teaser/components/teaser_av_consumption.hbs +5 -5
  9. package/dist/views_static/components/externalService/components/external_service_data_policy.hbs +1 -1
  10. package/dist/views_static/components/externalService/components/external_service_settings_button.hbs +1 -1
  11. package/dist/views_static/components/teaser/components/teaser_av_consumption.hbs +5 -5
  12. package/package.json +1 -1
  13. package/src/stories/basics/iconography/page_icon_404_data.js +3 -3
  14. package/src/stories/basics/iconography/page_icon_epg_data.js +3 -3
  15. package/src/stories/basics/iconography/page_icon_public_transport_data.js +3 -3
  16. package/src/stories/basics/iconography/page_icon_traffic_data.js +3 -3
  17. package/src/stories/basics/iconography/page_icon_weather_data.js +3 -3
  18. package/src/stories/basics/iconography/page_icons.mdx +7 -7
  19. package/src/stories/views/components/dataPolicySettings/dataPolicySettingsDs.feature.js +25 -12
  20. package/src/stories/views/components/externalService/components/external_service_data_policy.hbs +1 -1
  21. package/src/stories/views/components/externalService/components/external_service_settings_button.hbs +1 -1
  22. package/src/stories/views/components/externalService/createWahlErgebnisGemeinde.subfeature.js +157 -0
  23. package/src/stories/views/components/externalService/externalServiceDs.feature.js +15 -196
  24. package/src/stories/views/components/teaser/components/teaser_av_consumption.hbs +5 -5
@@ -1,6 +1,7 @@
1
1
  import SettingsCookie from './globalSettingsCookie.subfeature'
2
2
  import DataWrapperContentRefresher from './dataWrapperContentRefresher.subfeature'
3
3
  import DataWrapperNoResponsiveIframe from './dataWrapperNoResponsiveIframe.subfeature'
4
+ import CreateWahlGemeindeErgebnis from './createWahlErgebnisGemeinde.subfeature'
4
5
  import {
5
6
  fireEvent,
6
7
  hr$,
@@ -8,9 +9,7 @@ import {
8
9
  loadScript,
9
10
  removeScript,
10
11
  replaceAnimated,
11
- requestTimeout,
12
- getJSONCookie,
13
- deleteCookie,
12
+ requestTimeout
14
13
  } from 'hrQuery'
15
14
 
16
15
  const ExternalService = function (context) {
@@ -25,17 +24,16 @@ const ExternalService = function (context) {
25
24
  id = options.id,
26
25
  iFrameConfig = options.iFrameConfig
27
26
  let acceptButton,
28
- acceptAlwaysCheckbox = hr$('.js-dataPolicy-acceptPermanentely', rootElement)[0],
29
- dataPolicySettingsButton = hr$('.js-data-policy-settings-button', rootParent)[0]
27
+ acceptAlwaysCheckbox = hr$('.js-dataPolicy-acceptPermanentely', rootElement)[0]
30
28
  let embedCode = options.embedCode,
31
29
  iframe,
32
30
  settingsCookie,
33
31
  noResponsiveIframe,
34
32
  contentRefresher,
33
+ gemeindewahlergebnis,
35
34
  uniqueId,
36
- isExternalServiceLoaded = false,
37
- isWebview = window.parent.document.documentElement.classList.contains('webview')
38
-
35
+ isExternalServiceLoaded = false
36
+
39
37
  const testDOMElements = function () {
40
38
  console.log(rootElement)
41
39
  console.log(rootParent)
@@ -58,10 +56,8 @@ const ExternalService = function (context) {
58
56
  console.log('Done')
59
57
  if (undefined !== callback) {
60
58
  replaceAnimated(rootElement, data.html, false, callback)
61
- alert('boing')
62
59
  } else {
63
60
  replaceAnimated(rootElement, data.html, false)
64
- alert('boing, boing')
65
61
  }
66
62
  })
67
63
  //Add handlers to be called when the Deferred object is rejected.
@@ -104,7 +100,7 @@ const ExternalService = function (context) {
104
100
  createWahlOMatEmbed()
105
101
  break
106
102
  case 'wahl-gemeinde-ergebnis':
107
- createWahlGemeindeErgebnis()
103
+ createWahlGemeindeErgebnisEmbed()
108
104
  break
109
105
  default:
110
106
  console.error('No JS Config for external service ' + id)
@@ -115,155 +111,10 @@ const ExternalService = function (context) {
115
111
  loadIframe() //für alle Dienste die nicht der DSGVO Datapolicy unterliegen
116
112
  }
117
113
  }
118
- const createWahlGemeindeErgebnis = function () {
119
- let embedCode = options.embedCode,
120
- cleanUrl,
121
- wahlKreisVersionJsonUrl,
122
- wahlkreis,
123
- wahlid,
124
- jsonResponse,
125
- iFrameElement,
126
- iframeHeight = 300
127
-
128
- const cleanVariables = function (variable) {
129
- while (variable.charAt(0) === '&') {
130
- variable = variable.substring(1)
131
- }
132
- return variable
133
- }
134
- const extractDataFromEmbedCode = function () {
135
- const parts = embedCode.split('*')
136
- if (parts.length === 4) {
137
- cleanUrl = cleanVariables(decodeURIComponent(parts[0].trim()))
138
- wahlkreis = cleanVariables(decodeURIComponent(parts[1].trim()))
139
- wahlid = cleanVariables(decodeURIComponent(parts[2].trim()))
140
- wahlKreisVersionJsonUrl = cleanVariables(decodeURIComponent(parts[3].trim()))
141
- }
142
- }
143
- const loadIframe = function (version, url, wahlkreis) {
144
- if (version) {
145
- let iframeUrl = url.replace('{version}', version)
146
- let iframe = document.createElement('iframe')
147
- iframe.className = ''
148
- iframe.style.border = 'none'
149
- iframe.style.height = iframeHeight + 'px'
150
- iframe.style.width = '100%'
151
- iframe.setAttribute('webkitallowfullscreen', '')
152
- iframe.setAttribute('mozallowfullscreen', '')
153
- iframe.setAttribute('allowfullscreen', '')
154
- iframe.setAttribute('scrolling', 'no')
155
- iframe.setAttribute('frameborder', '0')
156
- iframe.src = iframeUrl
157
- iframe.id = 'wahl-gemeinde-ergebnis-' + wahlkreis
158
- rootElement.innerHTML = ''
159
- rootElement.insertBefore(iframe, null)
160
- iFrameElement = document.getElementById('wahl-gemeinde-ergebnis-' + wahlkreis)
161
- } else {
162
- loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
163
- }
164
- }
165
- const loadNoDataDiv = function (text, timeout) {
166
- let div = document.createElement('div')
167
- div.className =
168
- 'p-5 c-externalService__wahl-gemeinde-ergebnis-no-result rounded-tl-hr rounded-br-hr bg-highlight-1'
169
- div.innerHTML =
170
- '<div class="text-2xl text-clusterTeaserHeadline font-titleCluster mb-2">' +
171
- text +
172
- '</div>' +
173
- '<div class="flex flex-row" >' +
174
- ' <div class="">' +
175
- ' <span>Dieser Inhalt wird automatisch aktualisiert in</span>' +
176
- ' <span data-minutes>' +
177
- timeout +
178
- ' </span>' +
179
- ' <span>Min</span>' +
180
- ' <span data-seconds>0</span>' +
181
- ' <span>Sek</span>' +
182
- ' </div>' +
183
- '</div>'
184
- rootElement.innerHTML = ''
185
- rootElement.insertBefore(div, null)
186
- countdownMinutes(timeout, fetchJsonData)
187
- }
188
- const resizeIframe = function (newheight) {
189
- if (newheight !== iframeHeight) {
190
- iFrameElement.style.height = newheight + 'px'
191
- iframeHeight = newheight
192
- }
193
- }
194
- const processMessage = function (evt) {
195
- if (evt.origin !== 'https://www.tagesschau.de') {
196
- console.log('message', evt.origin + ' ist nicht vertrauenswürdig')
197
- } else {
198
- resizeIframe(evt.data)
199
- }
200
- }
201
- const initMessageEventListener = function () {
202
- if (window.addEventListener) {
203
- // For standards-compliant web browsers
204
- window.addEventListener('message', processMessage, false)
205
- } else {
206
- window.attachEvent('onmessage', processMessage)
207
- }
208
- }
209
- const fetchJsonData = function () {
210
- fetch(wahlKreisVersionJsonUrl, {
211
- method: 'GET',
212
- headers: {
213
- Accept: 'application/json',
214
- },
215
- })
216
- .then((response) => response.json())
217
- .then((jsonData) =>
218
- loadIframe(
219
- jsonData.hasOwnProperty(wahlkreis) && jsonData[wahlkreis].v
220
- ? jsonData[wahlkreis].v
221
- : null,
222
- cleanUrl,
223
- wahlkreis,
224
- ),
225
- )
226
- .catch(function () {
227
- loadNoDataDiv('Es liegen zur Zeit noch keine Ergebnisse vor', 5)
228
- console.log('No JSON Data Loaded')
229
- })
230
- }
231
-
232
- function countdownMinutes(minutesToCountdown, callbackFunction) {
233
- const second = 1000,
234
- minute = second * 60,
235
- hour = minute * 60,
236
- day = hour * 24,
237
- minuteElement = document.querySelector('[data-minutes]'),
238
- secondElement = document.querySelector('[data-seconds]')
239
-
240
- function AddMinutesToDate(date, minutes) {
241
- return new Date(date.getTime() + minutes * 60000)
242
- }
243
-
244
- let countDown = AddMinutesToDate(new Date(), minutesToCountdown),
245
- x = setInterval(function () {
246
- let now = new Date().getTime(),
247
- distance = countDown - now
248
-
249
- if (minuteElement != null) {
250
- minuteElement.innerText = Math.floor((distance % hour) / minute)
251
- }
252
-
253
- if (secondElement != null) {
254
- secondElement.innerText = Math.floor((distance % minute) / second)
255
- }
256
-
257
- if (distance < 1000) {
258
- callbackFunction()
259
- clearInterval(x)
260
- }
261
- }, second)
262
- }
263
-
264
- extractDataFromEmbedCode()
265
- initMessageEventListener()
266
- fetchJsonData()
114
+
115
+ const createWahlGemeindeErgebnisEmbed = function () {
116
+ gemeindewahlergebnis = new CreateWahlGemeindeErgebnis(embedCode,rootElement)
117
+ gemeindewahlergebnis.createErgebnis()
267
118
  }
268
119
  const createWahlOMatEmbed = function () {
269
120
 
@@ -297,6 +148,7 @@ const ExternalService = function (context) {
297
148
  rootElement.appendChild(script)
298
149
  }
299
150
  const createUniqueID = function() {
151
+ console.log("Erzeuge einzigartige ID")
300
152
  uniqueId = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(2, 10)
301
153
  }
302
154
 
@@ -324,6 +176,7 @@ const ExternalService = function (context) {
324
176
  const createDataWrapperEmbed = function () {
325
177
  removeDatapolicyBox()
326
178
  createUniqueID()
179
+ console.log("UniqueID"+uniqueId)
327
180
  if (iFrameConfig.noResponsiveIframe == 'true') {
328
181
 
329
182
  //Klassisches Iframe mit AR-Wrapper oder fester Höhe
@@ -342,7 +195,7 @@ const ExternalService = function (context) {
342
195
 
343
196
  // Webcomponent
344
197
  const divTag = document.createElement('div')
345
- divTag.id = 'datawrapper-chart-' + uniqueID
198
+ divTag.id = 'datawrapper-chart-' + uniqueId
346
199
  rootElement.insertBefore(divTag, null)
347
200
  const scriptTag = document.createElement('script')
348
201
  scriptTag.setAttribute('id', 'datawrapper-component-js')
@@ -504,18 +357,10 @@ const ExternalService = function (context) {
504
357
  settingsCookie = new SettingsCookie()
505
358
  acceptButton = hr$('.js-dataPolicy-accept', rootElement)[0]
506
359
  listen('click', handleDatapolicy, acceptButton)
507
- if (isWebview) {
508
- if (settingsCookie.isDataPolicyCookieAccepted(id)) {
360
+ if (settingsCookie.isSettingsCookieAccepted(id)) {
509
361
  loadServiceWithDataPolicyButton()
510
- } else {
511
- dataPolicyBox.style.visibility = 'visible'
512
- }
513
362
  } else {
514
- if (settingsCookie.isSettingsCookieAccepted(id)) {
515
- loadServiceWithDataPolicyButton()
516
- } else {
517
363
  dataPolicyBox.style.visibility = 'visible'
518
- }
519
364
  }
520
365
  listen('hr:externalService-activate-' + id, loadServiceWithDataPolicyButton)
521
366
  listen('hr:externalService-deactivate-' + id, removeExternalService)
@@ -528,9 +373,6 @@ const ExternalService = function (context) {
528
373
  if (acceptAlwaysCheckbox.checked == true) {
529
374
  fireEvent('hr:externalService-activate-' + id)
530
375
  settingsCookie.setCookieForOptions(id)
531
- if (isWebview) {
532
- settingsCookie.setCookieForDataPolicy(id)
533
- }
534
376
  } else {
535
377
  loadServiceWithDataPolicyButton()
536
378
  console.log('External Service once loaded - ' + id)
@@ -573,22 +415,6 @@ const ExternalService = function (context) {
573
415
  toggleContentSettingsButton()
574
416
  }
575
417
 
576
- const syncAppOptionsToSettingsCookie = function () {
577
- if (getJSONCookie('datapolicy')) {
578
- let dataPolicyCookie = getJSONCookie('datapolicy') || {}
579
- let objArray = Object.entries(dataPolicyCookie)
580
- objArray.forEach(([key, value]) => {
581
- settingsCookie.setCookieForOptions(key, value)
582
- })
583
- }
584
- }
585
-
586
- const setWhitelistServicesForInitialApp = function () {
587
- let whitelist = ['ard_mediathek', 'arte_concert', 'arte_concert_new', 'datawrapper_cdn']
588
- for (let i = 0; i < whitelist.length; ++i) {
589
- settingsCookie.setCookieForDataPolicy(whitelist[i], true)
590
- }
591
- }
592
418
  const resetCheckboxForPermanentService = function () {
593
419
  /*Die Autocompletion des Browsers merkt sich die Zustände von Formularelementen nach einem Refresh, das wird hier hart zurückgesetzt*/
594
420
  var clist = document.getElementsByClassName('js-dataPolicy-acceptPermanentely')
@@ -599,13 +425,6 @@ const ExternalService = function (context) {
599
425
  initDataPolicy()
600
426
  resetCheckboxForPermanentService()
601
427
  testDOMElements()
602
- if (isWebview) {
603
- /*Für die App werden Cookie-Daten des neuen Cookies wieder mit dem alten Cookie synchronisiert */
604
- syncAppOptionsToSettingsCookie()
605
- if (!getJSONCookie('datapolicy') || !getJSONCookie('hrSettings')) {
606
- setWhitelistServicesForInitialApp()
607
- }
608
- }
609
428
  }
610
429
 
611
430
  export default ExternalService
@@ -3,7 +3,7 @@
3
3
  {{#with this.toModel.videoElement}}
4
4
  {{~> components/mediaplayer/media_player _uiTestHook="ui-test-video-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
5
5
  {{#with ../../this}}
6
- {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Video" _aspectRatio=_aspectRatio-adjust_context _noDelay=this.dontLazyload}}
6
+ {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Video" _aspectRatio=_aspectRatio-adjust_context _addClassImg=_addClassImg-adjust_context _noDelay=this.dontLazyload}}
7
7
  {{/with}}
8
8
  {{#if ../../_isMobile1to1~}}
9
9
  {{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
@@ -14,7 +14,7 @@
14
14
  {{#with this.toModel.audioElementForVideoView}}
15
15
  {{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
16
16
  {{#with ../../this}}
17
- {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Audio" _aspectRatio=_aspectRatio-adjust_context _noDelay=this.dontLazyload}}
17
+ {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Audio" _aspectRatio=_aspectRatio-adjust_context _addClassImg=_addClassImg-adjust_context _noDelay=this.dontLazyload}}
18
18
  {{/with}}
19
19
  {{#if ../../_isMobile1to1~}}
20
20
  {{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
@@ -25,7 +25,7 @@
25
25
  {{#with this.toModel.audioElementForVideoView}}
26
26
  {{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-ondemand-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
27
27
  {{#with ../../this}}
28
- {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Podcast" _aspectRatio=_aspectRatio-adjust_context _noDelay=this.dontLazyload}}
28
+ {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="audio_button" _mediaButtonLabel="Podcast" _aspectRatio=_aspectRatio-adjust_context _addClassImg=_addClassImg-adjust_context _noDelay=this.dontLazyload}}
29
29
  {{/with}}
30
30
  {{#if ../../_isMobile1to1~}}
31
31
  {{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
@@ -36,7 +36,7 @@
36
36
  {{#with this.toModel.audioLivestreamElementForVideoView}}
37
37
  {{~> components/mediaplayer/media_player _uiTestHook="ui-test-audio-livestream-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
38
38
  {{#with ../../this}}
39
- {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio-adjust_context _noDelay=this.dontLazyload}}
39
+ {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio-adjust_context _addClassImg=_addClassImg-adjust_context _noDelay=this.dontLazyload}}
40
40
  {{/with}}
41
41
  {{#if ../../_isMobile1to1~}}
42
42
  {{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}
@@ -47,7 +47,7 @@
47
47
  {{#with this.toModel.videoLivestreamElement}}
48
48
  {{~> components/mediaplayer/media_player _uiTestHook="ui-test-video-livestream-player" _isUsedInTeaser=true _addClassImg=../../_addClassImg~}}
49
49
  {{#with ../../this}}
50
- {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio-adjust_context _noDelay=this.dontLazyload}}
50
+ {{~> components/teaser/components/teaser_media_player _mediaButtonIcon="play_button" _mediaButtonLabel="Live" _isLivestream=true _aspectRatio=_aspectRatio-adjust_context _addClassImg=_addClassImg-adjust_context _noDelay=this.dontLazyload}}
51
51
  {{/with}}
52
52
  {{#if ../../_isMobile1to1~}}
53
53
  {{> components/teaser/components/teaser_av_consumption_close_button _playerId=this.ardPlayerConfig.playerId }}