@financial-times/dotcom-ui-flags 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-flags",
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"
@@ -26,11 +25,14 @@
26
25
  "npm": "7.x || 8.x"
27
26
  },
28
27
  "dependencies": {
29
- "@financial-times/dotcom-ui-data-embed": "^7.2.7"
28
+ "@financial-times/dotcom-ui-data-embed": "file:../dotcom-ui-data-embed"
30
29
  },
31
30
  "peerDependencies": {
32
31
  "react": "16.x || 17.x"
33
32
  },
33
+ "files": [
34
+ "dist/"
35
+ ],
34
36
  "repository": {
35
37
  "type": "git",
36
38
  "repository": "https://github.com/Financial-Times/dotcom-page-kit.git",
@@ -44,4 +46,4 @@
44
46
  "check-engine": "^1.10.1",
45
47
  "react": "^16.8.6"
46
48
  }
47
- }
49
+ }
package/server.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./dist/node/server/index')
@@ -1,16 +0,0 @@
1
- import { TFlagsData, TFlag } from '../types'
2
-
3
- export default class Flags {
4
- private flags: TFlagsData
5
- constructor(flags: TFlagsData) {
6
- this.flags = Object.freeze(flags)
7
- }
8
-
9
- get(flag: string): TFlag | undefined {
10
- return this.flags.hasOwnProperty(flag) ? this.flags[flag] : undefined
11
- }
12
-
13
- getAll(): TFlagsData {
14
- return this.flags
15
- }
16
- }
@@ -1,9 +0,0 @@
1
- import loadFlags from './loadFlags'
2
- import Flags from './Flags'
3
-
4
- const init = () => {
5
- const flagsData = loadFlags()
6
- return new Flags(flagsData)
7
- }
8
-
9
- export { loadFlags, Flags, init }
@@ -1,7 +0,0 @@
1
- import { loadDataEmbed } from '@financial-times/dotcom-ui-data-embed'
2
- import { TFlagsData } from '../types'
3
- import { SCRIPT_ELEMENT_ID } from '../constants'
4
-
5
- export default function loadFlags(): TFlagsData {
6
- return loadDataEmbed(SCRIPT_ELEMENT_ID)
7
- }
@@ -1,19 +0,0 @@
1
- import { DataEmbed } from '@financial-times/dotcom-ui-data-embed'
2
- import { formatFlagsJSON } from '../server'
3
- import { TFlagsData } from '../types'
4
- import { SCRIPT_ELEMENT_ID } from '../constants'
5
-
6
- type TFlagsEmbedProps = {
7
- flags?: TFlagsData
8
- }
9
-
10
- function FlagsEmbed({ flags }: TFlagsEmbedProps) {
11
- return DataEmbed({ id: SCRIPT_ELEMENT_ID, data: formatFlagsJSON(flags) })
12
- }
13
-
14
- FlagsEmbed.defaultProps = {
15
- flags: {}
16
- }
17
-
18
- export { FlagsEmbed }
19
- export type { TFlagsEmbedProps }
package/src/constants.ts DELETED
@@ -1 +0,0 @@
1
- export const SCRIPT_ELEMENT_ID = 'page-kit-flags-embed'
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './components/FlagsEmbed'
2
- export * from './constants'
@@ -1,15 +0,0 @@
1
- import { TFlagsData } from '../types'
2
-
3
- export default function formatFlagsJSON(flags: TFlagsData = {}): TFlagsData {
4
- const output = {}
5
-
6
- Object.keys(flags).forEach((key) => {
7
- const value = flags[key]
8
-
9
- if (value) {
10
- output[key] = value
11
- }
12
- })
13
-
14
- return output
15
- }
@@ -1,2 +0,0 @@
1
- import formatFlagsJSON from './formatFlagsJSON'
2
- export { formatFlagsJSON }
package/src/types.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export type TFlag = string | boolean | number
2
-
3
- export interface TFlagsData {
4
- [key: string]: TFlag
5
- }