@financial-times/n-conversion-forms 37.0.0 → 37.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,6 +1,6 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "386e3356ff251ce8366db3384b1648521b3fd5b6",
5
- "tag": "v37.0.0"
4
+ "version": "e6de5072ce6f5873fcf887ed859149b61ca0ed6b",
5
+ "tag": "v37.2.0"
6
6
  }
@@ -10,10 +10,10 @@ exports[`DeliveryStartDate renders with a custom date 1`] = `
10
10
  <span class="o-forms-title__main"
11
11
  id="start-date-picker-title-span"
12
12
  >
13
- Delivery start date
13
+ Start date
14
14
  </span>
15
15
  <span class="o-forms-title__prompt">
16
- Earliest available delivery date: 5th November 2019
16
+ The first print edition you will receive is: 5th November 2019
17
17
  </span>
18
18
  </span>
19
19
  <span class="o-forms-input o-forms-input--text">
@@ -29,12 +29,6 @@ exports[`DeliveryStartDate renders with a custom date 1`] = `
29
29
  Please select a valid start date
30
30
  </span>
31
31
  </span>
32
- <p>
33
- The first print edition you will receive is:
34
- <strong class="js-start-date-text">
35
- 5th November 2019
36
- </strong>
37
- </p>
38
32
  </label>
39
33
  `;
40
34
 
@@ -48,10 +42,10 @@ exports[`DeliveryStartDate renders with a custom input max value 1`] = `
48
42
  <span class="o-forms-title__main"
49
43
  id="start-date-picker-title-span"
50
44
  >
51
- Delivery start date
45
+ Start date
52
46
  </span>
53
47
  <span class="o-forms-title__prompt">
54
- Earliest available delivery date: 2
48
+ The first print edition you will receive is: 2
55
49
  </span>
56
50
  </span>
57
51
  <span class="o-forms-input o-forms-input--text">
@@ -67,12 +61,6 @@ exports[`DeliveryStartDate renders with a custom input max value 1`] = `
67
61
  Please select a valid start date
68
62
  </span>
69
63
  </span>
70
- <p>
71
- The first print edition you will receive is:
72
- <strong class="js-start-date-text">
73
- 2
74
- </strong>
75
- </p>
76
64
  </label>
77
65
  `;
78
66
 
@@ -86,10 +74,10 @@ exports[`DeliveryStartDate renders with a custom input min value 1`] = `
86
74
  <span class="o-forms-title__main"
87
75
  id="start-date-picker-title-span"
88
76
  >
89
- Delivery start date
77
+ Start date
90
78
  </span>
91
79
  <span class="o-forms-title__prompt">
92
- Earliest available delivery date:
80
+ The first print edition you will receive is:
93
81
  </span>
94
82
  </span>
95
83
  <span class="o-forms-input o-forms-input--text">
@@ -106,11 +94,6 @@ exports[`DeliveryStartDate renders with a custom input min value 1`] = `
106
94
  Please select a valid start date
107
95
  </span>
108
96
  </span>
109
- <p>
110
- The first print edition you will receive is:
111
- <strong class="js-start-date-text">
112
- </strong>
113
- </p>
114
97
  </label>
115
98
  `;
116
99
 
@@ -124,10 +107,10 @@ exports[`DeliveryStartDate renders with a custom input value 1`] = `
124
107
  <span class="o-forms-title__main"
125
108
  id="start-date-picker-title-span"
126
109
  >
127
- Delivery start date
110
+ Start date
128
111
  </span>
129
112
  <span class="o-forms-title__prompt">
130
- Earliest available delivery date:
113
+ The first print edition you will receive is:
131
114
  </span>
132
115
  </span>
133
116
  <span class="o-forms-input o-forms-input--text">
@@ -143,11 +126,6 @@ exports[`DeliveryStartDate renders with a custom input value 1`] = `
143
126
  Please select a valid start date
144
127
  </span>
145
128
  </span>
146
- <p>
147
- The first print edition you will receive is:
148
- <strong class="js-start-date-text">
149
- </strong>
150
- </p>
151
129
  </label>
152
130
  `;
153
131
 
