@financial-times/n-myft-ui 24.0.1 → 25.0.0-beta.3

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@financial-times/n-myft-ui",
3
- "version": "24.0.1",
3
+ "version": "25.0.0-beta.3",
4
4
  "description": "Client side component for interaction with myft",
5
- "main": "server.js",
5
+ "main": "dist/bundles/bundle.js",
6
+ "module": "dist/bundles/bundle.js",
6
7
  "scripts": {
7
8
  "test": "echo \"Error: no test specified\" && exit 1",
8
9
  "commit": "commit-wizard",
9
- "prepare": "npx snyk protect || npx snyk protect -d || true"
10
+ "prepare": "npx snyk protect || npx snyk protect -d || true",
11
+ "build-package": "webpack"
10
12
  },
11
13
  "repository": {
12
14
  "type": "git",
@@ -28,7 +30,6 @@
28
30
  "@financial-times/dotcom-server-react-jsx": "^2.6.2",
29
31
  "@financial-times/n-express": "^22.4.1",
30
32
  "@financial-times/n-gage": "^8.3.2",
31
- "@financial-times/n-heroku-tools": "8.3.1",
32
33
  "@sucrase/jest-plugin": "^2.2.0",
33
34
  "@testing-library/jest-dom": "^5.16.1",
34
35
  "@testing-library/react": "^12.1.2",
@@ -44,6 +45,8 @@
44
45
  "babel-plugin-transform-runtime": "^6.9.0",
45
46
  "babel-preset-env": "^1.7.0",
46
47
  "babel-preset-es2015": "^6.6.0",
48
+ "babel-preset-react": "^6.24.1",
49
+ "babel-preset-stage-2": "^6.24.1",
47
50
  "babel-runtime": "^6.9.2",
48
51
  "bower": "^1.8.8",
49
52
  "bower-resolve-webpack-plugin": "^1.0.5",
@@ -51,6 +54,7 @@
51
54
  "brotli": "^1.3.1",
52
55
  "chai": "4.2.0",
53
56
  "chalk": "2.4.2",
57
+ "check-engine": "^1.10.1",
54
58
  "css-loader": "^0.23.1",
55
59
  "denodeify": "^1.2.1",
56
60
  "eslint": "6.5.1",
@@ -82,20 +86,27 @@
82
86
  "mocha": "6.2.2",
83
87
  "mockery": "2.1.0",
84
88
  "node-fetch": "2.6.0",
85
- "node-sass": "4.13.0",
89
+ "node-sass": "^4.14.1",
86
90
  "nodemon": "^1.9.2",
87
91
  "npm-prepublish": "^1.2.1",
88
92
  "pa11y-ci": "^2.1.1",
89
93
  "postcss-loader": "^0.9.1",
90
94
  "react": "^17.0.2",
91
95
  "regenerator-runtime": "^0.13.3",
92
- "sass-loader": "^3.2.0",
93
96
  "semver": "6.3.0",
94
97
  "sinon": "^7.1.0",
95
98
  "sinon-chai": "^3.2.0",
96
99
  "snyk": "^1.216.5",
97
100
  "sucrase": "^3.10.1"
98
101
  },
102
+ "volta": {
103
+ "node": "12.22.5",
104
+ "npm": "7.20.2"
105
+ },
106
+ "engines": {
107
+ "node": "12.x",
108
+ "npm": "7.x || 8.x"
109
+ },
99
110
  "x-dash": {
100
111
  "engine": {
101
112
  "server": "hyperons"
@@ -107,6 +118,5 @@
107
118
  "pre-commit": "node_modules/.bin/secret-squirrel",
108
119
  "pre-push": "make verify -j3"
109
120
  }
110
- },
111
- "dependencies": {}
121
+ }
112
122
  }
