@financial-times/n-conversion-forms 20.3.0 → 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 (112) hide show
  1. package/.circleci/config.yml +8 -6
  2. package/.circleci/shared-helpers/helper-npm-install-peer-deps +6 -5
  3. package/.eslintignore +3 -0
  4. package/.github/workflows/gh-pages-deploy.yml +2 -1
  5. package/build-state/npm-shrinkwrap.json +47805 -8576
  6. package/components/__snapshots__/accept-terms.spec.js.snap +94 -6
  7. package/components/__snapshots__/app-banner.spec.js.snap +2 -0
  8. package/components/__snapshots__/confirmation.spec.js.snap +11 -11
  9. package/components/__snapshots__/delivery-address.spec.js.snap +18 -1
  10. package/components/__snapshots__/delivery-postcode.spec.js.snap +24 -4
  11. package/components/__snapshots__/registration-confirmation.spec.js.snap +2 -2
  12. package/components/accept-terms.jsx +67 -9
  13. package/components/accept-terms.spec.js +12 -0
  14. package/components/app-banner.jsx +3 -1
  15. package/components/b2c-partnership-confirmation.jsx +7 -8
  16. package/components/b2c-partnership-confirmation.spec.js +1 -1
  17. package/components/b2c-partnership-payment-term.jsx +5 -2
  18. package/components/billing-country.jsx +1 -1
  19. package/components/billing-postcode.jsx +1 -1
  20. package/components/company-name.spec.js +9 -3
  21. package/components/confirmation.jsx +1 -1
  22. package/components/continue-reading.jsx +1 -1
  23. package/components/country.jsx +3 -2
  24. package/components/customer-care.jsx +1 -1
  25. package/components/debug.jsx +1 -1
  26. package/components/decision-maker.jsx +1 -1
  27. package/components/delivery-address-type.jsx +9 -9
  28. package/components/delivery-address-type.stories.js +10 -2
  29. package/components/delivery-address.jsx +115 -73
  30. package/components/delivery-address.spec.js +3 -1
  31. package/components/delivery-address.stories.js +1 -1
  32. package/components/delivery-city.jsx +2 -2
  33. package/components/delivery-county.jsx +1 -1
  34. package/components/delivery-instructions.jsx +48 -18
  35. package/components/delivery-instructions.spec.js +6 -2
  36. package/components/delivery-option.jsx +6 -2
  37. package/components/delivery-option.spec.js +4 -4
  38. package/components/delivery-option.stories.js +17 -5
  39. package/components/delivery-po-box.jsx +3 -5
  40. package/components/delivery-po-box.spec.js +3 -1
  41. package/components/delivery-po-box.stories.js +1 -1
  42. package/components/delivery-postcode.jsx +19 -3
  43. package/components/delivery-security-instructions.jsx +1 -2
  44. package/components/delivery-start-date.jsx +3 -1
  45. package/components/education-job-title.jsx +1 -1
  46. package/components/email.jsx +1 -1
  47. package/components/error-page.jsx +1 -1
  48. package/components/fieldset.jsx +1 -1
  49. package/components/first-name.jsx +1 -1
  50. package/components/form.jsx +1 -1
  51. package/components/google-sign-in.jsx +8 -4
  52. package/components/google-sign-in.stories.js +2 -1
  53. package/components/graduation-date.jsx +1 -1
  54. package/components/graduation-date.spec.js +1 -9
  55. package/components/industry.jsx +2 -2
  56. package/components/industry.spec.js +3 -1
  57. package/components/job-title.jsx +2 -2
  58. package/components/job-title.spec.js +3 -1
  59. package/components/last-name.jsx +1 -1
  60. package/components/licence-confirmation.jsx +7 -5
  61. package/components/licence-confirmation.stories.js +3 -1
  62. package/components/licence-header.jsx +2 -2
  63. package/components/licence-sign-in.jsx +2 -2
  64. package/components/licence-title.jsx +2 -2
  65. package/components/lite-sub-confirmation.jsx +92 -40
  66. package/components/lite-sub-confirmation.stories.js +3 -3
  67. package/components/loader.jsx +1 -1
  68. package/components/message.jsx +1 -1
  69. package/components/message.spec.jsx +1 -1
  70. package/components/organisation.jsx +1 -1
  71. package/components/package-change.jsx +13 -4
  72. package/components/password.jsx +1 -1
  73. package/components/payment-term.jsx +1 -1
  74. package/components/payment-type.jsx +7 -4
  75. package/components/personal-title.jsx +0 -1
  76. package/components/personal-title.spec.js +8 -6
  77. package/components/phone.jsx +2 -2
  78. package/components/phone.spec.js +3 -1
  79. package/components/position.jsx +2 -2
  80. package/components/position.spec.js +3 -1
  81. package/components/progress-indicator.jsx +4 -4
  82. package/components/registration-confirmation.jsx +1 -1
  83. package/components/responsibility.jsx +3 -5
  84. package/components/responsibility.spec.js +3 -1
  85. package/components/section.jsx +1 -1
  86. package/components/state.jsx +1 -1
  87. package/components/submit.jsx +1 -1
  88. package/components/trial-banner.jsx +1 -1
  89. package/dist/accept-terms.js +40 -5
  90. package/dist/app-banner.js +4 -2
  91. package/dist/confirmation.js +1 -1
  92. package/dist/delivery-address.js +15 -5
  93. package/dist/delivery-postcode.js +14 -2
  94. package/dist/delivery-security-instructions.js +0 -1
  95. package/dist/graduation-date.js +1 -1
  96. package/dist/index.js +42 -42
  97. package/dist/lite-sub-confirmation.js +7 -7
  98. package/dist/package-change.js +1 -1
  99. package/dist/payment-type.js +1 -1
  100. package/dist/registration-confirmation.js +1 -1
  101. package/jest.config.js +6 -1
  102. package/package.json +24 -13
  103. package/utils/billing-country.js +2 -3
  104. package/utils/company-name.spec.js +11 -3
  105. package/utils/delivery-address-type.js +4 -1
  106. package/utils/delivery-address-type.spec.js +11 -3
  107. package/utils/delivery-option-messages.js +61 -32
  108. package/utils/delivery-option-messages.spec.js +42 -12
  109. package/utils/delivery-option.js +14 -7
  110. package/utils/delivery-option.spec.js +7 -3
  111. package/utils/delivery-start-date.js +5 -3
  112. package/utils/zuora.js +6 -1
