@financial-times/n-conversion-forms 28.7.0 → 28.8.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,86 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`B2CPartnershipConfirmation renders Premium access for premium subscription 1`] = `
3
+ exports[`B2CPartnershipConfirmation renders FT access if subscription prop is null 1`] = `
4
+ <div class="ncf ncf__wrapper">
5
+ <div class="ncf__center">
6
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
7
+ </div>
8
+ <div class="ncf__paragraph">
9
+ <h1 class="ncf__header ncf__header--confirmation">
10
+ Welcome to your FT access
11
+ </h1>
12
+ </div>
13
+ </div>
14
+ <p class="ncf__paragraph">
15
+ Please check your email to confirm your account and set your password.
16
+ </p>
17
+ <p class="ncf__paragraph">
18
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
19
+ </p>
20
+ hello
21
+ <p class="ncf__paragraph ncf__center">
22
+ <a href="/"
23
+ class="ncf__link"
24
+ >
25
+ Start reading
26
+ </a>
27
+ </p>
28
+ <p class="ncf__paragraph">
29
+ <div class="ncf__strong">
30
+ Can we help?
31
+ </div>
32
+ For any queries about your Premium subscription please
33
+ <a href="https://help.ft.com/"
34
+ class="ncf__link"
35
+ >
36
+ contact Customer Care
37
+ </a>
38
+ .
39
+ </p>
40
+ </div>
41
+ `;
42
+
43
+ exports[`B2CPartnershipConfirmation renders FT access if subscription prop is undefined 1`] = `
44
+ <div class="ncf ncf__wrapper">
45
+ <div class="ncf__center">
46
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
47
+ </div>
48
+ <div class="ncf__paragraph">
49
+ <h1 class="ncf__header ncf__header--confirmation">
50
+ Welcome to your FT access
51
+ </h1>
52
+ </div>
53
+ </div>
54
+ <p class="ncf__paragraph">
55
+ Please check your email to confirm your account and set your password.
56
+ </p>
57
+ <p class="ncf__paragraph">
58
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
59
+ </p>
60
+ hello
61
+ <p class="ncf__paragraph ncf__center">
62
+ <a href="/"
63
+ class="ncf__link"
64
+ >
65
+ Start reading
66
+ </a>
67
+ </p>
68
+ <p class="ncf__paragraph">
69
+ <div class="ncf__strong">
70
+ Can we help?
71
+ </div>
72
+ For any queries about your Premium subscription please
73
+ <a href="https://help.ft.com/"
74
+ class="ncf__link"
75
+ >
76
+ contact Customer Care
77
+ </a>
78
+ .
79
+ </p>
80
+ </div>
81
+ `;
82
+
83
+ exports[`B2CPartnershipConfirmation renders Premium access for premium subscription lowercase 1`] = `
4
84
  <div class="ncf ncf__wrapper">
5
85
  <div class="ncf__center">
6
86
  <div class="ncf__icon ncf__icon--tick ncf__icon--large">
