tg-core-components 6.1.3-crypto.2 → 6.1.3-crypto.20
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/Money/index.js +24 -2
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +4 -1
- package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +4 -1
- package/es/widgets/HistoryWidget/index.js +4 -1
- package/lib/components/Money/index.js +25 -2
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +4 -1
- package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +4 -1
- package/lib/widgets/HistoryWidget/index.js +4 -1
- package/package.json +1 -1
|
@@ -4,13 +4,25 @@ import React from 'react';
|
|
|
4
4
|
import { FormattedNumber } from 'react-intl';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* For crypto we want more decimals.
|
|
9
|
+
*/
|
|
10
|
+
var fractionDigits = {
|
|
11
|
+
BTC: { min: 5, max: 5 },
|
|
12
|
+
LTC: { min: 5, max: 5 },
|
|
13
|
+
XBC: { min: 5, max: 5 },
|
|
14
|
+
ETH: { min: 5, max: 5 },
|
|
15
|
+
BCH: { min: 5, max: 5 },
|
|
16
|
+
XRP: { min: 3, max: 3 }
|
|
17
|
+
};
|
|
18
|
+
|
|
7
19
|
/**
|
|
8
20
|
* FormattedNumber component to display currency
|
|
9
21
|
*/
|
|
10
22
|
var Money = function Money(props) {
|
|
11
23
|
return React.createElement(FormattedNumber, _extends({
|
|
12
|
-
minimumFractionDigits: props.decimals ? 2 : 0,
|
|
13
|
-
maximumFractionDigits: props.decimals ? 2 : 0
|
|
24
|
+
minimumFractionDigits: props.decimals ? fractionDigits[props.currency] && fractionDigits[props.currency].min || 2 : 0,
|
|
25
|
+
maximumFractionDigits: props.decimals ? fractionDigits[props.currency] && fractionDigits[props.currency].max || 2 : 0
|
|
14
26
|
}, props, {
|
|
15
27
|
style: 'currency'
|
|
16
28
|
}));
|
|
@@ -34,4 +46,14 @@ Money.defaultProps = {
|
|
|
34
46
|
decimals: true
|
|
35
47
|
};
|
|
36
48
|
|
|
49
|
+
export var format = function format(currency) {
|
|
50
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
51
|
+
return new Intl.NumberFormat(locale, {
|
|
52
|
+
style: 'currency',
|
|
53
|
+
currency: currency,
|
|
54
|
+
minimumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].min : null,
|
|
55
|
+
maximumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].max : null
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
37
59
|
export default Money;
|
|
@@ -265,7 +265,10 @@ var DepositWidget = function (_Component) {
|
|
|
265
265
|
if (amount < parseFloat(selectedMethod.limit.min) || amount < parseFloat(_this2.getMinDepositBonusAmount())) {
|
|
266
266
|
errors.amount.push(React.createElement(Translate, {
|
|
267
267
|
id: 'error.cashier.amount-below-method-limit',
|
|
268
|
-
defaultMessage: 'Amount is too low.'
|
|
268
|
+
defaultMessage: 'Amount is too low. Min amount: {min}',
|
|
269
|
+
values: {
|
|
270
|
+
min: Math.min(parseFloat(selectedMethod.limit.min), parseFloat(_this2.getMinDepositBonusAmount()))
|
|
271
|
+
}
|
|
269
272
|
}));
|
|
270
273
|
return errors;
|
|
271
274
|
}
|
|
@@ -145,7 +145,10 @@ var WithdrawWidget = function (_PureComponent) {
|
|
|
145
145
|
if (Number(amount) < parseFloat(selectedMethod.limit.min)) {
|
|
146
146
|
errors.amount.push(React.createElement(Translate, {
|
|
147
147
|
id: 'error.cashier.amount-below-method-limit',
|
|
148
|
-
defaultMessage: 'Amount is too low.'
|
|
148
|
+
defaultMessage: 'Amount is too low. Min amount: {min}',
|
|
149
|
+
values: {
|
|
150
|
+
min: parseFloat(selectedMethod.limit.min)
|
|
151
|
+
}
|
|
149
152
|
}));
|
|
150
153
|
return errors;
|
|
151
154
|
}
|
|
@@ -137,7 +137,10 @@ var HistoryWidgetList = function (_React$Component) {
|
|
|
137
137
|
'div',
|
|
138
138
|
null,
|
|
139
139
|
getMessage(item.Settled ? 'settled' : 'pendling')
|
|
140
|
-
)], [React.createElement(Money, {
|
|
140
|
+
)], [React.createElement(Money, {
|
|
141
|
+
value: item.TotalWin - item.TotalWager,
|
|
142
|
+
currency: item.Currency
|
|
143
|
+
}), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
|
|
141
144
|
} else if (product === 'bingo') {
|
|
142
145
|
return [[React.createElement(Translate, {
|
|
143
146
|
tag: 'div'
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.format = undefined;
|
|
6
7
|
|
|
7
8
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
8
9
|
|
|
@@ -18,13 +19,25 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
18
19
|
|
|
19
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
21
|
|
|
22
|
+
/**
|
|
23
|
+
* For crypto we want more decimals.
|
|
24
|
+
*/
|
|
25
|
+
var fractionDigits = {
|
|
26
|
+
BTC: { min: 5, max: 5 },
|
|
27
|
+
LTC: { min: 5, max: 5 },
|
|
28
|
+
XBC: { min: 5, max: 5 },
|
|
29
|
+
ETH: { min: 5, max: 5 },
|
|
30
|
+
BCH: { min: 5, max: 5 },
|
|
31
|
+
XRP: { min: 3, max: 3 }
|
|
32
|
+
};
|
|
33
|
+
|
|
21
34
|
/**
|
|
22
35
|
* FormattedNumber component to display currency
|
|
23
36
|
*/
|
|
24
37
|
var Money = function Money(props) {
|
|
25
38
|
return _react2.default.createElement(_reactIntl.FormattedNumber, _extends({
|
|
26
|
-
minimumFractionDigits: props.decimals ? 2 : 0,
|
|
27
|
-
maximumFractionDigits: props.decimals ? 2 : 0
|
|
39
|
+
minimumFractionDigits: props.decimals ? fractionDigits[props.currency] && fractionDigits[props.currency].min || 2 : 0,
|
|
40
|
+
maximumFractionDigits: props.decimals ? fractionDigits[props.currency] && fractionDigits[props.currency].max || 2 : 0
|
|
28
41
|
}, props, {
|
|
29
42
|
style: 'currency'
|
|
30
43
|
}));
|
|
@@ -48,4 +61,14 @@ Money.defaultProps = {
|
|
|
48
61
|
decimals: true
|
|
49
62
|
};
|
|
50
63
|
|
|
64
|
+
var format = exports.format = function format(currency) {
|
|
65
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US';
|
|
66
|
+
return new Intl.NumberFormat(locale, {
|
|
67
|
+
style: 'currency',
|
|
68
|
+
currency: currency,
|
|
69
|
+
minimumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].min : null,
|
|
70
|
+
maximumFractionDigits: fractionDigits[currency] ? fractionDigits[currency].max : null
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
51
74
|
exports.default = Money;
|
|
@@ -330,7 +330,10 @@ var DepositWidget = function (_Component) {
|
|
|
330
330
|
if (amount < parseFloat(selectedMethod.limit.min) || amount < parseFloat(_this2.getMinDepositBonusAmount())) {
|
|
331
331
|
errors.amount.push(_react2.default.createElement(_Translate2.default, {
|
|
332
332
|
id: 'error.cashier.amount-below-method-limit',
|
|
333
|
-
defaultMessage: 'Amount is too low.'
|
|
333
|
+
defaultMessage: 'Amount is too low. Min amount: {min}',
|
|
334
|
+
values: {
|
|
335
|
+
min: Math.min(parseFloat(selectedMethod.limit.min), parseFloat(_this2.getMinDepositBonusAmount()))
|
|
336
|
+
}
|
|
334
337
|
}));
|
|
335
338
|
return errors;
|
|
336
339
|
}
|
|
@@ -202,7 +202,10 @@ var WithdrawWidget = function (_PureComponent) {
|
|
|
202
202
|
if (Number(amount) < parseFloat(selectedMethod.limit.min)) {
|
|
203
203
|
errors.amount.push(_react2.default.createElement(_Translate2.default, {
|
|
204
204
|
id: 'error.cashier.amount-below-method-limit',
|
|
205
|
-
defaultMessage: 'Amount is too low.'
|
|
205
|
+
defaultMessage: 'Amount is too low. Min amount: {min}',
|
|
206
|
+
values: {
|
|
207
|
+
min: parseFloat(selectedMethod.limit.min)
|
|
208
|
+
}
|
|
206
209
|
}));
|
|
207
210
|
return errors;
|
|
208
211
|
}
|
|
@@ -171,7 +171,10 @@ var HistoryWidgetList = function (_React$Component) {
|
|
|
171
171
|
'div',
|
|
172
172
|
null,
|
|
173
173
|
(0, _message.getMessage)(item.Settled ? 'settled' : 'pendling')
|
|
174
|
-
)], [_react2.default.createElement(_Money2.default, {
|
|
174
|
+
)], [_react2.default.createElement(_Money2.default, {
|
|
175
|
+
value: item.TotalWin - item.TotalWager,
|
|
176
|
+
currency: item.Currency
|
|
177
|
+
}), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
|
|
175
178
|
} else if (product === 'bingo') {
|
|
176
179
|
return [[_react2.default.createElement(_Translate2.default, {
|
|
177
180
|
tag: 'div'
|