tg-core-components 6.3.4-3.18 → 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,30 +103,32 @@ 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: getValues(maxAmounts, currency, timespan)[0],
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
  };
126
127
 
127
- console.log(normalizedLimits);
128
128
  return React.createElement(
129
129
  'div',
130
130
  { className: cn('ResponsibleGamingWidget', className) },
131
+ console.log(normalizedLimits),
131
132
  React.createElement(
132
133
  AccordionWidget,
133
134
  {
@@ -142,8 +143,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
142
143
  tooltipOpen: normalizedLimits.tooltipOpen
143
144
  }),
144
145
  React.createElement(LimitContent, _extends({
145
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
146
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
146
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
147
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
147
148
  hideSubmit: hideSubmit,
148
149
  onConfirmLimit: onConfirmLimit,
149
150
  onDeclineLimit: onDeclineLimit,
@@ -195,6 +196,8 @@ var LimitContent = function LimitContent(_ref3) {
195
196
 
196
197
  var alerts = getAlerts(Object.keys(timespans));
197
198
 
199
+ console.log(Object.values);
200
+
198
201
  var onSubmit = function onSubmit(e) {
199
202
  e.preventDefault();
200
203
  var limits = Object.values(timespans).filter(function (t) {
@@ -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,30 +145,32 @@ 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: (0, _helpers.getValues)(maxAmounts, currency, timespan)[0],
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
  };
169
169
 
170
- console.log(normalizedLimits);
171
170
  return _react2.default.createElement(
172
171
  'div',
173
172
  { className: (0, _classnames2.default)('ResponsibleGamingWidget', className) },
173
+ console.log(normalizedLimits),
174
174
  _react2.default.createElement(
175
175
  _AccordionWidget2.default,
176
176
  {
@@ -185,8 +185,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
185
185
  tooltipOpen: normalizedLimits.tooltipOpen
186
186
  }),
187
187
  _react2.default.createElement(LimitContent, _extends({
188
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
189
- onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product, normalizedLimits.maxAmounts),
188
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
189
+ onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
190
190
  hideSubmit: hideSubmit,
191
191
  onConfirmLimit: onConfirmLimit,
192
192
  onDeclineLimit: onDeclineLimit,
@@ -238,6 +238,8 @@ var LimitContent = function LimitContent(_ref3) {
238
238
 
239
239
  var alerts = getAlerts(Object.keys(timespans));
240
240
 
241
+ console.log(Object.values);
242
+
241
243
  var onSubmit = function onSubmit(e) {
242
244
  e.preventDefault();
243
245
  var limits = Object.values(timespans).filter(function (t) {
@@ -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.18",
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",