tg-core-components 6.3.0 → 6.3.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.
@@ -1,3 +1,3 @@
1
- export default (function (value) {
2
- return value.match(/^\+?\d{9,17}$/);
1
+ export default (function (phone) {
2
+ return phone ? /^[\+]?[0-9]{0,4}[0-9]{8,12}$/.test(phone) : true;
3
3
  });
@@ -3,10 +3,6 @@ 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';
10
6
  import WithValidation from '../../lib/WithValidation';
11
7
  import Input from '../../components/Input';
12
8
  import Select from '../../components/Select';
@@ -48,9 +44,7 @@ var AccountDetail = function AccountDetail(_ref) {
48
44
  onSubmit = _ref.onSubmit,
49
45
  jurisdiction = _ref.jurisdiction,
50
46
  countries = _ref.countries,
51
- isLoading = _ref.isLoading,
52
- isComplete = _ref.isComplete,
53
- showCallingCode = _ref.showCallingCode;
47
+ isLoading = _ref.isLoading;
54
48
 
55
49
  return React.createElement(
56
50
  'form',
@@ -125,7 +119,7 @@ var AccountDetail = function AccountDetail(_ref) {
125
119
  React.createElement(
126
120
  Select,
127
121
  {
128
- disabled: isComplete,
122
+ disabled: Boolean(data.Country),
129
123
  className: 'layout-item-6',
130
124
  value: data.Country,
131
125
  label: translate({
@@ -162,14 +156,6 @@ var AccountDetail = function AccountDetail(_ref) {
162
156
  id: 'title.mobile_number',
163
157
  defaultMessage: 'Mobile number'
164
158
  }, 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
- }) : [],
173
159
  name: 'MobilePhoneNumber',
174
160
  autoComplete: 'off',
175
161
  status: errors.MobilePhoneNumber && 'failure' || 'idle',
@@ -262,9 +248,7 @@ AccountDetail.propTypes = {
262
248
  /** Array of validation errors where the error display depends on which invalid rule it breaks */
263
249
  error: PropTypes.array,
264
250
  /** The submission function firing when submitting the form */
265
- onSubmit: PropTypes.func,
266
- /** If the user profile is complete or not */
267
- isComplete: PropTypes.bool
251
+ onSubmit: PropTypes.func
268
252
  };
269
253
 
270
254
  AccountDetail.defaultProps = {
@@ -274,15 +258,14 @@ AccountDetail.defaultProps = {
274
258
  value: '',
275
259
  name: '',
276
260
  error: [],
277
- onSubmit: Function,
278
- isComplete: false
261
+ onSubmit: Function
279
262
  };
280
263
 
281
264
  var rules = {
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']],
265
+ MobilePhoneNumber: [[require, 'error.empty.mobilePhoneNumber']],
266
+ Address1: [[require, 'error.empty.address']],
267
+ Zip: [[require, 'error.empty.zip_code']],
268
+ City: [[require, 'error.empty.city']],
286
269
  Password: [[require, 'error.empty.password']],
287
270
  Country: [[require, 'error.empty.country']],
288
271
  Gender: [[require, 'error.empty.gender']]
@@ -94,6 +94,7 @@ var PaymentForm = function (_Component) {
94
94
  return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref3 = PaymentForm.__proto__ || Object.getPrototypeOf(PaymentForm)).call.apply(_ref3, [this].concat(args))), _this), _this.onMessage = function (message) {
95
95
  var operatingSystem = _this.props.operatingSystem;
96
96
 
97
+ console.log({ message: message });
97
98
  var data = JSON.parse(message.data);
98
99
 
99
100
  if (data.method === 'OPEN_APP') {
@@ -31,7 +31,7 @@ var Amount = function Amount(_ref) {
31
31
  React.createElement('p', { dangerouslySetInnerHTML: { __html: content } }),
32
32
  React.createElement(Select, {
33
33
  className: 'layout-item',
34
- title: translate({ id: 'label.choose_limit' }),
34
+ title: translate({ id: 'label.choose_limit' }, intl),
35
35
  options: types,
36
36
  name: 'Timespan',
37
37
  error: errors.Timespan && translate({ id: errors.Timespan }, intl)
@@ -102,7 +102,7 @@ var ContactInfo = function (_Component) {
102
102
  onBlur: function onBlur(value) {
103
103
  return _onBlur('FirstName', value);
104
104
  },
105
- error: (errors.FirstName && translate({ id: errors.FirstName }), intl)
105
+ error: (errors.FirstName && translate({ id: errors.FirstName }, intl))
106
106
  }),
107
107
  React.createElement(Input, {
108
108
  className: 'layout-item-6',
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- exports.default = function (value) {
8
- return value.match(/^\+?\d{9,17}$/);
7
+ exports.default = function (phone) {
8
+ return phone ? /^[\+]?[0-9]{0,4}[0-9]{8,12}$/.test(phone) : true;
9
9
  };
@@ -22,22 +22,6 @@ 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
-
41
25
  var _WithValidation = require('../../lib/WithValidation');
42
26
 
43
27
  var _WithValidation2 = _interopRequireDefault(_WithValidation);
@@ -101,9 +85,7 @@ var AccountDetail = function AccountDetail(_ref) {
101
85
  onSubmit = _ref.onSubmit,
102
86
  jurisdiction = _ref.jurisdiction,
103
87
  countries = _ref.countries,
104
- isLoading = _ref.isLoading,
105
- isComplete = _ref.isComplete,
106
- showCallingCode = _ref.showCallingCode;
88
+ isLoading = _ref.isLoading;
107
89
 
108
90
  return _react2.default.createElement(
109
91
  'form',
@@ -178,7 +160,7 @@ var AccountDetail = function AccountDetail(_ref) {
178
160
  _react2.default.createElement(
179
161
  _Select2.default,
180
162
  {
181
- disabled: isComplete,
163
+ disabled: Boolean(data.Country),
182
164
  className: 'layout-item-6',
183
165
  value: data.Country,
184
166
  label: (0, _translate2.default)({
@@ -215,14 +197,6 @@ var AccountDetail = function AccountDetail(_ref) {
215
197
  id: 'title.mobile_number',
216
198
  defaultMessage: 'Mobile number'
217
199
  }, 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
- }) : [],
226
200
  name: 'MobilePhoneNumber',
227
201
  autoComplete: 'off',
228
202
  status: errors.MobilePhoneNumber && 'failure' || 'idle',
@@ -315,9 +289,7 @@ AccountDetail.propTypes = {
315
289
  /** Array of validation errors where the error display depends on which invalid rule it breaks */
316
290
  error: _propTypes2.default.array,
317
291
  /** The submission function firing when submitting the form */
318
- onSubmit: _propTypes2.default.func,
319
- /** If the user profile is complete or not */
320
- isComplete: _propTypes2.default.bool
292
+ onSubmit: _propTypes2.default.func
321
293
  };
322
294
 
323
295
  AccountDetail.defaultProps = {
@@ -327,15 +299,14 @@ AccountDetail.defaultProps = {
327
299
  value: '',
328
300
  name: '',
329
301
  error: [],
330
- onSubmit: Function,
331
- isComplete: false
302
+ onSubmit: Function
332
303
  };
333
304
 
334
305
  var rules = {
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']],
306
+ MobilePhoneNumber: [[_required2.default, 'error.empty.mobilePhoneNumber']],
307
+ Address1: [[_required2.default, 'error.empty.address']],
308
+ Zip: [[_required2.default, 'error.empty.zip_code']],
309
+ City: [[_required2.default, 'error.empty.city']],
339
310
  Password: [[_required2.default, 'error.empty.password']],
340
311
  Country: [[_required2.default, 'error.empty.country']],
341
312
  Gender: [[_required2.default, 'error.empty.gender']]
@@ -126,6 +126,7 @@ var PaymentForm = function (_Component) {
126
126
  return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref3 = PaymentForm.__proto__ || Object.getPrototypeOf(PaymentForm)).call.apply(_ref3, [this].concat(args))), _this), _this.onMessage = function (message) {
127
127
  var operatingSystem = _this.props.operatingSystem;
128
128
 
129
+ console.log({ message: message });
129
130
  var data = JSON.parse(message.data);
130
131
 
131
132
  if (data.method === 'OPEN_APP') {
@@ -48,7 +48,7 @@ var Amount = function Amount(_ref) {
48
48
  _react2.default.createElement('p', { dangerouslySetInnerHTML: { __html: content } }),
49
49
  _react2.default.createElement(_Select2.default, {
50
50
  className: 'layout-item',
51
- title: translate({ id: 'label.choose_limit' }),
51
+ title: translate({ id: 'label.choose_limit' }, intl),
52
52
  options: types,
53
53
  name: 'Timespan',
54
54
  error: errors.Timespan && translate({ id: errors.Timespan }, intl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.3.0",
3
+ "version": "6.3.2",
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": "06f3cdf713c2b8973a68fab04e7c0a74c125d723"
79
+ "gitHead": "655fb1956cc5f772c25bcb3a193836eb387d5122"
80
80
  }
@@ -1,3 +0,0 @@
1
- export default (function (value) {
2
- return !value.match(/[\+\=?!@%&<>\[\]{}()<>|$€£#\/\\]/);
3
- });
@@ -1,3 +0,0 @@
1
- export default (function (value) {
2
- return !value.match(/[\s!"#\$%&'\(\)\*\+,\-\.\/:;<>\?@\[\\\]\^_`{|}~]/);
3
- });
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- exports.default = function (value) {
8
- return !value.match(/[\+\=?!@%&<>\[\]{}()<>|$€£#\/\\]/);
9
- };
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- exports.default = function (value) {
8
- return !value.match(/[\s!"#\$%&'\(\)\*\+,\-\.\/:;<>\?@\[\\\]\^_`{|}~]/);
9
- };