tg-core-components 6.2.0-crypto.1 → 6.2.0-edit-profile.1
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/es/lib/WithValidation/rules/blacklistedCharacters.js +3 -0
- package/es/lib/WithValidation/rules/noSpecialCharacters.js +3 -0
- package/es/lib/WithValidation/rules/phone.js +2 -2
- package/es/widgets/AccountDetail/index.js +18 -5
- package/lib/lib/WithValidation/rules/blacklistedCharacters.js +9 -0
- package/lib/lib/WithValidation/rules/noSpecialCharacters.js +9 -0
- package/lib/lib/WithValidation/rules/phone.js +2 -2
- package/lib/widgets/AccountDetail/index.js +30 -5
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default (function (
|
|
2
|
-
return
|
|
1
|
+
export default (function (value) {
|
|
2
|
+
return value.match(/^\+?\d{9,17}$/);
|
|
3
3
|
});
|
|
@@ -3,6 +3,10 @@ import compose from 'recompose/compose';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { injectIntl } from 'react-intl';
|
|
5
5
|
import require from '../../lib/WithValidation/rules/required';
|
|
6
|
+
import phone from '../../lib/WithValidation/rules/phone';
|
|
7
|
+
import blacklistedCharacters from '../../lib/WithValidation/rules/blacklistedCharacters';
|
|
8
|
+
import noSpecialCharacters from '../../lib/WithValidation/rules/noSpecialCharacters';
|
|
9
|
+
import stringWithoutNumbers from '../../lib/WithValidation/rules/stringWithoutNumbers';
|
|
6
10
|
import WithValidation from '../../lib/WithValidation';
|
|
7
11
|
import Input from '../../components/Input';
|
|
8
12
|
import Select from '../../components/Select';
|
|
@@ -45,7 +49,8 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
45
49
|
jurisdiction = _ref.jurisdiction,
|
|
46
50
|
countries = _ref.countries,
|
|
47
51
|
isLoading = _ref.isLoading,
|
|
48
|
-
isComplete = _ref.isComplete
|
|
52
|
+
isComplete = _ref.isComplete,
|
|
53
|
+
showCallingCode = _ref.showCallingCode;
|
|
49
54
|
|
|
50
55
|
return React.createElement(
|
|
51
56
|
'form',
|
|
@@ -157,6 +162,14 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
157
162
|
id: 'title.mobile_number',
|
|
158
163
|
defaultMessage: 'Mobile number'
|
|
159
164
|
}, intl),
|
|
165
|
+
callingCodes: showCallingCode && countries ? countries.sort(function (a, b) {
|
|
166
|
+
return Number(a.callingCode) - Number(b.callingCode);
|
|
167
|
+
}).map(function (i) {
|
|
168
|
+
return {
|
|
169
|
+
value: '00' + i.callingCode,
|
|
170
|
+
label: '+' + i.callingCode + ' ' + (countryEmojiFlags[i.value] || '')
|
|
171
|
+
};
|
|
172
|
+
}) : [],
|
|
160
173
|
name: 'MobilePhoneNumber',
|
|
161
174
|
autoComplete: 'off',
|
|
162
175
|
status: errors.MobilePhoneNumber && 'failure' || 'idle',
|
|
@@ -266,10 +279,10 @@ AccountDetail.defaultProps = {
|
|
|
266
279
|
};
|
|
267
280
|
|
|
268
281
|
var rules = {
|
|
269
|
-
MobilePhoneNumber: [[require, 'error.empty.mobilePhoneNumber']],
|
|
270
|
-
Address1: [[require, 'error.empty.address']],
|
|
271
|
-
Zip: [[require, 'error.empty.zip_code']],
|
|
272
|
-
City: [[require, 'error.empty.city']],
|
|
282
|
+
MobilePhoneNumber: [[require, 'error.empty.mobilePhoneNumber'], [phone, 'error.condition.phone']],
|
|
283
|
+
Address1: [[require, 'error.empty.address'], [blacklistedCharacters, 'error.format.address']],
|
|
284
|
+
Zip: [[require, 'error.empty.zip_code'], [noSpecialCharacters, 'error.format.zip']],
|
|
285
|
+
City: [[require, 'error.empty.city'], [stringWithoutNumbers, 'error.invalid.city'], [blacklistedCharacters, 'error.invalid.city']],
|
|
273
286
|
Password: [[require, 'error.empty.password']],
|
|
274
287
|
Country: [[require, 'error.empty.country']],
|
|
275
288
|
Gender: [[require, 'error.empty.gender']]
|
|
@@ -22,6 +22,22 @@ var _required = require('../../lib/WithValidation/rules/required');
|
|
|
22
22
|
|
|
23
23
|
var _required2 = _interopRequireDefault(_required);
|
|
24
24
|
|
|
25
|
+
var _phone = require('../../lib/WithValidation/rules/phone');
|
|
26
|
+
|
|
27
|
+
var _phone2 = _interopRequireDefault(_phone);
|
|
28
|
+
|
|
29
|
+
var _blacklistedCharacters = require('../../lib/WithValidation/rules/blacklistedCharacters');
|
|
30
|
+
|
|
31
|
+
var _blacklistedCharacters2 = _interopRequireDefault(_blacklistedCharacters);
|
|
32
|
+
|
|
33
|
+
var _noSpecialCharacters = require('../../lib/WithValidation/rules/noSpecialCharacters');
|
|
34
|
+
|
|
35
|
+
var _noSpecialCharacters2 = _interopRequireDefault(_noSpecialCharacters);
|
|
36
|
+
|
|
37
|
+
var _stringWithoutNumbers = require('../../lib/WithValidation/rules/stringWithoutNumbers');
|
|
38
|
+
|
|
39
|
+
var _stringWithoutNumbers2 = _interopRequireDefault(_stringWithoutNumbers);
|
|
40
|
+
|
|
25
41
|
var _WithValidation = require('../../lib/WithValidation');
|
|
26
42
|
|
|
27
43
|
var _WithValidation2 = _interopRequireDefault(_WithValidation);
|
|
@@ -86,7 +102,8 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
86
102
|
jurisdiction = _ref.jurisdiction,
|
|
87
103
|
countries = _ref.countries,
|
|
88
104
|
isLoading = _ref.isLoading,
|
|
89
|
-
isComplete = _ref.isComplete
|
|
105
|
+
isComplete = _ref.isComplete,
|
|
106
|
+
showCallingCode = _ref.showCallingCode;
|
|
90
107
|
|
|
91
108
|
return _react2.default.createElement(
|
|
92
109
|
'form',
|
|
@@ -198,6 +215,14 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
198
215
|
id: 'title.mobile_number',
|
|
199
216
|
defaultMessage: 'Mobile number'
|
|
200
217
|
}, intl),
|
|
218
|
+
callingCodes: showCallingCode && countries ? countries.sort(function (a, b) {
|
|
219
|
+
return Number(a.callingCode) - Number(b.callingCode);
|
|
220
|
+
}).map(function (i) {
|
|
221
|
+
return {
|
|
222
|
+
value: '00' + i.callingCode,
|
|
223
|
+
label: '+' + i.callingCode + ' ' + (_countryEmojiFlags2.default[i.value] || '')
|
|
224
|
+
};
|
|
225
|
+
}) : [],
|
|
201
226
|
name: 'MobilePhoneNumber',
|
|
202
227
|
autoComplete: 'off',
|
|
203
228
|
status: errors.MobilePhoneNumber && 'failure' || 'idle',
|
|
@@ -307,10 +332,10 @@ AccountDetail.defaultProps = {
|
|
|
307
332
|
};
|
|
308
333
|
|
|
309
334
|
var rules = {
|
|
310
|
-
MobilePhoneNumber: [[_required2.default, 'error.empty.mobilePhoneNumber']],
|
|
311
|
-
Address1: [[_required2.default, 'error.empty.address']],
|
|
312
|
-
Zip: [[_required2.default, 'error.empty.zip_code']],
|
|
313
|
-
City: [[_required2.default, 'error.empty.city']],
|
|
335
|
+
MobilePhoneNumber: [[_required2.default, 'error.empty.mobilePhoneNumber'], [_phone2.default, 'error.condition.phone']],
|
|
336
|
+
Address1: [[_required2.default, 'error.empty.address'], [_blacklistedCharacters2.default, 'error.format.address']],
|
|
337
|
+
Zip: [[_required2.default, 'error.empty.zip_code'], [_noSpecialCharacters2.default, 'error.format.zip']],
|
|
338
|
+
City: [[_required2.default, 'error.empty.city'], [_stringWithoutNumbers2.default, 'error.invalid.city'], [_blacklistedCharacters2.default, 'error.invalid.city']],
|
|
314
339
|
Password: [[_required2.default, 'error.empty.password']],
|
|
315
340
|
Country: [[_required2.default, 'error.empty.country']],
|
|
316
341
|
Gender: [[_required2.default, 'error.empty.gender']]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tg-core-components",
|
|
3
|
-
"version": "6.2.0-
|
|
3
|
+
"version": "6.2.0-edit-profile.1",
|
|
4
4
|
"description": "tg-core-components",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"webpack": "^3.0.0",
|
|
77
77
|
"webpack-blocks": "^1.0.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "a86b4bd5cbd94731bfee1dce5f01b558a17dd1f4"
|
|
80
80
|
}
|