hr-design-system-handlebars 1.67.7 → 1.67.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # v1.67.8 (Wed May 15 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Refactoring datawrapper for webcomponent optional [#920](https://github.com/mumprod/hr-design-system-handlebars/pull/920) ([@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.67.7 (Wed May 15 2024)
2
15
 
3
16
  #### 🐛 Bug Fix
@@ -3347,7 +3347,7 @@ article.indexTextDS .indexTextHighlighted .link {
3347
3347
  border-bottom-color: var(--color-secondary-ds);
3348
3348
  }
3349
3349
  .counter-reset {
3350
- counter-reset: cnt1715773179194;
3350
+ counter-reset: cnt1715777055691;
3351
3351
  }
3352
3352
  .hyphens-auto {
3353
3353
  -webkit-hyphens: auto;
@@ -3726,7 +3726,7 @@ article.indexTextDS .indexTextHighlighted .link {
3726
3726
  --tw-ring-color: rgba(255, 255, 255, 0.5);
3727
3727
  }
3728
3728
  .-ordered {
3729
- counter-increment: cnt1715773179194 1;
3729
+ counter-increment: cnt1715777055691 1;
3730
3730
  }
3731
3731
  .-ordered::before {
3732
3732
  position: absolute;
@@ -3742,7 +3742,7 @@ article.indexTextDS .indexTextHighlighted .link {
3742
3742
  letter-spacing: .0125em;
3743
3743
  --tw-text-opacity: 1;
3744
3744
  color: rgba(0, 0, 0, var(--tw-text-opacity));
3745
- content: counter(cnt1715773179194);
3745
+ content: counter(cnt1715777055691);
3746
3746
  }
3747
3747
  /*! ****************************/
3748
3748
  /*! DataPolicy stuff */
@@ -1,11 +1,18 @@
1
1
 
2
- const DataWrapperContentRefresher = function (context, id, refreshIntervall) {
2
+ const DataWrapperContentRefresher = function (context, id, refreshIntervall, webcomponent) {
3
3
  const { element: rootElement } = context
4
4
  let remainingTime
5
5
  let timer
6
6
  let uniqueID = id
7
7
  let intervall = refreshIntervall
8
+
9
+ if (webcomponent) {
10
+ let container = document.getElementById('datawrapper-chart-' + uniqueID)
11
+ let script = document.getElementById('datawrapper-component-js')
12
+ }
13
+ else{
8
14
  let iframeRefresh = document.getElementById('datawrapper-chart-' + uniqueID)
15
+ }
9
16
 
10
17
  const createRefresher = function () {
11
18
  console.log("Refresher bauen")
@@ -45,15 +52,26 @@ const DataWrapperContentRefresher = function (context, id, refreshIntervall) {
45
52
 
46
53
  const refreshIframe = function () {
47
54
  console.log('Reload')
48
- iframeRefresh.style.opacity = '0'
49
- iframeRefresh.src =
50
- iframeRefresh.src.split('?')[0] + '?_=' + new Date().getTime()
55
+ if(webcomponent) {
56
+ container.style.opacity = '0'
57
+ script.src = script.src.split('?')[0] + '?_=' + new Date().getTime()
58
+ }
59
+ else{
60
+ iframeRefresh.style.opacity = '0'
61
+ iframeRefresh.src =
62
+ iframeRefresh.src.split('?')[0] + '?_=' + new Date().getTime()
63
+ }
51
64
  clearInterval(timer)
52
65
  }
53
66
  const startCountdown = function () {
54
67
  remainingTime = Number(intervall)
55
68
  setTimeout(function () {
56
- iframeRefresh.style.opacity = '1'
69
+ if(webcomponent) {
70
+ container.style.opacity = '1'
71
+ }
72
+ else{
73
+ iframeRefresh.style.opacity = '1'
74
+ }
57
75
  document.getElementById('overlay' + uniqueID).style.display = 'none'
58
76
  }, 1000)
59
77
  timer = setInterval(function () {
@@ -172,19 +172,11 @@ const ExternalService = function (context) {
172
172
  const createDataWrapperEmbed = function () {
173
173
  removeDatapolicyBox()
174
174
  createUniqueID()
175
- if (iFrameConfig.noResponsiveIframe == 'true') {
176
- noResponsiveIframe = new DataWrapperNoResponsiveIframe(context, iFrameConfig.aspectRatio, iFrameConfig.fixedHeight, uniqueId, embedCode)
177
- noResponsiveIframe.createNoResponsiveIframe()
178
-
179
- if (iFrameConfig.refreshContent == 'true') {
180
- console.log("contentRefresher anfügen")
181
- contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall)
182
- contentRefresher.createRefresher()
183
- }
184
- }
185
- else {
175
+ if (iFrameConfig.responsiveIframe == 'true') {
176
+
177
+ //Responsives Iframe
186
178
  var iframe = document.createElement('iframe')
187
- //Auflösen nach Tailwind-Klassen //dataWrapper-embed
179
+ //Auflösen nach Tailwind-Klassen //dataWrapper-embed
188
180
  iframe.className = 'w-0 !min-w-full border-0'
189
181
  iframe.setAttribute('webkitallowfullscreen', '')
190
182
  iframe.setAttribute('mozallowfullscreen', '')
@@ -199,13 +191,53 @@ const ExternalService = function (context) {
199
191
  'datawrapper-js',
200
192
  'https://static.hr.de/hessenschau/datawrapper/responsiveIframe.js',
201
193
  true
202
- )
203
-
194
+ )
204
195
  if (iFrameConfig.refreshContent == 'true') {
205
196
  console.log("contentRefresher anfügen")
206
- contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall)
197
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, false)
207
198
  contentRefresher.createRefresher()
208
199
  }
200
+ }
201
+ else {
202
+ if(iFrameConfig.webcomponent == 'true') {
203
+
204
+ // Webcomponent
205
+ const divTag = document.createElement('div')
206
+ divTag.id = 'datawrapper-chart-' + uniqueID
207
+ rootElement.insertBefore(divTag, null)
208
+ const scriptTag = document.createElement('script')
209
+ scriptTag.setAttribute('id', 'datawrapper-component-js')
210
+ scriptTag.setAttribute('type', 'text/javascript')
211
+ scriptTag.setAttribute('defer', 'defer')
212
+ scriptTag.setAttribute('src', embedCode + 'embed.js?v=1')
213
+ scriptTag.setAttribute('charset', 'utf-8')
214
+ const noScriptTag = document.createElement('noscript')
215
+ const imageTag = document.createElement('img')
216
+ imageTag.src = embedCode + 'full.png'
217
+ imageTag.alt = ''
218
+ noScriptTag.appendChild(imageTag)
219
+ divTag.appendChild(scriptTag)
220
+ divTag.appendChild(noScriptTag)
221
+
222
+ if (iFrameConfig.refreshContent == 'true') {
223
+ console.log("contentRefresher anfügen")
224
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, true)
225
+ contentRefresher.createRefresher()
226
+ }
227
+ }
228
+ else {
229
+ //Klassisches Iframe mit AR-Wrapper oder fester Höhe
230
+ noResponsiveIframe = new DataWrapperNoResponsiveIframe(context, iFrameConfig.aspectRatio, iFrameConfig.fixedHeight, uniqueId, embedCode)
231
+ noResponsiveIframe.createNoResponsiveIframe()
232
+
233
+ if (iFrameConfig.refreshContent == 'true') {
234
+ console.log("contentRefresher anfügen")
235
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, false)
236
+ contentRefresher.createRefresher()
237
+ }
238
+ }
239
+
240
+
209
241
  }
210
242
  }
211
243
 
@@ -1,8 +1,9 @@
1
1
  <div class="grid clear-both{{#unless _isTeaser}} mt-10{{/unless}}">
2
2
  {{~> components/base/a11y/hiddenText _locaTag="story_externalservice_intro_sr" ~}}
3
- <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}} js-load"
3
+ <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}}{{#unless
4
+ this.fixedHeight }} -noFixedHeight{{/unless}} js-load"
4
5
  data-hr-external-service-ds='{"id":"{{this.externalServiceConfig.externalServiceId}}","embedCode":"{{this.serviceUrl}}","embedType":"{{this.externalServiceConfig.externalServiceEmbedType}}","dataPolicyCheck": true,"iFrameConfig": { {{#if this.fixedHeight}}
5
- "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"noResponsiveIframe":"{{{this.setResponsiveIframe}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
+ "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"responsiveIframe":"{{{this.setResponsiveIframe}}}","webcomponent":"{{{this.setWebcomponent}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
7
  {{~> components/externalService/components/external_service_data_policy ~}}
7
8
  </div>
8
9
  {{~> components/externalService/components/external_service_caption ~}}
@@ -1,8 +1,9 @@
1
1
  <div class="grid clear-both{{#unless _isTeaser}} mt-10{{/unless}}">
2
2
  {{~> components/base/a11y/hiddenText _locaTag="story_externalservice_intro_sr" ~}}
3
- <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}} js-load"
3
+ <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}}{{#unless
4
+ this.fixedHeight }} -noFixedHeight{{/unless}} js-load"
4
5
  data-hr-external-service-ds='{"id":"{{this.externalServiceConfig.externalServiceId}}","embedCode":"{{this.serviceUrl}}","embedType":"{{this.externalServiceConfig.externalServiceEmbedType}}","dataPolicyCheck": true,"iFrameConfig": { {{#if this.fixedHeight}}
5
- "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"noResponsiveIframe":"{{{this.setResponsiveIframe}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
+ "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"responsiveIframe":"{{{this.setResponsiveIframe}}}","webcomponent":"{{{this.setWebcomponent}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
7
  {{~> components/externalService/components/external_service_data_policy ~}}
7
8
  </div>
8
9
  {{~> components/externalService/components/external_service_caption ~}}
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.67.7",
9
+ "version": "1.67.8",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "storybook dev -p 6006 public",
@@ -1,11 +1,18 @@
1
1
 
2
- const DataWrapperContentRefresher = function (context, id, refreshIntervall) {
2
+ const DataWrapperContentRefresher = function (context, id, refreshIntervall, webcomponent) {
3
3
  const { element: rootElement } = context
4
4
  let remainingTime
5
5
  let timer
6
6
  let uniqueID = id
7
7
  let intervall = refreshIntervall
8
+
9
+ if (webcomponent) {
10
+ let container = document.getElementById('datawrapper-chart-' + uniqueID)
11
+ let script = document.getElementById('datawrapper-component-js')
12
+ }
13
+ else{
8
14
  let iframeRefresh = document.getElementById('datawrapper-chart-' + uniqueID)
15
+ }
9
16
 
10
17
  const createRefresher = function () {
11
18
  console.log("Refresher bauen")
@@ -45,15 +52,26 @@ const DataWrapperContentRefresher = function (context, id, refreshIntervall) {
45
52
 
46
53
  const refreshIframe = function () {
47
54
  console.log('Reload')
48
- iframeRefresh.style.opacity = '0'
49
- iframeRefresh.src =
50
- iframeRefresh.src.split('?')[0] + '?_=' + new Date().getTime()
55
+ if(webcomponent) {
56
+ container.style.opacity = '0'
57
+ script.src = script.src.split('?')[0] + '?_=' + new Date().getTime()
58
+ }
59
+ else{
60
+ iframeRefresh.style.opacity = '0'
61
+ iframeRefresh.src =
62
+ iframeRefresh.src.split('?')[0] + '?_=' + new Date().getTime()
63
+ }
51
64
  clearInterval(timer)
52
65
  }
53
66
  const startCountdown = function () {
54
67
  remainingTime = Number(intervall)
55
68
  setTimeout(function () {
56
- iframeRefresh.style.opacity = '1'
69
+ if(webcomponent) {
70
+ container.style.opacity = '1'
71
+ }
72
+ else{
73
+ iframeRefresh.style.opacity = '1'
74
+ }
57
75
  document.getElementById('overlay' + uniqueID).style.display = 'none'
58
76
  }, 1000)
59
77
  timer = setInterval(function () {
@@ -172,19 +172,11 @@ const ExternalService = function (context) {
172
172
  const createDataWrapperEmbed = function () {
173
173
  removeDatapolicyBox()
174
174
  createUniqueID()
175
- if (iFrameConfig.noResponsiveIframe == 'true') {
176
- noResponsiveIframe = new DataWrapperNoResponsiveIframe(context, iFrameConfig.aspectRatio, iFrameConfig.fixedHeight, uniqueId, embedCode)
177
- noResponsiveIframe.createNoResponsiveIframe()
178
-
179
- if (iFrameConfig.refreshContent == 'true') {
180
- console.log("contentRefresher anfügen")
181
- contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall)
182
- contentRefresher.createRefresher()
183
- }
184
- }
185
- else {
175
+ if (iFrameConfig.responsiveIframe == 'true') {
176
+
177
+ //Responsives Iframe
186
178
  var iframe = document.createElement('iframe')
187
- //Auflösen nach Tailwind-Klassen //dataWrapper-embed
179
+ //Auflösen nach Tailwind-Klassen //dataWrapper-embed
188
180
  iframe.className = 'w-0 !min-w-full border-0'
189
181
  iframe.setAttribute('webkitallowfullscreen', '')
190
182
  iframe.setAttribute('mozallowfullscreen', '')
@@ -199,13 +191,53 @@ const ExternalService = function (context) {
199
191
  'datawrapper-js',
200
192
  'https://static.hr.de/hessenschau/datawrapper/responsiveIframe.js',
201
193
  true
202
- )
203
-
194
+ )
204
195
  if (iFrameConfig.refreshContent == 'true') {
205
196
  console.log("contentRefresher anfügen")
206
- contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall)
197
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, false)
207
198
  contentRefresher.createRefresher()
208
199
  }
200
+ }
201
+ else {
202
+ if(iFrameConfig.webcomponent == 'true') {
203
+
204
+ // Webcomponent
205
+ const divTag = document.createElement('div')
206
+ divTag.id = 'datawrapper-chart-' + uniqueID
207
+ rootElement.insertBefore(divTag, null)
208
+ const scriptTag = document.createElement('script')
209
+ scriptTag.setAttribute('id', 'datawrapper-component-js')
210
+ scriptTag.setAttribute('type', 'text/javascript')
211
+ scriptTag.setAttribute('defer', 'defer')
212
+ scriptTag.setAttribute('src', embedCode + 'embed.js?v=1')
213
+ scriptTag.setAttribute('charset', 'utf-8')
214
+ const noScriptTag = document.createElement('noscript')
215
+ const imageTag = document.createElement('img')
216
+ imageTag.src = embedCode + 'full.png'
217
+ imageTag.alt = ''
218
+ noScriptTag.appendChild(imageTag)
219
+ divTag.appendChild(scriptTag)
220
+ divTag.appendChild(noScriptTag)
221
+
222
+ if (iFrameConfig.refreshContent == 'true') {
223
+ console.log("contentRefresher anfügen")
224
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, true)
225
+ contentRefresher.createRefresher()
226
+ }
227
+ }
228
+ else {
229
+ //Klassisches Iframe mit AR-Wrapper oder fester Höhe
230
+ noResponsiveIframe = new DataWrapperNoResponsiveIframe(context, iFrameConfig.aspectRatio, iFrameConfig.fixedHeight, uniqueId, embedCode)
231
+ noResponsiveIframe.createNoResponsiveIframe()
232
+
233
+ if (iFrameConfig.refreshContent == 'true') {
234
+ console.log("contentRefresher anfügen")
235
+ contentRefresher = new DataWrapperContentRefresher(context, uniqueId, iFrameConfig.refreshIntervall, false)
236
+ contentRefresher.createRefresher()
237
+ }
238
+ }
239
+
240
+
209
241
  }
210
242
  }
211
243
 
@@ -1,8 +1,9 @@
1
1
  <div class="grid clear-both{{#unless _isTeaser}} mt-10{{/unless}}">
2
2
  {{~> components/base/a11y/hiddenText _locaTag="story_externalservice_intro_sr" ~}}
3
- <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}} js-load"
3
+ <div class="c-externalService c-externalService__{{this.externalServiceConfig.externalServiceId}}{{#unless
4
+ this.fixedHeight }} -noFixedHeight{{/unless}} js-load"
4
5
  data-hr-external-service-ds='{"id":"{{this.externalServiceConfig.externalServiceId}}","embedCode":"{{this.serviceUrl}}","embedType":"{{this.externalServiceConfig.externalServiceEmbedType}}","dataPolicyCheck": true,"iFrameConfig": { {{#if this.fixedHeight}}
5
- "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"noResponsiveIframe":"{{{this.setResponsiveIframe}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
+ "fixedHeight":"{{this.fixedHeight}}"{{else}}{{#if this.aspectRatio}}"aspectRatio":"{{this.aspectRatio}}"{{else}}"aspectRatio":"16x9"{{/if}}{{/if}},"responsiveIframe":"{{{this.setResponsiveIframe}}}","webcomponent":"{{{this.setWebcomponent}}}"{{#if this.setTimedReloadIframe}},"refreshContent":"{{{this.setTimedReloadIframe}}}","refreshIntervall":"{{this.setTimeForReload}}"{{/if}} }}'>
6
7
  {{~> components/externalService/components/external_service_data_policy ~}}
7
8
  </div>
8
9
  {{~> components/externalService/components/external_service_caption ~}}