@financial-times/n-conversion-forms 27.7.1 → 28.0.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.
Files changed (119) hide show
  1. package/.eslintignore +1 -0
  2. package/build-state/npm-shrinkwrap.json +1808 -1324
  3. package/components/__snapshots__/payment-type.spec.js.snap +0 -2
  4. package/components/accept-terms.jsx +18 -16
  5. package/components/app-banner.jsx +1 -1
  6. package/components/b2c-partnership-confirmation.jsx +1 -1
  7. package/components/billing-city.jsx +1 -1
  8. package/components/billing-country.jsx +1 -1
  9. package/components/billing-postcode.jsx +1 -1
  10. package/components/company-name.jsx +1 -1
  11. package/components/confirmation.jsx +5 -4
  12. package/components/continue-reading.jsx +1 -1
  13. package/components/continue-reading.stories.js +1 -1
  14. package/components/country.jsx +1 -1
  15. package/components/customer-care.jsx +1 -1
  16. package/components/debug.jsx +1 -1
  17. package/components/decision-maker.jsx +1 -1
  18. package/components/decision-maker.spec.js +1 -1
  19. package/components/deferred-billing-terms.jsx +92 -76
  20. package/components/deferred-billing-terms.spec.js +5 -1
  21. package/components/deferred-billing-terms.stories.js +3 -3
  22. package/components/delivery-address-type.jsx +4 -4
  23. package/components/delivery-address.jsx +1 -1
  24. package/components/delivery-city.jsx +9 -5
  25. package/components/delivery-county.jsx +1 -1
  26. package/components/delivery-instructions.jsx +30 -21
  27. package/components/delivery-option.jsx +5 -2
  28. package/components/delivery-po-box.jsx +1 -1
  29. package/components/delivery-postcode.jsx +32 -28
  30. package/components/delivery-security-instructions.jsx +1 -1
  31. package/components/delivery-start-date.jsx +1 -1
  32. package/components/education-job-title.jsx +1 -1
  33. package/components/email.jsx +1 -1
  34. package/components/error-page.jsx +1 -1
  35. package/components/fieldset.jsx +1 -1
  36. package/components/first-name.jsx +1 -1
  37. package/components/form.jsx +1 -1
  38. package/components/google-sign-in.jsx +1 -1
  39. package/components/graduation-date.jsx +1 -1
  40. package/components/industry.jsx +1 -1
  41. package/components/job-title.jsx +1 -1
  42. package/components/last-name.jsx +1 -1
  43. package/components/licence-confirmation.jsx +10 -8
  44. package/components/licence-header.jsx +3 -3
  45. package/components/licence-sign-in.jsx +2 -2
  46. package/components/licence-title.jsx +2 -2
  47. package/components/lite-sub-confirmation.jsx +1 -1
  48. package/components/loader.jsx +1 -1
  49. package/components/message.jsx +1 -1
  50. package/components/organisation.jsx +1 -1
  51. package/components/package-change.jsx +1 -1
  52. package/components/password.jsx +1 -1
  53. package/components/payment-term.jsx +52 -43
  54. package/components/payment-term.spec.js +15 -9
  55. package/components/payment-term.stories.js +63 -63
  56. package/components/payment-type.jsx +4 -4
  57. package/components/personal-title.jsx +1 -1
  58. package/components/phone.jsx +1 -1
  59. package/components/position.jsx +1 -1
  60. package/components/progress-indicator.jsx +3 -3
  61. package/components/province.jsx +1 -1
  62. package/components/registration-confirmation.jsx +1 -1
  63. package/components/responsibility.jsx +1 -1
  64. package/components/section.jsx +1 -1
  65. package/components/state.jsx +1 -1
  66. package/components/submit.jsx +1 -1
  67. package/components/text-input.jsx +1 -1
  68. package/components/trial-banner.jsx +1 -1
  69. package/dist/deferred-billing-terms.js +2 -3
  70. package/dist/payment-term.js +1 -1
  71. package/dist/payment-type.js +2 -2
  72. package/helpers/index.js +11 -8
  73. package/helpers/ncf-countries.spec.js +1 -1
  74. package/helpers/supportedCountries.js +12 -5
  75. package/helpers/supportedPostcodeExamples.js +5 -5
  76. package/helpers/supportedPostcodeValidators.js +5 -5
  77. package/helpers/supportedPostcodeValidators.spec.js +30 -10
  78. package/helpers/utilities.js +4 -4
  79. package/jest.config.js +1 -5
  80. package/package.json +14 -17
  81. package/styles/message.scss +0 -16
  82. package/test-jest/helpers/expect-to-render-correctly.js +1 -1
  83. package/utils/app-banner.js +1 -1
  84. package/utils/apple-pay.js +15 -15
  85. package/utils/billing-city.js +1 -1
  86. package/utils/billing-country.js +3 -3
  87. package/utils/billing-postcode.js +1 -1
  88. package/utils/company-name.js +1 -1
  89. package/utils/countries.js +2 -2
  90. package/utils/country.js +3 -3
  91. package/utils/delivery-address-type.js +3 -3
  92. package/utils/delivery-address-type.spec.js +6 -2
  93. package/utils/delivery-address.js +1 -1
  94. package/utils/delivery-instructions.js +1 -1
  95. package/utils/delivery-option-messages.js +11 -11
  96. package/utils/delivery-option-messages.spec.js +4 -13
  97. package/utils/delivery-option.js +5 -5
  98. package/utils/delivery-po-box.js +1 -1
  99. package/utils/delivery-postcode.js +1 -1
  100. package/utils/delivery-start-date.js +4 -4
  101. package/utils/delivery-start-date.spec.js +3 -2
  102. package/utils/email.js +4 -4
  103. package/utils/email.spec.js +2 -1
  104. package/utils/event-notifier.js +1 -1
  105. package/utils/form-element.js +8 -8
  106. package/utils/loader.js +10 -10
  107. package/utils/password.js +2 -2
  108. package/utils/payment-term.js +16 -15
  109. package/utils/payment-type.js +14 -14
  110. package/utils/postcode.js +3 -3
  111. package/utils/postcode.spec.js +21 -12
  112. package/utils/province.js +1 -1
  113. package/utils/salesforce.js +2 -2
  114. package/utils/state.js +1 -1
  115. package/utils/submit.js +5 -5
  116. package/utils/tracking.js +7 -7
  117. package/utils/validation.js +18 -11
  118. package/utils/zuora-error-map.js +5 -5
  119. package/utils/zuora.js +17 -12
