@financial-times/n-conversion-forms 45.0.0 → 45.2.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "af67cefb78210e23aab60a7c27b2a97b79880e2e",
5
- "tag": "v45.0.0",
6
- "buildNumber": "17972"
4
+ "version": "7cb3814b5ef6dccca5d29636c4cf6cf98eb37b52",
5
+ "tag": "v45.2.0",
6
+ "buildNumber": "18122"
7
7
  }
@@ -1,5 +1,102 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`Confirmation renders appropriately if a confirmation email has been sent 1`] = `
4
+ <div class="ncf ncf__wrapper">
5
+ <div class="ncf__center">
6
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
7
+ </div>
8
+ <p class="ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation">
9
+ You are now subscribed to:
10
+ </p>
11
+ <h1 class="ncf__header ncf__header--confirmation">
12
+ </h1>
13
+ </div>
14
+ <p class="ncf__paragraph">
15
+ We’ve sent confirmation to your email. Make sure you check your spam folder if you don’t receive it.
16
+ </p>
17
+ <p class="ncf__paragraph">
18
+ Here’s a summary of your subscription:
19
+ </p>
20
+ <div class="ncf__headed-paragraph">
21
+ <h3 class="ncf__header">
22
+ Something not right?
23
+ </h3>
24
+ <p class="ncf__paragraph o3-type-body-base">
25
+ Go to your
26
+ <a href="https://www.ft.com/myaccount/personal-details"
27
+ target="_blank"
28
+ rel="noopener noreferrer"
29
+ data-trackable="yourAccount"
30
+ >
31
+ account settings
32
+ </a>
33
+ to view or edit your account. If you need to get in touch call us on
34
+ <a href="tel:+442077556248">
35
+ +44 (0) 207 755 6248
36
+ </a>
37
+ . Or contact us for additional support.
38
+ </p>
39
+ </div>
40
+ <p class="ncf__paragraph o3-type-body-base">
41
+ We will automatically renew your subscription using the payment method provided unless you cancel before your renewal date. See our
42
+ <a href="http://help.ft.com/help/legal-privacy/terms-conditions/"
43
+ target="_top"
44
+ rel="noopener"
45
+ >
46
+ Terms &amp; Conditions
47
+ </a>
48
+ for details on how to cancel.
49
+ </p>
50
+ </div>
51
+ `;
52
+
53
+ exports[`Confirmation renders appropriately if a confirmation email has not been sent 1`] = `
54
+ <div class="ncf ncf__wrapper">
55
+ <div class="ncf__center">
56
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
57
+ </div>
58
+ <p class="ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation">
59
+ You are now subscribed to:
60
+ </p>
61
+ <h1 class="ncf__header ncf__header--confirmation">
62
+ </h1>
63
+ </div>
64
+ <p class="ncf__paragraph">
65
+ Here’s a summary of your subscription:
66
+ </p>
67
+ <div class="ncf__headed-paragraph">
68
+ <h3 class="ncf__header">
69
+ Something not right?
70
+ </h3>
71
+ <p class="ncf__paragraph o3-type-body-base">
72
+ Go to your
73
+ <a href="https://www.ft.com/myaccount/personal-details"
74
+ target="_blank"
75
+ rel="noopener noreferrer"
76
+ data-trackable="yourAccount"
77
+ >
78
+ account settings
79
+ </a>
80
+ to view or edit your account. If you need to get in touch call us on
81
+ <a href="tel:+442077556248">
82
+ +44 (0) 207 755 6248
83
+ </a>
84
+ . Or contact us for additional support.
85
+ </p>
86
+ </div>
87
+ <p class="ncf__paragraph o3-type-body-base">
88
+ We will automatically renew your subscription using the payment method provided unless you cancel before your renewal date. See our
89
+ <a href="http://help.ft.com/help/legal-privacy/terms-conditions/"
90
+ target="_top"
91
+ rel="noopener"
92
+ >
93
+ Terms &amp; Conditions
94
+ </a>
95
+ for details on how to cancel.
96
+ </p>
97
+ </div>
98
+ `;
99
+
3
100
  exports[`Confirmation renders appropriately if is 'Evergreen' subscription term type 1`] = `
4
101
  <div class="ncf ncf__wrapper">
5
102
  <div class="ncf__center">
@@ -13,7 +13,7 @@ exports[`DeliveryStartDate renders with a custom date 1`] = `
13
13
  Start date
