@financial-times/n-conversion-forms 37.2.3 → 38.0.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": "8bc87e48ea5c8edd123a52d6e59b12a23dee24e2",
5
- "tag": "v37.2.3"
4
+ "version": "31e041f551d5077e705e60bc10e33df6fe32fd0f",
5
+ "tag": "v38.0.0"
6
6
  }
@@ -38,6 +38,24 @@ export function AcceptTermsSubscription({
38
38
  required: true,
39
39
  };
40
40
 
41
+ const autoRenewingTerms = !isSingleTerm && (
42
+ <li>
43
+ <span className="terms-auto-renew">
44
+ I give consent for my chosen payment method to be charged automatically
45
+ at the end of each subscription term until I cancel it by contacting{' '}
46
+ <a
47
+ className="ncf__link--external"
48
+ href="https://help.ft.com/help/contact-us/"
49
+ target={isEmbedded ? '_top' : '_blank'}
50
+ rel="noopener noreferrer"
51
+ >
52
+ customer care through chat, phone or email
53
+ </a>
54
+ .
55
+ </span>
56
+ </li>
57
+ );
58
+
41
59
  if (isTermedSubscriptionTermType) {
42
60
  return (
43
61
  <div {...divProps}>
@@ -88,24 +106,6 @@ export function AcceptTermsSubscription({
88
106
 
89
107
  const transitionTerms = isTransition && (
90
108
  <>
91
- {!isSingleTerm && (
92
- <li>
93
- <span className="terms-transition">
94
- I give consent for my chosen payment method to be charged
95
- automatically at the end of each subscription term until I cancel it
96
- by contacting{' '}
97
- <a
98
- className="ncf__link--external"
99
- href="https://help.ft.com/help/contact-us/"
100
- target="_blank"
101
- rel="noopener noreferrer"
102
- >
103
- customer care through chat, phone or email
104
- </a>
105
- .
106
- </span>
107
- </li>
108
- )}
109
109
  {transitionType === 'immediate' ? (
110
110
  <li>
111
111
  <span className="terms-transition terms-transition--immediate">
@@ -185,22 +185,6 @@ export function AcceptTermsSubscription({
185
185
 
186
186
  const nonPrintTerms = (
187
187
  <>
188
- <li>
189
- <span className="terms-signup">
190
- I give consent for my chosen payment method to be charged
191
- automatically at the end of each subscription term until I cancel it
192
- by contacting{' '}
193
- <a
194
- className="ncf__link--external"
195
- href="https://help.ft.com/help/contact-us/"
196
- target={isEmbedded ? '_top' : '_blank'}
197
- rel="noopener noreferrer"
198
- >
199
- customer care through chat, phone or email
200
- </a>
201
- .
202
- </span>
203
- </li>
204
188
  <li>
205
189
  <span className="terms-signup">
206
190
  By placing my order, my subscription will start immediately and I am
@@ -234,6 +218,7 @@ export function AcceptTermsSubscription({
234
218
  return (
235
219
  <div {...divProps}>
236
220
  <ul className="o-typography-list ncf__accept-terms-list">
221
+ {autoRenewingTerms}
237
222
  {transitionTerms}
238
223
  {signupTerms}
239
224
  {deferredBillingTerms}
@@ -47,6 +47,28 @@ describe('AcceptTermsSubscription', () => {
47
47
  expect(trialTerms.exists()).toBe(false);
48
48
  });
49
49
 
50
+ it('renders the auto renewing charges terms when isSingleTerm prop is false', () => {
51
+ const props = {
52
+ isSingleTerm: false,
53
+ };
54
+
55
+ const component = mount(<AcceptTermsSubscription {...props} />);
56
+
57
+ const printTerms = component.find('.terms-auto-renew');
58
+ expect(printTerms.exists()).toBe(true);
59
+ });
60
+
61
+ it('does not render the auto renewing charges terms when isSingleTerm prop is true', () => {
62
+ const props = {
63
+ isSingleTerm: true,
64
+ };
65
+
66
+ const component = mount(<AcceptTermsSubscription {...props} />);
67
+
68
+ const printTerms = component.find('.terms-auto-renew');
69
+ expect(printTerms.exists()).toBe(false);
70
+ });
71
+
50
72
  it('renders the print-specific terms when isPrintProduct prop is true', () => {
51
73
  const props = {
52
74
  isPrintProduct: true,
@@ -190,6 +190,15 @@ export function PaymentTerm({
190
190
  };
191
191
 
192
192
  const createDiscount = () => {
193
+ // We need to display a specific text in the discount tile for H2 campaign offers.
194
+ // This is a TEMPORARY hack and will be removed once the campaign is over (Monday, October 28th).
195
+ // A ticket has been raised to deal with the clean-up: https://financialtimes.atlassian.net/browse/ACQ-2970.
196
+ if (option.specialOffer) {
197
+ return (
198
+ <span className="ncf__payment-term__discount">Special offer</span>
199
+ );
200
+ }
201
+
193
202
  return (
194
203
  option.discount && (
195
204
  <span className="ncf__payment-term__discount">
@@ -245,7 +254,7 @@ export function PaymentTerm({
245
254
  option.amount,
246
255
  option.currency,
247
256
  option.value
248
- )
257
+ )
249
258
  )}
250
259
  {nameMap['custom'].renewsText(getTimeFromPeriod(option.value))}
251
260
  </div>
@@ -420,6 +429,7 @@ PaymentTerm.propTypes = {
420
429
  title: PropTypes.string,
421
430
  subTitle: PropTypes.string,
422
431
  bestOffer: PropTypes.bool,
432
+ specialOffer: PropTypes.bool,
423
433
  chargeOnText: PropTypes.string,
424
434
  fulfilmentOption: PropTypes.string,
425
435
  })
@@ -132,6 +132,17 @@ RenewOffers.args = {
132
132
  selected: false,
133
133
  chargeOnText: 'You will be charged on May 1, 2021',
134
134
  },
135
+ {
136
+ title: 'Annual',
137
+ subTitle: '(Renews annually unless cancelled)',
138
+ price: '€ 150.00',
139
+ value: 150.0,
140
+ isTrial: false,
141
+ discount: '25%',
142
+ specialOffer: true,
143
+ selected: false,
144
+ chargeOnText: 'You will be charged on May 1, 2021',
145
+ },
135
146
  {
136
147
  title: '12 Month Subscription',
137
148
  price: '€ 300.00',
@@ -51,6 +51,14 @@ function AcceptTermsSubscription(_ref) {
51
51
  'aria-required': 'true',
52
52
  required: true
53
53
  };
54
+ var autoRenewingTerms = !isSingleTerm && /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
55
+ className: "terms-auto-renew"
56
+ }, "I give consent for my chosen payment method to be charged automatically at the end of each subscription term until I cancel it by contacting", ' ', /*#__PURE__*/_react["default"].createElement("a", {
57
+ className: "ncf__link--external",
58
+ href: "https://help.ft.com/help/contact-us/",
59
+ target: isEmbedded ? '_top' : '_blank',
60
+ rel: "noopener noreferrer"
61
+ }, "customer care through chat, phone or email"), "."));
54
62
  if (isTermedSubscriptionTermType) {
55
63
  return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
56
64
  className: "o-typography-list ncf__accept-terms-list"
@@ -74,14 +82,7 @@ function AcceptTermsSubscription(_ref) {
74
82
  className: "o-forms-input__error"
75
83
  }, "Please accept our terms & conditions")));
76
84
  }
77
- var transitionTerms = isTransition && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !isSingleTerm && /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
78
- className: "terms-transition"
79
- }, "I give consent for my chosen payment method to be charged automatically at the end of each subscription term until I cancel it by contacting", ' ', /*#__PURE__*/_react["default"].createElement("a", {
80
- className: "ncf__link--external",
81
- href: "https://help.ft.com/help/contact-us/",
82
- target: "_blank",
83
- rel: "noopener noreferrer"
84
- }, "customer care through chat, phone or email"), ".")), transitionType === 'immediate' ? /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
85
+ var transitionTerms = isTransition && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, transitionType === 'immediate' ? /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
85
86
  className: "terms-transition terms-transition--immediate"
86
87
  }, "By placing my order, my subscription will start immediately and I am aware and agree that I will therefore lose my statutory right to cancel my subscription within 14 days of acceptance of my order. Any notice of cancellation that I provide will only take effect at the end of my subscription period and previously paid amounts are non-refundable, except in the event that there is a fault in the provision of the services.")) : /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
87
88
  className: "terms-transition terms-transition--other"
@@ -109,13 +110,6 @@ function AcceptTermsSubscription(_ref) {
109
110
  }, "Terms & Conditions"), ".")));
110
111
  var nonPrintTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
111
112
  className: "terms-signup"
112
- }, "I give consent for my chosen payment method to be charged automatically at the end of each subscription term until I cancel it by contacting", ' ', /*#__PURE__*/_react["default"].createElement("a", {
113
- className: "ncf__link--external",
114
- href: "https://help.ft.com/help/contact-us/",
115
- target: isEmbedded ? '_top' : '_blank',
116
- rel: "noopener noreferrer"
117
- }, "customer care through chat, phone or email"), ".")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
118
- className: "terms-signup"
119
113
  }, "By placing my order, my subscription will start immediately and I am aware and agree that I will therefore lose my statutory right to cancel my subscription within 14 days of acceptance of my order. Any notice of cancellation that I provide will only take effect at the end of my subscription period and previously paid amounts are non-refundable, except in the event that there is a fault in the provision of the services.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
