@financial-times/n-conversion-forms 30.0.0 → 30.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.
@@ -10,7 +10,7 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@babel/runtime": "^7.11.2",
13
- "@financial-times/n-pricing": "5.6.1",
13
+ "@financial-times/n-pricing": "6.0.0",
14
14
  "classnames": "2.3.2",
15
15
  "fetchres": "1.7.2",
16
16
  "lodash.get": "4.4.2",
@@ -2800,17 +2800,16 @@
2800
2800
  }
2801
2801
  },
2802
2802
  "node_modules/@financial-times/n-pricing": {
2803
- "version": "5.6.1",
2804
- "resolved": "https://registry.npmjs.org/@financial-times/n-pricing/-/n-pricing-5.6.1.tgz",
2805
- "integrity": "sha512-ShEu3ipmv0E2Pq+wFCKQ8yq+vfaqR0Si/K8X4vkEzuXL9bqYoMms0ToEdMndFB3FYI7CTPwCiV0LMjBmYn29Pw==",
2806
- "hasInstallScript": true,
2803
+ "version": "6.0.0",
2804
+ "resolved": "https://registry.npmjs.org/@financial-times/n-pricing/-/n-pricing-6.0.0.tgz",
2805
+ "integrity": "sha512-ZaLhpfOc/LePEPAKpOURUQqCHhDx6LyFb3M1xWI4ondeiaFNlaXUPGnCgbmA6FtTOHCvfnYRy08dnIR8uLDGIQ==",
2807
2806
  "dependencies": {
2808
2807
  "accounting": "^0.4.1",
2809
2808
  "big.js": "^6.0.0"
2810
2809
  },
2811
2810
  "engines": {
2812
- "node": "12.x || 16.x",
2813
- "npm": "7.x || 8.x"
2811
+ "node": "16.x || 18.x",
2812
+ "npm": "7.x || 8.x || 9.x"
2814
2813
  }
2815
2814
  },
2816
2815
  "node_modules/@financial-times/o-brand": {
@@ -35190,9 +35189,9 @@
35190
35189
  }
35191
35190
  },
