@financial-times/n-conversion-forms 41.0.1 → 41.0.3

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.
@@ -0,0 +1,58 @@
1
+ version: 2
2
+ updates:
3
+
4
+ - package-ecosystem: "npm"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
8
+ commit-message:
9
+ prefix: "fix:"
10
+ prefix-development: "chore:"
11
+ groups:
12
+ aws-sdk:
13
+ patterns:
14
+ - "@aws-sdk/*"
15
+ update-types:
16
+ - "minor"
17
+ - "patch"
18
+ development-dependencies:
19
+ dependency-type: "development"
20
+ update-types:
21
+ - "minor"
22
+ - "patch"
23
+ origami:
24
+ patterns:
25
+ - "@financial-times/o-*"
26
+ update-types:
27
+ - "minor"
28
+ - "patch"
29
+ page-kit:
30
+ patterns:
31
+ - "@financial-times/dotcom-*"
32
+ update-types:
33
+ - "minor"
34
+ - "patch"
35
+ privacy:
36
+ patterns:
37
+ - "@financial-times/privacy-*"
38
+ update-types:
39
+ - "minor"
40
+ - "patch"
41
+ reliability-kit:
42
+ patterns:
43
+ - "@dotcom-reliability-kit/*"
44
+ update-types:
45
+ - "minor"
46
+ - "patch"
47
+ tool-kit:
48
+ patterns:
49
+ - "@dotcom-tool-kit/*"
50
+ update-types:
51
+ - "minor"
52
+ - "patch"
53
+ x-dash:
54
+ patterns:
55
+ - "@financial-times/x-*"
56
+ update-types:
57
+ - "minor"
58
+ - "patch"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "e74df51419f7232676af208155df4e968900c0e5",
5
- "tag": "v41.0.1",
6
- "buildNumber": "15124"
4
+ "version": "d3fb1dcfa88f17da11c266bef9e3fd7ffd08b46d",
5
+ "tag": "v41.0.3",
6
+ "buildNumber": "15547"
7
7
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  ".toolkitrc.yml": "XiiIocllEaT8xqKRCTpTbJ+yUyduDo5aEHARUQ3vJFfSe187Ci13PEs3bWL272GFJyNz2QgRQhdov2/+LFRKuw==",
3
- "package.json": "Q++D0RhTdwacN2+LL5eQZaV5Ck5QP637EEpW6f9Mu8Jk/PXaa11O1cCs+/TUvXxCrvDVSbepecfSkDoRv/oXzg==",
3
+ "package.json": "TF64fuZhcMaH62zTvMNGEnc1qyrhhepAFW2Fgay+PhKXmkAeMOVjBXeosKPhyN/+ITMHKLN1oNPtTUm6VLwp1w==",
4
4
  ".circleci/config.yml": "eph42EF3EsL7jvhiiC7D7vG3vGBAGBFVC+Ncmy4Dj4rUNzK8Rls0/cr+bEF/ttMN3J6iSL1xtCXKIJVrtZ4OSQ=="
5
5
  }
package/CODEOWNERS CHANGED
@@ -1,3 +1,6 @@
1
1
  # See https://help.github.com/articles/about-codeowners/ for more information about this file.
2
2
 
3
- * @financial-times/acquisition
3
+ * @financial-times/cp-customer-lifecycle
4
+
5
+ # Allow Dependency Auto-Merger to approve dependency bump PRs
6
+ **/package*.json @ft-dependency-auto-merger @financial-times/cp-customer-lifecycle
package/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  Contains HTML and CSS that's used within the conversion forms
4
4
 
