@financial-times/n-conversion-forms 36.0.3 → 37.1.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.
- package/.eslintignore +2 -1
- package/.github/PULL_REQUEST_TEMPLATE.md +3 -0
- package/.toolkitstate/ci.json +2 -2
- package/components/delivery-option.jsx +14 -5
- package/components/delivery-option.stories.js +15 -0
- package/components/payment-type.jsx +13 -18
- package/dist/delivery-option.jsx +6 -3
- package/dist/payment-type.jsx +5 -7
- package/package.json +1 -1
- package/styles/_shared.scss +3 -0
- package/styles/payment-type.scss +18 -6
- package/utils/delivery-option-messages.js +44 -28
- package/utils/delivery-option-messages.spec.js +38 -5
- package/.github/settings.yml +0 -11
package/.eslintignore
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
| ------ | ----- |
|
|
11
11
|
| | |
|
|
12
12
|
|
|
13
|
+
### Semantic versioning
|
|
14
|
+
<!-- What is the proposed release type (i.e. major, minor, path) for these changes and the rationale? -->
|
|
15
|
+
|
|
13
16
|
### Reminder
|
|
14
17
|
Have you completed these common tasks (remove those that don't apply)?
|
|
15
18
|
|
package/.toolkitstate/ci.json
CHANGED
|
@@ -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=
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
+
};
|
|
@@ -72,9 +72,7 @@ export function PaymentType({
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
const paymentTypePaypal = () => {
|
|
75
|
-
if (showPaypalCustomerCareMessage) {
|
|
76
|
-
return PaypalCustomerCareMessage();
|
|
77
|
-
} else {
|
|
75
|
+
if (!showPaypalCustomerCareMessage) {
|
|
78
76
|
return { id: 'paypal', label: 'PayPal', hide: !enablePaypal };
|
|
79
77
|
}
|
|
80
78
|
};
|
|
@@ -104,7 +102,8 @@ export function PaymentType({
|
|
|
104
102
|
paymentTypeDirectDebit,
|
|
105
103
|
paymentTypeApplePay,
|
|
106
104
|
paymentTypeBankTransfer,
|
|
107
|
-
];
|
|
105
|
+
].filter(Boolean);
|
|
106
|
+
|
|
108
107
|
return paymentTypes.map((type) => {
|
|
109
108
|
if (type.id === undefined) {
|
|
110
109
|
return type;
|
|
@@ -239,7 +238,6 @@ export function PaymentType({
|
|
|
239
238
|
checked: true,
|
|
240
239
|
...(isSingleTermChecked && { defaultChecked: true }),
|
|
241
240
|
};
|
|
242
|
-
|
|
243
241
|
return (
|
|
244
242
|
<React.Fragment>
|
|
245
243
|
{createSecuritySeal()}
|
|
@@ -252,24 +250,21 @@ export function PaymentType({
|
|
|
252
250
|
<div className="o-forms-input__error">
|
|
253
251
|
Please enter a valid payment type
|
|
254
252
|
</div>
|
|
255
|
-
|
|
253
|
+
{showPaypalCustomerCareMessage && PaypalCustomerCareMessage()}
|
|
256
254
|
{createDirectDebitPanel()}
|
|
257
|
-
|
|
258
255
|
{createZuoraPanel()}
|
|
259
256
|
</div>
|
|
260
257
|
<div className="o-forms-field">
|
|
261
258
|
{isSingleTerm && (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
</label>
|
|
272
|
-
</>
|
|
259
|
+
<label
|
|
260
|
+
className="o-forms-input o-forms-input--checkbox o-forms-input--suffix ncf__payment-type-pay-faster-next-time-checkbox"
|
|
261
|
+
htmlFor="payFasterNextTime"
|
|
262
|
+
>
|
|
263
|
+
<input {...inputCheckProps} />
|
|
264
|
+
<span className="o-forms-input__label">
|
|
265
|
+
Use these details to pay faster next time
|
|
266
|
+
</span>
|
|
267
|
+
</label>
|
|
273
268
|
)}
|
|
274
269
|
</div>
|
|
275
270
|
</React.Fragment>
|
package/dist/delivery-option.jsx
CHANGED
|
@@ -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:
|
|
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"
|
package/dist/payment-type.jsx
CHANGED
|
@@ -67,9 +67,7 @@ function PaymentType(_ref) {
|
|
|
67
67
|
hide: !enableCreditcard
|
|
68
68
|
};
|
|
69
69
|
var paymentTypePaypal = function paymentTypePaypal() {
|
|
70
|
-
if (showPaypalCustomerCareMessage) {
|
|
71
|
-
return PaypalCustomerCareMessage();
|
|
72
|
-
} else {
|
|
70
|
+
if (!showPaypalCustomerCareMessage) {
|
|
73
71
|
return {
|
|
74
72
|
id: 'paypal',
|
|
75
73
|
label: 'PayPal',
|
|
@@ -93,7 +91,7 @@ function PaymentType(_ref) {
|
|
|
93
91
|
hide: !enableBankTransfer
|
|
94
92
|
};
|
|
95
93
|
var createPaymentTypes = function createPaymentTypes() {
|
|
96
|
-
var paymentTypes = [paymentTypeCreditCard, paymentTypePaypal(), paymentTypeDirectDebit, paymentTypeApplePay, paymentTypeBankTransfer];
|
|
94
|
+
var paymentTypes = [paymentTypeCreditCard, paymentTypePaypal(), paymentTypeDirectDebit, paymentTypeApplePay, paymentTypeBankTransfer].filter(Boolean);
|
|
97
95
|
return paymentTypes.map(function (type) {
|
|
98
96
|
if (type.id === undefined) {
|
|
99
97
|
return type;
|
|
@@ -188,14 +186,14 @@ function PaymentType(_ref) {
|
|
|
188
186
|
className: "o-forms-input o-forms-input--radio-box ncf__payment-type-selector"
|
|
189
187
|
}, createPaymentTypes()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
190
188
|
className: "o-forms-input__error"
|
|
191
|
-
}, "Please enter a valid payment type"), createDirectDebitPanel(), createZuoraPanel()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
189
|
+
}, "Please enter a valid payment type"), showPaypalCustomerCareMessage && PaypalCustomerCareMessage(), createDirectDebitPanel(), createZuoraPanel()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
192
190
|
className: "o-forms-field"
|
|
193
|
-
}, isSingleTerm && /*#__PURE__*/_react["default"].createElement(
|
|
191
|
+
}, isSingleTerm && /*#__PURE__*/_react["default"].createElement("label", {
|
|
194
192
|
className: "o-forms-input o-forms-input--checkbox o-forms-input--suffix ncf__payment-type-pay-faster-next-time-checkbox",
|
|
195
193
|
htmlFor: "payFasterNextTime"
|
|
196
194
|
}, /*#__PURE__*/_react["default"].createElement("input", inputCheckProps), /*#__PURE__*/_react["default"].createElement("span", {
|
|
197
195
|
className: "o-forms-input__label"
|
|
198
|
-
}, "Use these details to pay faster next time"))))
|
|
196
|
+
}, "Use these details to pay faster next time"))));
|
|
199
197
|
}
|
|
200
198
|
PaymentType.propTypes = {
|
|
201
199
|
enableApplepay: _propTypes["default"].bool,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "37.1.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": {
|
package/styles/_shared.scss
CHANGED
package/styles/payment-type.scss
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
@mixin ncfPaymentType() {
|
|
13
|
+
|
|
13
14
|
// #1 - Need to be this specific to override specific o-forms styles.
|
|
14
15
|
// Helps us override the floating of the radio box so that we can have it
|
|
15
16
|
// full width.
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
// #1
|
|
22
23
|
display: block;
|
|
23
24
|
margin-bottom: oSpacingByName('s3');
|
|
25
|
+
width: 100%;
|
|
24
26
|
|
|
25
27
|
&:last-child {
|
|
26
28
|
margin-bottom: 0;
|
|
@@ -33,17 +35,27 @@
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
&-selector {
|
|
36
|
-
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
justify-content: space-evenly;
|
|
41
|
+
align-items: baseline;
|
|
42
|
+
margin-bottom: oSpacingByName('s3');
|
|
43
|
+
|
|
44
|
+
@include oGridRespondTo($from: L) {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
gap: oSpacingByName('s2');
|
|
47
|
+
}
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
.o-forms-input--radio-box &--paypal {
|
|
51
|
+
|
|
40
52
|
// #2
|
|
41
|
-
[type='radio']
|
|
53
|
+
[type='radio']+.o-forms-input__label {
|
|
42
54
|
@include buttonImageOverriding();
|
|
43
55
|
background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fpp-logo-100px.png?width=300&source=next&fit=scale-down);
|
|
44
56
|
}
|
|
45
57
|
|
|
46
|
-
[type='radio']:checked
|
|
58
|
+
[type='radio']:checked+.o-forms-input__label {
|
|
47
59
|
@include buttonImageOverriding();
|
|
48
60
|
background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fpp-logo-white.png?width=300&source=next&fit=scale-down);
|
|
49
61
|
}
|
|
@@ -52,12 +64,12 @@
|
|
|
52
64
|
|
|
53
65
|
.o-forms-input--radio-box &--directdebit {
|
|
54
66
|
// #2
|
|
55
|
-
[type='radio']
|
|
67
|
+
[type='radio']+.o-forms-input__label {
|
|
56
68
|
@include buttonImageOverriding();
|
|
57
69
|
background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fdirect_debit.png?width=300&source=next&fit=scale-down);
|
|
58
70
|
}
|
|
59
71
|
|
|
60
|
-
[type='radio']:checked
|
|
72
|
+
[type='radio']:checked+.o-forms-input__label {
|
|
61
73
|
@include buttonImageOverriding();
|
|
62
74
|
background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fdirect_debit-white.png?width=300&source=next&fit=scale-down);
|
|
63
75
|
}
|
|
@@ -113,4 +125,4 @@
|
|
|
113
125
|
|
|
114
126
|
.o-forms-input.o-forms-input--checkbox.o-forms-input--suffix.ncf__payment-type-pay-faster-next-time-checkbox {
|
|
115
127
|
margin-top: oSpacingByName('s3');
|
|
116
|
-
}
|
|
128
|
+
}
|
|
@@ -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
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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.',
|
|
@@ -180,7 +193,7 @@ const deliveryOptionMessages = [
|
|
|
180
193
|
SIX_DAYS_WEEK_DELIVERY_FREQ,
|
|
181
194
|
],
|
|
182
195
|
distributorType: MAIL,
|
|
183
|
-
country: [USA_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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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(
|
|
171
|
+
const deliveryOption = getDeliveryOption(
|
|
172
|
+
'N6D',
|
|
173
|
+
stubOption,
|
|
174
|
+
'CEMEA_V1',
|
|
175
|
+
'BGR'
|
|
176
|
+
);
|
|
149
177
|
|
|
150
178
|
expect(deliveryOption).toEqual(expected);
|
|
151
179
|
});
|
|
@@ -160,7 +188,12 @@ describe('Find Custom Delivery Option', () => {
|
|
|
160
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 the each daily edition.',
|
|
161
189
|
};
|
|
162
190
|
|
|
163
|
-
const deliveryOption = getDeliveryOption(
|
|
191
|
+
const deliveryOption = getDeliveryOption(
|
|
192
|
+
'N6D',
|
|
193
|
+
stubOption,
|
|
194
|
+
'APAC',
|
|
195
|
+
'HKG'
|
|
196
|
+
);
|
|
164
197
|
|
|
165
198
|
expect(deliveryOption).toEqual(expected);
|
|
166
199
|
});
|