tg-core-components 6.3.4-3.19 → 6.3.4-3.2

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.
@@ -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,
@@ -348,6 +349,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
348
349
  inputMode === 'input' && React.createElement(
349
350
  Fragment,
350
351
  null,
352
+ console.log(newLimit),
351
353
  React.createElement(Input, {
352
354
  type: 'number',
353
355
  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.amount : v.maxAmount : v;
13
+ return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
14
14
  });
15
15
  };
16
16
 
@@ -16,7 +16,6 @@ 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';
20
19
 
21
20
  var ResponsibleGaming = function ResponsibleGaming(_ref) {
22
21
  var limits = _ref.limits,
@@ -104,22 +103,24 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
104
103
  * Add a new limit with status "NewLimit"
105
104
  * There can only be one limit with status "NewLimit" for each type/timespan
106
105
  */
107
- var onChangeLimit = function onChangeLimit(type, product, maxAmounts) {
106
+ var onChangeLimit = function onChangeLimit(type, product) {
108
107
  return function (timespan) {
109
108
  return function (amount) {
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[type], currency, timespan)[0] : Infinity,
117
- Status: 'NewLimit'
109
+ return function (maxAmounts) {
110
+ console.log(maxAmounts);
111
+ var newLimit = {
112
+ Id: getByPath(normalizedLimits, '[' + type + '].timespans[' + timespan + '].currentLimit.Id'),
113
+ Type: type,
114
+ Product: product,
115
+ Timespan: timespan,
116
+ Amount: amount,
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]));
118
123
  };
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]));
123
124
  };
124
125
  };
125
126
  };
@@ -127,6 +128,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
127
128
  return React.createElement(
128
129
  'div',
129
130
  { className: cn('ResponsibleGamingWidget', className) },
131
+ console.log(normalizedLimits),
130
132
  React.createElement(
131
133
  AccordionWidget,
132
134
  {
@@ -141,8 +143,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
141
143
  tooltipOpen: normalizedLimits.tooltipOpen
142
144
  }),
143
145
  React.createElement(LimitContent, _extends({
144
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
145
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
146
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
147
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
146
148
  hideSubmit: hideSubmit,
147
149
  onConfirmLimit: onConfirmLimit,
148
150
  onDeclineLimit: onDeclineLimit,
@@ -180,6 +182,7 @@ var LimitContent = function LimitContent(_ref3) {
180
182
  getAlerts = _ref3.getAlerts,
181
183
  isLoading = _ref3.isLoading,
182
184
  currency = _ref3.currency,
185
+ maxAmounts = _ref3.maxAmounts,
183
186
  values = _ref3.values,
184
187
  valueType = _ref3.valueType,
185
188
  hideRemainingLimit = _ref3.hideRemainingLimit,
@@ -193,6 +196,8 @@ var LimitContent = function LimitContent(_ref3) {
193
196
 
194
197
  var alerts = getAlerts(Object.keys(timespans));
195
198
 
199
+ console.log(Object.values);
200
+
196
201
  var onSubmit = function onSubmit(e) {
197
202
  e.preventDefault();
198
203
  var limits = Object.values(timespans).filter(function (t) {
@@ -225,30 +230,36 @@ var LimitContent = function LimitContent(_ref3) {
225
230
  currency: currency
226
231
  }),
227
232
  Object.values(timespans).map(function (t) {
228
- return React.createElement(Timespan, _extends({
229
- key: t.timespan,
230
- title: Object.values(timespans).length > 1 && messages.get('header.responsible-gaming.timespan.' + t.timespan),
231
- onChangeLimit: onChangeLimit(t.timespan),
232
- onResetLimit: function onResetLimit() {
233
- return onSubmitLimits([t.currentLimit]);
234
- },
235
- onConfirmLimit: onConfirmLimit,
236
- onDeclineLimit: onDeclineLimit,
237
- onPickLimit: function onPickLimit(id) {
238
- return onSubmitLimits(t.pickLimits.filter(function (l) {
239
- return l.Id !== id;
240
- }).map(function (l) {
241
- return _extends({}, l, { Amount: 0 });
242
- }));
243
- },
244
- validationState: getValidationState(t.timespan),
245
- currency: currency,
246
- values: values,
247
- valueType: valueType,
248
- hideRemainingLimit: hideRemainingLimit,
249
- showCurrentValue: showCurrentValue,
250
- hideOther: hideOther
251
- }, t));
233
+ return React.createElement(
234
+ 'div',
235
+ null,
236
+ console.log(t),
237
+ React.createElement(Timespan, _extends({
238
+ key: t.timespan,
239
+ title: Object.values(timespans).length > 1 && messages.get('header.responsible-gaming.timespan.' + t.timespan),
240
+ onChangeLimit: onChangeLimit(t.timespan),
241
+ onResetLimit: function onResetLimit() {
242
+ return onSubmitLimits([t.currentLimit]);
243
+ },
244
+ onConfirmLimit: onConfirmLimit,
245
+ onDeclineLimit: onDeclineLimit,
246
+ onPickLimit: function onPickLimit(id) {
247
+ return onSubmitLimits(t.pickLimits.filter(function (l) {
248
+ return l.Id !== id;
249
+ }).map(function (l) {
250
+ return _extends({}, l, { Amount: 0 });
251
+ }));
252
+ },
253
+ validationState: getValidationState(t.timespan),
254
+ currency: currency,
255
+ maxAmounts: maxAmounts,
256
+ values: values,
257
+ valueType: valueType,
258
+ hideRemainingLimit: hideRemainingLimit,
259
+ showCurrentValue: showCurrentValue,
260
+ hideOther: hideOther
261
+ }, t))
262
+ );
252
263
  }),
253
264
  !hideSubmit && React.createElement(
254
265
  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) && !this['limit-above-maxlimit'];
53
+ return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit);
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,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,
@@ -379,6 +380,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
379
380
  inputMode === 'input' && _react2.default.createElement(
380
381
  _react.Fragment,
381
382
  null,
383
+ console.log(newLimit),
382
384
  _react2.default.createElement(_Input2.default, {
383
385
  type: 'number',
384
386
  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.amount : v.maxAmount : v;
24
+ return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
25
25
  });
26
26
  };
27
27
 
@@ -55,8 +55,6 @@ var _marked = require('marked');
55
55
 
56
56
  var _marked2 = _interopRequireDefault(_marked);
57
57
 
58
- var _helpers = require('./helpers');
59
-
60
58
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
59
 
62
60
  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); } }
@@ -147,22 +145,24 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
147
145
  * Add a new limit with status "NewLimit"
148
146
  * There can only be one limit with status "NewLimit" for each type/timespan
149
147
  */
150
- var onChangeLimit = function onChangeLimit(type, product, maxAmounts) {
148
+ var onChangeLimit = function onChangeLimit(type, product) {
151
149
  return function (timespan) {
152
150
  return function (amount) {
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[type], currency, timespan)[0] : Infinity,
160
- Status: 'NewLimit'
151
+ return function (maxAmounts) {
152
+ console.log(maxAmounts);
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
+ 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]));
161
165
  };
162
- var limits = localLimits.filter(function (l) {
163
- return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
164
- });
165
- setLocalLimits([].concat(_toConsumableArray(limits), [newLimit]));
166
166
  };
167
167
  };
168
168
  };
@@ -170,6 +170,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
170
170
  return _react2.default.createElement(
171
171
  'div',
172
172
  { className: (0, _classnames2.default)('ResponsibleGamingWidget', className) },
173
+ console.log(normalizedLimits),
173
174
  _react2.default.createElement(
174
175
  _AccordionWidget2.default,
175
176
  {
@@ -184,8 +185,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
184
185
  tooltipOpen: normalizedLimits.tooltipOpen
185
186
  }),
186
187
  _react2.default.createElement(LimitContent, _extends({
187
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
188
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
188
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
189
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
189
190
  hideSubmit: hideSubmit,
190
191
  onConfirmLimit: onConfirmLimit,
191
192
  onDeclineLimit: onDeclineLimit,
@@ -223,6 +224,7 @@ var LimitContent = function LimitContent(_ref3) {
223
224
  getAlerts = _ref3.getAlerts,
224
225
  isLoading = _ref3.isLoading,
225
226
  currency = _ref3.currency,
227
+ maxAmounts = _ref3.maxAmounts,
226
228
  values = _ref3.values,
227
229
  valueType = _ref3.valueType,
228
230
  hideRemainingLimit = _ref3.hideRemainingLimit,
@@ -236,6 +238,8 @@ var LimitContent = function LimitContent(_ref3) {
236
238
 
237
239
  var alerts = getAlerts(Object.keys(timespans));
238
240
 
241
+ console.log(Object.values);
242
+
239
243
  var onSubmit = function onSubmit(e) {
240
244
  e.preventDefault();
241
245
  var limits = Object.values(timespans).filter(function (t) {
@@ -268,30 +272,36 @@ var LimitContent = function LimitContent(_ref3) {
268
272
  currency: currency
269
273
  }),
270
274
  Object.values(timespans).map(function (t) {
271
- return _react2.default.createElement(_Timespan2.default, _extends({
272
- key: t.timespan,
273
- title: Object.values(timespans).length > 1 && _messages2.default.get('header.responsible-gaming.timespan.' + t.timespan),
274
- onChangeLimit: onChangeLimit(t.timespan),
275
- onResetLimit: function onResetLimit() {
276
- return onSubmitLimits([t.currentLimit]);
277
- },
278
- onConfirmLimit: onConfirmLimit,
279
- onDeclineLimit: onDeclineLimit,
280
- onPickLimit: function onPickLimit(id) {
281
- return onSubmitLimits(t.pickLimits.filter(function (l) {
282
- return l.Id !== id;
283
- }).map(function (l) {
284
- return _extends({}, l, { Amount: 0 });
285
- }));
286
- },
287
- validationState: getValidationState(t.timespan),
288
- currency: currency,
289
- values: values,
290
- valueType: valueType,
291
- hideRemainingLimit: hideRemainingLimit,
292
- showCurrentValue: showCurrentValue,
293
- hideOther: hideOther
294
- }, t));
275
+ return _react2.default.createElement(
276
+ 'div',
277
+ null,
278
+ console.log(t),
279
+ _react2.default.createElement(_Timespan2.default, _extends({
280
+ key: t.timespan,
281
+ title: Object.values(timespans).length > 1 && _messages2.default.get('header.responsible-gaming.timespan.' + t.timespan),
282
+ onChangeLimit: onChangeLimit(t.timespan),
283
+ onResetLimit: function onResetLimit() {
284
+ return onSubmitLimits([t.currentLimit]);
285
+ },
286
+ onConfirmLimit: onConfirmLimit,
287
+ onDeclineLimit: onDeclineLimit,
288
+ onPickLimit: function onPickLimit(id) {
289
+ return onSubmitLimits(t.pickLimits.filter(function (l) {
290
+ return l.Id !== id;
291
+ }).map(function (l) {
292
+ return _extends({}, l, { Amount: 0 });
293
+ }));
294
+ },
295
+ validationState: getValidationState(t.timespan),
296
+ currency: currency,
297
+ maxAmounts: maxAmounts,
298
+ values: values,
299
+ valueType: valueType,
300
+ hideRemainingLimit: hideRemainingLimit,
301
+ showCurrentValue: showCurrentValue,
302
+ hideOther: hideOther
303
+ }, t))
304
+ );
295
305
  }),
296
306
  !hideSubmit && _react2.default.createElement(
297
307
  _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) && !this['limit-above-maxlimit'];
63
+ return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.3.4-3.19",
3
+ "version": "6.3.4-3.2",
4
4
  "description": "tg-core-components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",