tg-core-components 5.5.1-bethard → 5.5.1-master

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 (101) hide show
  1. package/es/components/AcceptUpdatedTaC/index.js +8 -3
  2. package/es/components/Checkbox/index.js +93 -0
  3. package/es/components/Deposit/CardInput/index.js +1 -3
  4. package/es/components/Input/index.js +222 -22
  5. package/es/components/InputWrapper/index.js +69 -0
  6. package/es/components/List/ListItem.js +1 -7
  7. package/es/components/Notification.js +4 -4
  8. package/es/components/Select/index.js +202 -64
  9. package/es/components/Select/test.js +111 -0
  10. package/es/index.js +2 -2
  11. package/es/lib/utils/translate.js +1 -8
  12. package/es/misc/countryEmojiFlags.js +0 -1
  13. package/es/widgets/AccountDetail/index.js +53 -77
  14. package/es/widgets/ActivateWidget/index.js +59 -293
  15. package/es/widgets/BonusWidget/BonusCode.js +24 -17
  16. package/es/widgets/BonusWidget/index.js +83 -45
  17. package/es/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +9 -6
  18. package/es/widgets/CashierAccordion/Deposit/DepositWidget/index.js +47 -85
  19. package/es/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -6
  20. package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
  21. package/es/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +163 -347
  22. package/es/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
  23. package/es/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +9 -23
  24. package/es/widgets/ChangePassword/index.js +53 -40
  25. package/es/widgets/HistoryWidget/index.js +69 -51
  26. package/es/widgets/HistoryWidget/message.js +17 -20
  27. package/es/widgets/RequestResetPassword/index.js +15 -14
  28. package/es/widgets/ResetPassword/index.js +22 -18
  29. package/es/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
  30. package/es/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
  31. package/es/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
  32. package/es/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
  33. package/es/widgets/ResponsibleGamingWidget/helpers.js +2 -2
  34. package/es/widgets/ResponsibleGamingWidget/validate.js +2 -6
  35. package/es/widgets/Settings/index.js +2 -2
  36. package/es/widgets/SignIn/SignInForm.js +4 -6
  37. package/es/widgets/SignIn/index.js +21 -21
  38. package/es/widgets/SignUp/ContactInfoStep.js +5 -6
  39. package/es/widgets/SportsbookSettings/index.js +10 -24
  40. package/es/widgets/Subscriptions/index.js +3 -5
  41. package/lib/components/AcceptUpdatedTaC/index.js +11 -3
  42. package/lib/components/Checkbox/index.js +106 -0
  43. package/lib/components/Deposit/CardInput/index.js +1 -3
  44. package/lib/components/Input/index.js +223 -26
  45. package/lib/components/InputWrapper/index.js +85 -0
  46. package/lib/components/List/ListItem.js +1 -10
  47. package/lib/components/Notification.js +3 -3
  48. package/lib/components/Select/index.js +209 -63
  49. package/lib/components/Select/test.js +121 -0
  50. package/lib/index.js +7 -7
  51. package/lib/lib/utils/translate.js +1 -8
  52. package/lib/misc/countryEmojiFlags.js +0 -1
  53. package/lib/widgets/AccountDetail/index.js +53 -86
  54. package/lib/widgets/ActivateWidget/index.js +58 -305
  55. package/lib/widgets/BonusWidget/BonusCode.js +24 -20
  56. package/lib/widgets/BonusWidget/index.js +85 -44
  57. package/lib/widgets/CashierAccordion/Deposit/BonusCodeInput/index.js +13 -7
  58. package/lib/widgets/CashierAccordion/Deposit/DepositWidget/index.js +50 -88
  59. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/index.js +2 -9
  60. package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/astroPayBankTransaltions.js +12 -0
  61. package/lib/widgets/CashierAccordion/Payment/PaymentAccountForms/index.js +195 -378
  62. package/lib/widgets/CashierAccordion/Payment/PaymentAccountParser.js +0 -6
  63. package/lib/widgets/CashierAccordion/Withdraw/WithdrawWidget/index.js +11 -25
  64. package/lib/widgets/ChangePassword/index.js +53 -43
  65. package/lib/widgets/HistoryWidget/index.js +69 -51
  66. package/lib/widgets/HistoryWidget/message.js +17 -20
  67. package/lib/widgets/RequestResetPassword/index.js +15 -17
  68. package/lib/widgets/ResetPassword/index.js +25 -21
  69. package/lib/widgets/ResponsibleGamingAccordion/LimitStatus/index.js +5 -2
  70. package/lib/widgets/ResponsibleGamingAccordion/PeriodItemContent/index.js +1 -2
  71. package/lib/widgets/ResponsibleGamingSingleSignUp/AmountItem/index.js +1 -2
  72. package/lib/widgets/ResponsibleGamingWidget/Timespan.js +14 -24
  73. package/lib/widgets/ResponsibleGamingWidget/helpers.js +2 -2
  74. package/lib/widgets/ResponsibleGamingWidget/validate.js +2 -6
  75. package/lib/widgets/Settings/index.js +6 -6
  76. package/lib/widgets/SignIn/SignInForm.js +7 -6
  77. package/lib/widgets/SignIn/index.js +25 -25
  78. package/lib/widgets/SignUp/ContactInfoStep.js +8 -6
  79. package/lib/widgets/SportsbookSettings/index.js +10 -24
  80. package/lib/widgets/Subscriptions/index.js +3 -11
  81. package/package.json +8 -3
  82. package/es/components/AutocompleteInput/index.js +0 -104
  83. package/es/components/Input/BirthdateInput.js +0 -174
  84. package/es/components/Input/Checkbox.js +0 -51
  85. package/es/components/Input/Input.js +0 -73
  86. package/es/components/Input/PasswordInput.js +0 -84
  87. package/es/components/Input/PhoneNumberInput.js +0 -113
  88. package/es/components/Input/input.test.js +0 -80
  89. package/es/components/Input/old-input.test.js +0 -100
  90. package/es/components/common.js +0 -339
  91. package/es/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -28
  92. package/lib/components/AutocompleteInput/index.js +0 -118
  93. package/lib/components/Input/BirthdateInput.js +0 -195
  94. package/lib/components/Input/Checkbox.js +0 -65
  95. package/lib/components/Input/Input.js +0 -87
  96. package/lib/components/Input/PasswordInput.js +0 -101
  97. package/lib/components/Input/PhoneNumberInput.js +0 -130
  98. package/lib/components/Input/input.test.js +0 -89
  99. package/lib/components/Input/old-input.test.js +0 -107
  100. package/lib/components/common.js +0 -359
  101. package/lib/widgets/CashierAccordion/Deposit/PaymentForm/NewTab.js +0 -44
