@reuters-graphics/graphics-components 1.0.15 → 1.0.17

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.
@@ -0,0 +1,18 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ /** Add an ID to target with SCSS. */ id?: string;
5
+ /** Add a class to target with SCSS. */ class?: string;
6
+ };
7
+ events: {
8
+ [evt: string]: CustomEvent<any>;
9
+ };
10
+ slots: {};
11
+ };
12
+ export type SponsorshipAdProps = typeof __propDef.props;
13
+ export type SponsorshipAdEvents = typeof __propDef.events;
14
+ export type SponsorshipAdSlots = typeof __propDef.slots;
15
+ /** `SponsorshipeAd` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SponsorshipAd--default) */
16
+ export default class SponsorshipAd extends SvelteComponentTyped<SponsorshipAdProps, SponsorshipAdEvents, SponsorshipAdSlots> {
17
+ }
18
+ export {};
@@ -1 +1,6 @@
1
- export declare const loadScript: (src: string, onload?: () => void) => void;
1
+ interface attributesInterface {
2
+ onload?: () => void;
3
+ async?: boolean;
4
+ }
5
+ export declare const loadScript: (src: string, attributes?: attributesInterface) => void;
6
+ export {};
@@ -2,7 +2,6 @@ export { default as cssVariables } from "./actions/cssVariables/index.js";
2
2
  export { default as resizeObserver } from "./actions/resizeObserver/index.js";
3
3
  export { default as Article } from "./components/Article/Article.svelte";
4
4
  export { default as AdScripts } from "./components/AdSlot/AdScripts.svelte";
5
- export { default as InlineAd } from "./components/AdSlot/InlineAd.svelte";
6
5
  export { default as BeforeAfter } from "./components/BeforeAfter/BeforeAfter.svelte";
7
6
  export { default as Block } from "./components/Block/Block.svelte";
8
7
  export { default as BodyText } from "./components/BodyText/BodyText.svelte";
@@ -17,6 +16,7 @@ export { default as Headline } from "./components/Headline/Headline.svelte";
17
16
  export { default as HeroHeadline } from "./components/HeroHeadline/Hero.svelte";
18
17
  export { default as EndNotes } from "./components/EndNotes/EndNotes.svelte";
19
18
  export { default as InfoBox } from "./components/InfoBox/InfoBox.svelte";
19
+ export { default as InlineAd } from "./components/AdSlot/InlineAd.svelte";
20
20
  export { default as PaddingReset } from "./components/PaddingReset/PaddingReset.svelte";
21
21
  export { default as PhotoCarousel } from "./components/PhotoCarousel/PhotoCarousel.svelte";
22
22
  export { default as PhotoPack } from "./components/PhotoPack/PhotoPack.svelte";
@@ -33,6 +33,7 @@ export { default as SiteFooter } from "./components/SiteFooter/SiteFooter.svelte
33
33
  export { default as SiteHeader } from "./components/SiteHeader/SiteHeader.svelte";
34
34
  export { default as SiteHeadline } from "./components/SiteHeadline/SiteHeadline.svelte";
35
35
  export { default as Spinner } from "./components/Spinner/Spinner.svelte";
36
+ export { default as SponsorshipAd } from "./components/AdSlot/SponsorshipAd.svelte";
36
37
  export { default as Table } from "./components/Table/Table.svelte";
37
38
  export { default as ToolsHeader } from "./components/ToolsHeader/ToolsHeader.svelte";
38
39
  export { default as Video } from "./components/Video/Video.svelte";
@@ -8,8 +8,10 @@
8
8
  window.graphicsAdQueue = window.graphicsAdQueue || [];
9
9
  loadScript(
10
10
  'https://graphics.thomsonreuters.com/cdn/js/bootstrap.static.js',
11
- loadBootstrap
11
+ { onload: loadBootstrap, async: false }
12
12
  );
13
+ // Load Freestar script
14
+ loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
13
15
  });
14
16
  </script>
15
17
 
@@ -0,0 +1,68 @@
1
+ <script>import Block from '../Block/Block.svelte';
2
+ import ResponsiveAd from './ResponsiveAd.svelte';
3
+ /** Add an ID to target with SCSS. */
4
+ export let id = '';
5
+ /** Add a class to target with SCSS. */
6
+ let cls = 'my-12';
7
+ export { cls as class };
8
+ const desktopPlacementName = 'reuters_sponsorlogo';
9
+ </script>
10
+
11
+ <!-- @component `SponsorshipeAd` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-SponsorshipAd--default) -->
12
+ <Block id="{id}" class="freestar-adslot {cls}">
13
+ <div class="ad-block">
14
+ <div class="ad-label">
15
+ <div>Today's Sponsor</div>
16
+ </div>
17
+ <div class="ad-container">
18
+ <div class="ad-slot__inner">
19
+ <div>
20
+ <ResponsiveAd desktopPlacementName="{desktopPlacementName}" />
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </Block>
26
+
27
+ <style>div.ad-block {
28
+ display: flex;
29
+ justify-content: center;
30
+ flex-direction: column;
31
+ align-items: center;
32
+ gap: 10px;
33
+ }
34
+ div.ad-block div.ad-label {
35
+ font-family: Knowledge, "Source Sans Pro", Arial, Helvetica, sans-serif;
36
+ font-size: 12px;
37
+ margin: 0;
38
+ line-height: 1.333;
39
+ color: var(--theme-colour-text-secondary);
40
+ text-align: right;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ justify-items: center;
45
+ }
46
+ div.ad-block div.ad-container {
47
+ display: flex;
48
+ flex-direction: column;
49
+ justify-content: center;
50
+ align-items: center;
51
+ width: 195px;
52
+ min-height: 24px;
53
+ }
54
+ div.ad-block div.ad-container div.ad-slot__inner {
55
+ margin: auto 0;
56
+ width: 100%;
57
+ max-width: 100%;
58
+ flex: unset;
59
+ }
60
+ div.ad-block div.ad-container div.ad-slot__inner > div {
61
+ display: block;
62
+ }
63
+ div.ad-block div.ad-container div.ad-slot__inner > div :global(div[data-freestar-ad]) {
64
+ display: flex;
65
+ flex-direction: column;
66
+ justify-content: center;
67
+ align-items: center;
68
+ }</style>
@@ -1,6 +1,5 @@
1
1
  import getParameterByName from './getParameterByName';
