tg-core-components 6.2.0-crypto.0 → 6.2.0-crypto.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.
|
@@ -11,6 +11,32 @@ import Button from '../../components/Button';
|
|
|
11
11
|
import countryEmojiFlags from '../../misc/countryEmojiFlags';
|
|
12
12
|
import Icon from '../../components/Icon';
|
|
13
13
|
|
|
14
|
+
var genders = [{
|
|
15
|
+
label: function label(intl) {
|
|
16
|
+
return translate({
|
|
17
|
+
id: 'noun.male',
|
|
18
|
+
defaultMessage: 'Male'
|
|
19
|
+
}, intl);
|
|
20
|
+
},
|
|
21
|
+
value: 'Male'
|
|
22
|
+
}, {
|
|
23
|
+
label: function label(intl) {
|
|
24
|
+
return translate({
|
|
25
|
+
id: 'noun.female',
|
|
26
|
+
defaultMessage: 'Female'
|
|
27
|
+
}, intl);
|
|
28
|
+
},
|
|
29
|
+
value: 'Female'
|
|
30
|
+
}, {
|
|
31
|
+
label: function label(intl) {
|
|
32
|
+
return translate({
|
|
33
|
+
id: 'noun.other',
|
|
34
|
+
defaultMessage: 'Other'
|
|
35
|
+
}, intl);
|
|
36
|
+
},
|
|
37
|
+
value: 'Other'
|
|
38
|
+
}];
|
|
39
|
+
|
|
14
40
|
var AccountDetail = function AccountDetail(_ref) {
|
|
15
41
|
var data = _ref.data,
|
|
16
42
|
intl = _ref.intl,
|
|
@@ -18,7 +44,8 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
18
44
|
onSubmit = _ref.onSubmit,
|
|
19
45
|
jurisdiction = _ref.jurisdiction,
|
|
20
46
|
countries = _ref.countries,
|
|
21
|
-
isLoading = _ref.isLoading
|
|
47
|
+
isLoading = _ref.isLoading,
|
|
48
|
+
isComplete = _ref.isComplete;
|
|
22
49
|
|
|
23
50
|
return React.createElement(
|
|
24
51
|
'form',
|
|
@@ -93,33 +120,24 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
93
120
|
React.createElement(
|
|
94
121
|
Select,
|
|
95
122
|
{
|
|
96
|
-
disabled:
|
|
123
|
+
disabled: isComplete,
|
|
97
124
|
className: 'layout-item-6',
|
|
98
|
-
value:
|
|
99
|
-
return c.value === data.Country;
|
|
100
|
-
}) && countries.value.find(function (c) {
|
|
101
|
-
return c.value === data.Country;
|
|
102
|
-
}).value,
|
|
125
|
+
value: data.Country,
|
|
103
126
|
label: translate({
|
|
104
127
|
id: 'title.country',
|
|
105
128
|
defaultMessage: 'Country'
|
|
106
129
|
}, intl),
|
|
107
130
|
name: 'Country',
|
|
108
131
|
icon: React.createElement(Icon, { icon: 'flag' }) },
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return c.value === data.Country;
|
|
119
|
-
}) && countries.value.find(function (c) {
|
|
120
|
-
return c.value === data.Country;
|
|
121
|
-
}).label
|
|
122
|
-
)
|
|
132
|
+
countries.sort(function (a, b) {
|
|
133
|
+
return a.label.localeCompare(b.label);
|
|
134
|
+
}).map(function (c) {
|
|
135
|
+
return React.createElement(
|
|
136
|
+
Select.Option,
|
|
137
|
+
{ key: c.value, value: c.value },
|
|
138
|
+
c.label
|
|
139
|
+
);
|
|
140
|
+
})
|
|
123
141
|
),
|
|
124
142
|
React.createElement(Input, {
|
|
125
143
|
disabled: true,
|
|
@@ -132,15 +150,6 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
132
150
|
name: 'BirthDate'
|
|
133
151
|
})
|
|
134
152
|
),
|
|
135
|
-
React.createElement(Input, {
|
|
136
|
-
disabled: true,
|
|
137
|
-
value: data.Email,
|
|
138
|
-
label: translate({
|
|
139
|
-
id: 'title.email',
|
|
140
|
-
defaultMessage: 'Email'
|
|
141
|
-
}, intl),
|
|
142
|
-
name: 'Email'
|
|
143
|
-
}),
|
|
144
153
|
React.createElement(Input, {
|
|
145
154
|
value: data.MobilePhoneNumber,
|
|
146
155
|
type: 'tel',
|
|
@@ -153,6 +162,48 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
153
162
|
status: errors.MobilePhoneNumber && 'failure' || 'idle',
|
|
154
163
|
statusText: errors.MobilePhoneNumber && translate({ id: errors.MobilePhoneNumber }, intl)
|
|
155
164
|
}),
|
|
165
|
+
React.createElement(
|
|
166
|
+
'div',
|
|
167
|
+
{ className: 'layout-item' },
|
|
168
|
+
React.createElement(Input, {
|
|
169
|
+
className: 'layout-item-6',
|
|
170
|
+
disabled: true,
|
|
171
|
+
value: data.Email,
|
|
172
|
+
label: translate({
|
|
173
|
+
id: 'title.email',
|
|
174
|
+
defaultMessage: 'Email'
|
|
175
|
+
}, intl),
|
|
176
|
+
name: 'Email'
|
|
177
|
+
}),
|
|
178
|
+
React.createElement(
|
|
179
|
+
Select,
|
|
180
|
+
{
|
|
181
|
+
className: 'layout-item-6',
|
|
182
|
+
value: data.Gender,
|
|
183
|
+
label: translate({
|
|
184
|
+
id: 'title.gender',
|
|
185
|
+
defaultMessage: 'Gender'
|
|
186
|
+
}, intl),
|
|
187
|
+
name: 'Gender',
|
|
188
|
+
status: errors.Gender && 'failure' || 'idle',
|
|
189
|
+
statusText: errors.Gender && translate({ id: errors.Gender }, intl) },
|
|
190
|
+
React.createElement(
|
|
191
|
+
Select.Option,
|
|
192
|
+
{ value: '', disabled: true },
|
|
193
|
+
translate({
|
|
194
|
+
id: 'label.select-gender',
|
|
195
|
+
defaultMessage: 'Select gender'
|
|
196
|
+
}, intl)
|
|
197
|
+
),
|
|
198
|
+
genders.map(function (gender) {
|
|
199
|
+
return React.createElement(
|
|
200
|
+
Select.Option,
|
|
201
|
+
{ value: gender.value },
|
|
202
|
+
gender.label(intl)
|
|
203
|
+
);
|
|
204
|
+
})
|
|
205
|
+
)
|
|
206
|
+
),
|
|
156
207
|
!['sga', 'dga'].includes(jurisdiction) && React.createElement(
|
|
157
208
|
Fragment,
|
|
158
209
|
null,
|
|
@@ -167,7 +218,7 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
167
218
|
name: 'Password',
|
|
168
219
|
status: errors.Password && 'failure' || 'idle',
|
|
169
220
|
statusText: errors.Password && translate({ id: errors.Password }, intl),
|
|
170
|
-
|
|
221
|
+
autocomplete: 'new-password'
|
|
171
222
|
})
|
|
172
223
|
),
|
|
173
224
|
React.createElement(
|
|
@@ -198,7 +249,9 @@ AccountDetail.propTypes = {
|
|
|
198
249
|
/** Array of validation errors where the error display depends on which invalid rule it breaks */
|
|
199
250
|
error: PropTypes.array,
|
|
200
251
|
/** The submission function firing when submitting the form */
|
|
201
|
-
onSubmit: PropTypes.func
|
|
252
|
+
onSubmit: PropTypes.func,
|
|
253
|
+
/** If the user profile is complete or not */
|
|
254
|
+
isComplete: PropTypes.bool
|
|
202
255
|
};
|
|
203
256
|
|
|
204
257
|
AccountDetail.defaultProps = {
|
|
@@ -208,7 +261,8 @@ AccountDetail.defaultProps = {
|
|
|
208
261
|
value: '',
|
|
209
262
|
name: '',
|
|
210
263
|
error: [],
|
|
211
|
-
onSubmit: Function
|
|
264
|
+
onSubmit: Function,
|
|
265
|
+
isComplete: false
|
|
212
266
|
};
|
|
213
267
|
|
|
214
268
|
var rules = {
|
|
@@ -216,7 +270,9 @@ var rules = {
|
|
|
216
270
|
Address1: [[require, 'error.empty.address']],
|
|
217
271
|
Zip: [[require, 'error.empty.zip_code']],
|
|
218
272
|
City: [[require, 'error.empty.city']],
|
|
219
|
-
Password: [[require, 'error.empty.password']]
|
|
273
|
+
Password: [[require, 'error.empty.password']],
|
|
274
|
+
Country: [[require, 'error.empty.country']],
|
|
275
|
+
Gender: [[require, 'error.empty.gender']]
|
|
220
276
|
};
|
|
221
277
|
|
|
222
278
|
export default compose(WithValidation(rules), injectIntl)(AccountDetail);
|
|
@@ -52,6 +52,32 @@ var _Icon2 = _interopRequireDefault(_Icon);
|
|
|
52
52
|
|
|
53
53
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
54
54
|
|
|
55
|
+
var genders = [{
|
|
56
|
+
label: function label(intl) {
|
|
57
|
+
return (0, _translate2.default)({
|
|
58
|
+
id: 'noun.male',
|
|
59
|
+
defaultMessage: 'Male'
|
|
60
|
+
}, intl);
|
|
61
|
+
},
|
|
62
|
+
value: 'Male'
|
|
63
|
+
}, {
|
|
64
|
+
label: function label(intl) {
|
|
65
|
+
return (0, _translate2.default)({
|
|
66
|
+
id: 'noun.female',
|
|
67
|
+
defaultMessage: 'Female'
|
|
68
|
+
}, intl);
|
|
69
|
+
},
|
|
70
|
+
value: 'Female'
|
|
71
|
+
}, {
|
|
72
|
+
label: function label(intl) {
|
|
73
|
+
return (0, _translate2.default)({
|
|
74
|
+
id: 'noun.other',
|
|
75
|
+
defaultMessage: 'Other'
|
|
76
|
+
}, intl);
|
|
77
|
+
},
|
|
78
|
+
value: 'Other'
|
|
79
|
+
}];
|
|
80
|
+
|
|
55
81
|
var AccountDetail = function AccountDetail(_ref) {
|
|
56
82
|
var data = _ref.data,
|
|
57
83
|
intl = _ref.intl,
|
|
@@ -59,7 +85,8 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
59
85
|
onSubmit = _ref.onSubmit,
|
|
60
86
|
jurisdiction = _ref.jurisdiction,
|
|
61
87
|
countries = _ref.countries,
|
|
62
|
-
isLoading = _ref.isLoading
|
|
88
|
+
isLoading = _ref.isLoading,
|
|
89
|
+
isComplete = _ref.isComplete;
|
|
63
90
|
|
|
64
91
|
return _react2.default.createElement(
|
|
65
92
|
'form',
|
|
@@ -134,33 +161,24 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
134
161
|
_react2.default.createElement(
|
|
135
162
|
_Select2.default,
|
|
136
163
|
{
|
|
137
|
-
disabled:
|
|
164
|
+
disabled: isComplete,
|
|
138
165
|
className: 'layout-item-6',
|
|
139
|
-
value:
|
|
140
|
-
return c.value === data.Country;
|
|
141
|
-
}) && countries.value.find(function (c) {
|
|
142
|
-
return c.value === data.Country;
|
|
143
|
-
}).value,
|
|
166
|
+
value: data.Country,
|
|
144
167
|
label: (0, _translate2.default)({
|
|
145
168
|
id: 'title.country',
|
|
146
169
|
defaultMessage: 'Country'
|
|
147
170
|
}, intl),
|
|
148
171
|
name: 'Country',
|
|
149
172
|
icon: _react2.default.createElement(_Icon2.default, { icon: 'flag' }) },
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return c.value === data.Country;
|
|
160
|
-
}) && countries.value.find(function (c) {
|
|
161
|
-
return c.value === data.Country;
|
|
162
|
-
}).label
|
|
163
|
-
)
|
|
173
|
+
countries.sort(function (a, b) {
|
|
174
|
+
return a.label.localeCompare(b.label);
|
|
175
|
+
}).map(function (c) {
|
|
176
|
+
return _react2.default.createElement(
|
|
177
|
+
_Select2.default.Option,
|
|
178
|
+
{ key: c.value, value: c.value },
|
|
179
|
+
c.label
|
|
180
|
+
);
|
|
181
|
+
})
|
|
164
182
|
),
|
|
165
183
|
_react2.default.createElement(_Input2.default, {
|
|
166
184
|
disabled: true,
|
|
@@ -173,15 +191,6 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
173
191
|
name: 'BirthDate'
|
|
174
192
|
})
|
|
175
193
|
),
|
|
176
|
-
_react2.default.createElement(_Input2.default, {
|
|
177
|
-
disabled: true,
|
|
178
|
-
value: data.Email,
|
|
179
|
-
label: (0, _translate2.default)({
|
|
180
|
-
id: 'title.email',
|
|
181
|
-
defaultMessage: 'Email'
|
|
182
|
-
}, intl),
|
|
183
|
-
name: 'Email'
|
|
184
|
-
}),
|
|
185
194
|
_react2.default.createElement(_Input2.default, {
|
|
186
195
|
value: data.MobilePhoneNumber,
|
|
187
196
|
type: 'tel',
|
|
@@ -194,6 +203,48 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
194
203
|
status: errors.MobilePhoneNumber && 'failure' || 'idle',
|
|
195
204
|
statusText: errors.MobilePhoneNumber && (0, _translate2.default)({ id: errors.MobilePhoneNumber }, intl)
|
|
196
205
|
}),
|
|
206
|
+
_react2.default.createElement(
|
|
207
|
+
'div',
|
|
208
|
+
{ className: 'layout-item' },
|
|
209
|
+
_react2.default.createElement(_Input2.default, {
|
|
210
|
+
className: 'layout-item-6',
|
|
211
|
+
disabled: true,
|
|
212
|
+
value: data.Email,
|
|
213
|
+
label: (0, _translate2.default)({
|
|
214
|
+
id: 'title.email',
|
|
215
|
+
defaultMessage: 'Email'
|
|
216
|
+
}, intl),
|
|
217
|
+
name: 'Email'
|
|
218
|
+
}),
|
|
219
|
+
_react2.default.createElement(
|
|
220
|
+
_Select2.default,
|
|
221
|
+
{
|
|
222
|
+
className: 'layout-item-6',
|
|
223
|
+
value: data.Gender,
|
|
224
|
+
label: (0, _translate2.default)({
|
|
225
|
+
id: 'title.gender',
|
|
226
|
+
defaultMessage: 'Gender'
|
|
227
|
+
}, intl),
|
|
228
|
+
name: 'Gender',
|
|
229
|
+
status: errors.Gender && 'failure' || 'idle',
|
|
230
|
+
statusText: errors.Gender && (0, _translate2.default)({ id: errors.Gender }, intl) },
|
|
231
|
+
_react2.default.createElement(
|
|
232
|
+
_Select2.default.Option,
|
|
233
|
+
{ value: '', disabled: true },
|
|
234
|
+
(0, _translate2.default)({
|
|
235
|
+
id: 'label.select-gender',
|
|
236
|
+
defaultMessage: 'Select gender'
|
|
237
|
+
}, intl)
|
|
238
|
+
),
|
|
239
|
+
genders.map(function (gender) {
|
|
240
|
+
return _react2.default.createElement(
|
|
241
|
+
_Select2.default.Option,
|
|
242
|
+
{ value: gender.value },
|
|
243
|
+
gender.label(intl)
|
|
244
|
+
);
|
|
245
|
+
})
|
|
246
|
+
)
|
|
247
|
+
),
|
|
197
248
|
!['sga', 'dga'].includes(jurisdiction) && _react2.default.createElement(
|
|
198
249
|
_react.Fragment,
|
|
199
250
|
null,
|
|
@@ -208,7 +259,7 @@ var AccountDetail = function AccountDetail(_ref) {
|
|
|
208
259
|
name: 'Password',
|
|
209
260
|
status: errors.Password && 'failure' || 'idle',
|
|
210
261
|
statusText: errors.Password && (0, _translate2.default)({ id: errors.Password }, intl),
|
|
211
|
-
|
|
262
|
+
autocomplete: 'new-password'
|
|
212
263
|
})
|
|
213
264
|
),
|
|
214
265
|
_react2.default.createElement(
|
|
@@ -239,7 +290,9 @@ AccountDetail.propTypes = {
|
|
|
239
290
|
/** Array of validation errors where the error display depends on which invalid rule it breaks */
|
|
240
291
|
error: _propTypes2.default.array,
|
|
241
292
|
/** The submission function firing when submitting the form */
|
|
242
|
-
onSubmit: _propTypes2.default.func
|
|
293
|
+
onSubmit: _propTypes2.default.func,
|
|
294
|
+
/** If the user profile is complete or not */
|
|
295
|
+
isComplete: _propTypes2.default.bool
|
|
243
296
|
};
|
|
244
297
|
|
|
245
298
|
AccountDetail.defaultProps = {
|
|
@@ -249,7 +302,8 @@ AccountDetail.defaultProps = {
|
|
|
249
302
|
value: '',
|
|
250
303
|
name: '',
|
|
251
304
|
error: [],
|
|
252
|
-
onSubmit: Function
|
|
305
|
+
onSubmit: Function,
|
|
306
|
+
isComplete: false
|
|
253
307
|
};
|
|
254
308
|
|
|
255
309
|
var rules = {
|
|
@@ -257,7 +311,9 @@ var rules = {
|
|
|
257
311
|
Address1: [[_required2.default, 'error.empty.address']],
|
|
258
312
|
Zip: [[_required2.default, 'error.empty.zip_code']],
|
|
259
313
|
City: [[_required2.default, 'error.empty.city']],
|
|
260
|
-
Password: [[_required2.default, 'error.empty.password']]
|
|
314
|
+
Password: [[_required2.default, 'error.empty.password']],
|
|
315
|
+
Country: [[_required2.default, 'error.empty.country']],
|
|
316
|
+
Gender: [[_required2.default, 'error.empty.gender']]
|
|
261
317
|
};
|
|
262
318
|
|
|
263
319
|
exports.default = (0, _compose2.default)((0, _WithValidation2.default)(rules), _reactIntl.injectIntl)(AccountDetail);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tg-core-components",
|
|
3
|
-
"version": "6.2.0-crypto.
|
|
3
|
+
"version": "6.2.0-crypto.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": "726081c8015f50a46ad63c86ca9b4e0ac32a0864"
|
|
80
80
|
}
|