@ndla/article-converter 6.0.5 → 6.0.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.
@@ -10,6 +10,7 @@ import { ContactBlock } from '@ndla/ui';
10
10
  import { attributesToProps } from 'html-react-parser';
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export var contactBlockEmbedPlugin = function contactBlockEmbedPlugin(element, _, opts) {
13
+ var _opts$canonicalUrls;
13
14
  var props = attributesToProps(element.attribs);
14
15
  var embedData = JSON.parse(props['data-json']);
15
16
  var _embedData$embedData = embedData.embedData,
@@ -29,6 +30,7 @@ export var contactBlockEmbedPlugin = function contactBlockEmbedPlugin(element, _
29
30
  jobTitle: jobTitle,
30
31
  name: name,
31
32
  blob: blob,
32
- lang: opts.articleLanguage
33
+ lang: opts.articleLanguage,
34
+ imageCanonicalUrl: (_opts$canonicalUrls = opts.canonicalUrls) === null || _opts$canonicalUrls === void 0 ? void 0 : _opts$canonicalUrls.image
33
35
  });
34
36
  };
@@ -10,7 +10,7 @@ import { ImageEmbed } from '@ndla/ui';
10
10
  import { attributesToProps } from 'html-react-parser';
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export var imageEmbedPlugin = function imageEmbedPlugin(element, _, opts) {
13
- var _element$parentNode, _element$parentNode$p, _element$parentNode$p2, _opts$components;
13
+ var _element$parentNode, _element$parentNode$p, _element$parentNode$p2, _opts$components, _opts$canonicalUrls;
14
14
  var props = attributesToProps(element.attribs);
15
15
  var data = JSON.parse(props['data-json']);
16
16
  var inGrid = ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : (_element$parentNode$p = _element$parentNode.parentNode) === null || _element$parentNode$p === void 0 ? void 0 : (_element$parentNode$p2 = _element$parentNode$p.attribs) === null || _element$parentNode$p2 === void 0 ? void 0 : _element$parentNode$p2['data-type']) === 'grid';
@@ -20,6 +20,7 @@ export var imageEmbedPlugin = function imageEmbedPlugin(element, _, opts) {
20
20
  path: opts.path,
21
21
  previewAlt: opts.previewAlt,
22
22
  heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
23
+ canonicalUrl: (_opts$canonicalUrls = opts.canonicalUrls) === null || _opts$canonicalUrls === void 0 ? void 0 : _opts$canonicalUrls.image,
23
24
  lang: opts.articleLanguage,
24
25
  renderContext: opts.renderContext
25
26
  });
@@ -16,6 +16,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  var contactBlockEmbedPlugin = function contactBlockEmbedPlugin(element, _, opts) {
19
+ var _opts$canonicalUrls;
19
20
  var props = (0, _htmlReactParser.attributesToProps)(element.attribs);
20
21
  var embedData = JSON.parse(props['data-json']);
21
22
  var _embedData$embedData = embedData.embedData,
@@ -35,7 +36,8 @@ var contactBlockEmbedPlugin = function contactBlockEmbedPlugin(element, _, opts)
35
36
  jobTitle: jobTitle,
36
37
  name: name,
37
38
  blob: blob,
38
- lang: opts.articleLanguage
39
+ lang: opts.articleLanguage,
40
+ imageCanonicalUrl: (_opts$canonicalUrls = opts.canonicalUrls) === null || _opts$canonicalUrls === void 0 ? void 0 : _opts$canonicalUrls.image
39
41
  });
40
42
  };
41
43
  exports.contactBlockEmbedPlugin = contactBlockEmbedPlugin;
@@ -16,7 +16,7 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  var imageEmbedPlugin = function imageEmbedPlugin(element, _, opts) {
19
- var _element$parentNode, _element$parentNode$p, _element$parentNode$p2, _opts$components;
19
+ var _element$parentNode, _element$parentNode$p, _element$parentNode$p2, _opts$components, _opts$canonicalUrls;
20
20
  var props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
21
  var data = JSON.parse(props['data-json']);
22
22
  var inGrid = ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 ? void 0 : (_element$parentNode$p = _element$parentNode.parentNode) === null || _element$parentNode$p === void 0 ? void 0 : (_element$parentNode$p2 = _element$parentNode$p.attribs) === null || _element$parentNode$p2 === void 0 ? void 0 : _element$parentNode$p2['data-type']) === 'grid';