@@ -141,8 +141,11 @@ var TransactionLimit = function TransactionLimit(_ref3) {
141
141
  { className: 'transaction-limit-value' },
142
142
  React.createElement(
143
143
  'a',
144
- { href: '#', onClick: function onClick() {
145
- return handleCancel(id);
144
+ {
145
+ href: '#',
146
+ onClick: function onClick(e) {
147
+ e.preventDefault();
148
+ handleCancel(id);
146
149
  } },
147
150
  React.createElement(Translate, { id: 'action.delete.limit', defaultMessage: 'Delete' })
148
151
  )
@@ -66,8 +66,7 @@ var PeriodItemContent = function PeriodItemContent(_ref) {
66
66
  value: displayLimit ? displayLimit.Amount : null,
67
67
  name: 'Amount',
68
68
  disabled: confirmLimit || cooldownLimit || pendingLimit,
69
- status: errors.Amount && 'failure',
70
- statusText: errors.Amount && translate({ id: errors.Amount }, intl)
69
+ error: errors.Amount && translate({ id: errors.Amount }, intl)
71
70
  }),
72
71
  confirmLimit && React.createElement(
73
72
  'div',
@@ -64,8 +64,7 @@ var AmountItem = function (_Component) {
64
64
  },
65
65
  name: timespan,
66
66
  value: value,
67
- status: !!error && 'failure',
68
- statusText: error,
67
+ error: error,
69
68
  currency: currency,
70
69
  type: 'number',
71
70
  inputMode: 'numeric',
@@ -251,10 +251,8 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
251
251
  setValue = _useState2[1];
252
252
 
253
253
  useEffect(function () {
254
- if (newLimit && newLimit.Amount) {
255
- setValue(newLimit.Amount);
256
- }
257
- }, [newLimit]);
254
+ return setValue(newLimit ? newLimit.Amount : currentLimit ? currentLimit.Amount : 0);
255
+ }, [newLimit, currentLimit]);
258
256
 
259
257
  var _useState3 = useState('select'),
260
258
  _useState4 = _slicedToArray(_useState3, 2),
@@ -305,7 +303,9 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
305
303
  }).sort();
