@financial-times/n-conversion-forms 27.0.7 → 27.2.2

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.
@@ -10419,6 +10419,18 @@
10419
10419
  "url": "https://github.com/sponsors/sindresorhus"
10420
10420
  }
10421
10421
  },
10422
+ "node_modules/ansi-escapes/node_modules/type-fest": {
10423
+ "version": "0.21.3",
10424
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
10425
+ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
10426
+ "dev": true,
10427
+ "engines": {
10428
+ "node": ">=10"
10429
+ },
10430
+ "funding": {
10431
+ "url": "https://github.com/sponsors/sindresorhus"
10432
+ }
10433
+ },
10422
10434
  "node_modules/ansi-html": {
10423
10435
  "version": "0.0.7",
10424
10436
  "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=",
@@ -32005,9 +32017,12 @@
32005
32017
  }
32006
32018
  },
32007
32019
  "node_modules/type-fest": {
32008
- "version": "0.21.3",
32009
- "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
32020
+ "version": "0.13.1",
32021
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
32022
+ "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
32010
32023
  "dev": true,
32024
+ "optional": true,
32025
+ "peer": true,
32011
32026
  "engines": {
32012
32027
  "node": ">=10"
32013
32028
  },
@@ -41537,6 +41552,14 @@
41537
41552
  "dev": true,
41538
41553
  "requires": {
41539
41554
  "type-fest": "^0.21.3"
41555
+ },
41556
+ "dependencies": {
41557
+ "type-fest": {
41558
+ "version": "0.21.3",
41559
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
41560
+ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
41561
+ "dev": true
41562
+ }
41540
41563
  }
41541
41564
  },
41542
41565
  "ansi-html": {
@@ -58293,9 +58316,12 @@
58293
58316
  "dev": true
58294
58317
  },
58295
58318
  "type-fest": {
58296
- "version": "0.21.3",
58297
- "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
58298
- "dev": true
58319
+ "version": "0.13.1",
58320
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
58321
+ "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
58322
+ "dev": true,
58323
+ "optional": true,
58324
+ "peer": true
58299
58325
  },
