tg-core-components 5.4.3-bethard-account-changes.0 → 5.5.0-master
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/components/AcceptUpdatedTaC/index.js +8 -3
- package/es/components/Checkbox/index.js +93 -0
- package/es/components/Deposit/CardInput/index.js +1 -3
- package/es/components/Input/index.js +222 -22
- package/es/components/InputWrapper/index.js +69 -0
- package/es/components/List/ListItem.js +1 -7
- package/es/components/Notification.js +4 -4
- package/es/components/Select/index.js +202 -64
- package/es/components/Select/test.js +111 -0
- package/es/index.js +2 -2
- package/es/lib/utils/translate.js +1 -8
- package/es/misc/countryEmojiFlags.js +0 -1
- package/es/widgets/AccountDetail/index.js +53 -77
- package/es/widgets/ActivateWidget/index.js +59 -293
- package/es/widgets/BonusWidget/BonusCode.js +24 -17
- package/es/widgets/BonusWidget/index.js +83 -45
- package/es/widgets/Cashier/Payment/index.js +2 -0
- package/es/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +9 -6
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +47 -85
- package/es/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -6
- package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
- package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +163 -347
- package/es/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/es/widgets/CashierAccordion/Payment/PaymentMethodSelector/index.js +2 -2
- package/es/widgets/CashierAccordion/Payment/index.js +2 -0
- package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +8 -22
- package/es/widgets/ChangePassword/index.js +53 -40
- package/es/widgets/HistoryWidget/index.js +69 -51
- package/es/widgets/HistoryWidget/message.js +17 -20
- package/es/widgets/RequestResetPassword/index.js +15 -14
- package/es/widgets/ResetPassword/index.js +22 -18
- package/es/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
- package/es/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
- package/es/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
- package/es/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
- package/es/widgets/ResponsibleGamingWidget/helpers.js +2 -2
- package/es/widgets/ResponsibleGamingWidget/validate.js +2 -6
- package/es/widgets/Settings/index.js +2 -2
- package/es/widgets/SignIn/SignInForm.js +4 -6
- package/es/widgets/SignIn/index.js +21 -21
- package/es/widgets/SignUp/ContactInfoStep.js +5 -6
- package/es/widgets/SportsbookSettings/index.js +10 -24
- package/es/widgets/Subscriptions/index.js +3 -5
- package/lib/components/AcceptUpdatedTaC/index.js +11 -3
- package/lib/components/Checkbox/index.js +106 -0
- package/lib/components/Deposit/CardInput/index.js +1 -3
- package/lib/components/Input/index.js +223 -26
- package/lib/components/InputWrapper/index.js +85 -0
- package/lib/components/List/ListItem.js +1 -10
- package/lib/components/Notification.js +3 -3
- package/lib/components/Select/index.js +209 -63
- package/lib/components/Select/test.js +121 -0
- package/lib/index.js +7 -7
- package/lib/lib/utils/translate.js +1 -8
- package/lib/misc/countryEmojiFlags.js +0 -1
- package/lib/widgets/AccountDetail/index.js +53 -86
- package/lib/widgets/ActivateWidget/index.js +58 -305
- package/lib/widgets/BonusWidget/BonusCode.js +24 -20
- package/lib/widgets/BonusWidget/index.js +85 -44
- package/lib/widgets/Cashier/Payment/index.js +2 -0
- package/lib/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +13 -7
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +50 -88
- package/lib/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -9
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +195 -378
- package/lib/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
- package/lib/widgets/CashierAccordion/Payment/PaymentMethodSelector/index.js +2 -2
- package/lib/widgets/CashierAccordion/Payment/index.js +2 -0
- package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +10 -24
- package/lib/widgets/ChangePassword/index.js +53 -43
- package/lib/widgets/HistoryWidget/index.js +69 -51
- package/lib/widgets/HistoryWidget/message.js +17 -20
- package/lib/widgets/RequestResetPassword/index.js +15 -17
- package/lib/widgets/ResetPassword/index.js +25 -21
- package/lib/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
- package/lib/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
- package/lib/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
- package/lib/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
- package/lib/widgets/ResponsibleGamingWidget/helpers.js +2 -2
- package/lib/widgets/ResponsibleGamingWidget/validate.js +2 -6
- package/lib/widgets/Settings/index.js +6 -6
- package/lib/widgets/SignIn/SignInForm.js +7 -6
- package/lib/widgets/SignIn/index.js +25 -25
- package/lib/widgets/SignUp/ContactInfoStep.js +8 -6
- package/lib/widgets/SportsbookSettings/index.js +10 -24
- package/lib/widgets/Subscriptions/index.js +3 -11
- package/package.json +8 -3
- package/es/components/AutocompleteInput/index.js +0 -104
- package/es/components/Input/BirthdateInput.js +0 -174
- package/es/components/Input/Checkbox.js +0 -51
- package/es/components/Input/Input.js +0 -73
- package/es/components/Input/PasswordInput.js +0 -84
- package/es/components/Input/PhoneNumberInput.js +0 -111
- package/es/components/Input/input.test.js +0 -80
- package/es/components/Input/old-input.test.js +0 -100
- package/es/components/common.js +0 -339
- package/es/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -28
- package/lib/components/AutocompleteInput/index.js +0 -118
- package/lib/components/Input/BirthdateInput.js +0 -195
- package/lib/components/Input/Checkbox.js +0 -65
- package/lib/components/Input/Input.js +0 -87
- package/lib/components/Input/PasswordInput.js +0 -101
- package/lib/components/Input/PhoneNumberInput.js +0 -128
- package/lib/components/Input/input.test.js +0 -89
- package/lib/components/Input/old-input.test.js +0 -107
- package/lib/components/common.js +0 -359
- package/lib/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -44
|
@@ -5,11 +5,8 @@ import { injectIntl } from 'react-intl';
|
|
|
5
5
|
import require from '../../lib/WithValidation/rules/required';
|
|
6
6
|
import WithValidation from '../../lib/WithValidation';
|
|
7
7
|
import Input from '../../components/Input';
|
|
8
|
-
import Select from '../../components/Select';
|
|
9
8
|
import translate from '../../lib/utils/translate';
|
|
10
9
|
import Button from '../../components/Button';
|
|
11
|
-
import countryEmojiFlags from '../../misc/countryEmojiFlags';
|
|
12
|
-
import Icon from '../../components/Icon';
|
|
13
10
|
|
|
14
11
|
var AccountDetail = function AccountDetail(_ref) {
|
|
15
12
|
var data = _ref.data,
|
|
@@ -17,7 +14,6 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
17
14
|
errors = _ref.errors,
|
|
18
15
|
onSubmit = _ref.onSubmit,
|
|
19
16
|
jurisdiction = _ref.jurisdiction,
|
|
20
|
-
countries = _ref.countries,
|
|
21
17
|
isLoading = _ref.isLoading;
|
|
22
18
|
|
|
23
19
|
return React.createElement(
|
|
@@ -30,136 +26,113 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
30
26
|
disabled: true,
|
|
31
27
|
className: 'layout-item-6',
|
|
32
28
|
value: data.FirstName,
|
|
33
|
-
|
|
29
|
+
title: translate({
|
|
34
30
|
id: 'title.first_name',
|
|
35
31
|
defaultMessage: 'First name'
|
|
36
32
|
}, intl),
|
|
33
|
+
placeholder: translate({ id: 'label.first_name' }, intl),
|
|
37
34
|
name: 'FirstName',
|
|
38
|
-
|
|
39
|
-
statusText: errors.FirstName && translate({ id: errors.FirstName }, intl)
|
|
35
|
+
error: errors.FirstName && translate({ id: errors.FirstName }, intl)
|
|
40
36
|
}),
|
|
41
37
|
React.createElement(Input, {
|
|
42
38
|
disabled: true,
|
|
43
39
|
className: 'layout-item-6',
|
|
44
40
|
value: data.LastName,
|
|
45
|
-
|
|
41
|
+
title: translate({
|
|
46
42
|
id: 'title.last_name',
|
|
47
43
|
defaultMessage: 'Last name'
|
|
48
44
|
}, intl),
|
|
45
|
+
placeholder: translate({ id: 'label.last_name' }, intl),
|
|
49
46
|
name: 'LastName',
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
error: errors.LastName && translate({ id: errors.LastName }, intl)
|
|
48
|
+
})
|
|
49
|
+
),
|
|
50
|
+
React.createElement(
|
|
51
|
+
'div',
|
|
52
|
+
{ className: 'layout-item' },
|
|
53
|
+
React.createElement(Input, {
|
|
54
|
+
title: translate({
|
|
55
|
+
id: 'title.address',
|
|
56
|
+
defaultMessage: 'Address'
|
|
57
|
+
}, intl),
|
|
58
|
+
placeholder: translate({ id: 'label.address' }, intl),
|
|
59
|
+
name: 'Address1',
|
|
60
|
+
value: data.Address1,
|
|
61
|
+
error: errors.Address1 && translate({ id: errors.Address1 }, intl),
|
|
62
|
+
autoComplete: 'off'
|
|
52
63
|
})
|
|
53
64
|
),
|
|
54
|
-
React.createElement(Input, {
|
|
55
|
-
label: translate({
|
|
56
|
-
id: 'title.address',
|
|
57
|
-
defaultMessage: 'Address'
|
|
58
|
-
}, intl),
|
|
59
|
-
name: 'Address1',
|
|
60
|
-
value: data.Address1,
|
|
61
|
-
status: errors.Address1 && 'failure' || 'idle',
|
|
62
|
-
statusText: errors.Address1 && translate({ id: 'errors.Address1' }, intl),
|
|
63
|
-
autoComplete: 'off'
|
|
64
|
-
}),
|
|
65
65
|
React.createElement(
|
|
66
66
|
'div',
|
|
67
67
|
{ className: 'layout-item' },
|
|
68
68
|
React.createElement(Input, {
|
|
69
69
|
className: 'layout-item-6',
|
|
70
70
|
value: data.Zip,
|
|
71
|
-
|
|
71
|
+
title: translate({ id: 'title.zip', defaultMessage: 'Zip' }, intl),
|
|
72
|
+
placeholder: translate({ id: 'label.zip_code' }, intl),
|
|
72
73
|
name: 'Zip',
|
|
73
|
-
|
|
74
|
-
statusText: errors.Zip && translate({ id: errors.Zip }, intl),
|
|
74
|
+
error: errors.Zip && translate({ id: errors.Zip }, intl),
|
|
75
75
|
autoComplete: 'off'
|
|
76
76
|
}),
|
|
77
77
|
React.createElement(Input, {
|
|
78
78
|
className: 'layout-item-6',
|
|
79
79
|
value: data.City,
|
|
80
|
-
|
|
80
|
+
title: translate({
|
|
81
81
|
id: 'title.city',
|
|
82
82
|
defaultMessage: 'City'
|
|
83
83
|
}, intl),
|
|
84
|
+
placeholder: translate({ id: 'label.city' }, intl),
|
|
84
85
|
name: 'City',
|
|
85
|
-
|
|
86
|
-
statusText: errors.City && translate({ id: errors.City }, intl),
|
|
86
|
+
error: errors.City && translate({ id: errors.City }, intl),
|
|
87
87
|
autoComplete: 'off'
|
|
88
88
|
})
|
|
89
89
|
),
|
|
90
90
|
React.createElement(
|
|
91
91
|
'div',
|
|
92
92
|
{ className: 'layout-item' },
|
|
93
|
-
React.createElement(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
id: 'title.country',
|
|
105
|
-
defaultMessage: 'Country'
|
|
106
|
-
}, intl),
|
|
107
|
-
name: 'Country',
|
|
108
|
-
icon: React.createElement(Icon, { icon: 'flag' }) },
|
|
109
|
-
React.createElement(
|
|
110
|
-
Select.Option,
|
|
111
|
-
{
|
|
112
|
-
value: countries && countries.value.find(function (c) {
|
|
113
|
-
return c.value === data.Country;
|
|
114
|
-
}) && countries.value.find(function (c) {
|
|
115
|
-
return c.value === data.Country;
|
|
116
|
-
}).value },
|
|
117
|
-
countries && countries.value.find(function (c) {
|
|
118
|
-
return c.value === data.Country;
|
|
119
|
-
}) && countries.value.find(function (c) {
|
|
120
|
-
return c.value === data.Country;
|
|
121
|
-
}).label
|
|
122
|
-
)
|
|
123
|
-
),
|
|
93
|
+
React.createElement(Input, {
|
|
94
|
+
disabled: true,
|
|
95
|
+
className: 'layout-item-6',
|
|
96
|
+
value: data.Country,
|
|
97
|
+
title: translate({
|
|
98
|
+
id: 'title.country',
|
|
99
|
+
defaultMessage: 'Country'
|
|
100
|
+
}, intl),
|
|
101
|
+
placeholder: translate({ id: 'label.country' }, intl),
|
|
102
|
+
name: 'Country'
|
|
103
|
+
}),
|
|
124
104
|
React.createElement(Input, {
|
|
125
105
|
disabled: true,
|
|
126
106
|
className: 'layout-item-6',
|
|
127
107
|
value: intl.formatDate(new Date(data.BirthDate)),
|
|
128
|
-
|
|
108
|
+
title: translate({
|
|
129
109
|
id: 'title.user_birthday',
|
|
130
110
|
defaultMessage: 'Birthday'
|
|
131
111
|
}, intl),
|
|
112
|
+
placeholder: translate({ id: 'label.user_birthday' }, intl),
|
|
132
113
|
name: 'BirthDate'
|
|
133
114
|
})
|
|
134
115
|
),
|
|
135
116
|
React.createElement(Input, {
|
|
136
117
|
disabled: true,
|
|
137
118
|
value: data.Email,
|
|
138
|
-
|
|
119
|
+
title: translate({
|
|
139
120
|
id: 'title.email',
|
|
140
121
|
defaultMessage: 'Email'
|
|
141
122
|
}, intl),
|
|
123
|
+
placeholder: translate({ id: 'label.email' }, intl),
|
|
142
124
|
name: 'Email'
|
|
143
125
|
}),
|
|
144
126
|
React.createElement(Input, {
|
|
145
127
|
value: data.MobilePhoneNumber,
|
|
146
|
-
|
|
147
|
-
label: translate({
|
|
128
|
+
title: translate({
|
|
148
129
|
id: 'title.mobile_number',
|
|
149
130
|
defaultMessage: 'Mobile number'
|
|
150
131
|
}, intl),
|
|
151
|
-
|
|
152
|
-
return Number(a.callingCode) - Number(b.callingCode);
|
|
153
|
-
}).map(function (i) {
|
|
154
|
-
return {
|
|
155
|
-
value: '00' + i.callingCode,
|
|
156
|
-
label: '+' + i.callingCode + ' ' + (countryEmojiFlags[i.value] || '')
|
|
157
|
-
};
|
|
158
|
-
}) : [],
|
|
132
|
+
placeholder: translate({ id: 'label.mobile_number' }, intl),
|
|
159
133
|
name: 'MobilePhoneNumber',
|
|
160
134
|
autoComplete: 'off',
|
|
161
|
-
|
|
162
|
-
statusText: errors.MobilePhoneNumber && translate({ id: errors.MobilePhoneNumber }, intl)
|
|
135
|
+
error: errors.MobilePhoneNumber && translate({ id: errors.MobilePhoneNumber }, intl)
|
|
163
136
|
}),
|
|
164
137
|
!['sga', 'dga'].includes(jurisdiction) && React.createElement(
|
|
165
138
|
Fragment,
|
|
@@ -168,13 +141,16 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
168
141
|
React.createElement(Input, {
|
|
169
142
|
value: '',
|
|
170
143
|
type: 'password',
|
|
171
|
-
|
|
144
|
+
title: translate({
|
|
172
145
|
id: 'title.password',
|
|
173
146
|
defaultMessage: 'Password'
|
|
174
147
|
}, intl),
|
|
148
|
+
placeholder: translate({
|
|
149
|
+
id: 'label.old_password',
|
|
150
|
+
defaultMessage: 'Password'
|
|
151
|
+
}, intl),
|
|
175
152
|
name: 'Password',
|
|
176
|
-
|
|
177
|
-
statusText: errors.Password && translate({ id: errors.Password }, intl),
|
|
153
|
+
error: errors.Password && translate({ id: errors.Password }, intl),
|
|
178
154
|
autoComplete: 'off'
|
|
179
155
|
})
|
|
180
156
|
),
|
|
@@ -198,7 +174,7 @@ AccountDetail.propTypes = {
|
|
|
198
174
|
/** The form input fields and content */
|
|
199
175
|
children: PropTypes.any,
|
|
200
176
|
/** The above title for each field */
|
|
201
|
-
|
|
177
|
+
title: PropTypes.string,
|
|
202
178
|
/** The value inside each field */
|
|
203
179
|
value: PropTypes.any,
|
|
204
180
|
/** The name of each field */
|
|
@@ -212,7 +188,7 @@ AccountDetail.propTypes = {
|
|
|
212
188
|
AccountDetail.defaultProps = {
|
|
213
189
|
disabled: Function,
|
|
214
190
|
children: '',
|
|
215
|
-
|
|
191
|
+
title: '',
|
|
216
192
|
value: '',
|
|
217
193
|
name: '',
|
|
218
194
|
error: [],
|
|
@@ -1,327 +1,98 @@
|
|
|
1
|
-
var _this = this;
|
|
2
|
-
|
|
3
1
|
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
8
|
-
import compose from 'recompose/compose';
|
|
3
|
+
import React, { useState } from 'react';
|
|
9
4
|
import { injectIntl } from 'react-intl';
|
|
10
5
|
import Input from '../../components/Input';
|
|
11
6
|
import Button from '../../components/Button';
|
|
12
7
|
import Translate from '../../components/Translate';
|
|
13
8
|
import PropTypes from 'prop-types';
|
|
14
9
|
import translate from '../../lib/utils/translate';
|
|
15
|
-
import cn from 'classnames';
|
|
16
|
-
import withValidation from '../../lib/WithValidation';
|
|
17
|
-
import email from '../../lib/WithValidation/rules/email';
|
|
18
|
-
import require from '../../lib/WithValidation/rules/required';
|
|
19
|
-
|
|
20
|
-
var KEY_CODE = {
|
|
21
|
-
BACKSPACE: 'Backspace',
|
|
22
|
-
DELETE: 'Delete',
|
|
23
|
-
ARROW_LEFT: 'ArrowLeft',
|
|
24
|
-
ARROW_RIGHT: 'ArrowRight'
|
|
25
|
-
};
|
|
26
10
|
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
autoFocus = _ref$autoFocus === undefined ? true : _ref$autoFocus,
|
|
34
|
-
onChange = _ref.onChange,
|
|
35
|
-
isLoading = _ref.isLoading,
|
|
36
|
-
name = _ref.name,
|
|
37
|
-
status = _ref.status,
|
|
38
|
-
statusText = _ref.statusText;
|
|
11
|
+
var ActivateWidget = function ActivateWidget(_ref) {
|
|
12
|
+
var intl = _ref.intl,
|
|
13
|
+
defaultEmail = _ref.email,
|
|
14
|
+
defaultCode = _ref.code,
|
|
15
|
+
onSubmit = _ref.onSubmit,
|
|
16
|
+
onResend = _ref.onResend;
|
|
39
17
|
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
var _useState = useState(-1),
|
|
18
|
+
var _useState = useState(defaultCode),
|
|
43
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var inputRef = useRef();
|
|
48
|
-
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
if (autoFocus && !code.length) {
|
|
51
|
-
inputRef.current.focus();
|
|
52
|
-
setActiveIndex(0);
|
|
53
|
-
}
|
|
54
|
-
}, [autoFocus, code]);
|
|
55
|
-
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
return inputRef.current.value = code;
|
|
58
|
-
}, [code]);
|
|
59
|
-
|
|
60
|
-
var setCaretPosition = function setCaretPosition(from, to) {
|
|
61
|
-
inputRef.current.focus();
|
|
62
|
-
inputRef.current.setSelectionRange(from, to);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var handleKeyPress = function handleKeyPress(key, v) {
|
|
66
|
-
switch (key) {
|
|
67
|
-
case KEY_CODE.BACKSPACE || KEY_CODE.DELETE:
|
|
68
|
-
{
|
|
69
|
-
setActiveIndex(v.length);
|
|
70
|
-
setCaretPosition(v.length, v.length);
|
|
71
|
-
onChange(v);
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
case KEY_CODE.ARROW_LEFT:
|
|
76
|
-
{
|
|
77
|
-
if (activeIndex === 0) return;
|
|
78
|
-
setActiveIndex(activeIndex - 1);
|
|
79
|
-
setCaretPosition(activeIndex - 1, activeIndex);
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
case KEY_CODE.ARROW_RIGHT:
|
|
83
|
-
{
|
|
84
|
-
if (activeIndex === 3) return;
|
|
85
|
-
setActiveIndex(activeIndex + 1);
|
|
86
|
-
setCaretPosition(activeIndex + 1, activeIndex + 2);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
default:
|
|
91
|
-
{
|
|
92
|
-
setActiveIndex(v.length);
|
|
93
|
-
setCaretPosition(v.length, v.length + 1);
|
|
94
|
-
onChange(v);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
var handleFocus = function handleFocus(i) {
|
|
100
|
-
setCaretPosition(i, i + 1);
|
|
101
|
-
setActiveIndex(i);
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
var handleBlur = function handleBlur() {
|
|
105
|
-
setActiveIndex(-1);
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
return React.createElement(
|
|
109
|
-
'div',
|
|
110
|
-
{
|
|
111
|
-
className: cn('ActivationCode', {
|
|
112
|
-
'tg-input__status-failure': status === 'failure'
|
|
113
|
-
}) },
|
|
114
|
-
React.createElement(
|
|
115
|
-
'div',
|
|
116
|
-
{ className: 'ActivationCode__wrapper' },
|
|
117
|
-
React.createElement(
|
|
118
|
-
'div',
|
|
119
|
-
{ className: 'ActivationCode__label' },
|
|
120
|
-
React.createElement(Translate, {
|
|
121
|
-
id: 'label.activation_code',
|
|
122
|
-
defaultMessage: 'Activation code'
|
|
123
|
-
})
|
|
124
|
-
),
|
|
125
|
-
React.createElement(
|
|
126
|
-
'div',
|
|
127
|
-
{ className: 'ActivationCode__boxes' },
|
|
128
|
-
React.createElement('input', {
|
|
129
|
-
className: 'ActivationCode__input',
|
|
130
|
-
type: 'text',
|
|
131
|
-
autoComplete: 'one-time-code',
|
|
132
|
-
inputMode: 'decimal',
|
|
133
|
-
name: name,
|
|
134
|
-
ref: inputRef,
|
|
135
|
-
maxLength: length,
|
|
136
|
-
onKeyUp: function onKeyUp(_ref2) {
|
|
137
|
-
var key = _ref2.key,
|
|
138
|
-
target = _ref2.target;
|
|
139
|
-
return handleKeyPress(key, target.value);
|
|
140
|
-
},
|
|
141
|
-
onBlur: handleBlur
|
|
142
|
-
}),
|
|
143
|
-
boxes.map(function (_, i) {
|
|
144
|
-
return React.createElement(
|
|
145
|
-
'div',
|
|
146
|
-
{
|
|
147
|
-
className: cn('ActivationCode__box', {
|
|
148
|
-
'ActivationCode__box--focused': !isLoading && i === activeIndex,
|
|
149
|
-
'ActivationCode__box--error': status === 'failure',
|
|
150
|
-
'ActivationCode__box--empty': i === activeIndex && !code[i]
|
|
151
|
-
}),
|
|
152
|
-
key: i,
|
|
153
|
-
onClick: function onClick() {
|
|
154
|
-
return handleFocus(i);
|
|
155
|
-
} },
|
|
156
|
-
code[i]
|
|
157
|
-
);
|
|
158
|
-
})
|
|
159
|
-
)
|
|
160
|
-
),
|
|
161
|
-
React.createElement(
|
|
162
|
-
'div',
|
|
163
|
-
{ className: 'tg-input__status-text' },
|
|
164
|
-
statusText
|
|
165
|
-
)
|
|
166
|
-
);
|
|
167
|
-
};
|
|
20
|
+
code = _useState2[0],
|
|
21
|
+
onCodeChange = _useState2[1];
|
|
168
22
|
|
|
169
|
-
var
|
|
170
|
-
var intl = _ref3.intl,
|
|
171
|
-
_ref3$email = _ref3.email,
|
|
172
|
-
pEmail = _ref3$email === undefined ? '' : _ref3$email,
|
|
173
|
-
_ref3$code = _ref3.code,
|
|
174
|
-
pCode = _ref3$code === undefined ? '' : _ref3$code,
|
|
175
|
-
onSubmit = _ref3.onSubmit,
|
|
176
|
-
onResend = _ref3.onResend,
|
|
177
|
-
errors = _ref3.errors;
|
|
178
|
-
|
|
179
|
-
var _useState3 = useState(pCode),
|
|
23
|
+
var _useState3 = useState(defaultEmail),
|
|
180
24
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
181
|
-
|
|
182
|
-
|
|
25
|
+
email = _useState4[0],
|
|
26
|
+
onEmailChange = _useState4[1];
|
|
183
27
|
|
|
184
|
-
var _useState5 = useState(
|
|
28
|
+
var _useState5 = useState(false),
|
|
185
29
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
186
|
-
|
|
187
|
-
|
|
30
|
+
isLoading = _useState6[0],
|
|
31
|
+
setIsLoading = _useState6[1];
|
|
188
32
|
|
|
189
33
|
var _useState7 = useState(false),
|
|
190
34
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
switch (_context.prev = _context.next) {
|
|
205
|
-
case 0:
|
|
206
|
-
setIsLoading(true);
|
|
207
|
-
_context.prev = 1;
|
|
208
|
-
_context.next = 4;
|
|
209
|
-
return onResend(email);
|
|
210
|
-
|
|
211
|
-
case 4:
|
|
212
|
-
setIsLoading(false);
|
|
213
|
-
_context.next = 9;
|
|
214
|
-
break;
|
|
215
|
-
|
|
216
|
-
case 7:
|
|
217
|
-
_context.prev = 7;
|
|
218
|
-
_context.t0 = _context['catch'](1);
|
|
219
|
-
|
|
220
|
-
case 9:
|
|
221
|
-
case 'end':
|
|
222
|
-
return _context.stop();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}, _callee, _this, [[1, 7]]);
|
|
226
|
-
}));
|
|
227
|
-
|
|
228
|
-
return function handleResend() {
|
|
229
|
-
return _ref4.apply(this, arguments);
|
|
230
|
-
};
|
|
231
|
-
}();
|
|
232
|
-
|
|
233
|
-
var handleSubmit = function () {
|
|
234
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
235
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
236
|
-
while (1) {
|
|
237
|
-
switch (_context2.prev = _context2.next) {
|
|
238
|
-
case 0:
|
|
239
|
-
setIsLoading(true);
|
|
240
|
-
_context2.prev = 1;
|
|
241
|
-
_context2.next = 4;
|
|
242
|
-
return onSubmit(email, code);
|
|
243
|
-
|
|
244
|
-
case 4:
|
|
245
|
-
setCode('');
|
|
246
|
-
setIsLoading(false);
|
|
247
|
-
_context2.next = 10;
|
|
248
|
-
break;
|
|
249
|
-
|
|
250
|
-
case 8:
|
|
251
|
-
_context2.prev = 8;
|
|
252
|
-
_context2.t0 = _context2['catch'](1);
|
|
253
|
-
|
|
254
|
-
case 10:
|
|
255
|
-
case 'end':
|
|
256
|
-
return _context2.stop();
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}, _callee2, _this, [[1, 8]]);
|
|
260
|
-
}));
|
|
35
|
+
isResetLoading = _useState8[0],
|
|
36
|
+
setIsResetLoading = _useState8[1];
|
|
37
|
+
|
|
38
|
+
var _onResend = function _onResend(e) {
|
|
39
|
+
e.preventDefault();
|
|
40
|
+
setIsResetLoading(true);
|
|
41
|
+
onResend({
|
|
42
|
+
Email: email,
|
|
43
|
+
callback: function callback() {
|
|
44
|
+
return setIsResetLoading(false);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
};
|
|
261
48
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
49
|
+
var _onSubmit = function _onSubmit(e) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
setIsLoading(true);
|
|
52
|
+
onSubmit({
|
|
53
|
+
Email: email,
|
|
54
|
+
Code: code,
|
|
55
|
+
callback: function callback() {
|
|
56
|
+
return setIsLoading(false);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
266
60
|
|
|
267
61
|
return React.createElement(
|
|
268
62
|
'div',
|
|
269
63
|
{ className: 'ActivateWidget' },
|
|
270
64
|
React.createElement(
|
|
271
|
-
'
|
|
272
|
-
{
|
|
273
|
-
React.createElement(
|
|
274
|
-
id: 'label.
|
|
275
|
-
|
|
276
|
-
})
|
|
277
|
-
),
|
|
278
|
-
React.createElement(
|
|
279
|
-
'div',
|
|
280
|
-
{ className: 'form' },
|
|
281
|
-
!pEmail && React.createElement(Input, {
|
|
282
|
-
autoFocus: true,
|
|
283
|
-
label: translate({ id: 'label.email', defaultMessage: 'Email' }, intl),
|
|
284
|
-
value: email || '',
|
|
65
|
+
'form',
|
|
66
|
+
{ onSubmit: _onSubmit },
|
|
67
|
+
React.createElement(Input, {
|
|
68
|
+
title: translate({ id: 'label.email' }, intl),
|
|
69
|
+
value: email,
|
|
285
70
|
onChange: function onChange(e) {
|
|
286
|
-
return
|
|
71
|
+
return onEmailChange(e.target.value);
|
|
287
72
|
},
|
|
288
|
-
name: 'Email'
|
|
289
|
-
status: errors.Email ? 'failure' : 'idle',
|
|
290
|
-
statusText: errors.Email && translate({ id: errors.Email }, intl)
|
|
73
|
+
name: 'Email'
|
|
291
74
|
}),
|
|
292
|
-
React.createElement(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
75
|
+
React.createElement(Input, {
|
|
76
|
+
title: translate({ id: 'label.activation_code' }, intl),
|
|
77
|
+
value: code,
|
|
78
|
+
onChange: function onChange(e) {
|
|
79
|
+
return onCodeChange(e.target.value);
|
|
80
|
+
},
|
|
81
|
+
name: 'Code',
|
|
82
|
+
autoComplete: 'one-time-code'
|
|
300
83
|
}),
|
|
301
84
|
React.createElement(
|
|
302
85
|
Button,
|
|
303
|
-
{
|
|
304
|
-
isLoading: isLoading,
|
|
305
|
-
className: 'button primary wide',
|
|
306
|
-
onClick: handleSubmit },
|
|
86
|
+
{ isLoading: isLoading, className: 'button primary wide' },
|
|
307
87
|
React.createElement(Translate, { id: 'action.activate', defaultMessage: 'Activate' })
|
|
308
88
|
)
|
|
309
89
|
),
|
|
310
|
-
React.createElement('hr', { className: 'hr--1' }),
|
|
311
|
-
React.createElement(
|
|
312
|
-
'div',
|
|
313
|
-
{ className: 'ActivateWidget__resend' },
|
|
314
|
-
React.createElement(Translate, {
|
|
315
|
-
id: 'action.send_new_code',
|
|
316
|
-
defaultMessage: 'Didn\'t get code?'
|
|
317
|
-
})
|
|
318
|
-
),
|
|
319
90
|
React.createElement(
|
|
320
91
|
Button,
|
|
321
92
|
{
|
|
322
|
-
isLoading:
|
|
93
|
+
isLoading: isResetLoading,
|
|
323
94
|
className: 'button tertiary wide',
|
|
324
|
-
onClick:
|
|
95
|
+
onClick: _onResend },
|
|
325
96
|
React.createElement(Translate, {
|
|
326
97
|
id: 'action.resend_activation_code',
|
|
327
98
|
defaultMessage: 'Resend activation code'
|
|
@@ -346,9 +117,4 @@ ActivateWidget.defaultProps = {
|
|
|
346
117
|
onResend: Function
|
|
347
118
|
};
|
|
348
119
|
|
|
349
|
-
|
|
350
|
-
Email: [[require, 'error.empty.email'], [email, 'error.condition.email']],
|
|
351
|
-
ActivationCode: [[require, 'error.empty.activation_code']]
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export default compose(withValidation(rules), injectIntl)(ActivateWidget);
|
|
120
|
+
export default injectIntl(ActivateWidget);
|