14
14
  </span>
15
15
  <span class="o-forms-title__prompt">
16
- Earliest available delivery date: 5th November 2019
16
+ Earliest available start date: 5th November 2019
17
17
  </span>
18
18
  </span>
19
19
  <span class="o-forms-input o-forms-input--text">
@@ -51,7 +51,7 @@ exports[`DeliveryStartDate renders with a custom input max value 1`] = `
51
51
  Start date
52
52
  </span>
53
53
  <span class="o-forms-title__prompt">
54
- Earliest available delivery date: 2
54
+ Earliest available start date: 2
55
55
  </span>
56
56
  </span>
57
57
  <span class="o-forms-input o-forms-input--text">
@@ -89,7 +89,7 @@ exports[`DeliveryStartDate renders with a custom input min value 1`] = `
89
89
  Start date
90
90
  </span>
91
91
  <span class="o-forms-title__prompt">
92
- Earliest available delivery date:
92
+ Earliest available start date:
93
93
  </span>
94
94
  </span>
95
95
  <span class="o-forms-input o-forms-input--text">
@@ -127,7 +127,7 @@ exports[`DeliveryStartDate renders with a custom input value 1`] = `
127
127
  Start date
128
128
  </span>
129
129
  <span class="o-forms-title__prompt">
130
- Earliest available delivery date:
130
+ Earliest available start date:
131
131
  </span>
132
132
  </span>
133
133
  <span class="o-forms-input o-forms-input--text">
@@ -164,7 +164,7 @@ exports[`DeliveryStartDate renders with a disabled input 1`] = `
164
164
  Start date
165
165
  </span>
166
166
  <span class="o-forms-title__prompt">
167
- Earliest available delivery date:
167
+ Earliest available start date:
168
168
  </span>
169
169
  </span>
170
170
  <span class="o-forms-input o-forms-input--text">
@@ -202,7 +202,7 @@ exports[`DeliveryStartDate renders with an error 1`] = `
202
202
  Start date
203
203
  </span>
204
204
  <span class="o-forms-title__prompt">
205
- Earliest available delivery date:
205
+ Earliest available start date:
206
206
  </span>
207
207
  </span>
208
208
  <span class="o-forms-input o-forms-input--text o-forms-input--invalid">
@@ -239,7 +239,7 @@ exports[`DeliveryStartDate renders with appropriate start message when isAddress
239
239
  Start date
240
240
  </span>
241
241
  <span class="o-forms-title__prompt">
242
- Earliest available delivery date:
242
+ Earliest available start date:
243
243
  </span>
244
244
  </span>
245
245
  <span class="o-forms-input o-forms-input--text">