120
114
  className: "terms-signup"
121
115
  }, "Find out more about our cancellation policy in our", ' ', /*#__PURE__*/_react["default"].createElement("a", {
@@ -127,7 +121,7 @@ function AcceptTermsSubscription(_ref) {
127
121
  var signupTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isPrintProduct ? printTerms : nonPrintTerms);
128
122
  return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
129
123
  className: "o-typography-list ncf__accept-terms-list"
130
- }, transitionTerms, signupTerms, deferredBillingTerms), /*#__PURE__*/_react["default"].createElement("label", {
124
+ }, autoRenewingTerms, transitionTerms, signupTerms, deferredBillingTerms), /*#__PURE__*/_react["default"].createElement("label", {
131
125
  className: labelClassName,
132
126
  htmlFor: "termsAcceptance"
133
127
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
@@ -185,6 +185,14 @@ function PaymentTerm(_ref) {
185
185
  defaultChecked: true
186
186
  });
187
187
  var createDiscount = function createDiscount() {
188
+ // We need to display a specific text in the discount tile for H2 campaign offers.
189
+ // This is a TEMPORARY hack and will be removed once the campaign is over (Monday, October 28th).
190
+ // A ticket has been raised to deal with the clean-up: https://financialtimes.atlassian.net/browse/ACQ-2970.
191
+ if (option.specialOffer) {
192
+ return /*#__PURE__*/_react["default"].createElement("span", {
193
+ className: "ncf__payment-term__discount"
194
+ }, "Special offer");
195
+ }
188
196
  return option.discount && /*#__PURE__*/_react["default"].createElement("span", {
189
197
  className: "ncf__payment-term__discount"
190
198
  }, option.bestOffer ? 'Best offer' : "Save ".concat(option.discount, " off RRP"));
@@ -306,6 +314,7 @@ PaymentTerm.propTypes = {
306
314
  title: _propTypes["default"].string,
307
315
  subTitle: _propTypes["default"].string,
308
316
  bestOffer: _propTypes["default"].bool,
317
+ specialOffer: _propTypes["default"].bool,
309
318
  chargeOnText: _propTypes["default"].string,
310
319
  fulfilmentOption: _propTypes["default"].string
311
320
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "37.2.3",
3
+ "version": "38.0.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": {