tg-core-components 6.3.4-3.24 → 6.3.4-3.3

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,7 +103,7 @@ 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
109
  var newLimit = {
@@ -113,7 +112,6 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
113
112
  Product: product,
114
113
  Timespan: timespan,
115
114
  Amount: amount,
116
- MaxAmount: maxAmounts && maxAmounts[currency] ? getValues(maxAmounts, currency, timespan)[0] : Infinity,
117
115
  Status: 'NewLimit'
118
116
  };
119
117
  var limits = localLimits.filter(function (l) {
@@ -124,6 +122,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
124
122
  };
125
123
  };
126
124
 
125
+ console.log(normalizedLimits);
126
+
127
127
  return React.createElement(
128
128
  'div',
129
129
  { className: cn('ResponsibleGamingWidget', className) },
@@ -141,8 +141,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
141
141
  tooltipOpen: normalizedLimits.tooltipOpen
142
142
  }),
143
143
  React.createElement(LimitContent, _extends({
144
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
145
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
144
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
145
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
146
146
  hideSubmit: hideSubmit,
147
147
  onConfirmLimit: onConfirmLimit,
148
148
  onDeclineLimit: onDeclineLimit,
@@ -180,6 +180,7 @@ var LimitContent = function LimitContent(_ref3) {
180
180
  getAlerts = _ref3.getAlerts,
181
181
  isLoading = _ref3.isLoading,
182
182
  currency = _ref3.currency,
183
+ maxAmounts = _ref3.maxAmounts,
183
184
  values = _ref3.values,
184
185
  valueType = _ref3.valueType,
185
186
  hideRemainingLimit = _ref3.hideRemainingLimit,
@@ -193,6 +194,8 @@ var LimitContent = function LimitContent(_ref3) {
193
194
 
194
195
  var alerts = getAlerts(Object.keys(timespans));
195
196
 
197
+ console.log(Object.values);
198
+
196
199
  var onSubmit = function onSubmit(e) {
197
200
  e.preventDefault();
198
201
  var limits = Object.values(timespans).filter(function (t) {
@@ -225,30 +228,36 @@ var LimitContent = function LimitContent(_ref3) {
225
228
  currency: currency
226
229
  }),
227
230
  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));
231
+ return React.createElement(
232
+ 'div',
233
+ null,
234
+ console.log(t),
235
+ React.createElement(Timespan, _extends({
236
+ key: t.timespan,
237
+ title: Object.values(timespans).length > 1 && messages.get('header.responsible-gaming.timespan.' + t.timespan),
238
+ onChangeLimit: onChangeLimit(t.timespan),
239
+ onResetLimit: function onResetLimit() {
240
+ return onSubmitLimits([t.currentLimit]);
241
+ },
242
+ onConfirmLimit: onConfirmLimit,
243
+ onDeclineLimit: onDeclineLimit,
244
+ onPickLimit: function onPickLimit(id) {
245
+ return onSubmitLimits(t.pickLimits.filter(function (l) {
246
+ return l.Id !== id;
247
+ }).map(function (l) {
248
+ return _extends({}, l, { Amount: 0 });
249
+ }));
250
+ },
251
+ validationState: getValidationState(t.timespan),
252
+ currency: currency,
253
+ maxAmounts: maxAmounts,
254
+ values: values,
255
+ valueType: valueType,
256
+ hideRemainingLimit: hideRemainingLimit,
257
+ showCurrentValue: showCurrentValue,
258
+ hideOther: hideOther
259
+ }, t))
260
+ );
252
261
  }),
253
262
  !hideSubmit && React.createElement(
254
263
  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,7 +145,7 @@ 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
151
  var newLimit = {
@@ -156,7 +154,6 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
156
154
  Product: product,
157
155
  Timespan: timespan,
158
156
  Amount: amount,
159
- MaxAmount: maxAmounts && maxAmounts[currency] ? (0, _helpers.getValues)(maxAmounts, currency, timespan)[0] : Infinity,
160
157
  Status: 'NewLimit'
161
158
  };
162
159
  var limits = localLimits.filter(function (l) {
@@ -167,6 +164,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
167
164
  };
168
165
  };
169
166
 
167
+ console.log(normalizedLimits);
168
+
170
169
  return _react2.default.createElement(
171
170
  'div',
172
171
  { className: (0, _classnames2.default)('ResponsibleGamingWidget', className) },
@@ -184,8 +183,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
184
183
  tooltipOpen: normalizedLimits.tooltipOpen
185
184
  }),
186
185
  _react2.default.createElement(LimitContent, _extends({
187
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
188
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
186
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
187
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
189
188
  hideSubmit: hideSubmit,
190
189
  onConfirmLimit: onConfirmLimit,
191
190
  onDeclineLimit: onDeclineLimit,
@@ -223,6 +222,7 @@ var LimitContent = function LimitContent(_ref3) {
223
222
  getAlerts = _ref3.getAlerts,
224
223
  isLoading = _ref3.isLoading,
225
224
  currency = _ref3.currency,
225
+ maxAmounts = _ref3.maxAmounts,
226
226
  values = _ref3.values,
227
227
  valueType = _ref3.valueType,
228
228
  hideRemainingLimit = _ref3.hideRemainingLimit,
@@ -236,6 +236,8 @@ var LimitContent = function LimitContent(_ref3) {
236
236
 
237
237
  var alerts = getAlerts(Object.keys(timespans));
238
238
 
239
+ console.log(Object.values);
240
+
239
241
  var onSubmit = function onSubmit(e) {
240
242
  e.preventDefault();
241
243
  var limits = Object.values(timespans).filter(function (t) {
@@ -268,30 +270,36 @@ var LimitContent = function LimitContent(_ref3) {
268
270
  currency: currency
269
271
  }),
270
272
  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));
273
+ return _react2.default.createElement(
274
+ 'div',
275
+ null,
276
+ console.log(t),
277
+ _react2.default.createElement(_Timespan2.default, _extends({
278
+ key: t.timespan,
279
+ title: Object.values(timespans).length > 1 && _messages2.default.get('header.responsible-gaming.timespan.' + t.timespan),
280
+ onChangeLimit: onChangeLimit(t.timespan),
281
+ onResetLimit: function onResetLimit() {
282
+ return onSubmitLimits([t.currentLimit]);
283
+ },
284
+ onConfirmLimit: onConfirmLimit,
285
+ onDeclineLimit: onDeclineLimit,
286
+ onPickLimit: function onPickLimit(id) {
287
+ return onSubmitLimits(t.pickLimits.filter(function (l) {
288
+ return l.Id !== id;
289
+ }).map(function (l) {
290
+ return _extends({}, l, { Amount: 0 });
291
+ }));
292
+ },
293
+ validationState: getValidationState(t.timespan),
294
+ currency: currency,
295
+ maxAmounts: maxAmounts,
296
+ values: values,
297
+ valueType: valueType,
298
+ hideRemainingLimit: hideRemainingLimit,
299
+ showCurrentValue: showCurrentValue,
300
+ hideOther: hideOther
301
+ }, t))
302
+ );
295
303
  }),
296
304
  !hideSubmit && _react2.default.createElement(
297
305
  _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.24",
3
+ "version": "6.3.4-3.3",
4
4
  "description": "tg-core-components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",