@@ -13,18 +13,24 @@ describe('Find Custom Delivery Option', () => {
13
13
  });
14
14
 
15
15
  it('should return undefined when other country than custom messages', () => {
16
- expect(getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')).toBeUndefined();
16
+ expect(
17
+ getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')
18
+ ).toBeUndefined();
17
19
  });
18
20
 
19
21
  it('should return undefined when invalid distributor type code', () => {
20
22
  const option = { ...stubOption, value: 'ZZ' };
21
- expect(getDeliveryOption(sixDaysProductCode, option, 'USA')).toBeUndefined();
23
+ expect(
24
+ getDeliveryOption(sixDaysProductCode, option, 'USA')
25
+ ).toBeUndefined();
22
26
  });
23
27
 
24
28
  it('should return undefined when mailDelivery is false and not other required props are setup', () => {
25
29
  stubOption.deliveryOnPublicationDate = undefined;
26
30
  stubOption.flightMarket = undefined;
27
- expect(getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')).toBeUndefined();
31
+ expect(
32
+ getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')
33
+ ).toBeUndefined();
28
34
  });
29
35
  });
30
36
 
@@ -38,10 +44,15 @@ describe('Find Custom Delivery Option', () => {
38
44
  stubOption.flightMarket = false;
39
45
  const expected = {
40
46
  title: 'Hand delivery',
41
- description: 'Enjoy delivery of the newspaper daily to your home or office address.',
47
+ description:
48
+ 'Enjoy delivery of the newspaper daily to your home or office address.',
42
49
  };
43
50
 
44
- const deliveryOption = getDeliveryOption(sixDaysProductCode, stubOption, 'USA');
51
+ const deliveryOption = getDeliveryOption(
52
+ sixDaysProductCode,
53
+ stubOption,
54
+ 'USA'
55
+ );
45
56
 
46
57
  expect(deliveryOption).toEqual(expected);
47
58
  });