@@ -263,6 +263,43 @@ exports[`DeliveryStartDate renders with appropriate start message when isAddress
263
263
  </label>
264
264
  `;
265
265
 
266
+ exports[`DeliveryStartDate renders with appropriate start message when isPaperVoucherDeliveryOptionOnly 1`] = `
267
+ <label id="deliveryStartDateField"
268
+ class="o-forms-field ncf__validation-error"
269
+ data-validate="required"
270
+ for="deliveryStartDate"
271
+ >
272
+ <span class="o-forms-title">
273
+ <span class="o-forms-title__main"
274
+ id="start-date-picker-title-span"
275
+ >
276
+ Start date
277
+ </span>
278
+ <span class="o-forms-title__prompt">
279
+ Earliest available start date:
280
+ </span>
281
+ </span>
282
+ <span class="o-forms-input o-forms-input--text">
283
+ <input type="date"
284
+ id="deliveryStartDate"
285
+ name="deliveryStartDate"
286
+ data-trackable="field-deliveryStartDate"
287
+ aria-required="true"
288
+ required
289
+ value
290
+ >
291
+ <span class="o-forms-input__error">
292
+ Please select a valid start date
293
+ </span>
294
+ </span>
295
+ <p>
296
+ Your vouchers will be valid from:
297
+ <strong class="js-start-date-text">
298
+ </strong>
299
+ </p>
300
+ </label>
301
+ `;
302
+
266
303
  exports[`DeliveryStartDate renders with country different than default 1`] = `
267
304
  <label id="deliveryStartDateField"
268
305
  class="o-forms-field ncf__validation-error"
@@ -276,7 +313,7 @@ exports[`DeliveryStartDate renders with country different than default 1`] = `
276
313
  Start date
277
314
  </span>
278
315
  <span class="o-forms-title__prompt">
279
- Earliest available delivery date:
316
+ Earliest available start date:
280
317
  </span>
281
318
  </span>
282
319
  <span class="o-forms-input o-forms-input--text">
@@ -313,7 +350,7 @@ exports[`DeliveryStartDate renders with default props 1`] = `
313
350
  Start date
314
351
  </span>
315
352
  <span class="o-forms-title__prompt">
316
- Earliest available delivery date:
353
+ Earliest available start date:
317
354
  </span>
318
355
  </span>
319
356
  <span class="o-forms-input o-forms-input--text">
@@ -8,6 +8,7 @@ export function Confirmation({
8
8
  isTrial = false,
9
9
  isB2cPartnership = false,
10
10
  b2cPartnershipCopy = [],
11
+ sendConfirmationEmail = true,
11
12
  isEvergreenSubscriptionTermType = true,
12
13
  offer = '',
13
14
  email = EMAIL_DEFAULT_TEXT,
@@ -69,7 +70,7 @@ export function Confirmation({
69
70
  </div>
70
71
 
71
72
  {nextActionTop}
72
- {!isB2cPartnershipCopyAvailable && (
73
+ {sendConfirmationEmail && !isB2cPartnershipCopyAvailable && (
73
74
  <p className="ncf__paragraph">
74
75
  We’ve sent confirmation to {email}. Make sure you check your spam
75
76
  folder if you don’t receive it.
@@ -136,6 +137,7 @@ Confirmation.propTypes = {
136
137
  isTrial: PropTypes.bool,
137
138
  isB2cPartnership: PropTypes.bool,
138
139
  b2cPartnershipCopy: PropTypes.array,
140
+ sendConfirmationEmail: PropTypes.bool,
139
141
  isEvergreenSubscriptionTermType: PropTypes.bool,
140
142
  offer: PropTypes.string.isRequired,
141
143
  email: PropTypes.string,
@@ -41,7 +41,23 @@ describe('Confirmation', () => {
41
41
  it("renders appropriately if is 'Termed' subscription term type", () => {
42
42
  const props = {
43
43
  isEvergreenSubscriptionTermType: false,
44
- isTermedSubscriptionTermType: true,
44
+ isTermedSubscriptionTermType: false,
45
+ };
46
+
47
+ expect(Confirmation).toRenderCorrectly(props);
48
+ });
49
+
50
+ it('renders appropriately if a confirmation email has been sent', () => {
51
+ const props = {
52
+ sendConfirmationEmail: true,
53
+ };
54
+
55
+ expect(Confirmation).toRenderCorrectly(props);
56
+ });
57
+
58
+ it('renders appropriately if a confirmation email has not been sent', () => {
59
+ const props = {
60
+ sendConfirmationEmail: false,
45
61
  };
46
62
 
47
63
  expect(Confirmation).toRenderCorrectly(props);
@@ -65,6 +65,7 @@ Basic.args = {
65
65
 
66
66
  export const TermedSubscriptionTermType = (args) => <Confirmation {...args} />;
67
67
  TermedSubscriptionTermType.args = {
68
+ sendConfirmationEmail: false,
68
69
  isTermedSubscriptionTermType: true,
69
70
  offer: 'Single-term subscription',
70
71
  details: [
@@ -10,6 +10,8 @@ export function DeliveryOption({
10
10
  productCode = undefined,
11
11
  options = [],
12
12
  isSingle = false,
13
+ isEvergreenSubscriptionTermType = true,
14
+ isTermedSubscriptionTermType = false,
13
15
  }) {
14
16
  const divClassName = classNames([
15
17
  'o-forms-field',
@@ -34,6 +36,8 @@ export function DeliveryOption({
34
36
  option,
35
37
  shippingZone,
36
38
  countryCode,
39
+ isEvergreenSubscriptionTermType,
40
+ isTermedSubscriptionTermType,
37
41
  });
38
42
 
39
43
  if (!isValidDeliveryOption || !deliveryOptionValue) {
@@ -96,4 +100,6 @@ DeliveryOption.propTypes = {
96
100
  })
97
101
  ),
98
102
  isSingle: PropTypes.bool,
103
+ isEvergreenSubscriptionTermType: PropTypes.bool,
104
+ isTermedSubscriptionTermType: PropTypes.bool,
99
105
  };
@@ -34,6 +34,40 @@ Basic.args = {
34
34
  ],
35
35
  };
36
36
 
37
+ export const UKPaperVoucherEvergreenDeliveryOptions = (args) => (
38
+ <div className="ncf">
39
+ <DeliveryOption {...args} />
40
+ </div>
41
+ );
42
+ UKPaperVoucherEvergreenDeliveryOptions.args = {
43
+ country: 'GBR',
44
+ options: [
45
+ {
46
+ value: 'PV',
47
+ isValidDeliveryOption: true,
48
+ },
49
+ ],
50
+ isEvergreenSubscriptionTermType: true,
51
+ isTermedSubscriptionTermType: false,
52
+ };
53
+
54
+ export const UKPaperVoucherTermedDeliveryOptions = (args) => (
55
+ <div className="ncf">
56
+ <DeliveryOption {...args} />
57
+ </div>
58
+ );
59
+ UKPaperVoucherTermedDeliveryOptions.args = {
60
+ country: 'GBR',
61
+ options: [
62
+ {
63
+ value: 'PV',
64
+ isValidDeliveryOption: true,
65
+ },
66
+ ],
67
+ isEvergreenSubscriptionTermType: false,
68
+ isTermedSubscriptionTermType: true,
69
+ };
70
+
37
71
  export const UnitedStates5or6DaysWeekDeliveryOptions = (args) => (
38
72
  <div className="ncf">
39
73
  <DeliveryOption {...args} />
@@ -10,6 +10,7 @@ export function DeliveryStartDate({
10
10
  max = null,
11
11
  isDisabled = false,
12
12
  isAddressUpdate = false,
13
+ isPaperVoucherDeliveryOptionOnly = false,
13
14
  }) {
14
15
  const inputWrapperClassNames = classNames([
15
16
  'o-forms-input',
@@ -30,9 +31,11 @@ export function DeliveryStartDate({
30
31
  defaultValue: value,
31
32
  };
32
33
 
33
- const startMessage = isAddressUpdate
34
- ? 'We’ll start delivering to this address from:'
35
- : 'The first print edition you will receive is:';
34
+ const startMessage = isPaperVoucherDeliveryOptionOnly
35
+ ? 'Your vouchers will be valid from:'
36
+ : isAddressUpdate
37
+ ? 'We’ll start delivering to this address from:'
38
+ : 'The first print edition you will receive is:';
36
39
 
37
40
  return (
38
41
  <label
@@ -46,7 +49,7 @@ export function DeliveryStartDate({
46
49
  Start date
47
50
  </span>
48
51
  <span className="o-forms-title__prompt">
49
- Earliest available delivery date: {date}
52
+ Earliest available start date: {date}
50
53
  </span>
51
54
  </span>
52
55
 
@@ -72,4 +75,5 @@ DeliveryStartDate.propTypes = {
72
75
  max: PropTypes.string,
73
76
  isDisabled: PropTypes.bool,
74
77
  isAddressUpdate: PropTypes.bool,
78
+ isPaperVoucherDeliveryOptionOnly: PropTypes.bool,
75
79
  };
@@ -52,6 +52,12 @@ describe('DeliveryStartDate', () => {
52
52
  expect(DeliveryStartDate).toRenderCorrectly(props);
53
53
  });
54
54
 
55
+ it('renders with appropriate start message when isPaperVoucherDeliveryOptionOnly', () => {
56
+ const props = { isPaperVoucherDeliveryOptionOnly: true };
57
+
58
+ expect(DeliveryStartDate).toRenderCorrectly(props);
59
+ });
60
+
55
61
  it('renders with country different than default', () => {
56
62
  const props = { country: 'USA' };
57
63
 
@@ -18,6 +18,8 @@ function Confirmation(_ref) {
18
18
  isB2cPartnership = _ref$isB2cPartnership === void 0 ? false : _ref$isB2cPartnership,
19
19
  _ref$b2cPartnershipCo = _ref.b2cPartnershipCopy,
20
20
  b2cPartnershipCopy = _ref$b2cPartnershipCo === void 0 ? [] : _ref$b2cPartnershipCo,
21
+ _ref$sendConfirmation = _ref.sendConfirmationEmail,
22
+ sendConfirmationEmail = _ref$sendConfirmation === void 0 ? true : _ref$sendConfirmation,
21
23
  _ref$isEvergreenSubsc = _ref.isEvergreenSubscriptionTermType,
22
24
  isEvergreenSubscriptionTermType = _ref$isEvergreenSubsc === void 0 ? true : _ref$isEvergreenSubsc,
23
25
  _ref$offer = _ref.offer,
@@ -72,7 +74,7 @@ function Confirmation(_ref) {
72
74
  className: "ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation"
73
75
  }, "You are now subscribed to:"), /*#__PURE__*/_react["default"].createElement("h1", {
74
76
  className: "ncf__header ncf__header--confirmation"
75
- }, offer)), nextActionTop, !isB2cPartnershipCopyAvailable && /*#__PURE__*/_react["default"].createElement("p", {
77
+ }, offer)), nextActionTop, sendConfirmationEmail && !isB2cPartnershipCopyAvailable && /*#__PURE__*/_react["default"].createElement("p", {
76
78
  className: "ncf__paragraph"
77
79
  }, "We\u2019ve sent confirmation to ", email, ". Make sure you check your spam folder if you don\u2019t receive it."), isB2cPartnershipCopyAvailable ? /*#__PURE__*/_react["default"].createElement("p", {
78
80
  className: "ncf__paragraph"
@@ -105,6 +107,7 @@ Confirmation.propTypes = {
105
107
  isTrial: _propTypes["default"].bool,
106
108
  isB2cPartnership: _propTypes["default"].bool,
107
109
  b2cPartnershipCopy: _propTypes["default"].array,
110
+ sendConfirmationEmail: _propTypes["default"].bool,
108
111
  isEvergreenSubscriptionTermType: _propTypes["default"].bool,
109
112
  offer: _propTypes["default"].string.isRequired,
110
113
  email: _propTypes["default"].string,
@@ -19,7 +19,11 @@ function DeliveryOption(_ref) {
19
19
  _ref$options = _ref.options,
20
20
  options = _ref$options === void 0 ? [] : _ref$options,
21
21
  _ref$isSingle = _ref.isSingle,
22
- isSingle = _ref$isSingle === void 0 ? false : _ref$isSingle;
22
+ isSingle = _ref$isSingle === void 0 ? false : _ref$isSingle,
23
+ _ref$isEvergreenSubsc = _ref.isEvergreenSubscriptionTermType,
24
+ isEvergreenSubscriptionTermType = _ref$isEvergreenSubsc === void 0 ? true : _ref$isEvergreenSubsc,
25
+ _ref$isTermedSubscrip = _ref.isTermedSubscriptionTermType,
26
+ isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip;
23
27
  var divClassName = (0, _classnames["default"])(['o-forms-field', 'ncf__delivery-option', {
24
28
  'ncf__delivery-option--single': isSingle
25
29
  }]);
@@ -39,7 +43,9 @@ function DeliveryOption(_ref) {
39
43
  productCode: productCode,
40
44
  option: option,
41
45
  shippingZone: shippingZone,
42
- countryCode: countryCode
46
+ countryCode: countryCode,
47
+ isEvergreenSubscriptionTermType: isEvergreenSubscriptionTermType,
48
+ isTermedSubscriptionTermType: isTermedSubscriptionTermType
43
49
  });
44
50
  if (!isValidDeliveryOption || !deliveryOptionValue) {
45
51
  return null;
@@ -81,5 +87,7 @@ DeliveryOption.propTypes = {
81
87
  flightMarket: _propTypes["default"].bool,
82
88
  mailDelivery: _propTypes["default"].bool
83
89
  })),
84
- isSingle: _propTypes["default"].bool
90
+ isSingle: _propTypes["default"].bool,
91
+ isEvergreenSubscriptionTermType: _propTypes["default"].bool,
92
+ isTermedSubscriptionTermType: _propTypes["default"].bool
85
93
  };
@@ -25,7 +25,9 @@ function DeliveryStartDate(_ref) {
25
25
  _ref$isDisabled = _ref.isDisabled,
26
26
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
27
27
  _ref$isAddressUpdate = _ref.isAddressUpdate,
28
- isAddressUpdate = _ref$isAddressUpdate === void 0 ? false : _ref$isAddressUpdate;
28
+ isAddressUpdate = _ref$isAddressUpdate === void 0 ? false : _ref$isAddressUpdate,
29
+ _ref$isPaperVoucherDe = _ref.isPaperVoucherDeliveryOptionOnly,
30
+ isPaperVoucherDeliveryOptionOnly = _ref$isPaperVoucherDe === void 0 ? false : _ref$isPaperVoucherDe;
29
31
  var inputWrapperClassNames = (0, _classnames["default"])(['o-forms-input', 'o-forms-input--text', {
30
32
  'o-forms-input--invalid': hasError
31
33
  }]);
@@ -44,7 +46,7 @@ function DeliveryStartDate(_ref) {
44
46
  disabled: isDisabled,
45
47
  defaultValue: value
46
48
  });
47
- var startMessage = isAddressUpdate ? 'We’ll start delivering to this address from:' : 'The first print edition you will receive is:';
49
+ var startMessage = isPaperVoucherDeliveryOptionOnly ? 'Your vouchers will be valid from:' : isAddressUpdate ? 'We’ll start delivering to this address from:' : 'The first print edition you will receive is:';
48
50
  return /*#__PURE__*/_react["default"].createElement("label", {
49
51
  id: "deliveryStartDateField",
50
52
  className: "o-forms-field ncf__validation-error",
@@ -57,7 +59,7 @@ function DeliveryStartDate(_ref) {
57
59
  id: "start-date-picker-title-span"
58
60
  }, "Start date"), /*#__PURE__*/_react["default"].createElement("span", {
59
61
  className: "o-forms-title__prompt"
60
- }, "Earliest available delivery date: ", date)), /*#__PURE__*/_react["default"].createElement("span", {
62
+ }, "Earliest available start date: ", date)), /*#__PURE__*/_react["default"].createElement("span", {
61
63
  className: inputWrapperClassNames
62
64
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
63
65
  className: "o-forms-input__error"
@@ -73,5 +75,6 @@ DeliveryStartDate.propTypes = {
73
75
  min: _propTypes["default"].string,
74
76
  max: _propTypes["default"].string,
75
77
  isDisabled: _propTypes["default"].bool,
76
- isAddressUpdate: _propTypes["default"].bool
78
+ isAddressUpdate: _propTypes["default"].bool,
79
+ isPaperVoucherDeliveryOptionOnly: _propTypes["default"].bool
77
80
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "45.0.0",
3
+ "version": "45.2.0",
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": {
@@ -28,27 +28,44 @@ const USA_COUNTRY_CODE = 'USA';
28
28
  const countryCodeToCustomDeliveryOptionsMap = {
29
29
  [JAPAN_COUNTRY_CODE]: {
30
30
  HD: {
31
- description:
31
+ description: () =>
32
32
  'Enjoy delivery of the newspaper to your home or office address.',
33
33
  },
34
34
  ML: {
35
- description:
35
+ description: () =>
36
36
  'Enjoy delivery of the newspaper to your home or office address.',
37
37
  },
38
38
  },
39
39
  [UK_COUNTRY_CODE]: {
40
40
  PV: {
41
41
  title: 'Paper vouchers',
42
- description:
43
- '13-week voucher pack delivered quarterly and redeemable at retailers nationwide.',
42
+ description: ({
43
+ isEvergreenSubscriptionTermType,
44
+ isTermedSubscriptionTermType,
45
+ }) => {
46
+ if (isEvergreenSubscriptionTermType) {
47
+ return '13-week voucher pack delivered quarterly and redeemable at retailers nationwide.';
48
+ }
49
+
50
+ if (isTermedSubscriptionTermType) {
51
+ // Note: This wording relates to a specific offer: UK Retail Sampling
52
+ // • Production environment offer ID: f9f6383d-98fd-4655-9bc8-2b22bfda8bab
53
+ // • Test environment offer ID: 83fd2c19-2899-4e59-8929-aeb1e0cae096
54
+ // Should in the future there be additional offers for
55
+ // Termed subscriptions then this approach will need to be revised.
56
+ return '6 flexible vouchers that can be exchanged for a copy of FT Weekend over a 13-week period at retailers nationwide.';
57
+ }
58
+
59
+ return '';
60
+ },
44
61
  },
45
62
  HD: {
46
63
  title: 'Hand delivery',
47
- description: 'Free delivery to your home or office before 7am.',
64
+ description: () => 'Free delivery to your home or office before 7am.',
48
65
  },
49
66
  EV: {
50
67
  title: 'Electronic vouchers',
51
- description:
68
+ description: () =>
52
69
  'Delivered via email and card, redeemable at retailers nationwide.',
53
70
  },
54
71
  },
@@ -309,12 +326,33 @@ function findCustomDeliveryOption(productCode, option, shippingZone) {
309
326
  return deliveryOption;
310
327
  }
311
328
 
312
- function getDeliveryOption({ productCode, option, shippingZone, countryCode }) {
329
+ function getDeliveryOption({
330
+ productCode,
331
+ option,
332
+ shippingZone,
333
+ countryCode,
334
+ isEvergreenSubscriptionTermType,
335
+ isTermedSubscriptionTermType,
336
+ }) {
337
+ let deliveryOption;
338
+
313
339
  // Custom delivery messages are displayed for certain countries
314
340
  if (
315
341
  Object.keys(countryCodeToCustomDeliveryOptionsMap).includes(countryCode)
316
342
  ) {
317
- return countryCodeToCustomDeliveryOptionsMap[countryCode][option.value];
343
+ deliveryOption =
344
+ countryCodeToCustomDeliveryOptionsMap[countryCode][option.value];
345
+
346
+ const normalisedDeliveryOption = {
347
+ ...deliveryOption,
348
+ // Set `description` value as string returned from function.
349
+ description: deliveryOption?.description({
350
+ isEvergreenSubscriptionTermType,
351
+ isTermedSubscriptionTermType,
352
+ }),
353
+ };
354
+
355
+ return normalisedDeliveryOption;
318
356
  }
319
357
 
320
358
  return (
@@ -141,8 +141,70 @@ describe('Find Custom Delivery Option', () => {
141
141
  });
142
142
  });
143
143
 
144
- describe('Find UK Delivery Option', () => {
145
- it('returns UK EV delivery option', () => {
144
+ describe('find UK Paper Vouchers delivery option', () => {
145
+ describe('Evergreen (i.e. recurring) subscription term type', () => {
146
+ it('returns UK Paper Vouchers delivery option for Evergreen subscription term type', () => {
147
+ const expected = {
148
+ title: 'Paper vouchers',
149
+ description:
150
+ '13-week voucher pack delivered quarterly and redeemable at retailers nationwide.',
151
+ };
152
+
153
+ const deliveryOption = getDeliveryOption({
154
+ productCode: sixDaysProductCode,
155
+ option: { value: 'PV' },
156
+ shippingZone: 'GBR',
157
+ countryCode: 'GBR',
158
+ isEvergreenSubscriptionTermType: true,
159
+ isTermedSubscriptionTermType: false,
160
+ });
161
+
162
+ expect(deliveryOption).toEqual(expected);
163
+ });
164
+ });
165
+
166
+ describe('Termed (i.e. single-term) subscription term type', () => {
167
+ it('returns UK Paper Vouchers delivery option for Termed subscription term type', () => {
168
+ const expected = {
169
+ title: 'Paper vouchers',
170
+ description:
171
+ '6 flexible vouchers that can be exchanged for a copy of FT Weekend over a 13-week period at retailers nationwide.',
172
+ };
173
+
174
+ const deliveryOption = getDeliveryOption({
175
+ productCode: sixDaysProductCode,
176
+ option: { value: 'PV' },
177
+ shippingZone: 'GBR',
178
+ countryCode: 'GBR',
179
+ isEvergreenSubscriptionTermType: false,
180
+ isTermedSubscriptionTermType: true,
181
+ });
182
+
183
+ expect(deliveryOption).toEqual(expected);
184
+ });
185
+ });
186
+ });
187
+
188
+ describe('find UK Hand delivery option', () => {
189
+ it('returns UK Hand delivery option', () => {
190
+ const expected = {
191
+ title: 'Hand delivery',
192
+ description: 'Free delivery to your home or office before 7am.',
193
+ };
194
+
195
+ const deliveryOption = getDeliveryOption({
196
+ productCode: sixDaysProductCode,
197
+ option: { value: 'HD' },
198
+ shippingZone: 'GBR',
199
+ countryCode: 'GBR',
200
+ });
201
+
202
+ expect(deliveryOption).toEqual(expected);
203
+ });
204
+ });
205
+
206
+ describe('find UK Electronic Vouchers delivery option', () => {
207
+ it('returns UK Electronic Vouchers delivery option', () => {
146
208
  const expected = {
147
209
  title: 'Electronic vouchers',
148
210
  description: