@ndla/ui 3.0.11 → 3.0.12

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/lib/index.d.ts CHANGED
@@ -46,3 +46,4 @@ export { default as ResourceGroup } from './ResourceGroup';
46
46
  export { default as LayoutItem, OneColumn, PageContainer, Content } from './Layout';
47
47
  export { SubjectAbout, SubjectArchive, SubjectCarousel, SubjectChildContent, SubjectContent, SubjectFilter, SubjectFlexChild, SubjectFlexWrapper, SubjectHeader, SubjectLinks, SubjectNewContent, SubjectSecondaryContent, SubjectSectionTitle, SubjectShortcuts, SubjectSidebarWrapper, SubjectSocialContent, SubjectSocialSection, SubjectTopics, SubjectBanner, } from './Subject';
48
48
  export { default as ContentCard } from './ContentCard';
49
+ export { default as MatomoTracker } from './Matomo';
package/lib/index.js CHANGED
@@ -103,7 +103,8 @@ var _exportNames = {
103
103
  SubjectSocialSection: true,
104
104
  SubjectTopics: true,
105
105
  SubjectBanner: true,
106
- ContentCard: true
106
+ ContentCard: true,
107
+ MatomoTracker: true
107
108
  };
108
109
  Object.defineProperty(exports, "ArticleByline", {
109
110
  enumerable: true,
@@ -693,6 +694,12 @@ Object.defineProperty(exports, "ContentCard", {
693
694
  return _ContentCard["default"];
694
695
  }
695
696
  });
697
+ Object.defineProperty(exports, "MatomoTracker", {
698
+ enumerable: true,
699
+ get: function get() {
700
+ return _Matomo["default"];
701
+ }
702
+ });
696
703
 
697
704
  var _indexJavascript = require("./index-javascript");
698
705
 
@@ -781,6 +788,8 @@ var _Subject = require("./Subject");
781
788
 
782
789
  var _ContentCard = _interopRequireDefault(require("./ContentCard"));
783
790
 
791
+ var _Matomo = _interopRequireDefault(require("./Matomo"));
792
+
784
793
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
785
794
 
786
795
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "UI component library for NDLA.",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -34,15 +34,15 @@
34
34
  "@ndla/button": "^1.0.6",
35
35
  "@ndla/carousel": "^1.0.6",
36
36
  "@ndla/core": "^0.7.2",
37
- "@ndla/hooks": "^1.0.5",
37
+ "@ndla/hooks": "^1.0.6",
38
38
  "@ndla/icons": "^1.3.1",
39
39
  "@ndla/licenses": "^1.0.7",
40
- "@ndla/modal": "^1.1.10",
40
+ "@ndla/modal": "^1.1.11",
41
41
  "@ndla/safelink": "^1.0.5",
42
42
  "@ndla/switch": "^0.0.32",
43
- "@ndla/tabs": "^1.0.7",
43
+ "@ndla/tabs": "^1.0.8",
44
44
  "@ndla/tooltip": "^0.2.46",
45
- "@ndla/util": "^1.1.1",
45
+ "@ndla/util": "^2.0.0",
46
46
  "@reach/menu-button": "^0.12.1",
47
47
  "@reach/slider": "^0.12.1",
48
48
  "@types/hoist-non-react-statics": "^3.3.1",
@@ -92,5 +92,5 @@
92
92
  "publishConfig": {
93
93
  "access": "public"
94
94
  },
95
- "gitHead": "c8dd39fca22db0ab754eac76406c723a678159ab"
95
+ "gitHead": "358121e2526a252d2b53f010e4b38c17040872dc"
96
96
  }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright (c) 2021-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import React from 'react';
10
+
11
+ interface Props {
12
+ trackerUrl: string;
13
+ siteId: string;
14
+ }
15
+
16
+ export const MatomoTracker = ({ trackerUrl, siteId }: Props) => {
17
+ return (
18
+ <script
19
+ dangerouslySetInnerHTML={{
20
+ __html: `
21
+ var _paq = window._paq = window._paq || [];
22
+ _paq.push(['trackPageView']);
23
+ _paq.push(['enableLinkTracking']);
24
+ (function() {
25
+ var u="${trackerUrl}";
26
+ _paq.push(['setTrackerUrl', u+'matomo.php']);
27
+ _paq.push(['setSiteId', '${siteId}']);
28
+ var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
29
+ g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
30
+ })();`,
31
+ }}
32
+ />
33
+ );
34
+ };
35
+
36
+ export default MatomoTracker;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2021-present, NDLA.
3
+ *
4
+ * This source code is licensed under the GPLv3 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import MatomoTracker from './MatomoTracker';
10
+
11
+ export default MatomoTracker;
@@ -1,4 +1,4 @@
1
- import React, { ReactChildren } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import styled from '@emotion/styled';
4
4
  import { breakpoints, fonts, mq } from '@ndla/core';
@@ -87,7 +87,7 @@ const Illustration = styled.div`
87
87
 
88
88
  type Props = {
89
89
  cards: ListItemProps[];
90
- children: ReactChildren;
90
+ children: ReactNode;
91
91
  totalCardCount: number;
92
92
  hideCards?: boolean;
93
93
  };
package/src/index.ts CHANGED
@@ -135,3 +135,4 @@ export {
135
135
  } from './Subject';
136
136
 
137
137
  export { default as ContentCard } from './ContentCard';
138
+ export { default as MatomoTracker } from './Matomo';