tg-core-components 6.3.4-2.8 → 6.3.4-3.10
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 +1 -0
- package/es/widgets/ResponsibleGamingWidget/index.js +11 -4
- package/lib/widgets/ResponsibleGamingWidget/Timespan.js +7 -1
- package/lib/widgets/ResponsibleGamingWidget/helpers.js +1 -0
- package/lib/widgets/ResponsibleGamingWidget/index.js +12 -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,6 +6,7 @@ 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;
|
|
10
11
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
11
12
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
@@ -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,
|
|
@@ -179,6 +182,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
179
182
|
getAlerts = _ref3.getAlerts,
|
|
180
183
|
isLoading = _ref3.isLoading,
|
|
181
184
|
currency = _ref3.currency,
|
|
185
|
+
maxAmounts = _ref3.maxAmounts,
|
|
182
186
|
values = _ref3.values,
|
|
183
187
|
valueType = _ref3.valueType,
|
|
184
188
|
hideRemainingLimit = _ref3.hideRemainingLimit,
|
|
@@ -192,6 +196,8 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
192
196
|
|
|
193
197
|
var alerts = getAlerts(Object.keys(timespans));
|
|
194
198
|
|
|
199
|
+
console.log(Object.values);
|
|
200
|
+
|
|
195
201
|
var onSubmit = function onSubmit(e) {
|
|
196
202
|
e.preventDefault();
|
|
197
203
|
var limits = Object.values(timespans).filter(function (t) {
|
|
@@ -246,6 +252,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
246
252
|
},
|
|
247
253
|
validationState: getValidationState(t.timespan),
|
|
248
254
|
currency: currency,
|
|
255
|
+
maxAmounts: maxAmounts,
|
|
249
256
|
values: values,
|
|
250
257
|
valueType: valueType,
|
|
251
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,6 +17,7 @@ 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;
|
|
21
22
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
22
23
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
@@ -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,
|
|
@@ -221,6 +225,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
221
225
|
getAlerts = _ref3.getAlerts,
|
|
222
226
|
isLoading = _ref3.isLoading,
|
|
223
227
|
currency = _ref3.currency,
|
|
228
|
+
maxAmounts = _ref3.maxAmounts,
|
|
224
229
|
values = _ref3.values,
|
|
225
230
|
valueType = _ref3.valueType,
|
|
226
231
|
hideRemainingLimit = _ref3.hideRemainingLimit,
|
|
@@ -234,6 +239,8 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
234
239
|
|
|
235
240
|
var alerts = getAlerts(Object.keys(timespans));
|
|
236
241
|
|
|
242
|
+
console.log(Object.values);
|
|
243
|
+
|
|
237
244
|
var onSubmit = function onSubmit(e) {
|
|
238
245
|
e.preventDefault();
|
|
239
246
|
var limits = Object.values(timespans).filter(function (t) {
|
|
@@ -288,6 +295,7 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
288
295
|
},
|
|
289
296
|
validationState: getValidationState(t.timespan),
|
|
290
297
|
currency: currency,
|
|
298
|
+
maxAmounts: maxAmounts,
|
|
291
299
|
values: values,
|
|
292
300
|
valueType: valueType,
|
|
293
301
|
hideRemainingLimit: hideRemainingLimit,
|