5
5
  [![CircleCI](https://circleci.com/gh/Financial-Times/n-conversion-forms.svg?style=svg)](https://circleci.com/gh/Financial-Times/n-conversion-forms)
6
- [![Known Vulnerabilities](https://snyk.io/test/github/Financial-Times/n-conversion-forms/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Financial-Times/n-conversion-forms?targetFile=package.json)
7
6
 
8
7
  ```bash
9
8
  npm install # install all dependencies
@@ -26,7 +26,7 @@ exports[`Debug renders with isTest 1`] = `
26
26
  var SYSTEM_CODE = document.documentElement.getAttribute('data-next-app') || 'n-conversion-forms';
27
27
  var COUNTRY_CODE = window.FT && window.FT.country || 'GBR';
28
28
 
29
- var postcodeByCountry = {"AUT":"1708","ARE":"","BEL":"6596","BGR":"4000","HRV":"10000","CZE":"122 00","DNK":"1819","FIN":"39500","DEU":"17087","GRC":"241 00","HUN":"3821","ISL":"149","ITA":"23844","LIE":"9485","LTU":"LT-12345","NLD":"6971 HJ","NOR":"1608","POL":"43-190","PRT":"2525-517","QAT":"","ROU":"712341","RUS":"191028","SVK":"98401","SVN":"8263","ZAF":"5189","ESP":"37752","SWE":"260 38","CHE":"9424","FRA":"95000","LUX":"1009","MCO":"98000","CHN":"610000","HKG":"","IND":"401107","IDN":"55165","JPN":"100-0001","KOR":"46500","MYS":"59100","PHL":"2799","SGP":"584163","TWN":"100","THA":"10330","GBR":"EC4M 9BT","USA":"60411","CAN":"M5H 3E5"};
29
+ var postcodeByCountry = {"AUT":"1708","ARE":"","BEL":"6596","BGR":"4000","HRV":"10000","CZE":"122 00","DNK":"1819","EST":"10120","FIN":"39500","DEU":"17087","GRC":"241 00","HUN":"3821","ISL":"149","ISR":"1234567","ITA":"23844","LIE":"9485","LTU":"LT-12345","LVA":"LV-1010","MLT":"MST 2020","MNE":"81250","NLD":"6971 HJ","NOR":"1608","POL":"43-190","PRT":"2525-517","QAT":"","ROU":"712341","RUS":"191028","SVK":"98401","SVN":"8263","TTO":"500234","ZAF":"5189","ESP":"37752","SWE":"260 38","CHE":"9424","SRB":"11000","FRA":"95000","LUX":"1009","MCO":"98000","AUS":"2000","CHN":"610000","HKG":"","IND":"401107","IDN":"55165","JPN":"100-0001","KOR":"46500","MYS":"59100","NZL":"6011","PHL":"2799","SGP":"584163","TWN":"100","THA":"10330","GBR":"EC4M 9BT","USA":"60411","CAN":"M5H 3E5"};
30
30
 
31
31
  var debugData = {
32
32
  billingCity: 'London',
@@ -1472,7 +1472,7 @@ exports[`Debug renders with showHelpers 1`] = `
1472
1472
  var SYSTEM_CODE = document.documentElement.getAttribute('data-next-app') || 'n-conversion-forms';
1473
1473
  var COUNTRY_CODE = window.FT && window.FT.country || 'GBR';
1474
1474
 
1475
- var postcodeByCountry = {"AUT":"1708","ARE":"","BEL":"6596","BGR":"4000","HRV":"10000","CZE":"122 00","DNK":"1819","FIN":"39500","DEU":"17087","GRC":"241 00","HUN":"3821","ISL":"149","ITA":"23844","LIE":"9485","LTU":"LT-12345","NLD":"6971 HJ","NOR":"1608","POL":"43-190","PRT":"2525-517","QAT":"","ROU":"712341","RUS":"191028","SVK":"98401","SVN":"8263","ZAF":"5189","ESP":"37752","SWE":"260 38","CHE":"9424","FRA":"95000","LUX":"1009","MCO":"98000","CHN":"610000","HKG":"","IND":"401107","IDN":"55165","JPN":"100-0001","KOR":"46500","MYS":"59100","PHL":"2799","SGP":"584163","TWN":"100","THA":"10330","GBR":"EC4M 9BT","USA":"60411","CAN":"M5H 3E5"};
1475
+ var postcodeByCountry = {"AUT":"1708","ARE":"","BEL":"6596","BGR":"4000","HRV":"10000","CZE":"122 00","DNK":"1819","EST":"10120","FIN":"39500","DEU":"17087","GRC":"241 00","HUN":"3821","ISL":"149","ISR":"1234567","ITA":"23844","LIE":"9485","LTU":"LT-12345","LVA":"LV-1010","MLT":"MST 2020","MNE":"81250","NLD":"6971 HJ","NOR":"1608","POL":"43-190","PRT":"2525-517","QAT":"","ROU":"712341","RUS":"191028","SVK":"98401","SVN":"8263","TTO":"500234","ZAF":"5189","ESP":"37752","SWE":"260 38","CHE":"9424","SRB":"11000","FRA":"95000","LUX":"1009","MCO":"98000","AUS":"2000","CHN":"610000","HKG":"","IND":"401107","IDN":"55165","JPN":"100-0001","KOR":"46500","MYS":"59100","NZL":"6011","PHL":"2799","SGP":"584163","TWN":"100","THA":"10330","GBR":"EC4M 9BT","USA":"60411","CAN":"M5H 3E5"};
1476
1476
 
1477
1477
  var debugData = {
1478
1478
  billingCity: 'London',
@@ -232,6 +232,43 @@ exports[`Delivery Postcode renders a postcode input with default label 1`] = `
232
232
  </label>
233
233
  `;
234
234
 
235
+ exports[`Delivery Postcode renders an optional input 1`] = `
236
+ <label id="deliveryPostcodeField"
237
+ class="o-forms-field"
238
+ data-validate="required"
239
+ for="deliveryPostcode"
240
+ >
241
+ <span class="o-forms-title">
242
+ <span class="o-forms-title__main">
243
+ <span data-reference="postcode">
244
+ Postcode
245
+ </span>
246
+ </span>
247
+ <span class="o-forms-title__prompt">
248
+ </span>
249
+ </span>
250
+ <span class="o-forms-input o-forms-input--text">
251
+ <input type="text"
252
+ id="deliveryPostcode"
253
+ name="deliveryPostcode"
254
+ placeholder="Enter your Postcode"
255
+ autocomplete="postal-code"
256
+ data-trackable="delivery-postcode"
257
+ aria-required="false"
258
+ pattern="whatever"
259
+ value
260
+ >
261
+ <span class="o-forms-input__error">
262
+ Please enter a valid
263
+ <span data-reference="postcode">
264
+ Postcode
265
+ </span>
266
+ .
267
+ </span>
268
+ </span>
269
+ </label>
270
+ `;
271
+
235
272
  exports[`Delivery Postcode renders different styles 1`] = `
236
273
  <label id="deliveryPostcodeField"
237
274
  class="o-forms-field ncf__hidden"
@@ -71,9 +71,6 @@ exports[`GraduationDate renders with default props 1`] = `
71
71
  name="graduationDateYear"
72
72
  aria-required="false"
73
73
  >
74
- <option value="2020">
75
- 2020
76
- </option>
77
74
  <option value="2021">
78
75
  2021
79
76
  </option>
@@ -98,6 +95,9 @@ exports[`GraduationDate renders with default props 1`] = `
98
95
  <option value="2028">
99
96
  2028
100
97
  </option>
98
+ <option value="2029">
99
+ 2029
100
+ </option>
101
101
  </select>
102
102
  </span>
103
103
  </div>
@@ -49,6 +49,7 @@ export function DeliveryPostcode({
49
49
  pattern,
50
50
  additionalFieldInformation,
51
51
  changePostcodeUrl = '',
52
+ isRequired = true,
52
53
  }) {
53
54
  const postcodeReference = postcodeLabel[country.toUpperCase()] || 'Postcode';
54
55
  const promptReference = promptLabel[country.toUpperCase()];
@@ -98,8 +99,8 @@ export function DeliveryPostcode({
98
99
  placeholder={placeholderReference}
99
100
  autoComplete="postal-code"
100
101
  data-trackable="delivery-postcode"
101
- aria-required="true"
102
- required
102
+ aria-required={isRequired}
103
+ required={isRequired}
103
104
  pattern={pattern}
104
105
  disabled={isDisabled}
105
106
  />
@@ -73,6 +73,16 @@ describe('Delivery Postcode', () => {
73
73
  expect(DeliveryPostcode).toRenderCorrectly(props);
74
74
  });
75
75
 
76
+ it('renders an optional input', () => {
77
+ const props = {
78
+ postcodeReference: 'Postcode',
79
+ pattern: 'whatever',
80
+ isRequired: false,
81
+ };
82
+
83
+ expect(DeliveryPostcode).toRenderCorrectly(props);
84
+ });
85
+
76
86
  it('renders with link to change the value', () => {
77
87
  const props = {
78
88
  country: 'USA',
@@ -49,7 +49,9 @@ function DeliveryPostcode(_ref) {
49
49
  pattern = _ref.pattern,
50
50
  additionalFieldInformation = _ref.additionalFieldInformation,
51
51
  _ref$changePostcodeUr = _ref.changePostcodeUrl,
52
- changePostcodeUrl = _ref$changePostcodeUr === void 0 ? '' : _ref$changePostcodeUr;
52
+ changePostcodeUrl = _ref$changePostcodeUr === void 0 ? '' : _ref$changePostcodeUr,
53
+ _ref$isRequired = _ref.isRequired,
54
+ isRequired = _ref$isRequired === void 0 ? true : _ref$isRequired;
53
55
  var postcodeReference = postcodeLabel[country.toUpperCase()] || 'Postcode';
54
56
  var promptReference = promptLabel[country.toUpperCase()];
55
57
  var placeholderReference = placeholderLabel[country.toUpperCase()] || "Enter your ".concat(postcodeReference);
@@ -85,8 +87,8 @@ function DeliveryPostcode(_ref) {
85
87
  placeholder: placeholderReference,
86
88
  autoComplete: "postal-code",
87
89
  "data-trackable": "delivery-postcode",
88
- "aria-required": "true",
89
- required: true,
90
+ "aria-required": isRequired,
91
+ required: isRequired,
90
92
  pattern: pattern,
91
93
  disabled: isDisabled
92
94
  }), /*#__PURE__*/_react["default"].createElement("span", {
@@ -9,14 +9,19 @@ const countriesMasterList = {
9
9
  HRV: 'Croatia',
10
10
  CZE: 'Czechia',
11
11
  DNK: 'Denmark',
12
+ EST: 'Estonia',
12
13
  FIN: 'Finland',
13
14
  DEU: 'Germany',
14
15
  GRC: 'Greece',
15
16
  HUN: 'Hungary',
16
17
  ISL: 'Iceland',
18
+ ISR: 'Isarel',
17
19
  ITA: 'Italy',
18
20
  LIE: 'Liechtenstein',
19
21
  LTU: 'Lithuania',
22
+ LVA: 'Latvia',
23
+ MLT: 'Malta',
24
+ MNE: 'Montenegro',
20
25
  NLD: 'Netherlands',
21
26
  NOR: 'Norway',
22
27
  POL: 'Poland',
@@ -26,6 +31,7 @@ const countriesMasterList = {
26
31
  RUS: 'Russian Federation',
27
32
  SVK: 'Slovakia',
28
33
  SVN: 'Slovenia',
34
+ TTO: 'Trinidad and Tobago',
29
35
  ZAF: 'South Africa',
30
36
  ESP: 'Spain',
31
37
  SWE: 'Sweden',
@@ -33,8 +39,13 @@ const countriesMasterList = {
33
39
  SRB: 'Serbia',
34
40
  BIH: 'Bosnia and Herzegovina',
35
41
  },
36
- cemeaV2: { FRA: 'France', LUX: 'Luxembourg', MCO: 'Monaco' },
42
+ cemeaV2: {
43
+ FRA: 'France',
44
+ LUX: 'Luxembourg',
45
+ MCO: 'Monaco',
46
+ },
37
47
  apac: {
48
+ AUS: 'Australia',
38
49
  CHN: 'China',
39
50
  HKG: 'Hong Kong',
40
51
  IND: 'India',
@@ -42,6 +53,7 @@ const countriesMasterList = {
42
53
  JPN: 'Japan',
43
54
  KOR: 'Korea, Republic of',
44
55
  MYS: 'Malaysia',
56
+ NZL: 'New Zealand',
45
57
  PHL: 'Philippines',
46
58
  SGP: 'Singapore',
47
59
  TWN: 'Taiwan, Province of China',
@@ -9,14 +9,19 @@ const supportedPostcodeExamples = {
9
9
  HRV: '10000',
10
10
  CZE: '122 00',
11
11
  DNK: '1819',
12
+ EST: '10120',
12
13
  FIN: '39500',
13
14
  DEU: '17087',
14
15
  GRC: '241 00',
15
16
  HUN: '3821',
16
17
  ISL: '149',
18
+ ISR: '1234567',
17
19
  ITA: '23844',
18
20
  LIE: '9485',
19
21
  LTU: 'LT-12345',
22
+ LVA: 'LV-1010',
23
+ MLT: 'MST 2020',
24
+ MNE: '81250',
20
25
  NLD: '6971 HJ',
21
26
  NOR: '1608',
22
27
  POL: '43-190',
@@ -26,13 +31,20 @@ const supportedPostcodeExamples = {
26
31
  RUS: '191028',
27
32
  SVK: '98401',
28
33
  SVN: '8263',
34
+ TTO: '500234',
29
35
  ZAF: '5189',
30
36
  ESP: '37752',
31
37
  SWE: '260 38',
32
38
  CHE: '9424',
39
+ SRB: '11000',
40
+ },
41
+ cemeaV2: {
42
+ FRA: '95000',
43
+ LUX: '1009',
44
+ MCO: '98000',
33
45
  },
34
- cemeaV2: { FRA: '95000', LUX: '1009', MCO: '98000' },
35
46
  apac: {
47
+ AUS: '2000',
36
48
  CHN: '610000',
37
49
  HKG: '', //match anything
38
50
  IND: '401107',
@@ -40,6 +52,7 @@ const supportedPostcodeExamples = {
40
52
  JPN: '100-0001',
41
53
  KOR: '46500',
42
54
  MYS: '59100',
55
+ NZL: '6011',
43
56
  PHL: '2799',
44
57
  SGP: '584163',
45
58
  TWN: '100',
@@ -7,14 +7,19 @@ const supportedPostcodeValidators = {
7
7
  HRV: /^\d{5}$/,
8
8
  CZE: /^\d{3}[ ]?\d{2}$/,
9
9
  DNK: /^\d{4}$/,
10
+ EST: /^\d{5}$/,
10
11
  FIN: /^\d{5}$/,
11
12
  DEU: /^\d{5}$/,
12
13
  GRC: /^\d{3}[ ]?\d{2}$/,
13
14
  HUN: /^\d{4}$/,
14
15
  ISL: /^\d{3}$/,
16
+ ISR: /^\d{7}$/,
15
17
  ITA: /^\d{5}$/,
16
18
  LIE: /^(948[5-9])|(949[0-7])$/,
17
19
  LTU: /^[Ll][Tt][- ]{0,1}\d{5}$/,
20
+ LVA: /^LV-\d{4}$/,
21
+ MLT: /^[A-Za-z]{3}\s{0,1}\d{4}$/,
22
+ MNE: /^\d{5}$/,
18
23
  NLD: /\d{4}\s{0,1}[A-Za-z]{2}$/,
19
24
  NOR: /^\d{4}$/,
20
25
  POL: /^\d{2}-\d{3}$/,
@@ -22,15 +27,22 @@ const supportedPostcodeValidators = {
22
27
  QAT: /.*$/, //match anything
23
28
  ROU: /^\d{6}$/,
24
29
  RUS: /^\d{6}$/,
30
+ SRB: /^\d{5}$/,
25
31
  SVK: /^\d{3}[ ]?\d{2}$/,
26
32
  SVN: /^\d{4}$/,
33
+ TTO: /^\d{6}$/,
27
34
  ZAF: /^\d{4}$/,
28
35
  ESP: /^\d{5}$/,
29
36
  SWE: /^\d{3}[ ]?\d{2}$/,
30
37
  CHE: /^\d{4}$/,
31
38
  },
32
- cemeaV2: { FRA: /^[0-9]{5}$/, LUX: /^\d{4}$/, MCO: /^980\d{2}$/ },
39
+ cemeaV2: {
40
+ FRA: /^[0-9]{5}$/,
41
+ LUX: /^\d{4}$/,
42
+ MCO: /^980\d{2}$/,
43
+ },
33
44
  apac: {
45
+ AUS: /^\d{4}$/,
34
46
  CHN: /^\d{6}$/,
35
47
  HKG: /.*$/, //match anything
36
48
  IND: /^\d{6}$/,
@@ -38,6 +50,7 @@ const supportedPostcodeValidators = {
38
50
  JPN: /^\d{3}-\d{4}$/,
39
51
  KOR: /^\d{5}$/,
40
52
  MYS: /^\d{5}$/,
53
+ NZL: /^\d{4}$/,
41
54
  PHL: /^\d{4}$/,
42
55
  SGP: /^\d{6}$/,
43
56
  TWN: /^\d{3}(\d{2})?$/,
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "41.0.1",
3
+ "version": "41.0.3",
4
4
  "description": "Containing jsx components and styles for forms included on Accounts and Acquisition 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
8
  "test:update-snapshots": "NODE_ENV=test jest --updateSnapshot",
9
- "prepare": "snyk-protect || snyk-protect -d || true",
10
9
  "build": "npm run clean && dotcom-tool-kit build:local",
11
10
  "start": "dotcom-tool-kit run:local",
12
11
  "storybook": "storybook dev -p 5005",
@@ -46,7 +45,6 @@
46
45
  "@dotcom-tool-kit/prettier": "^4.0.2",
47
46
  "@financial-times/eslint-config-next": "7.1.0",
48
47
  "@financial-times/jest-browser-resolver": "^1.0.2",
49
- "@snyk/protect": "1.1278.0",
50
48
  "@storybook/addon-a11y": "^7.6.13",
51
49
  "@storybook/addon-essentials": "7.6.13",
52
50
  "@storybook/react": "^7.6.13",
package/.snyk DELETED
@@ -1,4 +0,0 @@
1
- # Snyk (https://snyk.io) policy file, which patches or ignores known vulnerabilities.
2
- version: v1.13.5
3
- ignore: {}
4
- patch: {}
package/renovate.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "github>financial-times/renovate-config-next"
4
- ]
5
- }