@financial-times/n-conversion-forms 20.3.3 → 20.3.4

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 (105) hide show
  1. package/.circleci/config.yml +7 -5
  2. package/.circleci/shared-helpers/helper-npm-install-peer-deps +6 -6
  3. package/.eslintignore +3 -0
  4. package/.github/workflows/gh-pages-deploy.yml +2 -1
  5. package/build-state/npm-shrinkwrap.json +47013 -9010
  6. package/components/__snapshots__/accept-terms.spec.js.snap +94 -6
  7. package/components/accept-terms.jsx +67 -9
  8. package/components/accept-terms.spec.js +12 -0
  9. package/components/app-banner.jsx +1 -1
  10. package/components/b2c-partnership-confirmation.jsx +2 -2
  11. package/components/b2c-partnership-payment-term.jsx +1 -1
  12. package/components/billing-city.jsx +1 -1
  13. package/components/billing-country.jsx +1 -1
  14. package/components/billing-postcode.jsx +1 -1
  15. package/components/company-name.jsx +1 -1
  16. package/components/confirmation.jsx +1 -1
  17. package/components/continue-reading.jsx +1 -1
  18. package/components/continue-reading.stories.js +1 -1
  19. package/components/country.jsx +1 -1
  20. package/components/customer-care.jsx +1 -1
  21. package/components/debug.jsx +1 -1
  22. package/components/decision-maker.jsx +1 -1
  23. package/components/decision-maker.spec.js +1 -1
  24. package/components/delivery-address-type.jsx +1 -1
  25. package/components/delivery-address.jsx +2 -2
  26. package/components/delivery-city.jsx +1 -1
  27. package/components/delivery-county.jsx +1 -1
  28. package/components/delivery-instructions.jsx +1 -1
  29. package/components/delivery-option.jsx +1 -1
  30. package/components/delivery-po-box.jsx +1 -1
  31. package/components/delivery-postcode.jsx +1 -1
  32. package/components/delivery-security-instructions.jsx +1 -1
  33. package/components/delivery-start-date.jsx +1 -1
  34. package/components/education-job-title.jsx +1 -1
  35. package/components/email.jsx +1 -1
  36. package/components/error-page.jsx +1 -1
  37. package/components/fieldset.jsx +1 -1
  38. package/components/first-name.jsx +1 -1
  39. package/components/form.jsx +1 -1
  40. package/components/google-sign-in.jsx +1 -1
  41. package/components/graduation-date.jsx +1 -1
  42. package/components/industry.jsx +1 -1
  43. package/components/job-title.jsx +1 -1
  44. package/components/last-name.jsx +1 -1
  45. package/components/licence-confirmation.jsx +1 -1
  46. package/components/licence-header.jsx +2 -2
  47. package/components/licence-sign-in.jsx +2 -2
  48. package/components/licence-title.jsx +2 -2
  49. package/components/lite-sub-confirmation.jsx +1 -1
  50. package/components/loader.jsx +1 -1
  51. package/components/message.jsx +1 -1
  52. package/components/organisation.jsx +1 -1
  53. package/components/package-change.jsx +1 -1
  54. package/components/password.jsx +1 -1
  55. package/components/payment-term.jsx +1 -1
  56. package/components/payment-type.jsx +2 -2
  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/trial-banner.jsx +1 -1
  68. package/dist/accept-terms.js +40 -5
  69. package/dist/b2c-partnership-confirmation.js +1 -1
  70. package/dist/payment-type.js +1 -1
  71. package/package.json +9 -6
  72. package/test-jest/helpers/expect-to-render-correctly.js +1 -1
  73. package/utils/app-banner.js +1 -1
  74. package/utils/apple-pay.js +15 -15
  75. package/utils/billing-city.js +1 -1
  76. package/utils/billing-country.js +3 -3
  77. package/utils/billing-postcode.js +1 -1
  78. package/utils/company-name.js +1 -1
  79. package/utils/countries.js +2 -2
  80. package/utils/country.js +3 -3
  81. package/utils/delivery-address-type.js +3 -3
  82. package/utils/delivery-address.js +1 -1
  83. package/utils/delivery-instructions.js +1 -1
  84. package/utils/delivery-option-messages.js +11 -11
  85. package/utils/delivery-option-messages.spec.js +2 -2
  86. package/utils/delivery-option.js +5 -5
  87. package/utils/delivery-po-box.js +1 -1
  88. package/utils/delivery-postcode.js +1 -1
  89. package/utils/delivery-start-date.js +4 -4
  90. package/utils/email.js +4 -4
  91. package/utils/event-notifier.js +1 -1
  92. package/utils/form-element.js +8 -8
  93. package/utils/loader.js +10 -10
  94. package/utils/password.js +2 -2
  95. package/utils/payment-term.js +5 -5
  96. package/utils/payment-type.js +12 -12
  97. package/utils/postcode.js +3 -3
  98. package/utils/province.js +1 -1
  99. package/utils/salesforce.js +2 -2
  100. package/utils/state.js +1 -1
  101. package/utils/submit.js +5 -5
  102. package/utils/tracking.js +7 -7
  103. package/utils/validation.js +10 -10
  104. package/utils/zuora-error-map.js +5 -5
  105. package/utils/zuora.js +12 -12