@@ -40,7 +120,7 @@ exports[`B2CPartnershipConfirmation renders Premium access for premium subscript
40
120
  </div>
41
121
  `;
42
122
 
43
- exports[`B2CPartnershipConfirmation renders Premium access if subscription prop is null 1`] = `
123
+ exports[`B2CPartnershipConfirmation renders Premium access for premium subscription uppercase 1`] = `
44
124
  <div class="ncf ncf__wrapper">
45
125
  <div class="ncf__center">
46
126
  <div class="ncf__icon ncf__icon--tick ncf__icon--large">
@@ -80,7 +160,47 @@ exports[`B2CPartnershipConfirmation renders Premium access if subscription prop
80
160
  </div>
81
161
  `;
82
162
 
83
- exports[`B2CPartnershipConfirmation renders Standard access for standard subscription 1`] = `
163
+ exports[`B2CPartnershipConfirmation renders Standard access for standard subscription lowercase 1`] = `
164
+ <div class="ncf ncf__wrapper">
165
+ <div class="ncf__center">
166
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
167
+ </div>
168
+ <div class="ncf__paragraph">
169
+ <h1 class="ncf__header ncf__header--confirmation">
170
+ Welcome to your Standard access
171
+ </h1>
172
+ </div>
173
+ </div>
174
+ <p class="ncf__paragraph">
175
+ Please check your email to confirm your account and set your password.
176
+ </p>
177
+ <p class="ncf__paragraph">
178
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
179
+ </p>
180
+ hello
181
+ <p class="ncf__paragraph ncf__center">
182
+ <a href="/"
183
+ class="ncf__link"
184
+ >
185
+ Start reading
186
+ </a>
187
+ </p>
188
+ <p class="ncf__paragraph">
189
+ <div class="ncf__strong">
190
+ Can we help?
191
+ </div>
192
+ For any queries about your Premium subscription please
193
+ <a href="https://help.ft.com/"
194
+ class="ncf__link"
195
+ >
196
+ contact Customer Care
197
+ </a>
198
+ .
199
+ </p>
200
+ </div>
201
+ `;
202
+
203
+ exports[`B2CPartnershipConfirmation renders Standard access for standard subscription uppercase 1`] = `
84
204
  <div class="ncf ncf__wrapper">
85
205
  <div class="ncf__center">
86
206
  <div class="ncf__icon ncf__icon--tick ncf__icon--large">
@@ -127,7 +247,87 @@ exports[`B2CPartnershipConfirmation renders as default 1`] = `
127
247
  </div>
128
248
  <div class="ncf__paragraph">
129
249
  <h1 class="ncf__header ncf__header--confirmation">
130
- Welcome to your Premium access
250
+ Welcome to your FT access
251
+ </h1>
252
+ </div>
253
+ </div>
254
+ <p class="ncf__paragraph">
255
+ Please check your email to confirm your account and set your password.
256
+ </p>
257
+ <p class="ncf__paragraph">
258
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
259
+ </p>
260
+ hello
261
+ <p class="ncf__paragraph ncf__center">
262
+ <a href="/"
263
+ class="ncf__link"
264
+ >
265
+ Start reading
266
+ </a>
267
+ </p>
268
+ <p class="ncf__paragraph">
269
+ <div class="ncf__strong">
270
+ Can we help?
271
+ </div>
272
+ For any queries about your Premium subscription please
273
+ <a href="https://help.ft.com/"
274
+ class="ncf__link"
275
+ >
276
+ contact Customer Care
277
+ </a>
278
+ .
279
+ </p>
280
+ </div>
281
+ `;
282
+
283
+ exports[`B2CPartnershipConfirmation renders ePaper access for ePaper subscription lowercase 1`] = `
284
+ <div class="ncf ncf__wrapper">
285
+ <div class="ncf__center">
286
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
287
+ </div>
288
+ <div class="ncf__paragraph">
289
+ <h1 class="ncf__header ncf__header--confirmation">
290
+ Welcome to your ePaper access
291
+ </h1>
292
+ </div>
293
+ </div>
294
+ <p class="ncf__paragraph">
295
+ Please check your email to confirm your account and set your password.
296
+ </p>
297
+ <p class="ncf__paragraph">
298
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
299
+ </p>
300
+ hello
301
+ <p class="ncf__paragraph ncf__center">
302
+ <a href="/"
303
+ class="ncf__link"
304
+ >
305
+ Start reading
306
+ </a>
307
+ </p>
308
+ <p class="ncf__paragraph">
309
+ <div class="ncf__strong">
310
+ Can we help?
311
+ </div>
312
+ For any queries about your Premium subscription please
313
+ <a href="https://help.ft.com/"
314
+ class="ncf__link"
315
+ >
316
+ contact Customer Care
317
+ </a>
318
+ .
319
+ </p>
320
+ </div>
321
+ `;
322
+
323
+ exports[`B2CPartnershipConfirmation renders ePaper access for ePaper subscription uppercase 1`] = `
324
+ <div class="ncf ncf__wrapper">
325
+ <div class="ncf__center">
326
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
327
+ </div>
328
+ <div class="ncf__paragraph">
329
+ <h1 class="ncf__header ncf__header--confirmation">
330
+ Welcome to your ePaper access
131
331
  </h1>
132
332
  </div>
133
333
  </div>
@@ -1,6 +1,12 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
+ const productCodeMapping = {
5
+ P1: 'Standard',
6
+ P2: 'Premium',
7
+ EP: 'ePaper',
8
+ };
9
+
4
10
  export function B2CPartnershipConfirmation({
5
11
  ctaElement = null,
6
12
  productCode = null,
@@ -15,8 +21,11 @@ export function B2CPartnershipConfirmation({
15
21
  className: 'ncf__link',
16
22
  };
17
23
 
18
- const accessType =
19
- productCode?.toUpperCase() === 'P1' ? 'Standard' : 'Premium';
24
+ // Welcome to your Standard access
25
+ // Welcome to your Premium access
26
+ // Welcome to your ePaper access
27
+ // Welcome to your FT access (default)
28
+ const accessType = productCodeMapping[productCode?.toUpperCase()] || 'FT';
20
29
 
21
30
  return (
22
31
  <div className="ncf ncf__wrapper">
@@ -10,21 +10,51 @@ describe('B2CPartnershipConfirmation', () => {
10
10
  expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
11
11
  });
12
12
 
13
- it('renders Premium access for premium subscription', () => {
13
+ it('renders Premium access for premium subscription lowercase', () => {
14
14
  const props = { ctaElement: 'hello', productCode: 'p2' };
15
15
 
16
16
  expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
17
17
  });
18
18
 
19
- it('renders Standard access for standard subscription', () => {
19
+ it('renders Premium access for premium subscription uppercase', () => {
20
+ const props = { ctaElement: 'hello', productCode: 'P2' };
21
+
22
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
23
+ });
24
+
25
+ it('renders Standard access for standard subscription lowercase', () => {
20
26
  const props = { ctaElement: 'hello', productCode: 'p1' };
21
27
 
22
28
  expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
23
29
  });
24
30
 
25
- it('renders Premium access if subscription prop is null', () => {
31
+ it('renders Standard access for standard subscription uppercase', () => {
32
+ const props = { ctaElement: 'hello', productCode: 'P1' };
33
+
34
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
35
+ });
36
+
37
+ it('renders ePaper access for ePaper subscription lowercase', () => {
38
+ const props = { ctaElement: 'hello', productCode: 'ep' };
39
+
40
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
41
+ });
42
+
43
+ it('renders ePaper access for ePaper subscription uppercase', () => {
44
+ const props = { ctaElement: 'hello', productCode: 'EP' };
45
+
46
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
47
+ });
48
+
49
+ it('renders FT access if subscription prop is null', () => {
26
50
  const props = { ctaElement: 'hello', productCode: null };
27
51
 
28
52
  expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
29
53
  });
54
+
55
+ it('renders FT access if subscription prop is undefined', () => {
56
+ const props = { ctaElement: 'hello', productCode: undefined };
57
+
58
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
59
+ });
30
60
  });
@@ -7,6 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.B2CPartnershipConfirmation = B2CPartnershipConfirmation;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var productCodeMapping = {
11
+ P1: 'Standard',
12
+ P2: 'Premium',
13
+ EP: 'ePaper'
14
+ };
10
15
  function B2CPartnershipConfirmation(_ref) {
11
16
  var _ref$ctaElement = _ref.ctaElement,
12
17
  ctaElement = _ref$ctaElement === void 0 ? null : _ref$ctaElement,
@@ -20,7 +25,12 @@ function B2CPartnershipConfirmation(_ref) {
20
25
  href: 'https://help.ft.com/',
21
26
  className: 'ncf__link'
22
27
  };
23
- var accessType = (productCode === null || productCode === void 0 ? void 0 : productCode.toUpperCase()) === 'P1' ? 'Standard' : 'Premium';
28
+
29
+ // Welcome to your Standard access
30
+ // Welcome to your Premium access
31
+ // Welcome to your ePaper access
32
+ // Welcome to your FT access (default)
33
+ var accessType = productCodeMapping[productCode === null || productCode === void 0 ? void 0 : productCode.toUpperCase()] || 'FT';
24
34
  return /*#__PURE__*/_react["default"].createElement("div", {
25
35
  className: "ncf ncf__wrapper"
26
36
  }, /*#__PURE__*/_react["default"].createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "28.7.0",
3
+ "version": "28.8.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": {