tg-core-components 6.3.4-3.2 → 6.3.4-3.21
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 +0 -2
- package/es/widgets/ResponsibleGamingWidget/helpers.js +1 -1
- package/es/widgets/ResponsibleGamingWidget/index.js +41 -50
- package/es/widgets/ResponsibleGamingWidget/validate.js +1 -1
- package/lib/widgets/ResponsibleGamingWidget/Timespan.js +0 -2
- package/lib/widgets/ResponsibleGamingWidget/helpers.js +1 -1
- package/lib/widgets/ResponsibleGamingWidget/index.js +42 -50
- package/lib/widgets/ResponsibleGamingWidget/validate.js +1 -1
- package/package.json +1 -1
|
@@ -242,7 +242,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
242
242
|
hideRemainingLimit = _ref10.hideRemainingLimit,
|
|
243
243
|
showCurrentValue = _ref10.showCurrentValue,
|
|
244
244
|
hideOther = _ref10.hideOther,
|
|
245
|
-
maxAmounts = _ref10.maxAmounts,
|
|
246
245
|
values = _ref10.values,
|
|
247
246
|
messages = _ref10.messages,
|
|
248
247
|
isTime = _ref10.isTime,
|
|
@@ -349,7 +348,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
349
348
|
inputMode === 'input' && React.createElement(
|
|
350
349
|
Fragment,
|
|
351
350
|
null,
|
|
352
|
-
console.log(newLimit),
|
|
353
351
|
React.createElement(Input, {
|
|
354
352
|
type: 'number',
|
|
355
353
|
pattern: '\\d*',
|
|
@@ -10,7 +10,7 @@ export var getValues = function getValues(values, currency, timespan) {
|
|
|
10
10
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
11
11
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
12
12
|
}).map(function (v) {
|
|
13
|
-
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
|
|
13
|
+
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount ? v.amount : v.maxAmount : v;
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -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,24 +104,23 @@ 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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Status: 'NewLimit'
|
|
118
|
-
};
|
|
119
|
-
var limits = localLimits.filter(function (l) {
|
|
120
|
-
return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
|
|
121
|
-
});
|
|
122
|
-
setLocalLimits([].concat(_toConsumableArray(limits), [newLimit]));
|
|
110
|
+
var newLimit = {
|
|
111
|
+
Id: getByPath(normalizedLimits, '[' + type + '].timespans[' + timespan + '].currentLimit.Id'),
|
|
112
|
+
Type: type,
|
|
113
|
+
Product: product,
|
|
114
|
+
Timespan: timespan,
|
|
115
|
+
Amount: amount,
|
|
116
|
+
MaxAmount: maxAmounts ? getValues(maxAmounts, currency, timespan)[0] : Infinity,
|
|
117
|
+
Status: 'NewLimit'
|
|
123
118
|
};
|
|
119
|
+
console.log(type);
|
|
120
|
+
var limits = localLimits.filter(function (l) {
|
|
121
|
+
return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
|
|
122
|
+
});
|
|
123
|
+
setLocalLimits([].concat(_toConsumableArray(limits), [newLimit]));
|
|
124
124
|
};
|
|
125
125
|
};
|
|
126
126
|
};
|
|
@@ -143,8 +143,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
143
143
|
tooltipOpen: normalizedLimits.tooltipOpen
|
|
144
144
|
}),
|
|
145
145
|
React.createElement(LimitContent, _extends({
|
|
146
|
-
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
|
|
147
|
-
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
|
|
146
|
+
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
147
|
+
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
148
148
|
hideSubmit: hideSubmit,
|
|
149
149
|
onConfirmLimit: onConfirmLimit,
|
|
150
150
|
onDeclineLimit: onDeclineLimit,
|
|
@@ -182,7 +182,6 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
182
182
|
getAlerts = _ref3.getAlerts,
|
|
183
183
|
isLoading = _ref3.isLoading,
|
|
184
184
|
currency = _ref3.currency,
|
|
185
|
-
maxAmounts = _ref3.maxAmounts,
|
|
186
185
|
values = _ref3.values,
|
|
187
186
|
valueType = _ref3.valueType,
|
|
188
187
|
hideRemainingLimit = _ref3.hideRemainingLimit,
|
|
@@ -196,8 +195,6 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
196
195
|
|
|
197
196
|
var alerts = getAlerts(Object.keys(timespans));
|
|
198
197
|
|
|
199
|
-
console.log(Object.values);
|
|
200
|
-
|
|
201
198
|
var onSubmit = function onSubmit(e) {
|
|
202
199
|
e.preventDefault();
|
|
203
200
|
var limits = Object.values(timespans).filter(function (t) {
|
|
@@ -230,36 +227,30 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
230
227
|
currency: currency
|
|
231
228
|
}),
|
|
232
229
|
Object.values(timespans).map(function (t) {
|
|
233
|
-
return React.createElement(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
valueType: valueType,
|
|
258
|
-
hideRemainingLimit: hideRemainingLimit,
|
|
259
|
-
showCurrentValue: showCurrentValue,
|
|
260
|
-
hideOther: hideOther
|
|
261
|
-
}, t))
|
|
262
|
-
);
|
|
230
|
+
return React.createElement(Timespan, _extends({
|
|
231
|
+
key: t.timespan,
|
|
232
|
+
title: Object.values(timespans).length > 1 && messages.get('header.responsible-gaming.timespan.' + t.timespan),
|
|
233
|
+
onChangeLimit: onChangeLimit(t.timespan),
|
|
234
|
+
onResetLimit: function onResetLimit() {
|
|
235
|
+
return onSubmitLimits([t.currentLimit]);
|
|
236
|
+
},
|
|
237
|
+
onConfirmLimit: onConfirmLimit,
|
|
238
|
+
onDeclineLimit: onDeclineLimit,
|
|
239
|
+
onPickLimit: function onPickLimit(id) {
|
|
240
|
+
return onSubmitLimits(t.pickLimits.filter(function (l) {
|
|
241
|
+
return l.Id !== id;
|
|
242
|
+
}).map(function (l) {
|
|
243
|
+
return _extends({}, l, { Amount: 0 });
|
|
244
|
+
}));
|
|
245
|
+
},
|
|
246
|
+
validationState: getValidationState(t.timespan),
|
|
247
|
+
currency: currency,
|
|
248
|
+
values: values,
|
|
249
|
+
valueType: valueType,
|
|
250
|
+
hideRemainingLimit: hideRemainingLimit,
|
|
251
|
+
showCurrentValue: showCurrentValue,
|
|
252
|
+
hideOther: hideOther
|
|
253
|
+
}, t));
|
|
263
254
|
}),
|
|
264
255
|
!hideSubmit && React.createElement(
|
|
265
256
|
Button,
|
|
@@ -50,7 +50,7 @@ var validate = function validate(_ref) {
|
|
|
50
50
|
* Compose jurisdictions with rules
|
|
51
51
|
*/
|
|
52
52
|
var common = (_common = {}, _defineProperty(_common, 'show-confirm-on-submit', type === 'Block' || type === 'SelfExclude'), _defineProperty(_common, 'insufficient-limit-count', false), _defineProperty(_common, 'limits-are-pristine', limitsArePristine), _defineProperty(_common, 'limit-increase-blocked', false), _defineProperty(_common, 'limit-remove-blocked', false), _defineProperty(_common, 'limit-above-maxlimit', exceedingMaxLimitAmount), _defineProperty(_common, 'isValid', function isValid() {
|
|
53
|
-
return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit);
|
|
53
|
+
return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit) && !this['limit-above-maxlimit'];
|
|
54
54
|
}), _common);
|
|
55
55
|
var mga = {};
|
|
56
56
|
var sga = (_sga = {}, _defineProperty(_sga, 'insufficient-limit-count', type === 'Deposit' && limitCount < 3), _defineProperty(_sga, 'limit-remove-blocked', type === 'Deposit'), _defineProperty(_sga, 'monthly-deposit-above-10k', getByPath(newMonthlyDepositLimit, 'newLimit.Amount') >= 10000), _sga);
|
|
@@ -273,7 +273,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
273
273
|
hideRemainingLimit = _ref10.hideRemainingLimit,
|
|
274
274
|
showCurrentValue = _ref10.showCurrentValue,
|
|
275
275
|
hideOther = _ref10.hideOther,
|
|
276
|
-
maxAmounts = _ref10.maxAmounts,
|
|
277
276
|
values = _ref10.values,
|
|
278
277
|
messages = _ref10.messages,
|
|
279
278
|
isTime = _ref10.isTime,
|
|
@@ -380,7 +379,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
|
|
|
380
379
|
inputMode === 'input' && _react2.default.createElement(
|
|
381
380
|
_react.Fragment,
|
|
382
381
|
null,
|
|
383
|
-
console.log(newLimit),
|
|
384
382
|
_react2.default.createElement(_Input2.default, {
|
|
385
383
|
type: 'number',
|
|
386
384
|
pattern: '\\d*',
|
|
@@ -21,7 +21,7 @@ var getValues = exports.getValues = function getValues(values, currency, timespa
|
|
|
21
21
|
return (Array.isArray(values) ? values : []).filter(function (v) {
|
|
22
22
|
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
|
|
23
23
|
}).map(function (v) {
|
|
24
|
-
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
|
|
24
|
+
return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount ? v.amount : v.maxAmount : v;
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -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,24 +147,23 @@ 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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
Status: 'NewLimit'
|
|
160
|
-
};
|
|
161
|
-
var limits = localLimits.filter(function (l) {
|
|
162
|
-
return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
|
|
163
|
-
});
|
|
164
|
-
setLocalLimits([].concat(_toConsumableArray(limits), [newLimit]));
|
|
153
|
+
var newLimit = {
|
|
154
|
+
Id: (0, _get2.default)(normalizedLimits, '[' + type + '].timespans[' + timespan + '].currentLimit.Id'),
|
|
155
|
+
Type: type,
|
|
156
|
+
Product: product,
|
|
157
|
+
Timespan: timespan,
|
|
158
|
+
Amount: amount,
|
|
159
|
+
MaxAmount: maxAmounts ? (0, _helpers.getValues)(maxAmounts, currency, timespan)[0] : Infinity,
|
|
160
|
+
Status: 'NewLimit'
|
|
165
161
|
};
|
|
162
|
+
console.log(type);
|
|
163
|
+
var limits = localLimits.filter(function (l) {
|
|
164
|
+
return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
|
|
165
|
+
});
|
|
166
|
+
setLocalLimits([].concat(_toConsumableArray(limits), [newLimit]));
|
|
166
167
|
};
|
|
167
168
|
};
|
|
168
169
|
};
|
|
@@ -185,8 +186,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
|
|
|
185
186
|
tooltipOpen: normalizedLimits.tooltipOpen
|
|
186
187
|
}),
|
|
187
188
|
_react2.default.createElement(LimitContent, _extends({
|
|
188
|
-
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
|
|
189
|
-
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
|
|
189
|
+
onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
190
|
+
onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
|
|
190
191
|
hideSubmit: hideSubmit,
|
|
191
192
|
onConfirmLimit: onConfirmLimit,
|
|
192
193
|
onDeclineLimit: onDeclineLimit,
|
|
@@ -224,7 +225,6 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
224
225
|
getAlerts = _ref3.getAlerts,
|
|
225
226
|
isLoading = _ref3.isLoading,
|
|
226
227
|
currency = _ref3.currency,
|
|
227
|
-
maxAmounts = _ref3.maxAmounts,
|
|
228
228
|
values = _ref3.values,
|
|
229
229
|
valueType = _ref3.valueType,
|
|
230
230
|
hideRemainingLimit = _ref3.hideRemainingLimit,
|
|
@@ -238,8 +238,6 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
238
238
|
|
|
239
239
|
var alerts = getAlerts(Object.keys(timespans));
|
|
240
240
|
|
|
241
|
-
console.log(Object.values);
|
|
242
|
-
|
|
243
241
|
var onSubmit = function onSubmit(e) {
|
|
244
242
|
e.preventDefault();
|
|
245
243
|
var limits = Object.values(timespans).filter(function (t) {
|
|
@@ -272,36 +270,30 @@ var LimitContent = function LimitContent(_ref3) {
|
|
|
272
270
|
currency: currency
|
|
273
271
|
}),
|
|
274
272
|
Object.values(timespans).map(function (t) {
|
|
275
|
-
return _react2.default.createElement(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
valueType: valueType,
|
|
300
|
-
hideRemainingLimit: hideRemainingLimit,
|
|
301
|
-
showCurrentValue: showCurrentValue,
|
|
302
|
-
hideOther: hideOther
|
|
303
|
-
}, t))
|
|
304
|
-
);
|
|
273
|
+
return _react2.default.createElement(_Timespan2.default, _extends({
|
|
274
|
+
key: t.timespan,
|
|
275
|
+
title: Object.values(timespans).length > 1 && _messages2.default.get('header.responsible-gaming.timespan.' + t.timespan),
|
|
276
|
+
onChangeLimit: onChangeLimit(t.timespan),
|
|
277
|
+
onResetLimit: function onResetLimit() {
|
|
278
|
+
return onSubmitLimits([t.currentLimit]);
|
|
279
|
+
},
|
|
280
|
+
onConfirmLimit: onConfirmLimit,
|
|
281
|
+
onDeclineLimit: onDeclineLimit,
|
|
282
|
+
onPickLimit: function onPickLimit(id) {
|
|
283
|
+
return onSubmitLimits(t.pickLimits.filter(function (l) {
|
|
284
|
+
return l.Id !== id;
|
|
285
|
+
}).map(function (l) {
|
|
286
|
+
return _extends({}, l, { Amount: 0 });
|
|
287
|
+
}));
|
|
288
|
+
},
|
|
289
|
+
validationState: getValidationState(t.timespan),
|
|
290
|
+
currency: currency,
|
|
291
|
+
values: values,
|
|
292
|
+
valueType: valueType,
|
|
293
|
+
hideRemainingLimit: hideRemainingLimit,
|
|
294
|
+
showCurrentValue: showCurrentValue,
|
|
295
|
+
hideOther: hideOther
|
|
296
|
+
}, t));
|
|
305
297
|
}),
|
|
306
298
|
!hideSubmit && _react2.default.createElement(
|
|
307
299
|
_Button2.default,
|
|
@@ -60,7 +60,7 @@ var validate = function validate(_ref) {
|
|
|
60
60
|
* Compose jurisdictions with rules
|
|
61
61
|
*/
|
|
62
62
|
var common = (_common = {}, _defineProperty(_common, 'show-confirm-on-submit', type === 'Block' || type === 'SelfExclude'), _defineProperty(_common, 'insufficient-limit-count', false), _defineProperty(_common, 'limits-are-pristine', limitsArePristine), _defineProperty(_common, 'limit-increase-blocked', false), _defineProperty(_common, 'limit-remove-blocked', false), _defineProperty(_common, 'limit-above-maxlimit', exceedingMaxLimitAmount), _defineProperty(_common, 'isValid', function isValid() {
|
|
63
|
-
return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit);
|
|
63
|
+
return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit) && !this['limit-above-maxlimit'];
|
|
64
64
|
}), _common);
|
|
65
65
|
var mga = {};
|
|
66
66
|
var sga = (_sga = {}, _defineProperty(_sga, 'insufficient-limit-count', type === 'Deposit' && limitCount < 3), _defineProperty(_sga, 'limit-remove-blocked', type === 'Deposit'), _defineProperty(_sga, 'monthly-deposit-above-10k', (0, _get2.default)(newMonthlyDepositLimit, 'newLimit.Amount') >= 10000), _sga);
|