@financial-times/n-conversion-forms 27.0.2 → 27.0.5
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/components/__snapshots__/licence-header.spec.js.snap +1 -1
- package/components/__snapshots__/licence-title.spec.js.snap +1 -1
- package/components/__snapshots__/registration-confirmation.spec.js.snap +2 -2
- package/components/licence-title.jsx +1 -4
- package/components/registration-confirmation.jsx +1 -1
- package/dist/licence-title.js +1 -1
- package/dist/registration-confirmation.js +1 -1
- package/helpers/supportedPostcodeExamples.js +7 -7
- package/helpers/supportedPostcodeValidators.js +37 -37
- package/helpers/supportedPostcodeValidators.spec.js +26 -0
- package/package.json +1 -1
|
@@ -120,7 +120,7 @@ exports[`RegistrationConfirmation renders with a custom email 1`] = `
|
|
|
120
120
|
class="ncf__confirmation--finish ncf__button ncf__button--submit"
|
|
121
121
|
data-trackable="register-finish"
|
|
122
122
|
>
|
|
123
|
-
|
|
123
|
+
Start reading
|
|
124
124
|
</a>
|
|
125
125
|
</div>
|
|
126
126
|
`;
|
|
@@ -245,7 +245,7 @@ exports[`RegistrationConfirmation renders with default props 1`] = `
|
|
|
245
245
|
class="ncf__confirmation--finish ncf__button ncf__button--submit"
|
|
246
246
|
data-trackable="register-finish"
|
|
247
247
|
>
|
|
248
|
-
|
|
248
|
+
Start reading
|
|
249
249
|
</a>
|
|
250
250
|
</div>
|
|
251
251
|
`;
|
|
@@ -9,10 +9,7 @@ export function LicenceTitle ({
|
|
|
9
9
|
if (isB2cPartnershipLicence || isTrial) {
|
|
10
10
|
return (
|
|
11
11
|
<h1 className="ncf__header ncf__center">
|
|
12
|
-
{displayName
|
|
13
|
-
{isB2cPartnershipLicence
|
|
14
|
-
? 'Welcome to the Financial Times'
|
|
15
|
-
: 'Start your free trial'}
|
|
12
|
+
{displayName || 'Welcome to the Financial Times'}
|
|
16
13
|
</h1>
|
|
17
14
|
);
|
|
18
15
|
}
|
package/dist/licence-title.js
CHANGED
|
@@ -22,7 +22,7 @@ function LicenceTitle(_ref) {
|
|
|
22
22
|
if (isB2cPartnershipLicence || isTrial) {
|
|
23
23
|
return /*#__PURE__*/_react["default"].createElement("h1", {
|
|
24
24
|
className: "ncf__header ncf__center"
|
|
25
|
-
}, displayName
|
|
25
|
+
}, displayName || 'Welcome to the Financial Times');
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
{
|
|
@@ -106,7 +106,7 @@ function RegistrationConfirmation(_ref) {
|
|
|
106
106
|
target: "_parent",
|
|
107
107
|
className: "ncf__confirmation--finish ncf__button ncf__button--submit",
|
|
108
108
|
"data-trackable": "register-finish"
|
|
109
|
-
}, "
|
|
109
|
+
}, "Start reading"));
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
RegistrationConfirmation.propTypes = {
|
|
@@ -2,27 +2,27 @@ const { flattenObj } = require('./utilities');
|
|
|
2
2
|
|
|
3
3
|
const supportedPostcodeExamples = {
|
|
4
4
|
cemeaV1: {
|
|
5
|
-
AUT: '
|
|
5
|
+
AUT: '1708',
|
|
6
6
|
ARE: '', //match anything
|
|
7
7
|
BEL: '6596',
|
|
8
8
|
BGR: '4000',
|
|
9
9
|
HRV: '10000',
|
|
10
|
-
CZE: '00
|
|
10
|
+
CZE: '122 00',
|
|
11
11
|
DNK: '1819',
|
|
12
12
|
FIN: '39500',
|
|
13
13
|
DEU: '17087',
|
|
14
14
|
GRC: '241 00',
|
|
15
15
|
HUN: '3821',
|
|
16
|
-
ISL: '
|
|
16
|
+
ISL: '149',
|
|
17
17
|
ITA: '23844',
|
|
18
|
-
LIE: '
|
|
18
|
+
LIE: '9485',
|
|
19
19
|
LTU: 'LT-12345',
|
|
20
20
|
NLD: '6971 HJ',
|
|
21
21
|
NOR: '1608',
|
|
22
22
|
POL: '43-190',
|
|
23
23
|
PRT: '2525-517',
|
|
24
24
|
QAT: '',//match anything
|
|
25
|
-
ROU: '
|
|
25
|
+
ROU: '712341',
|
|
26
26
|
RUS: '191028',
|
|
27
27
|
SVK: '98401',
|
|
28
28
|
SVN: '8263',
|
|
@@ -41,7 +41,7 @@ const supportedPostcodeExamples = {
|
|
|
41
41
|
KOR: '46500',
|
|
42
42
|
MYS: '59100',
|
|
43
43
|
PHL: '2799',
|
|
44
|
-
SGP: '
|
|
44
|
+
SGP: '584163',
|
|
45
45
|
TWN: '100',
|
|
46
46
|
THA: '10330'
|
|
47
47
|
},
|
|
@@ -54,4 +54,4 @@ const supportedPostcodeExamples = {
|
|
|
54
54
|
|
|
55
55
|
const allSupportedPostcodeExamples = flattenObj(supportedPostcodeExamples);
|
|
56
56
|
|
|
57
|
-
module.exports = { allSupportedPostcodeExamples };
|
|
57
|
+
module.exports = { allSupportedPostcodeExamples, supportedPostcodeExamples };
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
const supportedPostcodeValidators = {
|
|
2
2
|
cemeaV1: {
|
|
3
|
-
AUT:
|
|
3
|
+
AUT: /^\d{4}$/,
|
|
4
4
|
ARE: /.*$/, //match anything
|
|
5
|
-
BEL:
|
|
6
|
-
BGR:
|
|
7
|
-
HRV:
|
|
8
|
-
CZE:
|
|
9
|
-
DNK:
|
|
10
|
-
FIN:
|
|
11
|
-
DEU:
|
|
12
|
-
GRC:
|
|
13
|
-
HUN:
|
|
14
|
-
ISL:
|
|
15
|
-
ITA:
|
|
16
|
-
LIE:
|
|
17
|
-
LTU: /^[Ll][Tt][- ]{0,1}
|
|
18
|
-
NLD:
|
|
19
|
-
NOR:
|
|
20
|
-
POL:
|
|
21
|
-
PRT:
|
|
5
|
+
BEL: /^\d{4}$/,
|
|
6
|
+
BGR: /^\d{4}$/,
|
|
7
|
+
HRV: /^\d{5}$/,
|
|
8
|
+
CZE: /^\d{3}[ ]?\d{2}$/,
|
|
9
|
+
DNK: /^\d{4}$/,
|
|
10
|
+
FIN: /^\d{5}$/,
|
|
11
|
+
DEU: /^\d{5}$/,
|
|
12
|
+
GRC: /^\d{3}[ ]?\d{2}$/,
|
|
13
|
+
HUN: /^\d{4}$/,
|
|
14
|
+
ISL: /^\d{3}$/,
|
|
15
|
+
ITA: /^\d{5}$/,
|
|
16
|
+
LIE: /^(948[5-9])|(949[0-7])$/,
|
|
17
|
+
LTU: /^[Ll][Tt][- ]{0,1}\d{5}$/,
|
|
18
|
+
NLD: /\d{4}\s{0,1}[A-Za-z]{2}$/,
|
|
19
|
+
NOR: /^\d{4}$/,
|
|
20
|
+
POL: /^\d{2}-\d{3}$/,
|
|
21
|
+
PRT: /^\d{4}([\-]\d{3})?$/,
|
|
22
22
|
QAT: /.*$/,//match anything
|
|
23
|
-
ROU:
|
|
24
|
-
RUS:
|
|
25
|
-
SVK:
|
|
26
|
-
SVN:
|
|
27
|
-
ZAF:
|
|
28
|
-
ESP:
|
|
29
|
-
SWE:
|
|
30
|
-
CHE:
|
|
23
|
+
ROU: /^\d{6}$/,
|
|
24
|
+
RUS: /^\d{6}$/,
|
|
25
|
+
SVK: /^\d{3}[ ]?\d{2}$/,
|
|
26
|
+
SVN: /^\d{4}$/,
|
|
27
|
+
ZAF: /^\d{4}$/,
|
|
28
|
+
ESP: /^\d{5}$/,
|
|
29
|
+
SWE: /^\d{3}[ ]?\d{2}$/,
|
|
30
|
+
CHE: /^\d{4}$/
|
|
31
31
|
},
|
|
32
|
-
cemeaV2: { FRA: /^[0-9]{5}$/, LUX:
|
|
32
|
+
cemeaV2: { FRA: /^[0-9]{5}$/, LUX: /^\d{4}$/, MCO: /^980\d{2}$/ },
|
|
33
33
|
apac: {
|
|
34
|
-
CHN:
|
|
34
|
+
CHN: /^\d{6}$/,
|
|
35
35
|
HKG: /.*$/, //match anything
|
|
36
|
-
IND:
|
|
37
|
-
IDN:
|
|
38
|
-
JPN:
|
|
39
|
-
KOR:
|
|
40
|
-
MYS:
|
|
41
|
-
PHL:
|
|
42
|
-
SGP:
|
|
43
|
-
TWN:
|
|
44
|
-
THA:
|
|
36
|
+
IND: /^\d{6}$/,
|
|
37
|
+
IDN: /^\d{5}$/,
|
|
38
|
+
JPN: /^\d{3}-\d{4}$/,
|
|
39
|
+
KOR: /^\d{5}$/,
|
|
40
|
+
MYS: /^\d{5}$/,
|
|
41
|
+
PHL: /^\d{4}$/,
|
|
42
|
+
SGP: /^\d{6}$/,
|
|
43
|
+
TWN: /^\d{3}(\d{2})?$/,
|
|
44
|
+
THA: /^\d{5}$/
|
|
45
45
|
},
|
|
46
46
|
other: {
|
|
47
47
|
GBR: /^[A-Za-z]{1,2}[0-9][0-9A-Za-z]?[\s-]?[0-9][A-Za-z]{2}$/,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { supportedPostcodeValidators } = require('./supportedPostcodeValidators');
|
|
2
|
+
const { supportedPostcodeExamples } = require('./supportedPostcodeExamples');
|
|
3
|
+
|
|
4
|
+
describe('supportedPostcodeValidators', () => {
|
|
5
|
+
it('should validate every cemeaV1 supportedPostcodeExamples', () => {
|
|
6
|
+
const cemeaV1PostcodeCountryCodes = Object.keys(supportedPostcodeExamples.cemeaV1);
|
|
7
|
+
|
|
8
|
+
for ( const cemeaV1PostcodeCountryCode of cemeaV1PostcodeCountryCodes ) {
|
|
9
|
+
expect(supportedPostcodeValidators.cemeaV1[cemeaV1PostcodeCountryCode].test(supportedPostcodeExamples.cemeaV1[cemeaV1PostcodeCountryCode])).toBe(true);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
it('should validate every cemeaV2 supportedPostcodeExamples', () => {
|
|
13
|
+
const cemeaV2PostcodeCountryCodes = Object.keys(supportedPostcodeExamples.cemeaV2);
|
|
14
|
+
|
|
15
|
+
for ( const cemeaV2PostcodeCountryCode of cemeaV2PostcodeCountryCodes ) {
|
|
16
|
+
expect(supportedPostcodeValidators.cemeaV2[cemeaV2PostcodeCountryCode].test(supportedPostcodeExamples.cemeaV2[cemeaV2PostcodeCountryCode])).toBe(true);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
it('should validate every apac supportedPostcodeExamples', () => {
|
|
20
|
+
const apacPostcodeCountryCodes = Object.keys(supportedPostcodeExamples.apac);
|
|
21
|
+
|
|
22
|
+
for ( const apacPostcodeCountryCode of apacPostcodeCountryCodes ) {
|
|
23
|
+
expect(supportedPostcodeValidators.apac[apacPostcodeCountryCode].test(supportedPostcodeExamples.apac[apacPostcodeCountryCode])).toBe(true);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "27.0.
|
|
3
|
+
"version": "27.0.5",
|
|
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": {
|