58300
58326
  "type-is": {
58301
58327
  "version": "1.6.18",
@@ -7,7 +7,7 @@ exports[`B2CPartnershipConfirmation renders as default 1`] = `
7
7
  </div>
8
8
  <div class="ncf__paragraph">
9
9
  <h1 class="ncf__header ncf__header--confirmation">
10
- Welcome to your 30 days&#x27; Premium access
10
+ Welcome to your Premium access
11
11
  </h1>
12
12
  </div>
13
13
  </div>
@@ -19,7 +19,7 @@ export function B2CPartnershipConfirmation ({ ctaElement = null }) {
19
19
  <div className="ncf__paragraph">
20
20
  {
21
21
  <h1 className="ncf__header ncf__header--confirmation">
22
- {'Welcome to your 30 days\' Premium access'}
22
+ {'Welcome to your Premium access'}
23
23
  </h1>
24
24
  }
25
25
  </div>
@@ -31,7 +31,7 @@ const deliveryAddressMap = {
31
31
  APAC: 'District/County/Province/Ward',
32
32
  },
33
33
  addressLine1Title:{
34
- 'ARE': 'PO Box',
34
+ ARE: 'PO Box',
35
35
  },
36
36
  addressLine3Title: {
37
37
  GBR: 'Address line 3',
@@ -39,6 +39,7 @@ const deliveryAddressMap = {
39
39
  CAN: 'APT/FL/STE',
40
40
  CEMEA_V1: 'Address line 3',
41
41
  CEMEA_V2: 'Address line 3',
42
+ APAC: 'Address line 3',
42
43
  },
43
44
  addressLine3Prompt: {
44
45
  USA: 'Max. 6 characters. Please enter “Apartment 2C” as “Apt 2C”, “Floor 10 as FL 10”',
@@ -12,6 +12,7 @@ export function DeliveryAddressType ({
12
12
  fieldId = 'deliveryAddressTypeField',
13
13
  inputName = 'deliveryAddressType',
14
14
  options = ['home', 'company', 'pobox'],
15
+ editMode = false,
15
16
  }) {
16
17
  return (
17
18
  <div
@@ -36,6 +37,7 @@ export function DeliveryAddressType ({
36
37
  name={inputName}
37
38
  value={type.id}
38
39
  className="ncf__delivery-address-type__input"
40
+ disabled={editMode && (type.id !== value)}
39
41
  defaultChecked={type.id === value}
40
42
  />
41
43
  <span
@@ -8,6 +8,7 @@ export function LicenceConfirmation ({
8
8
  isEducationalLicence = false,
9
9
  contentId = '',
10
10
  ctaElement = null,
11
+ bodyContent = null,
11
12
  }) {
12
13
  const readingLinkProps = {
13
14
  href: contentId === '' ? '/' : `/content/${contentId}`,
@@ -32,17 +33,19 @@ export function LicenceConfirmation ({
32
33
  )}
33
34
  </div>
34
35
  </div>
36
+ {
37
+ bodyContent ? bodyContent : <>
38
+ <p className="ncf__paragraph">
39
+ Go to myFT to personalise your feed &amp; follow topics &amp; articles
40
+ of interest to you. Set this up now or later.
41
+ </p>
35
42
 
36
- <p className="ncf__paragraph">
37
- Go to myFT to personalise your feed &amp; follow topics &amp; articles
38
- of interest to you. Set this up now or later.
39
- </p>
40
-
41
- <p className="ncf__paragraph">
42
- Explore the homepage &amp; enjoy your unlimited access &amp; exclusive
43
- content.
44
- </p>
45
-
43
+ <p className="ncf__paragraph">
44
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive
45
+ content.
46
+ </p>
47
+ </>
48
+ }
46
49
  {ctaElement || (
47
50
  <p className="ncf__paragraph ncf__center">
48
51
  <a className="ncf__button ncf__button--submit" href="/myft">
@@ -65,4 +68,5 @@ LicenceConfirmation.propTypes = {
65
68
  isEducationalLicence: PropTypes.bool,
66
69
  contentId: PropTypes.string,
67
70
  ctaElement: PropTypes.node,
71
+ bodyContent: PropTypes.element,
68
72
  };
@@ -32,7 +32,7 @@ function B2CPartnershipConfirmation(_ref) {
32
32
  className: "ncf__paragraph"
33
33
  }, /*#__PURE__*/_react["default"].createElement("h1", {
34
34
  className: "ncf__header ncf__header--confirmation"
35
- }, 'Welcome to your 30 days\' Premium access'))), /*#__PURE__*/_react["default"].createElement("p", {
35
+ }, 'Welcome to your Premium access'))), /*#__PURE__*/_react["default"].createElement("p", {
36
36
  className: "ncf__paragraph"
37
37
  }, "Please check your email to confirm your account and set your password."), /*#__PURE__*/_react["default"].createElement("p", {
38
38
  className: "ncf__paragraph"
@@ -30,14 +30,15 @@ var deliveryAddressMap = {
30
30
  APAC: 'District/County/Province/Ward'
31
31
  },
32
32
  addressLine1Title: {
33
- 'ARE': 'PO Box'
33
+ ARE: 'PO Box'
34
34
  },
35
35
  addressLine3Title: {
36
36
  GBR: 'Address line 3',
37
37
  USA: 'APT/FL/STE',
38
38
  CAN: 'APT/FL/STE',
39
39
  CEMEA_V1: 'Address line 3',
40
- CEMEA_V2: 'Address line 3'
40
+ CEMEA_V2: 'Address line 3',
41
+ APAC: 'Address line 3'
41
42
  },
42
43
  addressLine3Prompt: {
43
44
  USA: 'Max. 6 characters. Please enter “Apartment 2C” as “Apt 2C”, “Floor 10 as FL 10”',
@@ -30,7 +30,9 @@ function DeliveryAddressType(_ref) {
30
30
  _ref$inputName = _ref.inputName,
31
31
  inputName = _ref$inputName === void 0 ? 'deliveryAddressType' : _ref$inputName,
32
32
  _ref$options = _ref.options,
33
- options = _ref$options === void 0 ? ['home', 'company', 'pobox'] : _ref$options;
33
+ options = _ref$options === void 0 ? ['home', 'company', 'pobox'] : _ref$options,
34
+ _ref$editMode = _ref.editMode,
35
+ editMode = _ref$editMode === void 0 ? false : _ref$editMode;
34
36
  return /*#__PURE__*/_react["default"].createElement("div", {
35
37
  id: fieldId,
36
38
  className: "o-forms-field ncf__delivery-address-type",
@@ -56,6 +58,7 @@ function DeliveryAddressType(_ref) {
56
58
  name: inputName,
57
59
  value: type.id,
58
60
  className: "ncf__delivery-address-type__input",
61
+ disabled: editMode && type.id !== value,
59
62
  defaultChecked: type.id === value
60
63
  }), /*#__PURE__*/_react["default"].createElement("span", {
61
64
  className: "o-forms-input__label o-forms-input__address-type__label",
@@ -29,7 +29,9 @@ function LicenceConfirmation(_ref) {
29
29
  _ref$contentId = _ref.contentId,
30
30
  contentId = _ref$contentId === void 0 ? '' : _ref$contentId,
31
31
  _ref$ctaElement = _ref.ctaElement,
32
- ctaElement = _ref$ctaElement === void 0 ? null : _ref$ctaElement;
32
+ ctaElement = _ref$ctaElement === void 0 ? null : _ref$ctaElement,
33
+ _ref$bodyContent = _ref.bodyContent,
34
+ bodyContent = _ref$bodyContent === void 0 ? null : _ref$bodyContent;
33
35
 
34
36
  var readingLinkProps = _objectSpread({
35
37
  href: contentId === '' ? '/' : "/content/".concat(contentId),
@@ -50,11 +52,11 @@ function LicenceConfirmation(_ref) {
50
52
  className: "ncf__header ncf__header--confirmation"
51
53
  }, "Your", duration ? " ".concat(duration) : '', " trial has started") : /*#__PURE__*/_react["default"].createElement("h1", {
52
54
  className: "ncf__header ncf__header--confirmation"
53
- }, "Great news, you have joined your", ' ', isEducationalLicence ? 'school' : 'company', " licence"))), /*#__PURE__*/_react["default"].createElement("p", {
55
+ }, "Great news, you have joined your", ' ', isEducationalLicence ? 'school' : 'company', " licence"))), bodyContent ? bodyContent : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("p", {
54
56
  className: "ncf__paragraph"
55
57
  }, "Go to myFT to personalise your feed & follow topics & articles of interest to you. Set this up now or later."), /*#__PURE__*/_react["default"].createElement("p", {
56
58
  className: "ncf__paragraph"
57
- }, "Explore the homepage & enjoy your unlimited access & exclusive content."), ctaElement || /*#__PURE__*/_react["default"].createElement("p", {
59
+ }, "Explore the homepage & enjoy your unlimited access & exclusive content.")), ctaElement || /*#__PURE__*/_react["default"].createElement("p", {
58
60
  className: "ncf__paragraph ncf__center"
59
61
  }, /*#__PURE__*/_react["default"].createElement("a", {
60
62
  className: "ncf__button ncf__button--submit",
@@ -70,5 +72,6 @@ LicenceConfirmation.propTypes = {
70
72
  duration: _propTypes["default"].string,
71
73
  isEducationalLicence: _propTypes["default"].bool,
72
74
  contentId: _propTypes["default"].string,
73
- ctaElement: _propTypes["default"].node
75
+ ctaElement: _propTypes["default"].node,
76
+ bodyContent: _propTypes["default"].element
74
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "27.0.7",
3
+ "version": "27.2.2",
4
4
  "description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -105,6 +105,19 @@ const deliveryOptionMessages = [
105
105
  description:
106
106
  'Enjoy delivery of the newspaper daily to your home or office address. \nPlease note: Your FT Weekend will be delivered on Sunday or Monday.',
107
107
  },
108
+ {
109
+ deliveryFrequency: [
110
+ FIVE_DAYS_WEEK_DELIVERY_FREQ,
111
+ SIX_DAYS_WEEK_DELIVERY_FREQ,
112
+ ],
113
+ distributorType: HAND_DELIVERY,
114
+ deliveryOnPublicationDate: false,
115
+ flightMarket: true,
116
+ country: [printRegions.cemeaV1, printRegions.cemeaV2, printRegions.apac],
117
+ title: 'Hand Delivery',
118
+ description:
119
+ '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.',
120
+ },
108
121
  {
109
122
  deliveryFrequency: [
110
123
  FIVE_DAYS_WEEK_DELIVERY_FREQ,
@@ -112,12 +125,24 @@ const deliveryOptionMessages = [
112
125
  ],
113
126
  distributorType: HAND_DELIVERY,
114
127
  deliveryOnPublicationDate: true,
115
- flightMarket: false,
128
+ flightMarket: true,
116
129
  country: [printRegions.cemeaV1, printRegions.cemeaV2, printRegions.apac],
117
- title: 'Hand delivery',
130
+ title: 'Hand Delivery',
118
131
  description:
119
132
  '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.',
120
133
  },
134
+ {
135
+ deliveryFrequency: [
136
+ FIVE_DAYS_WEEK_DELIVERY_FREQ,
137
+ SIX_DAYS_WEEK_DELIVERY_FREQ,
138
+ ],
139
+ distributorType: MAIL,
140
+ country: [printRegions.cemeaV1, printRegions.cemeaV2, printRegions.apac],
141
+ title: 'Mail Delivery',
142
+ customId: 'ML',
143
+ description:
144
+ '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.',
145
+ },
121
146
  {
122
147
  deliveryFrequency: [
123
148
  FIVE_DAYS_WEEK_DELIVERY_FREQ,
@@ -188,38 +213,38 @@ function includesDeliveryFrequency (productCode = '', item) {
188
213
  });
189
214
  }
190
215
 
191
- function mailStrategy (productCode, option, country, item) {
216
+ function mailStrategy (productCode, option, FTShippingZone, item) {
192
217
  return (
193
218
  includesDeliveryFrequency(productCode, item) &&
194
219
  item.distributorType === MAIL &&
195
- item.country.includes(country)
220
+ item.country.includes(FTShippingZone)
196
221
  );
197
222
  }
198
223
 
199
- function handDeliveryStrategy (productCode, option, country, item) {
224
+ function handDeliveryStrategy (productCode, option, FTShippingZone, item) {
200
225
  return (
201
226
  includesDeliveryFrequency(productCode, item) &&
202
227
  item.distributorType === HAND_DELIVERY &&
203
228
  item.deliveryOnPublicationDate === option.deliveryOnPublicationDate &&
204
229
  item.flightMarket === option.flightMarket &&
205
- item.country.includes(country)
230
+ item.country.includes(FTShippingZone)
206
231
  );
207
232
  }
208
233
 
209
234
  /**
210
- * Method to find a specific delivery option based on the delivery frequency, country and option values.
235
+ * Method to find a specific delivery option based on the delivery frequency, FTShippingZone and option values.
211
236
  * There are two different strategies, one for options with mailDelivery = true and other by the opposite.
212
237
  * Both cases are represented by system option code 'HD', but differ on the mailDelivery property value.
213
238
  * If no message matchs, then undefined is returned.
214
239
  */
215
- function findCustomDeliveryOption (productCode, option, country) {
240
+ function findCustomDeliveryOption (productCode, option, FTShippingZone) {
216
241
  let deliveryOption;
217
242
 
218
243
  if (option.value === HAND_DELIVERY) {
219
244
  const filteredMessages = deliveryOptionMessages.filter((item) => {
220
245
  return option.mailDelivery
221
- ? mailStrategy(productCode, option, country, item)
222
- : handDeliveryStrategy(productCode, option, country, item);
246
+ ? mailStrategy(productCode, option, FTShippingZone, item)
247
+ : handDeliveryStrategy(productCode, option, FTShippingZone, item);
223
248
  });
224
249
 
225
250
  if (filteredMessages.length) {
@@ -231,10 +256,10 @@ function findCustomDeliveryOption (productCode, option, country) {
231
256
  return deliveryOption;
232
257
  }
233
258
 
234
- function getDeliveryOption (productCode, option, country) {
235
- return country === UK_COUNTRY_CODE
259
+ function getDeliveryOption (productCode, option, FTShippingZone) {
260
+ return FTShippingZone === UK_COUNTRY_CODE
236
261
  ? UKDeliveryOptions[option.value]
237
- : findCustomDeliveryOption(productCode, option, country);
262
+ : findCustomDeliveryOption(productCode, option, FTShippingZone);
238
263
  }
239
264
 
240
265
  module.exports = {
@@ -133,4 +133,45 @@ describe('Find Custom Delivery Option', () => {
133
133
  expect(deliveryOption).toEqual(expected);
134
134
  });
135
135
  });
136
+
137
+ describe('Find CEMEA/APAC Delivery Option', () => {
138
+
139
+ it('returns CEMEA/APAC HD delivery option', () => {
140
+ stubOption.flightMarket = true;
141
+ stubOption.deliveryOnPublicationDate = false;
142
+ stubOption.mailDelivery = false;
143
+ const expected = {
144
+ title: 'Hand Delivery',
145
+ description:
146
+ '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.',
147
+ };
148
+
149
+ const deliveryOption = getDeliveryOption(
150
+ 'N6D',
151
+ stubOption,
152
+ 'CEMEA_V1'
153
+ );
154
+
155
+ expect(deliveryOption).toEqual(expected);
156
+ });
157
+
158
+ it('returns CEMEA/APAC ML delivery option', () => {
159
+ stubOption.mailDelivery = true;
160
+
161
+ const expected = {
162
+ title: 'Mail Delivery',
163
+ customId: 'ML',
164
+ description:
165
+ '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.',
166
+ };
167
+
168
+ const deliveryOption = getDeliveryOption(
169
+ 'N6D',
170
+ stubOption,
171
+ 'APAC'
172
+ );
173
+
174
+ expect(deliveryOption).toEqual(expected);
175
+ });
176
+ });
136
177
  });