@financial-times/n-conversion-forms 41.0.0 → 41.0.2
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/.github/dependabot.yml +58 -0
- package/.toolkitstate/ci.json +3 -3
- package/.toolkitstate/install.json +1 -1
- package/CODEOWNERS +4 -1
- package/README.md +0 -1
- package/components/__snapshots__/debug.spec.js.snap +2 -2
- package/components/__snapshots__/graduation-date.spec.js.snap +3 -3
- package/components/region-selector.jsx +2 -2
- package/dist/region-selector.jsx +6 -6
- package/helpers/supportedCountries.js +13 -1
- package/helpers/supportedPostcodeExamples.js +14 -1
- package/helpers/supportedPostcodeValidators.js +14 -1
- package/package.json +1 -3
- package/utils/region-config-by-country.js +25 -0
- package/utils/region-selector.js +4 -26
- package/.snyk +0 -4
- package/renovate.json +0 -5
|
@@ -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"
|
package/.toolkitstate/ci.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
".toolkitrc.yml": "XiiIocllEaT8xqKRCTpTbJ+yUyduDo5aEHARUQ3vJFfSe187Ci13PEs3bWL272GFJyNz2QgRQhdov2/+LFRKuw==",
|
|
3
|
-
"package.json": "
|
|
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/
|
|
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
|
[](https://circleci.com/gh/Financial-Times/n-conversion-forms)
|
|
6
|
-
[](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',
|
|
@@ -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>
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import regionConfigByCountry from '../utils/region-config-by-country';
|
|
6
6
|
|
|
7
7
|
export function RegionSelector({
|
|
8
8
|
country = 'USA',
|
|
@@ -20,7 +20,7 @@ export function RegionSelector({
|
|
|
20
20
|
regions = [],
|
|
21
21
|
defaultRegionType,
|
|
22
22
|
label: defaultLabel,
|
|
23
|
-
} =
|
|
23
|
+
} = regionConfigByCountry[country];
|
|
24
24
|
|
|
25
25
|
const dynamicRegionType = regionType || defaultRegionType;
|
|
26
26
|
const dynamicLabel = isBillingSelector
|
package/dist/region-selector.jsx
CHANGED
|
@@ -8,7 +8,7 @@ exports.RegionSelector = RegionSelector;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var
|
|
11
|
+
var _regionConfigByCountry = _interopRequireDefault(require("../utils/region-config-by-country"));
|
|
12
12
|
function RegionSelector(_ref) {
|
|
13
13
|
var _ref$country = _ref.country,
|
|
14
14
|
country = _ref$country === void 0 ? 'USA' : _ref$country,
|
|
@@ -25,11 +25,11 @@ function RegionSelector(_ref) {
|
|
|
25
25
|
regionType = _ref.regionType,
|
|
26
26
|
selectId = _ref.selectId,
|
|
27
27
|
value = _ref.value;
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
regions =
|
|
31
|
-
defaultRegionType =
|
|
32
|
-
defaultLabel =
|
|
28
|
+
var _regionConfigByCountr = _regionConfigByCountry["default"][country],
|
|
29
|
+
_regionConfigByCountr2 = _regionConfigByCountr.regions,
|
|
30
|
+
regions = _regionConfigByCountr2 === void 0 ? [] : _regionConfigByCountr2,
|
|
31
|
+
defaultRegionType = _regionConfigByCountr.defaultRegionType,
|
|
32
|
+
defaultLabel = _regionConfigByCountr.label;
|
|
33
33
|
var dynamicRegionType = regionType || defaultRegionType;
|
|
34
34
|
var dynamicLabel = isBillingSelector ? "Billing ".concat(label || defaultLabel) : label || defaultLabel;
|
|
35
35
|
var dynamicFieldId = fieldId || "".concat(dynamicRegionType, "Field");
|
|
@@ -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: {
|
|
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: {
|
|
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.
|
|
3
|
+
"version": "41.0.2",
|
|
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",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const {
|
|
2
|
+
americanStates,
|
|
3
|
+
canadianProvinces,
|
|
4
|
+
indianStatesAndUnionTerritories,
|
|
5
|
+
} = require('n-common-static-data');
|
|
6
|
+
|
|
7
|
+
const regionConfigByCountry = {
|
|
8
|
+
USA: {
|
|
9
|
+
regions: americanStates.states,
|
|
10
|
+
defaultRegionType: 'state',
|
|
11
|
+
label: 'State',
|
|
12
|
+
},
|
|
13
|
+
CAN: {
|
|
14
|
+
regions: canadianProvinces.provinces,
|
|
15
|
+
defaultRegionType: 'province',
|
|
16
|
+
label: 'Province',
|
|
17
|
+
},
|
|
18
|
+
IND: {
|
|
19
|
+
regions: indianStatesAndUnionTerritories.states,
|
|
20
|
+
defaultRegionType: 'state',
|
|
21
|
+
label: 'State/Union Territory',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
module.exports = regionConfigByCountry;
|
package/utils/region-selector.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
canadianProvinces,
|
|
4
|
-
indianStatesAndUnionTerritories,
|
|
5
|
-
} from 'n-common-static-data';
|
|
6
|
-
import FormElement from './form-element';
|
|
7
|
-
|
|
8
|
-
export const configByCountry = {
|
|
9
|
-
USA: {
|
|
10
|
-
regions: americanStates.states,
|
|
11
|
-
defaultRegionType: 'state',
|
|
12
|
-
label: 'State',
|
|
13
|
-
},
|
|
14
|
-
CAN: {
|
|
15
|
-
regions: canadianProvinces.provinces,
|
|
16
|
-
defaultRegionType: 'province',
|
|
17
|
-
label: 'Province',
|
|
18
|
-
},
|
|
19
|
-
IND: {
|
|
20
|
-
regions: indianStatesAndUnionTerritories.states,
|
|
21
|
-
defaultRegionType: 'state',
|
|
22
|
-
label: 'State/Union Territory',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
1
|
+
const FormElement = require('./form-element');
|
|
2
|
+
const regionConfigByCountry = require('./region-config-by-country');
|
|
25
3
|
|
|
26
4
|
/**
|
|
27
5
|
* Class representing a region selector form element.
|
|
@@ -41,7 +19,7 @@ class RegionSelector extends FormElement {
|
|
|
41
19
|
*/
|
|
42
20
|
constructor(document, { country = 'USA', regionType, fieldId } = {}) {
|
|
43
21
|
const defaultRegionType =
|
|
44
|
-
regionType ||
|
|
22
|
+
regionType || regionConfigByCountry[country].defaultRegionType;
|
|
45
23
|
|
|
46
24
|
const selector = fieldId
|
|
47
25
|
? `.ncf #${fieldId}`
|
|
@@ -51,4 +29,4 @@ class RegionSelector extends FormElement {
|
|
|
51
29
|
}
|
|
52
30
|
}
|
|
53
31
|
|
|
54
|
-
|
|
32
|
+
module.exports = RegionSelector;
|
package/.snyk
DELETED