306
304
  }
307
305
 
308
- var closeCustomAmount = function closeCustomAmount() {
306
+ var closeCustomAmount = function closeCustomAmount(e) {
307
+ e.preventDefault();
308
+ e.stopPropagation();
309
309
  _onChange(currentLimit ? currentLimit.Amount : 0);
310
310
  setInputMode('select');
311
311
  };
@@ -323,24 +323,15 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
323
323
  Fragment,
324
324
  null,
325
325
  React.createElement(
326
- 'div',
326
+ 'form',
327
327
  { className: 'ResponsibleGamingWidget__timespan-limit-selector' },
328
- inputMode === 'select' && React.createElement(
329
- Select,
330
- {
331
- options: options,
332
- value: value,
333
- onChange: function onChange(e, value) {
334
- return _onChange(value);
335
- } },
336
- options.map(function (o) {
337
- return React.createElement(
338
- Select.Option,
339
- { value: o.value },
340
- o.label
341
- );
342
- })
343
- ),
328
+ inputMode === 'select' && React.createElement(Select, {
329
+ options: options,
330
+ value: value,
331
+ onChange: function onChange(e, name, value) {
332
+ return _onChange(value);
333
+ }
334
+ }),
344
335
  inputMode === 'input' && React.createElement(
345
336
  Fragment,
346
337
  null,
@@ -348,7 +339,7 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
348
339
  type: 'number',
349
340
  pattern: '\\d*',
350
341
  value: value,
351
- onChange: function onChange(e, value) {
342
+ onChange: function onChange(e, name, value) {
352
343
  setValue(parseInt(value));
353
344
  if (value > 0) _onChange(value);
354
345
  },
@@ -359,7 +350,6 @@ var DefaultTimespan = function DefaultTimespan(_ref10) {
359
350
  React.createElement(
360
351
  Button,
361
352
  {
362
- type: 'button',
363
353
  onClick: closeCustomAmount,
364
354
  className: 'button mini tertiary' },
365
355
  React.createElement(Icon, { icon: 'times' })
@@ -6,8 +6,8 @@ import getByPath from 'lodash/get';
6
6
  * Helper function to get values using currency and timespan
7
7
  */
8
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) {
9
+ values = getByPath(values, '[' + (currency || '').toUpperCase() + ']') || values || [];
10
+ return 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
13
  return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' ? v.amount : v;
@@ -38,10 +38,6 @@ var validate = function validate(_ref) {
38
38
  return !t.newLimit || getByPath(t, 'newLimit.Amount') === getByPath(t, 'currentLimit.Amount');
39
39
  });
40
40
 
41
- var newMonthlyDepositLimit = timespans.find(function (t) {
42
- return getByPath(t, 'newLimit.Type') === 'Deposit' && t.timespan === 30;
43
- });
44
-
45
41
  /**
46
42
  * Compose jurisdictions with rules
47
43
  */
@@ -49,10 +45,10 @@ var validate = function validate(_ref) {
49
45
  return !this['insufficient-limit-count'] && !(this['limit-increase-blocked'] && isIncreasingLimit) && !(this['limit-remove-blocked'] && isRemovingLimit);
50
46
  }), _common);
51
47
  var mga = {};
52
- 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);
48
+ var sga = (_sga = {}, _defineProperty(_sga, 'insufficient-limit-count', type === 'Deposit' && limitCount < 3), _defineProperty(_sga, 'limit-remove-blocked', type === 'Deposit'), _sga);
53
49
  var uk = {};
54
50
  var dga = (_dga = {}, _defineProperty(_dga, 'insufficient-limit-count', type === 'Deposit' && limitCount < 1), _defineProperty(_dga, 'limit-remove-blocked', type === 'Deposit' && limitCount <= 1), _dga);
55
- var es = (_es = {}, _defineProperty(_es, 'insufficient-limit-count', type === 'Deposit' && limitCount < 3), _defineProperty(_es, 'limit-remove-blocked', type === 'Deposit'), _defineProperty(_es, 'limit-increase-blocked', type === 'Deposit' && limitIncreaseInfo.HasDepositLimitIncreaseBlock), _defineProperty(_es, 'support-pending', type === 'Deposit' && limitIncreaseInfo.HasValidPgsiScore && limitIncreaseInfo.RequiresSupportApproval), _defineProperty(_es, 'requires-self-test', isIncreasingLimit && type === 'Deposit' && !limitIncreaseInfo.HasDepositLimitIncreaseBlock), _defineProperty(_es, 'self-test-fail-cooldown', type === 'Deposit' && !limitIncreaseInfo.HasValidPgsiScore && limitIncreaseInfo.HasDepositLimitIncreaseBlock), _es);
51
+ var es = (_es = {}, _defineProperty(_es, 'insufficient-limit-count', type === 'Deposit' && limitCount < 3), _defineProperty(_es, 'limit-remove-blocked', type === 'Deposit'), _defineProperty(_es, 'limit-increase-blocked', type === 'Deposit' && limitIncreaseInfo.HasDepositLimitIncreaseBlock), _defineProperty(_es, 'support-pending', type === 'Deposit' && limitIncreaseInfo.HasValidPgsiScore && limitIncreaseInfo.RequiresSupportApproval), _defineProperty(_es, 'requires-self-test', isIncreasingLimit && type === 'Deposit' && !limitIncreaseInfo.HasValidPgsiScore && !limitIncreaseInfo.HasDepositLimitIncreaseBlock), _defineProperty(_es, 'self-test-fail-cooldown', type === 'Deposit' && !limitIncreaseInfo.HasValidPgsiScore && limitIncreaseInfo.HasDepositLimitIncreaseBlock), _es);
56
52
 
57
53
  switch (jurisdiction) {
58
54
  case 'mga':
@@ -4,9 +4,9 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
4
4
 
5
5
  import React from 'react';
6
6
  import PropTypes from 'prop-types';
7
+ import Checkbox from '../../components/Checkbox';
7
8
  import Select from '../../components/Select';
8
9
  import Input from '../../components/Input';
9
- import Button from '../../components/Button';
10
10
  import Translate from '../../components/Translate';
11
11
 
12
12
  var Settings = function Settings(_ref) {
@@ -32,7 +32,7 @@ var Settings = function Settings(_ref) {
32
32
  return Component && React.createElement(Component, _extends({ key: key }, props, { onChange: onChange }));
33
33
  }),
34
34
  React.createElement(
35
- Button,
35
+ 'button',
36
36
  { onClick: onSave, className: 'button primary' },
37
37
  React.createElement(Translate, { id: 'action.save', defaultMessage: 'Save' })
38
38
  )
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import compose from 'recompose/compose';
3
3
  import { injectIntl } from 'react-intl';
4
4
  import Input from '../../components/Input';
5
+ import Checkbox from '../../components/Checkbox';
5
6
  import ButtonLoader from '../../components/ButtonLoader';
6
7
  import WithValidation from '../../lib/WithValidation';
7
8
  import require from '../../lib/WithValidation/rules/required';
@@ -32,8 +33,7 @@ var SignIn = function SignIn(_ref) {
32
33
  return _onBlur('username', value);
33
34
  },
34
35
  title: translate({ id: 'label.username' }, intl),
35
- status: errors.username && 'failure' || 'idle',
36
- statusText: errors.username && translate({ id: errors.username }, intl),
36
+ error: errors.username && translate({ id: errors.username }, intl),
37
37
  autoFocus: shouldAutoFocus && !email
38
38
  }),
39
39
  React.createElement(Input, {
@@ -45,13 +45,11 @@ var SignIn = function SignIn(_ref) {
45
45
  return _onBlur('password', value);
46
46
  },
47
47
  title: translate({ id: 'label.password' }, intl),
48
- status: errors.password && 'failure' || 'idle',
49
- statusText: errors.password && translate({ id: errors.password }, intl),
48
+ error: errors.password && translate({ id: errors.password }, intl),
50
49
  autoFocus: shouldAutoFocus && email
51
50
  }),
52
- React.createElement(Input, {
51
+ React.createElement(Checkbox, {
53
52
  className: 'layout-item-full-width remember-email-checkbox',
54
- type: 'checkbox',
55
53
  label: translate({
56
54
  id: 'label.remember-email',
57
55
  defaultMessage: 'Remember email'
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import compose from 'recompose/compose';
3
3
  import { injectIntl } from 'react-intl';
4
4
  import Input from '../../components/Input';
5
- import Button from '../../components/Button';
5
+ import Checkbox from '../../components/Checkbox';
6
+ import ButtonLoader from '../../components/ButtonLoader';
6
7
  import WithValidation from '../../lib/WithValidation';
7
8
  import require from '../../lib/WithValidation/rules/required';
8
9
  import translate from '../../lib/utils/translate';
9
- import Icon from '../../components/Icon';
10
10
 
11
11
  var SignIn = function SignIn(_ref) {
12
12
  var errors = _ref.errors,
@@ -29,44 +29,44 @@ var SignIn = function SignIn(_ref) {
29
29
  name: 'username',
30
30
  value: email,
31
31
  onChange: handleChangeEmail,
32
- onBlur: function onBlur() {
33
- return _onBlur('username', email);
32
+ onBlur: function onBlur(value) {
33
+ return _onBlur('username', value);
34
34
  },
35
- label: translate({ id: 'label.username_or_email' }, intl),
35
+ title: translate({ id: 'label.username_or_email' }, intl),
36
+ error: errors.username && translate({ id: errors.username }, intl),
36
37
  autoFocus: shouldAutoFocus && !email,
37
- autoComplete: 'username',
38
- icon: React.createElement(Icon, { icon: 'envelope' }),
39
- status: errors.username && 'failure',
40
- statusText: errors.username && translate({ id: errors.username }, intl)
38
+ autoComplete: 'username'
41
39
  }),
42
40
  React.createElement(Input, {
43
41
  className: 'layout-item-full-width',
44
42
  type: 'password',
45
43
  name: 'password',
46
- label: translate({ id: 'label.password' }, intl),
44
+ showToggleIcon: true,
45
+ onBlur: function onBlur(value) {
46
+ return _onBlur('password', value);
47
+ },
48
+ title: translate({ id: 'label.password' }, intl),
49
+ error: errors.password && translate({ id: errors.password }, intl),
47
50
  autoFocus: shouldAutoFocus && email,
48
- autoComplete: 'current-password',
49
- icon: React.createElement(Icon, { icon: 'lock' }),
50
- status: errors.password && 'failure',
51
- statusText: errors.password && translate({ id: errors.password }, intl)
51
+ autoComplete: 'current-password'
52
52
  }),
53
- React.createElement(Input, {
53
+ React.createElement(Checkbox, {
54
54
  className: 'layout-item-full-width remember-email-checkbox',
55
- type: 'checkbox',
56
- label: translate({
55
+ title: translate({
57
56
  id: 'label.remember-email',
58
57
  defaultMessage: 'Remember email'
59
58
  }, intl),
60
- value: shouldRememberEmail,
59
+ checked: shouldRememberEmail,
61
60
  onChange: handleToggleRememberEmail,
62
61
  name: 'remember-email'
63
62
  }),
64
63
  React.createElement(
65
- Button,
64
+ 'button',
66
65
  {
67
- className: 'button primary wide',
66
+ className: 'button primary wide ' + (isLoading && 'loading'),
68
67
  type: 'submit',
69
- isLoading: !!isLoading },
68
+ disabled: !!isLoading },
69
+ isLoading && React.createElement(ButtonLoader, null),
70
70
  translate({ id: 'action.button.login' }, intl)
71
71
  )
72
72
  );
@@ -12,6 +12,7 @@ import { injectIntl } from 'react-intl';
12
12
  import { range } from 'ramda';
13
13
  import Input from '../../components/Input';
14
14
  import Select from '../../components/Select';
15
+ import Checkbox from '../../components/Checkbox';
15
16
  import WithValidation from '../../lib/WithValidation';
16
17
  import require from '../../lib/WithValidation/rules/required';
17
18
  import number from '../../lib/WithValidation/rules/number';
@@ -267,18 +268,16 @@ var ContactInfo = function (_Component) {
267
268
  },
268
269
  defaultValue: 'Male'
269
270
  }),
270
- React.createElement(Input, {
271
- type: 'checkbox',
272
- label: intl.formatMessage({ id: 'label.terms-of-conditions' }),
271
+ React.createElement(Checkbox, {
272
+ title: intl.formatMessage({ id: 'label.terms-of-conditions' }),
273
273
  name: 'AcceptTerms',
274
274
  onChange: function onChange(e, name, val) {
275
275
  return _onChange(name, val);
276
276
  },
277
277
  error: errors.AcceptTerms && translate({ id: errors.AcceptTerms }, intl)
278
278
  }),
279
- React.createElement(Input, {
280
- type: 'checkbox',
281
- label: intl.formatMessage({
279
+ React.createElement(Checkbox, {
280
+ title: intl.formatMessage({
282
281
  id: 'label.optin.marketing',
283
282
  defaultMessage: 'I want to receive marketing material'
284
283
  }),
@@ -13,31 +13,17 @@ var SportsbookSettings = function SportsbookSettings(_ref) {
13
13
 
14
14
  return React.createElement(
15
15
  'form',
16
- {
17
- onSubmit: onSubmit,
18
- className: cn('SportsbookSettings', 'form', className) },
16
+ { onSubmit: onSubmit, className: cn('SportsbookSettings', className) },
19
17
  Array.isArray(selects) && selects.map(function (s, i) {
20
- return React.createElement(
21
- Select,
22
- {
23
- key: i,
24
- name: s.name,
25
- label: s.title,
26
- value: s.value,
27
- onChange: s.onChange || onChange },
28
- s.placeholder && React.createElement(
29
- Select.Option,
30
- { value: '', selected: true },
31
- s.placeholder
32
- ),
33
- s.options.map(function (o) {
34
- return React.createElement(
35
- Select.Option,
36
- { value: o.value },
37
- o.label
38
- );
39
- })
40
- );
18
+ return React.createElement(Select, {
19
+ key: i,
20
+ name: s.name,
21
+ title: s.title,
22
+ options: s.options,
23
+ value: s.value,
24
+ placeholder: s.placeholder,
25
+ onChange: s.onChange || onChange
26
+ });
41
27
  }),
42
28
  React.createElement(
43
29
  Button,
@@ -12,8 +12,6 @@ import React from 'react';
12
12
  import { injectIntl } from 'react-intl';
13
13
  import PropTypes from 'prop-types';
14
14
  import translate from '../../lib/utils/translate';
15
- import Button from '../../components/Button';
16
- import Input from '../../components/Input';
17
15
 
18
16
  /**
19
17
  * @component Subscriptions
@@ -145,10 +143,10 @@ var Subscriptions = function (_React$Component) {
145
143
  return React.createElement(
146
144
  'div',
147
145
  { key: index, className: 'subscribe-item' },
148
- React.createElement(Input, {
146
+ React.createElement('input', {
149
147
  id: 'newsletter-checkbox-' + index,
150
148
  type: 'checkbox',
151
- value: option.OptIn,
149
+ checked: option.OptIn,
152
150
  onChange: function onChange(e) {
153
151
  return _this3.onClickCheckbox({ e: e, option: option });
154
152
  }
@@ -163,7 +161,7 @@ var Subscriptions = function (_React$Component) {
163
161
  );
164
162
  }),
165
163
  React.createElement(
166
- Button,
164
+ 'button',
167
165
  {
168
166
  className: 'button primary',
169
167
  disabled: isLoading,
@@ -18,6 +18,10 @@ var _marked = require('marked');
18
18
 
19
19
  var _marked2 = _interopRequireDefault(_marked);
20
20
 
21
+ var _Button = require('../../components/Button');
22
+
23
+ var _Button2 = _interopRequireDefault(_Button);
24
+
21
25
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
26
 
23
27
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -41,7 +45,8 @@ var AcceptUpdatedTaC = function (_Component) {
41
45
  var _props = this.props,
42
46
  onAccept = _props.onAccept,
43
47
  termsContent = _props.termsContent,
44
- current = _props.current;
48
+ current = _props.current,
49
+ isLoading = _props.isLoading;
45
50
 
46
51
 
47
52
  return _react2.default.createElement(
@@ -67,8 +72,11 @@ var AcceptUpdatedTaC = function (_Component) {
67
72
  dangerouslySetInnerHTML: { __html: (0, _marked2.default)(termsContent || '') }
68
73
  }),
69
74
  _react2.default.createElement(
70
- 'button',
71
- { className: 'button primary', onClick: onAccept },
75
+ _Button2.default,
76
+ {
77
+ className: 'button primary',
78
+ onClick: onAccept,
79
+ isLoading: isLoading },
72
80
  _react2.default.createElement(_Translate2.default, { id: 'action.accept' })
73
81
  )
74
82
  );
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
+
9
+ var _react = require('react');
10
+
11
+ var _react2 = _interopRequireDefault(_react);
12
+
13
+ var _propTypes = require('prop-types');
14
+
15
+ var _propTypes2 = _interopRequireDefault(_propTypes);
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20
+
21
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
22
+
23
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
24
+
25
+ var Checkbox = function (_React$Component) {
26
+ _inherits(Checkbox, _React$Component);
27
+
28
+ function Checkbox() {
29
+ _classCallCheck(this, Checkbox);
30
+
31
+ return _possibleConstructorReturn(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).apply(this, arguments));
32
+ }
33
+
34
+ _createClass(Checkbox, [{
35
+ key: 'render',
36
+ value: function render() {
37
+ var _props = this.props,
38
+ className = _props.className,
39
+ _onChange = _props.onChange,
40
+ title = _props.title,
41
+ name = _props.name,
42
+ error = _props.error,
43
+ checked = _props.checked;
44
+
45
+ if (!_onChange) {
46
+ throw new Error('You need to provide onChange function');
47
+ }
48
+
49
+ var randomId = Math.floor(Math.random() * 100000);
50
+ var wrapperClassName = 'Checkbox';
51
+
52
+ if (className) {
53
+ wrapperClassName += ' ' + className;
54
+ }
55
+
56
+ return _react2.default.createElement(
57
+ 'div',
58
+ { className: wrapperClassName },
59
+ _react2.default.createElement(
60
+ 'div',
61
+ { className: 'flex' },
62
+ _react2.default.createElement('input', {
63
+ id: 'checkbox-' + randomId,
64
+ type: 'checkbox',
65
+ defaultValue: null,
66
+ defaultChecked: this.props.value === 'true' ? true : false,
67
+ onChange: function onChange(e) {
68
+ _onChange(e, name, e.target.checked ? true : '');
69
+ },
70
+ name: name ? name : '',
71
+ checked: checked
72
+ }),
73
+ !_react2.default.isValidElement(title) ? _react2.default.createElement('label', {
74
+ htmlFor: 'checkbox-' + randomId,
75
+ dangerouslySetInnerHTML: { __html: title }
76
+ }) : _react2.default.createElement(
77
+ 'label',
78
+ { htmlFor: 'checkbox-' + randomId },
79
+ title
80
+ )
81
+ ),
82
+ error && _react2.default.createElement(
83
+ 'p',
84
+ { className: 'error-text' },
85
+ error
86
+ )
87
+ );
88
+ }
89
+ }]);
90
+
91
+ return Checkbox;
92
+ }(_react2.default.Component);
93
+
94
+ Checkbox.propTypes = {
95
+ /** Listens for value changes */
96
+ onChange: _propTypes2.default.func.isRequired,
97
+ /** Title for the checkboxes */
98
+ title: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
99
+ /** Css class name */
100
+ className: _propTypes2.default.string,
101
+ /** Name of the input element */
102
+ name: _propTypes2.default.string,
103
+ /** Errors output */
104
+ error: _propTypes2.default.array
105
+ };
106
+ exports.default = Checkbox;
@@ -54,9 +54,7 @@ var Input = exports.Input = function (_Component) {
54
54
  return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Input.__proto__ || Object.getPrototypeOf(Input)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
55
55
  isFocusing: false
56
56
  }, _this.formatInput = function (value) {
57
- var _this$props = _this.props,
58
- type = _this$props.type,
59
- provider = _this$props.provider;
57
+ var type = _this.props.type;
60
58
 
61
59
 
62
60
  if (!value) {