tg-core-components 6.3.11-1 → 6.3.11-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.
Files changed (202) hide show
  1. package/package.json +1 -1
  2. package/es/widgets/ResponsibleGamingWidget/Timespan.js +0 -387
  3. package/es/widgets/ResponsibleGamingWidget/helpers.js +0 -39
  4. package/es/widgets/ResponsibleGamingWidget/index.js +0 -319
  5. package/es/widgets/ResponsibleGamingWidget/messages.js +0 -342
  6. package/es/widgets/ResponsibleGamingWidget/normalize.js +0 -238
  7. package/es/widgets/ResponsibleGamingWidget/validate.js +0 -75
  8. package/es/widgets/Settings/index.js +0 -54
  9. package/es/widgets/SignIn/SignInForm.js +0 -80
  10. package/es/widgets/SignIn/index.js +0 -80
  11. package/es/widgets/SignUp/ActivationStep.js +0 -166
  12. package/es/widgets/SignUp/ConfirmContactInfoStep.js +0 -250
  13. package/es/widgets/SignUp/ContactInfoStep.js +0 -368
  14. package/es/widgets/SignUp/SetLimitsStep.js +0 -255
  15. package/es/widgets/SignUp/UserInfoStep.js +0 -258
  16. package/es/widgets/SignUp/index.js +0 -324
  17. package/es/widgets/SportsbookHistoryTable/index.js +0 -300
  18. package/es/widgets/SportsbookSettings/index.js +0 -56
  19. package/es/widgets/Subscriptions/index.js +0 -193
  20. package/es/widgets/TableWidget/Tables/bonusCode.js +0 -92
  21. package/es/widgets/TableWidget/Tables/bonusTable.js +0 -249
  22. package/es/widgets/TableWidget/Tables/index.js +0 -71
  23. package/es/widgets/TableWidget/index.js +0 -125
  24. package/es/widgets/Verify/Address.js +0 -28
  25. package/es/widgets/Verify/Passport.js +0 -28
  26. package/es/widgets/Verify/Payment.js +0 -28
  27. package/es/widgets/Verify/index.js +0 -154
  28. package/es/widgets/Verify/reasons.js +0 -92
  29. package/es/widgets/Verify/status.js +0 -16
  30. package/es/widgets/Verify/types.js +0 -25
  31. package/es/widgets/VerifyAccordionWidget/index.js +0 -177
  32. package/lib/components/AcceptUpdatedTaC/index.js +0 -89
  33. package/lib/components/Alert/index.js +0 -145
  34. package/lib/components/AutocompleteInput/index.js +0 -118
  35. package/lib/components/Button/index.js +0 -86
  36. package/lib/components/ButtonLoader.js +0 -78
  37. package/lib/components/Checklist/index.js +0 -73
  38. package/lib/components/Deposit/BonusCodeInput/index.js +0 -110
  39. package/lib/components/Deposit/CardInput/index.js +0 -249
  40. package/lib/components/Deposit/DelayVisibility/index.js +0 -63
  41. package/lib/components/Deposit/InputAdapter/index.js +0 -54
  42. package/lib/components/Deposit/Select/index.js +0 -183
  43. package/lib/components/Deposit/Single/index.js +0 -126
  44. package/lib/components/Deposit/TextInput/index.js +0 -194
  45. package/lib/components/Icon/index.js +0 -34
  46. package/lib/components/Image/index.js +0 -172
  47. package/lib/components/Input/BirthdateInput.js +0 -195
  48. package/lib/components/Input/Checkbox.js +0 -65
  49. package/lib/components/Input/Input.js +0 -87
  50. package/lib/components/Input/PasswordInput.js +0 -101
  51. package/lib/components/Input/PhoneNumberInput.js +0 -136
  52. package/lib/components/Input/index.js +0 -50
  53. package/lib/components/Input/input.test.js +0 -89
  54. package/lib/components/Input/old-input.test.js +0 -107
  55. package/lib/components/InternalMessagesInbox.js +0 -315
  56. package/lib/components/List/ListItem.js +0 -64
  57. package/lib/components/List/index.js +0 -98
  58. package/lib/components/Loader/index.js +0 -51
  59. package/lib/components/Money/index.js +0 -74
  60. package/lib/components/Notification.js +0 -189
  61. package/lib/components/Picture/index.js +0 -88
  62. package/lib/components/Radio/index.js +0 -103
  63. package/lib/components/Select/index.js +0 -83
  64. package/lib/components/Single/index.js +0 -142
  65. package/lib/components/Skeleton/index.js +0 -31
  66. package/lib/components/Textarea/index.js +0 -184
  67. package/lib/components/Translate/index.js +0 -39
  68. package/lib/components/Uploader/index.js +0 -157
  69. package/lib/components/common.js +0 -363
  70. package/lib/index.js +0 -270
  71. package/lib/lib/WithFetch.js +0 -65
  72. package/lib/lib/WithMultipleStep.js +0 -61
  73. package/lib/lib/WithValidation/index.js +0 -132
  74. package/lib/lib/WithValidation/rules/blacklistedCharacters.js +0 -9
  75. package/lib/lib/WithValidation/rules/date.js +0 -22
  76. package/lib/lib/WithValidation/rules/email.js +0 -9
  77. package/lib/lib/WithValidation/rules/hasMin.js +0 -11
  78. package/lib/lib/WithValidation/rules/hasMinLength.js +0 -17
  79. package/lib/lib/WithValidation/rules/match.js +0 -12
  80. package/lib/lib/WithValidation/rules/noSpecialCharacters.js +0 -9
  81. package/lib/lib/WithValidation/rules/number.js +0 -9
  82. package/lib/lib/WithValidation/rules/password.js +0 -9
  83. package/lib/lib/WithValidation/rules/phone.js +0 -9
  84. package/lib/lib/WithValidation/rules/required.js +0 -11
  85. package/lib/lib/WithValidation/rules/stringWithoutJapaneseCharacters.js +0 -9
  86. package/lib/lib/WithValidation/rules/stringWithoutNumbers.js +0 -9
  87. package/lib/lib/utils/historyMaps.js +0 -40
  88. package/lib/lib/utils/muchBetterParser.js +0 -11
  89. package/lib/lib/utils/selectUnit.js +0 -69
  90. package/lib/lib/utils/swishParser.js +0 -10
  91. package/lib/lib/utils/swishParser.test.js +0 -29
  92. package/lib/lib/utils/translate.js +0 -32
  93. package/lib/lib/withSwipeListeners.js +0 -104
  94. package/lib/misc/countryEmojiFlags.js +0 -207
  95. package/lib/styleguide/Wrapper.js +0 -46
  96. package/lib/styleguide/logo/index.js +0 -21
  97. package/lib/widgets/AccordionWidget/index.js +0 -228
  98. package/lib/widgets/AccountDetail/index.js +0 -344
  99. package/lib/widgets/ActivateWidget/index.js +0 -393
  100. package/lib/widgets/Balance/index.js +0 -64
  101. package/lib/widgets/Bonus/bonusCode.js +0 -111
  102. package/lib/widgets/Bonus/index.js +0 -115
  103. package/lib/widgets/Bonus/table.js +0 -166
  104. package/lib/widgets/BonusWidget/BonusCode.js +0 -113
  105. package/lib/widgets/BonusWidget/index.js +0 -336
  106. package/lib/widgets/BonusWidget/states.js +0 -48
  107. package/lib/widgets/BonusWidget/types.js +0 -38
  108. package/lib/widgets/Cashier/Deposit/BonusSelectorList/index.js +0 -79
  109. package/lib/widgets/Cashier/Deposit/DepositWidget/index.js +0 -416
  110. package/lib/widgets/Cashier/Deposit/PaymentForm/DynamicForm.js +0 -75
  111. package/lib/widgets/Cashier/Deposit/PaymentForm/InjectedIframeHTML.js +0 -74
  112. package/lib/widgets/Cashier/Deposit/PaymentForm/NewTab.js +0 -44
  113. package/lib/widgets/Cashier/Deposit/PaymentForm/PaymentResult.js +0 -53
  114. package/lib/widgets/Cashier/Deposit/PaymentForm/index.js +0 -224
  115. package/lib/widgets/Cashier/Payment/PaymentAccountForms/index.js +0 -350
  116. package/lib/widgets/Cashier/Payment/PaymentAccountParser.js +0 -55
  117. package/lib/widgets/Cashier/Payment/PaymentAmountSelector/index.js +0 -89
  118. package/lib/widgets/Cashier/Payment/PaymentMethodItem/index.js +0 -247
  119. package/lib/widgets/Cashier/Payment/PaymentMethodSelector/index.js +0 -79
  120. package/lib/widgets/Cashier/Payment/SelectedPaymentMethod/index.js +0 -104
  121. package/lib/widgets/Cashier/Payment/index.js +0 -35
  122. package/lib/widgets/Cashier/Withdraw/WithdrawWidget/index.js +0 -314
  123. package/lib/widgets/Cashier/hoc/FramedComponent/index.js +0 -90
  124. package/lib/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +0 -96
  125. package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +0 -818
  126. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/DynamicForm.js +0 -75
  127. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/InjectedIframeHTML.js +0 -70
  128. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -44
  129. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/PaymentResult.js +0 -50
  130. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/index.js +0 -167
  131. package/lib/widgets/CashierAccordion/Payment/AccountSelection/index.js +0 -115
  132. package/lib/widgets/CashierAccordion/Payment/Button/index.js +0 -35
  133. package/lib/widgets/CashierAccordion/Payment/CashierResult/index.js +0 -173
  134. package/lib/widgets/CashierAccordion/Payment/MethodMinMax/index.js +0 -69
  135. package/lib/widgets/CashierAccordion/Payment/Notice/index.js +0 -44
  136. package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +0 -1113
  137. package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +0 -1084
  138. package/lib/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -63
  139. package/lib/widgets/CashierAccordion/Payment/PaymentAmountSelector/index.js +0 -57
  140. package/lib/widgets/CashierAccordion/Payment/PaymentMethodItem/index.js +0 -236
  141. package/lib/widgets/CashierAccordion/Payment/PaymentMethodSelector/index.js +0 -117
  142. package/lib/widgets/CashierAccordion/Payment/SelectedPaymentMethod/index.js +0 -73
  143. package/lib/widgets/CashierAccordion/Payment/index.js +0 -87
  144. package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +0 -536
  145. package/lib/widgets/CashierAccordion/hoc/FramedComponent/index.js +0 -90
  146. package/lib/widgets/CasinoHistoryTable/index.js +0 -317
  147. package/lib/widgets/ChangePassword/index.js +0 -139
  148. package/lib/widgets/ChangeUsername/index.js +0 -95
  149. package/lib/widgets/HistoryWidget/index.js +0 -410
  150. package/lib/widgets/HistoryWidget/message.js +0 -160
  151. package/lib/widgets/HistoryWidget/utils.js +0 -40
  152. package/lib/widgets/Pagination/index.js +0 -217
  153. package/lib/widgets/PaymentHistoryTable/index.js +0 -310
  154. package/lib/widgets/RequestResetPassword/index.js +0 -132
  155. package/lib/widgets/ResetPassword/index.js +0 -143
  156. package/lib/widgets/ResponsibleGaming/Amount.js +0 -72
  157. package/lib/widgets/ResponsibleGaming/LimitList/index.js +0 -229
  158. package/lib/widgets/ResponsibleGaming/Period.js +0 -67
  159. package/lib/widgets/ResponsibleGaming/index.js +0 -167
  160. package/lib/widgets/ResponsibleGamingAccordion/AmountItemContent/index.js +0 -416
  161. package/lib/widgets/ResponsibleGamingAccordion/AmountItemHeader/index.js +0 -57
  162. package/lib/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +0 -400
  163. package/lib/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +0 -217
  164. package/lib/widgets/ResponsibleGamingAccordion/PeriodItemHeader/index.js +0 -53
  165. package/lib/widgets/ResponsibleGamingAccordion/index.js +0 -688
  166. package/lib/widgets/ResponsibleGamingAccordionSignUp/AmountItemContent/index.js +0 -139
  167. package/lib/widgets/ResponsibleGamingAccordionSignUp/AmountItemHeader/index.js +0 -57
  168. package/lib/widgets/ResponsibleGamingAccordionSignUp/LimitStatus/index.js +0 -61
  169. package/lib/widgets/ResponsibleGamingAccordionSignUp/index.js +0 -258
  170. package/lib/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +0 -112
  171. package/lib/widgets/ResponsibleGamingSingleSignUp/LimitStatus/index.js +0 -42
  172. package/lib/widgets/ResponsibleGamingSingleSignUp/index.js +0 -286
  173. package/lib/widgets/ResponsibleGamingWidget/Timespan.js +0 -418
  174. package/lib/widgets/ResponsibleGamingWidget/helpers.js +0 -50
  175. package/lib/widgets/ResponsibleGamingWidget/index.js +0 -362
  176. package/lib/widgets/ResponsibleGamingWidget/messages.js +0 -363
  177. package/lib/widgets/ResponsibleGamingWidget/normalize.js +0 -244
  178. package/lib/widgets/ResponsibleGamingWidget/validate.js +0 -85
  179. package/lib/widgets/Settings/index.js +0 -79
  180. package/lib/widgets/SignIn/SignInForm.js +0 -109
  181. package/lib/widgets/SignIn/index.js +0 -112
  182. package/lib/widgets/SignUp/ActivationStep.js +0 -199
  183. package/lib/widgets/SignUp/ConfirmContactInfoStep.js +0 -279
  184. package/lib/widgets/SignUp/ContactInfoStep.js +0 -407
  185. package/lib/widgets/SignUp/SetLimitsStep.js +0 -293
  186. package/lib/widgets/SignUp/UserInfoStep.js +0 -308
  187. package/lib/widgets/SignUp/index.js +0 -352
  188. package/lib/widgets/SportsbookHistoryTable/index.js +0 -315
  189. package/lib/widgets/SportsbookSettings/index.js +0 -78
  190. package/lib/widgets/Subscriptions/index.js +0 -215
  191. package/lib/widgets/TableWidget/Tables/bonusCode.js +0 -124
  192. package/lib/widgets/TableWidget/Tables/bonusTable.js +0 -264
  193. package/lib/widgets/TableWidget/Tables/index.js +0 -86
  194. package/lib/widgets/TableWidget/index.js +0 -139
  195. package/lib/widgets/Verify/Address.js +0 -38
  196. package/lib/widgets/Verify/Passport.js +0 -38
  197. package/lib/widgets/Verify/Payment.js +0 -38
  198. package/lib/widgets/Verify/index.js +0 -189
  199. package/lib/widgets/Verify/reasons.js +0 -106
  200. package/lib/widgets/Verify/status.js +0 -30
  201. package/lib/widgets/Verify/types.js +0 -39
  202. package/lib/widgets/VerifyAccordionWidget/index.js +0 -213
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.3.11-1",
3
+ "version": "6.3.11-2",
4
4
  "description": "tg-core-components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,387 +0,0 @@