@@ -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)
@@ -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
  }
@@ -62,7 +62,7 @@ const deliveryOptionMessages = [
62
62
  country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
63
63
  title: 'Hand delivery',
64
64
  description:
65
- "Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT's control. In those circumstances, your newspaper will be delivered on the next delivery day.",
65
+ 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT\'s control. In those circumstances, your newspaper will be delivered on the next delivery day.',
66
66
  },
67
67
  {
68
68
  deliveryFrequency: [
@@ -88,7 +88,7 @@ const deliveryOptionMessages = [
88
88
  country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
89
89
  title: 'Hand delivery',
90
90
  description:
91
- "Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT's control. In those circumstances, your newspaper will be delivered on the next delivery day. Please also be aware that your FT Weekend will be delivered on Sunday.",
91
+ 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT\'s control. In those circumstances, your newspaper will be delivered on the next delivery day. Please also be aware that your FT Weekend will be delivered on Sunday.',
92
92
  },
93
93
  {
94
94
  deliveryFrequency: [
@@ -113,7 +113,7 @@ const deliveryOptionMessages = [
113
113
  title: 'Mail',
114
114
  customId: 'ML',
115
115
  description:
116
- "We can only deliver the newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT's control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.",
116
+ 'We can only deliver the newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT\'s control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.',
117
117
  },
118
118
  {
119
119
  deliveryFrequency: [ONLY_WEEKEND_DELIVERY_FREQ],
@@ -123,7 +123,7 @@ const deliveryOptionMessages = [
123
123
  country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
124
124
  title: 'Hand delivery',
125
125
  description:
126
- "Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspapers to your location which means delivery is subject to flight delays/cancellations outside of the FT's control. In those circumstances, your newspaper will be delivered the next delivery day.",
126
+ 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: We fly the newspapers to your location which means delivery is subject to flight delays/cancellations outside of the FT\'s control. In those circumstances, your newspaper will be delivered the next delivery day.',
127
127
  },
128
128
  {
129
129
  deliveryFrequency: [ONLY_WEEKEND_DELIVERY_FREQ],
@@ -143,7 +143,7 @@ const deliveryOptionMessages = [
143
143
  country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
144
144
  title: 'Hand delivery',
145
145
  description:
146
- "Enjoy delivery of the newspaper daily to your home or office address. \nPlease note we fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT's control. In those circumstances, your newspaper will be delivered on the next delivery day. Please also be aware that your FT Weekend will be delivered on Sunday.",
146
+ 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note we fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside of the FT\'s control. In those circumstances, your newspaper will be delivered on the next delivery day. Please also be aware that your FT Weekend will be delivered on Sunday.',
147
147
  },
148
148
  {
149
149
  deliveryFrequency: [ONLY_WEEKEND_DELIVERY_FREQ],
@@ -162,18 +162,18 @@ const deliveryOptionMessages = [
162
162
  title: 'Mail',
163
163
  customId: 'ML',
164
164
  description:
165
- "We can only deliver the FT Weekend newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT's control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.",
165
+ 'We can only deliver the FT Weekend newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT\'s control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.',
166
166
  },
167
167
  ];
168
168
 
169
- function includesDeliveryFrequency(productCode = '', item) {
169
+ function includesDeliveryFrequency (productCode = '', item) {
170
170
  return item.deliveryFrequency.find((freq) => {
171
171
  const productCodePattern = deliveryFrequencyProductsMapping[freq];
172
172
  return productCode.includes(productCodePattern);
173
173
  });
174
174
  }
175
175
 
176
- function mailStrategy(productCode, option, country, item) {
176
+ function mailStrategy (productCode, option, country, item) {
177
177
  return (
178
178
  includesDeliveryFrequency(productCode, item) &&
179
179
  item.distributorType === MAIL &&
@@ -181,7 +181,7 @@ function mailStrategy(productCode, option, country, item) {
181
181
  );
182
182
  }
183
183
 
184
- function handDeliveryStrategy(productCode, option, country, item) {
184
+ function handDeliveryStrategy (productCode, option, country, item) {
185
185
  return (
186
186
  includesDeliveryFrequency(productCode, item) &&
187
187
  item.distributorType === HAND_DELIVERY &&
@@ -197,7 +197,7 @@ function handDeliveryStrategy(productCode, option, country, item) {
197
197
  * Both cases are represented by system option code 'HD', but differ on the mailDelivery property value.
198
198
  * If no message matchs, then undefined is returned.
199
199
  */
200
- function findCustomDeliveryOption(productCode, option, country) {
200
+ function findCustomDeliveryOption (productCode, option, country) {
201
201
  let deliveryOption;
202
202
 
203
203
  if (option.value === HAND_DELIVERY) {
@@ -216,7 +216,7 @@ function findCustomDeliveryOption(productCode, option, country) {
216
216
  return deliveryOption;
217
217
  }
218
218
 
219
- function getDeliveryOption(productCode, option, country) {
219
+ function getDeliveryOption (productCode, option, country) {
220
220
  return country === UK_COUNTRY_CODE
221
221
  ? UKDeliveryOptions[option.value]
222
222
  : findCustomDeliveryOption(productCode, option, country);
@@ -86,7 +86,7 @@ describe('Find Custom Delivery Option', () => {
86
86
  title: 'Mail',
87
87
  customId: 'ML',
88
88
  description:
89
- "We can only deliver the newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT's control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.",
89
+ 'We can only deliver the newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT\'s control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.',
90
90
  };
91
91
 
92
92
  const deliveryOption = getDeliveryOption(
@@ -103,7 +103,7 @@ describe('Find Custom Delivery Option', () => {
103
103
  title: 'Mail',
104
104
  customId: 'ML',
105
105
  description:
106
- "We can only deliver the FT Weekend newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT's control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.",
106
+ 'We can only deliver the FT Weekend newspaper to your location by postal mail which means your delivery will arrive up to 3 business days after the date of publication and will not include the HTSI Magazine. We also fly the newspaper to your location which means delivery is subject to flight delays/cancellations outside the FT\'s control. If you prefer to read the printed content on the day of publication, please proceed to subscribe to the FT ePaper - a digital replica of the print edition.',
107
107
  };
108
108
 
109
109
  const deliveryOption = getDeliveryOption(
@@ -9,7 +9,7 @@ class DeliveryOption {
9
9
  * @param {Element} element Usually the window.document
10
10
  * @throws If the element not passed
11
11
  */
12
- constructor(element) {
12
+ constructor (element) {
13
13
  if (!element) {
14
14
  throw new Error('Please supply the DOM element');
15
15
  }
@@ -27,7 +27,7 @@ class DeliveryOption {
27
27
  * Binds the given callback to the field's onchange event.
28
28
  * @param {Function} callback The callback function to call when a change event occurs.
29
29
  */
30
- handleDeliveryOptionChange(callback) {
30
+ handleDeliveryOptionChange (callback) {
31
31
  if (this.$form.elements['deliveryOption'].length === undefined) {
32
32
  this.$form.elements['deliveryOption'].addEventListener(
33
33
  'change',
@@ -43,7 +43,7 @@ class DeliveryOption {
43
43
  /**
44
44
  * Hide a specific radio input item.
45
45
  */
46
- hideItem(itemId) {
46
+ hideItem (itemId) {
47
47
  const labelNodes = this.$form.querySelectorAll(
48
48
  '.ncf__delivery-option__item'
49
49
  );
@@ -56,7 +56,7 @@ class DeliveryOption {
56
56
  /**
57
57
  * Show a specific radio input item.
58
58
  */
59
- showItem(itemId) {
59
+ showItem (itemId) {
60
60
  const labelNodes = this.$form.querySelectorAll(
61
61
  '.ncf__delivery-option__item'
62
62
  );
@@ -69,7 +69,7 @@ class DeliveryOption {
69
69
  /**
70
70
  * Mark an input item as checked
71
71
  */
72
- checkItem(itemId) {
72
+ checkItem (itemId) {
73
73
  const inputNodes = this.$form.elements['deliveryOption'];
74
74
  const item = Array.from(inputNodes).find((node) => node.id === itemId);
75
75
  if (item) {
@@ -1,7 +1,7 @@
1
1
  const FormElement = require('./form-element');
2
2
 
3
3
  class DeliveryPOBox extends FormElement {
4
- constructor(document, fieldId = 'deliveryPOBoxField') {
4
+ constructor (document, fieldId = 'deliveryPOBoxField') {
5
5
  super(document, `.ncf #${fieldId}`);
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
1
  const Postcode = require('./postcode');
2
2
 
3
3
  class DeliveryPostcode extends Postcode {
4
- constructor(document) {
4
+ constructor (document) {
5
5
  super(document, '.ncf #deliveryPostcodeField');
6
6
  }
7
7
  }
@@ -11,7 +11,7 @@ class DeliveryStartDate {
11
11
  * @param {Element} element Usually the window.document
12
12
  * @throws If the element not passed
13
13
  */
14
- constructor(element) {
14
+ constructor (element) {
15
15
  if (!element) {
16
16
  throw new Error('Please supply the DOM element');
17
17
  }
@@ -60,7 +60,7 @@ class DeliveryStartDate {
60
60
  * @returns {boolean} Whether or not the start date is valid.
61
61
  * @throws If there was an error calling the endpoint to check this.
62
62
  */
63
- async handleDeliveryStartDateChange(url, getData) {
63
+ async handleDeliveryStartDateChange (url, getData) {
64
64
  const isNewValue =
65
65
  this.previousDeliveryDateValue !== this.$deliveryStartDate.value;
66
66
  this.previousDeliveryDateValue = this.$deliveryStartDate.value;
@@ -103,14 +103,14 @@ class DeliveryStartDate {
103
103
  /**
104
104
  * Enables the start date field
105
105
  */
106
- enable() {
106
+ enable () {
107
107
  this.$deliveryStartDate.removeAttribute('disabled');
108
108
  }
109
109
 
110
110
  /**
111
111
  * Disables the start date field
112
112
  */
113
- disable() {
113
+ disable () {
114
114
  this.$deliveryStartDate.setAttribute('disabled', 'true');
115
115
  }
116
116
  }
package/utils/email.js CHANGED
@@ -12,7 +12,7 @@ class Email {
12
12
  * @throws If the element not passed
13
13
  * @throws When the email element not found
14
14
  */
15
- constructor(element) {
15
+ constructor (element) {
16
16
  if (!element) {
17
17
  throw new Error('Please supply the DOM element');
18
18
  }
@@ -35,7 +35,7 @@ class Email {
35
35
  /**
36
36
  * Check the values of the two fields and update error state accordingly.
37
37
  */
38
- checkMatch() {
38
+ checkMatch () {
39
39
  if (this.$emailConfirm.value) {
40
40
  if (this.$email.value !== this.$emailConfirm.value) {
41
41
  this.$emailConfirmField.classList.add('o-forms--error');
@@ -54,7 +54,7 @@ class Email {
54
54
  * @param {Function} onNotFound Callback function to run if email does *not* exist.
55
55
  * @returns {Function} The handler function so the caller can unregister it if they need.
56
56
  */
57
- registerEmailExistsCheck(url, onFound, onNotFound) {
57
+ registerEmailExistsCheck (url, onFound, onNotFound) {
58
58
  const handler = () => {
59
59
  this.handleEmailExistsChange(url, onFound, onNotFound);
60
60
  };
@@ -71,7 +71,7 @@ class Email {
71
71
  * @param {Function} onNotFound Function to call when not found
72
72
  * @return {Promise}
73
73
  */
74
- handleEmailExistsChange(url, onFound, onNotFound) {
74
+ handleEmailExistsChange (url, onFound, onNotFound) {
75
75
  if (this.$email.value) {
76
76
  return fetch(url, {
77
77
  method: 'POST',
@@ -44,6 +44,6 @@ module.exports = {
44
44
  },
45
45
  };
46
46
 
47
- function notifier(payload, windowObject) {
47
+ function notifier (payload, windowObject) {
48
48
  windowObject.postMessage(JSON.stringify(payload), '*');
49
49
  }
@@ -10,7 +10,7 @@ class FormElement {
10
10
  * @param {object} document The global document object
11
11
  * @param {string} querySelector The selector for the main element used by this component.
12
12
  */
13
- constructor(document, querySelector) {
13
+ constructor (document, querySelector) {
14
14
  this.$document = document;
15
15
 
16
16
  if (!this.$document) {
@@ -31,21 +31,21 @@ class FormElement {
31
31
  /**
32
32
  * Hides the form element.
33
33
  */
34
- hide() {
34
+ hide () {
35
35
  this.$el.classList.add('ncf__hidden');
36
36
  }
37
37
 
38
38
  /**
39
39
  * Shows the form element.
40
40
  */
41
- show() {
41
+ show () {
42
42
  this.$el.classList.remove('ncf__hidden');
43
43
  }
44
44
 
45
45
  /**
46
46
  * Disable any inputs or selects inside form element
47
47
  */
48
- disable() {
48
+ disable () {
49
49
  for (let i = 0; i < this.inputs.length; i++) {
50
50
  this.inputs[i].disabled = true;
51
51
  }
@@ -54,7 +54,7 @@ class FormElement {
54
54
  /**
55
55
  * Enable any inputs or selects inside form element
56
56
  */
57
- enable() {
57
+ enable () {
58
58
  for (let i = 0; i < this.inputs.length; i++) {
59
59
  this.inputs[i].disabled = false;
60
60
  }
@@ -64,14 +64,14 @@ class FormElement {
64
64
  * Get the value of the form element
65
65
  * Assumes the first input or select is what's required
66
66
  */
67
- value() {
67
+ value () {
68
68
  return this.$el.querySelector('input,select').value;
69
69
  }
70
70
 
71
71
  /**
72
72
  * Make firts input element required
73
73
  */
74
- makeRequired() {
74
+ makeRequired () {
75
75
  if (this.inputs && this.inputs.length) {
76
76
  this.inputs[0].required = true;
77
77
  }
@@ -81,7 +81,7 @@ class FormElement {
81
81
  /**
82
82
  * Make firts input element not required (optional)
83
83
  */
84
- makeOptional() {
84
+ makeOptional () {
85
85
  if (this.inputs && this.inputs.length) {
86
86
  this.inputs[0].required = false;
87
87
  }
package/utils/loader.js CHANGED
@@ -12,7 +12,7 @@ class Loader {
12
12
  * @throws If the document not passed
13
13
  * @throws When the loader element not found
14
14
  */
15
- constructor(element) {
15
+ constructor (element) {
16
16
  if (!element) {
17
17
  throw new Error('Please supply a DOM element');
18
18
  }
@@ -38,7 +38,7 @@ class Loader {
38
38
  /**
39
39
  * Clear the content.
40
40
  */
41
- clearContent() {
41
+ clearContent () {
42
42
  this.$loaderContent.innerHTML = '';
43
43
  }
44
44
 
@@ -48,7 +48,7 @@ class Loader {
48
48
  * @param {string} title The HTML markup/string containing the title of the message.
49
49
  * @param {string} content The HTML markup/string containing the main content of the message.
50
50
  */
51
- setContent({ title, content }) {
51
+ setContent ({ title, content }) {
52
52
  if (title) {
53
53
  if (!this.$loaderContentTitle) {
54
54
  this.$loaderContentTitle = document.createElement('div');
@@ -70,7 +70,7 @@ class Loader {
70
70
  *
71
71
  * @param {object} content The optional content to set *before* showing the loader.
72
72
  */
73
- show(content) {
73
+ show (content) {
74
74
  this._previouslyFocused = document.activeElement;
75
75
 
76
76
  if (content) {
@@ -88,7 +88,7 @@ class Loader {
88
88
  *
89
89
  * @param {object} content The optional content to set *before* showing the loader.
90
90
  */
91
- showAndPreventTabbing(content) {
91
+ showAndPreventTabbing (content) {
92
92
  this.show(content);
93
93
 
94
94
  this.element.addEventListener('keydown', this.interceptTab);
@@ -97,7 +97,7 @@ class Loader {
97
97
  /**
98
98
  * Hide the loader
99
99
  */
100
- hide() {
100
+ hide () {
101
101
  this.$loader.classList.add(this.HIDDEN_CLASS);
102
102
  this.$loader.classList.remove(this.VISIBLE_CLASS);
103
103
  this.$loader.removeAttribute('tabindex');
@@ -114,7 +114,7 @@ class Loader {
114
114
  * Intercepts Tab key events that normally navigate through the content on the page.
115
115
  * @param {object} event The event object for the keypress.
116
116
  */
117
- interceptTab(event) {
117
+ interceptTab (event) {
118
118
  if (event.keyCode === 9) {
119
119
  event.preventDefault();
120
120
  }
@@ -125,7 +125,7 @@ class Loader {
125
125
  * @param {DOMElement} element Show loader over this
126
126
  * @param {Object} content Content for the loader in standard format
127
127
  */
128
- showOnElement(element, content) {
128
+ showOnElement (element, content) {
129
129
  const existingLoader = element.querySelector('.ncf__loader');
130
130
  const loader = new DOMParser()
131
131
  .parseFromString(this.template(content), 'text/html')
@@ -142,7 +142,7 @@ class Loader {
142
142
  * Remove loader from a given element
143
143
  * @param {DOMElement} element Loader inside
144
144
  */
145
- removeFromElement(element) {
145
+ removeFromElement (element) {
146
146
  element.querySelector('.ncf__loader').remove();
147
147
  }
148
148
 
@@ -151,7 +151,7 @@ class Loader {
151
151
  * @param {String} title
152
152
  * @param {String} content
153
153
  */
154
- template({ title = 'Loading', content = '' }) {
154
+ template ({ title = 'Loading', content = '' }) {
155
155
  return `
156
156
  <div class="ncf__loader is-visible ncf__loader--element"
157
157
  role="dialog"
package/utils/password.js CHANGED
@@ -13,7 +13,7 @@ class Password {
13
13
  * @throws If the document not passed
14
14
  * @throws When the password element not found
15
15
  */
16
- constructor(element) {
16
+ constructor (element) {
17
17
  if (!element) {
18
18
  throw new Error('Please supply a DOM element');
19
19
  }
@@ -34,7 +34,7 @@ class Password {
34
34
  * Toggle whether the password is shown in plain text or not
35
35
  * @param {Boolean} mask Pass false to show plain text
36
36
  */
37
- toggleMask(mask) {
37
+ toggleMask (mask) {
38
38
  this.$password.type = mask ? 'password' : 'text';
39
39
  }
40
40
  }
@@ -28,7 +28,7 @@ class PaymentTerm {
28
28
  * @throws If the document not passed
29
29
  * @throws When the paymentTermField element not found
30
30
  */
31
- constructor(element) {
31
+ constructor (element) {
32
32
  if (!element) {
33
33
  throw new Error('Please supply a DOM element');
34
34
  }
@@ -46,7 +46,7 @@ class PaymentTerm {
46
46
  * @return {String}
47
47
  * @throws If nothing has been selected
48
48
  */
49
- getSelected() {
49
+ getSelected () {
50
50
  const checked = this.$paymentTerm.querySelector('input:checked');
51
51
  if (!checked) {
52
52
  throw new Error('No payment term has been selected');
@@ -59,7 +59,7 @@ class PaymentTerm {
59
59
  * @return {Number}
60
60
  * @throws If no payment term has been selected
61
61
  */
62
- getBaseAmount() {
62
+ getBaseAmount () {
63
63
  const checked = this.$paymentTerm.querySelector('input:checked');
64
64
  if (!checked) {
65
65
  throw new Error('No payment term has been selected');
@@ -71,7 +71,7 @@ class PaymentTerm {
71
71
  * Register on change an event listener
72
72
  * @param {Function} callback Called with event when changed
73
73
  */
74
- onChange(callback = () => {}) {
74
+ onChange (callback = () => {}) {
75
75
  return this.$paymentTerm.addEventListener('change', callback);
76
76
  }
77
77
 
@@ -79,7 +79,7 @@ class PaymentTerm {
79
79
  * Update the payment term options
80
80
  * @param {Array} options Array of objects contain terms information
81
81
  */
82
- updateOptions(options) {
82
+ updateOptions (options) {
83
83
  const terms = this.$paymentTerm.querySelectorAll(ITEM_CLASS);
84
84
  for (let i = 0; i < terms.length; i++) {
85
85
  const term = terms[i];
@@ -16,7 +16,7 @@ class PaymentType {
16
16
  * @throws If the document not passed
17
17
  * @throws When the paymentTypeField element not found
18
18
  */
19
- constructor(element) {
19
+ constructor (element) {
20
20
  if (!element) {
21
21
  throw new Error('Please supply a DOM element');
22
22
  }
@@ -46,7 +46,7 @@ class PaymentType {
46
46
  * Hides and removes from the DOM the payment type given
47
47
  * @param {String} type Payment type to hide
48
48
  */
49
- hide(type) {
49
+ hide (type) {
50
50
  const container = this.$paymentType.querySelector(`#${type}`).parentElement
51
51
  .parentElement;
52
52
  container.classList.add('ncf__hidden');
@@ -57,7 +57,7 @@ class PaymentType {
57
57
  * cloning existing payment types
58
58
  * @param {String} type Payment type to show
59
59
  */
60
- show(type) {
60
+ show (type) {
61
61
  const container = this.$paymentType.querySelector(`#${type}`).parentElement
62
62
  .parentElement;
63
63
  container.classList.remove('ncf__hidden');
@@ -66,14 +66,14 @@ class PaymentType {
66
66
  /**
67
67
  * Display an error message on the paymentType
68
68
  */
69
- displayError() {
69
+ displayError () {
70
70
  this.$paymentType.classList.add('o-forms-input--invalid');
71
71
  }
72
72
 
73
73
  /**
74
74
  * Remove an error from display
75
75
  */
76
- removeError() {
76
+ removeError () {
77
77
  this.$paymentType.classList.remove('o-forms-input--invalid');
78
78
  }
79
79
 
@@ -81,7 +81,7 @@ class PaymentType {
81
81
  * Register on change an event listener
82
82
  * @param {Function} callback Called with event when changed
83
83
  */
84
- onChange(callback = () => {}) {
84
+ onChange (callback = () => {}) {
85
85
  return this.$paymentType.addEventListener('change', callback);
86
86
  }
87
87
 
@@ -90,7 +90,7 @@ class PaymentType {
90
90
  * @return {String}
91
91
  * @throws If nothing has been selected
92
92
  */
93
- getSelected() {
93
+ getSelected () {
94
94
  const checked = this.$paymentType.querySelector('input:checked');
95
95
  if (!checked) {
96
96
  throw new Error('No payment type has been selected');
@@ -101,7 +101,7 @@ class PaymentType {
101
101
  /**
102
102
  * Show the payment types panel
103
103
  */
104
- showPanel() {
104
+ showPanel () {
105
105
  const type = this.getSelected();
106
106
  const content = this.$paymentType.querySelectorAll(
107
107
  '.ncf__payment-type-panel'
@@ -116,19 +116,19 @@ class PaymentType {
116
116
  }
117
117
  }
118
118
 
119
- static get CREDITCARD() {
119
+ static get CREDITCARD () {
120
120
  return 'creditcard';
121
121
  }
122
122
 
123
- static get DIRECTDEBIT() {
123
+ static get DIRECTDEBIT () {
124
124
  return 'directdebit';
125
125
  }
126
126
 
127
- static get PAYPAL() {
127
+ static get PAYPAL () {
128
128
  return 'paypal';
129
129
  }
130
130
 
131
- static get APPLEPAY() {
131
+ static get APPLEPAY () {
132
132
  return 'applepay';
133
133
  }
134
134
  }