@@ -29,7 +29,7 @@ const supportedCountriesMasterList = {
29
29
  ZAF: 'South Africa',
30
30
  ESP: 'Spain',
31
31
  SWE: 'Sweden',
32
- CHE: 'Switzerland'
32
+ CHE: 'Switzerland',
33
33
  },
34
34
  cemeaV2: { FRA: 'France', LUX: 'Luxembourg', MCO: 'Monaco' },
35
35
  apac: {
@@ -43,14 +43,14 @@ const supportedCountriesMasterList = {
43
43
  PHL: 'Philippines',
44
44
  SGP: 'Singapore',
45
45
  TWN: 'Taiwan, Province of China',
46
- THA: 'Thailand'
46
+ THA: 'Thailand',
47
47
  },
48
48
  other: {
49
49
  GBR: 'United Kingdom',
50
50
  USA: 'United States',
51
51
  CAN: 'Canada',
52
- ARE: 'United Arab Emirates'
53
- }
52
+ ARE: 'United Arab Emirates',
53
+ },
54
54
  };
55
55
 
56
56
  const cemeaV1ISO = Object.keys(supportedCountriesMasterList.cemeaV1);
@@ -73,4 +73,11 @@ const identifyFTShippingZone = (country) => {
73
73
  return country;
74
74
  };
75
75
 
