tg-core-components 6.3.4-3.1 → 6.3.4-3.11
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/widgets/ResponsibleGamingWidget/Timespan.js +7 -1
- package/es/widgets/ResponsibleGamingWidget/helpers.js +2 -0
- package/es/widgets/ResponsibleGamingWidget/index.js +8 -4
- package/lib/widgets/ResponsibleGamingWidget/Timespan.js +7 -1
- package/lib/widgets/ResponsibleGamingWidget/helpers.js +2 -0
- package/lib/widgets/ResponsibleGamingWidget/index.js +9 -4
- package/package.json +1 -1
|
@@ -242,6 +242,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
242
242
|
hideRemainingLimit = _ref10.hideRemainingLimit,
|
|
243
243
|
showCurrentValue = _ref10.showCurrentValue,
|
|
244
244
|
hideOther = _ref10.hideOther,
|
|
245
|
+
maxAmounts = _ref10.maxAmounts,
|
|
245
246
|
values = _ref10.values,
|
|
246
247
|
messages = _ref10.messages,
|
|
247
248
|
isTime = _ref10.isTime,
|
|
@@ -254,7 +255,13 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
254
255
|
|
|
255
256
|
useEffect(function () {
|
|
256
257
|
if (newLimit) {
|
|
258
|
+
var _console, _console2;
|
|
259
|
+
|
|
257
260
|
setValue(newLimit.Amount);
|
|
261
|
+
(_console = console).log.apply(_console, _toConsumableArray(getValues(maxAmounts, currency, timespan)));
|
|
262
|
+
(_console2 = console).log.apply(_console2, _toConsumableArray(getValues(newLimit.MaxAmount, currency, timespan)));
|
|
263
|
+
console.log(maxAmounts);
|
|
264
|
+
console.log(values);
|
|
258
265
|
}
|
|
259
266
|
}, [newLimit]);
|
|
260
267
|
|
|
@@ -348,7 +355,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
348
355
|
inputMode === 'input' && React.createElement(
|
|
349
356
|
Fragment,
|
|
350
357
|
null,
|
|
351
|
-
console.log(newLimit),
|
|
352
358
|
React.createElement(Input, {
|
|
353
359
|
type: 'number',
|
|
354
360
|
pattern: '\\d*',
|
|
@@ -6,7 +6,9 @@ import getByPath from 'lodash/get';
|
|
|
6
6
|
* Helper function to get values using currency and timespan
|
|
7
7
|
*/
|
|
8
8
|
export var getValues = function getValues(values, currency, timespan) {
|
|
9
|
+
console.log('values', values, currency, timespan);
|
|
9
10
|
values = getByPath(values, '[' + (currency || '').toUpperCase() + ']') || values;
|
|
11
|
+
console.log(values);
|
|
10
12
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
11
13
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
12
14
|
}).map(function (v) {
|
|
@@ -16,6 +16,7 @@ import messages from './messages';
|
|
|
16
16
|
import Timespan from './Timespan';
|
|
17
17
|
import getByPath from 'lodash/get';
|
|
18
18
|
import marked from 'marked';
|
|
19
|
+
import { getValues } from './helpers';
|
|
19
20
|
|
|
20
21
|
var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
21
22
|
var limits = _ref.limits,
|
|
@@ -103,7 +104,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
103
104
|
* Add a new limit with status "NewLimit"
|
|
104
105
|
* There can only be one limit with status "NewLimit" for each type/timespan
|
|
105
106
|
*/
|
|
106
|
-
var onChangeLimit = function onChangeLimit(type, product) {
|
|
107
|
+
var onChangeLimit = function onChangeLimit(type, product, maxAmounts) {
|
|
107
108
|
return function (timespan) {
|
|
108
109
|
return function (amount) {
|
|
109
110
|
var newLimit = {
|
|
@@ -112,6 +113,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
112
113
|
Product: product,
|
|
113
114
|
Timespan: timespan,
|
|
114
115
|
Amount: amount,
|
|
116
|
+
MaxAmount: getValues(maxAmounts, currency, timespan),
|
|
115
117
|
Status: 'NewLimit'
|
|
116
118
|
};
|
|
117
119
|
var limits = localLimits.filter(function (l) {
|
|
@@ -122,10 +124,11 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
122
124
|
};
|
|
123
125
|
};
|
|
124
126
|
|
|
127
|
+
console.log(normalizedLimits);
|
|
128
|
+
|
|
125
129
|
return React.createElement(
|
|
126
130
|
'div',
|
|
127
131
|
{ className: cn('ResponsibleGamingWidget', className) },
|
|
128
|
-
console.log(normalizedLimits),
|
|
129
132
|
React.createElement(
|
|
130
133
|
AccordionWidget,
|
|
131
134
|
{
|
|
@@ -140,8 +143,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
140
143
|
tooltipOpen: normalizedLimits.tooltipOpen
|
|
141
144
|
}),
|
|
142
145
|
React.createElement(LimitContent, _extends({
|
|
143
|
-
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
|
|
144
|
-
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
|
|
146
|
+
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
147
|
+
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
145
148
|
hideSubmit: hideSubmit,
|
|
146
149
|
onConfirmLimit: onConfirmLimit,
|
|
147
150
|
onDeclineLimit: onDeclineLimit,
|
|
@@ -249,6 +252,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
249
252
|
},
|
|
250
253
|
validationState: getValidationState(t.timespan),
|
|
251
254
|
currency: currency,
|
|
255
|
+
maxAmounts: maxAmounts,
|
|
252
256
|
values: values,
|
|
253
257
|
valueType: valueType,
|
|
254
258
|
hideRemainingLimit: hideRemainingLimit,
|
|
@@ -273,6 +273,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
273
273
|
hideRemainingLimit = _ref10.hideRemainingLimit,
|
|
274
274
|
showCurrentValue = _ref10.showCurrentValue,
|
|
275
275
|
hideOther = _ref10.hideOther,
|
|
276
|
+
maxAmounts = _ref10.maxAmounts,
|
|
276
277
|
values = _ref10.values,
|
|
277
278
|
messages = _ref10.messages,
|
|
278
279
|
isTime = _ref10.isTime,
|
|
@@ -285,7 +286,13 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
285
286
|
|
|
286
287
|
(0, _react.useEffect)(function () {
|
|
287
288
|
if (newLimit) {
|
|
289
|
+
var _console, _console2;
|
|
290
|
+
|
|
288
291
|
setValue(newLimit.Amount);
|
|
292
|
+
(_console = console).log.apply(_console, _toConsumableArray((0, _helpers.getValues)(maxAmounts, currency, timespan)));
|
|
293
|
+
(_console2 = console).log.apply(_console2, _toConsumableArray((0, _helpers.getValues)(newLimit.MaxAmount, currency, timespan)));
|
|
294
|
+
console.log(maxAmounts);
|
|
295
|
+
console.log(values);
|
|
289
296
|
}
|
|
290
297
|
}, [newLimit]);
|
|
291
298
|
|
|
@@ -379,7 +386,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
379
386
|
inputMode === 'input' && _react2.default.createElement(
|
|
380
387
|
_react.Fragment,
|
|
381
388
|
null,
|
|
382
|
-
console.log(newLimit),
|
|
383
389
|
_react2.default.createElement(_Input2.default, {
|
|
384
390
|
type: 'number',
|
|
385
391
|
pattern: '\\d*',
|
|
@@ -17,7 +17,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* Helper function to get values using currency and timespan
|
|
18
18
|
*/
|
|
19
19
|
var getValues = exports.getValues = function getValues(values, currency, timespan) {
|
|
20
|
+
console.log('values', values, currency, timespan);
|
|
20
21
|
values = (0, _get2.default)(values, '[' + (currency || '').toUpperCase() + ']') || values;
|
|
22
|
+
console.log(values);
|
|
21
23
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
22
24
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
23
25
|
}).map(function (v) {
|
|
@@ -55,6 +55,8 @@ var _marked = require('marked');
|
|
|
55
55
|
|
|
56
56
|
var _marked2 = _interopRequireDefault(_marked);
|
|
57
57
|
|
|
58
|
+
var _helpers = require('./helpers');
|
|
59
|
+
|
|
58
60
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
61
|
|
|
60
62
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
@@ -145,7 +147,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
145
147
|
* Add a new limit with status "NewLimit"
|
|
146
148
|
* There can only be one limit with status "NewLimit" for each type/timespan
|
|
147
149
|
*/
|
|
148
|
-
var onChangeLimit = function onChangeLimit(type, product) {
|
|
150
|
+
var onChangeLimit = function onChangeLimit(type, product, maxAmounts) {
|
|
149
151
|
return function (timespan) {
|
|
150
152
|
return function (amount) {
|
|
151
153
|
var newLimit = {
|
|
@@ -154,6 +156,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
154
156
|
Product: product,
|
|
155
157
|
Timespan: timespan,
|
|
156
158
|
Amount: amount,
|
|
159
|
+
MaxAmount: (0, _helpers.getValues)(maxAmounts, currency, timespan),
|
|
157
160
|
Status: 'NewLimit'
|
|
158
161
|
};
|
|
159
162
|
var limits = localLimits.filter(function (l) {
|
|
@@ -164,10 +167,11 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
164
167
|
};
|
|
165
168
|
};
|
|
166
169
|
|
|
170
|
+
console.log(normalizedLimits);
|
|
171
|
+
|
|
167
172
|
return _react2.default.createElement(
|
|
168
173
|
'div',
|
|
169
174
|
{ className: (0, _classnames2.default)('ResponsibleGamingWidget', className) },
|
|
170
|
-
console.log(normalizedLimits),
|
|
171
175
|
_react2.default.createElement(
|
|
172
176
|
_AccordionWidget2.default,
|
|
173
177
|
{
|
|
@@ -182,8 +186,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
182
186
|
tooltipOpen: normalizedLimits.tooltipOpen
|
|
183
187
|
}),
|
|
184
188
|
_react2.default.createElement(LimitContent, _extends({
|
|
185
|
-
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
|
|
186
|
-
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
|
|
189
|
+
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
190
|
+
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
187
191
|
hideSubmit: hideSubmit,
|
|
188
192
|
onConfirmLimit: onConfirmLimit,
|
|
189
193
|
onDeclineLimit: onDeclineLimit,
|
|
@@ -291,6 +295,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
291
295
|
},
|
|
292
296
|
validationState: getValidationState(t.timespan),
|
|
293
297
|
currency: currency,
|
|
298
|
+
maxAmounts: maxAmounts,
|
|
294
299
|
values: values,
|
|
295
300
|
valueType: valueType,
|
|
296
301
|
hideRemainingLimit: hideRemainingLimit,
|