@ndla/article-converter 8.0.8 → 9.0.1-alpha.0

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,12 +10,10 @@ import { attributesToProps } from "html-react-parser";
10
10
  import { AudioEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const audioEmbedPlugin = (element, _, opts) => {
13
- var _opts$components;
14
13
  const props = attributesToProps(element.attribs);
15
14
  const data = JSON.parse(props["data-json"]);
16
15
  return _jsx(AudioEmbed, {
17
16
  embed: data,
18
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
19
17
  lang: opts.articleLanguage
20
18
  });
21
19
  };
@@ -10,12 +10,10 @@ import { attributesToProps } from "html-react-parser";
10
10
  import { BrightcoveEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const brightcoveEmbedPlugin = (element, _, opts) => {
13
- var _opts$components;
14
13
  const props = attributesToProps(element.attribs);
15
14
  const data = JSON.parse(props["data-json"]);
16
15
  return _jsx(BrightcoveEmbed, {
17
16
  embed: data,
18
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
19
17
  renderContext: opts.renderContext
20
18
  });
21
19
  };
@@ -10,13 +10,11 @@ import { attributesToProps } from "html-react-parser";
10
10
  import { ConceptEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const conceptEmbedPlugin = (element, _, opts) => {
13
- var _opts$components;
14
13
  const props = attributesToProps(element.attribs);
15
14
  const data = JSON.parse(props["data-json"]);
16
15
  return _jsx(ConceptEmbed, {
17
16
  embed: data,
18
17
  fullWidth: true,
19
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
20
18
  lang: opts.articleLanguage,
21
19
  renderContext: opts.renderContext
22
20
  });
@@ -10,17 +10,14 @@ import { attributesToProps } from "html-react-parser";
10
10
  import { ImageEmbed } from "@ndla/ui";
11
11
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
12
12
  export const imageEmbedPlugin = (element, _, opts) => {
13
- var _element$parentNode, _opts$components, _opts$canonicalUrls;
13
+ var _element$parentNode;
14
14
  const props = attributesToProps(element.attribs);
15
15
  const data = JSON.parse(props["data-json"]);
16
16
  const inGrid = ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.attribs) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode["data-type"]) === "grid";
17
17
  return _jsx(ImageEmbed, {
18
18
  inGrid: inGrid,
19
19
  embed: data,
20
- path: opts.path,
21
20
  previewAlt: opts.previewAlt,
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,
24
21
  lang: opts.articleLanguage,
25
22
  renderContext: opts.renderContext
26
23
  });
package/lib/index.d.ts CHANGED
@@ -7,4 +7,4 @@
7
7
  */
8
8
  export { default as transform } from "./transform";
9
9
  export { default as extractEmbedMeta, extractEmbedMetas } from "./extractEmbedMeta";
10
- export type { TransformOptions, DynamicComponents } from "./plugins/types";
10
+ export type { TransformOptions } from "./plugins/types";
@@ -16,12 +16,10 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const audioEmbedPlugin = (element, _, opts) => {
19
- var _opts$components;
20
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
20
  const data = JSON.parse(props["data-json"]);
22
21
  return (0, _jsxRuntime.jsx)(_ui.AudioEmbed, {
23
22
  embed: data,
24
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
25
23
  lang: opts.articleLanguage
26
24
  });
27
25
  };
@@ -16,12 +16,10 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const brightcoveEmbedPlugin = (element, _, opts) => {
19
- var _opts$components;
20
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
20
  const data = JSON.parse(props["data-json"]);
22
21
  return (0, _jsxRuntime.jsx)(_ui.BrightcoveEmbed, {
23
22
  embed: data,
24
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
25
23
  renderContext: opts.renderContext
26
24
  });
27
25
  };
@@ -16,13 +16,11 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const conceptEmbedPlugin = (element, _, opts) => {
19
- var _opts$components;
20
19
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
20
  const data = JSON.parse(props["data-json"]);
22
21
  return (0, _jsxRuntime.jsx)(_ui.ConceptEmbed, {
23
22
  embed: data,
24
23
  fullWidth: true,
25
- heartButton: (_opts$components = opts.components) === null || _opts$components === void 0 ? void 0 : _opts$components.heartButton,
26
24
  lang: opts.articleLanguage,
27
25
  renderContext: opts.renderContext
28
26
  });
@@ -16,17 +16,14 @@ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
16
  */
17
17
 
18
18
  const imageEmbedPlugin = (element, _, opts) => {
19
- var _element$parentNode, _opts$components, _opts$canonicalUrls;
19
+ var _element$parentNode;
20
20
  const props = (0, _htmlReactParser.attributesToProps)(element.attribs);
21
21
  const data = JSON.parse(props["data-json"]);
22
22
  const inGrid = ((_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.parentNode) === null || _element$parentNode === void 0 || (_element$parentNode = _element$parentNode.attribs) === null || _element$parentNode === void 0 ? void 0 : _element$parentNode["data-type"]) === "grid";
23
23
  return (0, _jsxRuntime.jsx)(_ui.ImageEmbed, {
24
24
  inGrid: inGrid,
25
25
  embed: data,
26
- path: opts.path,
27
26
  previewAlt: opts.previewAlt,
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,
30
27
  lang: opts.articleLanguage,
31
28
  renderContext: opts.renderContext
32
29
  });
@@ -7,17 +7,13 @@
7
7
  */
8
8
  /// <reference types="react" />
9
9
  import { Element, HTMLReactParserOptions } from "html-react-parser";
10
- import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from "@ndla/ui";
11
- export interface DynamicComponents {
12
- heartButton?: HeartButtonType;
13
- }
10
+ import { RenderContext, CanonicalUrlFuncs } from "@ndla/ui";
14
11
  export interface TransformOptions {
15
12
  isOembed?: boolean;
16
13
  subject?: string;
17
14
  path?: string;
18
15
  previewAlt?: boolean;
19
16
  frontendDomain?: string;
20
- components?: DynamicComponents;
21
17
  articleLanguage?: string;
22
18
  canonicalUrls?: CanonicalUrlFuncs;
23
19
  renderContext?: RenderContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/article-converter",
3
- "version": "8.0.8",
3
+ "version": "9.0.1-alpha.0",
4
4
  "description": "Transforms NDLA articles into extended html versions",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -31,7 +31,7 @@
31
31
  "@ndla/types-embed": "^4.1.8"
32
32
  },
33
33
  "dependencies": {
34
- "@ndla/ui": "^54.0.6",
34
+ "@ndla/ui": "^55.0.1-alpha.0",
35
35
  "html-react-parser": "^5.1.8"
36
36
  },
37
37
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "ca017a610c49c3f08691b7963b7a82284c3baa2b"
49
+ "gitHead": "4d43efa927c3f403d61a252efd8f06647073c076"
50
50
  }
package/src/index.ts CHANGED
@@ -8,4 +8,4 @@
8
8
 
9
9
  export { default as transform } from "./transform";
10
10
  export { default as extractEmbedMeta, extractEmbedMetas } from "./extractEmbedMeta";
11
- export type { TransformOptions, DynamicComponents } from "./plugins/types";
11
+ export type { TransformOptions } from "./plugins/types";
@@ -14,5 +14,5 @@ import { PluginType } from "../types";
14
14
  export const audioEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props["data-json"] as string) as AudioMetaData;
17
- return <AudioEmbed embed={data} heartButton={opts.components?.heartButton} lang={opts.articleLanguage} />;
17
+ return <AudioEmbed embed={data} lang={opts.articleLanguage} />;
18
18
  };
@@ -14,5 +14,5 @@ import { PluginType } from "../types";
14
14
  export const brightcoveEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props["data-json"] as string) as BrightcoveMetaData;
17
- return <BrightcoveEmbed embed={data} heartButton={opts.components?.heartButton} renderContext={opts.renderContext} />;
17
+ return <BrightcoveEmbed embed={data} renderContext={opts.renderContext} />;
18
18
  };