@@ -161,10 +139,10 @@ exports[`DeliveryStartDate renders with a disabled input 1`] = `
161
139
  <span class="o-forms-title__main"
162
140
  id="start-date-picker-title-span"
163
141
  >
164
- Delivery start date
142
+ Start date
165
143
  </span>
166
144
  <span class="o-forms-title__prompt">
167
- Earliest available delivery date:
145
+ The first print edition you will receive is:
168
146
  </span>
169
147
  </span>
170
148
  <span class="o-forms-input o-forms-input--text">
@@ -181,11 +159,6 @@ exports[`DeliveryStartDate renders with a disabled input 1`] = `
181
159
  Please select a valid start date
182
160
  </span>
183
161
  </span>
184
- <p>
185
- The first print edition you will receive is:
186
- <strong class="js-start-date-text">
187
- </strong>
188
- </p>
189
162
  </label>
190
163
  `;
191
164
 
@@ -199,10 +172,10 @@ exports[`DeliveryStartDate renders with an error 1`] = `
199
172
  <span class="o-forms-title__main"
200
173
  id="start-date-picker-title-span"
201
174
  >
202
- Delivery start date
175
+ Start date
203
176
  </span>
204
177
  <span class="o-forms-title__prompt">
205
- Earliest available delivery date:
178
+ The first print edition you will receive is:
206
179
  </span>
207
180
  </span>
208
181
  <span class="o-forms-input o-forms-input--text o-forms-input--invalid">
@@ -218,11 +191,6 @@ exports[`DeliveryStartDate renders with an error 1`] = `
218
191
  Please select a valid start date
219
192
  </span>
220
193
  </span>
221
- <p>
222
- The first print edition you will receive is:
223
- <strong class="js-start-date-text">
224
- </strong>
225
- </p>
226
194
  </label>
227
195
  `;
228
196
 
