tg-core-components 6.3.11-3 → 6.3.11-5

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.
@@ -246,8 +246,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
246
246
  messages = _ref10.messages,
247
247
  isTime = _ref10.isTime,
248
248
  valueType = _ref10.valueType,
249
- setValueType = _ref10.setValueType,
250
- setValueTransform = _ref10.setValueTransform;
249
+ setValueType = _ref10.setValueType;
251
250
 
252
251
  var _useState = useState(newLimit ? newLimit.Amount : currentLimit ? currentLimit.Amount : 0),
253
252
  _useState2 = _slicedToArray(_useState, 2),
@@ -314,12 +313,12 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
314
313
  setInputMode('select');
315
314
  };
316
315
 
317
- var _onChange = function _onChange(value) {
316
+ var _onChange = function _onChange(value, isOther) {
318
317
  if (value === 'other') {
319
318
  setInputMode('input');
320
319
  setValue('');
321
320
  } else {
322
- onChangeLimit(isNaN(parseInt(value)) ? getByPath(currentLimit, 'Amount') : parseInt(value));
321
+ onChangeLimit(isNaN(parseInt(value)) ? getByPath(currentLimit, 'Amount') : parseInt(value), isOther);
323
322
  }
324
323
  };
325
324
 
@@ -355,9 +354,8 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
355
354
  pattern: '\\d*',
356
355
  value: value,
357
356
  onChange: function onChange(e, value) {
358
- var transformedValue = typeof setValueTransform === 'function' ? setValueTransform(parseInt(value), currentLimit, true) : value;
359
- setValue(transformedValue);
360
- if (transformedValue > 0) _onChange(transformedValue);
357
+ setValue(parseInt(value));
358
+ if (value > 0) _onChange(value, true);
361
359
  },
362
360
  autoFocus: !isIphone,
363
361
  min: validationState['limit-remove-blocked'] ? '1' : '0',
@@ -88,8 +88,9 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
88
88
  };
89
89
  };
90
90
 