1
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
2
-
3
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4
-
5
- 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); } }
6
-
7
- function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
8
-
9
- import React, { useState, useEffect, Fragment } from 'react';
10
- import Input from '../../components/Input';
11
- import Select from '../../components/Select';
12
- import Button from '../../components/Button';
13
- import Icon from '../../components/Icon';
14
- import messages from './messages';
15
- import getByPath from 'lodash/get';
16
- import { injectIntl } from 'react-intl';
17
- import { getValues, convertTimeValues } from './helpers';
18
-
19
- var Timespan = function Timespan(_ref) {
20
- var title = _ref.title,
21
- rest = _objectWithoutProperties(_ref, ['title']);
22
-
23
- var Component = getTimespanComponent(rest);
24
-
25
- var get = function get(intl) {
26
- return function (id) {
27
- var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28
- return messages.get(id, _extends({ intl: intl }, values || {}));
29
- };
30
- };
31
- var getValue = function getValue(valueType, currency, intl) {
32
- return function (value) {
33
- if (valueType !== 'currency') {
34
- if (value === 99999 && valueType === 'days') return get(intl)('label.responsible-gaming.unlimited');
35
-
36
- var values = convertTimeValues(value, valueType);
37
- return Object.entries(values).filter(function (_ref2) {
38
- var _ref3 = _slicedToArray(_ref2, 2),
39
- valueType = _ref3[0],
40
- value = _ref3[1];
41
-
42
- return value > 0;
43
- }).map(function (_ref4) {
44
- var _ref5 = _slicedToArray(_ref4, 2),
45
- valueType = _ref5[0],
46
- value = _ref5[1];
47
-
48
- return messages.getValue(value, valueType, null, intl);
49
- }).slice(0, 2).join(' ');
50
- } else {
51
- return messages.getValue(value, valueType, currency, intl);
52
- }
53
- };
54
- };
55
-
56
- return React.createElement(
57
- 'div',
58
- { className: 'ResponsibleGamingWidget__timespan' },
59
- title && React.createElement(
60
- 'div',
61
- { className: 'ResponsibleGamingWidget__timespan-title' },
62
- title
63
- ),
64
- React.createElement(Component, _extends({}, rest, {
65
- isTime: ['hours', 'minutes', 'days'].includes(rest.valueType),
66
- messages: {
67
- get: get(rest.intl),
68
- getValue: getValue(rest.valueType, rest.currency, rest.intl)
69
- }
70
- }))
71
- );
72
- };
73
-
74
- export default injectIntl(Timespan);
75
-
76
- /**
77
- * Map normalized limits to a timespan component.
78
- */
79
- var getTimespanComponent = function getTimespanComponent(_ref6) {
80
- var confirmLimit = _ref6.confirmLimit,
81
- pendingActivateLimit = _ref6.pendingActivateLimit,
82
- pendingDeleteLimit = _ref6.pendingDeleteLimit,
83
- pickLimits = _ref6.pickLimits;
84
-
85
- if (confirmLimit) return ConfirmTimespan;
86
- if (pendingActivateLimit || pendingDeleteLimit) return PendingTimespan;
87
- if (Array.isArray(pickLimits) && pickLimits.length > 1) return PickTimespan;
88
- return DefaultTimespan;
89
- };
90
-
91
- var PickTimespan = function PickTimespan(_ref7) {
92
- var pickLimits = _ref7.pickLimits,
93
- onPickLimit = _ref7.onPickLimit,
94
- messages = _ref7.messages;
95
- return React.createElement(
96
- Fragment,
97
- null,
98
- messages.get('label.responsible-gaming.pick-limit'),
99
- pickLimits.map(function (l, k) {
100
- return React.createElement(
101
- 'div',
102
- { className: 'ResponsibleGamingWidget__timespan-row', key: k },
103
- messages.getValue(getByPath(l, 'Amount')),
104
- React.createElement(
105
- Button,
106
- {
107
- type: 'button',
108
- className: 'button tertiary tiny',
109
- onClick: function onClick() {
110
- return onPickLimit(l.Id);
111
- } },
112
- messages.get('action.responsible-gaming.pick')
113
- )
114
- );
115
- })
116
- );
117
- };
118
-
119
- var ConfirmTimespan = function ConfirmTimespan(_ref8) {
120
- var confirmLimit = _ref8.confirmLimit,
121
- currentLimit = _ref8.currentLimit,
122
- pendingActivateLimit = _ref8.pendingActivateLimit,
123
- pendingDeleteLimit = _ref8.pendingDeleteLimit,
124
- onConfirmLimit = _ref8.onConfirmLimit,
125
- onDeclineLimit = _ref8.onDeclineLimit,
126
- hideRemainingLimit = _ref8.hideRemainingLimit,
127
- isTime = _ref8.isTime,
128
- messages = _ref8.messages;
129
- return React.createElement(
130
- Fragment,
131
- null,
132
- React.createElement(
133
- 'div',
134
- { className: 'ResponsibleGamingWidget__timespan-row' },
135
- messages.get('message.responsiblegaming.current-limit'),
136
- messages.getValue(getByPath(currentLimit, 'Amount'))
137
- ),
138
- !hideRemainingLimit && React.createElement(
139
- 'div',
140
- { className: 'ResponsibleGamingWidget__timespan-row' },
141
- isTime ? messages.get('message.responsiblegaming.remaining-time') : messages.get('message.responsiblegaming.remaining-limit'),
142
- messages.getValue(getByPath(currentLimit, 'RemainingAmount'))
143
- ),
144
- React.createElement(
145
- 'div',
146
- { className: 'ResponsibleGamingWidget__timespan-box' },
147
- pendingActivateLimit && messages.get('label.responsible-gaming.confirm-increase', {
148
- PendingActivateLimitAmount: messages.getValue(getByPath(pendingActivateLimit, 'Amount'))
149
- }),
150
- pendingDeleteLimit && messages.get('label.responsible-gaming.confirm-delete'),
151
- React.createElement(
152
- 'div',
153
- { className: 'ResponsibleGamingWidget__timespan-box-actions' },
154
- React.createElement(
155
- Button,
156
- {
157
- type: 'button',
158
- className: 'button tertiary',
159
- onClick: function onClick() {
160
- return onDeclineLimit(confirmLimit.Id);
161
- } },
162
- messages.get('action.responsible-gaming.reset-limit')
163
- ),
164
- React.createElement(
165
- Button,
166
- {
167
- type: 'button',
168
- className: 'button primary',
169
- onClick: function onClick() {
170
- return onConfirmLimit(confirmLimit.Id);
171
- } },
172
- messages.get('action.responsible-gaming.accept')
173
- )
174
- )
175
- )
176
- );
177
- };
178
-
179
- var PendingTimespan = function PendingTimespan(_ref9) {
180
- var currentLimit = _ref9.currentLimit,
181
- pendingActivateLimit = _ref9.pendingActivateLimit,
182
- pendingDeleteLimit = _ref9.pendingDeleteLimit,
183
- onResetLimit = _ref9.onResetLimit,
184
- hideRemainingLimit = _ref9.hideRemainingLimit,
185
- messages = _ref9.messages,
186
- isTime = _ref9.isTime;
187
-
188
- var isPendingDelete = Boolean(pendingDeleteLimit && !pendingActivateLimit);
189
- var isPendingActivate = Boolean(pendingActivateLimit && pendingActivateLimit.Activates);
190
- var isPendingReview = Boolean(pendingActivateLimit && !pendingActivateLimit.Activates);
191
- return React.createElement(
192
- Fragment,
193
- null,
194
- React.createElement(
195
- 'div',
196
- { className: 'ResponsibleGamingWidget__timespan-row' },
197
- messages.get('message.responsiblegaming.current-limit'),
198
- messages.getValue(getByPath(currentLimit, 'Amount'))
199
- ),
200
- !hideRemainingLimit && React.createElement(
201
- 'div',
202
- { className: 'ResponsibleGamingWidget__timespan-row' },
203
- isTime ? messages.get('message.responsiblegaming.remaining-time') : messages.get('message.responsiblegaming.remaining-limit'),
204
- messages.getValue(getByPath(currentLimit, 'RemainingAmount'))
205
- ),
206
- React.createElement(
207
- 'div',
208
- { className: 'ResponsibleGamingWidget__timespan-box' },
209
- isPendingDelete && messages.get('label.responsible-gaming.pending-delete', {
210
- PendingDeleteLimitExpires: pendingDeleteLimit.Expires
211
- }),
212
- isPendingActivate && messages.get('label.responsible-gaming.pending-activate', {
213
- PendingActivateLimitAmount: messages.getValue(pendingActivateLimit.Amount),
214
- PendingActivateLimitActivates: pendingActivateLimit.Activates
215
- }),
216
- isPendingReview && messages.get('label.responsible-gaming.pending-review', {
217
- PendingReviewLimitAmount: messages.getValue(pendingActivateLimit.Amount)
218
- }),
219
- React.createElement(
220
- 'div',
221
- { className: 'ResponsibleGamingWidget__timespan-box-actions' },
222
- React.createElement(
223
- Button,
224
- {
225
- type: 'button',
226
- className: 'button tertiary wide',
227
- onClick: onResetLimit },
228
- messages.get('action.responsible-gaming.reset-limit')
229
- )
230
- )
231
- )
232
- );
233
- };
234
-
235
- var DefaultTimespan = function DefaultTimespan(_ref10) {
236
- var currentLimit = _ref10.currentLimit,
237
- newLimit = _ref10.newLimit,
238
- onChangeLimit = _ref10.onChangeLimit,
239
- validationState = _ref10.validationState,
240
- currency = _ref10.currency,
241
- timespan = _ref10.timespan,
242
- hideRemainingLimit = _ref10.hideRemainingLimit,
243
- showCurrentValue = _ref10.showCurrentValue,
244
- hideOther = _ref10.hideOther,
245
- values = _ref10.values,
246
- messages = _ref10.messages,
247
- isTime = _ref10.isTime,
248
- valueType = _ref10.valueType,
249
- setValueType = _ref10.setValueType;
250
-
251
- var _useState = useState(newLimit ? newLimit.Amount : currentLimit ? currentLimit.Amount : 0),
252
- _useState2 = _slicedToArray(_useState, 2),
253
- value = _useState2[0],
254
- setValue = _useState2[1];
255
-
256
- useEffect(function () {
257
- if (newLimit) {
258
- setValue(newLimit.Amount);
259
- }
260
- }, [newLimit]);
261
-
262
- var _useState3 = useState('select'),
263
- _useState4 = _slicedToArray(_useState3, 2),
264
- inputMode = _useState4[0],
265
- setInputMode = _useState4[1];
266
-
267
- var options = [getByPath(currentLimit, 'Amount'), getByPath(newLimit, 'Amount')].concat(_toConsumableArray(getValues(values, currency, timespan))).filter(function (v) {
268
- return v;
269
- });
270
- options.sort(function (a, b) {
271
- return a - b;
272
- });
273
- options = [].concat(_toConsumableArray(new Set(options))).map(function (v) {
274
- return {
275
- value: v,
276
- label: value !== v && v === getByPath(currentLimit, 'Amount') ? messages.get('label.responsible-gaming.option.current-limit', {
277
- currentLimit: messages.getValue(v)
278
- }) : messages.getValue(v)
279
- };
280
- });
281
- // If not allowed to increase limit -> remove options greater than current limit
282
- if (validationState['limit-increase-blocked']) {
283
- options = options.filter(function (o) {
284
- return o.value <= getByPath(currentLimit, 'Amount');
285
- });
286
- }
287
- // If not blocked from removing limit or 'No limit' option is selected -> add 'No limit' option
288
- if (!validationState['limit-remove-blocked'] || value === 0 || value === '') {
289
- options.unshift({
290
- value: 0,
291
- label: messages.get('label.responsible-gaming.option.no-limit')
292
- });
293
- }
294
- // Add 'Other' option
295
- if (!hideOther) {
296
- options.push({
297
- value: 'other',
298
- label: valueType !== 'currency' ? messages.get('label.responsible-gaming.option.other-' + (setValueType || valueType)) : messages.get('label.responsible-gaming.option.other')
299
- });
300
- }
301
- // Per transaction (0) limits are depricated, remove all other options but no limit.
302
- if (timespan === 0) {
303
- options = [getByPath(currentLimit, 'Amount'), getByPath(newLimit, 'Amount'), {
304
- value: 0,
305
- label: messages.get('label.responsible-gaming.option.no-limit')
306
- }].filter(function (v) {
307
- return v;
308
- }).sort();
309
- }
310
-
311
- var closeCustomAmount = function closeCustomAmount() {
312
- _onChange(currentLimit ? currentLimit.Amount : 0);
313
- setInputMode('select');
314
- };
315
-
316
- var _onChange = function _onChange(value) {
317
- if (value === 'other') {
318
- setInputMode('input');
319
- setValue('');
320
- } else {
321
- onChangeLimit(isNaN(parseInt(value)) ? getByPath(currentLimit, 'Amount') : parseInt(value));
322
- }
323
- };
324
-
325
- var isIphone = typeof window !== 'undefined' && navigator.platform === 'iPhone';
326
-
327
- return React.createElement(
328
- Fragment,
329
- null,
330
- React.createElement(
331
- 'div',
332
- { className: 'ResponsibleGamingWidget__timespan-limit-selector' },
333
- inputMode === 'select' && React.createElement(
334
- Select,
335
- {
336
- options: options,
337
- value: value,
338
- onChange: function onChange(e, value) {
339
- return _onChange(value);
340
- } },
341
- options.map(function (o) {
342
- return React.createElement(
343
- Select.Option,
344
- { value: o.value },
345
- o.label
346
- );
347
- })
348
- ),
349
- inputMode === 'input' && React.createElement(
350
- Fragment,
351
- null,
352
- React.createElement(Input, {
353
- type: 'number',
354
- pattern: '\\d*',
355
- value: value,
356
- onChange: function onChange(e, value) {
357
- setValue(parseInt(value));
358
- if (value > 0) _onChange(value);
359
- },
360
- autoFocus: !isIphone,
361
- min: validationState['limit-remove-blocked'] ? '1' : '0',
362
- max: validationState['limit-increase-blocked'] ? getByPath(currentLimit, 'Amount') : Infinity
363
- }),
364
- React.createElement(
365
- Button,
366
- {
367
- type: 'button',
368
- onClick: closeCustomAmount,
369
- className: 'button mini tertiary' },
370
- React.createElement(Icon, { icon: 'times' })
371
- )
372
- )
373
- ),
374
- !hideRemainingLimit && typeof getByPath(currentLimit, 'RemainingAmount') === 'number' && React.createElement(
375
- 'div',
376
- { className: 'ResponsibleGamingWidget__timespan-row' },
377
- isTime ? messages.get('message.responsiblegaming.remaining-time') : messages.get('message.responsiblegaming.remaining-limit'),
378
- messages.getValue(currentLimit.RemainingAmount)
379
- ),
380
- showCurrentValue && typeof getByPath(currentLimit, 'Amount') === 'number' && React.createElement(
381
- 'div',
382
- { className: 'ResponsibleGamingWidget__timespan-row' },
383
- messages.get('message.responsiblegaming.current-limit'),
384
- messages.getValue(currentLimit.Amount)
385
- )
386
- );
387
- };
@@ -1,39 +0,0 @@
1
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2
-
3
- import getByPath from 'lodash/get';
4
-
5
- /**
6
- * Helper function to get values using currency and timespan
7
- */
8
- export var getValues = function getValues(values, currency, timespan) {
9
- values = getByPath(values, '[' + (currency || '').toUpperCase() + ']') || values;
10
- return (Array.isArray(values) ? values : []).filter(function (v) {
11
- return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v.timespan === timespan || typeof v === 'number';
12
- }).map(function (v) {
13
- return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
14
- });
15
- };
16
-
17
- export var convertTimeValues = function convertTimeValues(value, valueType) {
18
- var convertedAmounts = {};
19
-
20
- var minutes = valueType === 'hours' ? value * 60 : valueType === 'days' ? value * 24 * 60 : valueType === 'weeks' ? value * 24 * 7 * 60 : valueType === 'months' ? value * 24 * 30 * 60 : valueType === 'years' ? value * 24 * 365 * 60 : value;
21
-
22
- var years = Math.floor(minutes / 525600);
23
- var months = Math.floor(minutes % 525600 / 43200);
24
- var weeks = Math.floor(minutes % 525600 % 43200 / 10080);
25
- var days = Math.floor(minutes % 525600 % 43200 % 10080 / 1440);
26
- var hours = Math.floor(minutes % 525600 % 43200 % 10080 % 1440 / 60);
27
- minutes = Math.floor(minutes % 525600 % 43200 % 10080 % 1440 % 60);
28
-
29
- convertedAmounts = {
30
- years: years,
31
- months: months,
32
- weeks: weeks,
33
- days: days,
34
- hours: hours,
35
- minutes: minutes
36
- };
37
-
38
- return convertedAmounts;
39
- };