@@ -26,6 +26,7 @@ var imageEmbedPlugin = function imageEmbedPlugin(element, _, opts) {
26
26
  path: opts.path,
27
27
  previewAlt: opts.previewAlt,
28
28
  heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
29
+ canonicalUrl: (_opts$canonicalUrls = opts.canonicalUrls) === null || _opts$canonicalUrls === void 0 ? void 0 : _opts$canonicalUrls.image,
29
30
  lang: opts.articleLanguage,
30
31
  renderContext: opts.renderContext
31
32
  });
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import { HeartButtonType, RenderContext } from '@ndla/ui';
9
+ import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from '@ndla/ui';
10
10
  import { Element, HTMLReactParserOptions } from 'html-react-parser';
11
11
  export interface DynamicComponents {
12
12
  heartButton?: HeartButtonType;
@@ -19,6 +19,7 @@ export interface TransformOptions {
19
19
  frontendDomain?: string;
20
20
  components?: DynamicComponents;
21
21
  articleLanguage?: string;
22
+ canonicalUrls?: CanonicalUrlFuncs;
22
23
  renderContext?: RenderContext;
23
24
  }
24
25
  export type PluginType = (element: Element, options: HTMLReactParserOptions, metaData: TransformOptions) => JSX.Element | undefined | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -27,11 +27,12 @@
27
27
  "src"
28
28
  ],
29
29
  "devDependencies": {
30
+ "@ndla/types-backend": "^0.2.21",
30
31
  "@ndla/types-embed": "^4.0.7"
31
32
  },
32
33
  "dependencies": {
33
- "@ndla/code": "^5.0.12",
34
- "@ndla/ui": "^49.0.6",
34
+ "@ndla/code": "^5.0.13",
35
+ "@ndla/ui": "^49.0.7",
35
36
  "html-react-parser": "^4.2.2",
36
37
  "lodash": "^4.17.20"
37
38
  },
@@ -44,5 +45,5 @@
44
45
  "publishConfig": {
45
46
  "access": "public"
46
47
  },
47
- "gitHead": "780199a967ead3bcb024102e21fea869e3aec2ba"
48
+ "gitHead": "5b6502dbc509b761ddea72112df15ee4fe633255"
48
49
  }
@@ -26,6 +26,7 @@ export const contactBlockEmbedPlugin: PluginType = (element, _, opts) => {
26
26
  name={name}
27
27
  blob={blob}
28
28
  lang={opts.articleLanguage}
29
+ imageCanonicalUrl={opts.canonicalUrls?.image}
29
30
  />
30
31
  );
31
32
  };
@@ -23,6 +23,7 @@ export const imageEmbedPlugin: PluginType = (element, _, opts) => {
23
23
  path={opts.path}
24
24
  previewAlt={opts.previewAlt}
25
25
  heartButton={opts.components?.heartButton}
26
+ canonicalUrl={opts.canonicalUrls?.image}
26
27
  lang={opts.articleLanguage}
27
28
  renderContext={opts.renderContext}
28
29
  />
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
 
9
- import { HeartButtonType, RenderContext } from '@ndla/ui';
9
+ import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from '@ndla/ui';
10
10
  import { Element, HTMLReactParserOptions } from 'html-react-parser';
11
11
 
12
12
  export interface DynamicComponents {
@@ -21,6 +21,7 @@ export interface TransformOptions {
21
21
  frontendDomain?: string;
22
22
  components?: DynamicComponents;
23
23
  articleLanguage?: string;
24
+ canonicalUrls?: CanonicalUrlFuncs;
24
25
  renderContext?: RenderContext;
25
26
  }
26
27