tg-core-components 6.1.3 → 6.1.4

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.
@@ -0,0 +1,64 @@
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
+ };
@@ -17,71 +17,7 @@ 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
-
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
- };
20
+ import { selectUnit } from '../../lib/utils/selectUnit';
85
21
 
86
22
  var HistoryWidgetList = function (_React$Component) {
87
23
  _inherits(HistoryWidgetList, _React$Component);
@@ -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';
23
22
  import { getKycType } from '../Verify/types';
24
23
  import { getKycReason } from '../Verify/reasons';
25
24
  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,
@@ -0,0 +1,69 @@
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
+ };
@@ -44,6 +44,8 @@ var _Translate2 = _interopRequireDefault(_Translate);
44
44
 
45
45
  var _message = require('./message');
46
46
 
47
+ var _selectUnit = require('../../lib/utils/selectUnit');
48
+
47
49
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
48
50
 
49
51
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -52,71 +54,6 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
52
54
 
53
55
  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; }
54
56
 
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
-
120
57
  var HistoryWidgetList = function (_React$Component) {
121
58
  _inherits(HistoryWidgetList, _React$Component);
122
59
 
@@ -155,7 +92,7 @@ var HistoryWidgetList = function (_React$Component) {
155
92
  'div',
156
93
  null,
157
94
  (0, _message.getMessage)((0, _get2.default)(item, 'Transactions[0].Status'))
158
- )], [_react2.default.createElement(_Money2.default, { value: item.Win - item.Bet, currency: currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.StartTime + '+00:00')))]];
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')))]];
159
96
  } else if (product === 'sportsbook') {
160
97
  var selection = item.Transactions[0].Description;
161
98
  var odds = item.Transactions[0].Odds;
@@ -171,7 +108,7 @@ var HistoryWidgetList = function (_React$Component) {
171
108
  'div',
172
109
  null,
173
110
  (0, _message.getMessage)(item.Settled ? 'settled' : 'pendling')
174
- )], [_react2.default.createElement(_Money2.default, { value: item.TotalWin - item.TotalWager, currency: currency }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
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')))]];
175
112
  } else if (product === 'bingo') {
176
113
  return [[_react2.default.createElement(_Translate2.default, {
177
114
  tag: 'div'
@@ -184,7 +121,7 @@ var HistoryWidgetList = function (_React$Component) {
184
121
  )], [_react2.default.createElement(_Money2.default, {
185
122
  value: (0, _get2.default)(item, 'Transactions[0].Amount'),
186
123
  currency: currency
187
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
124
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Created + '+00:00')))]];
188
125
  } else if (product === 'fantasy') {
189
126
  return [[_react2.default.createElement(
190
127
  'div',
@@ -199,7 +136,7 @@ var HistoryWidgetList = function (_React$Component) {
199
136
  )], [_react2.default.createElement(_Money2.default, {
200
137
  value: item.Win - (item.Bet + item.Rake),
201
138
  currency: currency
202
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Created + '+00:00')))]];
139
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Created + '+00:00')))]];
203
140
  }
204
141
 
205
142
  return [[_react2.default.createElement(
@@ -213,7 +150,7 @@ var HistoryWidgetList = function (_React$Component) {
213
150
  )], [_react2.default.createElement(_Money2.default, {
214
151
  value: item.TransactionType === 'Withdraw' ? -item.Amount : item.Amount,
215
152
  currency: currency
216
- }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, selectUnit(new Date(item.Started + '+00:00')))]];
153
+ }), _react2.default.createElement(_reactIntl.FormattedRelativeTime, (0, _selectUnit.selectUnit)(new Date(item.Started + '+00:00')))]];
217
154
  }, _this.createListDetail = function (item, product, currency) {
218
155
  if (product === 'casino') {
219
156
  return [[_react2.default.createElement(
@@ -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
-
49
47
  var _types = require('../Verify/types');
50
48
 
51
49
  var _reasons = require('../Verify/reasons');
52
50
 
53
51
  var _status = require('../Verify/status');
54
52
 
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, _intlUtils.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, _selectUnit.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.3",
3
+ "version": "6.1.4",
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": "359297fba3cc9fae7c24eccf36eeab528da8bb8e"
79
+ "gitHead": "00f5600421bf93372fa02d7dcd12cf8efa6b6f62"
80
80
  }