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

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "2cb838a4fc4d3fd5c1911d80503a2d927ec71a27",
5
- "tag": "v41.0.0",
6
- "buildNumber": "15084"
4
+ "version": "e74df51419f7232676af208155df4e968900c0e5",
5
+ "tag": "v41.0.1",
6
+ "buildNumber": "15124"
7
7
  }
@@ -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 { configByCountry } from '../utils/region-selector';
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
- } = configByCountry[country];
23
+ } = regionConfigByCountry[country];
24
24
 
25
25
  const dynamicRegionType = regionType || defaultRegionType;
26
26
  const dynamicLabel = isBillingSelector
@@ -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 _regionSelector = require("../utils/region-selector");
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 _configByCountry$coun = _regionSelector.configByCountry[country],
29
- _configByCountry$coun2 = _configByCountry$coun.regions,
30
- regions = _configByCountry$coun2 === void 0 ? [] : _configByCountry$coun2,
31
- defaultRegionType = _configByCountry$coun.defaultRegionType,
32
- defaultLabel = _configByCountry$coun.label;
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");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "41.0.0",
3
+ "version": "41.0.1",
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": {
@@ -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;
@@ -1,27 +1,5 @@
1
- import {
2
- americanStates,
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 || configByCountry[country].defaultRegionType;
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
- export default RegionSelector;
32
+ module.exports = RegionSelector;