@depay/widgets 6.4.0 → 6.5.0

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.
@@ -71511,15 +71511,15 @@ var SelectTokenDialog = (function (props) {
71511
71511
  var _useContext3 = react.useContext(SelectionContext),
71512
71512
  setSelection = _useContext3.setSelection;
71513
71513
 
71514
- var _useState = react.useState(Blockchain.findByName('ethereum')),
71514
+ var _useState = react.useState(),
71515
71515
  _useState2 = _slicedToArray(_useState, 2),
71516
- blockchain = _useState2[0],
71517
- setBlockchain = _useState2[1];
71516
+ requestController = _useState2[0],
71517
+ setRequestController = _useState2[1];
71518
71518
 
71519
71519
  var _useState3 = react.useState(),
71520
71520
  _useState4 = _slicedToArray(_useState3, 2),
71521
- requestController = _useState4[0],
71522
- setRequestController = _useState4[1];
71521
+ blockchain = _useState4[0],
71522
+ setBlockchain = _useState4[1];
71523
71523
 
71524
71524
  var _useState5 = react.useState(false),
71525
71525
  _useState6 = _slicedToArray(_useState5, 2),
@@ -71537,21 +71537,41 @@ var SelectTokenDialog = (function (props) {
71537
71537
  _useState10[1];
71538
71538
 
71539
71539
  var searchElement = react.useRef();
71540
+ var wallet = getWallet();
71540
71541
  react.useEffect(function () {
71541
- setSelection(Object.assign(props.selection, {
71542
- blockchain: blockchain,
71543
- token: undefined
71544
- }));
71542
+ var blockchain;
71543
+
71544
+ if (wallet) {
71545
+ wallet.connectedTo().then(function (name) {
71546
+ blockchain = Blockchain.findByName(name);
71547
+ setBlockchain(blockchain);
71548
+ setSelection(Object.assign(props.selection, {
71549
+ blockchain: blockchain,
71550
+ token: undefined
71551
+ }));
71552
+ setTokens(blockchain.tokens);
71553
+ });
71554
+ } else {
71555
+ blockchain = Blockchain.findByName('ethereum');
71556
+ setBlockchain(blockchain);
71557
+ setSelection(Object.assign(props.selection, {
71558
+ blockchain: blockchain,
71559
+ token: undefined
71560
+ }));
71561
+ setTokens(blockchain.tokens);
71562
+ }
71545
71563
  }, []);
71546
71564
  react.useEffect(function () {
71547
- setBlockchain(props.selection.blockchain);
71548
- setTokens(props.selection.blockchain.tokens);
71565
+ if (props.selection.blockchain) {
71566
+ setBlockchain(props.selection.blockchain);
71567
+ setTokens(props.selection.blockchain.tokens);
71549
71568
 
71550
- if (searchElement.current) {
71551
- searchElement.current.value = '';
71552
- searchElement.current.focus();
71569
+ if (searchElement.current) {
71570
+ searchElement.current.value = '';
71571
+ searchElement.current.focus();
71572
+ }
71553
71573
  }
71554
- }, [props.selection.blockchain]);
71574
+ }, [props.selection, props.selection.blockchain]);
71555
71575
 
71556
71576
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
71557
71577
  navigate('SelectBlockchain');
@@ -71620,7 +71640,7 @@ var SelectTokenDialog = (function (props) {
71620
71640
  }
71621
71641
  })["catch"](function () {});
71622
71642
  } else {
71623
- setTokens(props.selection.blockchain.tokens);
71643
+ setTokens(blockchain.tokens);
71624
71644
  }
71625
71645
  };
71626
71646
 
@@ -71677,7 +71697,7 @@ var SelectTokenDialog = (function (props) {
71677
71697
  }, token.name))));
71678
71698
  });
71679
71699
 