91
- var onSubmitLimits = function onSubmitLimits(type, product) {
91
+ var onSubmitLimits = function onSubmitLimits(type, product, transform) {
92
92
  return function (limits) {
93
+ console.log('Submitting limits', limits, type, product, transform);
93
94
  return typeof onSubmit === 'function' && onSubmit({
94
95
  type: type,
95
96
  product: product,
@@ -104,7 +105,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
104
105
  * There can only be one limit with status "NewLimit" for each type/timespan
105
106
  */
106
107
  var onChangeLimit = function onChangeLimit(type, product) {
107
- return function (timespan) {
108
+ return function (timespan, isOther) {
108
109
  return function (amount) {
109
110
  var newLimit = {
110
111
  Id: getByPath(normalizedLimits, '[' + type + '].timespans[' + timespan + '].currentLimit.Id'),
@@ -112,7 +113,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
112
113
  Product: product,
113
114
  Timespan: timespan,
114
115
  Amount: amount,
115
- Status: 'NewLimit'
116
+ Status: 'NewLimit',
117
+ IsOther: isOther
116
118
  };
117
119
  var limits = localLimits.filter(function (l) {
118
120
  return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
@@ -139,7 +141,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
139
141
  tooltipOpen: normalizedLimits.tooltipOpen
140
142
  }),
141
143
  React.createElement(LimitContent, _extends({
142
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
144
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.setValueTransform),
143
145
  onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
144
146
  hideSubmit: hideSubmit,
145
147
  onConfirmLimit: onConfirmLimit,
@@ -181,7 +183,6 @@ var LimitContent = function LimitContent(_ref3) {
181
183
  values = _ref3.values,
182
184
  valueType = _ref3.valueType,
183
185
  setValueType = _ref3.setValueType,
184
- setValueTransform = _ref3.setValueTransform,
185
186
  hideRemainingLimit = _ref3.hideRemainingLimit,
186
187
  showCurrentValue = _ref3.showCurrentValue,
187
188
  hideOther = _ref3.hideOther,
@@ -194,6 +195,7 @@ var LimitContent = function LimitContent(_ref3) {
194
195
  var alerts = getAlerts(Object.keys(timespans));
195
196
 
196
197
  var onSubmit = function onSubmit(e) {
198
+ console.log('Submitting form', timespans);
197
199
  e.preventDefault();
198
200
  var limits = Object.values(timespans).filter(function (t) {
199
201
  return !t.pendingDeleteLimit && !t.pendingActivateLimit;
@@ -246,7 +248,6 @@ var LimitContent = function LimitContent(_ref3) {
246
248
  values: values,
247
249
  valueType: valueType,
248
250
  setValueType: setValueType,
249
- setValueTransform: setValueTransform,
250
251
  hideRemainingLimit: hideRemainingLimit,
251
252
  showCurrentValue: showCurrentValue,
252
253
  hideOther: hideOther
@@ -277,8 +277,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
277
277
  messages = _ref10.messages,
278
278
  isTime = _ref10.isTime,
279
279
  valueType = _ref10.valueType,
280
- setValueType = _ref10.setValueType,
281
- setValueTransform = _ref10.setValueTransform;
280
+ setValueType = _ref10.setValueType;
282
281
 
283
282
  var _useState = (0, _react.useState)(newLimit ? newLimit.Amount : currentLimit ? currentLimit.Amount : 0),
284
283
  _useState2 = _slicedToArray(_useState, 2),
@@ -345,12 +344,12 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
345
344
  setInputMode('select');
346
345
  };
347
346
 
348
- var _onChange = function _onChange(value) {
347
+ var _onChange = function _onChange(value, isOther) {
349
348
  if (value === 'other') {
350
349
  setInputMode('input');
351
350
  setValue('');
352
351
  } else {
353
- onChangeLimit(isNaN(parseInt(value)) ? (0, _get2.default)(currentLimit, 'Amount') : parseInt(value));
352
+ onChangeLimit(isNaN(parseInt(value)) ? (0, _get2.default)(currentLimit, 'Amount') : parseInt(value), isOther);
354
353
  }
355
354
  };
356
355
 
@@ -386,9 +385,8 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
386
385
  pattern: '\\d*',
387
386
  value: value,
388
387
  onChange: function onChange(e, value) {
389
- var transformedValue = typeof setValueTransform === 'function' ? setValueTransform(parseInt(value), currentLimit, true) : value;
390
- setValue(transformedValue);
391
- if (transformedValue > 0) _onChange(transformedValue);
388
+ setValue(parseInt(value));
389
+ if (value > 0) _onChange(value, true);
392
390
  },
393
391
  autoFocus: !isIphone,
394
392
  min: validationState['limit-remove-blocked'] ? '1' : '0',
@@ -130,8 +130,9 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
130
130
  };
131
131
  };
132
132
 
133
- var onSubmitLimits = function onSubmitLimits(type, product) {
133
+ var onSubmitLimits = function onSubmitLimits(type, product, transform) {
134
134
  return function (limits) {
135
+ console.log('Submitting limits', limits, type, product, transform);
135
136
  return typeof onSubmit === 'function' && onSubmit({
136
137
  type: type,
137
138
  product: product,
@@ -146,7 +147,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
146
147
  * There can only be one limit with status "NewLimit" for each type/timespan
147
148
  */
148
149
  var onChangeLimit = function onChangeLimit(type, product) {
149
- return function (timespan) {
150
+ return function (timespan, isOther) {
150
151
  return function (amount) {
151
152
  var newLimit = {
152
153
  Id: (0, _get2.default)(normalizedLimits, '[' + type + '].timespans[' + timespan + '].currentLimit.Id'),
@@ -154,7 +155,8 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
154
155
  Product: product,
155
156
  Timespan: timespan,
156
157
  Amount: amount,
157
- Status: 'NewLimit'
158
+ Status: 'NewLimit',
159
+ IsOther: isOther
158
160
  };
159
161
  var limits = localLimits.filter(function (l) {
160
162
  return !(l.Type === newLimit.Type && l.Product === newLimit.Product && l.Timespan === newLimit.Timespan && l.Status === newLimit.Status);
@@ -181,7 +183,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
181
183
  tooltipOpen: normalizedLimits.tooltipOpen
182
184
  }),
183
185
  _react2.default.createElement(LimitContent, _extends({
184
- onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
186
+ onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product, normalizedLimits.setValueTransform),
185
187
  onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
186
188
  hideSubmit: hideSubmit,
187
189
  onConfirmLimit: onConfirmLimit,
@@ -223,7 +225,6 @@ var LimitContent = function LimitContent(_ref3) {
223
225
  values = _ref3.values,
224
226
  valueType = _ref3.valueType,
225
227
  setValueType = _ref3.setValueType,
226
- setValueTransform = _ref3.setValueTransform,
227
228
  hideRemainingLimit = _ref3.hideRemainingLimit,
228
229
  showCurrentValue = _ref3.showCurrentValue,
229
230
  hideOther = _ref3.hideOther,
@@ -236,6 +237,7 @@ var LimitContent = function LimitContent(_ref3) {
236
237
  var alerts = getAlerts(Object.keys(timespans));
237
238
 
238
239
  var onSubmit = function onSubmit(e) {
240
+ console.log('Submitting form', timespans);
239
241
  e.preventDefault();
240
242
  var limits = Object.values(timespans).filter(function (t) {
241
243
  return !t.pendingDeleteLimit && !t.pendingActivateLimit;
@@ -288,7 +290,6 @@ var LimitContent = function LimitContent(_ref3) {
288
290
  values: values,
289
291
  valueType: valueType,
290
292
  setValueType: setValueType,
291
- setValueTransform: setValueTransform,
292
293
  hideRemainingLimit: hideRemainingLimit,
293
294
  showCurrentValue: showCurrentValue,
294
295
  hideOther: hideOther
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.3.11-3",
3
+ "version": "6.3.11-5",
4
4
  "description": "tg-core-components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",