@@ -51,10 +62,15 @@ describe('Find Custom Delivery Option', () => {
51
62
  stubOption.flightMarket = false;
52
63
  const expected = {
53
64
  title: 'Hand delivery',
54
- description: 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: Your FT Weekend will be delivered on Sunday.',
65
+ description:
66
+ 'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: Your FT Weekend will be delivered on Sunday.',
55
67
  };
56
68
 
57
- const deliveryOption = getDeliveryOption(weekendProductCode, stubOption, 'USA');
69
+ const deliveryOption = getDeliveryOption(
70
+ weekendProductCode,
71
+ stubOption,
72
+ 'USA'
73
+ );
58
74
 
59
75
  expect(deliveryOption).toEqual(expected);
60
76
  });
@@ -69,10 +85,15 @@ describe('Find Custom Delivery Option', () => {
69
85
  const expected = {
70
86
  title: 'Mail',
71
87
  customId: 'ML',
72
- description: '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.',
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.',
73
90
  };
74
91
 
75
- const deliveryOption = getDeliveryOption(sixDaysProductCode, stubOption, 'USA');
92
+ const deliveryOption = getDeliveryOption(
93
+ sixDaysProductCode,
94
+ stubOption,
95
+ 'USA'
96
+ );
76
97
 
77
98
  expect(deliveryOption).toEqual(expected);
78
99
  });
@@ -81,10 +102,15 @@ describe('Find Custom Delivery Option', () => {
81
102
  const expected = {
82
103
  title: 'Mail',
83
104
  customId: 'ML',
84
- description: '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.',
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.',
85
107
  };
86
108
 
87
- const deliveryOption = getDeliveryOption(weekendProductCode, stubOption, 'CAN');
109
+ const deliveryOption = getDeliveryOption(
110
+ weekendProductCode,
111
+ stubOption,
112
+ 'CAN'
113
+ );
88
114
 
89
115
  expect(deliveryOption).toEqual(expected);
90
116
  });
@@ -98,7 +124,11 @@ describe('Find Custom Delivery Option', () => {
98
124
  'Delivered via email and card, redeemable at retailers nationwide.',
99
125
  };
100
126
 
101
- const deliveryOption = getDeliveryOption(sixDaysProductCode, { value: 'EV' }, 'GBR');
127
+ const deliveryOption = getDeliveryOption(
128
+ sixDaysProductCode,
129
+ { value: 'EV' },
130
+ 'GBR'
131
+ );
102
132
 
103
133
  expect(deliveryOption).toEqual(expected);
104
134
  });
