@financial-times/n-conversion-forms 36.0.2 → 37.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/.eslintignore CHANGED
@@ -7,4 +7,5 @@ package-lock.json
7
7
  *.sh
8
8
  .*
9
9
  *.feature
10
- /docs
10
+ /docs
11
+ *.scss
@@ -10,6 +10,9 @@
10
10
  | ------ | ----- |
11
11
  | | |
12
12
 
13
+ ### Semantic versioning
14
+ <!-- What is the proposed release type (i.e. major, minor, path) for these changes and the rationale? -->
15
+
13
16
  ### Reminder
14
17
  Have you completed these common tasks (remove those that don't apply)?
15
18
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "branch": "",
3
3
  "repo": "n-conversion-forms",
4
- "version": "130d302fb2332d165d2b06495f0fc1170eac37d0",
5
- "tag": "v36.0.2"
4
+ "version": "386e3356ff251ce8366db3384b1648521b3fd5b6",
5
+ "tag": "v37.0.0"
6
6
  }
@@ -30,7 +30,7 @@ exports[`DeliveryStartDate renders with a custom date 1`] = `
30
30
  </span>
31
31
  </span>
32
32
  <p>
33
- The first print edition you will receive is on:
33
+ The first print edition you will receive is:
34
34
  <strong class="js-start-date-text">
35
35
  5th November 2019
36
36
  </strong>
@@ -68,7 +68,7 @@ exports[`DeliveryStartDate renders with a custom input max value 1`] = `
68
68
  </span>
69
69
  </span>
70
70
  <p>
71
- The first print edition you will receive is on:
71
+ The first print edition you will receive is:
72
72
  <strong class="js-start-date-text">
73
73
  2
74
74
  </strong>
@@ -107,7 +107,7 @@ exports[`DeliveryStartDate renders with a custom input min value 1`] = `
107
107
  </span>
108
108
  </span>
109
109
  <p>
110
- The first print edition you will receive is on:
110
+ The first print edition you will receive is:
111
111
  <strong class="js-start-date-text">
112
112
  </strong>
113
113
  </p>
@@ -144,7 +144,7 @@ exports[`DeliveryStartDate renders with a custom input value 1`] = `
144
144
  </span>
145
145
  </span>
146
146
  <p>
147
- The first print edition you will receive is on:
147
+ The first print edition you will receive is:
148
148
  <strong class="js-start-date-text">
149
149
  </strong>
150
150
  </p>
@@ -182,7 +182,7 @@ exports[`DeliveryStartDate renders with a disabled input 1`] = `
182
182
  </span>
183
183
  </span>
184
184
  <p>
185
- The first print edition you will receive is on:
185
+ The first print edition you will receive is:
186
186
  <strong class="js-start-date-text">
187
187
  </strong>
188
188
  </p>
@@ -219,7 +219,7 @@ exports[`DeliveryStartDate renders with an error 1`] = `
219
219
  </span>
220
220
  </span>
221
221
  <p>
222
- The first print edition you will receive is on:
222
+ The first print edition you will receive is:
223
223
  <strong class="js-start-date-text">
224
224
  </strong>
225
225
  </p>
@@ -293,7 +293,7 @@ exports[`DeliveryStartDate renders with country different than default 1`] = `
293
293
  </span>
294
294
  </span>
295
295
  <p>
296
- The first print edition you will receive is on:
296
+ The first print edition you will receive is:
297
297
  <strong class="js-start-date-text">
298
298
  </strong>
299
299
  </p>
@@ -330,7 +330,7 @@ exports[`DeliveryStartDate renders with default props 1`] = `
330
330
  </span>
331
331
  </span>
332
332
  <p>
333
- The first print edition you will receive is on:
333
+ The first print edition you will receive is:
334
334
  <strong class="js-start-date-text">
335
335
  </strong>
336
336
  </p>
