@reuters-graphics/graphics-components 1.1.1 → 1.1.2

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.
@@ -34,3 +34,9 @@ onMount(() => {
34
34
  </script>
35
35
 
36
36
  <div data-freestar-ad="{dataFreestarAd || null}" id="{adId}"></div>
37
+
38
+ <style>
39
+ :global(div.freestar-adslot:has(.unfulfilled-ad)) {
40
+ display: none;
41
+ }
42
+ </style>
@@ -33,7 +33,7 @@ onMount(() => {
33
33
  <svelte:window bind:innerWidth="{windowWidth}" />
34
34
 
35
35
  <div
36
- class="leaderboard__sticky {cls}"
36
+ class="freestar-adslot leaderboard__sticky {cls}"
37
37
  class:sticky
38
38
  class:unstick
39
39
  {id}
@@ -45,6 +45,20 @@ export const loadBootstrap = () => {
45
45
  // @ts-ignore window global
46
46
  window.googletag.pubads().enableAsyncRendering();
47
47
  window.googletag.pubads().collapseEmptyDivs(true);
48
+ window.googletag
49
+ .pubads()
50
+ .addEventListener('slotRenderEnded', function (event) {
51
+ const adDiv = document.getElementById(event.slot.getSlotElementId());
52
+ if (!adDiv)
53
+ return;
54
+ // If the ad slot is empty
55
+ if (event.isEmpty) {
56
+ adDiv.classList.add('unfulfilled-ad');
57
+ }
58
+ else {
59
+ adDiv.classList.remove('unfulfilled-ad');
60
+ }
61
+ });
48
62
  });
49
63
  // Set page-level key-values
50
64
  // cf: https://help.freestar.com/help/using-key-values
@@ -18,6 +18,6 @@ Import the SCSS directly in your top-level component. (This is done for you in t
18
18
  <script>
19
19
  // other imports and stuffs ...
20
20
 
21
- import '@reuters-graphics/graphics-components/scss/main';
21
+ import '@reuters-graphics/graphics-components/scss/main.scss';
22
22
  </script>
23
23
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",