@@ -29,7 +29,10 @@ class DeliveryOption {
29
29
  */
30
30
  handleDeliveryOptionChange (callback) {
31
31
  if (this.$form.elements['deliveryOption'].length === undefined) {
32
- this.$form.elements['deliveryOption'].addEventListener('change', callback);
32
+ this.$form.elements['deliveryOption'].addEventListener(
33
+ 'change',
34
+ callback
35
+ );
33
36
  } else {
34
37
  for (let option of [...this.$form.elements['deliveryOption']]) {
35
38
  option.addEventListener('change', callback);
@@ -41,8 +44,10 @@ class DeliveryOption {
41
44
  * Hide a specific radio input item.
42
45
  */
43
46
  hideItem (itemId) {
44
- const labelNodes = this.$form.querySelectorAll('.ncf__delivery-option__item');
45
- const item = Array.from(labelNodes).find(node => node.htmlFor === itemId);
47
+ const labelNodes = this.$form.querySelectorAll(
48
+ '.ncf__delivery-option__item'
49
+ );
50
+ const item = Array.from(labelNodes).find((node) => node.htmlFor === itemId);
46
51
  if (item) {
47
52
  item.classList.add('ncf__hidden');
48
53
  }
@@ -52,8 +57,10 @@ class DeliveryOption {
52
57
  * Show a specific radio input item.
53
58
  */
54
59
  showItem (itemId) {
55
- const labelNodes = this.$form.querySelectorAll('.ncf__delivery-option__item');
56
- const item = Array.from(labelNodes).find(node => node.htmlFor === itemId);
60
+ const labelNodes = this.$form.querySelectorAll(
61
+ '.ncf__delivery-option__item'
62
+ );
63
+ const item = Array.from(labelNodes).find((node) => node.htmlFor === itemId);
57
64
  if (item) {
58
65
  item.classList.remove('ncf__hidden');
59
66
  }
@@ -64,11 +71,11 @@ class DeliveryOption {
64
71
  */
65
72
  checkItem (itemId) {
66
73
  const inputNodes = this.$form.elements['deliveryOption'];
67
- const item = Array.from(inputNodes).find(node => node.id === itemId);
74
+ const item = Array.from(inputNodes).find((node) => node.id === itemId);
68
75
  if (item) {
69
76
  item.checked = true;
70
77
  }
71
- };
78
+ }
72
79
  }
73
80
 
74
81
  module.exports = DeliveryOption;
@@ -30,10 +30,14 @@ describe('Delivery Option - Util', () => {
30
30
  country: 'GBR',
31
31
  options: [
32
32
  { value: 'HD', isSelected: true, isValidDeliveryOption: true },
33
- { value: 'PV', isSelected: false, isValidDeliveryOption: true }
34
- ]
33
+ { value: 'PV', isSelected: false, isValidDeliveryOption: true },
34
+ ],
35
35
  };
36
- const component = mount(<Form ><DeliveryOption {...props} /></Form>);
36
+ const component = mount(
37
+ <Form>
38
+ <DeliveryOption {...props} />
39
+ </Form>
40
+ );
37
41
  const dom = new JSDOM(`
38
42
  <!DOCTYPE html>
39
43
  <html>
@@ -6,7 +6,6 @@ const fetchres = require('fetchres');
6
6
  * const deliveryStartDate = new DeliveryStartDate(document);
7
7
  */
8
8
  class DeliveryStartDate {
9
-
10
9
  /**
11
10
  * Initalise the DeliveryStartDate utility
12
11
  * @param {Element} element Usually the window.document
@@ -35,7 +34,9 @@ class DeliveryStartDate {
35
34
  // to use if datepicker isn't available
36
35
  // from https://stackoverflow.com/questions/10193294/how-can-i-tell-if-a-browser-supports-input-type-date
37
36
 
38
- this.$deliveryStartDateTitleSpan = element.querySelector('#start-date-picker-title-span');
37
+ this.$deliveryStartDateTitleSpan = element.querySelector(
38
+ '#start-date-picker-title-span'
39
+ );
39
40
 
40
41
  const checkDateInput = () => {
41
42
  let input = element.createElement('input');
@@ -60,7 +61,8 @@ class DeliveryStartDate {
60
61
  * @throws If there was an error calling the endpoint to check this.
61
62
  */
62
63
  async handleDeliveryStartDateChange (url, getData) {
63
- const isNewValue = (this.previousDeliveryDateValue !== this.$deliveryStartDate.value);
64
+ const isNewValue =
65
+ this.previousDeliveryDateValue !== this.$deliveryStartDate.value;
64
66
  this.previousDeliveryDateValue = this.$deliveryStartDate.value;
65
67
 
66
68
  if (this.$deliveryStartDate.value && isNewValue) {
package/utils/zuora.js CHANGED
@@ -155,7 +155,12 @@ class Zuora {
155
155
  const agreementSupportedBrands = 'Visa,Mastercard';
156
156
  const mitConsentAgreementRef = 'createStoredCredentialProfile';
157
157
 
158
- return this.Z.setAgreement(mitConsentAgreementSrc, mitProfileType, agreementSupportedBrands, mitConsentAgreementRef);
158
+ return this.Z.setAgreement(
159
+ mitConsentAgreementSrc,
160
+ mitProfileType,
161
+ agreementSupportedBrands,
162
+ mitConsentAgreementRef
163
+ );
159
164
  }
160
165
 
161
166
  /**