2
2
  import Ias from './ias';
3
- import { loadScript } from './loadScript';
4
3
  const ONETRUST_LOGS = 'ot_logs';
5
4
  const ONETRUST_GEOLOCATION_MOCK = 'ot_geolocation_mock';
6
5
  const ONETRUST_SCRIPT_ID = '38cb75bd-fbe1-4ac8-b4af-e531ab368caf-test';
@@ -32,8 +31,6 @@ export const loadBootstrap = () => {
32
31
  });
33
32
  });
34
33
  window.bootstrap.getResults((result) => {
35
- // Load Freestar script
36
- loadScript('https://a.pub.network/reuters-com/pubfig.min.js');
37
34
  // Set GAM
38
35
  window.googletag = window.googletag || { cmd: [] };
39
36
  window.googletag.cmd.push(() => {
@@ -54,9 +51,9 @@ export const loadBootstrap = () => {
54
51
  window.googletag.pubads().setTargeting('adstest', adstest);
55
52
  }
56
53
  // Use the URL path to create a unique ID for the page.
57
- const graphicId = window.location.pathname
58
- .replace(/^\/(.*)\/$/, '$1')
59
- .replaceAll('/', '-');
54
+ const graphicId = window.location.pathname.split('/')
55
+ // Get the first lowercase slug in the pathname, which is the graphic UID.
56
+ .filter(d => d.match(/[a-z0-9]+/) && d !== 'graphics')[0] || 'unknown-graphic';
60
57
  window.googletag.pubads().setTargeting('template', 'graphics');
61
58
  window.googletag.pubads().setTargeting('graphicId', graphicId);
62
59
  });
@@ -1,6 +1,8 @@
1
- export const loadScript = (src, onload) => {
1
+ export const loadScript = (src, attributes) => {
2
+ const { onload, async = true } = attributes || {};
2
3
  const script = document.createElement('script');
3
4
  script.addEventListener('load', onload);
5
+ script.async = async;
4
6
  script.src = src;
5
7
  document.head.append(script);
6
8
  };
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ export {
9
9
  } from './components/Analytics/Analytics.svelte';
10
10
  export { default as Article } from './components/Article/Article.svelte';
11
11
  export { default as AdScripts } from './components/AdSlot/AdScripts.svelte';
12
- export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
13
12
  export { default as BeforeAfter } from './components/BeforeAfter/BeforeAfter.svelte';
14
13
  export { default as Block } from './components/Block/Block.svelte';
15
14
  export { default as BodyText } from './components/BodyText/BodyText.svelte';
@@ -24,6 +23,7 @@ export { default as Headline } from './components/Headline/Headline.svelte';
24
23
  export { default as HeroHeadline } from './components/HeroHeadline/Hero.svelte';
25
24
  export { default as EndNotes } from './components/EndNotes/EndNotes.svelte';
26
25
  export { default as InfoBox } from './components/InfoBox/InfoBox.svelte';
26
+ export { default as InlineAd } from './components/AdSlot/InlineAd.svelte';
27
27
  export { default as PaddingReset } from './components/PaddingReset/PaddingReset.svelte';
28
28
  export { default as PhotoCarousel } from './components/PhotoCarousel/PhotoCarousel.svelte';
29
29
  export { default as PhotoPack } from './components/PhotoPack/PhotoPack.svelte';
@@ -40,6 +40,7 @@ export { default as SiteFooter } from './components/SiteFooter/SiteFooter.svelte
40
40
  export { default as SiteHeader } from './components/SiteHeader/SiteHeader.svelte';
41
41
  export { default as SiteHeadline } from './components/SiteHeadline/SiteHeadline.svelte';
42
42
  export { default as Spinner } from './components/Spinner/Spinner.svelte';
43
+ export { default as SponsorshipAd } from './components/AdSlot/SponsorshipAd.svelte';
43
44
  export { default as Table } from './components/Table/Table.svelte';
44
45
  export {
45
46
  default as Theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",
@@ -140,6 +140,7 @@
140
140
  "./components/AdSlot/InlineAd.svelte": "./dist/components/AdSlot/InlineAd.svelte",
141
141
  "./components/AdSlot/OneTrust.svelte": "./dist/components/AdSlot/OneTrust.svelte",
142
142
  "./components/AdSlot/ResponsiveAd.svelte": "./dist/components/AdSlot/ResponsiveAd.svelte",
143
+ "./components/AdSlot/SponsorshipAd.svelte": "./dist/components/AdSlot/SponsorshipAd.svelte",
143
144
  "./components/AdSlot/adScripts/bootstrap.ts": "./dist/components/AdSlot/adScripts/bootstrap.ts",
144
145
  "./components/AdSlot/adScripts/getParameterByName.ts": "./dist/components/AdSlot/adScripts/getParameterByName.ts",
145
146
  "./components/AdSlot/adScripts/ias.ts": "./dist/components/AdSlot/adScripts/ias.ts",