tg-core-components 6.0.5 → 6.1.1

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.
@@ -171,7 +171,8 @@ var DepositWidget = function (_Component) {
171
171
  paymentStats = _props.paymentStats,
172
172
  _props$shouldAutoFocu = _props.shouldAutoFocus,
173
173
  shouldAutoFocus = _props$shouldAutoFocu === undefined ? false : _props$shouldAutoFocu,
174
- hideSelectedBonus = _props.hideSelectedBonus;
174
+ hideSelectedBonus = _props.hideSelectedBonus,
175
+ config = _props.config;
175
176
 
176
177
 
177
178
  var accountExclusions = payments.filter(function (provider) {
@@ -426,7 +427,8 @@ var DepositWidget = function (_Component) {
426
427
  account: selectedAccount,
427
428
  method: selectedMethod,
428
429
  detail: selectedMethodDetail,
429
- country: country
430
+ country: country,
431
+ config: config
430
432
  };
431
433
  var PaymentAccountForm = paymentDetail ? paymentDetail.component : null;
432
434
 
@@ -1,13 +1,15 @@
1
1
  import React, { Fragment } from 'react';
2
- import { FormattedNumber } from 'react-intl';
2
+ import { FormattedNumber, useIntl } from 'react-intl';
3
3
  import Icon from '../../../../components/Icon';
4
4
  import Notice from '../Notice';
5
5
  import marked from 'marked';
6
6
  import Translate from '../../../../components/Translate';
7
+ import { getKey } from '../../../../components/Alert';
7
8
 
8
9
  var CashierResult = function CashierResult(_ref) {
9
10
  var status = _ref.status,
10
11
  generalError = _ref.generalError,
12
+ providerType = _ref.providerType,
11
13
  cashierType = _ref.cashierType,
12
14
  currency = _ref.currency,
13
15
  wallet = _ref.wallet,
@@ -18,6 +20,14 @@ var CashierResult = function CashierResult(_ref) {
18
20
  if (wallet && wallet.isLoading) return null;
19
21
 
20
22
  if (status === 'success' || status === 'pending') {
23
+ var intl = useIntl();
24
+
25
+ var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status;
26
+
27
+ if (providerType && intl.messages[messageKey + '.' + providerType]) {
28
+ messageKey = messageKey + '.' + providerType;
29
+ }
30
+
21
31
  return React.createElement(
22
32
  'div',
23
33
  { className: 'cashier-accordion' },
@@ -27,9 +37,7 @@ var CashierResult = function CashierResult(_ref) {
27
37
  React.createElement(Notice, {
28
38
  level: 'success',
29
39
  icon: React.createElement(Icon, { icon: 'check' }),
30
- header: React.createElement(Translate, {
31
- id: 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status
32
- })
40
+ header: React.createElement(Translate, { id: messageKey })
33
41
  }),
34
42
  successMessage && React.createElement(
35
43
  'div',
@@ -1,16 +1,20 @@
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
+
1
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; };
2
4
 
3
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
6
 
5
- import React from 'react';
7
+ import React, { useEffect, useState } from 'react';
6
8
  import { injectIntl } from 'react-intl';
7
9
  import identity from 'lodash/identity';
8
10
  import * as Parser from '../../Payment/PaymentAccountParser';
9
11
  import astroPayBankTransaltions from './astroPayBankTransaltions';
10
12
  import getByPath from 'lodash/get';
13
+ import axios from 'axios';
11
14
  import translate from '../../../../lib/utils/translate';
12
15
  import Input from '../../../../components/Input';
13
16
  import Select from '../../../../components/Select';
17
+ import Loader from '../../../../components/Loader';
14
18
 
15
19
  import Payment from 'payment';
16
20
 
@@ -320,7 +324,34 @@ var AstroPayBank = function AstroPayBank(_ref8) {
320
324
  method = _ref8.method,
321
325
  detail = _ref8.detail,
322
326
  change = _ref8.change,
323
- values = _ref8.values;
327
+ values = _ref8.values,
328
+ config = _ref8.config;
329
+
330
+ var _useState = useState([]),
331
+ _useState2 = _slicedToArray(_useState, 2),
332
+ banks = _useState2[0],
333
+ setBanks = _useState2[1];
334
+
335
+ var _useState3 = useState(false),
336
+ _useState4 = _slicedToArray(_useState3, 2),
337
+ isLoading = _useState4[0],
338
+ setIsLoading = _useState4[1];
339
+
340
+ useEffect(function () {
341
+ setIsLoading(true);
342
+
343
+ axios.post(config.devcode.host + '/directa24/getBanksByCountry', {
344
+ merchantId: config.MERCHANT_ID,
345
+ countryCode: country
346
+ }).then(function (res) {
347
+ var banks = res.data.map(function (bank) {
348
+ return bank.code;
349
+ });
350
+ setBanks(banks);
351
+ }).finally(function () {
352
+ return setIsLoading(false);
353
+ });
354
+ }, []);
324
355
 
325
356
  var translateMap = function translateMap(category) {
326
357
  return function (value) {
@@ -333,12 +364,14 @@ var AstroPayBank = function AstroPayBank(_ref8) {
333
364
 
334
365
  var countryKey = country.toUpperCase();
335
366
  var methodDetails = {
336
- banks: getByPath(detail, 'config[' + countryKey + '].banks'),
367
+ banks: banks.length > 0 ? banks : getByPath(detail, 'config[' + countryKey + '].banks'),
337
368
  idTypes: getByPath(detail, 'config[' + countryKey + '].idTypes'),
338
369
  accountTypes: getByPath(detail, 'config[' + countryKey + '].accountTypes'),
339
370
  services: getByPath(detail, 'config[' + countryKey + '].services')
340
371
  };
341
372
 
373
+ if (isLoading) return React.createElement(Loader, { inline: true });
374
+
342
375
  return React.createElement(
343
376
  'div',
344
377
  null,
@@ -93,7 +93,8 @@ var WithdrawWidget = function (_PureComponent) {
93
93
  initialState = _props.initialState,
94
94
  headers = _props.headers,
95
95
  wallet = _props.wallet,
96
- renderCanceledNotice = _props.renderCanceledNotice;
96
+ renderCanceledNotice = _props.renderCanceledNotice,
97
+ config = _props.config;
97
98
 
98
99
 
99
100
  var accountExclusions = payments.filter(function (provider) {
@@ -263,7 +264,8 @@ var WithdrawWidget = function (_PureComponent) {
263
264
  account: selectedAccount,
264
265
  method: selectedMethod,
265
266
  detail: selectedMethodDetail,
266
- country: country
267
+ country: country,
268
+ config: config
267
269
  };
268
270
  var PaymentAccountForm = paymentDetail ? paymentDetail.component : null;
269
271
 
@@ -26,8 +26,10 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
26
26
  limitIncreaseInfo = _ref.limitIncreaseInfo,
27
27
  jurisdiction = _ref.jurisdiction,
28
28
  currency = _ref.currency,
29
+ onChangeLimits = _ref.onChangeLimits,
29
30
  isLoading = _ref.isLoading,
30
- className = _ref.className;
31
+ className = _ref.className,
32
+ hideSubmit = _ref.hideSubmit;
31
33
 
32
34
  var _useState = useState(limits || []),
33
35
  _useState2 = _slicedToArray(_useState, 2),
@@ -40,6 +42,10 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
40
42
 
41
43
  var normalizedLimits = normalize(localLimits, content);
42
44
 
45
+ useEffect(function () {
46
+ onChangeLimits && onChangeLimits(localLimits);
47
+ }, [localLimits]);
48
+
43
49
  /**
44
50
  * Validate the normalized limits
45
51
  */
@@ -135,6 +141,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
135
141
  React.createElement(LimitContent, _extends({
136
142
  onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
137
143
  onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
144
+ hideSubmit: hideSubmit,
138
145
  onConfirmLimit: onConfirmLimit,
139
146
  onDeclineLimit: onDeclineLimit,
140
147
  getValidationState: getValidationState(normalizedLimits.type),
@@ -175,7 +182,8 @@ var LimitContent = function LimitContent(_ref3) {
175
182
  valueType = _ref3.valueType,
176
183
  hideRemainingLimit = _ref3.hideRemainingLimit,
177
184
  showCurrentValue = _ref3.showCurrentValue,
178
- hideOther = _ref3.hideOther;
185
+ hideOther = _ref3.hideOther,
186
+ hideSubmit = _ref3.hideSubmit;
179
187
 
180
188
  var formIsValid = Object.keys(timespans).every(function (t) {
181
189
  return getValidationState(t).isValid();
@@ -240,7 +248,7 @@ var LimitContent = function LimitContent(_ref3) {
240
248
  hideOther: hideOther
241
249
  }, t));
242
250
  }),
243
- React.createElement(
251
+ !hideSubmit && React.createElement(
244
252
  Button,
245
253
  {
246
254
  type: 'submit',
@@ -236,7 +236,8 @@ var DepositWidget = function (_Component) {
236
236
  paymentStats = _props.paymentStats,
237
237
  _props$shouldAutoFocu = _props.shouldAutoFocus,
238
238
  shouldAutoFocus = _props$shouldAutoFocu === undefined ? false : _props$shouldAutoFocu,
239
- hideSelectedBonus = _props.hideSelectedBonus;
239
+ hideSelectedBonus = _props.hideSelectedBonus,
240
+ config = _props.config;
240
241
 
241
242
 
242
243
  var accountExclusions = payments.filter(function (provider) {
@@ -491,7 +492,8 @@ var DepositWidget = function (_Component) {
491
492
  account: selectedAccount,
492
493
  method: selectedMethod,
493
494
  detail: selectedMethodDetail,
494
- country: country
495
+ country: country,
496
+ config: config
495
497
  };
496
498
  var PaymentAccountForm = paymentDetail ? paymentDetail.component : null;
497
499
 
@@ -26,11 +26,14 @@ var _Translate = require('../../../../components/Translate');
26
26
 
27
27
  var _Translate2 = _interopRequireDefault(_Translate);
28
28
 
29
+ var _Alert = require('../../../../components/Alert');
30
+
29
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
32
 
31
33
  var CashierResult = function CashierResult(_ref) {
32
34
  var status = _ref.status,
33
35
  generalError = _ref.generalError,
36
+ providerType = _ref.providerType,
34
37
  cashierType = _ref.cashierType,
35
38
  currency = _ref.currency,
36
39
  wallet = _ref.wallet,
@@ -41,6 +44,14 @@ var CashierResult = function CashierResult(_ref) {
41
44
  if (wallet && wallet.isLoading) return null;
42
45
 
43
46
  if (status === 'success' || status === 'pending') {
47
+ var intl = (0, _reactIntl.useIntl)();
48
+
49
+ var messageKey = 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status;
50
+
51
+ if (providerType && intl.messages[messageKey + '.' + providerType]) {
52
+ messageKey = messageKey + '.' + providerType;
53
+ }
54
+
44
55
  return _react2.default.createElement(
45
56
  'div',
46
57
  { className: 'cashier-accordion' },
@@ -50,9 +61,7 @@ var CashierResult = function CashierResult(_ref) {
50
61
  _react2.default.createElement(_Notice2.default, {
51
62
  level: 'success',
52
63
  icon: _react2.default.createElement(_Icon2.default, { icon: 'check' }),
53
- header: _react2.default.createElement(_Translate2.default, {
54
- id: 'message.' + (cashierType ? 'deposit' : 'withdrawal') + '.' + status
55
- })
64
+ header: _react2.default.createElement(_Translate2.default, { id: messageKey })
56
65
  }),
57
66
  successMessage && _react2.default.createElement(
58
67
  'div',
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.InteracWithdrawal = exports.PaysafecardWithdrawal = exports.InstadebitWithdrawal = exports.IDebitWithdrawal = exports.IdealWithdrawal = exports.EProPaymentWallWithdrawal = exports.EcoPayzWithdrawal = exports.TrustlyWithdrawal = exports.BankWithdrawal = exports.ZimplerWithdrawal = exports.MiFinityEWalletWithdrawal = exports.EzeeWalletWithdrawal = exports.AstroPayBankWithdrawal = exports.MuchBetterWithdrawal = exports.NetellerWithdrawal = exports.VenusPointWithdrawal = exports.CreditcardWithdrawal = exports.SkrillWithdrawal = exports.BankIBANWithdrawal = exports.BankLocalWithdrawal = exports.JetonWithdrawal = exports.CryptoCurrencyWithdrawal = exports.BestPayWithdrawal = exports.BankIntlWithdrawal = exports.MiFinityEWalletDeposit = exports.BankIntlDeposit = exports.BestPayDeposit = exports.FunangaDeposit = exports.PaysafecardDeposit = exports.InstadebitDeposit = exports.IDebitDeposit = exports.IdealDeposit = exports.EProPaymentWallDeposit = exports.EcoPayzDeposit = exports.TrustlyDeposit = exports.BankDeposit = exports.ZimplerDeposit = exports.EzeeWalletDeposit = exports.CryptoCurrencyDeposit = exports.AstroPayBankDeposit = exports.MobilePayDeposit = exports.PProDeposit = exports.MuchBetterDeposit = exports.SiruDeposit = exports.VenusPointDeposit = exports.NetellerDeposit = exports.CreditcardDeposit = exports.SkrillDeposit = undefined;
7
7
 
8
+ 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"); } }; }();
9
+
8
10
  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; };
9
11
 
10
12
  var _react = require('react');
@@ -29,6 +31,10 @@ var _get = require('lodash/get');
29
31
 
30
32
  var _get2 = _interopRequireDefault(_get);
31
33
 
34
+ var _axios = require('axios');
35
+
36
+ var _axios2 = _interopRequireDefault(_axios);
37
+
32
38
  var _translate = require('../../../../lib/utils/translate');
33
39
 
34
40
  var _translate2 = _interopRequireDefault(_translate);
@@ -41,6 +47,10 @@ var _Select = require('../../../../components/Select');
41
47
 
42
48
  var _Select2 = _interopRequireDefault(_Select);
43
49
 
50
+ var _Loader = require('../../../../components/Loader');
51
+
52
+ var _Loader2 = _interopRequireDefault(_Loader);
53
+
44
54
  var _payment = require('payment');
45
55
 
46
56
  var _payment2 = _interopRequireDefault(_payment);
@@ -357,7 +367,34 @@ var AstroPayBank = function AstroPayBank(_ref8) {
357
367
  method = _ref8.method,
358
368
  detail = _ref8.detail,
359
369
  change = _ref8.change,
360
- values = _ref8.values;
370
+ values = _ref8.values,
371
+ config = _ref8.config;
372
+
373
+ var _useState = (0, _react.useState)([]),
374
+ _useState2 = _slicedToArray(_useState, 2),
375
+ banks = _useState2[0],
376
+ setBanks = _useState2[1];
377
+
378
+ var _useState3 = (0, _react.useState)(false),
379
+ _useState4 = _slicedToArray(_useState3, 2),
380
+ isLoading = _useState4[0],
381
+ setIsLoading = _useState4[1];
382
+
383
+ (0, _react.useEffect)(function () {
384
+ setIsLoading(true);
385
+
386
+ _axios2.default.post(config.devcode.host + '/directa24/getBanksByCountry', {
387
+ merchantId: config.MERCHANT_ID,
388
+ countryCode: country
389
+ }).then(function (res) {
390
+ var banks = res.data.map(function (bank) {
391
+ return bank.code;
392
+ });
393
+ setBanks(banks);
394
+ }).finally(function () {
395
+ return setIsLoading(false);
396
+ });
397
+ }, []);
361
398
 
362
399
  var translateMap = function translateMap(category) {
363
400
  return function (value) {
@@ -370,12 +407,14 @@ var AstroPayBank = function AstroPayBank(_ref8) {
370
407
 
371
408
  var countryKey = country.toUpperCase();
372
409
  var methodDetails = {
373
- banks: (0, _get2.default)(detail, 'config[' + countryKey + '].banks'),
410
+ banks: banks.length > 0 ? banks : (0, _get2.default)(detail, 'config[' + countryKey + '].banks'),
374
411
  idTypes: (0, _get2.default)(detail, 'config[' + countryKey + '].idTypes'),
375
412
  accountTypes: (0, _get2.default)(detail, 'config[' + countryKey + '].accountTypes'),
376
413
  services: (0, _get2.default)(detail, 'config[' + countryKey + '].services')
377
414
  };
378
415
 
416
+ if (isLoading) return _react2.default.createElement(_Loader2.default, { inline: true });
417
+
379
418
  return _react2.default.createElement(
380
419
  'div',
381
420
  null,
@@ -150,7 +150,8 @@ var WithdrawWidget = function (_PureComponent) {
150
150
  initialState = _props.initialState,
151
151
  headers = _props.headers,
152
152
  wallet = _props.wallet,
153
- renderCanceledNotice = _props.renderCanceledNotice;
153
+ renderCanceledNotice = _props.renderCanceledNotice,
154
+ config = _props.config;
154
155
 
155
156
 
156
157
  var accountExclusions = payments.filter(function (provider) {
@@ -320,7 +321,8 @@ var WithdrawWidget = function (_PureComponent) {
320
321
  account: selectedAccount,
321
322
  method: selectedMethod,
322
323
  detail: selectedMethodDetail,
323
- country: country
324
+ country: country,
325
+ config: config
324
326
  };
325
327
  var PaymentAccountForm = paymentDetail ? paymentDetail.component : null;
326
328
 
@@ -68,8 +68,10 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
68
68
  limitIncreaseInfo = _ref.limitIncreaseInfo,
69
69
  jurisdiction = _ref.jurisdiction,
70
70
  currency = _ref.currency,
71
+ onChangeLimits = _ref.onChangeLimits,
71
72
  isLoading = _ref.isLoading,
72
- className = _ref.className;
73
+ className = _ref.className,
74
+ hideSubmit = _ref.hideSubmit;
73
75
 
74
76
  var _useState = (0, _react.useState)(limits || []),
75
77
  _useState2 = _slicedToArray(_useState, 2),
@@ -82,6 +84,10 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
82
84
 
83
85
  var normalizedLimits = (0, _normalize2.default)(localLimits, content);
84
86
 
87
+ (0, _react.useEffect)(function () {
88
+ onChangeLimits && onChangeLimits(localLimits);
89
+ }, [localLimits]);
90
+
85
91
  /**
86
92
  * Validate the normalized limits
87
93
  */
@@ -177,6 +183,7 @@ var ResponsibleGaming = function ResponsibleGaming(_ref) {
177
183
  _react2.default.createElement(LimitContent, _extends({
178
184
  onSubmitLimits: onSubmitLimits(normalizedLimits.type, normalizedLimits.product),
179
185
  onChangeLimit: onChangeLimit(normalizedLimits.type, normalizedLimits.product),
186
+ hideSubmit: hideSubmit,
180
187
  onConfirmLimit: onConfirmLimit,
181
188
  onDeclineLimit: onDeclineLimit,
182
189
  getValidationState: getValidationState(normalizedLimits.type),
@@ -217,7 +224,8 @@ var LimitContent = function LimitContent(_ref3) {
217
224
  valueType = _ref3.valueType,
218
225
  hideRemainingLimit = _ref3.hideRemainingLimit,
219
226
  showCurrentValue = _ref3.showCurrentValue,
220
- hideOther = _ref3.hideOther;
227
+ hideOther = _ref3.hideOther,
228
+ hideSubmit = _ref3.hideSubmit;
221
229
 
222
230
  var formIsValid = Object.keys(timespans).every(function (t) {
223
231
  return getValidationState(t).isValid();
@@ -282,7 +290,7 @@ var LimitContent = function LimitContent(_ref3) {
282
290
  hideOther: hideOther
283
291
  }, t));
284
292
  }),
285
- _react2.default.createElement(
293
+ !hideSubmit && _react2.default.createElement(
286
294
  _Button2.default,
287
295
  {
288
296
  type: 'submit',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "6.0.5",
3
+ "version": "6.1.1",
4
4
  "description": "tg-core-components",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -76,5 +76,5 @@
76
76
  "webpack": "^3.0.0",
77
77
  "webpack-blocks": "^1.0.0"
78
78
  },
79
- "gitHead": "376f83774543ad0744a20cf4eaa2e93970763764"
79
+ "gitHead": "747e8f43202add17f5cf667c5d4cfa9834c70bdf"
80
80
  }