@financial-times/n-conversion-forms 32.8.0 → 32.10.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.
- package/.eslintignore +6 -2
- package/.prettierignore +1 -0
- package/.toolkitrc.yml +9 -3
- package/.toolkitstate/ci.json +2 -2
- package/components/__snapshots__/graduation-date.spec.js.snap +3 -3
- package/components/__snapshots__/industry.spec.js.snap +364 -16
- package/components/__snapshots__/position.spec.js.snap +64 -64
- package/components/__snapshots__/responsibility.spec.js.snap +270 -150
- package/components/accept-terms-subscription.jsx +8 -6
- package/components/confirmation.jsx +3 -5
- package/components/industry.jsx +2 -0
- package/components/industry.stories.js +3 -0
- package/components/position.jsx +4 -6
- package/components/position.stories.js +3 -0
- package/components/responsibility.jsx +4 -6
- package/components/responsibility.spec.js +0 -10
- package/components/responsibility.stories.js +3 -0
- package/dist/industry.jsx +3 -0
- package/dist/position.jsx +4 -6
- package/dist/responsibility.jsx +4 -6
- package/package.json +12 -14
package/components/position.jsx
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
const B2CPositions = demographics.positions.positions;
|
|
6
|
-
const B2BPositions = b2b.demographics.positions.positions;
|
|
4
|
+
import { demographics } from 'n-common-static-data';
|
|
7
5
|
|
|
8
6
|
export function Position({
|
|
9
7
|
value,
|
|
@@ -12,8 +10,7 @@ export function Position({
|
|
|
12
10
|
fieldId = 'positionField',
|
|
13
11
|
selectId = 'position',
|
|
14
12
|
selectName = 'position',
|
|
15
|
-
|
|
16
|
-
options = isB2B ? B2BPositions : B2CPositions,
|
|
13
|
+
options = demographics.positions.positions,
|
|
17
14
|
isRequired = true,
|
|
18
15
|
fieldLabel = 'What’s your job position?',
|
|
19
16
|
}) {
|
|
@@ -28,6 +25,8 @@ export function Position({
|
|
|
28
25
|
{ 'o-forms-field--optional': !isRequired },
|
|
29
26
|
]);
|
|
30
27
|
|
|
28
|
+
options.sort((a, b) => a.description.localeCompare(b.description));
|
|
29
|
+
|
|
31
30
|
return (
|
|
32
31
|
<label
|
|
33
32
|
id={fieldId}
|
|
@@ -72,7 +71,6 @@ Position.propTypes = {
|
|
|
72
71
|
fieldId: PropTypes.string,
|
|
73
72
|
selectId: PropTypes.string,
|
|
74
73
|
selectName: PropTypes.string,
|
|
75
|
-
isB2B: PropTypes.bool,
|
|
76
74
|
options: PropTypes.arrayOf(
|
|
77
75
|
PropTypes.shape({
|
|
78
76
|
code: PropTypes.string,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
const B2CResponsibilities = demographics.responsibilities.responsibilities;
|
|
6
|
-
const B2BResponsibilities = b2b.demographics.responsibilities.responsibilities;
|
|
4
|
+
import { demographics } from 'n-common-static-data';
|
|
7
5
|
|
|
8
6
|
export function Responsibility({
|
|
9
7
|
value,
|
|
@@ -13,8 +11,7 @@ export function Responsibility({
|
|
|
13
11
|
fieldId = 'responsibilityField',
|
|
14
12
|
selectId = 'responsibility',
|
|
15
13
|
selectName = 'responsibility',
|
|
16
|
-
|
|
17
|
-
options = isB2B ? B2BResponsibilities : B2CResponsibilities,
|
|
14
|
+
options = demographics.responsibilities.responsibilities,
|
|
18
15
|
fieldLabel = 'Which best describes your job responsibility?',
|
|
19
16
|
}) {
|
|
20
17
|
const inputWrapperClassName = classNames([
|
|
@@ -28,6 +25,8 @@ export function Responsibility({
|
|
|
28
25
|
{ 'o-forms-field--optional': !isRequired },
|
|
29
26
|
]);
|
|
30
27
|
|
|
28
|
+
options.sort((a, b) => a.description.localeCompare(b.description));
|
|
29
|
+
|
|
31
30
|
return (
|
|
32
31
|
<label
|
|
33
32
|
id={fieldId}
|
|
@@ -74,7 +73,6 @@ Responsibility.propTypes = {
|
|
|
74
73
|
fieldId: PropTypes.string,
|
|
75
74
|
selectId: PropTypes.string,
|
|
76
75
|
selectName: PropTypes.string,
|
|
77
|
-
isB2B: PropTypes.bool,
|
|
78
76
|
options: PropTypes.arrayOf(
|
|
79
77
|
PropTypes.shape({
|
|
80
78
|
code: PropTypes.string,
|
|
@@ -74,14 +74,4 @@ describe('Responsibility', () => {
|
|
|
74
74
|
component.find('.o-forms-title.o-forms-field--optional').length
|
|
75
75
|
).toEqual(1);
|
|
76
76
|
});
|
|
77
|
-
|
|
78
|
-
it('defaults to B2B options if isB2B is true', () => {
|
|
79
|
-
const props = { isB2B: true };
|
|
80
|
-
const component = mount(Responsibility(props));
|
|
81
|
-
|
|
82
|
-
// Look for an option which is only present in the default B2B data set and not in the B2C one.
|
|
83
|
-
const optionValue = component.find('option').at(1).instance().value;
|
|
84
|
-
|
|
85
|
-
expect(optionValue).toBe('ACC');
|
|
86
|
-
});
|
|
87
77
|
});
|
package/dist/industry.jsx
CHANGED
|
@@ -34,6 +34,9 @@ function Industry(_ref) {
|
|
|
34
34
|
var fieldTitleClassName = (0, _classnames["default"])(['o-forms-title', {
|
|
35
35
|
'o-forms-field--optional': !isRequired
|
|
36
36
|
}]);
|
|
37
|
+
options.sort(function (a, b) {
|
|
38
|
+
return a.description.localeCompare(b.description);
|
|
39
|
+
});
|
|
37
40
|
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
38
41
|
id: fieldId,
|
|
39
42
|
className: "o-forms-field ncf__validation-error",
|
package/dist/position.jsx
CHANGED
|
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _nCommonStaticData = require("n-common-static-data");
|
|
12
|
-
var B2CPositions = _nCommonStaticData.demographics.positions.positions;
|
|
13
|
-
var B2BPositions = _nCommonStaticData.b2b.demographics.positions.positions;
|
|
14
12
|
function Position(_ref) {
|
|
15
13
|
var value = _ref.value,
|
|
16
14
|
_ref$isDisabled = _ref.isDisabled,
|
|
@@ -23,10 +21,8 @@ function Position(_ref) {
|
|
|
23
21
|
selectId = _ref$selectId === void 0 ? 'position' : _ref$selectId,
|
|
24
22
|
_ref$selectName = _ref.selectName,
|
|
25
23
|
selectName = _ref$selectName === void 0 ? 'position' : _ref$selectName,
|
|
26
|
-
_ref$isB2B = _ref.isB2B,
|
|
27
|
-
isB2B = _ref$isB2B === void 0 ? false : _ref$isB2B,
|
|
28
24
|
_ref$options = _ref.options,
|
|
29
|
-
options = _ref$options === void 0 ?
|
|
25
|
+
options = _ref$options === void 0 ? _nCommonStaticData.demographics.positions.positions : _ref$options,
|
|
30
26
|
_ref$isRequired = _ref.isRequired,
|
|
31
27
|
isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired,
|
|
32
28
|
_ref$fieldLabel = _ref.fieldLabel,
|
|
@@ -37,6 +33,9 @@ function Position(_ref) {
|
|
|
37
33
|
var fieldTitleClassName = (0, _classnames["default"])(['o-forms-title', {
|
|
38
34
|
'o-forms-field--optional': !isRequired
|
|
39
35
|
}]);
|
|
36
|
+
options.sort(function (a, b) {
|
|
37
|
+
return a.description.localeCompare(b.description);
|
|
38
|
+
});
|
|
40
39
|
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
41
40
|
id: fieldId,
|
|
42
41
|
className: "o-forms-field ncf__validation-error",
|
|
@@ -76,7 +75,6 @@ Position.propTypes = {
|
|
|
76
75
|
fieldId: _propTypes["default"].string,
|
|
77
76
|
selectId: _propTypes["default"].string,
|
|
78
77
|
selectName: _propTypes["default"].string,
|
|
79
|
-
isB2B: _propTypes["default"].bool,
|
|
80
78
|
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
81
79
|
code: _propTypes["default"].string,
|
|
82
80
|
description: _propTypes["default"].string
|
package/dist/responsibility.jsx
CHANGED
|
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _nCommonStaticData = require("n-common-static-data");
|
|
12
|
-
var B2CResponsibilities = _nCommonStaticData.demographics.responsibilities.responsibilities;
|
|
13
|
-
var B2BResponsibilities = _nCommonStaticData.b2b.demographics.responsibilities.responsibilities;
|
|
14
12
|
function Responsibility(_ref) {
|
|
15
13
|
var value = _ref.value,
|
|
16
14
|
_ref$isDisabled = _ref.isDisabled,
|
|
@@ -25,10 +23,8 @@ function Responsibility(_ref) {
|
|
|
25
23
|
selectId = _ref$selectId === void 0 ? 'responsibility' : _ref$selectId,
|
|
26
24
|
_ref$selectName = _ref.selectName,
|
|
27
25
|
selectName = _ref$selectName === void 0 ? 'responsibility' : _ref$selectName,
|
|
28
|
-
_ref$isB2B = _ref.isB2B,
|
|
29
|
-
isB2B = _ref$isB2B === void 0 ? false : _ref$isB2B,
|
|
30
26
|
_ref$options = _ref.options,
|
|
31
|
-
options = _ref$options === void 0 ?
|
|
27
|
+
options = _ref$options === void 0 ? _nCommonStaticData.demographics.responsibilities.responsibilities : _ref$options,
|
|
32
28
|
_ref$fieldLabel = _ref.fieldLabel,
|
|
33
29
|
fieldLabel = _ref$fieldLabel === void 0 ? 'Which best describes your job responsibility?' : _ref$fieldLabel;
|
|
34
30
|
var inputWrapperClassName = (0, _classnames["default"])(['o-forms-input', 'o-forms-input--select', {
|
|
@@ -37,6 +33,9 @@ function Responsibility(_ref) {
|
|
|
37
33
|
var fieldTitleClassName = (0, _classnames["default"])(['o-forms-title', {
|
|
38
34
|
'o-forms-field--optional': !isRequired
|
|
39
35
|
}]);
|
|
36
|
+
options.sort(function (a, b) {
|
|
37
|
+
return a.description.localeCompare(b.description);
|
|
38
|
+
});
|
|
40
39
|
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
41
40
|
id: fieldId,
|
|
42
41
|
className: "o-forms-field ncf__validation-error",
|
|
@@ -76,7 +75,6 @@ Responsibility.propTypes = {
|
|
|
76
75
|
fieldId: _propTypes["default"].string,
|
|
77
76
|
selectId: _propTypes["default"].string,
|
|
78
77
|
selectName: _propTypes["default"].string,
|
|
79
|
-
isB2B: _propTypes["default"].bool,
|
|
80
78
|
options: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
81
79
|
code: _propTypes["default"].string,
|
|
82
80
|
description: _propTypes["default"].string
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.10.0",
|
|
4
4
|
"description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "dotcom-tool-kit test:local",
|
|
8
|
+
"test:update-snapshots": "NODE_ENV=test jest --updateSnapshot",
|
|
8
9
|
"prepare": "snyk-protect || snyk-protect -d || true",
|
|
9
10
|
"build": "npm run clean && dotcom-tool-kit build:local",
|
|
10
11
|
"start": "dotcom-tool-kit run:local",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"classnames": "2.3.2",
|
|
30
31
|
"fetchres": "1.7.2",
|
|
31
32
|
"lodash.get": "4.4.2",
|
|
32
|
-
"n-common-static-data": "github:Financial-Times/n-common-static-data#v2.
|
|
33
|
+
"n-common-static-data": "github:Financial-Times/n-common-static-data#v2.4.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@babel/core": "^7.22.15",
|
|
@@ -40,11 +41,10 @@
|
|
|
40
41
|
"@dotcom-tool-kit/component": "^4.0.4",
|
|
41
42
|
"@dotcom-tool-kit/eslint": "^3.1.3",
|
|
42
43
|
"@dotcom-tool-kit/frontend-app": "^3.1.9",
|
|
43
|
-
"@dotcom-tool-kit/husky-npm": "^4.1.0",
|
|
44
44
|
"@dotcom-tool-kit/jest": "^3.2.0",
|
|
45
|
-
"@dotcom-tool-kit/lint-staged": "^
|
|
45
|
+
"@dotcom-tool-kit/lint-staged-npm": "^3.1.6",
|
|
46
46
|
"@dotcom-tool-kit/logger": "^3.1.1",
|
|
47
|
-
"@dotcom-tool-kit/prettier": "^3.1.
|
|
47
|
+
"@dotcom-tool-kit/prettier": "^3.1.6",
|
|
48
48
|
"@financial-times/eslint-config-next": "^6.0.0",
|
|
49
49
|
"@financial-times/jest-browser-resolver": "^1.0.2",
|
|
50
50
|
"@snyk/protect": "1.1193.0",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"enzyme": "^3.11.0",
|
|
59
59
|
"enzyme-adapter-react-16": "^1.15.7",
|
|
60
60
|
"eslint": "^8.28.0",
|
|
61
|
-
"eslint-config-prettier": "^
|
|
62
|
-
"eslint-plugin-jest": "^27.
|
|
63
|
-
"eslint-plugin-prettier": "^
|
|
64
|
-
"eslint-plugin-react": "^7.
|
|
61
|
+
"eslint-config-prettier": "^9.1.0",
|
|
62
|
+
"eslint-plugin-jest": "^27.6.1",
|
|
63
|
+
"eslint-plugin-prettier": "^5.1.2",
|
|
64
|
+
"eslint-plugin-react": "^7.33.2",
|
|
65
65
|
"eslint-plugin-storybook": "^0.6.13",
|
|
66
66
|
"fetch-mock": "^7.2.0",
|
|
67
67
|
"html-webpack-plugin": "^5.5.3",
|
|
@@ -72,8 +72,6 @@
|
|
|
72
72
|
"jsdom-global": "^3.0.2",
|
|
73
73
|
"lint-staged": "^13.0.4",
|
|
74
74
|
"pa11y-ci": "2.4.2",
|
|
75
|
-
"prettier": "^2.4.1",
|
|
76
|
-
"pretty-quick": "^3.1.3",
|
|
77
75
|
"prop-types": "15.7.2",
|
|
78
76
|
"react": "16.14.0",
|
|
79
77
|
"react-dom": "16.14.0",
|
|
@@ -89,13 +87,13 @@
|
|
|
89
87
|
"npm": "7.x || 8.x || 9.x"
|
|
90
88
|
},
|
|
91
89
|
"lint-staged": {
|
|
92
|
-
"**/*.{js,jsx,json,scss}": "
|
|
93
|
-
"**/*.{js,jsx}": "eslint --fix"
|
|
90
|
+
"**/*.{js,jsx,json,scss}": "dotcom-tool-kit format:staged test:staged --"
|
|
94
91
|
},
|
|
95
92
|
"husky": {
|
|
96
93
|
"hooks": {
|
|
97
94
|
"commit-msg": "dotcom-tool-kit git:commitmsg",
|
|
98
|
-
"pre-commit": "
|
|
95
|
+
"pre-commit": "dotcom-tool-kit git:precommit",
|
|
96
|
+
"pre-push": "dotcom-tool-kit test:local"
|
|
99
97
|
}
|
|
100
98
|
},
|
|
101
99
|
"peerDependencies": {
|