71680
- if (props.selection.blockchain == undefined) {
71700
+ if (blockchain == undefined) {
71681
71701
  return null;
71682
71702
  }
71683
71703
 
@@ -71695,10 +71715,10 @@ var SelectTokenDialog = (function (props) {
71695
71715
  className: "CardImage small"
71696
71716
  }, /*#__PURE__*/react.createElement("img", {
71697
71717
  className: "transparent",
71698
- src: props.selection.blockchain.logo
71718
+ src: blockchain.logo
71699
71719
  })), /*#__PURE__*/react.createElement("div", {
71700
71720
  className: "CardBody"
71701
- }, props.selection.blockchain.label), /*#__PURE__*/react.createElement("div", {
71721
+ }, blockchain.label), /*#__PURE__*/react.createElement("div", {
71702
71722
  className: "CardAction"
71703
71723
  }, /*#__PURE__*/react.createElement(ChevronRight, null)))), /*#__PURE__*/react.createElement("div", {
71704
71724
  className: "PaddingTopXS PaddingBottomS"
package/dist/esm/index.js CHANGED
@@ -4888,15 +4888,15 @@ var SelectTokenDialog = (function (props) {
4888
4888
  var _useContext3 = useContext(SelectionContext),
4889
4889
  setSelection = _useContext3.setSelection;
4890
4890
 
4891
- var _useState = useState(Blockchain.findByName('ethereum')),
4891
+ var _useState = useState(),
4892
4892
  _useState2 = _slicedToArray(_useState, 2),
4893
- blockchain = _useState2[0],
4894
- setBlockchain = _useState2[1];
4893
+ requestController = _useState2[0],
4894
+ setRequestController = _useState2[1];
4895
4895
 
4896
4896
  var _useState3 = useState(),
4897
4897
  _useState4 = _slicedToArray(_useState3, 2),
4898
- requestController = _useState4[0],
4899
- setRequestController = _useState4[1];
4898
+ blockchain = _useState4[0],
4899
+ setBlockchain = _useState4[1];
4900
4900
 
4901
4901
  var _useState5 = useState(false),
4902
4902
  _useState6 = _slicedToArray(_useState5, 2),
@@ -4914,21 +4914,41 @@ var SelectTokenDialog = (function (props) {
4914
4914
  _useState10[1];
4915
4915
 
4916
4916
  var searchElement = useRef();
4917
+ var wallet = getWallet();
4917
4918
  useEffect(function () {
4918
- setSelection(Object.assign(props.selection, {
4919
- blockchain: blockchain,
4920
- token: undefined
4921
- }));
4919
+ var blockchain;
4920
+
4921
+ if (wallet) {
4922
+ wallet.connectedTo().then(function (name) {
4923
+ blockchain = Blockchain.findByName(name);
4924
+ setBlockchain(blockchain);
4925
+ setSelection(Object.assign(props.selection, {
4926
+ blockchain: blockchain,
4927
+ token: undefined
4928
+ }));
4929
+ setTokens(blockchain.tokens);
4930
+ });
4931
+ } else {
4932
+ blockchain = Blockchain.findByName('ethereum');
4933
+ setBlockchain(blockchain);
4934
+ setSelection(Object.assign(props.selection, {
4935
+ blockchain: blockchain,
4936
+ token: undefined
4937
+ }));
4938
+ setTokens(blockchain.tokens);
4939
+ }
4922
4940
  }, []);
4923
4941
  useEffect(function () {
4924
- setBlockchain(props.selection.blockchain);
4925
- setTokens(props.selection.blockchain.tokens);
4942
+ if (props.selection.blockchain) {
4943
+ setBlockchain(props.selection.blockchain);
4944
+ setTokens(props.selection.blockchain.tokens);
4926
4945
 
4927
- if (searchElement.current) {
4928
- searchElement.current.value = '';
4929
- searchElement.current.focus();
4946
+ if (searchElement.current) {
4947
+ searchElement.current.value = '';
4948
+ searchElement.current.focus();
4949
+ }
4930
4950
  }
4931
- }, [props.selection.blockchain]);
4951
+ }, [props.selection, props.selection.blockchain]);
4932
4952
 
4933
4953
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
4934
4954
  navigate('SelectBlockchain');
@@ -4997,7 +5017,7 @@ var SelectTokenDialog = (function (props) {
4997
5017
  }
4998
5018
  })["catch"](function () {});
4999
5019
  } else {
5000
- setTokens(props.selection.blockchain.tokens);
5020
+ setTokens(blockchain.tokens);
5001
5021
  }
5002
5022
  };
5003
5023
 
@@ -5054,7 +5074,7 @@ var SelectTokenDialog = (function (props) {
5054
5074
  }, token.name))));
5055
5075
  });
5056
5076
 