@@ -32,7 +32,7 @@ export function DeliveryStartDate({
32
32
 
33
33
  const startMessage = isAddressUpdate
34
34
  ? 'We’ll start delivering to this address from:'
35
- : 'The first print edition you will receive is on:';
35
+ : 'The first print edition you will receive is:';
36
36
 
37
37
  return (
38
38
  <label
@@ -72,9 +72,7 @@ export function PaymentType({
72
72
  };
73
73
 
74
74
  const paymentTypePaypal = () => {
75
- if (showPaypalCustomerCareMessage) {
76
- return PaypalCustomerCareMessage();
77
- } else {
75
+ if (!showPaypalCustomerCareMessage) {
78
76
  return { id: 'paypal', label: 'PayPal', hide: !enablePaypal };
79
77
  }
80
78
  };
@@ -104,7 +102,8 @@ export function PaymentType({
104
102
  paymentTypeDirectDebit,
105
103
  paymentTypeApplePay,
106
104
  paymentTypeBankTransfer,
107
- ];
105
+ ].filter(Boolean);
106
+
108
107
  return paymentTypes.map((type) => {
109
108
  if (type.id === undefined) {
110
109
  return type;
@@ -239,7 +238,6 @@ export function PaymentType({
239
238
  checked: true,
240
239
  ...(isSingleTermChecked && { defaultChecked: true }),
241
240
  };
242
-
243
241
  return (
244
242
  <React.Fragment>
245
243
  {createSecuritySeal()}
@@ -252,24 +250,21 @@ export function PaymentType({
252
250
  <div className="o-forms-input__error">
253
251
  Please enter a valid payment type
254
252
  </div>
255
-
253
+ {showPaypalCustomerCareMessage && PaypalCustomerCareMessage()}
256
254
  {createDirectDebitPanel()}
257
-
258
255
  {createZuoraPanel()}
259
256
  </div>
260
257
  <div className="o-forms-field">
261
258
  {isSingleTerm && (
262
- <>
263
- <label
264
- className="o-forms-input o-forms-input--checkbox o-forms-input--suffix ncf__payment-type-pay-faster-next-time-checkbox"
265
- htmlFor="payFasterNextTime"
266
- >
267
- <input {...inputCheckProps} />
268
- <span className="o-forms-input__label">
269
- Use these details to pay faster next time
270
- </span>
271
- </label>
272
- </>
259
+ <label
260
+ className="o-forms-input o-forms-input--checkbox o-forms-input--suffix ncf__payment-type-pay-faster-next-time-checkbox"
261
+ htmlFor="payFasterNextTime"
262
+ >
263
+ <input {...inputCheckProps} />
264
+ <span className="o-forms-input__label">
265
+ Use these details to pay faster next time
266
+ </span>
267
+ </label>
273
268
  )}
274
269
  </div>
275
270
  </React.Fragment>
@@ -44,7 +44,7 @@ function DeliveryStartDate(_ref) {
44
44
  disabled: isDisabled,
45
45
  defaultValue: value
46
46
  });
47
- var startMessage = isAddressUpdate ? 'We’ll start delivering to this address from:' : 'The first print edition you will receive is on:';
47
+ var startMessage = isAddressUpdate ? 'We’ll start delivering to this address from:' : 'The first print edition you will receive is:';
48
48
  return /*#__PURE__*/_react["default"].createElement("label", {
49
49
  id: "deliveryStartDateField",
50
50
  className: "o-forms-field ncf__validation-error",
@@ -67,9 +67,7 @@ function PaymentType(_ref) {
67
67
  hide: !enableCreditcard
68
68
  };
69
69
  var paymentTypePaypal = function paymentTypePaypal() {
70
- if (showPaypalCustomerCareMessage) {
71
- return PaypalCustomerCareMessage();
72
- } else {
70
+ if (!showPaypalCustomerCareMessage) {
73
71
  return {
74
72
  id: 'paypal',
75
73
  label: 'PayPal',
@@ -93,7 +91,7 @@ function PaymentType(_ref) {
93
91
  hide: !enableBankTransfer
94
92
  };
95
93
  var createPaymentTypes = function createPaymentTypes() {
96
- var paymentTypes = [paymentTypeCreditCard, paymentTypePaypal(), paymentTypeDirectDebit, paymentTypeApplePay, paymentTypeBankTransfer];
94
+ var paymentTypes = [paymentTypeCreditCard, paymentTypePaypal(), paymentTypeDirectDebit, paymentTypeApplePay, paymentTypeBankTransfer].filter(Boolean);
97
95
  return paymentTypes.map(function (type) {
98
96
  if (type.id === undefined) {
99
97
  return type;
@@ -188,14 +186,14 @@ function PaymentType(_ref) {
188
186
  className: "o-forms-input o-forms-input--radio-box ncf__payment-type-selector"
189
187
  }, createPaymentTypes()), /*#__PURE__*/_react["default"].createElement("div", {
190
188
  className: "o-forms-input__error"
191
- }, "Please enter a valid payment type"), createDirectDebitPanel(), createZuoraPanel()), /*#__PURE__*/_react["default"].createElement("div", {
189
+ }, "Please enter a valid payment type"), showPaypalCustomerCareMessage && PaypalCustomerCareMessage(), createDirectDebitPanel(), createZuoraPanel()), /*#__PURE__*/_react["default"].createElement("div", {
192
190
  className: "o-forms-field"
193
- }, isSingleTerm && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("label", {
191
+ }, isSingleTerm && /*#__PURE__*/_react["default"].createElement("label", {
194
192
  className: "o-forms-input o-forms-input--checkbox o-forms-input--suffix ncf__payment-type-pay-faster-next-time-checkbox",
195
193
  htmlFor: "payFasterNextTime"
196
194
  }, /*#__PURE__*/_react["default"].createElement("input", inputCheckProps), /*#__PURE__*/_react["default"].createElement("span", {
197
195
  className: "o-forms-input__label"
198
- }, "Use these details to pay faster next time")))));
196
+ }, "Use these details to pay faster next time"))));
199
197
  }
200
198
  PaymentType.propTypes = {
201
199
  enableApplepay: _propTypes["default"].bool,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@financial-times/n-conversion-forms",
3
- "version": "36.0.2",
4
- "description": "Containing jsx components and styles for forms included on Accounts and Acqusition apps (next-signup, next-profile, next-retention, etc).",
3
+ "version": "37.0.0",
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": {
7
7
  "test": "dotcom-tool-kit test:local",
@@ -10,6 +10,7 @@
10
10
  }
11
11
 
12
12
  @mixin ncfPaymentType() {
13
+
13
14
  // #1 - Need to be this specific to override specific o-forms styles.
14
15
  // Helps us override the floating of the radio box so that we can have it
15
16
  // full width.
@@ -21,6 +22,7 @@
21
22
  // #1
22
23
  display: block;
23
24
  margin-bottom: oSpacingByName('s3');
25
+ width: 100%;
24
26
 
25
27
  &:last-child {
26
28
  margin-bottom: 0;
@@ -33,17 +35,27 @@
33
35
  }
34
36
 
35
37
  &-selector {
36
- margin-top: 0;
38
+ display: flex;
39
+ flex-direction: column;
40
+ justify-content: space-evenly;
41
+ align-items: baseline;
42
+ margin-bottom: oSpacingByName('s3');
43
+
44
+ @include oGridRespondTo($from: L) {
45
+ flex-direction: row;
46
+ gap: oSpacingByName('s2');
47
+ }
37
48
  }
38
49
 
39
50
  .o-forms-input--radio-box &--paypal {
51
+
40
52
  // #2
41
- [type='radio'] + .o-forms-input__label {
53
+ [type='radio']+.o-forms-input__label {
42
54
  @include buttonImageOverriding();
43
55
  background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fpp-logo-100px.png?width=300&source=next&fit=scale-down);
44
56
  }
45
57
 
46
- [type='radio']:checked + .o-forms-input__label {
58
+ [type='radio']:checked+.o-forms-input__label {
47
59
  @include buttonImageOverriding();
48
60
  background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fpp-logo-white.png?width=300&source=next&fit=scale-down);
49
61
  }
@@ -52,12 +64,12 @@
52
64
 
53
65
  .o-forms-input--radio-box &--directdebit {
54
66
  // #2
55
- [type='radio'] + .o-forms-input__label {
67
+ [type='radio']+.o-forms-input__label {
56
68
  @include buttonImageOverriding();
57
69
  background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fdirect_debit.png?width=300&source=next&fit=scale-down);
58
70
  }
59
71
 
60
- [type='radio']:checked + .o-forms-input__label {
72
+ [type='radio']:checked+.o-forms-input__label {
61
73
  @include buttonImageOverriding();
62
74
  background-image: url(https://www.ft.com/__origami/service/image/v2/images/raw/%2F%2Fwww.ft.com%2F__assets%2Fcreatives%2Fthird-party%2Fdirect_debit-white.png?width=300&source=next&fit=scale-down);
63
75
  }
@@ -113,4 +125,4 @@
113
125
 
114
126
  .o-forms-input.o-forms-input--checkbox.o-forms-input--suffix.ncf__payment-type-pay-faster-next-time-checkbox {
115
127
  margin-top: oSpacingByName('s3');
116
- }
128
+ }