tg-core-components 6.1.1-verify.0 → 6.1.3-crypto.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.
@@ -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') {
@@ -139,6 +139,16 @@ var DepositWidget = function (_Component) {
139
139
  }
140
140
 
141
141
  _createClass(DepositWidget, [{
142
+ key: 'componentDidUpdate',
143
+ value: function componentDidUpdate(prevProps) {
144
+ // Update state when the bonus code updates in props
145
+ if (this.props.bonusCode !== prevProps.bonusCode) {
146
+ this.setState({
147
+ bonusCode: this.props.bonusCode
148
+ });
149
+ }
150
+ }
151
+ }, {
142
152
  key: 'render',
143
153
  value: function render() {
144
154
  var _this2 = this;
@@ -21,7 +21,13 @@ var CashierResult = function CashierResult(_ref) {
21
21
 
22
22
  if (status === 'success' || status === 'pending') {
23
23
  var intl = useIntl();
24
- var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status + '.' + providerType;
24
+
25
+ var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status;
26
+
27
+ if (providerType && intl.messages[messageKey + '.' + providerType]) {
28
+ messageKey = messageKey + '.' + providerType;
29
+ }
30
+
25
31
  return React.createElement(
26
32
  'div',
27
33
  { className: 'cashier-accordion' },
@@ -31,9 +37,7 @@ var CashierResult = function CashierResult(_ref) {
31
37
  React.createElement(Notice, {
32
38
  level: 'success',
33
39
  icon: React.createElement(Icon, { icon: 'check' }),
34
- header: React.createElement(Translate, {
35
- id: getKey(intl, messageKey)
36
- })
40
+ header: React.createElement(Translate, { id: messageKey })
37
41
  }),
38
42
  successMessage && React.createElement(
39
43
  'div',
@@ -17,7 +17,71 @@ import { SkeletonLine } from '../../components/Skeleton';
17
17
  import getByPath from 'lodash/get';
18
18
  import Translate from '../../components/Translate';
19
19
  import { getMessage } from './message';
20
- import { selectUnit } from '../../lib/utils/selectUnit';
20
+
21
+ var MILISECONDS = {
22
+ IN_A_SECOND: 1000,
23
+ IN_A_MINUTE: 60000,
24
+ IN_AN_HOUR: 3600000,
25
+ IN_A_DAY: 86400000,
26
+ IN_A_WEEK: 604800000,
27
+ IN_A_MONTH: 2628000000,
28
+ IN_A_YEAR: 31536000000
29
+ };
30
+
31
+ var selectUnit = function selectUnit(from) {
32
+ var now = Date.now();
33
+ var ms = now - from;
34
+
35
+ switch (true) {
36
+ case MILISECONDS.IN_A_SECOND < ms && ms < MILISECONDS.IN_A_MINUTE:
37
+ return {
38
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_SECOND),
39
+ unit: 'second',
40
+ updateIntervalInSeconds: 1
41
+ };
42
+
43
+ case MILISECONDS.IN_A_MINUTE < ms && ms < MILISECONDS.IN_AN_HOUR:
44
+ return {
45
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_MINUTE),
46
+ unit: 'minute'
47
+ };
48
+
49
+ case MILISECONDS.IN_AN_HOUR < ms && ms < MILISECONDS.IN_A_DAY:
50
+ return {
51
+ value: -1 * Math.floor(ms / MILISECONDS.IN_AN_HOUR),
52
+ unit: 'hour'
53
+ };
54
+
55
+ case MILISECONDS.IN_A_DAY < ms && ms < MILISECONDS.IN_A_WEEK:
56
+ return {
57
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_DAY),
58
+ unit: 'day'
59
+ };
60
+
61
+ case MILISECONDS.IN_A_WEEK < ms && ms < MILISECONDS.IN_A_MONTH:
62
+ return {
63
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_WEEK),
64
+ unit: 'week'
65
+ };
66
+
67
+ case MILISECONDS.IN_A_MONTH < ms && ms < MILISECONDS.IN_A_YEAR:
68
+ return {
69
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_MONTH),
70
+ unit: 'month'
71
+ };
72
+
73
+ case MILISECONDS.IN_A_YEAR < ms:
74
+ return {
75
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_YEAR),
76
+ unit: 'year'
77
+ };
78
+
79
+ default:
80
+ return {
81
+ value: 0
82
+ };
83
+ }
84
+ };
21
85
 
22
86
  var HistoryWidgetList = function (_React$Component) {
23
87
  _inherits(HistoryWidgetList, _React$Component);
@@ -45,7 +109,7 @@ var HistoryWidgetList = function (_React$Component) {
45
109
  minute: '2-digit',
46
110
  second: '2-digit'
47
111
  });
48
- }, _this.createListInfo = function (item, product, currency, isLoading) {
112
+ }, _this.createListInfo = function (item, product, isLoading) {
49
113
  if (isLoading) return [[React.createElement(SkeletonLine, { bold: true }), React.createElement(SkeletonLine, null)], [React.createElement(SkeletonLine, { bold: true }), React.createElement(SkeletonLine, null)]];
50
114
 
51
115
  if (product === 'casino') {
@@ -57,7 +121,7 @@ var HistoryWidgetList = function (_React$Component) {
57
121
  'div',
58
122
  null,
59
123
  getMessage(getByPath(item, 'Transactions[0].Status'))
60
- )], [React.createElement(Money, { value: item.Win - item.Bet, currency: currency }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.StartTime + '+00:00')))]];
124
+ )], [React.createElement(Money, { value: item.Win - item.Bet, currency: item.Currency }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.StartTime + '+00:00')))]];
61
125
  } else if (product === 'sportsbook') {
62
126
  var selection = item.Transactions[0].Description;
63
127
  var odds = item.Transactions[0].Odds;
@@ -73,7 +137,7 @@ var HistoryWidgetList = function (_React$Component) {
73
137
  'div',
74
138
  null,
75
139
  getMessage(item.Settled ? 'settled' : 'pendling')
76
- )], [React.createElement(Money, { value: item.TotalWin - item.TotalWager, currency: currency }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
140
+ )], [React.createElement(Money, { value: item.TotalWin - item.TotalWager, currency: item.Currency }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
77
141
  } else if (product === 'bingo') {
78
142
  return [[React.createElement(Translate, {
79
143
  tag: 'div'
@@ -85,7 +149,7 @@ var HistoryWidgetList = function (_React$Component) {
85
149
  getMessage(getByPath(item, 'Transactions[0].TransactionType'))
86
150
  )], [React.createElement(Money, {
87
151
  value: getByPath(item, 'Transactions[0].Amount'),
88
- currency: currency
152
+ currency: item.Currency
89
153
  }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
90
154
  } else if (product === 'fantasy') {
91
155
  return [[React.createElement(
@@ -100,7 +164,7 @@ var HistoryWidgetList = function (_React$Component) {
100
164
  getMessage(item.Status === 'Default' ? 'initiated' : item.Status === 'Canceled' ? 'canceled' : 'completed')
101
165
  )], [React.createElement(Money, {
102
166
  value: item.Win - (item.Bet + item.Rake),
103
- currency: currency
167
+ currency: item.Currency
104
168
  }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
105
169
  }
106
170
 
@@ -114,9 +178,9 @@ var HistoryWidgetList = function (_React$Component) {
114
178
  getMessage(item.Status)
115
179
  )], [React.createElement(Money, {
116
180
  value: item.TransactionType === 'Withdraw' ? -item.Amount : item.Amount,
117
- currency: currency
181
+ currency: item.Currency
118
182
  }), React.createElement(FormattedRelativeTime, selectUnit(new Date(item.Started + '+00:00')))]];
119
- }, _this.createListDetail = function (item, product, currency) {
183
+ }, _this.createListDetail = function (item, product) {
120
184
  if (product === 'casino') {
121
185
  return [[React.createElement(
122
186
  'div',
@@ -128,14 +192,14 @@ var HistoryWidgetList = function (_React$Component) {
128
192
  id: 'label.history.bet',
129
193
  defaultMessage: 'Bet: {value}',
130
194
  values: {
131
- value: React.createElement(Money, { value: item.Bet, currency: currency })
195
+ value: React.createElement(Money, { value: item.Bet, currency: item.Currency })
132
196
  }
133
197
  }), React.createElement(Translate, {
134
198
  tag: 'div',
135
199
  id: 'label.history.win',
136
200
  defaultMessage: 'Win: {value}',
137
201
  values: {
138
- value: React.createElement(Money, { value: item.Win, currency: currency })
202
+ value: React.createElement(Money, { value: item.Win, currency: item.Currency })
139
203
  }
140
204
  })]];
141
205
  } else if (product === 'sportsbook') {
@@ -164,14 +228,14 @@ var HistoryWidgetList = function (_React$Component) {
164
228
  id: 'label.history.bet',
165
229
  defaultMessage: 'Bet: {value}',
166
230
  values: {
167
- value: React.createElement(Money, { value: item.TotalWager, currency: currency })
231
+ value: React.createElement(Money, { value: item.TotalWager, currency: item.Currency })
168
232
  }
169
233
  }), React.createElement(Translate, {
170
234
  tag: 'div',
171
235
  id: 'label.history.win',
172
236
  defaultMessage: 'Win: {value}',
173
237
  values: {
174
- value: React.createElement(Money, { value: item.TotalWin, currency: currency })
238
+ value: React.createElement(Money, { value: item.TotalWin, currency: item.Currency })
175
239
  }
176
240
  })]];
177
241
  } else if (product === 'bingo') {
@@ -204,14 +268,14 @@ var HistoryWidgetList = function (_React$Component) {
204
268
  id: 'label.history.bet',
205
269
  defaultMessage: 'Bet: {value}',
206
270
  values: {
207
- value: React.createElement(Money, { value: item.Bet + item.Rake, currency: currency })
271
+ value: React.createElement(Money, { value: item.Bet + item.Rake, currency: item.Currency })
208
272
  }
209
273
  }), React.createElement(Translate, {
210
274
  tag: 'div',
211
275
  id: 'label.history.win',
212
276
  defaultMessage: 'Win: {value}',
213
277
  values: {
214
- value: React.createElement(Money, { value: item.Win, currency: currency })
278
+ value: React.createElement(Money, { value: item.Win, currency: item.Currency })
215
279
  }
216
280
  })]];
217
281
  }
@@ -273,8 +337,7 @@ var HistoryWidgetList = function (_React$Component) {
273
337
  var _props = this.props,
274
338
  items = _props.items,
275
339
  product = _props.product,
276
- limit = _props.limit,
277
- currency = _props.currency;
340
+ limit = _props.limit;
278
341
  var page = this.state.page;
279
342
 
280
343
 
@@ -283,8 +346,8 @@ var HistoryWidgetList = function (_React$Component) {
283
346
  var listItems = pageItems.map(function (item) {
284
347
  return {
285
348
  id: item,
286
- info: _this2.createListInfo(item, product, currency, items.isLoading),
287
- detail: _this2.createListDetail(item, product, currency, items.isLoading)
349
+ info: _this2.createListInfo(item, product, items.isLoading),
350
+ detail: _this2.createListDetail(item, product, items.isLoading)
288
351
  };
289
352
  });
290
353
 
@@ -331,7 +394,6 @@ var HistoryWidget = function HistoryWidget(_ref2) {
331
394
  var getTransactions = _ref2.getTransactions,
332
395
  items = _ref2.items,
333
396
  products = _ref2.products,
334
- currency = _ref2.currency,
335
397
  limit = _ref2.limit;
336
398
 
337
399
  var accordionItems = products.map(function (product) {
@@ -339,7 +401,6 @@ var HistoryWidget = function HistoryWidget(_ref2) {
339
401
  header: getMessage(product),
340
402
  content: React.createElement(HistoryWidgetList, {
341
403
  product: product,
342
- currency: currency,
343
404
  limit: limit,
344
405
  getTransactions: getTransactions[product],
345
406
  items: items[product]
@@ -19,10 +19,10 @@ import { FormattedRelativeTime } from 'react-intl';
19
19
  import getByPath from 'lodash/get';
20
20
  import PropTypes from 'prop-types';
21
21
  import Translate from '../../components/Translate';
22
+ import { selectUnit } from '@formatjs/intl-utils';
22
23
  import { getKycType } from '../Verify/types';
23
24
  import { getKycReason } from '../Verify/reasons';
24
25
  import { getKycStatus } from '../Verify/status';
25
- import { selectUnit } from '../../lib/utils/selectUnit';
26
26
 
27
27
  var UploadForm = function UploadForm(_ref) {
28
28
  var type = _ref.type,
@@ -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') {
@@ -204,6 +204,16 @@ var DepositWidget = function (_Component) {
204
204
  }
205
205
 
206
206
  _createClass(DepositWidget, [{
207
+ key: 'componentDidUpdate',
208
+ value: function componentDidUpdate(prevProps) {
209
+ // Update state when the bonus code updates in props
210
+ if (this.props.bonusCode !== prevProps.bonusCode) {
211
+ this.setState({
212
+ bonusCode: this.props.bonusCode
213
+ });
214
+ }
215
+ }
216
+ }, {
207
217
  key: 'render',
208
218
  value: function render() {
209
219
  var _this2 = this;
@@ -45,7 +45,13 @@ var CashierResult = function CashierResult(_ref) {
45
45
 
46
46
  if (status === 'success' || status === 'pending') {
47
47
  var intl = (0, _reactIntl.useIntl)();
48
- var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status + '.' + providerType;
48
+
49
+ var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status;
50
+
51
+ if (providerType && intl.messages[messageKey + '.' + providerType]) {
52
+ messageKey = messageKey + '.' + providerType;
53
+ }
54
+
49
55
  return _react2.default.createElement(
50
56
  'div',
51
57
  { className: 'cashier-accordion' },
@@ -55,9 +61,7 @@ var CashierResult = function CashierResult(_ref) {
55
61
  _react2.default.createElement(_Notice2.default, {
56
62
  level: 'success',
57
63
  icon: _react2.default.createElement(_Icon2.default, { icon: 'check' }),
58
- header: _react2.default.createElement(_Translate2.default, {
59
- id: (0, _Alert.getKey)(intl, messageKey)
60
- })
64
+ header: _react2.default.createElement(_Translate2.default, { id: messageKey })
61
65
  }),
62
66
  successMessage && _react2.default.createElement(
63
67
  'div',
@@ -44,8 +44,6 @@ var _Translate2 = _interopRequireDefault(_Translate);
44
44
 
45
45
  var _message = require('./message');
46
46
 
47
- var _selectUnit = require('../../lib/utils/selectUnit');
48
-
49
47
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
48
 
51
49
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -54,6 +52,71 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
54
52
 
55
53
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
56
54
 
55
+ var MILISECONDS = {
56
+ IN_A_SECOND: 1000,
57
+ IN_A_MINUTE: 60000,
58
+ IN_AN_HOUR: 3600000,
59
+ IN_A_DAY: 86400000,
60
+ IN_A_WEEK: 604800000,
61
+ IN_A_MONTH: 2628000000,
62
+ IN_A_YEAR: 31536000000
63
+ };
64
+
65
+ var selectUnit = function selectUnit(from) {
66
+ var now = Date.now();
67
+ var ms = now - from;
68
+
69
+ switch (true) {
70
+ case MILISECONDS.IN_A_SECOND < ms && ms < MILISECONDS.IN_A_MINUTE:
71
+ return {
72
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_SECOND),
73
+ unit: 'second',
74
+ updateIntervalInSeconds: 1
75
+ };
76
+
77
+ case MILISECONDS.IN_A_MINUTE < ms && ms < MILISECONDS.IN_AN_HOUR:
78
+ return {
79
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_MINUTE),
80
+ unit: 'minute'
81
+ };
82
+
83
+ case MILISECONDS.IN_AN_HOUR < ms && ms < MILISECONDS.IN_A_DAY:
84
+ return {
85
+ value: -1 * Math.floor(ms / MILISECONDS.IN_AN_HOUR),
86
+ unit: 'hour'
87
+ };
88
+
89
+ case MILISECONDS.IN_A_DAY < ms && ms < MILISECONDS.IN_A_WEEK:
90
+ return {
91
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_DAY),
92
+ unit: 'day'
93
+ };
94
+
95
+ case MILISECONDS.IN_A_WEEK < ms && ms < MILISECONDS.IN_A_MONTH:
96
+ return {
97
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_WEEK),
98
+ unit: 'week'
99
+ };
100
+
101
+ case MILISECONDS.IN_A_MONTH < ms && ms < MILISECONDS.IN_A_YEAR:
102
+ return {
103
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_MONTH),
104
+ unit: 'month'
105
+ };
106
+
107
+ case MILISECONDS.IN_A_YEAR < ms:
108
+ return {
109
+ value: -1 * Math.floor(ms / MILISECONDS.IN_A_YEAR),
110
+ unit: 'year'
111
+ };
112
+
113
+ default:
114
+ return {
115
+ value: 0
116
+ };
117
+ }
118
+ };
119
+
57
120
  var HistoryWidgetList = function (_React$Component) {
58
121
  _inherits(HistoryWidgetList, _React$Component);
59
122
 
@@ -80,7 +143,7 @@ var HistoryWidgetList = function (_React$Component) {
80
143
  minute: '2-digit',
81
144
  second: '2-digit'
82
145
  });
83
- }, _this.createListInfo = function (item, product, currency, isLoading) {
146
+ }, _this.createListInfo = function (item, product, isLoading) {
84
147
  if (isLoading) return [[_react2.default.createElement(_Skeleton.SkeletonLine, { bold: true }), _react2.default.createElement(_Skeleton.SkeletonLine, null)], [_react2.default.createElement(_Skeleton.SkeletonLine, { bold: true }), _react2.default.createElement(_Skeleton.SkeletonLine, null)]];
85
148
 
86
149
  if (product === 'casino') {
@@ -92,7 +155,7 @@ var HistoryWidgetList = function (_React$Component) {
92
155
  'div',
93
156
  null,
94
157
  (0, _message.getMessage)((0, _get2.default)(item, 'Transactions[0].Status'))
95
- )], [_react2.default.createElement(_Money2.default, { value: item.Win - item.Bet, currency: currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.StartTime + '+00:00')))]];
158
+ )], [_react2.default.createElement(_Money2.default, { value: item.Win - item.Bet, currency: item.Currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.StartTime + '+00:00')))]];
96
159
  } else if (product === 'sportsbook') {
97
160
  var selection = item.Transactions[0].Description;
98
161
  var odds = item.Transactions[0].Odds;
@@ -108,7 +171,7 @@ var HistoryWidgetList = function (_React$Component) {
108
171
  'div',
109
172
  null,
110
173
  (0, _message.getMessage)(item.Settled ? 'settled' : 'pendling')
111
- )], [_react2.default.createElement(_Money2.default, { value: item.TotalWin - item.TotalWager, currency: currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Created + '+00:00')))]];
174
+ )], [_react2.default.createElement(_Money2.default, { value: item.TotalWin - item.TotalWager, currency: item.Currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
112
175
  } else if (product === 'bingo') {
113
176
  return [[_react2.default.createElement(_Translate2.default, {
114
177
  tag: 'div'
@@ -120,8 +183,8 @@ var HistoryWidgetList = function (_React$Component) {
120
183
  (0, _message.getMessage)((0, _get2.default)(item, 'Transactions[0].TransactionType'))
121
184
  )], [_react2.default.createElement(_Money2.default, {
122
185
  value: (0, _get2.default)(item, 'Transactions[0].Amount'),
123
- currency: currency
124
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Created + '+00:00')))]];
186
+ currency: item.Currency
187
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
125
188
  } else if (product === 'fantasy') {
126
189
  return [[_react2.default.createElement(
127
190
  'div',
@@ -135,8 +198,8 @@ var HistoryWidgetList = function (_React$Component) {
135
198
  (0, _message.getMessage)(item.Status === 'Default' ? 'initiated' : item.Status === 'Canceled' ? 'canceled' : 'completed')
136
199
  )], [_react2.default.createElement(_Money2.default, {
137
200
  value: item.Win - (item.Bet + item.Rake),
138
- currency: currency
139
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Created + '+00:00')))]];
201
+ currency: item.Currency
202
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
140
203
  }
141
204
 
142
205
  return [[_react2.default.createElement(
@@ -149,9 +212,9 @@ var HistoryWidgetList = function (_React$Component) {
149
212
  (0, _message.getMessage)(item.Status)
150
213
  )], [_react2.default.createElement(_Money2.default, {
151
214
  value: item.TransactionType === 'Withdraw' ? -item.Amount : item.Amount,
152
- currency: currency
153
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Started + '+00:00')))]];
154
- }, _this.createListDetail = function (item, product, currency) {
215
+ currency: item.Currency
216
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Started + '+00:00')))]];
217
+ }, _this.createListDetail = function (item, product) {
155
218
  if (product === 'casino') {
156
219
  return [[_react2.default.createElement(
157
220
  'div',
@@ -163,14 +226,14 @@ var HistoryWidgetList = function (_React$Component) {
163
226
  id: 'label.history.bet',
164
227
  defaultMessage: 'Bet: {value}',
165
228
  values: {
166
- value: _react2.default.createElement(_Money2.default, { value: item.Bet, currency: currency })
229
+ value: _react2.default.createElement(_Money2.default, { value: item.Bet, currency: item.Currency })
167
230
  }
168
231
  }), _react2.default.createElement(_Translate2.default, {
169
232
  tag: 'div',
170
233
  id: 'label.history.win',
171
234
  defaultMessage: 'Win: {value}',
172
235
  values: {
173
- value: _react2.default.createElement(_Money2.default, { value: item.Win, currency: currency })
236
+ value: _react2.default.createElement(_Money2.default, { value: item.Win, currency: item.Currency })
174
237
  }
175
238
  })]];
176
239
  } else if (product === 'sportsbook') {
@@ -199,14 +262,14 @@ var HistoryWidgetList = function (_React$Component) {
199
262
  id: 'label.history.bet',
200
263
  defaultMessage: 'Bet: {value}',
201
264
  values: {
202
- value: _react2.default.createElement(_Money2.default, { value: item.TotalWager, currency: currency })
265
+ value: _react2.default.createElement(_Money2.default, { value: item.TotalWager, currency: item.Currency })
203
266
  }
204
267
  }), _react2.default.createElement(_Translate2.default, {
205
268
  tag: 'div',
206
269
  id: 'label.history.win',
207
270
  defaultMessage: 'Win: {value}',
208
271
  values: {
209
- value: _react2.default.createElement(_Money2.default, { value: item.TotalWin, currency: currency })
272
+ value: _react2.default.createElement(_Money2.default, { value: item.TotalWin, currency: item.Currency })
210
273
  }
211
274
  })]];