35192
35191
  "@financial-times/n-pricing": {
35193
- "version": "5.6.1",
35194
- "resolved": "https://registry.npmjs.org/@financial-times/n-pricing/-/n-pricing-5.6.1.tgz",
35195
- "integrity": "sha512-ShEu3ipmv0E2Pq+wFCKQ8yq+vfaqR0Si/K8X4vkEzuXL9bqYoMms0ToEdMndFB3FYI7CTPwCiV0LMjBmYn29Pw==",
35192
+ "version": "6.0.0",
35193
+ "resolved": "https://registry.npmjs.org/@financial-times/n-pricing/-/n-pricing-6.0.0.tgz",
35194
+ "integrity": "sha512-ZaLhpfOc/LePEPAKpOURUQqCHhDx6LyFb3M1xWI4ondeiaFNlaXUPGnCgbmA6FtTOHCvfnYRy08dnIR8uLDGIQ==",
35196
35195
  "requires": {
35197
35196
  "accounting": "^0.4.1",
35198
35197
  "big.js": "^6.0.0"
@@ -1,5 +1,20 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`PackageChange annual render when is7DayPassExperiment is true 1`] = `
4
+ <div class="ncf__package-change">
5
+ <div class="ncf__package-change__package">
6
+ <div class="ncf__package-change__content">
7
+ <p>
8
+ You have chosen
9
+ <span class="ncf__strong">
10
+ Trial
11
+ </span>
12
+ </p>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ `;
17
+
3
18
  exports[`PackageChange annual render with defaults 1`] = `
4
19
  <div class="ncf__package-change">
5
20
  <div class="ncf__package-change__package">
@@ -9,6 +9,7 @@ export function AcceptTermsSubscription({
9
9
  isTrial = false,
10
10
  isPrintProduct = false,
11
11
  isSingleTerm = false,
12
+ is7DayPassExperiment = false,
12
13
  isTransition = false,
13
14
  transitionType = null,
14
15
  isDeferredBilling = false,
@@ -37,6 +38,54 @@ export function AcceptTermsSubscription({
37
38
  required: true,
38
39
  };
39
40
 
41
+ if (is7DayPassExperiment) {
42
+ return (
43
+ <div {...divProps}>
44
+ <ul className="o-typography-list ncf__accept-terms-list">
45
+ <li>
46
+ <span className="terms-transition terms-transition--immediate">
47
+ I give consent for my chosen payment method to be charged
48
+ automatically.
49
+ </span>
50
+ </li>
51
+ <li>
52
+ <span className="terms-transition terms-transition--immediate">
53
+ By placing your order subject to the Terms & Conditions (save for
54
+ section 2) referred to below, you are waiving your statutory right
55
+ to cancel our contract within 14 days of payment. Your payment is
56
+ a one-time payment collected at the time of checkout, and
57
+ unsubscribing or cancelling at any point (whether before or after
58
+ the 14-day period) will not entitle you to a refund.
59
+ </span>
60
+ </li>
61
+ <li>
62
+ <span className="terms-transition">
63
+ Please see here for the complete{' '}
64
+ <a
65
+ className="ncf__link--external"
66
+ href="http://help.ft.com/help/legal-privacy/terms-conditions/"
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ >
70
+ Terms &amp; Conditions
71
+ </a>
72
+ .
73
+ </span>
74
+ </li>
75
+ </ul>
76
+ <label className={labelClassName} htmlFor="termsAcceptance">
77
+ <input {...inputProps} />
78
+ <span className="o-forms-input__label">
79
+ I agree to the above terms &amp; conditions.
80
+ </span>
81
+ <p className="o-forms-input__error">
82
+ Please accept our terms &amp; conditions
83
+ </p>
84
+ </label>
85
+ </div>
86
+ );
87
+ }
88
+
40
89
  const transitionTerms = isTransition && (
41
90
  <>
42
91
  {!isSingleTerm && (
@@ -209,6 +258,7 @@ AcceptTermsSubscription.propTypes = {
209
258
  isTrial: PropTypes.bool,
210
259
  isPrintProduct: PropTypes.bool,
211
260
  isSingleTerm: PropTypes.bool,
261
+ is7DayPassExperiment: PropTypes.bool,
212
262
  isTransition: PropTypes.bool,
213
263
  transitionType: PropTypes.string,
214
264
  isDeferredBilling: PropTypes.bool,
@@ -49,6 +49,7 @@ export { Province } from './province';
49
49
  export { RegistrationConfirmation } from './registration-confirmation';
50
50
  export { Responsibility } from './responsibility';
51
51
  export { Section } from './section';
52
+ export { SevenDayPassExperimentConfirmation } from './seven-day-pass-experiment-confirmation';
52
53
  export { State } from './state';
53
54
  export { Submit } from './submit';
54
55
  export { TrialBanner } from './trial-banner';
@@ -5,6 +5,7 @@ export function PackageChange({
5
5
  changePackageUrl,
6
6
  currentPackage,
7
7
  packageDescription,
8
+ is7DayPassExperiment,
8
9
  }) {
9
10
  return (
10
11
  <div className="ncf__package-change">
@@ -20,15 +21,17 @@ export function PackageChange({
20
21
  </p>
21
22
  )}
22
23
  </div>
23
- <div className="ncf__package-change__actions">
24
- <a
25
- href={changePackageUrl}
26
- className="ncf__button ncf__button--mono ncf__button--baseline"
27
- data-trackable="change"
28
- >
29
- Change
30
- </a>
31
- </div>
24
+ {!is7DayPassExperiment && (
25
+ <div className="ncf__package-change__actions">
26
+ <a
27
+ href={changePackageUrl}
28
+ className="ncf__button ncf__button--mono ncf__button--baseline"
29
+ data-trackable="change"
30
+ >
31
+ Change
32
+ </a>
33
+ </div>
34
+ )}
32
35
  </div>
33
36
  </div>
34
37
  );
@@ -38,4 +41,5 @@ PackageChange.propTypes = {
38
41
  changePackageUrl: PropTypes.string.isRequired,
39
42
  currentPackage: PropTypes.string.isRequired,
40
43
  packageDescription: PropTypes.string,
44
+ is7DayPassExperiment: PropTypes.bool,
41
45
  };
@@ -74,6 +74,23 @@ describe('PackageChange', () => {
74
74
 
75
75
  expect(PackageChange).toRenderCorrectly(props);
76
76
  });
77
+
78
+ it('render when is7DayPassExperiment is true', () => {
79
+ const props = {
80
+ changePackageUrl: 'https://www.ft.com',
81
+ currentPackage: 'Trial',
82
+ is7DayPassExperiment: true,
83
+ terms: [
84
+ {
85
+ name: term,
86
+ price: '£1.00',
87
+ weeklyPrice: '£1.00',
88
+ },
89
+ ],
90
+ };
91
+
92
+ expect(PackageChange).toRenderCorrectly(props);
93
+ });
77
94
  });
78
95
  });
79
96
  });
@@ -18,3 +18,11 @@ WithPackageDescription.args = {
18
18
  changePackageUrl: 'https://ft.com/products',
19
19
  packageDescription: 'Personalised email briefings and alerts',
20
20
  };
21
+
22
+ export const SevenDayPassExperiment = (args) => <PackageChange {...args} />;
23
+ SevenDayPassExperiment.args = {
24
+ currentPackage: 'Premium Digital',
25
+ changePackageUrl: 'https://ft.com/products',
26
+ packageDescription: 'Personalised email briefings and alerts',
27
+ is7DayPassExperiment: true,
28
+ };
@@ -15,6 +15,7 @@ export function PaymentTerm({
15
15
  largePrice = false,
16
16
  optionsInARow = false,
17
17
  billingCountry = '',
18
+ is7DayPassExperiment = false,
18
19
  }) {
19
20
  /**
20
21
  * Compute monthly price for given term name
@@ -107,11 +108,24 @@ export function PaymentTerm({
107
108
  },
108
109
  monthly: {
109
110
  title: 'Monthly',
110
- price: (price) => (
111
- <React.Fragment>
112
- <span className="ncf__payment-term__price">{price}</span> per month
113
- </React.Fragment>
114
- ),
111
+ price: (price, is7DayPassExperiment) => {
112
+ const paymentIntervalTextToDisplay = (() => {
113
+ switch (true) {
114
+ case is7DayPassExperiment:
115
+ return ' one-time payment';
116
+
117
+ default:
118
+ return ' per month';
119
+ }
120
+ })();
121
+
122
+ return (
123
+ <React.Fragment>
124
+ <span className="ncf__payment-term__price">{price}</span>
125
+ {paymentIntervalTextToDisplay}
126
+ </React.Fragment>
127
+ );
128
+ },
115
129
  trialPrice: (price) => (
116
130
  <React.Fragment>
117
131
  Unless you cancel during your trial you will be billed{' '}
@@ -120,10 +134,20 @@ export function PaymentTerm({
120
134
  </React.Fragment>
121
135
  ),
122
136
  monthlyPrice: () => {},
123
- renewsText: (isFixedTermOffer) => {
124
- const textToDisplay = isFixedTermOffer
125
- ? 'This subscription is for 3 months, charged monthly. You can cancel at anytime'
126
- : 'Renews monthly unless cancelled';
137
+ renewsText: (isFixedTermOffer, is7DayPassExperiment) => {
138
+ const textToDisplay = (() => {
139
+ switch (true) {
140
+ case is7DayPassExperiment:
141
+ return 'This subscription is for 7 days, charged at the outset.';
142
+
143
+ case isFixedTermOffer:
144
+ return 'This subscription is for 3 months, charged monthly. You can cancel at anytime';
145
+
146
+ default:
147
+ return 'Renews monthly unless cancelled';
148
+ }
149
+ })();
150
+
127
151
  return (
128
152
  <p className="ncf__payment-term__renews-text">{textToDisplay}</p>
129
153
  );
@@ -218,9 +242,12 @@ export function PaymentTerm({
218
242
  <React.Fragment>
219
243
  {nameMap[option.name] ? (
220
244
  <div className="ncf__payment-term__description">
221
- {nameMap[option.name].price(option.price)}
245
+ {nameMap[option.name].price(option.price, is7DayPassExperiment)}
222
246
  {nameMap[option.name].monthlyPrice(option.monthlyPrice)}
223
- {nameMap[option.name].renewsText(isFixedTermOffer)}
247
+ {nameMap[option.name].renewsText(
248
+ isFixedTermOffer,
249
+ is7DayPassExperiment
250
+ )}
224
251
  {/* Remove this discount text temporarily in favour of monthly price */}
225
252
  {/* <br />Save up to 25% when you pay annually */}
226
253
  </div>
@@ -262,11 +289,21 @@ export function PaymentTerm({
262
289
  const showTrialCopyInTitle =
263
290
  option.isTrial && !isPrintOrBundle && !isEpaper;
264
291
 
265
- const defaultTitle =
266
- option.name && nameMap[option.name] ? nameMap[option.name].title : '';
292
+ const defaultTitle = (() => {
293
+ switch (true) {
294
+ case is7DayPassExperiment:
295
+ return '';
296
+
297
+ case Boolean(option.name && nameMap[option.name]):
298
+ return nameMap[option.name].title;
299
+
300
+ default:
301
+ return '';
302
+ }
303
+ })();
267
304
 
268
305
  const title = isFixedTermOffer
269
- ? `${offerDisplayName} - ${defaultTitle}`
306
+ ? [offerDisplayName, defaultTitle].filter(Boolean).join(' - ')
270
307
  : defaultTitle;
271
308
 
272
309
  let termDisplayName = '';
@@ -153,6 +153,37 @@ describe('PaymentTerm', () => {
153
153
  });
154
154
  });
155
155
 
156
+ describe('given is7DayPassExperiment is true', () => {
157
+ const options = [
158
+ {
159
+ name: 'monthly',
160
+ price: '$5.00',
161
+ value: 'monthly',
162
+ monthlyPrice: '$5.00',
163
+ },
164
+ ];
165
+ const wrapper = shallow(
166
+ <PaymentTerm
167
+ isFixedTermOffer={true}
168
+ options={options}
169
+ offerDisplayName="7-day pass"
170
+ is7DayPassExperiment={true}
171
+ />
172
+ );
173
+
174
+ it('renders renewal text that actually reflects how the 7-day pass is a fixed term subscription with a one-off payment made at the outset', () => {
175
+ expect(wrapper.find('.ncf__payment-term__renews-text').text()).toMatch(
176
+ /This subscription is for 7 days, charged at the outset./
177
+ );
178
+ });
179
+
180
+ it('renders offer name and omits payment term title', () => {
181
+ expect(wrapper.find('.ncf__payment-term__title').text()).toMatch(
182
+ '7-day pass'
183
+ );
184
+ });
185
+ });
186
+
156
187
  describe('getDisplayName', () => {
157
188
  const baseOptions = {
158
189
  name: 'monthly',
@@ -199,6 +230,22 @@ describe('PaymentTerm', () => {
199
230
  );
200
231
  });
201
232
  });
233
+ describe('7-day pass experiment', () => {
234
+ const options = [
235
+ {
236
+ ...baseOptions,
237
+ isTrial: false,
238
+ },
239
+ ];
240
+ it('renders with time period only if trial.option == false', () => {
241
+ const wrapper = shallow(
242
+ <PaymentTerm options={options} is7DayPassExperiment={true} />
243
+ );
244
+ expect(wrapper.find('.ncf__payment-term__label').text().trim()).toMatch(
245
+ '£20.00 one-time paymentThis subscription is for 7 days, charged at the outset.'
246
+ );
247
+ });
248
+ });
202
249
  });
203
250
 
204
251
  describe('[data-base-amount]', () => {
@@ -109,6 +109,26 @@ FixedTermOffer.args = {
109
109
  offerDisplayName: 'Mix & Match',
110
110
  };
111
111
 
112
+ export const SevenDayPassExperimentOffer = (args) => (
113
+ <div className="ncf">
114
+ <Fieldset>
115
+ <PaymentTerm {...args} />
116
+ </Fieldset>
117
+ </div>
118
+ );
119
+ SevenDayPassExperimentOffer.args = {
120
+ options: [
121
+ {
122
+ name: 'monthly',
123
+ price: '$5.00',
124
+ value: 5.0,
125
+ },
126
+ ],
127
+ isFixedTermOffer: true,
128
+ is7DayPassExperiment: true,
129
+ offerDisplayName: '7-day pass',
130
+ };
131
+
112
132
  export const RenewOffers = (args) => (
113
133
  <div className="ncf">
114
134
  <Fieldset>
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ const DetailsMobileView = ({ details }) => (
5
+ <dl className="ncf__list ncf__lite-sub__details ncf__lite-sub-confirmation--hidden-md ncf__lite-sub-confirmation--hidden-lg">
6
+ {details.map((detail, index) => (
7
+ <React.Fragment key={index}>
8
+ <dt className="ncf__list-title">{detail.title}</dt>
9
+ <dd className="ncf__list-data">{detail.data}</dd>
10
+ </React.Fragment>
11
+ ))}
12
+ </dl>
13
+ );
14
+
15
+ export function SevenDayPassExperimentConfirmation({
16
+ offerName = '',
17
+ details = [],
18
+ }) {
19
+ const detailElements = details && (
20
+ <React.Fragment>
21
+ <h2 className="ncf__header2--afterline">Your billing details</h2>
22
+ <dl className="ncf__list ncf__lite-sub-confirmation--hidden-sm">
23
+ {details.map((detail, index) => (
24
+ <React.Fragment key={index}>
25
+ <dt className="ncf__list-title">{detail.title}</dt>
26
+ <dd className="ncf__list-data">{detail.data}</dd>
27
+ </React.Fragment>
28
+ ))}
29
+ </dl>
30
+ <DetailsMobileView details={details} />
31
+ </React.Fragment>
32
+ );
33
+
34
+ return (
35
+ <div className="ncf ncf__wrapper">
36
+ <div className="ncf__center">
37
+ <div className="ncf__icon ncf__icon--tick ncf__icon--large"></div>
38
+ <p className="ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation">
39
+ You are now subscribed to:
40
+ </p>
41
+ <h1 className="ncf__header ncf__header--confirmation">
42
+ {'Premium Digital'}
43
+ </h1>
44
+ </div>
45
+ <p className="ncf__paragraph">
46
+ Exciting news! You are one of the first to try a{' '}
47
+ <strong>{offerName}</strong>. As a thank you, we are pleased to extend
48
+ your subscription to one month at no additional cost.
49
+ </p>
50
+ <p className="ncf__center">
51
+ <a
52
+ href="/"
53
+ className="ncf__button ncf__button--submit ncf__button--margin ncf__lite-sub-confirmation--lite-sub-cta"
54
+ >
55
+ Go to FT.com
56
+ </a>
57
+ </p>
58
+ <p className="ncf__paragraph">
59
+ Please save or print this page for your records as your purchase
60
+ confirmation.
61
+ </p>
62
+
63
+ <p className="ncf__paragraph">
64
+ Here&apos;s a summary of your Premium Digital subscription:
65
+ </p>
66
+
67
+ {detailElements}
68
+
69
+ <div className="ncf__headed-paragraph">
70
+ <h3 className="ncf__header">Something not right?</h3>
71
+ <p className="ncf__paragraph">
72
+ Go to your{' '}
73
+ <a
74
+ className="ncf__link ncf__link--external"
75
+ href="https://www.ft.com/myaccount/personal-details"
76
+ target="_blank"
77
+ rel="noopener noreferrer"
78
+ data-trackable="yourAccount"
79
+ >
80
+ account settings
81
+ </a>{' '}
82
+ to view or edit your account. If you need to get in touch call us on{' '}
83
+ <a href="tel:+442077556248" className="ncf__link ncf__link--external">
84
+ +44 20 7755 6248
85
+ </a>
86
+ . Or{' '}
87
+ <a
88
+ className="ncf__link ncf__link--external"
89
+ href="https://help.ft.com/contact/"
90
+ target="_blank"
91
+ rel="noopener noreferrer"
92
+ >
93
+ contact us
94
+ </a>{' '}
95
+ for additional support.
96
+ </p>
97
+ </div>
98
+ </div>
99
+ );
100
+ }
101
+
102
+ SevenDayPassExperimentConfirmation.propTypes = {
103
+ offerName: PropTypes.string.isRequired,
104
+ details: PropTypes.arrayOf(
105
+ PropTypes.shape({
106
+ title: PropTypes.string.isRequired,
107
+ data: PropTypes.string.isRequired,
108
+ })
109
+ ),
110
+ };
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { SevenDayPassExperimentConfirmation } from './seven-day-pass-experiment-confirmation';
3
+
4
+ export default {
5
+ title: '7-day pass experiment confirmation',
6
+ component: SevenDayPassExperimentConfirmation,
7
+ argTypes: {
8
+ details: { control: 'array' },
9
+ offerType: { control: 'string' },
10
+ offerName: { control: 'string' },
11
+ },
12
+ };
13
+
14
+ export const Basic = (args) => <SevenDayPassExperimentConfirmation {...args} />;
15
+ Basic.args = {
16
+ offerType: 'Premium',
17
+ details: [
18
+ {
19
+ title: 'End Date',
20
+ data: 'September 18, 2023',
21
+ },
22
+ {
23
+ title: 'One-time payment',
24
+ data: '£1.99',
25
+ },
26
+ {
27
+ title: 'Payment method',
28
+ data: 'Credit / Debit Card',
29
+ },
30
+ ],
31
+ offerName: '7-day pass',
32
+ subscriptionAmount: '£1.99',
33
+ };
@@ -24,6 +24,8 @@ function AcceptTermsSubscription(_ref) {
24
24
  isPrintProduct = _ref$isPrintProduct === void 0 ? false : _ref$isPrintProduct,
25
25
  _ref$isSingleTerm = _ref.isSingleTerm,
26
26
  isSingleTerm = _ref$isSingleTerm === void 0 ? false : _ref$isSingleTerm,
27
+ _ref$is7DayPassExperi = _ref.is7DayPassExperiment,
28
+ is7DayPassExperiment = _ref$is7DayPassExperi === void 0 ? false : _ref$is7DayPassExperi,
27
29
  _ref$isTransition = _ref.isTransition,
28
30
  isTransition = _ref$isTransition === void 0 ? false : _ref$isTransition,
29
31
  _ref$transitionType = _ref.transitionType,
@@ -49,6 +51,29 @@ function AcceptTermsSubscription(_ref) {
49
51
  'aria-required': 'true',
50
52
  required: true
51
53
  };
54
+ if (is7DayPassExperiment) {
55
+ return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
56
+ className: "o-typography-list ncf__accept-terms-list"
57
+ }, /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
58
+ className: "terms-transition terms-transition--immediate"
59
+ }, "I give consent for my chosen payment method to be charged automatically.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
60
+ className: "terms-transition terms-transition--immediate"
61
+ }, "By placing your order subject to the Terms & Conditions (save for section 2) referred to below, you are waiving your statutory right to cancel our contract within 14 days of payment. Your payment is a one-time payment collected at the time of checkout, and unsubscribing or cancelling at any point (whether before or after the 14-day period) will not entitle you to a refund.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
62
+ className: "terms-transition"
63
+ }, "Please see here for the complete", ' ', /*#__PURE__*/_react["default"].createElement("a", {
64
+ className: "ncf__link--external",
65
+ href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
66
+ target: "_blank",
67
+ rel: "noopener noreferrer"
68
+ }, "Terms & Conditions"), "."))), /*#__PURE__*/_react["default"].createElement("label", {
69
+ className: labelClassName,
70
+ htmlFor: "termsAcceptance"
71
+ }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
72
+ className: "o-forms-input__label"
73
+ }, "I agree to the above terms & conditions."), /*#__PURE__*/_react["default"].createElement("p", {
74
+ className: "o-forms-input__error"
75
+ }, "Please accept our terms & conditions")));
76
+ }
52
77
  var transitionTerms = isTransition && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, !isSingleTerm && /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
53
78
  className: "terms-transition"
54
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", {
@@ -118,6 +143,7 @@ AcceptTermsSubscription.propTypes = {
118
143
  isTrial: _propTypes["default"].bool,
119
144
  isPrintProduct: _propTypes["default"].bool,
120
145
  isSingleTerm: _propTypes["default"].bool,
146
+ is7DayPassExperiment: _propTypes["default"].bool,
121
147
  isTransition: _propTypes["default"].bool,
122
148
  transitionType: _propTypes["default"].string,
123
149
  isDeferredBilling: _propTypes["default"].bool
package/dist/index.js CHANGED
@@ -339,6 +339,12 @@ Object.defineProperty(exports, "Section", {
339
339
  return _section.Section;
340
340
  }
341
341
  });
342
+ Object.defineProperty(exports, "SevenDayPassExperimentConfirmation", {
343
+ enumerable: true,
344
+ get: function get() {
345
+ return _sevenDayPassExperimentConfirmation.SevenDayPassExperimentConfirmation;
346
+ }
347
+ });
342
348
  Object.defineProperty(exports, "State", {
343
349
  enumerable: true,
344
350
  get: function get() {
@@ -414,6 +420,7 @@ var _province = require("./province");
414
420
  var _registrationConfirmation = require("./registration-confirmation");
415
421
  var _responsibility = require("./responsibility");
416
422
  var _section = require("./section");
423
+ var _sevenDayPassExperimentConfirmation = require("./seven-day-pass-experiment-confirmation");
417
424
  var _state = require("./state");
418
425
  var _submit = require("./submit");
419
426
  var _trialBanner = require("./trial-banner");
@@ -10,7 +10,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  function PackageChange(_ref) {
11
11
  var changePackageUrl = _ref.changePackageUrl,
12
12
  currentPackage = _ref.currentPackage,
13
- packageDescription = _ref.packageDescription;
13
+ packageDescription = _ref.packageDescription,
14
+ is7DayPassExperiment = _ref.is7DayPassExperiment;
14
15
  return /*#__PURE__*/_react["default"].createElement("div", {
15
16
  className: "ncf__package-change"
16
17
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -21,7 +22,7 @@ function PackageChange(_ref) {
21
22
  className: "ncf__strong"
22
23
  }, currentPackage)), packageDescription && /*#__PURE__*/_react["default"].createElement("p", {
23
24
  className: "ncf__package-change__content__description"
24
- }, packageDescription)), /*#__PURE__*/_react["default"].createElement("div", {
25
+ }, packageDescription)), !is7DayPassExperiment && /*#__PURE__*/_react["default"].createElement("div", {
25
26
  className: "ncf__package-change__actions"
26
27
  }, /*#__PURE__*/_react["default"].createElement("a", {
27
28
  href: changePackageUrl,
@@ -32,5 +33,6 @@ function PackageChange(_ref) {
32
33
  PackageChange.propTypes = {
33
34
  changePackageUrl: _propTypes["default"].string.isRequired,
34
35
  currentPackage: _propTypes["default"].string.isRequired,
35
- packageDescription: _propTypes["default"].string
36
+ packageDescription: _propTypes["default"].string,
37
+ is7DayPassExperiment: _propTypes["default"].bool
36
38
  };
@@ -33,7 +33,9 @@ function PaymentTerm(_ref) {
33
33
  _ref$optionsInARow = _ref.optionsInARow,
34
34
  optionsInARow = _ref$optionsInARow === void 0 ? false : _ref$optionsInARow,
35
35
  _ref$billingCountry = _ref.billingCountry,
36
- billingCountry = _ref$billingCountry === void 0 ? '' : _ref$billingCountry;
36
+ billingCountry = _ref$billingCountry === void 0 ? '' : _ref$billingCountry,
37
+ _ref$is7DayPassExperi = _ref.is7DayPassExperiment,
38
+ is7DayPassExperiment = _ref$is7DayPassExperi === void 0 ? false : _ref$is7DayPassExperi;
37
39
  /**
38
40
  * Compute monthly price for given term name
39
41
  * @param {number} amount price in number format
@@ -118,10 +120,18 @@ function PaymentTerm(_ref) {
118
120
  },
119
121
  monthly: {
120
122
  title: 'Monthly',
121
- price: function price(_price3) {
123
+ price: function price(_price3, is7DayPassExperiment) {
124
+ var paymentIntervalTextToDisplay = function () {
125
+ switch (true) {
126
+ case is7DayPassExperiment:
127
+ return ' one-time payment';
128
+ default:
129
+ return ' per month';
130
+ }
131
+ }();
122
132
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
123
133
  className: "ncf__payment-term__price"
124
- }, _price3), " per month");
134
+ }, _price3), paymentIntervalTextToDisplay);
125
135
  },
126
136
  trialPrice: function trialPrice(price) {
127
137
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "Unless you cancel during your trial you will be billed", ' ', /*#__PURE__*/_react["default"].createElement("span", {
@@ -129,8 +139,17 @@ function PaymentTerm(_ref) {
129
139
  }, price), " per month after the trial period.");
130
140
  },
131
141
  monthlyPrice: function monthlyPrice() {},
132
- renewsText: function renewsText(isFixedTermOffer) {
133
- var textToDisplay = isFixedTermOffer ? 'This subscription is for 3 months, charged monthly. You can cancel at anytime' : 'Renews monthly unless cancelled';
142
+ renewsText: function renewsText(isFixedTermOffer, is7DayPassExperiment) {
143
+ var textToDisplay = function () {
144
+ switch (true) {
145
+ case is7DayPassExperiment:
146
+ return 'This subscription is for 7 days, charged at the outset.';
147
+ case isFixedTermOffer:
148
+ return 'This subscription is for 3 months, charged monthly. You can cancel at anytime';
149
+ default:
150
+ return 'Renews monthly unless cancelled';
151
+ }
152
+ }();
134
153
  return /*#__PURE__*/_react["default"].createElement("p", {
135
154
  className: "ncf__payment-term__renews-text"
136
155
  }, textToDisplay);
@@ -192,7 +211,7 @@ function PaymentTerm(_ref) {
192
211
  className: "ncf__payment-term__trial-price"
193
212
  }, option.trialPrice), /*#__PURE__*/_react["default"].createElement("br", null), nameMap[option.name] && nameMap[option.name].trialPrice(option.price)) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, nameMap[option.name] ? /*#__PURE__*/_react["default"].createElement("div", {
194
213
  className: "ncf__payment-term__description"
195
- }, nameMap[option.name].price(option.price), nameMap[option.name].monthlyPrice(option.monthlyPrice), nameMap[option.name].renewsText(isFixedTermOffer)) :
214
+ }, nameMap[option.name].price(option.price, is7DayPassExperiment), nameMap[option.name].monthlyPrice(option.monthlyPrice), nameMap[option.name].renewsText(isFixedTermOffer, is7DayPassExperiment)) :
196
215
  // this should cover the cases different than annual, quarterly and monthly
197
216
  // for those containing period on option.value, render custom template, for the rest keep legacy render
198
217
  isValidPeriod(option.value) ? /*#__PURE__*/_react["default"].createElement("div", {
@@ -205,8 +224,17 @@ function PaymentTerm(_ref) {
205
224
  };
206
225
  var getTermDisplayName = function getTermDisplayName() {
207
226
  var showTrialCopyInTitle = option.isTrial && !isPrintOrBundle && !isEpaper;
208
- var defaultTitle = option.name && nameMap[option.name] ? nameMap[option.name].title : '';
209
- var title = isFixedTermOffer ? "".concat(offerDisplayName, " - ").concat(defaultTitle) : defaultTitle;
227
+ var defaultTitle = function () {
228
+ switch (true) {
229
+ case is7DayPassExperiment:
230
+ return '';
231
+ case Boolean(option.name && nameMap[option.name]):
232
+ return nameMap[option.name].title;
233
+ default:
234
+ return '';
235
+ }
236
+ }();
237
+ var title = isFixedTermOffer ? [offerDisplayName, defaultTitle].filter(Boolean).join(' - ') : defaultTitle;
210
238
  var termDisplayName = '';
211
239
  if (showTrialCopyInTitle) {
212
240
  var termName = option.displayName ? option.displayName : 'Premium Digital';
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SevenDayPassExperimentConfirmation = SevenDayPassExperimentConfirmation;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var DetailsMobileView = function DetailsMobileView(_ref) {
11
+ var details = _ref.details;
12
+ return /*#__PURE__*/_react["default"].createElement("dl", {
13
+ className: "ncf__list ncf__lite-sub__details ncf__lite-sub-confirmation--hidden-md ncf__lite-sub-confirmation--hidden-lg"
14
+ }, details.map(function (detail, index) {
15
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
16
+ key: index
17
+ }, /*#__PURE__*/_react["default"].createElement("dt", {
18
+ className: "ncf__list-title"
19
+ }, detail.title), /*#__PURE__*/_react["default"].createElement("dd", {
20
+ className: "ncf__list-data"
21
+ }, detail.data));
22
+ }));
23
+ };
24
+ function SevenDayPassExperimentConfirmation(_ref2) {
25
+ var _ref2$offerName = _ref2.offerName,
26
+ offerName = _ref2$offerName === void 0 ? '' : _ref2$offerName,
27
+ _ref2$details = _ref2.details,
28
+ details = _ref2$details === void 0 ? [] : _ref2$details;
29
+ var detailElements = details && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("h2", {
30
+ className: "ncf__header2--afterline"
31
+ }, "Your billing details"), /*#__PURE__*/_react["default"].createElement("dl", {
32
+ className: "ncf__list ncf__lite-sub-confirmation--hidden-sm"
33
+ }, details.map(function (detail, index) {
34
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
35
+ key: index
36
+ }, /*#__PURE__*/_react["default"].createElement("dt", {
37
+ className: "ncf__list-title"
38
+ }, detail.title), /*#__PURE__*/_react["default"].createElement("dd", {
39
+ className: "ncf__list-data"
40
+ }, detail.data));
41
+ })), /*#__PURE__*/_react["default"].createElement(DetailsMobileView, {
42
+ details: details
43
+ }));
44
+ return /*#__PURE__*/_react["default"].createElement("div", {
45
+ className: "ncf ncf__wrapper"
46
+ }, /*#__PURE__*/_react["default"].createElement("div", {
47
+ className: "ncf__center"
48
+ }, /*#__PURE__*/_react["default"].createElement("div", {
49
+ className: "ncf__icon ncf__icon--tick ncf__icon--large"
50
+ }), /*#__PURE__*/_react["default"].createElement("p", {
51
+ className: "ncf__paragraph--reduced-padding ncf__paragraph--subscription-confirmation"
52
+ }, "You are now subscribed to:"), /*#__PURE__*/_react["default"].createElement("h1", {
53
+ className: "ncf__header ncf__header--confirmation"
54
+ }, 'Premium Digital')), /*#__PURE__*/_react["default"].createElement("p", {
55
+ className: "ncf__paragraph"
56
+ }, "Exciting news! You are one of the first to try a", ' ', /*#__PURE__*/_react["default"].createElement("strong", null, offerName), ". As a thank you, we are pleased to extend your subscription to one month at no additional cost."), /*#__PURE__*/_react["default"].createElement("p", {
57
+ className: "ncf__center"
58
+ }, /*#__PURE__*/_react["default"].createElement("a", {
59
+ href: "/",
60
+ className: "ncf__button ncf__button--submit ncf__button--margin ncf__lite-sub-confirmation--lite-sub-cta"
61
+ }, "Go to FT.com")), /*#__PURE__*/_react["default"].createElement("p", {
62
+ className: "ncf__paragraph"
63
+ }, "Please save or print this page for your records as your purchase confirmation."), /*#__PURE__*/_react["default"].createElement("p", {
64
+ className: "ncf__paragraph"
65
+ }, "Here's a summary of your Premium Digital subscription:"), detailElements, /*#__PURE__*/_react["default"].createElement("div", {
66
+ className: "ncf__headed-paragraph"
67
+ }, /*#__PURE__*/_react["default"].createElement("h3", {
68
+ className: "ncf__header"
69
+ }, "Something not right?"), /*#__PURE__*/_react["default"].createElement("p", {
70
+ className: "ncf__paragraph"
71
+ }, "Go to your", ' ', /*#__PURE__*/_react["default"].createElement("a", {
72
+ className: "ncf__link ncf__link--external",
73
+ href: "https://www.ft.com/myaccount/personal-details",
74
+ target: "_blank",
75
+ rel: "noopener noreferrer",
76
+ "data-trackable": "yourAccount"
77
+ }, "account settings"), ' ', "to view or edit your account. If you need to get in touch call us on", ' ', /*#__PURE__*/_react["default"].createElement("a", {
78
+ href: "tel:+442077556248",
79
+ className: "ncf__link ncf__link--external"
80
+ }, "+44 20 7755 6248"), ". Or", ' ', /*#__PURE__*/_react["default"].createElement("a", {
81
+ className: "ncf__link ncf__link--external",
82
+ href: "https://help.ft.com/contact/",
83
+ target: "_blank",
84
+ rel: "noopener noreferrer"
85
+ }, "contact us"), ' ', "for additional support.")));
86
+ }
87
+ SevenDayPassExperimentConfirmation.propTypes = {
88
+ offerName: _propTypes["default"].string.isRequired,
89
+ details: _propTypes["default"].arrayOf(_propTypes["default"].shape({
90
+ title: _propTypes["default"].string.isRequired,
91
+ data: _propTypes["default"].string.isRequired
92
+ }))
93
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "30.0.0",
3
+ "version": "30.1.0",
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": {
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://github.com/Financial-Times/n-conversion-forms#readme",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.11.2",
28
- "@financial-times/n-pricing": "5.6.1",
28
+ "@financial-times/n-pricing": "6.0.0",
29
29
  "classnames": "2.3.2",
30
30
  "fetchres": "1.7.2",
31
31
  "lodash.get": "4.4.2",