@financial-times/dotcom-ui-data-embed 7.2.7 → 7.3.1

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/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-ui-data-embed",
3
- "version": "7.2.7",
3
+ "version": "7.3.1",
4
4
  "description": "",
5
5
  "main": "component.js",
6
6
  "browser": "browser.js",
7
7
  "types": "src/index.ts",
8
8
  "scripts": {
9
9
  "test": "echo \"Error: no test specified\" && exit 1",
10
- "tsc": "../../node_modules/.bin/tsc --incremental",
11
10
  "clean": "npm run clean:dist && npm run clean:node_modules",
12
11
  "clean:dist": "rm -rf dist",
13
12
  "clean:node_modules": "rm -rf node_modules",
14
13
  "clean:install": "npm run clean && npm i",
15
- "build:node": "npm run tsc -- --module commonjs --outDir ./dist/node",
16
- "build:browser": "npm run tsc -- --module es2015 --outDir ./dist/browser",
14
+ "build:browser": "tsc --module es2015 --outDir ./dist/browser",
15
+ "build:node": "tsc",
17
16
  "build": "npm run build:node && npm run build:browser",
18
17
  "dev": "echo -n node browser | parallel -u -d ' ' npm run build:{} -- --watch",
19
18
  "preinstall": "[ \"$INIT_CWD\" != \"$PWD\" ] || npm_config_yes=true npx check-engine"
@@ -28,6 +27,9 @@
28
27
  "peerDependencies": {
29
28
  "react": "16.x || 17.x"
30
29
  },
30
+ "files": [
31
+ "dist/"
32
+ ],
31
33
  "repository": {
32
34
  "type": "git",
33
35
  "repository": "https://github.com/Financial-Times/dotcom-page-kit.git",
@@ -41,4 +43,4 @@
41
43
  "check-engine": "^1.10.1",
42
44
  "react": "^16.8.6"
43
45
  }
44
- }
46
+ }
@@ -1,15 +0,0 @@
1
- export default class DataEmbedStore {
2
- private data
3
-
4
- constructor(data) {
5
- this.data = Object.freeze(data)
6
- }
7
-
8
- get(key: string) {
9
- return this.data.hasOwnProperty(key) ? this.data[key] : undefined
10
- }
11
-
12
- getAll() {
13
- return this.data
14
- }
15
- }
@@ -1,9 +0,0 @@
1
- import loadDataEmbed from './loadDataEmbed'
2
- import DataEmbedStore from './DataEmbedStore'
3
-
4
- const init = ({ id }: { id: string }) => {
5
- const data = loadDataEmbed(id)
6
- return new DataEmbedStore(data)
7
- }
8
-
9
- export { loadDataEmbed, init }
@@ -1,15 +0,0 @@
1
- export default function loadDataEmbed(id: string) {
2
- const dataEmbedElement = document.getElementById(id)
3
-
4
- let data = {}
5
-
6
- if (dataEmbedElement) {
7
- try {
8
- data = JSON.parse(dataEmbedElement.innerHTML)
9
- } catch (error) {
10
- console.error('Data embed error', error) // eslint-disable-line no-console
11
- }
12
- }
13
-
14
- return Object.freeze(data)
15
- }
@@ -1,5 +0,0 @@
1
- import React from 'react'
2
-
3
- export function DataEmbed({ id, data }: { id: string; data: object }) {
4
- return <script type="application/json" id={id} dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }} />
5
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './components/DataEmbed'
2
- export * from './client'