@financial-times/n-conversion-forms 43.0.2 → 44.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "43bf193e6c5bb6ea45b708559bbbb5f8c4a72d5f",
5
- "tag": "v43.0.2",
6
- "buildNumber": "16560"
4
+ "version": "7378c0ba4948452dbcff7c028f0c27542e22d89d",
5
+ "tag": "v44.1.0",
6
+ "buildNumber": "16706"
7
7
  }
@@ -11,12 +11,19 @@ export function AcceptTermsSubscription({
11
11
  isSingleTerm = false,
12
12
  isTermedSubscriptionTermType = false,
13
13
  isTransition = false,
14
+ isDmccCompliantTransition = false,
14
15
  transitionType = null,
15
16
  isDeferredBilling = false,
17
+ additionalClassNames = [],
16
18
  }) {
17
19
  const divProps = {
18
20
  id: 'acceptTermsField',
19
- className: 'o-forms-field o-layout-typography ncf__validation-error',
21
+ className: classNames([
22
+ 'o-forms-field',
23
+ 'o-layout-typography',
24
+ 'ncf__validation-error',
25
+ ...additionalClassNames,
26
+ ]),
20
27
  'data-validate': 'required,checked',
21
28
  ...(isSignup && { 'data-trackable': 'sign-up-terms' }),
22
29
  };
@@ -145,6 +152,49 @@ export function AcceptTermsSubscription({
145
152
  </>
146
153
  );
147
154
 
155
+ const dmccTransitionTerms = isDmccCompliantTransition && (
156
+ <>
157
+ {transitionType === 'immediate' ? (
158
+ <li>
159
+ <span className="terms-dmcc-transition terms-dmcc-transition--immediate">
160
+ I consent to payment being taken at the end of each subscription
161
+ term until I cancel. I understand and agree that I will lose my
162
+ statutory right to cancel within 14 days of accepting my order, and
163
+ that any notice to cancel will only take effect at the end of my
164
+ subscription period. Previously paid amounts are non-refundable,
165
+ except in the event of a fault in the provision of services.
166
+ </span>
167
+ </li>
168
+ ) : (
169
+ <li>
170
+ <span className="terms-dmcc-transition terms-dmcc-transition--end-of-term">
171
+ I consent to payment being taken at the end of each subscription
172
+ term until I cancel. By accepting, I am aware that my subscription
173
+ will renew on the date given. I understand and agree that I will
174
+ lose my statutory right to cancel within 14 days of accepting my
175
+ order, and that any notice to cancel will only take effect at the
176
+ end of my subscription period. Previously paid amounts are
177
+ non-refundable, except in the event of a fault in the provision of
178
+ services.
179
+ </span>
180
+ </li>
181
+ )}
182
+ <li>
183
+ <span className="terms-dmcc-transition o3-type-body-base">
184
+ For more information, see our full{' '}
185
+ <a
186
+ href="http://help.ft.com/help/legal-privacy/terms-conditions/"
187
+ target="_blank"
188
+ rel="noopener noreferrer"
189
+ >
190
+ Terms &amp; Conditions
191
+ </a>
192
+ .
193
+ </span>
194
+ </li>
195
+ </>
196
+ );
197
+
148
198
  const deferredBillingTerms = isDeferredBilling && (
149
199
  <li>
150
200
  <span className="terms-deferred">
@@ -213,10 +263,16 @@ export function AcceptTermsSubscription({
213
263
  return (
214
264
  <div {...divProps}>
215
265
  <ul className="ncf__accept-terms-list">
216
- {autoRenewingTerms}
217
- {transitionTerms}
218
- {signupTerms}
219
- {deferredBillingTerms}
266
+ {isDmccCompliantTransition ? (
267
+ dmccTransitionTerms
268
+ ) : (
269
+ <>
270
+ {autoRenewingTerms}
271
+ {transitionTerms}
272
+ {signupTerms}
273
+ {deferredBillingTerms}
274
+ </>
275
+ )}
220
276
  </ul>
221
277
  <label className={labelClassName} htmlFor="termsAcceptance">
222
278
  <input {...inputProps} />
@@ -242,4 +298,6 @@ AcceptTermsSubscription.propTypes = {
242
298
  isTransition: PropTypes.bool,
243
299
  transitionType: PropTypes.string,
244
300
  isDeferredBilling: PropTypes.bool,
301
+ isDmccCompliantTransition: PropTypes.bool,
302
+ additionalClassNames: PropTypes.arrayOf(PropTypes.string),
245
303
  };
@@ -135,4 +135,28 @@ describe('AcceptTermsSubscription', () => {
135
135
  const deferredBillingTerms = component.find('.terms-deferred');
136
136
  expect(deferredBillingTerms.exists()).toBe(true);
137
137
  });
138
+
139
+ it('renders the terms for DMCC compliant journey with end of term transition', () => {
140
+ const props = {
141
+ isDmccCompliantTransition: true,
142
+ transitionType: 'endOfTerm',
143
+ };
144
+
145
+ const component = mount(<AcceptTermsSubscription {...props} />);
146
+
147
+ const dmccTerms = component.find('.terms-dmcc-transition--end-of-term');
148
+ expect(dmccTerms.exists()).toBe(true);
149
+ });
150
+
151
+ it('renders the terms for DMCC compliant journey with immediate transition', () => {
152
+ const props = {
153
+ isDmccCompliantTransition: true,
154
+ transitionType: 'immediate',
155
+ };
156
+
157
+ const component = mount(<AcceptTermsSubscription {...props} />);
158
+
159
+ const dmccTerms = component.find('.terms-dmcc-transition--immediate');
160
+ expect(dmccTerms.exists()).toBe(true);
161
+ });
138
162
  });
@@ -57,3 +57,11 @@ export const IsDeferredBilling = (args) => (
57
57
  IsDeferredBilling.args = {
58
58
  isDeferredBilling: true,
59
59
  };
60
+
61
+ export const IsDmccCompliantTransition = (args) => (
62
+ <AcceptTermsSubscription {...args} />
63
+ );
64
+
65
+ IsDmccCompliantTransition.args = {
66
+ isDmccCompliantTransition: true,
67
+ };
@@ -14,8 +14,6 @@ export function PaymentTerm({
14
14
  optionsInARow = false,
15
15
  billingCountry = '',
16
16
  isTermedSubscriptionTermType = false,
17
- isTrialOfferAsNonTrialOverride = false,
18
- labelOverride = '', // this is a temporary hack for the February 2024 campaign
19
17
  }) {
20
18
  /**
21
19
  * Compute monthly price for given term name
@@ -271,16 +269,6 @@ export function PaymentTerm({
271
269
  const showTrialCopyInTitle =
272
270
  option.isTrial && !isPrintOrBundle && !isDigitalEdition;
273
271
 
274
- // https://financialtimes.atlassian.net/browse/ACQ-2592
275
- // We need to have one specific trial offer to have terms displayed as non-trial.
276
- // The offer is a trial offer and should use trial mechanics but should show as non-trial.
277
- // There is nothing in the offer payload to identify when this should happen, we need to rely on the offer id.
278
- // This is a TEMPORARY hack and will be removed once the campaign is over.
279
- // A ticket as been raised already to deal with the clean up: https://financialtimes.atlassian.net/browse/ACQ-2593.
280
- if (isTrialOfferAsNonTrialOverride && labelOverride) {
281
- return labelOverride;
282
- }
283
-
284
272
  const title =
285
273
  option.name && nameMap[option.name] ? nameMap[option.name].title : '';
286
274
 
@@ -427,5 +415,4 @@ PaymentTerm.propTypes = {
427
415
  largePrice: PropTypes.bool,
428
416
  optionsInARow: PropTypes.bool,
429
417
  billingCountry: PropTypes.string,
430
- isTrialOfferAsNonTrialOverride: PropTypes.bool,
431
418
  };
@@ -194,7 +194,7 @@ describe('PaymentTerm', () => {
194
194
  );
195
195
  });
196
196
  });
197
- describe('getDisplayName trial', () => {
197
+ describe('getDisplayName', () => {
198
198
  const trialOptions = {
199
199
  ...baseOptions,
200
200
  isTrial: true,
@@ -206,19 +206,6 @@ describe('PaymentTerm', () => {
206
206
  /^Trial: Premium Digital - Monthly .*$/
207
207
  );
208
208
  });
209
- it('handles trial to non-trial payment term display name', () => {
210
- const options = [trialOptions];
211
- const wrapper = shallow(
212
- <PaymentTerm
213
- options={options}
214
- labelOverride={'some term label'}
215
- isTrialOfferAsNonTrialOverride={true}
216
- />
217
- );
218
- expect(wrapper.find('.ncf__payment-term__label').text()).toMatch(
219
- /^some term label.*$/
220
- );
221
- });
222
209
  it('renders using displayName if available', () => {
223
210
  const options = [
224
211
  {
@@ -144,38 +144,3 @@ RenewOffers.args = {
144
144
  ],
145
145
  optionsInARow: true,
146
146
  };
147
-
148
- // https://financialtimes.atlassian.net/browse/ACQ-2592
149
- // We need to have one specific trial offer to have terms displayed as non-trial.
150
- // The offer is a trial offer and should use trial mechanics but should show as non-trial.
151
- // There is nothing in the offer payload to identify when this should happen, we need to rely on the offer id.
152
- // This is a TEMPORARY hack and will be removed once the campaign is over.
153
- // A ticket as been raised already to deal with the clean up: https://financialtimes.atlassian.net/browse/ACQ-2593.
154
- export const PaymentTermLabelOverride = (args) => (
155
- <div className="ncf">
156
- <Fieldset>
157
- <PaymentTerm {...args} />
158
- </Fieldset>
159
- </div>
160
- );
161
-
162
- PaymentTermLabelOverride.args = {
163
- isTrialOfferAsNonTrialOverride: true,
164
- labelOverride: 'some fancy payment term',
165
- options: [
166
- {
167
- name: '6 monthly',
168
- isTrial: false,
169
- discount: '',
170
- selected: false,
171
- price: '$229.00',
172
- trialPrice: '$0.00',
173
- trialDuration: '',
174
- monthlyPrice: '0',
175
- amount: '229.00',
176
- trialAmount: null,
177
- value: 'P6M',
178
- currency: 'USD',
179
- },
180
- ],
181
- };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.AcceptTermsSubscription = AcceptTermsSubscription;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
10
  var _react = _interopRequireDefault(require("react"));
10
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
@@ -28,13 +29,17 @@ function AcceptTermsSubscription(_ref) {
28
29
  isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip,
29
30
  _ref$isTransition = _ref.isTransition,
30
31
  isTransition = _ref$isTransition === void 0 ? false : _ref$isTransition,
32
+ _ref$isDmccCompliantT = _ref.isDmccCompliantTransition,
33
+ isDmccCompliantTransition = _ref$isDmccCompliantT === void 0 ? false : _ref$isDmccCompliantT,
31
34
  _ref$transitionType = _ref.transitionType,
32
35
  transitionType = _ref$transitionType === void 0 ? null : _ref$transitionType,
33
36
  _ref$isDeferredBillin = _ref.isDeferredBilling,
34
- isDeferredBilling = _ref$isDeferredBillin === void 0 ? false : _ref$isDeferredBillin;
37
+ isDeferredBilling = _ref$isDeferredBillin === void 0 ? false : _ref$isDeferredBillin,
38
+ _ref$additionalClassN = _ref.additionalClassNames,
39
+ additionalClassNames = _ref$additionalClassN === void 0 ? [] : _ref$additionalClassN;
35
40
  var divProps = _objectSpread({
36
41
  id: 'acceptTermsField',
37
- className: 'o-forms-field o-layout-typography ncf__validation-error',
42
+ className: (0, _classnames["default"])(['o-forms-field', 'o-layout-typography', 'ncf__validation-error'].concat((0, _toConsumableArray2["default"])(additionalClassNames))),
38
43
  'data-validate': 'required,checked'
39
44
  }, isSignup && {
40
45
  'data-trackable': 'sign-up-terms'
@@ -91,6 +96,17 @@ function AcceptTermsSubscription(_ref) {
91
96
  target: "_blank",
92
97
  rel: "noopener noreferrer"
93
98
  }, "Terms & Conditions"), ".")));
99
+ var dmccTransitionTerms = isDmccCompliantTransition && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, transitionType === 'immediate' ? /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
100
+ className: "terms-dmcc-transition terms-dmcc-transition--immediate"
101
+ }, "I consent to payment being taken at the end of each subscription term until I cancel. I understand and agree that I will lose my statutory right to cancel within 14 days of accepting my order, and that any notice to cancel will only take effect at the end of my subscription period. Previously paid amounts are non-refundable, except in the event of a fault in the provision of services.")) : /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
102
+ className: "terms-dmcc-transition terms-dmcc-transition--end-of-term"
103
+ }, "I consent to payment being taken at the end of each subscription term until I cancel. By accepting, I am aware that my subscription will renew on the date given. I understand and agree that I will lose my statutory right to cancel within 14 days of accepting my order, and that any notice to cancel will only take effect at the end of my subscription period. Previously paid amounts are non-refundable, except in the event of a fault in the provision of services.")), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
104
+ className: "terms-dmcc-transition o3-type-body-base"
105
+ }, "For more information, see our full", ' ', /*#__PURE__*/_react["default"].createElement("a", {
106
+ href: "http://help.ft.com/help/legal-privacy/terms-conditions/",
107
+ target: "_blank",
108
+ rel: "noopener noreferrer"
109
+ }, "Terms & Conditions"), ".")));
94
110
  var deferredBillingTerms = isDeferredBilling && /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("span", {
95
111
  className: "terms-deferred"
96
112
  }, "Please note if you fail to make payment for your deferred billing plan within due date your subscription will be automatically cancelled."));
@@ -116,7 +132,7 @@ function AcceptTermsSubscription(_ref) {
116
132
  var signupTerms = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isPrintProduct ? printTerms : nonPrintTerms);
117
133
  return /*#__PURE__*/_react["default"].createElement("div", divProps, /*#__PURE__*/_react["default"].createElement("ul", {
118
134
  className: "ncf__accept-terms-list"
119
- }, autoRenewingTerms, transitionTerms, signupTerms, deferredBillingTerms), /*#__PURE__*/_react["default"].createElement("label", {
135
+ }, isDmccCompliantTransition ? dmccTransitionTerms : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, autoRenewingTerms, transitionTerms, signupTerms, deferredBillingTerms)), /*#__PURE__*/_react["default"].createElement("label", {
120
136
  className: labelClassName,
121
137
  htmlFor: "termsAcceptance"
122
138
  }, /*#__PURE__*/_react["default"].createElement("input", inputProps), /*#__PURE__*/_react["default"].createElement("span", {
@@ -135,5 +151,7 @@ AcceptTermsSubscription.propTypes = {
135
151
  isTermedSubscriptionTermType: _propTypes["default"].bool,
136
152
  isTransition: _propTypes["default"].bool,
137
153
  transitionType: _propTypes["default"].string,
138
- isDeferredBilling: _propTypes["default"].bool
154
+ isDeferredBilling: _propTypes["default"].bool,
155
+ isDmccCompliantTransition: _propTypes["default"].bool,
156
+ additionalClassNames: _propTypes["default"].arrayOf(_propTypes["default"].string)
139
157
  };
@@ -32,11 +32,7 @@ function PaymentTerm(_ref) {
32
32
  _ref$billingCountry = _ref.billingCountry,
33
33
  billingCountry = _ref$billingCountry === void 0 ? '' : _ref$billingCountry,
34
34
  _ref$isTermedSubscrip = _ref.isTermedSubscriptionTermType,
35
- isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip,
36
- _ref$isTrialOfferAsNo = _ref.isTrialOfferAsNonTrialOverride,
37
- isTrialOfferAsNonTrialOverride = _ref$isTrialOfferAsNo === void 0 ? false : _ref$isTrialOfferAsNo,
38
- _ref$labelOverride = _ref.labelOverride,
39
- labelOverride = _ref$labelOverride === void 0 ? '' : _ref$labelOverride;
35
+ isTermedSubscriptionTermType = _ref$isTermedSubscrip === void 0 ? false : _ref$isTermedSubscrip;
40
36
  /**
41
37
  * Compute monthly price for given term name
42
38
  * @param {number} amount price in number format
@@ -214,16 +210,6 @@ function PaymentTerm(_ref) {
214
210
  };
215
211
  var getTermDisplayName = function getTermDisplayName() {
216
212
  var showTrialCopyInTitle = option.isTrial && !isPrintOrBundle && !isDigitalEdition;
217
-
218
- // https://financialtimes.atlassian.net/browse/ACQ-2592
219
- // We need to have one specific trial offer to have terms displayed as non-trial.
220
- // The offer is a trial offer and should use trial mechanics but should show as non-trial.
221
- // There is nothing in the offer payload to identify when this should happen, we need to rely on the offer id.
222
- // This is a TEMPORARY hack and will be removed once the campaign is over.
223
- // A ticket as been raised already to deal with the clean up: https://financialtimes.atlassian.net/browse/ACQ-2593.
224
- if (isTrialOfferAsNonTrialOverride && labelOverride) {
225
- return labelOverride;
226
- }
227
213
  var title = option.name && nameMap[option.name] ? nameMap[option.name].title : '';
228
214
  var termDisplayName = '';
229
215
  if (showTrialCopyInTitle) {
@@ -315,6 +301,5 @@ PaymentTerm.propTypes = {
315
301
  showLegal: _propTypes["default"].bool,
316
302
  largePrice: _propTypes["default"].bool,
317
303
  optionsInARow: _propTypes["default"].bool,
318
- billingCountry: _propTypes["default"].string,
319
- isTrialOfferAsNonTrialOverride: _propTypes["default"].bool
304
+ billingCountry: _propTypes["default"].string
320
305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "43.0.2",
3
+ "version": "44.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": {