212
275
  } else if (product === 'bingo') {
@@ -239,14 +302,14 @@ var HistoryWidgetList = function (_React$Component) {
239
302
  id: 'label.history.bet',
240
303
  defaultMessage: 'Bet: {value}',
241
304
  values: {
242
- value: _react2.default.createElement(_Money2.default, { value: item.Bet + item.Rake, currency: currency })
305
+ value: _react2.default.createElement(_Money2.default, { value: item.Bet + item.Rake, currency: item.Currency })
243
306
  }
244
307
  }), _react2.default.createElement(_Translate2.default, {
245
308
  tag: 'div',
246
309
  id: 'label.history.win',
247
310
  defaultMessage: 'Win: {value}',
248
311
  values: {
249
- value: _react2.default.createElement(_Money2.default, { value: item.Win, currency: currency })
312
+ value: _react2.default.createElement(_Money2.default, { value: item.Win, currency: item.Currency })
250
313
  }
251
314
  })]];
252
315
  }
@@ -308,8 +371,7 @@ var HistoryWidgetList = function (_React$Component) {
308
371
  var _props = this.props,
309
372
  items = _props.items,
310
373
  product = _props.product,
311
- limit = _props.limit,
312
- currency = _props.currency;
374
+ limit = _props.limit;
313
375
  var page = this.state.page;
314
376
 
315
377
 
@@ -318,8 +380,8 @@ var HistoryWidgetList = function (_React$Component) {
318
380
  var listItems = pageItems.map(function (item) {
319
381
  return {
320
382
  id: item,
321
- info: _this2.createListInfo(item, product, currency, items.isLoading),
322
- detail: _this2.createListDetail(item, product, currency, items.isLoading)
383
+ info: _this2.createListInfo(item, product, items.isLoading),
384
+ detail: _this2.createListDetail(item, product, items.isLoading)
323
385
  };
324
386
  });
325
387
 
@@ -366,7 +428,6 @@ var HistoryWidget = function HistoryWidget(_ref2) {
366
428
  var getTransactions = _ref2.getTransactions,
367
429
  items = _ref2.items,
368
430
  products = _ref2.products,
369
- currency = _ref2.currency,
370
431
  limit = _ref2.limit;
371
432
 
372
433
  var accordionItems = products.map(function (product) {
@@ -374,7 +435,6 @@ var HistoryWidget = function HistoryWidget(_ref2) {
374
435
  header: (0, _message.getMessage)(product),
375
436
  content: _react2.default.createElement(HistoryWidgetList, {
376
437
  product: product,
377
- currency: currency,
378
438
  limit: limit,
379
439
  getTransactions: getTransactions[product],
380
440
  items: items[product]
@@ -44,14 +44,14 @@ var _Translate = require('../../components/Translate');
44
44
 
45
45
  var _Translate2 = _interopRequireDefault(_Translate);
46
46
 
47
+ var _intlUtils = require('@formatjs/intl-utils');
48
+
47
49
  var _types = require('../Verify/types');
48
50
 
49
51
  var _reasons = require('../Verify/reasons');
50
52
 
51
53
  var _status = require('../Verify/status');
52
54
 
53
- var _selectUnit = require('../../lib/utils/selectUnit');
54
-
55
55
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
56
56
 
57
57
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -119,7 +119,7 @@ var KYCList = function KYCList(_ref2) {
119
119
  'div',
120
120
  { className: 'bold' },
121
121
  (0, _types.getKycType)(item.Type)
122
- ), (0, _status.getKycStatus)(item.Status)], [_react2.default.createElement('div', { className: 'space' }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Added + '+00:00')))]],
122
+ ), (0, _status.getKycStatus)(item.Status)], [_react2.default.createElement('div', { className: 'space' }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _intlUtils.selectUnit)(new Date(item.Added + '+00:00')))]],
123
123
  detail: [[_react2.default.createElement(_Translate2.default, { id: 'label.comment', defaultMessage: 'Comment' }), _react2.default.createElement(_Translate2.default, { id: 'label.reasons', defaultMessage: 'Reasons' })], [item.Comment ? _react2.default.createElement(
124
124
  'span',
125
125
  null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.1.1-verify.0",
3
+ "version": "6.1.3-crypto.0",
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": "c4a8f4edf41051f46b347f86afa4692174d9f7cf"
79
+ "gitHead": "655fb1956cc5f772c25bcb3a193836eb387d5122"
80
80
  }
@@ -1,64 +0,0 @@
1
- var MILISECONDS = {
2
- IN_A_SECOND: 1000,
3
- IN_A_MINUTE: 60000,
4
- IN_AN_HOUR: 3600000,
5
- IN_A_DAY: 86400000,
6
- IN_A_WEEK: 604800000,
7
- IN_A_MONTH: 2628000000,
8
- IN_A_YEAR: 31536000000
9
- };
10
-
11
- export var selectUnit = function selectUnit(from) {
12
- var now = Date.now();
13
- var ms = now - from;
14
-
15
- switch (true) {
16
- case MILISECONDS.IN_A_SECOND < ms && ms < MILISECONDS.IN_A_MINUTE:
17
- return {
18
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_SECOND),
19
- unit: 'second',
20
- updateIntervalInSeconds: 1
21
- };
22
-
23
- case MILISECONDS.IN_A_MINUTE < ms && ms < MILISECONDS.IN_AN_HOUR:
24
- return {
25
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_MINUTE),
26
- unit: 'minute'
27
- };
28
-
29
- case MILISECONDS.IN_AN_HOUR < ms && ms < MILISECONDS.IN_A_DAY:
30
- return {
31
- value: -1 * Math.floor(ms / MILISECONDS.IN_AN_HOUR),
32
- unit: 'hour'
33
- };
34
-
35
- case MILISECONDS.IN_A_DAY < ms && ms < MILISECONDS.IN_A_WEEK:
36
- return {
37
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_DAY),
38
- unit: 'day'
39
- };
40
-
41
- case MILISECONDS.IN_A_WEEK < ms && ms < MILISECONDS.IN_A_MONTH:
42
- return {
43
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_WEEK),
44
- unit: 'week'
45
- };
46
-
47
- case MILISECONDS.IN_A_MONTH < ms && ms < MILISECONDS.IN_A_YEAR:
48
- return {
49
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_MONTH),
50
- unit: 'month'
51
- };
52
-
53
- case MILISECONDS.IN_A_YEAR < ms:
54
- return {
55
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_YEAR),
56
- unit: 'year'
57
- };
58
-
59
- default:
60
- return {
61
- value: 0
62
- };
63
- }
64
- };
@@ -1,69 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var MILISECONDS = {
7
- IN_A_SECOND: 1000,
8
- IN_A_MINUTE: 60000,
9
- IN_AN_HOUR: 3600000,
10
- IN_A_DAY: 86400000,
11
- IN_A_WEEK: 604800000,
12
- IN_A_MONTH: 2628000000,
13
- IN_A_YEAR: 31536000000
14
- };
15
-
16
- var selectUnit = exports.selectUnit = function selectUnit(from) {
17
- var now = Date.now();
18
- var ms = now - from;
19
-
20
- switch (true) {
21
- case MILISECONDS.IN_A_SECOND < ms && ms < MILISECONDS.IN_A_MINUTE:
22
- return {
23
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_SECOND),
24
- unit: 'second',
25
- updateIntervalInSeconds: 1
26
- };
27
-
28
- case MILISECONDS.IN_A_MINUTE < ms && ms < MILISECONDS.IN_AN_HOUR:
29
- return {
30
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_MINUTE),
31
- unit: 'minute'
32
- };
33
-
34
- case MILISECONDS.IN_AN_HOUR < ms && ms < MILISECONDS.IN_A_DAY:
35
- return {
36
- value: -1 * Math.floor(ms / MILISECONDS.IN_AN_HOUR),
37
- unit: 'hour'
38
- };
39
-
40
- case MILISECONDS.IN_A_DAY < ms && ms < MILISECONDS.IN_A_WEEK:
41
- return {
42
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_DAY),
43
- unit: 'day'
44
- };
45
-
46
- case MILISECONDS.IN_A_WEEK < ms && ms < MILISECONDS.IN_A_MONTH:
47
- return {
48
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_WEEK),
49
- unit: 'week'
50
- };
51
-
52
- case MILISECONDS.IN_A_MONTH < ms && ms < MILISECONDS.IN_A_YEAR:
53
- return {
54
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_MONTH),
55
- unit: 'month'
56
- };
57
-
58
- case MILISECONDS.IN_A_YEAR < ms:
59
- return {
60
- value: -1 * Math.floor(ms / MILISECONDS.IN_A_YEAR),
61
- unit: 'year'
62
- };
63
-
64
- default:
65
- return {
66
- value: 0
67
- };
68
- }
69
- };