@@ -14,13 +14,5 @@ import { PluginType } from "../types";
14
14
  export const conceptEmbedPlugin: PluginType = (element, _, opts) => {
15
15
  const props = attributesToProps(element.attribs);
16
16
  const data = JSON.parse(props["data-json"] as string) as ConceptMetaData;
17
- return (
18
- <ConceptEmbed
19
- embed={data}
20
- fullWidth
21
- heartButton={opts.components?.heartButton}
22
- lang={opts.articleLanguage}
23
- renderContext={opts.renderContext}
24
- />
25
- );
17
+ return <ConceptEmbed embed={data} fullWidth lang={opts.articleLanguage} renderContext={opts.renderContext} />;
26
18
  };
@@ -20,10 +20,7 @@ export const imageEmbedPlugin: PluginType = (element, _, opts) => {
20
20
  <ImageEmbed
21
21
  inGrid={inGrid}
22
22
  embed={data}
23
- path={opts.path}
24
23
  previewAlt={opts.previewAlt}
25
- heartButton={opts.components?.heartButton}
26
- canonicalUrl={opts.canonicalUrls?.image}
27
24
  lang={opts.articleLanguage}
28
25
  renderContext={opts.renderContext}
29
26
  />
@@ -7,11 +7,7 @@
7
7
  */
8
8
 
9
9
  import { Element, HTMLReactParserOptions } from "html-react-parser";
10
- import { HeartButtonType, RenderContext, CanonicalUrlFuncs } from "@ndla/ui";
11
-
12
- export interface DynamicComponents {
13
- heartButton?: HeartButtonType;
14
- }
10
+ import { RenderContext, CanonicalUrlFuncs } from "@ndla/ui";
15
11
 
16
12
  export interface TransformOptions {
17
13
  isOembed?: boolean;
@@ -19,7 +15,6 @@ export interface TransformOptions {
19
15
  path?: string;
20
16
  previewAlt?: boolean;
21
17
  frontendDomain?: string;
22
- components?: DynamicComponents;
23
18
  articleLanguage?: string;
24
19
  canonicalUrls?: CanonicalUrlFuncs;
25
20
  renderContext?: RenderContext;