@financial-times/n-conversion-forms 34.0.0 → 35.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.
package/.toolkitstate/ci.json
CHANGED
|
@@ -9,8 +9,6 @@ export function PaymentTerm({
|
|
|
9
9
|
isPrintOrBundle = false,
|
|
10
10
|
isEpaper = false,
|
|
11
11
|
options = [],
|
|
12
|
-
isFixedTermOffer = false,
|
|
13
|
-
offerDisplayName,
|
|
14
12
|
showLegal = true,
|
|
15
13
|
largePrice = false,
|
|
16
14
|
optionsInARow = false,
|
|
@@ -133,15 +131,11 @@ export function PaymentTerm({
|
|
|
133
131
|
</React.Fragment>
|
|
134
132
|
),
|
|
135
133
|
monthlyPrice: () => {},
|
|
136
|
-
renewsText: (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return (
|
|
142
|
-
<p className="ncf__payment-term__renews-text">{textToDisplay}</p>
|
|
143
|
-
);
|
|
144
|
-
},
|
|
134
|
+
renewsText: () => (
|
|
135
|
+
<p className="ncf__payment-term__renews-text">
|
|
136
|
+
{'Renews monthly unless cancelled'}
|
|
137
|
+
</p>
|
|
138
|
+
),
|
|
145
139
|
},
|
|
146
140
|
custom: {
|
|
147
141
|
price: (price) => (
|
|
@@ -235,7 +229,7 @@ export function PaymentTerm({
|
|
|
235
229
|
<div className="ncf__payment-term__description">
|
|
236
230
|
{nameMap[option.name].price(option.price)}
|
|
237
231
|
{nameMap[option.name].monthlyPrice(option.monthlyPrice)}
|
|
238
|
-
{nameMap[option.name].renewsText(
|
|
232
|
+
{nameMap[option.name].renewsText()}
|
|
239
233
|
{/* Remove this discount text temporarily in favour of monthly price */}
|
|
240
234
|
{/* <br />Save up to 25% when you pay annually */}
|
|
241
235
|
</div>
|
|
@@ -287,13 +281,9 @@ export function PaymentTerm({
|
|
|
287
281
|
return labelOverride;
|
|
288
282
|
}
|
|
289
283
|
|
|
290
|
-
const
|
|
284
|
+
const title =
|
|
291
285
|
option.name && nameMap[option.name] ? nameMap[option.name].title : '';
|
|
292
286
|
|
|
293
|
-
const title = isFixedTermOffer
|
|
294
|
-
? `${offerDisplayName} - ${defaultTitle}`
|
|
295
|
-
: defaultTitle;
|
|
296
|
-
|
|
297
287
|
let termDisplayName = '';
|
|
298
288
|
if (showTrialCopyInTitle) {
|
|
299
289
|
const termName = option.displayName
|
|
@@ -363,7 +353,7 @@ export function PaymentTerm({
|
|
|
363
353
|
|
|
364
354
|
{showLegal && (
|
|
365
355
|
<div className="ncf__payment-term__legal">
|
|
366
|
-
{isTermedSubscriptionTermType
|
|
356
|
+
{isTermedSubscriptionTermType ? (
|
|
367
357
|
<p>
|
|
368
358
|
Find out more about our cancellation policy in our{' '}
|
|
369
359
|
<a
|
|
@@ -434,9 +424,7 @@ PaymentTerm.propTypes = {
|
|
|
434
424
|
fulfilmentOption: PropTypes.string,
|
|
435
425
|
})
|
|
436
426
|
),
|
|
437
|
-
isFixedTermOffer: PropTypes.bool,
|
|
438
427
|
isTermedSubscriptionTermType: PropTypes.bool,
|
|
439
|
-
offerDisplayName: PropTypes.string,
|
|
440
428
|
showLegal: PropTypes.bool,
|
|
441
429
|
largePrice: PropTypes.bool,
|
|
442
430
|
optionsInARow: PropTypes.bool,
|
|
@@ -117,42 +117,6 @@ describe('PaymentTerm', () => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
-
describe('given isFixedTermOffer prop is set to true', () => {
|
|
121
|
-
const options = [
|
|
122
|
-
{
|
|
123
|
-
name: 'monthly',
|
|
124
|
-
price: '$5.00',
|
|
125
|
-
value: 'monthly',
|
|
126
|
-
monthlyPrice: '$5.00',
|
|
127
|
-
},
|
|
128
|
-
];
|
|
129
|
-
const wrapper = shallow(
|
|
130
|
-
<PaymentTerm
|
|
131
|
-
isFixedTermOffer={true}
|
|
132
|
-
options={options}
|
|
133
|
-
offerDisplayName="Mix & Match"
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
it('does not include renewal text', () => {
|
|
138
|
-
expect(
|
|
139
|
-
wrapper.find('.ncf__payment-term__renews-text').text()
|
|
140
|
-
).not.toMatch(/Renews (annually|monthly|quarterly) unless cancelled/);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('renders fixed term renewal text in English', () => {
|
|
144
|
-
expect(wrapper.find('.ncf__payment-term__renews-text').text()).toMatch(
|
|
145
|
-
/This subscription is for 3 months, charged monthly. You can cancel at anytime/
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('renders offer name on payment term title', () => {
|
|
150
|
-
expect(wrapper.find('.ncf__payment-term__title').text()).toMatch(
|
|
151
|
-
'Mix & Match - Monthly'
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
120
|
describe('given isTermedSubscriptionTermType is true', () => {
|
|
157
121
|
describe('options include duration expressed in weeks', () => {
|
|
158
122
|
const options = [
|
|
@@ -90,25 +90,6 @@ Basic.args = {
|
|
|
90
90
|
],
|
|
91
91
|
};
|
|
92
92
|
|
|
93
|
-
export const FixedTermOffer = (args) => (
|
|
94
|
-
<div className="ncf">
|
|
95
|
-
<Fieldset>
|
|
96
|
-
<PaymentTerm {...args} />
|
|
97
|
-
</Fieldset>
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
FixedTermOffer.args = {
|
|
101
|
-
options: [
|
|
102
|
-
{
|
|
103
|
-
name: 'monthly',
|
|
104
|
-
price: '$5.00',
|
|
105
|
-
value: 5.0,
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
isFixedTermOffer: true,
|
|
109
|
-
offerDisplayName: 'Mix & Match',
|
|
110
|
-
};
|
|
111
|
-
|
|
112
93
|
export const TermedSubscriptionTermType = (args) => (
|
|
113
94
|
<div className="ncf">
|
|
114
95
|
<Fieldset>
|
package/dist/payment-term.jsx
CHANGED
|
@@ -23,9 +23,6 @@ function PaymentTerm(_ref) {
|
|
|
23
23
|
isEpaper = _ref$isEpaper === void 0 ? false : _ref$isEpaper,
|
|
24
24
|
_ref$options = _ref.options,
|
|
25
25
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
26
|
-
_ref$isFixedTermOffer = _ref.isFixedTermOffer,
|
|
27
|
-
isFixedTermOffer = _ref$isFixedTermOffer === void 0 ? false : _ref$isFixedTermOffer,
|
|
28
|
-
offerDisplayName = _ref.offerDisplayName,
|
|
29
26
|
_ref$showLegal = _ref.showLegal,
|
|
30
27
|
showLegal = _ref$showLegal === void 0 ? true : _ref$showLegal,
|
|
31
28
|
_ref$largePrice = _ref.largePrice,
|
|
@@ -142,11 +139,10 @@ function PaymentTerm(_ref) {
|
|
|
142
139
|
}, price), " per month after the trial period.");
|
|
143
140
|
},
|
|
144
141
|
monthlyPrice: function monthlyPrice() {},
|
|
145
|
-
renewsText: function renewsText(
|
|
146
|
-
var textToDisplay = isFixedTermOffer ? 'This subscription is for 3 months, charged monthly. You can cancel at anytime' : 'Renews monthly unless cancelled';
|
|
142
|
+
renewsText: function renewsText() {
|
|
147
143
|
return /*#__PURE__*/_react["default"].createElement("p", {
|
|
148
144
|
className: "ncf__payment-term__renews-text"
|
|
149
|
-
},
|
|
145
|
+
}, 'Renews monthly unless cancelled');
|
|
150
146
|
}
|
|
151
147
|
},
|
|
152
148
|
custom: {
|
|
@@ -205,7 +201,7 @@ function PaymentTerm(_ref) {
|
|
|
205
201
|
className: "ncf__payment-term__trial-price"
|
|
206
202
|
}, 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", {
|
|
207
203
|
className: "ncf__payment-term__description"
|
|
208
|
-
}, nameMap[option.name].price(option.price), nameMap[option.name].monthlyPrice(option.monthlyPrice), nameMap[option.name].renewsText(
|
|
204
|
+
}, nameMap[option.name].price(option.price), nameMap[option.name].monthlyPrice(option.monthlyPrice), nameMap[option.name].renewsText()) :
|
|
209
205
|
// this should cover the cases different than annual, quarterly and monthly
|
|
210
206
|
// for those containing period on option.value, render custom template, for the rest keep legacy render
|
|
211
207
|
isValidPeriod(option.value) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -228,8 +224,7 @@ function PaymentTerm(_ref) {
|
|
|
228
224
|
if (isTrialOfferAsNonTrialOverride && labelOverride) {
|
|
229
225
|
return labelOverride;
|
|
230
226
|
}
|
|
231
|
-
var
|
|
232
|
-
var title = isFixedTermOffer ? "".concat(offerDisplayName, " - ").concat(defaultTitle) : defaultTitle;
|
|
227
|
+
var title = option.name && nameMap[option.name] ? nameMap[option.name].title : '';
|
|
233
228
|
var termDisplayName = '';
|
|
234
229
|
if (showTrialCopyInTitle) {
|
|
235
230
|
var termName = option.displayName ? option.displayName : 'Premium Digital';
|
|
@@ -275,7 +270,7 @@ function PaymentTerm(_ref) {
|
|
|
275
270
|
return createPaymentTerm(option);
|
|
276
271
|
})), showLegal && /*#__PURE__*/_react["default"].createElement("div", {
|
|
277
272
|
className: "ncf__payment-term__legal"
|
|
278
|
-
}, isTermedSubscriptionTermType
|
|
273
|
+
}, isTermedSubscriptionTermType ? /*#__PURE__*/_react["default"].createElement("p", null, "Find out more about our cancellation policy in our", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
279
274
|
className: "ncf__link--external",
|
|
280
275
|
href: "https://help.ft.com/legal-privacy/terms-and-conditions/",
|
|
281
276
|
title: "FT Legal Terms and Conditions help page",
|
|
@@ -314,9 +309,7 @@ PaymentTerm.propTypes = {
|
|
|
314
309
|
chargeOnText: _propTypes["default"].string,
|
|
315
310
|
fulfilmentOption: _propTypes["default"].string
|
|
316
311
|
})),
|
|
317
|
-
isFixedTermOffer: _propTypes["default"].bool,
|
|
318
312
|
isTermedSubscriptionTermType: _propTypes["default"].bool,
|
|
319
|
-
offerDisplayName: _propTypes["default"].string,
|
|
320
313
|
showLegal: _propTypes["default"].bool,
|
|
321
314
|
largePrice: _propTypes["default"].bool,
|
|
322
315
|
optionsInARow: _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": "35.0.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": {
|