76
- module.exports = { cemeaV1ISO, cemeaV2ISO, apacISO, countriesSupported, countriesSupportedISO, identifyFTShippingZone };
76
+ module.exports = {
77
+ cemeaV1ISO,
78
+ cemeaV2ISO,
79
+ apacISO,
80
+ countriesSupported,
81
+ countriesSupportedISO,
82
+ identifyFTShippingZone,
83
+ };
@@ -21,7 +21,7 @@ const supportedPostcodeExamples = {
21
21
  NOR: '1608',
22
22
  POL: '43-190',
23
23
  PRT: '2525-517',
24
- QAT: '',//match anything
24
+ QAT: '', //match anything
25
25
  ROU: '712341',
26
26
  RUS: '191028',
27
27
  SVK: '98401',
@@ -29,7 +29,7 @@ const supportedPostcodeExamples = {
29
29
  ZAF: '5189',
30
30
  ESP: '37752',
31
31
  SWE: '260 38',
32
- CHE: '9424'
32
+ CHE: '9424',
33
33
  },
34
34
  cemeaV2: { FRA: '95000', LUX: '1009', MCO: '98000' },
35
35
  apac: {
@@ -43,13 +43,13 @@ const supportedPostcodeExamples = {
43
43
  PHL: '2799',
44
44
  SGP: '584163',
45
45
  TWN: '100',
46
- THA: '10330'
46
+ THA: '10330',
47
47
  },
48
48
  other: {
49
49
  GBR: 'EC4M 9BT',
50
50
  USA: '60411',
51
- CAN: 'M5H 3E5'
52
- }
51
+ CAN: 'M5H 3E5',
52
+ },
53
53
  };
54
54
 
55
55
  const allSupportedPostcodeExamples = flattenObj(supportedPostcodeExamples);
@@ -19,7 +19,7 @@ const supportedPostcodeValidators = {
19
19
  NOR: /^\d{4}$/,
20
20
  POL: /^\d{2}-\d{3}$/,
21
21
  PRT: /^\d{4}([\-]\d{3})?$/,
22
- QAT: /.*$/,//match anything
22
+ QAT: /.*$/, //match anything
23
23
  ROU: /^\d{6}$/,
24
24
  RUS: /^\d{6}$/,
25
25
  SVK: /^\d{3}[ ]?\d{2}$/,
@@ -27,7 +27,7 @@ const supportedPostcodeValidators = {
27
27
  ZAF: /^\d{4}$/,
28
28
  ESP: /^\d{5}$/,
29
29
  SWE: /^\d{3}[ ]?\d{2}$/,
30
- CHE: /^\d{4}$/
30
+ CHE: /^\d{4}$/,
31
31
  },
32
32
  cemeaV2: { FRA: /^[0-9]{5}$/, LUX: /^\d{4}$/, MCO: /^980\d{2}$/ },
33
33
  apac: {
@@ -41,13 +41,13 @@ const supportedPostcodeValidators = {
41
41
  PHL: /^\d{4}$/,
42
42
  SGP: /^\d{6}$/,
43
43
  TWN: /^\d{3}(\d{2})?$/,
44
- THA: /^\d{5}$/
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}$/,
48
48
  USA: /^[0-9]{5}$/,
49
- CAN: /^[A-Za-z]\d[A-Za-z][\s-]?\d[A-Za-z]\d$/
50
- }
49
+ CAN: /^[A-Za-z]\d[A-Za-z][\s-]?\d[A-Za-z]\d$/,
50
+ },
51
51
  };
52
52
 
53
53
  module.exports = { supportedPostcodeValidators };
@@ -1,26 +1,46 @@
1
- const { supportedPostcodeValidators } = require('./supportedPostcodeValidators');
1
+ const {
2
+ supportedPostcodeValidators,
3
+ } = require('./supportedPostcodeValidators');
2
4
  const { supportedPostcodeExamples } = require('./supportedPostcodeExamples');
3
5
 
