tg-core-components 6.1.3-crypto.9 → 6.1.3-iframeprops.0
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/BonusWidget/index.js +2 -5
- package/es/widgets/Cashier/Deposit/PaymentForm/InjectedIframeHTML.js +7 -3
- package/es/widgets/Cashier/Deposit/PaymentForm/index.js +6 -5
- package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +4 -1
- package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +4 -1
- package/lib/components/Money/index.js +25 -2
- package/lib/widgets/BonusWidget/index.js +5 -5
- package/lib/widgets/Cashier/Deposit/PaymentForm/InjectedIframeHTML.js +7 -3
- package/lib/widgets/Cashier/Deposit/PaymentForm/index.js +6 -5
- package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +4 -1
- package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/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;
|
|
@@ -7,6 +7,7 @@ import Button from '../../components/Button';
|
|
|
7
7
|
import BonusCode from './BonusCode';
|
|
8
8
|
import { List } from 'tg-core-components';
|
|
9
9
|
import Translate from '../../components/Translate';
|
|
10
|
+
import Money from '../../components/Money';
|
|
10
11
|
import { getBonusState } from './states';
|
|
11
12
|
import marked from 'marked';
|
|
12
13
|
|
|
@@ -168,11 +169,7 @@ var BonusWidget = function BonusWidget(_ref3) {
|
|
|
168
169
|
)], [React.createElement(
|
|
169
170
|
'div',
|
|
170
171
|
{ className: 'amount' },
|
|
171
|
-
React.createElement(FormattedNumber, {
|
|
172
|
-
value: item.Amount,
|
|
173
|
-
style: item.Type.toLowerCase() == 'freespins' ? 'decimal' : 'currency',
|
|
174
|
-
currency: item.Currency
|
|
175
|
-
})
|
|
172
|
+
item.Type.toLowerCase() == 'freespins' ? React.createElement(FormattedNumber, { value: item.Amount, style: 'decimal' }) : React.createElement(Money, { value: item.Amount, currency: item.Currency })
|
|
176
173
|
), React.createElement(Translate, {
|
|
177
174
|
id: 'label.type.bonus.' + item.Type.toLowerCase(),
|
|
178
175
|
defaultMessage: item.Type.toLowerCase()
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
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; };
|
|
2
|
+
|
|
1
3
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
2
4
|
|
|
3
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -40,9 +42,11 @@ var InjectedIframeHTML = function (_Component) {
|
|
|
40
42
|
value: function render() {
|
|
41
43
|
var _this2 = this;
|
|
42
44
|
|
|
43
|
-
var
|
|
45
|
+
var _props = this.props,
|
|
46
|
+
data = _props.data,
|
|
47
|
+
iframeProps = _props.iframeProps;
|
|
44
48
|
|
|
45
|
-
return React.createElement('iframe', {
|
|
49
|
+
return React.createElement('iframe', _extends({
|
|
46
50
|
ref: function ref(node) {
|
|
47
51
|
return _this2._iframe = node;
|
|
48
52
|
},
|
|
@@ -50,7 +54,7 @@ var InjectedIframeHTML = function (_Component) {
|
|
|
50
54
|
width: '100%',
|
|
51
55
|
height: data.redirectOutput.height,
|
|
52
56
|
onLoad: this.handleLoad
|
|
53
|
-
});
|
|
57
|
+
}, iframeProps));
|
|
54
58
|
}
|
|
55
59
|
}]);
|
|
56
60
|
|
|
@@ -125,7 +125,8 @@ var PaymentForm = function (_Component) {
|
|
|
125
125
|
onClose = _props.onClose,
|
|
126
126
|
onSuccess = _props.onSuccess,
|
|
127
127
|
redirect = _props.redirect,
|
|
128
|
-
details = _props.details
|
|
128
|
+
details = _props.details,
|
|
129
|
+
iframeProps = _props.iframeProps;
|
|
129
130
|
|
|
130
131
|
|
|
131
132
|
if (!data.success) {
|
|
@@ -158,19 +159,19 @@ var PaymentForm = function (_Component) {
|
|
|
158
159
|
target: redirect ? '_top' : frameId
|
|
159
160
|
}, data.redirectOutput));
|
|
160
161
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'POST' && data.redirectOutput.html != null) {
|
|
161
|
-
return React.createElement(InjectedIframeHTML, { data: data });
|
|
162
|
+
return React.createElement(InjectedIframeHTML, { data: data, iframeProps: iframeProps });
|
|
162
163
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET' && data.redirectOutput.html != null) {
|
|
163
|
-
return React.createElement(InjectedIframeHTML, { data: data });
|
|
164
|
+
return React.createElement(InjectedIframeHTML, { data: data, iframeProps: iframeProps });
|
|
164
165
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET' && redirect) {
|
|
165
166
|
window.location.href = data.redirectOutput.url;
|
|
166
167
|
return null;
|
|
167
168
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET') {
|
|
168
|
-
return React.createElement('iframe', {
|
|
169
|
+
return React.createElement('iframe', _extends({
|
|
169
170
|
src: data.redirectOutput.url,
|
|
170
171
|
width: data.redirectOutput.width,
|
|
171
172
|
height: data.redirectOutput.height,
|
|
172
173
|
frameBorder: '0'
|
|
173
|
-
});
|
|
174
|
+
}, iframeProps));
|
|
174
175
|
} else if (data.redirectOutput.container == 'window' && data.redirectOutput.method == 'POST') {
|
|
175
176
|
return React.createElement(DynamicForm, data.redirectOutput);
|
|
176
177
|
} else if (data.redirectOutput.container == 'window' && data.redirectOutput.method == 'GET') {
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -30,6 +30,10 @@ var _Translate = require('../../components/Translate');
|
|
|
30
30
|
|
|
31
31
|
var _Translate2 = _interopRequireDefault(_Translate);
|
|
32
32
|
|
|
33
|
+
var _Money = require('../../components/Money');
|
|
34
|
+
|
|
35
|
+
var _Money2 = _interopRequireDefault(_Money);
|
|
36
|
+
|
|
33
37
|
var _states = require('./states');
|
|
34
38
|
|
|
35
39
|
var _marked = require('marked');
|
|
@@ -196,11 +200,7 @@ var BonusWidget = function BonusWidget(_ref3) {
|
|
|
196
200
|
)], [_react2.default.createElement(
|
|
197
201
|
'div',
|
|
198
202
|
{ className: 'amount' },
|
|
199
|
-
_react2.default.createElement(_reactIntl.FormattedNumber, {
|
|
200
|
-
value: item.Amount,
|
|
201
|
-
style: item.Type.toLowerCase() == 'freespins' ? 'decimal' : 'currency',
|
|
202
|
-
currency: item.Currency
|
|
203
|
-
})
|
|
203
|
+
item.Type.toLowerCase() == 'freespins' ? _react2.default.createElement(_reactIntl.FormattedNumber, { value: item.Amount, style: 'decimal' }) : _react2.default.createElement(_Money2.default, { value: item.Amount, currency: item.Currency })
|
|
204
204
|
), _react2.default.createElement(_Translate2.default, {
|
|
205
205
|
id: 'label.type.bonus.' + item.Type.toLowerCase(),
|
|
206
206
|
defaultMessage: item.Type.toLowerCase()
|
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
+
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
|
+
|
|
7
9
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
10
|
|
|
9
11
|
var _react = require('react');
|
|
@@ -50,9 +52,11 @@ var InjectedIframeHTML = function (_Component) {
|
|
|
50
52
|
value: function render() {
|
|
51
53
|
var _this2 = this;
|
|
52
54
|
|
|
53
|
-
var
|
|
55
|
+
var _props = this.props,
|
|
56
|
+
data = _props.data,
|
|
57
|
+
iframeProps = _props.iframeProps;
|
|
54
58
|
|
|
55
|
-
return _react2.default.createElement('iframe', {
|
|
59
|
+
return _react2.default.createElement('iframe', _extends({
|
|
56
60
|
ref: function ref(node) {
|
|
57
61
|
return _this2._iframe = node;
|
|
58
62
|
},
|
|
@@ -60,7 +64,7 @@ var InjectedIframeHTML = function (_Component) {
|
|
|
60
64
|
width: '100%',
|
|
61
65
|
height: data.redirectOutput.height,
|
|
62
66
|
onLoad: this.handleLoad
|
|
63
|
-
});
|
|
67
|
+
}, iframeProps));
|
|
64
68
|
}
|
|
65
69
|
}]);
|
|
66
70
|
|
|
@@ -157,7 +157,8 @@ var PaymentForm = function (_Component) {
|
|
|
157
157
|
onClose = _props.onClose,
|
|
158
158
|
onSuccess = _props.onSuccess,
|
|
159
159
|
redirect = _props.redirect,
|
|
160
|
-
details = _props.details
|
|
160
|
+
details = _props.details,
|
|
161
|
+
iframeProps = _props.iframeProps;
|
|
161
162
|
|
|
162
163
|
|
|
163
164
|
if (!data.success) {
|
|
@@ -190,19 +191,19 @@ var PaymentForm = function (_Component) {
|
|
|
190
191
|
target: redirect ? '_top' : frameId
|
|
191
192
|
}, data.redirectOutput));
|
|
192
193
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'POST' && data.redirectOutput.html != null) {
|
|
193
|
-
return _react2.default.createElement(_InjectedIframeHTML2.default, { data: data });
|
|
194
|
+
return _react2.default.createElement(_InjectedIframeHTML2.default, { data: data, iframeProps: iframeProps });
|
|
194
195
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET' && data.redirectOutput.html != null) {
|
|
195
|
-
return _react2.default.createElement(_InjectedIframeHTML2.default, { data: data });
|
|
196
|
+
return _react2.default.createElement(_InjectedIframeHTML2.default, { data: data, iframeProps: iframeProps });
|
|
196
197
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET' && redirect) {
|
|
197
198
|
window.location.href = data.redirectOutput.url;
|
|
198
199
|
return null;
|
|
199
200
|
} else if (data.redirectOutput.container == 'iframe' && data.redirectOutput.method == 'GET') {
|
|
200
|
-
return _react2.default.createElement('iframe', {
|
|
201
|
+
return _react2.default.createElement('iframe', _extends({
|
|
201
202
|
src: data.redirectOutput.url,
|
|
202
203
|
width: data.redirectOutput.width,
|
|
203
204
|
height: data.redirectOutput.height,
|
|
204
205
|
frameBorder: '0'
|
|
205
|
-
});
|
|
206
|
+
}, iframeProps));
|
|
206
207
|
} else if (data.redirectOutput.container == 'window' && data.redirectOutput.method == 'POST') {
|
|
207
208
|
return _react2.default.createElement(_DynamicForm2.default, data.redirectOutput);
|
|
208
209
|
} else if (data.redirectOutput.container == 'window' && data.redirectOutput.method == 'GET') {
|
|
@@ -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
|
}
|