@financial-times/n-conversion-forms 27.3.3 → 27.4.2
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/components/__snapshots__/delivery-address-type.spec.js.snap +4 -0
- package/components/__snapshots__/phone.spec.js.snap +5 -5
- package/components/delivery-address-type.jsx +3 -0
- package/components/delivery-city.jsx +8 -2
- package/components/phone.jsx +2 -1
- package/dist/delivery-address-type.js +8 -3
- package/dist/delivery-city.js +7 -1
- package/dist/phone.js +1 -1
- package/package.json +1 -1
- package/utils/payment-type.js +12 -0
|
@@ -10,6 +10,8 @@ exports[`DeliveryAddressType renders with all props 1`] = `
|
|
|
10
10
|
<span class="o-forms-title__main">
|
|
11
11
|
Address type
|
|
12
12
|
</span>
|
|
13
|
+
<span class="o-forms-title__prompt">
|
|
14
|
+
</span>
|
|
13
15
|
</span>
|
|
14
16
|
<div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
15
17
|
<label for="home"
|
|
@@ -72,6 +74,8 @@ exports[`DeliveryAddressType renders with default props 1`] = `
|
|
|
72
74
|
<span class="o-forms-title__main">
|
|
73
75
|
Address type
|
|
74
76
|
</span>
|
|
77
|
+
<span class="o-forms-title__prompt">
|
|
78
|
+
</span>
|
|
75
79
|
</span>
|
|
76
80
|
<div class="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
77
81
|
<label for="home"
|
|
@@ -11,7 +11,7 @@ exports[`Phone render a disabled phone input 1`] = `
|
|
|
11
11
|
Phone number
|
|
12
12
|
</span>
|
|
13
13
|
<span class="o-forms-title__prompt">
|
|
14
|
-
|
|
14
|
+
We need this for security purposes. We'll never send anything without consent (Use numbers only)
|
|
15
15
|
</span>
|
|
16
16
|
</span>
|
|
17
17
|
<span class="o-forms-input o-forms-input--text">
|
|
@@ -48,7 +48,7 @@ exports[`Phone render a phone input with a label 1`] = `
|
|
|
48
48
|
Phone number
|
|
49
49
|
</span>
|
|
50
50
|
<span class="o-forms-title__prompt">
|
|
51
|
-
|
|
51
|
+
We need this for security purposes. We'll never send anything without consent (Use numbers only)
|
|
52
52
|
</span>
|
|
53
53
|
</span>
|
|
54
54
|
<span class="o-forms-input o-forms-input--text">
|
|
@@ -84,7 +84,7 @@ exports[`Phone render a phone input with a label for B2B 1`] = `
|
|
|
84
84
|
Work phone number
|
|
85
85
|
</span>
|
|
86
86
|
<span class="o-forms-title__prompt">
|
|
87
|
-
|
|
87
|
+
We need this for security purposes. We'll never send anything without consent (Use numbers only)
|
|
88
88
|
</span>
|
|
89
89
|
</span>
|
|
90
90
|
<span class="o-forms-input o-forms-input--text">
|
|
@@ -120,7 +120,7 @@ exports[`Phone render a phone input with error styling 1`] = `
|
|
|
120
120
|
Phone number
|
|
121
121
|
</span>
|
|
122
122
|
<span class="o-forms-title__prompt">
|
|
123
|
-
|
|
123
|
+
We need this for security purposes. We'll never send anything without consent (Use numbers only)
|
|
124
124
|
</span>
|
|
125
125
|
</span>
|
|
126
126
|
<span class="o-forms-input o-forms-input--text o-forms-input--invalid">
|
|
@@ -156,7 +156,7 @@ exports[`Phone render default label if B2B and educational licence 1`] = `
|
|
|
156
156
|
Phone number
|
|
157
157
|
</span>
|
|
158
158
|
<span class="o-forms-title__prompt">
|
|
159
|
-
|
|
159
|
+
We need this for security purposes. We'll never send anything without consent (Use numbers only)
|
|
160
160
|
</span>
|
|
161
161
|
</span>
|
|
162
162
|
<span class="o-forms-input o-forms-input--text">
|
|
@@ -13,6 +13,7 @@ export function DeliveryAddressType ({
|
|
|
13
13
|
inputName = 'deliveryAddressType',
|
|
14
14
|
options = ['home', 'company', 'pobox'],
|
|
15
15
|
editMode = false,
|
|
16
|
+
titlePrompt = ''
|
|
16
17
|
}) {
|
|
17
18
|
return (
|
|
18
19
|
<div
|
|
@@ -23,6 +24,7 @@ export function DeliveryAddressType ({
|
|
|
23
24
|
>
|
|
24
25
|
<span className="o-forms-title">
|
|
25
26
|
<span className="o-forms-title__main">Address type</span>
|
|
27
|
+
<span className="o-forms-title__prompt">{titlePrompt}</span>
|
|
26
28
|
</span>
|
|
27
29
|
|
|
28
30
|
<div className="o-forms-input o-forms-input--inline o-forms-input--radio-round">
|
|
@@ -59,4 +61,5 @@ DeliveryAddressType.propTypes = {
|
|
|
59
61
|
inputName: PropTypes.string,
|
|
60
62
|
value: PropTypes.oneOf(['home', 'company', 'pobox']),
|
|
61
63
|
options: PropTypes.arrayOf(PropTypes.oneOf(['home', 'company', 'pobox'])),
|
|
64
|
+
titlePrompt:PropTypes.string,
|
|
62
65
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import { countriesSupportedISO } from '../helpers/supportedCountries';
|
|
4
|
+
import { countriesSupportedISO, identifyFTShippingZone } from '../helpers/supportedCountries';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export function DeliveryCity ({
|
|
@@ -22,8 +22,14 @@ export function DeliveryCity ({
|
|
|
22
22
|
CAN: 'e.g. Montreal',
|
|
23
23
|
ARE: 'e.g. Dubai'
|
|
24
24
|
};
|
|
25
|
+
const FTShippingZone = identifyFTShippingZone(country);
|
|
25
26
|
|
|
26
|
-
const
|
|
27
|
+
const labelMapping = {
|
|
28
|
+
ARE: 'Emirate or City',
|
|
29
|
+
APAC: 'City/Prefecture',
|
|
30
|
+
DEFAULT: 'City',
|
|
31
|
+
};
|
|
32
|
+
const inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
|
|
27
33
|
|
|
28
34
|
return (
|
|
29
35
|
<label
|
package/components/phone.jsx
CHANGED
|
@@ -39,7 +39,8 @@ export function Phone ({
|
|
|
39
39
|
<span className={fieldTitleClassName}>
|
|
40
40
|
<span className="o-forms-title__main">{labelText}</span>
|
|
41
41
|
<span className="o-forms-title__prompt">
|
|
42
|
-
|
|
42
|
+
We need this for security purposes. We'll never send anything
|
|
43
|
+
without consent (Use numbers only)
|
|
43
44
|
</span>
|
|
44
45
|
</span>
|
|
45
46
|
<span className={inputWrapperClassNames}>
|
|
@@ -32,7 +32,9 @@ function DeliveryAddressType(_ref) {
|
|
|
32
32
|
_ref$options = _ref.options,
|
|
33
33
|
options = _ref$options === void 0 ? ['home', 'company', 'pobox'] : _ref$options,
|
|
34
34
|
_ref$editMode = _ref.editMode,
|
|
35
|
-
editMode = _ref$editMode === void 0 ? false : _ref$editMode
|
|
35
|
+
editMode = _ref$editMode === void 0 ? false : _ref$editMode,
|
|
36
|
+
_ref$titlePrompt = _ref.titlePrompt,
|
|
37
|
+
titlePrompt = _ref$titlePrompt === void 0 ? '' : _ref$titlePrompt;
|
|
36
38
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
39
|
id: fieldId,
|
|
38
40
|
className: "o-forms-field ncf__delivery-address-type",
|
|
@@ -42,7 +44,9 @@ function DeliveryAddressType(_ref) {
|
|
|
42
44
|
className: "o-forms-title"
|
|
43
45
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
44
46
|
className: "o-forms-title__main"
|
|
45
|
-
}, "Address type")
|
|
47
|
+
}, "Address type"), /*#__PURE__*/_react["default"].createElement("span", {
|
|
48
|
+
className: "o-forms-title__prompt"
|
|
49
|
+
}, titlePrompt)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
46
50
|
className: "o-forms-input o-forms-input--inline o-forms-input--radio-round"
|
|
47
51
|
}, options.map(function (option) {
|
|
48
52
|
var type = addressTypes.find(function (item) {
|
|
@@ -71,5 +75,6 @@ DeliveryAddressType.propTypes = {
|
|
|
71
75
|
fieldId: _propTypes["default"].string,
|
|
72
76
|
inputName: _propTypes["default"].string,
|
|
73
77
|
value: _propTypes["default"].oneOf(['home', 'company', 'pobox']),
|
|
74
|
-
options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox']))
|
|
78
|
+
options: _propTypes["default"].arrayOf(_propTypes["default"].oneOf(['home', 'company', 'pobox'])),
|
|
79
|
+
titlePrompt: _propTypes["default"].string
|
|
75
80
|
};
|
package/dist/delivery-city.js
CHANGED
|
@@ -33,7 +33,13 @@ function DeliveryCity(_ref) {
|
|
|
33
33
|
CAN: 'e.g. Montreal',
|
|
34
34
|
ARE: 'e.g. Dubai'
|
|
35
35
|
};
|
|
36
|
-
var
|
|
36
|
+
var FTShippingZone = (0, _supportedCountries.identifyFTShippingZone)(country);
|
|
37
|
+
var labelMapping = {
|
|
38
|
+
ARE: 'Emirate or City',
|
|
39
|
+
APAC: 'City/Prefecture',
|
|
40
|
+
DEFAULT: 'City'
|
|
41
|
+
};
|
|
42
|
+
var inputLabel = labelMapping[FTShippingZone] ? labelMapping[FTShippingZone] : labelMapping['DEFAULT'];
|
|
37
43
|
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
38
44
|
id: "deliveryCityField",
|
|
39
45
|
className: "o-forms-field ncf__validation-error",
|
package/dist/phone.js
CHANGED
|
@@ -55,7 +55,7 @@ function Phone(_ref) {
|
|
|
55
55
|
className: "o-forms-title__main"
|
|
56
56
|
}, labelText), /*#__PURE__*/_react["default"].createElement("span", {
|
|
57
57
|
className: "o-forms-title__prompt"
|
|
58
|
-
}, "
|
|
58
|
+
}, "We need this for security purposes. We'll never send anything without consent (Use numbers only)")), /*#__PURE__*/_react["default"].createElement("span", {
|
|
59
59
|
className: inputWrapperClassNames
|
|
60
60
|
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
61
61
|
type: "tel",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@financial-times/n-conversion-forms",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.4.2",
|
|
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": {
|
package/utils/payment-type.js
CHANGED
|
@@ -115,6 +115,18 @@ class PaymentType {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Hide the payment types panel
|
|
120
|
+
*/
|
|
121
|
+
hidePanel () {
|
|
122
|
+
const content = this.$paymentType.querySelectorAll(
|
|
123
|
+
'.ncf__payment-type-panel'
|
|
124
|
+
);
|
|
125
|
+
for (let i = 0; i < content.length; i++) {
|
|
126
|
+
const element = content[i];
|
|
127
|
+
element.classList.add('ncf__hidden');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
118
130
|
|
|
119
131
|
static get CREDITCARD () {
|
|
120
132
|
return 'creditcard';
|