5057
- if (props.selection.blockchain == undefined) {
5077
+ if (blockchain == undefined) {
5058
5078
  return null;
5059
5079
  }
5060
5080
 
@@ -5072,10 +5092,10 @@ var SelectTokenDialog = (function (props) {
5072
5092
  className: "CardImage small"
5073
5093
  }, /*#__PURE__*/React.createElement("img", {
5074
5094
  className: "transparent",
5075
- src: props.selection.blockchain.logo
5095
+ src: blockchain.logo
5076
5096
  })), /*#__PURE__*/React.createElement("div", {
5077
5097
  className: "CardBody"
5078
- }, props.selection.blockchain.label), /*#__PURE__*/React.createElement("div", {
5098
+ }, blockchain.label), /*#__PURE__*/React.createElement("div", {
5079
5099
  className: "CardAction"
5080
5100
  }, /*#__PURE__*/React.createElement(ChevronRight, null)))), /*#__PURE__*/React.createElement("div", {
5081
5101
  className: "PaddingTopXS PaddingBottomS"
@@ -71517,15 +71517,15 @@
71517
71517
  var _useContext3 = react.useContext(SelectionContext),
71518
71518
  setSelection = _useContext3.setSelection;
71519
71519
 
71520
- var _useState = react.useState(Blockchain.findByName('ethereum')),
71520
+ var _useState = react.useState(),
71521
71521
  _useState2 = _slicedToArray(_useState, 2),
71522
- blockchain = _useState2[0],
71523
- setBlockchain = _useState2[1];
71522
+ requestController = _useState2[0],
71523
+ setRequestController = _useState2[1];
71524
71524
 
71525
71525
  var _useState3 = react.useState(),
71526
71526
  _useState4 = _slicedToArray(_useState3, 2),
71527
- requestController = _useState4[0],
71528
- setRequestController = _useState4[1];
71527
+ blockchain = _useState4[0],
71528
+ setBlockchain = _useState4[1];
71529
71529
 
71530
71530
  var _useState5 = react.useState(false),
71531
71531
  _useState6 = _slicedToArray(_useState5, 2),
@@ -71543,21 +71543,41 @@
71543
71543
  _useState10[1];
71544
71544
 
71545
71545
  var searchElement = react.useRef();
71546
+ var wallet = getWallet();
71546
71547
  react.useEffect(function () {
71547
- setSelection(Object.assign(props.selection, {
71548
- blockchain: blockchain,
71549
- token: undefined
71550
- }));
71548
+ var blockchain;
71549
+
71550
+ if (wallet) {
71551
+ wallet.connectedTo().then(function (name) {
71552
+ blockchain = Blockchain.findByName(name);
71553
+ setBlockchain(blockchain);
71554
+ setSelection(Object.assign(props.selection, {
71555
+ blockchain: blockchain,
71556
+ token: undefined
71557
+ }));
71558
+ setTokens(blockchain.tokens);
71559
+ });
71560
+ } else {
71561
+ blockchain = Blockchain.findByName('ethereum');
71562
+ setBlockchain(blockchain);
71563
+ setSelection(Object.assign(props.selection, {
71564
+ blockchain: blockchain,
71565
+ token: undefined
71566
+ }));
71567
+ setTokens(blockchain.tokens);
71568
+ }
71551
71569
  }, []);
71552
71570
  react.useEffect(function () {
71553
- setBlockchain(props.selection.blockchain);
71554
- setTokens(props.selection.blockchain.tokens);
71571
+ if (props.selection.blockchain) {
71572
+ setBlockchain(props.selection.blockchain);
71573
+ setTokens(props.selection.blockchain.tokens);
71555
71574
 
71556
- if (searchElement.current) {
71557
- searchElement.current.value = '';
71558
- searchElement.current.focus();
71575
+ if (searchElement.current) {
71576
+ searchElement.current.value = '';
71577
+ searchElement.current.focus();
71578
+ }
71559
71579
  }
71560
- }, [props.selection.blockchain]);
71580
+ }, [props.selection, props.selection.blockchain]);
71561
71581
 
71562
71582
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
71563
71583
  navigate('SelectBlockchain');
@@ -71626,7 +71646,7 @@
71626
71646
  }
71627
71647
  })["catch"](function () {});
71628
71648
  } else {
71629
- setTokens(props.selection.blockchain.tokens);
71649
+ setTokens(blockchain.tokens);
71630
71650
  }
71631
71651
  };
71632
71652
 
@@ -71683,7 +71703,7 @@
71683
71703
  }, token.name))));
71684
71704
  });
71685
71705
 