@@ -236,10 +204,10 @@ exports[`DeliveryStartDate renders with appropriate start message when isAddress
236
204
  <span class="o-forms-title__main"
237
205
  id="start-date-picker-title-span"
238
206
  >
239
- Delivery start date
207
+ Start date
240
208
  </span>
241
209
  <span class="o-forms-title__prompt">
242
- Earliest available delivery date:
210
+ The first print edition you will receive is:
243
211
  </span>
244
212
  </span>
245
213
  <span class="o-forms-input o-forms-input--text">
@@ -273,10 +241,10 @@ exports[`DeliveryStartDate renders with country different than default 1`] = `
273
241
  <span class="o-forms-title__main"
274
242
  id="start-date-picker-title-span"
275
243
  >
276
- Delivery start date
244
+ Start date
277
245
  </span>
278
246
  <span class="o-forms-title__prompt">
279
- Earliest available delivery date:
247
+ The first print edition you will receive is:
280
248
  </span>
281
249
  </span>
282
250
  <span class="o-forms-input o-forms-input--text">
@@ -292,11 +260,6 @@ exports[`DeliveryStartDate renders with country different than default 1`] = `
292
260
  Please select a valid start date
293
261
  </span>
294
262
  </span>
295
- <p>
296
- The first print edition you will receive is:
297
- <strong class="js-start-date-text">
298
- </strong>
299
- </p>
300
263
  </label>
301
264
  `;
302
265
 
@@ -310,10 +273,10 @@ exports[`DeliveryStartDate renders with default props 1`] = `
310
273
  <span class="o-forms-title__main"
311
274
  id="start-date-picker-title-span"
312
275
  >
313
- Delivery start date
276
+ Start date
314
277
  </span>
315
278
  <span class="o-forms-title__prompt">
316
- Earliest available delivery date:
279
+ The first print edition you will receive is:
317
280
  </span>
318
281
  </span>
319
282
  <span class="o-forms-input o-forms-input--text">
@@ -329,10 +292,5 @@ exports[`DeliveryStartDate renders with default props 1`] = `
329
292
  Please select a valid start date
330
293
  </span>
331
294
  </span>
332
- <p>
333
- The first print edition you will receive is:
334
- <strong class="js-start-date-text">
335
- </strong>
336
- </p>
337
295
  </label>
338
296
  `;
@@ -35,7 +35,8 @@ export function DeliveryOption({
35
35
  const deliveryOptionValue = getDeliveryOption(
36
36
  productCode,
37
37
  option,
38
- FTShippingZone
38
+ FTShippingZone,
39
+ country
39
40
  );
40
41
 
41
42
  if (!isValidDeliveryOption || !deliveryOptionValue) {
@@ -54,6 +55,12 @@ export function DeliveryOption({
54
55
  defaultChecked: isSelected,
55
56
  };
56
57
 
58
+ const deliveryOptionBoxClassNames = classNames([
59
+ 'o-forms-input__label',
60
+ 'ncf__delivery-option__label',
61
+ { 'no-title__delivery-option__box': !deliveryOptionValue.title },
62
+ ]);
63
+
57
64
  return (
58
65
  <label
59
66
  key={value}
@@ -61,10 +68,12 @@ export function DeliveryOption({
61
68
  htmlFor={id}
62
69
  >
63
70
  <input {...inputProps} />
64
- <span className="o-forms-input__label ncf__delivery-option__label">
65
- <span className="ncf__delivery-option__title o-forms-title__main">
66
- {deliveryOptionValue.title}
67
- </span>
71
+ <span className={deliveryOptionBoxClassNames}>
72
+ {deliveryOptionValue.title && (
73
+ <span className="ncf__delivery-option__title o-forms-title__main">
74
+ {deliveryOptionValue.title}
75
+ </span>
76
+ )}
68
77
  <div className="ncf__delivery-option__description">
69
78
  {deliveryOptionValue.description}
70
79
  </div>
@@ -89,3 +89,18 @@ USWeekendOnlyDeliveryOptions.args = {
89
89
  country: 'USA',
90
90
  productCode: 'NWE',
91
91
  };
92
+
93
+ export const JapanDeliveryOptions = (args) => (
94
+ <div className="ncf">
95
+ <DeliveryOption {...args} />
96
+ </div>
97
+ );
98
+ JapanDeliveryOptions.args = {
99
+ country: 'JPN',
100
+ options: [
101
+ {
102
+ value: 'HD',
103
+ isValidDeliveryOption: true,
104
+ },
105
+ ],
106
+ };
@@ -30,10 +30,6 @@ export function DeliveryStartDate({
30
30
  defaultValue: value,
31
31
  };
32
32
 
33
- const startMessage = isAddressUpdate
34
- ? 'We’ll start delivering to this address from:'
35
- : 'The first print edition you will receive is:';
36
-
37
33
  return (
38
34
  <label
39
35
  id="deliveryStartDateField"
@@ -43,10 +39,10 @@ export function DeliveryStartDate({
43
39
  >
44
40
  <span className="o-forms-title">
45
41
  <span className="o-forms-title__main" id="start-date-picker-title-span">
46
- Delivery start date
42
+ Start date
47
43
  </span>
48
44
  <span className="o-forms-title__prompt">
49
- Earliest available delivery date: {date}
45
+ The first print edition you will receive is: {date}
50
46
  </span>
51
47
  </span>
52
48
 
@@ -57,9 +53,12 @@ export function DeliveryStartDate({
57
53
  </span>
58
54
  </span>
59
55
 
60
- <p>
61
- {startMessage} <strong className="js-start-date-text">{date}</strong>
62
- </p>
56
+ {isAddressUpdate && (
57
+ <p>
58
+ We’ll start delivering to this address from:{' '}
59
+ <strong className="js-start-date-text">{date}</strong>
60
+ </p>
61
+ )}
63
62
  </label>
64
63
  );
65
64
  }
@@ -35,7 +35,7 @@ function DeliveryOption(_ref) {
35
35
  var value = option.value,
36
36
  isValidDeliveryOption = option.isValidDeliveryOption,
37
37
  isSelected = option.isSelected;
38
- var deliveryOptionValue = (0, _deliveryOptionMessages.getDeliveryOption)(productCode, option, FTShippingZone);
38
+ var deliveryOptionValue = (0, _deliveryOptionMessages.getDeliveryOption)(productCode, option, FTShippingZone, country);
39
39
  if (!isValidDeliveryOption || !deliveryOptionValue) {
40
40
  return null;
41
41
  }
@@ -50,13 +50,16 @@ function DeliveryOption(_ref) {
50
50
  className: 'ncf__delivery-option__input',
51
51
  defaultChecked: isSelected
52
52
  };
53
+ var deliveryOptionBoxClassNames = (0, _classnames["default"])(['o-forms-input__label', 'ncf__delivery-option__label', {
54
+ 'no-title__delivery-option__box': !deliveryOptionValue.title
55
+ }]);
53
56
  return /*#__PURE__*/_react["default"].createElement("label", {
54
57
  key: value,
55
58
  className: "ncf__delivery-option__item",
56
59
  htmlFor: id
57
60
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
58
- className: "o-forms-input__label ncf__delivery-option__label"
59
- }, /*#__PURE__*/_react["default"].createElement("span", {
61
+ className: deliveryOptionBoxClassNames
62
+ }, deliveryOptionValue.title && /*#__PURE__*/_react["default"].createElement("span", {
60
63
  className: "ncf__delivery-option__title o-forms-title__main"
61
64
  }, deliveryOptionValue.title), /*#__PURE__*/_react["default"].createElement("div", {
62
65
  className: "ncf__delivery-option__description"
@@ -44,7 +44,6 @@ function DeliveryStartDate(_ref) {
44
44
  disabled: isDisabled,
45
45
  defaultValue: value
46
46
  });
47
- var startMessage = isAddressUpdate ? 'We’ll start delivering to this address from:' : 'The first print edition you will receive is:';
48
47
  return /*#__PURE__*/_react["default"].createElement("label", {
49
48
  id: "deliveryStartDateField",
50
49
  className: "o-forms-field ncf__validation-error",
@@ -55,13 +54,13 @@ function DeliveryStartDate(_ref) {
55
54
  }, /*#__PURE__*/_react["default"].createElement("span", {
56
55
  className: "o-forms-title__main",
57
56
  id: "start-date-picker-title-span"
58
- }, "Delivery start date"), /*#__PURE__*/_react["default"].createElement("span", {
57
+ }, "Start date"), /*#__PURE__*/_react["default"].createElement("span", {
59
58
  className: "o-forms-title__prompt"
60
- }, "Earliest available delivery date: ", date)), /*#__PURE__*/_react["default"].createElement("span", {
59
+ }, "The first print edition you will receive is: ", date)), /*#__PURE__*/_react["default"].createElement("span", {
61
60
  className: inputWrapperClassNames
62
61
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
63
62
  className: "o-forms-input__error"
64
- }, "Please select a valid start date")), /*#__PURE__*/_react["default"].createElement("p", null, startMessage, " ", /*#__PURE__*/_react["default"].createElement("strong", {
63
+ }, "Please select a valid start date")), isAddressUpdate && /*#__PURE__*/_react["default"].createElement("p", null, "We\u2019ll start delivering to this address from:", ' ', /*#__PURE__*/_react["default"].createElement("strong", {
65
64
  className: "js-start-date-text"
66
65
  }, date)));
67
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "37.0.0",
3
+ "version": "37.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,6 +28,9 @@
28
28
  background-color: oColorsByName('white');
29
29
  color: oColorsByName('black-80');;
30
30
  }
31
+ .no-title__delivery-option__box {
32
+ min-height: 80px;
33
+ }
31
34
  .o-forms-input__address-type__label {
32
35
  padding: 2px 2px 2px 35px;
33
36
  min-height: 0;
@@ -20,24 +20,37 @@ const HAND_DELIVERY = 'HD';
20
20
  const MAIL = 'ML';
21
21
 
22
22
  // Country codes
23
+ const CANADA_COUNTRY_CODE = 'CAN';
24
+ const JAPAN_COUNTRY_CODE = 'JPN';
23
25
  const UK_COUNTRY_CODE = 'GBR';
24
26
  const USA_COUNTRY_CODE = 'USA';
25
- const CAN_COUNTRY_CODE = 'CAN';
26
27
 
27
- const UKDeliveryOptions = {
28
- PV: {
29
- title: 'Paper vouchers',
30
- description:
31
- '13-week voucher pack delivered quarterly and redeemable at retailers nationwide.',
32
- },
33
- HD: {
34
- title: 'Hand delivery',
35
- description: 'Free delivery to your home or office before 7am.',
28
+ const countryCodeToCustomDeliveryOptionsMap = {
29
+ [JAPAN_COUNTRY_CODE]: {
30
+ HD: {
31
+ description:
32
+ 'Enjoy delivery of the newspaper to your home or office address.',
33
+ },
34
+ ML: {
35
+ description:
36
+ 'Enjoy delivery of the newspaper to your home or office address.',
37
+ },
36
38
  },
37
- EV: {
38
- title: 'Electronic vouchers',
39
- description:
40
- 'Delivered via email and card, redeemable at retailers nationwide.',
39
+ [UK_COUNTRY_CODE]: {
40
+ PV: {
41
+ title: 'Paper vouchers',
42
+ description:
43
+ '13-week voucher pack delivered quarterly and redeemable at retailers nationwide.',
44
+ },
45
+ HD: {
46
+ title: 'Hand delivery',
47
+ description: 'Free delivery to your home or office before 7am.',
48
+ },
49
+ EV: {
50
+ title: 'Electronic vouchers',
51
+ description:
52
+ 'Delivered via email and card, redeemable at retailers nationwide.',
53
+ },
41
54
  },
42
55
  };
43
56
 
@@ -61,7 +74,7 @@ const deliveryOptionMessages = [
61
74
  distributorType: HAND_DELIVERY,
62
75
  deliveryOnPublicationDate: true,
63
76
  flightMarket: true,
64
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
77
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
65
78
  title: 'Hand delivery',
66
79
  description:
67
80
  "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.",
@@ -74,7 +87,7 @@ const deliveryOptionMessages = [
74
87
  distributorType: HAND_DELIVERY,
75
88
  deliveryOnPublicationDate: true,
76
89
  flightMarket: false,
77
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
90
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
78
91
  title: 'Hand delivery',
79
92
  description:
80
93
  'Enjoy delivery of the newspaper daily to your home or office address.',
@@ -87,7 +100,7 @@ const deliveryOptionMessages = [
87
100
  distributorType: HAND_DELIVERY,
88
101
  deliveryOnPublicationDate: false,
89
102
  flightMarket: true,
90
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
103
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
91
104
  title: 'Hand delivery',
92
105
  description:
93
106
  "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.",
@@ -100,7 +113,7 @@ const deliveryOptionMessages = [
100
113
  distributorType: HAND_DELIVERY,
101
114
  deliveryOnPublicationDate: false,
102
115
  flightMarket: false,
103
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
116
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
104
117
  title: 'Hand delivery',
105
118
  description:
106
119
  'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: Your FT Weekend will be delivered on Sunday or Monday.',
@@ -158,7 +171,7 @@ const deliveryOptionMessages = [
158
171
  customId: 'ML',
159
172
  flightMarket: true,
160
173
  description:
161
- 'Enjoy delivery of the newspaper to your home or office address. Note this is a postal delivery - expect delivery after the day of publication. If you would prefer to read the newspaper on the day of publication, purchase an FT ePaper subscription, our digital replica of the each daily edition.',
174
+ 'Enjoy delivery of the newspaper to your home or office address. Note this is a postal delivery - expect delivery after the day of publication. If you would prefer to read the newspaper on the day of publication, purchase an FT ePaper subscription, our digital replica of each daily edition.',
162
175
  },
163
176
  {
164
177
  deliveryFrequency: [
@@ -180,7 +193,7 @@ const deliveryOptionMessages = [
180
193
  SIX_DAYS_WEEK_DELIVERY_FREQ,
181
194
  ],
182
195
  distributorType: MAIL,
183
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
196
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
184
197
  title: 'Mail',
185
198
  customId: 'ML',
186
199
  description:
@@ -191,7 +204,7 @@ const deliveryOptionMessages = [
191
204
  distributorType: HAND_DELIVERY,
192
205
  deliveryOnPublicationDate: true,
193
206
  flightMarket: true,
194
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
207
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
195
208
  title: 'Hand delivery',
196
209
  description:
197
210
  "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.",
@@ -201,7 +214,7 @@ const deliveryOptionMessages = [
201
214
  distributorType: HAND_DELIVERY,
202
215
  deliveryOnPublicationDate: true,
203
216
  flightMarket: false,
204
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
217
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
205
218
  title: 'Hand delivery',
206
219
  description:
207
220
  'Enjoy delivery of the newspaper daily to your home or office address.',
@@ -211,7 +224,7 @@ const deliveryOptionMessages = [
211
224
  distributorType: HAND_DELIVERY,
212
225
  deliveryOnPublicationDate: false,
213
226
  flightMarket: true,
214
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
227
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
215
228
  title: 'Hand delivery',
216
229
  description:
217
230
  "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.",
@@ -221,7 +234,7 @@ const deliveryOptionMessages = [
221
234
  distributorType: HAND_DELIVERY,
222
235
  deliveryOnPublicationDate: false,
223
236
  flightMarket: false,
224
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
237
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
225
238
  title: 'Hand delivery',
226
239
  description:
227
240
  'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: Your FT Weekend will be delivered on Sunday.',
@@ -229,7 +242,7 @@ const deliveryOptionMessages = [
229
242
  {
230
243
  deliveryFrequency: [ONLY_WEEKEND_DELIVERY_FREQ],
231
244
  distributorType: MAIL,
232
- country: [USA_COUNTRY_CODE, CAN_COUNTRY_CODE],
245
+ country: [USA_COUNTRY_CODE, CANADA_COUNTRY_CODE],
233
246
  title: 'Mail',
234
247
  customId: 'ML',
235
248
  description:
@@ -287,10 +300,13 @@ function findCustomDeliveryOption(productCode, option, FTShippingZone) {
287
300
  return deliveryOption;
288
301
  }
289
302
 
290
- function getDeliveryOption(productCode, option, FTShippingZone) {
291
- return FTShippingZone === UK_COUNTRY_CODE
292
- ? UKDeliveryOptions[option.value]
293
- : findCustomDeliveryOption(productCode, option, FTShippingZone);
303
+ function getDeliveryOption(productCode, option, FTShippingZone, country) {
304
+ // Custom delivery messages are displayed for certain countries
305
+ if (Object.keys(countryCodeToCustomDeliveryOptionsMap).includes(country)) {
306
+ return countryCodeToCustomDeliveryOptionsMap[country][option.value];
307
+ }
308
+
309
+ return findCustomDeliveryOption(productCode, option, FTShippingZone);
294
310
  }
295
311
 
296
312
  module.exports = {
@@ -14,14 +14,14 @@ describe('Find Custom Delivery Option', () => {
14
14
 
15
15
  it('returns undefined when other country than custom messages', () => {
16
16
  expect(
17
- getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')
17
+ getDeliveryOption(sixDaysProductCode, stubOption, 'AAA', 'AAA')
18
18
  ).toBeUndefined();
19
19
  });
20
20
 
21
21
  it('returns undefined when invalid distributor type code', () => {
22
22
  const option = { ...stubOption, value: 'ZZ' };
23
23
  expect(
24
- getDeliveryOption(sixDaysProductCode, option, 'USA')
24
+ getDeliveryOption(sixDaysProductCode, option, 'USA', 'USA')
25
25
  ).toBeUndefined();
26
26
  });
27
27
 
@@ -29,7 +29,7 @@ describe('Find Custom Delivery Option', () => {
29
29
  stubOption.deliveryOnPublicationDate = undefined;
30
30
  stubOption.flightMarket = undefined;
31
31
  expect(
32
- getDeliveryOption(sixDaysProductCode, stubOption, 'AAA')
32
+ getDeliveryOption(sixDaysProductCode, stubOption, 'AAA', 'AAA')
33
33
  ).toBeUndefined();
34
34
  });
35
35
  });
@@ -51,6 +51,7 @@ describe('Find Custom Delivery Option', () => {
51
51
  const deliveryOption = getDeliveryOption(
52
52
  sixDaysProductCode,
53
53
  stubOption,
54
+ 'USA',
54
55
  'USA'
55
56
  );
56
57
 
@@ -69,6 +70,7 @@ describe('Find Custom Delivery Option', () => {
69
70
  const deliveryOption = getDeliveryOption(
70
71
  weekendProductCode,
71
72
  stubOption,
73
+ 'USA',
72
74
  'USA'
73
75
  );
74
76
 
@@ -92,6 +94,7 @@ describe('Find Custom Delivery Option', () => {
92
94
  const deliveryOption = getDeliveryOption(
93
95
  sixDaysProductCode,
94
96
  stubOption,
97
+ 'USA',
95
98
  'USA'
96
99
  );
97
100
 
@@ -109,6 +112,7 @@ describe('Find Custom Delivery Option', () => {
109
112
  const deliveryOption = getDeliveryOption(
110
113
  weekendProductCode,
111
114
  stubOption,
115
+ 'CAN',
112
116
  'CAN'
113
117
  );
114
118
 
@@ -127,6 +131,7 @@ describe('Find Custom Delivery Option', () => {
127
131
  const deliveryOption = getDeliveryOption(
128
132
  sixDaysProductCode,
129
133
  { value: 'EV' },
134
+ 'GBR',
130
135
  'GBR'
131
136
  );
132
137
 
@@ -134,6 +139,24 @@ describe('Find Custom Delivery Option', () => {
134
139
  });
135
140
  });
136
141
 
142
+ describe('Find Japan Delivery Option', () => {
143
+ it('returns Japan HD delivery option', () => {
144
+ const expected = {
145
+ description:
146
+ 'Enjoy delivery of the newspaper to your home or office address.',
147
+ };
148
+
149
+ const deliveryOption = getDeliveryOption(
150
+ sixDaysProductCode,
151
+ stubOption,
152
+ 'APAC',
153
+ 'JPN'
154
+ );
155
+
156
+ expect(deliveryOption).toEqual(expected);
157
+ });
158
+ });
159
+
137
160
  describe('Find CEMEA/APAC Delivery Option', () => {
138
161
  it('returns CEMEA/APAC HD delivery option', () => {
139
162
  stubOption.flightMarket = true;
@@ -145,7 +168,12 @@ describe('Find Custom Delivery Option', () => {
145
168
  'Enjoy the delivery of the newspaper to your home or office address. Please 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 the next delivery day. Please also be aware that your FT weekend will be delivered on Sunday.',
146
169
  };
147
170
 
148
- const deliveryOption = getDeliveryOption('N6D', stubOption, 'CEMEA_V1');
171
+ const deliveryOption = getDeliveryOption(
172
+ 'N6D',
173
+ stubOption,
174
+ 'CEMEA_V1',
175
+ 'BGR'
176
+ );
149
177
 
150
178
  expect(deliveryOption).toEqual(expected);
151
179
  });
@@ -157,10 +185,15 @@ describe('Find Custom Delivery Option', () => {
157
185
  title: 'Mail Delivery',
158
186
  customId: 'ML',
159
187
  description:
160
- 'Enjoy delivery of the newspaper to your home or office address. Note this is a postal delivery - expect delivery after the day of publication. If you would prefer to read the newspaper on the day of publication, purchase an FT ePaper subscription, our digital replica of the each daily edition.',
188
+ 'Enjoy delivery of the newspaper to your home or office address. Note this is a postal delivery - expect delivery after the day of publication. If you would prefer to read the newspaper on the day of publication, purchase an FT ePaper subscription, our digital replica of each daily edition.',
161
189
  };
162
190
 
163
- const deliveryOption = getDeliveryOption('N6D', stubOption, 'APAC');
191
+ const deliveryOption = getDeliveryOption(
192
+ 'N6D',
193
+ stubOption,
194
+ 'APAC',
195
+ 'HKG'
196
+ );
164
197
 
165
198
  expect(deliveryOption).toEqual(expected);
166
199
  });
@@ -1,11 +0,0 @@
1
- _extends: github-apps-config-next
2
-
3
- branches:
4
- - name: main
5
- protection:
6
- required_pull_request_reviews: null
7
- required_status_checks: null
8
- enforce_admins: true
9
- restrictions:
10
- users: []
11
- teams: []