tg-core-components 5.4.3-bethard → 5.4.5-bethard

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.
@@ -10,7 +10,9 @@ import cn from 'classnames';
10
10
  var PhoneNumberInput = function PhoneNumberInput(props) {
11
11
  var val = props.value || '';
12
12
 
13
- var callingCodeValue = ((props.callingCodes || []).find(function (c) {
13
+ var callingCodeValue = ((props.callingCodes || []).slice().sort(function (a, b) {
14
+ return b.value - a.value;
15
+ }).find(function (c) {
14
16
  return val.startsWith(c.value);
15
17
  }) || (props.callingCodes || [])[0] || {}).value || '';
16
18
  var phoneNumberValue = callingCodeValue ? val.replace(new RegExp('^' + callingCodeValue), '').replace(/^0*/, '') : val;
@@ -540,45 +540,18 @@ var DepositWidget = function (_Component) {
540
540
  var _initialiseProps = function _initialiseProps() {
541
541
  var _this3 = this;
542
542
 
543
- this.componentDidUpdate = function (prevProps) {
544
- if (prevProps.shouldRenderSgaWarning !== _this3.props.shouldRenderSgaWarning) {
545
- var _state2 = _this3.state,
546
- currentAmount = _state2.currentAmount,
547
- bonusCode = _state2.bonusCode;
548
-
549
- _this3.handleNextStep({ amount: currentAmount, bonusCode: bonusCode });
550
- }
551
- };
552
-
553
543
  this.handleNextStep = function (_ref6) {
554
544
  var amount = _ref6.amount,
555
545
  bonusCode = _ref6.bonusCode;
556
- var _state3 = _this3.state,
557
- selectedMethod = _state3.selectedMethod,
558
- preDepositBonus = _state3.preDepositBonus,
559
- selectedAccount = _state3.selectedAccount;
560
- var _props2 = _this3.props,
561
- paymentStats = _props2.paymentStats,
562
- renderSgaWarningPopup = _props2.renderSgaWarningPopup,
563
- shouldRenderSgaWarning = _props2.shouldRenderSgaWarning;
546
+ var _state2 = _this3.state,
547
+ selectedMethod = _state2.selectedMethod,
548
+ preDepositBonus = _state2.preDepositBonus,
549
+ selectedAccount = _state2.selectedAccount;
564
550
 
565
551
 
566
552
  var formExists = !!PaymentAccountForms[getPaymentForm(selectedMethod)];
567
553
  var skipFillInStep = ['skrill', 'bestpay', 'jeton', 'bankiban', 'bankintl'];
568
554
 
569
- var remainingAmount = 5000 - Number(paymentStats.TotalDepositLast7Days);
570
- var renderSgaWarning = shouldRenderSgaWarning && Number(paymentStats.TotalDepositLast7Days) + Number(amount) > 5000;
571
-
572
- if (renderSgaWarning) {
573
- _this3.setState({
574
- buttonLoading: null,
575
- currentAmount: amount,
576
- bonusCode: bonusCode
577
- });
578
- renderSgaWarningPopup(remainingAmount);
579
- return;
580
- }
581
-
582
555
  if (!formExists || selectedAccount.accountId && skipFillInStep.includes(selectedMethod.providerType.toLowerCase())) {
583
556
  return _this3.onSubmit({
584
557
  currentAmount: amount,
@@ -596,9 +569,9 @@ var _initialiseProps = function _initialiseProps() {
596
569
  };
597
570
 
598
571
  this.handleBackStep = function () {
599
- var _state4 = _this3.state,
600
- currentStep = _state4.currentStep,
601
- buttonLoading = _state4.buttonLoading;
572
+ var _state3 = _this3.state,
573
+ currentStep = _state3.currentStep,
574
+ buttonLoading = _state3.buttonLoading;
602
575
 
603
576
 
604
577
  if (buttonLoading === 'fill-in-submit') return null;
@@ -615,13 +588,13 @@ var _initialiseProps = function _initialiseProps() {
615
588
  };
616
589
 
617
590
  this.onSubmit = function (data) {
618
- var _props3 = _this3.props,
619
- onSubmit = _props3.onSubmit,
620
- countries = _props3.countries,
621
- user = _props3.user;
622
- var _state5 = _this3.state,
623
- selectedMethod = _state5.selectedMethod,
624
- swishNumber = _state5.swishNumber;
591
+ var _props2 = _this3.props,
592
+ onSubmit = _props2.onSubmit,
593
+ countries = _props2.countries,
594
+ user = _props2.user;
595
+ var _state4 = _this3.state,
596
+ selectedMethod = _state4.selectedMethod,
597
+ swishNumber = _state4.swishNumber;
625
598
 
626
599
 
627
600
  var submitData = _extends({}, _this3.state, data);
@@ -654,12 +627,12 @@ var _initialiseProps = function _initialiseProps() {
654
627
 
655
628
  this.onSelectMethod = function (_ref7) {
656
629
  var method = _ref7.method;
657
- var _props4 = _this3.props,
658
- currency = _props4.currency,
659
- paymentStats = _props4.paymentStats,
660
- remainingDepositLimit = _props4.remainingDepositLimit,
661
- payments = _props4.payments,
662
- shouldAutoFocus = _props4.shouldAutoFocus;
630
+ var _props3 = _this3.props,
631
+ currency = _props3.currency,
632
+ paymentStats = _props3.paymentStats,
633
+ remainingDepositLimit = _props3.remainingDepositLimit,
634
+ payments = _props3.payments,
635
+ shouldAutoFocus = _props3.shouldAutoFocus;
663
636
 
664
637
 
665
638
  if (shouldAutoFocus) {
@@ -724,9 +697,9 @@ var _initialiseProps = function _initialiseProps() {
724
697
  };
725
698
 
726
699
  this.getMinDepositBonusAmount = function () {
727
- var _props5 = _this3.props,
728
- bonuses = _props5.bonuses,
729
- currency = _props5.currency;
700
+ var _props4 = _this3.props,
701
+ bonuses = _props4.bonuses,
702
+ currency = _props4.currency;
730
703
  var bonusCode = _this3.state.bonusCode;
731
704
 
732
705
 
@@ -749,10 +722,10 @@ var _initialiseProps = function _initialiseProps() {
749
722
  };
750
723
 
751
724
  this.getSpainRemainingDepositAmount = function () {
752
- var _props6 = _this3.props,
753
- jurisdiction = _props6.jurisdiction,
754
- hasIdApproved = _props6.hasIdApproved,
755
- paymentStats = _props6.paymentStats;
725
+ var _props5 = _this3.props,
726
+ jurisdiction = _props5.jurisdiction,
727
+ hasIdApproved = _props5.hasIdApproved,
728
+ paymentStats = _props5.paymentStats;
756
729
 
757
730
  return jurisdiction.toLowerCase() === 'es' && !hasIdApproved && (150 - parseFloat(paymentStats.TotalDeposit) < 0 ? 0 : 150 - parseFloat(paymentStats.TotalDeposit));
758
731
  };
@@ -27,7 +27,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
27
27
  var PhoneNumberInput = function PhoneNumberInput(props) {
28
28
  var val = props.value || '';
29
29
 
30
- var callingCodeValue = ((props.callingCodes || []).find(function (c) {
30
+ var callingCodeValue = ((props.callingCodes || []).slice().sort(function (a, b) {
31
+ return b.value - a.value;
32
+ }).find(function (c) {
31
33
  return val.startsWith(c.value);
32
34
  }) || (props.callingCodes || [])[0] || {}).value || '';
33
35
  var phoneNumberValue = callingCodeValue ? val.replace(new RegExp('^' + callingCodeValue), '').replace(/^0*/, '') : val;
@@ -605,45 +605,18 @@ var DepositWidget = function (_Component) {
605
605
  var _initialiseProps = function _initialiseProps() {
606
606
  var _this3 = this;
607
607
 
608
- this.componentDidUpdate = function (prevProps) {
609
- if (prevProps.shouldRenderSgaWarning !== _this3.props.shouldRenderSgaWarning) {
610
- var _state2 = _this3.state,
611
- currentAmount = _state2.currentAmount,
612
- bonusCode = _state2.bonusCode;
613
-
614
- _this3.handleNextStep({ amount: currentAmount, bonusCode: bonusCode });
615
- }
616
- };
617
-
618
608
  this.handleNextStep = function (_ref6) {
619
609
  var amount = _ref6.amount,
620
610
  bonusCode = _ref6.bonusCode;
621
- var _state3 = _this3.state,
622
- selectedMethod = _state3.selectedMethod,
623
- preDepositBonus = _state3.preDepositBonus,
624
- selectedAccount = _state3.selectedAccount;
625
- var _props2 = _this3.props,
626
- paymentStats = _props2.paymentStats,
627
- renderSgaWarningPopup = _props2.renderSgaWarningPopup,
628
- shouldRenderSgaWarning = _props2.shouldRenderSgaWarning;
611
+ var _state2 = _this3.state,
612
+ selectedMethod = _state2.selectedMethod,
613
+ preDepositBonus = _state2.preDepositBonus,
614
+ selectedAccount = _state2.selectedAccount;
629
615
 
630
616
 
631
617
  var formExists = !!PaymentAccountForms[(0, _Payment.getPaymentForm)(selectedMethod)];
632
618
  var skipFillInStep = ['skrill', 'bestpay', 'jeton', 'bankiban', 'bankintl'];
633
619
 
634
- var remainingAmount = 5000 - Number(paymentStats.TotalDepositLast7Days);
635
- var renderSgaWarning = shouldRenderSgaWarning && Number(paymentStats.TotalDepositLast7Days) + Number(amount) > 5000;
636
-
637
- if (renderSgaWarning) {
638
- _this3.setState({
639
- buttonLoading: null,
640
- currentAmount: amount,
641
- bonusCode: bonusCode
642
- });
643
- renderSgaWarningPopup(remainingAmount);
644
- return;
645
- }
646
-
647
620
  if (!formExists || selectedAccount.accountId && skipFillInStep.includes(selectedMethod.providerType.toLowerCase())) {
648
621
  return _this3.onSubmit({
649
622
  currentAmount: amount,
@@ -661,9 +634,9 @@ var _initialiseProps = function _initialiseProps() {
661
634
  };
662
635
 
663
636
  this.handleBackStep = function () {
664
- var _state4 = _this3.state,
665
- currentStep = _state4.currentStep,
666
- buttonLoading = _state4.buttonLoading;
637
+ var _state3 = _this3.state,
638
+ currentStep = _state3.currentStep,
639
+ buttonLoading = _state3.buttonLoading;
667
640
 
668
641
 
669
642
  if (buttonLoading === 'fill-in-submit') return null;
@@ -680,13 +653,13 @@ var _initialiseProps = function _initialiseProps() {
680
653
  };
681
654
 
682
655
  this.onSubmit = function (data) {
683
- var _props3 = _this3.props,
684
- onSubmit = _props3.onSubmit,
685
- countries = _props3.countries,
686
- user = _props3.user;
687
- var _state5 = _this3.state,
688
- selectedMethod = _state5.selectedMethod,
689
- swishNumber = _state5.swishNumber;
656
+ var _props2 = _this3.props,
657
+ onSubmit = _props2.onSubmit,
658
+ countries = _props2.countries,
659
+ user = _props2.user;
660
+ var _state4 = _this3.state,
661
+ selectedMethod = _state4.selectedMethod,
662
+ swishNumber = _state4.swishNumber;
690
663
 
691
664
 
692
665
  var submitData = _extends({}, _this3.state, data);
@@ -719,12 +692,12 @@ var _initialiseProps = function _initialiseProps() {
719
692
 
720
693
  this.onSelectMethod = function (_ref7) {
721
694
  var method = _ref7.method;
722
- var _props4 = _this3.props,
723
- currency = _props4.currency,
724
- paymentStats = _props4.paymentStats,
725
- remainingDepositLimit = _props4.remainingDepositLimit,
726
- payments = _props4.payments,
727
- shouldAutoFocus = _props4.shouldAutoFocus;
695
+ var _props3 = _this3.props,
696
+ currency = _props3.currency,
697
+ paymentStats = _props3.paymentStats,
698
+ remainingDepositLimit = _props3.remainingDepositLimit,
699
+ payments = _props3.payments,
700
+ shouldAutoFocus = _props3.shouldAutoFocus;
728
701
 
729
702
 
730
703
  if (shouldAutoFocus) {
@@ -789,9 +762,9 @@ var _initialiseProps = function _initialiseProps() {
789
762
  };
790
763
 
791
764
  this.getMinDepositBonusAmount = function () {
792
- var _props5 = _this3.props,
793
- bonuses = _props5.bonuses,
794
- currency = _props5.currency;
765
+ var _props4 = _this3.props,
766
+ bonuses = _props4.bonuses,
767
+ currency = _props4.currency;
795
768
  var bonusCode = _this3.state.bonusCode;
796
769
 
797
770
 
@@ -814,10 +787,10 @@ var _initialiseProps = function _initialiseProps() {
814
787
  };
815
788
 
816
789
  this.getSpainRemainingDepositAmount = function () {
817
- var _props6 = _this3.props,
818
- jurisdiction = _props6.jurisdiction,
819
- hasIdApproved = _props6.hasIdApproved,
820
- paymentStats = _props6.paymentStats;
790
+ var _props5 = _this3.props,
791
+ jurisdiction = _props5.jurisdiction,
792
+ hasIdApproved = _props5.hasIdApproved,
793
+ paymentStats = _props5.paymentStats;
821
794
 
822
795
  return jurisdiction.toLowerCase() === 'es' && !hasIdApproved && (150 - parseFloat(paymentStats.TotalDeposit) < 0 ? 0 : 150 - parseFloat(paymentStats.TotalDeposit));
823
796
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tg-core-components",
3
- "version": "5.4.3-bethard",
3
+ "version": "5.4.5-bethard",
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": "e3a3ebce4ba6585375c613415b1405f6d02a117e"
79
+ "gitHead": "0f1fd60381256a28aa304c18a636b8298b7cb34a"
80
80
  }