@@ -0,0 +1,34 @@
1
+ const path = require('path');
2
+
3
+ module.exports = {
4
+ entry: './components/index.js',
5
+ resolve: {
6
+ extensions: ['.js', '.jsx']
7
+ },
8
+ module: {
9
+ rules: [
10
+ {
11
+ test: /\.(js|jsx)$/,
12
+ exclude: /node_modules/,
13
+ use: [
14
+ {
15
+ loader: 'babel-loader',
16
+ options: {
17
+ presets: [
18
+ 'react',
19
+ 'stage-2'
20
+ ]
21
+ }
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ },
27
+ target: 'node',
28
+ output: {
29
+ path: path.resolve(__dirname, 'dist/bundles'),
30
+ filename: 'bundle.js',
31
+ libraryTarget: 'umd',
32
+ library: '@financial-times/n-myft-ui'
33
+ }
34
+ };
@@ -1,77 +0,0 @@
1
- <section
2
- class="collection {{#if liteStyle}}collection--lite{{else}}collection--regular{{/if}}"
3
- data-trackable="{{#if trackable}}{{trackable}}{{else}}collection{{/if}}">
4
- <header class="collection__header {{#if liteStyle}}collection__header--lite{{else}}collection__header--regular{{/if}}">
5
- <h2 class="collection__title {{#if liteStyle}}collection__title--lite{{else}}collection__title--regular{{/if}}">
6
- {{title}}
7
- </h2>
8
- </header>
9
- <ul class="collection__concepts">
10
- {{#concepts}}
11
- <li class="collection__concept">
12
- {{#if ../liteStyle}}
13
- {{{renderReactComponent localPath="components/follow-button/follow-button" variant="primary" buttonText=name flags=@root.flags collectionName=../collectionName}}}
14
- {{else}}
15
- {{{renderReactComponent localPath="components/follow-button/follow-button" variant="inverse" buttonText=name flags=@root.flags collectionName=../collectionName}}}
16
- {{/if}}
17
- </li>
18
- {{/concepts}}
19
- </ul>
20
- <div class="collection__meta">
21
- <form
22
- method="POST"
23
- action="#"
24
- data-myft-ui="follow"
25
- {{#if collectionName}}data-myft-tracking="collectionName={{collectionName}}"{{/if}}
26
- data-concept-id="
27
- {{~#concepts~}}
28
- {{conceptId}}
29
- {{~#unless @last~}}
30
- ,
31
- {{~/unless~}}
32
- {{~/concepts~}}"
33
- class="n-myft-ui n-myft-ui--follow n-ui-hide-core collection-follow-all">
34
- <input
35
- type="hidden"
36
- name="directType"
37
- value="
38
- {{~#concepts~}}
39
- {{directType}}
40
- {{~#unless @last~}}
41
- ,
42
- {{~/unless~}}
43
- {{~/concepts~}}"
44
- />
45
- {{{renderReactComponent localPath="components/csrf-token/input"}}}
46
- <input
47
- type="hidden"
48
- name="name"
49
- value="
50
- {{~#concepts~}}
51
- {{name}}
52
- {{~#unless @last~}}
53
- ,
54
- {{~/unless~}}
55
- {{~/concepts~}}"
56
- />
57
- <button
58
- type="submit"
59
- aria-pressed="false"
60
- class="collection-follow-all__button {{#if liteStyle}}collection-follow-all__button--lite{{else}}collection-follow-all__button--regular{{/if}}"
61
- data-trackable="follow all"
62
- data-concept-id="
63
- {{~#concepts~}}
64
- {{conceptId}}
65
- {{~#unless @last~}}
66
- ,
67
- {{~/unless~}}
68
- {{~/concepts~}}"
69
- aria-label="Add all topics in the {{title}} collection to my F T"
70
- data-alternate-label="Remove all topics in the {{title}} collection from my F T"
71
- data-alternate-text="Added"
72
- title="Add all topics in the {{title}} collection to my F T">
73
- Add all to myFT
74
- </button>
75
- </form>
76
- </div>
77
- </section>
@@ -1,28 +0,0 @@
1
- {{#ifAll @root.flags.myFtApi @root.flags.myFtApiWrite concepts concepts.length}}
2
- <div
3
- class="concept-list"
4
- data-trackable="{{#if trackable}}{{trackable}}{{else}}concept-list{{/if}}">
5
- {{#ifSome contentType conceptListTitle}}
6
- <h2 class="concept-list__title">
7
- {{#if conceptListTitle}}
8
- {{conceptListTitle}}
9
- {{else}}
10
- Follow the topics in this {{contentType}}
11
- {{/if}}
12
- </h2>
13
- {{/ifSome}}
14
- <ul class="concept-list__list">
15
- {{#each concepts}}
16
- <li class="concept-list__list-item">
17
- <a
18
- href="{{relativeUrl}}"
19
- data-trackable="{{#if conceptTrackable}}{{conceptTrackable}}{{else}}concept{{/if}}"
20
- class="concept-list__concept">
21
- {{prefLabel}}
22
- </a>
23
- {{{renderReactComponent localPath="components/follow-button/follow-button" conceptId=id name=prefLabel flags=@root.flags}}}
24
- </li>
25
- {{/each}}
26
- </ul>
27
- </div>
28
- {{/ifAll}}
@@ -1,20 +0,0 @@
1
- {{#if showPrioritiseButton}}
2
- <span class="myft-pin-divider"></span>
3
- <div class="myft-pin-button-wrapper">
4
- <form method="post" action="/__myft/api/core/prioritised/concept/{{id}}?method={{#if prioritised}}delete{{else}}put{{/if}}" data-myft-prioritise>
5
- {{{renderReactComponent localPath="components/csrf-token/input"}}}
6
- <input type="hidden" value="{{name}}" name="name"> {{#if directType}}
7
- <input type="hidden" value="{{directType}}" name="directType"> {{else}}
8
- <input type="hidden" value="http://www.ft.com/ontology/concept/Concept" name="directType"> {{/if}}
9
- <div
10
- class="n-myft-ui__announcement o-normalise-visually-hidden"
11
- aria-live="assertive"
12
- data-pressed-text="{{name}} pinned in myFT."
13
- data-unpressed-text="Unpinned {{name}} from myFT."
14
- ></div>
15
- <button id="myft-pin-button__{{id}}" class="myft-pin-button" data-prioritise-button data-trackable="prioritised" data-concept-id="{{id}}" data-prioritised="{{#if prioritised}}true{{else}}false{{/if}}"
16
- aria-label="{{#if prioritised}}Unpin{{else}}Pin{{/if}} {{name}} {{#if prioritised}}from{{else}}in{{/if}} myFT" aria-pressed="{{#if prioritised}}true{{else}}false{{/if}}" title="{{#if prioritised}}Unpin{{else}}Pin{{/if}} {{name}}">
17
- </button>
18
- </form>
19
- </div>
20
- {{/if}}
@@ -1,67 +0,0 @@
1
- {{#if @root.flags.myFtApiWrite}}
2
- <form class="n-myft-ui n-myft-ui--save" method="GET"
3
- data-content-id="{{contentId}}"
4
- data-myft-ui="saved"
5
- action="/myft/save/{{contentId}}"
6
- data-js-action="/__myft/api/core/saved/content/{{contentId}}?method=put">
7
- {{{renderReactComponent localPath="components/csrf-token/input"}}}
8
- <div
9
- class="n-myft-ui__announcement o-normalise-visually-hidden"
10
- aria-live="assertive"
11
- data-pressed-text="Article saved in My FT."
12
- data-unpressed-text="Removed article from My FT."
13
- ></div>
14
- <button
15
- type="submit"
16
- class="{{#if saveButtonWithIcon}}n-myft-ui__save-button-with-icon{{else}}n-myft-ui__button{{#variant}} n-myft-ui__button--{{this}}{{/variant}}{{/if}}"
17
- data-trackable="{{#if trackableId}}{{trackableId}}{{else}}save-for-later{{/if}}"
18
- {{#if isSaved}}
19
- {{!-- The value of alternate label needs to be the opposite of label / the current saved state. This allows the client side JS to toggle the labels on state changes --}}
20
- title="{{#if title}}{{title}} is{{/if}} Saved to myFT"
21
- aria-label="{{#if title}}{{title}} is{{/if}} Saved to myFT"
22
- data-alternate-label="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
23
- aria-pressed="true"
24
- {{else}}
25
- title="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
26
- aria-label="{{#if title}}Save {{title}} to myFT for later{{else}}Save this article to myFT for later{{/if}}"
27
- data-alternate-label="{{#if title}}{{title}} is{{/if}} Saved to myFT"
28
- aria-pressed="false"
29
- {{/if}}
30
- {{#unlessEquals appIsStreamPage true}}
31
- {{#if saveButtonWithIcon}}
32
- data-text-variant="save-button-with-icon-copy"
33
- {{else}}
34
- data-text-variant="save-button-longer-copy"
35
- {{/if}}
36
- {{/unlessEquals}}
37
- {{#if alternateText}}
38
- data-alternate-text="{{alternateText}}"
39
- {{else}}
40
- {{#if isSaved}}
41
- data-alternate-text="Save&nbsp;"
42
- {{else}}
43
- data-alternate-text="Saved&nbsp;"
44
- {{/if}}
45
- {{/if}}
46
- data-content-id="{{contentId}}" {{! duplicated here for tracking}}
47
- >
48
- {{#if saveButtonWithIcon}}
49
- <span class="save-button-with-icon-copy" data-variant-label>{{#if buttonText~}}
50
- {{buttonText}}
51
- {{~else~}}
52
- {{#if isSaved}}Saved{{else}}Save{{/if}}
53
- {{~/if}}</span>
54
- {{else}}
55
- {{#if buttonText}}{{buttonText}}{{else}}
56
- {{#unlessEquals appIsStreamPage true}}
57
- <span class="save-button-longer-copy" data-variant-label>{{#if isSaved}}Saved&nbsp;{{else}}Save&nbsp;{{/if}}</span><span class="n-myft-ui__button--viewport-large" aria-hidden="true">to myFT</span>
58
- {{else}}
59
- <span>{{#if isSaved}}Saved{{else}}Save{{/if}}</span>
60
- {{/unlessEquals}}
61
- {{/if}}
62
- {{/if}}
63
- </button>
64
- </form>
65
- {{else}}
66
- <!-- Save button hidden due to myFtApiWrite being off -->
67
- {{/if }}