@reuters-graphics/graphics-components 1.1.4 → 1.1.6

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.
@@ -1,20 +1,23 @@
1
1
  <script context="module">
2
2
  import { registerPageview as registerChartbeatPageview } from './providers/chartbeat';
3
3
  import { registerPageview as registerGAPageview } from './providers/ga';
4
+ import { registerPageview as registerParselyPageview } from './providers/parsely';
4
5
 
5
6
  /** Register virtual pageviews when using client-side routing in multipage applications. */
6
7
  export function registerPageview() {
7
8
  registerChartbeatPageview();
8
9
  registerGAPageview();
10
+ registerParselyPageview();
9
11
  }
10
12
  </script>
11
13
 
12
14
  <!-- @component `Analytics` [Read the docs.](https://reuters-graphics.github.io/graphics-components/?path=/docs/components-Analytics--default) -->
13
15
  <script>export let authors = [];
14
16
  import { onMount } from "svelte";
15
- import { ga, chartbeat } from "./providers";
17
+ import { ga, chartbeat, parsely } from "./providers";
16
18
  onMount(() => {
17
19
  ga();
18
20
  chartbeat(authors);
21
+ parsely();
19
22
  });
20
23
  </script>
@@ -1,2 +1,3 @@
1
1
  export { default as ga } from './ga';
2
2
  export { default as chartbeat } from './chartbeat';
3
+ export { default as parsely } from './parsely';
@@ -1,2 +1,3 @@
1
1
  export { default as ga } from './ga';
2
2
  export { default as chartbeat } from './chartbeat';
3
+ export { default as parsely } from './parsely';
@@ -0,0 +1,3 @@
1
+ declare const _default: () => void;
2
+ export default _default;
3
+ export declare const registerPageview: () => void;
@@ -0,0 +1,29 @@
1
+ const SITE_ID = 'reuters.com';
2
+ const attachScript = () => {
3
+ const b = document.body;
4
+ const e = document.createElement('script');
5
+ e.id = 'parsely-cfg';
6
+ e.src = `//cdn.parsely.com/keys/${SITE_ID}/p.js`;
7
+ e.setAttribute('async', '');
8
+ e.setAttribute('defer', '');
9
+ b.appendChild(e);
10
+ };
11
+ export default () => {
12
+ window.PARSELY = window.PARSELY || {
13
+ autotrack: false,
14
+ onReady() {
15
+ window.PARSELY.updateDefaults({
16
+ data: {
17
+ is_logged_in: false,
18
+ },
19
+ });
20
+ window.PARSELY.beacon.trackPageView();
21
+ },
22
+ };
23
+ attachScript();
24
+ };
25
+ export const registerPageview = () => {
26
+ if (typeof window === 'undefined' || !window.PARSELY)
27
+ return;
28
+ window.PARSELY.beacon.trackPageView();
29
+ };
@@ -19,7 +19,7 @@ $: columnWidthVars = {
19
19
  };
20
20
  </script>
21
21
 
22
- <main>
22
+ <main id="main-content">
23
23
  <article {id} class:embedded {role} use:cssVariables="{columnWidthVars}">
24
24
  <!-- Article content -->
25
25
  <slot />
@@ -19,7 +19,7 @@ const getOrigin = (baseUrl2) => {
19
19
  }
20
20
  };
21
21
  $: origin = getOrigin(baseUrl);
22
- $: canonicalUrl = (origin + pageUrl.pathname).replace(/index\.html\/$/, "");
22
+ $: canonicalUrl = (origin + pageUrl?.pathname).replace(/index\.html\/$/, "");
23
23
  const orgLdJson = {
24
24
  "@context": "http://schema.org",
25
25
  "@type": "NewsMediaOrganization",
@@ -62,9 +62,9 @@ $: articleLdJson = {
62
62
  name,
63
63
  url
64
64
  })),
65
+ creator: authors.map(({ name }) => name),
65
66
  articleSection: "Graphics",
66
67
  isAccessibleForFree: true,
67
- creator: ["Reuters Graphics"],
68
68
  keywords: ["Reuters graphics", "Reuters", "graphics", "Interactives"]
69
69
  };
70
70
  </script>
@@ -40,13 +40,14 @@ onMount(async () => {
40
40
  --theme-font-family-sans-serif: Knowledge, sans-serif;
41
41
  `}"
42
42
  >
43
+ <a href="#main-content" class="skip-link"> Skip to main content </a>
43
44
  <div class="nav-container show-nav">
44
45
  <div class="scroll-container">
45
46
  <div class="inner">
46
47
  <div class="main-bar">
47
48
  <div class="logo-container">
48
49
  <div class="logo">
49
- <a href="https://www.reuters.com">
50
+ <a href="https://www.reuters.com" aria-label="Reuters home">
50
51
  <ReutersLogo
51
52
  logoColour="var(--nav-accent)"
52
53
  textColour="var(--nav-primary)"
@@ -236,4 +237,17 @@ To handle overlapping borders within components (e.g., buttons and inputs in inp
236
237
  }
237
238
  .mobile-menu .menu-button:focus-visible .button-container {
238
239
  border: 2px solid var(--nav-accent);
240
+ }
241
+ .skip-link {
242
+ position: absolute;
243
+ left: -10000px;
244
+ top: auto;
245
+ width: 1px;
246
+ height: 1px;
247
+ overflow: hidden;
248
+ }
249
+ .skip-link:focus {
250
+ position: static;
251
+ width: auto;
252
+ height: auto;
239
253
  }</style>
package/dist/globals.d.ts CHANGED
@@ -21,6 +21,14 @@ declare global {
21
21
  };
22
22
  /** Graphics ads */
23
23
  graphicsAdQueue: any[];
24
+ /** Parsely */
25
+ PARSELY: {
26
+ onLoad: () => void;
27
+ beacon: {
28
+ trackPageView: () => void;
29
+ };
30
+ updateDefaults: (params: any) => void;
31
+ };
24
32
  }
25
33
  }
26
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",