71686
- if (props.selection.blockchain == undefined) {
71706
+ if (blockchain == undefined) {
71687
71707
  return null;
71688
71708
  }
71689
71709
 
@@ -71701,10 +71721,10 @@
71701
71721
  className: "CardImage small"
71702
71722
  }, /*#__PURE__*/react.createElement("img", {
71703
71723
  className: "transparent",
71704
- src: props.selection.blockchain.logo
71724
+ src: blockchain.logo
71705
71725
  })), /*#__PURE__*/react.createElement("div", {
71706
71726
  className: "CardBody"
71707
- }, props.selection.blockchain.label), /*#__PURE__*/react.createElement("div", {
71727
+ }, blockchain.label), /*#__PURE__*/react.createElement("div", {
71708
71728
  className: "CardAction"
71709
71729
  }, /*#__PURE__*/react.createElement(ChevronRight, null)))), /*#__PURE__*/react.createElement("div", {
71710
71730
  className: "PaddingTopXS PaddingBottomS"
package/dist/umd/index.js CHANGED
@@ -4883,15 +4883,15 @@
4883
4883
  var _useContext3 = React.useContext(SelectionContext),
4884
4884
  setSelection = _useContext3.setSelection;
4885
4885
 
4886
- var _useState = React.useState(web3Blockchains.Blockchain.findByName('ethereum')),
4886
+ var _useState = React.useState(),
4887
4887
  _useState2 = _slicedToArray(_useState, 2),
4888
- blockchain = _useState2[0],
4889
- setBlockchain = _useState2[1];
4888
+ requestController = _useState2[0],
4889
+ setRequestController = _useState2[1];
4890
4890
 
4891
4891
  var _useState3 = React.useState(),
4892
4892
  _useState4 = _slicedToArray(_useState3, 2),
4893
- requestController = _useState4[0],
4894
- setRequestController = _useState4[1];
4893
+ blockchain = _useState4[0],
4894
+ setBlockchain = _useState4[1];
4895
4895
 
4896
4896
  var _useState5 = React.useState(false),
4897
4897
  _useState6 = _slicedToArray(_useState5, 2),
@@ -4909,21 +4909,41 @@
4909
4909
  _useState10[1];
4910
4910
 
4911
4911
  var searchElement = React.useRef();
4912
+ var wallet = web3Wallets.getWallet();
4912
4913
  React.useEffect(function () {
4913
- setSelection(Object.assign(props.selection, {
4914
- blockchain: blockchain,
4915
- token: undefined
4916
- }));
4914
+ var blockchain;
4915
+
4916
+ if (wallet) {
4917
+ wallet.connectedTo().then(function (name) {
4918
+ blockchain = web3Blockchains.Blockchain.findByName(name);
4919
+ setBlockchain(blockchain);
4920
+ setSelection(Object.assign(props.selection, {
4921
+ blockchain: blockchain,
4922
+ token: undefined
4923
+ }));
4924
+ setTokens(blockchain.tokens);
4925
+ });
4926
+ } else {
4927
+ blockchain = web3Blockchains.Blockchain.findByName('ethereum');
4928
+ setBlockchain(blockchain);
4929
+ setSelection(Object.assign(props.selection, {
4930
+ blockchain: blockchain,
4931
+ token: undefined
4932
+ }));
4933
+ setTokens(blockchain.tokens);
4934
+ }
4917
4935
  }, []);
4918
4936
  React.useEffect(function () {
4919
- setBlockchain(props.selection.blockchain);
4920
- setTokens(props.selection.blockchain.tokens);
4937
+ if (props.selection.blockchain) {
4938
+ setBlockchain(props.selection.blockchain);
4939
+ setTokens(props.selection.blockchain.tokens);
4921
4940
 
4922
- if (searchElement.current) {
4923
- searchElement.current.value = '';
4924
- searchElement.current.focus();
4941
+ if (searchElement.current) {
4942
+ searchElement.current.value = '';
4943
+ searchElement.current.focus();
4944
+ }
4925
4945
  }
4926
- }, [props.selection.blockchain]);
4946
+ }, [props.selection, props.selection.blockchain]);
4927
4947
 
4928
4948
  var onClickChangeBlockchain = function onClickChangeBlockchain() {
4929
4949
  navigate('SelectBlockchain');
@@ -4992,7 +5012,7 @@
4992
5012
  }
4993
5013
  })["catch"](function () {});
4994
5014
  } else {
4995
- setTokens(props.selection.blockchain.tokens);
5015
+ setTokens(blockchain.tokens);
4996
5016
  }
4997
5017
  };
4998
5018
 
@@ -5049,7 +5069,7 @@
5049
5069
  }, token.name))));
5050
5070
  });
5051
5071
 
5052
- if (props.selection.blockchain == undefined) {
5072
+ if (blockchain == undefined) {
5053
5073
  return null;
5054
5074
  }
5055
5075
 
@@ -5067,10 +5087,10 @@
5067
5087
  className: "CardImage small"
5068
5088
  }, /*#__PURE__*/React__default["default"].createElement("img", {
5069
5089
  className: "transparent",
5070
- src: props.selection.blockchain.logo
5090
+ src: blockchain.logo
5071
5091
  })), /*#__PURE__*/React__default["default"].createElement("div", {
5072
5092
  className: "CardBody"
5073
- }, props.selection.blockchain.label), /*#__PURE__*/React__default["default"].createElement("div", {
5093
+ }, blockchain.label), /*#__PURE__*/React__default["default"].createElement("div", {
5074
5094
  className: "CardAction"
5075
5095
  }, /*#__PURE__*/React__default["default"].createElement(ChevronRight, null)))), /*#__PURE__*/React__default["default"].createElement("div", {
5076
5096
  className: "PaddingTopXS PaddingBottomS"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "6.4.0",
4
+ "version": "6.5.0",
5
5
  "description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
6
6
  "main": "./dist/umd/index.js",
7
7
  "module": "./dist/esm/index.js",