4
6
  describe('supportedPostcodeValidators', () => {
5
7
  it('should validate every cemeaV1 supportedPostcodeExamples', () => {
6
- const cemeaV1PostcodeCountryCodes = Object.keys(supportedPostcodeExamples.cemeaV1);
8
+ const cemeaV1PostcodeCountryCodes = Object.keys(
9
+ supportedPostcodeExamples.cemeaV1
10
+ );
7
11
 
8
- for ( const cemeaV1PostcodeCountryCode of cemeaV1PostcodeCountryCodes ) {
9
- expect(supportedPostcodeValidators.cemeaV1[cemeaV1PostcodeCountryCode].test(supportedPostcodeExamples.cemeaV1[cemeaV1PostcodeCountryCode])).toBe(true);
12
+ for (const cemeaV1PostcodeCountryCode of cemeaV1PostcodeCountryCodes) {
13
+ expect(
14
+ supportedPostcodeValidators.cemeaV1[cemeaV1PostcodeCountryCode].test(
15
+ supportedPostcodeExamples.cemeaV1[cemeaV1PostcodeCountryCode]
16
+ )
17
+ ).toBe(true);
10
18
  }
11
19
  });
12
20
  it('should validate every cemeaV2 supportedPostcodeExamples', () => {
13
- const cemeaV2PostcodeCountryCodes = Object.keys(supportedPostcodeExamples.cemeaV2);
21
+ const cemeaV2PostcodeCountryCodes = Object.keys(
22
+ supportedPostcodeExamples.cemeaV2
23
+ );
14
24
 
15
- for ( const cemeaV2PostcodeCountryCode of cemeaV2PostcodeCountryCodes ) {
16
- expect(supportedPostcodeValidators.cemeaV2[cemeaV2PostcodeCountryCode].test(supportedPostcodeExamples.cemeaV2[cemeaV2PostcodeCountryCode])).toBe(true);
25
+ for (const cemeaV2PostcodeCountryCode of cemeaV2PostcodeCountryCodes) {
26
+ expect(
27
+ supportedPostcodeValidators.cemeaV2[cemeaV2PostcodeCountryCode].test(
28
+ supportedPostcodeExamples.cemeaV2[cemeaV2PostcodeCountryCode]
29
+ )
30
+ ).toBe(true);
17
31
  }
18
32
  });
19
33
  it('should validate every apac supportedPostcodeExamples', () => {
20
- const apacPostcodeCountryCodes = Object.keys(supportedPostcodeExamples.apac);
34
+ const apacPostcodeCountryCodes = Object.keys(
35
+ supportedPostcodeExamples.apac
36
+ );
21
37
 
22
- for ( const apacPostcodeCountryCode of apacPostcodeCountryCodes ) {
23
- expect(supportedPostcodeValidators.apac[apacPostcodeCountryCode].test(supportedPostcodeExamples.apac[apacPostcodeCountryCode])).toBe(true);
38
+ for (const apacPostcodeCountryCode of apacPostcodeCountryCodes) {
39
+ expect(
40
+ supportedPostcodeValidators.apac[apacPostcodeCountryCode].test(
41
+ supportedPostcodeExamples.apac[apacPostcodeCountryCode]
42
+ )
43
+ ).toBe(true);
24
44
  }
25
45
  });
26
46
  });
@@ -1,9 +1,9 @@
1
1
  //Recursively flattens a nested object.
2
2
  //For example: input: {a:{b:1}} -> output: {b:1}
3
- const flattenObj = (obj, out={}) => {
4
- Object.keys(obj).forEach(key => {
3
+ const flattenObj = (obj, out = {}) => {
4
+ Object.keys(obj).forEach((key) => {
5
5
  if (typeof obj[key] === 'object') {
6
- out = flattenObj(obj[key], out); //recursively call for nesteds
6
+ out = flattenObj(obj[key], out); //recursively call for nested objects
7
7
  } else {
8
8
  out[key] = obj[key]; //direct assign for values
9
9
  }
@@ -11,4 +11,4 @@ const flattenObj = (obj, out={}) => {
11
11
  return out;
12
12
  };
13
13
 
14
- module.exports = { flattenObj };
14
+ module.exports = { flattenObj };
package/jest.config.js CHANGED
@@ -1,9 +1,5 @@
1
1
  module.exports = {
2
- testPathIgnorePatterns: [
3
- '/node_modules/',
4
- '/cypress/',
5
- '/test/',
6
- ],
2
+ testPathIgnorePatterns: ['/node_modules/', '/cypress/', '/test/'],
7
3
  transform: {
8
4
  '.(js|jsx)': '@sucrase/jest-plugin',
9
5
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "27.7.1",
3
+ "version": "28.0.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": {
@@ -26,11 +26,11 @@
26
26
  "homepage": "https://github.com/Financial-Times/n-conversion-forms#readme",
27
27
  "dependencies": {
28
28
  "@babel/runtime": "^7.11.2",
29
+ "@financial-times/n-pricing": "5.6.1",
29
30
  "classnames": "2.3.1",
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#v1.7.1",
33
- "@financial-times/n-pricing": "5.6.1"
33
+ "n-common-static-data": "github:Financial-Times/n-common-static-data#v1.7.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@babel/cli": "^7.10.5",
@@ -38,38 +38,35 @@
38
38
  "@babel/plugin-transform-runtime": "^7.11.0",
39
39
  "@babel/preset-env": "^7.11.0",
40
40
  "@babel/preset-react": "^7.10.4",
41
- "@financial-times/eslint-config-next": "^3.0.0",
41
+ "@financial-times/eslint-config-next": "^6.0.0",
42
42
  "@financial-times/jest-browser-resolver": "^1.0.2",
43
43
  "@financial-times/n-gage": "^8.2.0",
44
44
  "@storybook/addon-a11y": "^6.5.13",
45
45
  "@storybook/addon-essentials": "6.5.13",
46
46
  "@storybook/react": "^6.5.13",
47
47
  "@sucrase/jest-plugin": "^2.0.0",
48
- "chai": "^4.2.0",
49
48
  "check-engines": "^1.5.0",
50
49
  "enzyme": "^3.10.0",
51
50
  "enzyme-adapter-react-16": "^1.15.1",
52
- "eslint": "^8.1.0",
53
- "eslint-config-prettier": "^8.3.0",
54
- "eslint-plugin-jest": "^25.2.4",
55
- "eslint-plugin-react": "^7.26.1",
51
+ "eslint": "^8.28.0",
52
+ "eslint-config-prettier": "^8.5.0",
53
+ "eslint-plugin-jest": "^27.1.6",
54
+ "eslint-plugin-prettier": "^4.2.1",
55
+ "eslint-plugin-react": "^7.31.1",
56
56
  "fetch-mock": "^7.2.0",
57
57
  "jest": "^26.0.0",
58
58
  "jest-serializer-html": "^7.0.0",
59
59
  "jsdom": "15.1.0",
60
- "lint-staged": "^11.2.6",
61
- "mocha": "5.1.1",
60
+ "lint-staged": "^13.0.4",
62
61
  "pa11y-ci": "2.1.1",
63
- "postcss": "^7.0.32",
64
- "prettier": "2.4.1",
62
+ "prettier": "^2.4.1",
63
+ "pretty-quick": "^3.1.3",
65
64
  "prop-types": "15.7.2",
66
- "proxyquire": "2.1.0",
67
65
  "react": "16.14.0",
68
66
  "react-dom": "16.14.0",
69
67
  "react-is": "^16.13.1",
70
68
  "sass": "^1.55.0",
71
69
  "sass-loader": "^10.2.1",
72
- "sinon": "6.3.5",
73
70
  "snyk": "1.230.7"
74
71
  },
75
72
  "engines": {
@@ -83,8 +80,8 @@
83
80
  "husky": {
84
81
  "hooks": {
85
82
  "commit-msg": "node_modules/.bin/secret-squirrel-commitmsg",
86
- "pre-commit": "node_modules/.bin/secret-squirrel && npm run lint",
87
- "pre-push": "make test"
83
+ "pre-commit": "node_modules/.bin/secret-squirrel && pretty-quick --staged && npm run lint",
84
+ "pre-push": "pretty-quick --staged && make test"
88
85
  }
89
86
  },
90
87
  "peerDependencies": {
@@ -4,20 +4,4 @@
4
4
  margin-top: 0;
5
5
  }
6
6
  }
7
-
8
- // Change the colour of messages inside the wrapper
9
- // to look better with a white background
10
- .ncf__wrapper & &__message {
11
- .o-message--error {
12
- color: oColorsByName('crimson');
13
- background-color: oColorsMix('crimson', 'white', 10);
14
-
15
- .o-message__actions__primary {
16
- background-color: oColorsMix('crimson', 'white', 10);
17
- &:hover {
18
- background-color: oColorsMix('crimson', 'white', 20);
19
- }
20
- }
21
- }
22
- }
23
7
  }
@@ -1,7 +1,7 @@
1
1
  import ReactDOMServer from 'react-dom/server';
2
2
 
3
3
  export const expectToRenderCorrectly = {
4
- toRenderCorrectly (reactComponent, props) {
4
+ toRenderCorrectly(reactComponent, props) {
5
5
  // Render the React component with props.
6
6
  const ReactComponentRendered = ReactDOMServer.renderToStaticMarkup(
7
7
  reactComponent(props)
@@ -1,5 +1,5 @@
1
1
  class AppBanner {
2
- constructor (window) {
2
+ constructor(window) {
3
3
  if (!window) {
4
4
  throw new Error('Please supply a Window object');
5
5
  }
@@ -38,7 +38,7 @@ class ApplePay {
38
38
  * @param {Object} options PaymentRequest API payment options object
39
39
  * @throws If browser doesn't support PaymentRequest API
40
40
  */
41
- constructor (
41
+ constructor(
42
42
  window,
43
43
  methods = ApplePay.PAYMENT_METHODS,
44
44
  details = ApplePay.PAYMENT_DETAILS,
@@ -63,7 +63,7 @@ class ApplePay {
63
63
  * Proxy call through to the request
64
64
  * @return {Promise<Boolean>}
65
65
  */
66
- canMakePayment () {
66
+ canMakePayment() {
67
67
  return this.request.canMakePayment();
68
68
  }
69
69
 
@@ -72,7 +72,7 @@ class ApplePay {
72
72
  * @param {Object} paymentDetails Optional payment details object for update
73
73
  * @return {Promise<Object>} Response object from apple pay
74
74
  */
75
- show (paymentDetails) {
75
+ show(paymentDetails) {
76
76
  // Work around to enable the update of payment details for safari
77
77
  // browsers as it seems not to be supported, regenerates PaymentRequest
78
78
  if (paymentDetails) {
@@ -92,7 +92,7 @@ class ApplePay {
92
92
  * Validate ourselves via membership
93
93
  * @param {Object} event
94
94
  */
95
- async handleMerchantValidation (event) {
95
+ async handleMerchantValidation(event) {
96
96
  const merchantId = ApplePay.getMerchantId(this.methods);
97
97
  const url = ApplePay.getMerchantValidationUrl(merchantId);
98
98
  const data = {
@@ -123,7 +123,7 @@ class ApplePay {
123
123
  * @param {Array} methods
124
124
  * @return {String}
125
125
  */
126
- static getMerchantId (methods = []) {
126
+ static getMerchantId(methods = []) {
127
127
  const method = methods[0] || {};
128
128
  return (
129
129
  (method.data && method.data.merchantIdentifier) || ApplePay.MERCHANT_ID
@@ -135,7 +135,7 @@ class ApplePay {
135
135
  * @param {String} merchantId
136
136
  * @return {String}
137
137
  */
138
- static getMerchantValidationUrl (merchantId) {
138
+ static getMerchantValidationUrl(merchantId) {
139
139
  if (merchantId === ApplePay.TEST_MERCHANT_ID) {
140
140
  return ApplePay.TEST_MERCHANT_VALIDATION_URL;
141
141
  }
@@ -148,7 +148,7 @@ class ApplePay {
148
148
  * @param {String} currency ISO 3 digit currency code
149
149
  * @param {String} label Product name
150
150
  */
151
- static getPaymentDetails (value, currency, label) {
151
+ static getPaymentDetails(value, currency, label) {
152
152
  const details = ApplePay.PAYMENT_DETAILS;
153
153
  details.total.label = label;
154
154
  details.total.amount.value = value;
@@ -160,7 +160,7 @@ class ApplePay {
160
160
  * Expose the production merchant id
161
161
  * @return {String}
162
162
  */
163
- static get MERCHANT_ID () {
163
+ static get MERCHANT_ID() {
164
164
  return 'merchant.com.ft';
165
165
  }
166
166
 
@@ -168,7 +168,7 @@ class ApplePay {
168
168
  * Expose the production merchant validation url
169
169
  * @return {String}
170
170
  */
171
- static get MERCHANT_VALIDATION_URL () {
171
+ static get MERCHANT_VALIDATION_URL() {
172
172
  return 'https://api.ft.com/idm/v1/apple-merchant-validation/validate';
173
173
  }
174
174
 
@@ -176,7 +176,7 @@ class ApplePay {
176
176
  * Expose production payment methods
177
177
  * @return {Array}
178
178
  */
179
- static get PAYMENT_METHODS () {
179
+ static get PAYMENT_METHODS() {
180
180
  return [
181
181
  {
182
182
  supportedMethods: 'https://apple.com/apple-pay',
@@ -195,7 +195,7 @@ class ApplePay {
195
195
  * Default payment details
196
196
  * @return {Object}
197
197
  */
198
- static get PAYMENT_DETAILS () {
198
+ static get PAYMENT_DETAILS() {
199
199
  return {
200
200
  total: {
201
201
  label: 'FT.com',
@@ -211,7 +211,7 @@ class ApplePay {
211
211
  * Default payment options
212
212
  * @return {Object}
213
213
  */
214
- static get PAYMENT_OPTIONS () {
214
+ static get PAYMENT_OPTIONS() {
215
215
  return {
216
216
  requestPayerName: false,
217
217
  requestPayerEmail: false,
@@ -224,7 +224,7 @@ class ApplePay {
224
224
  * Expose the test merchant id
225
225
  * @return {String}
226
226
  */
227
- static get TEST_MERCHANT_ID () {
227
+ static get TEST_MERCHANT_ID() {
228
228
  return 'merchant.test.env.apple.pay';
229
229
  }
230
230
 
@@ -232,7 +232,7 @@ class ApplePay {
232
232
  * Expose the test merchant validation url
233
233
  * @return {String}
234
234
  */
235
- static get TEST_MERCHANT_VALIDATION_URL () {
235
+ static get TEST_MERCHANT_VALIDATION_URL() {
236
236
  return 'https://api-t.ft.com/idm/v1/apple-merchant-validation/validate';
237
237
  }
238
238
 
@@ -240,7 +240,7 @@ class ApplePay {
240
240
  * Expose the test payment methods
241
241
  * @return {Array}
242
242
  */
243
- static get TEST_PAYMENT_METHODS () {
243
+ static get TEST_PAYMENT_METHODS() {
244
244
  return [
245
245
  {
246
246
  supportedMethods: 'https://apple.com/apple-pay',
@@ -1,7 +1,7 @@
1
1
  const FormElement = require('./form-element');
2
2
 
3
3
  class BillingCity extends FormElement {
4
- constructor (document) {
4
+ constructor(document) {
5
5
  super(document, '.ncf #billingCityField');
6
6
  }
7
7
  }
@@ -15,7 +15,7 @@ class BillingCountry {
15
15
  * @throws If the document not passed
16
16
  * @throws When the country element not found
17
17
  */
18
- constructor (element) {
18
+ constructor(element) {
19
19
  if (!element) {
20
20
  throw new Error('Please supply a DOM element');
21
21
  }
@@ -32,7 +32,7 @@ class BillingCountry {
32
32
  * Register an event listener
33
33
  * @param {Function} callback Called with event when changed
34
34
  */
35
- onChange (callback = () => {}) {
35
+ onChange(callback = () => {}) {
36
36
  return this.$billingCountry.addEventListener('change', callback);
37
37
  }
38
38
 
@@ -41,7 +41,7 @@ class BillingCountry {
41
41
  * @return {String}
42
42
  * @throws If nothing has been selected
43
43
  */
44
- getSelected () {
44
+ getSelected() {
45
45
  const selected =
46
46
  this.$billingCountry.options[this.$billingCountry.selectedIndex];
47
47
  if (!selected) {
@@ -1,7 +1,7 @@
1
1
  const Postcode = require('./postcode');
2
2
 
3
3
  class BillingPostcode extends Postcode {
4
- constructor (document) {
4
+ constructor(document) {
5
5
  super(document, '.ncf #billingPostcodeField');
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
1
  const FormElement = require('./form-element');
2
2
 
3
3
  class CompanyName extends FormElement {
4
- constructor (document, fieldId = 'companyNameField') {
4
+ constructor(document, fieldId = 'companyNameField') {
5
5
  super(document, `.ncf #${fieldId}`);
6
6
  }
7
7
  }
@@ -7,7 +7,7 @@ const { countries } = require('n-common-static-data').billingCountries;
7
7
  * @param {array} options.filter Only returns countries within the filter list if supplied
8
8
  * @param {number} options.minimumToGroup Only show groupings if there are over this amount of countries
9
9
  */
10
- function getCountries ({ value, filter = [], minimumToGroup = 20 } = {}) {
10
+ function getCountries({ value, filter = [], minimumToGroup = 20 } = {}) {
11
11
  let data = countries;
12
12
 
13
13
  // Only show countries in the filter
@@ -41,7 +41,7 @@ function getCountries ({ value, filter = [], minimumToGroup = 20 } = {}) {
41
41
  * @param {string} options.alphabeticalLabel Label to use for all other countries
42
42
  * @return {array}
43
43
  */
44
- function groupCountries (
44
+ function groupCountries(
45
45
  countries,
46
46
  {
47
47
  minimumToShowGroups = 2,
package/utils/country.js CHANGED
@@ -15,7 +15,7 @@ class Country {
15
15
  * @throws If the document not passed
16
16
  * @throws When the country element not found
17
17
  */
18
- constructor (element) {
18
+ constructor(element) {
19
19
  if (!element) {
20
20
  throw new Error('Please supply a DOM element');
21
21
  }
@@ -32,7 +32,7 @@ class Country {
32
32
  * Register an event listener
33
33
  * @param {Function} callback Called with event when changed
34
34
  */
35
- onChange (callback = () => {}) {
35
+ onChange(callback = () => {}) {
36
36
  return this.$country.addEventListener('change', callback);
37
37
  }
38
38
 
@@ -41,7 +41,7 @@ class Country {
41
41
  * @return {String}
42
42
  * @throws If nothing has been selected
43
43
  */
44
- getSelected () {
44
+ getSelected() {
45
45
  const selected = this.$country.options[this.$country.selectedIndex];
46
46
  if (!selected) {
47
47
  throw new Error('No country has been selected');
@@ -11,7 +11,7 @@ class DeliveryAdressType {
11
11
  * @throws If the document not passed
12
12
  * @throws When the country element not found
13
13
  */
14
- constructor (element, fieldId = 'deliveryAddressTypeField') {
14
+ constructor(element, fieldId = 'deliveryAddressTypeField') {
15
15
  if (!element) {
16
16
  throw new Error('Please supply a DOM element');
17
17
  }
@@ -29,7 +29,7 @@ class DeliveryAdressType {
29
29
  * @return {String}
30
30
  * @throws If nothing has been selected
31
31
  */
32
- getSelected () {
32
+ getSelected() {
33
33
  const checked = this.$deliveryAddressType.querySelector('input:checked');
34
34
  if (!checked) {
35
35
  throw new Error('No address type has been selected');
@@ -41,7 +41,7 @@ class DeliveryAdressType {
41
41
  * Register an event listener
42
42
  * @param {Function} callback Called with event when changed
43
43
  */
44
- onChange (callback) {
44
+ onChange(callback) {
45
45
  return (
46
46
  typeof callback === 'function' &&
47
47
  this.$deliveryAddressType.addEventListener('change', callback)
@@ -36,7 +36,9 @@ describe('Delivery Address Type - Util', () => {
36
36
  <body>${component.html()}</body>
37
37
  </html>`;
38
38
 
39
- const deliveryAdressTypeUtilInstance = new DeliveryAdressTypeUtil(document);
39
+ const deliveryAdressTypeUtilInstance = new DeliveryAdressTypeUtil(
40
+ document
41
+ );
40
42
  expect(deliveryAdressTypeUtilInstance.getSelected()).toEqual('home');
41
43
  });
42
44
 
@@ -54,7 +56,9 @@ describe('Delivery Address Type - Util', () => {
54
56
  <body>${component.html()}</body>
55
57
  </html>`;
56
58
 
57
- const deliveryAdressTypeUtilInstance = new DeliveryAdressTypeUtil(document);
59
+ const deliveryAdressTypeUtilInstance = new DeliveryAdressTypeUtil(
60
+ document
61
+ );
58
62
  expect(deliveryAdressTypeUtilInstance.getSelected()).toEqual(props.value);
59
63
  });
60
64
  });
@@ -1,7 +1,7 @@
1
1
  const FormElement = require('./form-element');
2
2
 
3
3
  class DeliveryAddress extends FormElement {
4
- constructor (document, fieldId = 'deliveryAddressFields') {
4
+ constructor(document, fieldId = 'deliveryAddressFields') {
5
5
  super(document, `.ncf #${fieldId}`);
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
1
  const FormElement = require('./form-element');
2
2
 
3
3
  class DeliveryInstructions extends FormElement {
4
- constructor (document, fieldId = 'deliveryInstructionsField') {
4
+ constructor(document, fieldId = 'deliveryInstructionsField') {
5
5
  super(document, `.ncf #${fieldId}`);
6
6
  }
7
7
  }