@financial-times/n-conversion-forms 28.6.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 as default 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">
@@ -39,3 +119,243 @@ exports[`B2CPartnershipConfirmation renders as default 1`] = `
39
119
  </p>
40
120
  </div>
41
121
  `;
122
+
123
+ exports[`B2CPartnershipConfirmation renders Premium access for premium subscription uppercase 1`] = `
124
+ <div class="ncf ncf__wrapper">
125
+ <div class="ncf__center">
126
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
127
+ </div>
128
+ <div class="ncf__paragraph">
129
+ <h1 class="ncf__header ncf__header--confirmation">
130
+ Welcome to your Premium access
131
+ </h1>
132
+ </div>
133
+ </div>
134
+ <p class="ncf__paragraph">
135
+ Please check your email to confirm your account and set your password.
136
+ </p>
137
+ <p class="ncf__paragraph">
138
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
139
+ </p>
140
+ hello
141
+ <p class="ncf__paragraph ncf__center">
142
+ <a href="/"
143
+ class="ncf__link"
144
+ >
145
+ Start reading
146
+ </a>
147
+ </p>
148
+ <p class="ncf__paragraph">
149
+ <div class="ncf__strong">
150
+ Can we help?
151
+ </div>
152
+ For any queries about your Premium subscription please
153
+ <a href="https://help.ft.com/"
154
+ class="ncf__link"
155
+ >
156
+ contact Customer Care
157
+ </a>
158
+ .
159
+ </p>
160
+ </div>
161
+ `;
162
+
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`] = `
204
+ <div class="ncf ncf__wrapper">
205
+ <div class="ncf__center">
206
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
207
+ </div>
208
+ <div class="ncf__paragraph">
209
+ <h1 class="ncf__header ncf__header--confirmation">
210
+ Welcome to your Standard access
211
+ </h1>
212
+ </div>
213
+ </div>
214
+ <p class="ncf__paragraph">
215
+ Please check your email to confirm your account and set your password.
216
+ </p>
217
+ <p class="ncf__paragraph">
218
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
219
+ </p>
220
+ hello
221
+ <p class="ncf__paragraph ncf__center">
222
+ <a href="/"
223
+ class="ncf__link"
224
+ >
225
+ Start reading
226
+ </a>
227
+ </p>
228
+ <p class="ncf__paragraph">
229
+ <div class="ncf__strong">
230
+ Can we help?
231
+ </div>
232
+ For any queries about your Premium subscription please
233
+ <a href="https://help.ft.com/"
234
+ class="ncf__link"
235
+ >
236
+ contact Customer Care
237
+ </a>
238
+ .
239
+ </p>
240
+ </div>
241
+ `;
242
+
243
+ exports[`B2CPartnershipConfirmation renders as default 1`] = `
244
+ <div class="ncf ncf__wrapper">
245
+ <div class="ncf__center">
246
+ <div class="ncf__icon ncf__icon--tick ncf__icon--large">
247
+ </div>
248
+ <div class="ncf__paragraph">
249
+ <h1 class="ncf__header ncf__header--confirmation">
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
331
+ </h1>
332
+ </div>
333
+ </div>
334
+ <p class="ncf__paragraph">
335
+ Please check your email to confirm your account and set your password.
336
+ </p>
337
+ <p class="ncf__paragraph">
338
+ Explore the homepage &amp; enjoy your unlimited access &amp; exclusive content.
339
+ </p>
340
+ hello
341
+ <p class="ncf__paragraph ncf__center">
342
+ <a href="/"
343
+ class="ncf__link"
344
+ >
345
+ Start reading
346
+ </a>
347
+ </p>
348
+ <p class="ncf__paragraph">
349
+ <div class="ncf__strong">
350
+ Can we help?
351
+ </div>
352
+ For any queries about your Premium subscription please
353
+ <a href="https://help.ft.com/"
354
+ class="ncf__link"
355
+ >
356
+ contact Customer Care
357
+ </a>
358
+ .
359
+ </p>
360
+ </div>
361
+ `;
@@ -1,7 +1,16 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- export function B2CPartnershipConfirmation({ ctaElement = null }) {
4
+ const productCodeMapping = {
5
+ P1: 'Standard',
6
+ P2: 'Premium',
7
+ EP: 'ePaper',
8
+ };
9
+
10
+ export function B2CPartnershipConfirmation({
11
+ ctaElement = null,
12
+ productCode = null,
13
+ }) {
5
14
  const readingLinkProps = {
6
15
  href: '/',
7
16
  className: 'ncf__link',
@@ -12,6 +21,12 @@ export function B2CPartnershipConfirmation({ ctaElement = null }) {
12
21
  className: 'ncf__link',
13
22
  };
14
23
 
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';
29
+
15
30
  return (
16
31
  <div className="ncf ncf__wrapper">
17
32
  <div className="ncf__center">
@@ -19,7 +34,7 @@ export function B2CPartnershipConfirmation({ ctaElement = null }) {
19
34
  <div className="ncf__paragraph">
20
35
  {
21
36
  <h1 className="ncf__header ncf__header--confirmation">
22
- {'Welcome to your Premium access'}
37
+ {`Welcome to your ${accessType} access`}
23
38
  </h1>
24
39
  }
25
40
  </div>
@@ -57,4 +72,5 @@ export function B2CPartnershipConfirmation({ ctaElement = null }) {
57
72
 
58
73
  B2CPartnershipConfirmation.propTypes = {
59
74
  ctaElement: PropTypes.node,
75
+ productCode: PropTypes.string,
60
76
  };
@@ -9,4 +9,52 @@ describe('B2CPartnershipConfirmation', () => {
9
9
 
10
10
  expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
11
11
  });
12
+
13
+ it('renders Premium access for premium subscription lowercase', () => {
14
+ const props = { ctaElement: 'hello', productCode: 'p2' };
15
+
16
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
17
+ });
18
+
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', () => {
26
+ const props = { ctaElement: 'hello', productCode: 'p1' };
27
+
28
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
29
+ });
30
+
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', () => {
50
+ const props = { ctaElement: 'hello', productCode: null };
51
+
52
+ expect(B2CPartnershipConfirmation).toRenderCorrectly(props);
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
+ });
12
60
  });
@@ -7,9 +7,16 @@ 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
- ctaElement = _ref$ctaElement === void 0 ? null : _ref$ctaElement;
17
+ ctaElement = _ref$ctaElement === void 0 ? null : _ref$ctaElement,
18
+ _ref$productCode = _ref.productCode,
19
+ productCode = _ref$productCode === void 0 ? null : _ref$productCode;
13
20
  var readingLinkProps = {
14
21
  href: '/',
15
22
  className: 'ncf__link'
@@ -18,6 +25,12 @@ function B2CPartnershipConfirmation(_ref) {
18
25
  href: 'https://help.ft.com/',
19
26
  className: 'ncf__link'
20
27
  };
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';
21
34
  return /*#__PURE__*/_react["default"].createElement("div", {
22
35
  className: "ncf ncf__wrapper"
23
36
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -28,7 +41,7 @@ function B2CPartnershipConfirmation(_ref) {
28
41
  className: "ncf__paragraph"
29
42
  }, /*#__PURE__*/_react["default"].createElement("h1", {
30
43
  className: "ncf__header ncf__header--confirmation"
31
- }, 'Welcome to your Premium access'))), /*#__PURE__*/_react["default"].createElement("p", {
44
+ }, "Welcome to your ".concat(accessType, " access")))), /*#__PURE__*/_react["default"].createElement("p", {
32
45
  className: "ncf__paragraph"
33
46
  }, "Please check your email to confirm your account and set your password."), /*#__PURE__*/_react["default"].createElement("p", {
34
47
  className: "ncf__paragraph"
@@ -46,5 +59,6 @@ function B2CPartnershipConfirmation(_ref) {
46
59
  }, "Can we help?"), "For any queries about your Premium subscription please", ' ', /*#__PURE__*/_react["default"].createElement("a", customerCareProps, "contact Customer Care"), "."));
47
60
  }
48
61
  B2CPartnershipConfirmation.propTypes = {
49
- ctaElement: _propTypes["default"].node
62
+ ctaElement: _propTypes["default"].node,
63
+ productCode: _propTypes["default"].string
50
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "28.6.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": {