@depay/widgets 6.28.1 → 6.28.5

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.
@@ -49881,7 +49881,7 @@ var PaddingStyle = (function () {
49881
49881
  });
49882
49882
 
49883
49883
  var PoweredByStyle = (function (style) {
49884
- return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
49884
+ return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .contained .PoweredByWrapper {\n position: absolute;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
49885
49885
  });
49886
49886
 
49887
49887
  var RangeSliderStyle = (function (style) {
@@ -62159,6 +62159,10 @@ var ChangableAmountProvider = (function (props) {
62159
62159
  }));
62160
62160
  } else {
62161
62161
  Promise.all(props.accept.map(function (configuration) {
62162
+ if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
62163
+ return 1.00 / conversionRate;
62164
+ }
62165
+
62162
62166
  return route$8({
62163
62167
  blockchain: configuration.blockchain,
62164
62168
  tokenIn: CONSTANTS$2[configuration.blockchain].USD,
@@ -62167,17 +62171,19 @@ var ChangableAmountProvider = (function (props) {
62167
62171
  fromAddress: account,
62168
62172
  toAddress: account
62169
62173
  });
62170
- })).then(function (routes) {
62171
- Promise.all(routes.map(function (routes, index) {
62172
- if (routes[0] == undefined) {
62174
+ })).then(function (results) {
62175
+ Promise.all(results.map(function (result, index) {
62176
+ if (typeof result == 'number') {
62177
+ return result;
62178
+ } else if (result[0] == undefined) {
62173
62179
  return;
62180
+ } else {
62181
+ return Token.readable({
62182
+ blockchain: props.accept[index].blockchain,
62183
+ amount: result[0].amountOut,
62184
+ address: result[0].tokenOut
62185
+ });
62174
62186
  }
62175
-
62176
- return Token.readable({
62177
- blockchain: props.accept[index].blockchain,
62178
- amount: routes[0].amountOut,
62179
- address: routes[0].tokenOut
62180
- });
62181
62187
  })).then(resolve)["catch"](setError);
62182
62188
  })["catch"](setError);
62183
62189
  }
@@ -68147,7 +68153,7 @@ let subtractFee = ({ amount, paymentRoute, fee })=> {
68147
68153
 
68148
68154
  let transactionFeeAmount = ({ paymentRoute, fee })=> {
68149
68155
  if(typeof fee.amount == 'string' && fee.amount.match('%')) {
68150
- return BigNumber.from(paymentRoute.toAmount).div(100).mul(parseFloat(fee.amount)).toString()
68156
+ return BigNumber.from(paymentRoute.toAmount).div(1000).mul(parseFloat(fee.amount)*10).toString()
68151
68157
  } else if(typeof fee.amount == 'string') {
68152
68158
  return fee.amount
68153
68159
  } else if(typeof fee.amount == 'number') {
@@ -85498,6 +85504,10 @@ function assetsToRoutes({ assets, blacklist, accept, from, event, fee }) {
85498
85504
  }
85499
85505
 
85500
85506
  function route({ accept, from, whitelist, blacklist, event, fee, update }) {
85507
+ if(fee && fee.amount && typeof(fee.amount) == 'string' && fee.amount.match(/\.\d\d+\%/)) {
85508
+ throw('Only up to 1 decimal is supported for fee amounts!')
85509
+ }
85510
+
85501
85511
  return new Promise(async (resolveAll, rejectAll)=>{
85502
85512
 
85503
85513
  let priority = [];
@@ -85810,8 +85820,6 @@ var PaymentRoutingProvider = (function (props) {
85810
85820
  recover = _useContext3.recover;
85811
85821
 
85812
85822
  var onRoutesUpdate = function onRoutesUpdate(routes) {
85813
- console.log('routes', routes);
85814
-
85815
85823
  if (routes.length == 0) {
85816
85824
  setAllRoutes([]);
85817
85825
 
@@ -89524,7 +89532,7 @@ var PaymentOverviewSkeleton = (function (props) {
89524
89532
  className: "SkeletonBackground"
89525
89533
  }))), selectedRoute == undefined && slowRouting && /*#__PURE__*/react.createElement("div", {
89526
89534
  className: "TextCenter Opacity05 PaddingTopS"
89527
- }, /*#__PURE__*/react.createElement("strong", null, "Still loading your wallet balances...")))
89535
+ }, /*#__PURE__*/react.createElement("strong", null, "Loading payment routes...")))
89528
89536
  });
89529
89537
  });
89530
89538
 
@@ -89955,13 +89963,22 @@ var SaleOverviewDialog = (function (props) {
89955
89963
  setSalePerTokenValue = _useState2[1];
89956
89964
 
89957
89965
  react.useEffect(function () {
89958
- if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true)) {
89959
- setSalePerTokenValue(new Currency({
89960
- amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
89966
+ if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true) && toTokenReadableAmount) {
89967
+ var UsdAmountPerToken = paymentValue.amount / parseFloat(toTokenReadableAmount);
89968
+ var readableLocalizedAmountPerToken = new Currency({
89969
+ amount: UsdAmountPerToken,
89970
+ code: paymentValue.code
89971
+ }).toString();
89972
+ var zero = new Currency({
89973
+ amount: 0,
89961
89974
  code: paymentValue.code
89962
- }).toString());
89975
+ }).toString();
89976
+
89977
+ if (readableLocalizedAmountPerToken != zero) {
89978
+ setSalePerTokenValue(readableLocalizedAmountPerToken);
89979
+ }
89963
89980
  }
89964
- }, [paymentValue]);
89981
+ }, [paymentValue, toTokenReadableAmount]);
89965
89982
 
89966
89983
  if (toToken == undefined || toTokenReadableAmount == undefined || payment == undefined || paymentValue == undefined) {
89967
89984
  return /*#__PURE__*/react.createElement(SaleOverviewSkeleton, null);
@@ -107855,7 +107872,7 @@ var SelectTokenDialog = (function (props) {
107855
107872
  className: "Tooltip"
107856
107873
  }, /*#__PURE__*/react.createElement("span", {
107857
107874
  className: "TooltipArrowUp"
107858
- }), "Paste or enter token address here!")))),
107875
+ }), "Enter token address here")))),
107859
107876
  bodyClassName: "ScrollHeight",
107860
107877
  body: /*#__PURE__*/react.createElement("div", {
107861
107878
  className: ""
package/dist/esm/index.js CHANGED
@@ -1742,7 +1742,7 @@ var PaddingStyle = (function () {
1742
1742
  });
1743
1743
 
1744
1744
  var PoweredByStyle = (function (style) {
1745
- return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
1745
+ return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .contained .PoweredByWrapper {\n position: absolute;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
1746
1746
  });
1747
1747
 
1748
1748
  var RangeSliderStyle = (function (style) {
@@ -2107,6 +2107,10 @@ var ChangableAmountProvider = (function (props) {
2107
2107
  }));
2108
2108
  } else {
2109
2109
  Promise.all(props.accept.map(function (configuration) {
2110
+ if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
2111
+ return 1.00 / conversionRate;
2112
+ }
2113
+
2110
2114
  return route({
2111
2115
  blockchain: configuration.blockchain,
2112
2116
  tokenIn: CONSTANTS[configuration.blockchain].USD,
@@ -2115,17 +2119,19 @@ var ChangableAmountProvider = (function (props) {
2115
2119
  fromAddress: account,
2116
2120
  toAddress: account
2117
2121
  });
2118
- })).then(function (routes) {
2119
- Promise.all(routes.map(function (routes, index) {
2120
- if (routes[0] == undefined) {
2122
+ })).then(function (results) {
2123
+ Promise.all(results.map(function (result, index) {
2124
+ if (typeof result == 'number') {
2125
+ return result;
2126
+ } else if (result[0] == undefined) {
2121
2127
  return;
2128
+ } else {
2129
+ return Token.readable({
2130
+ blockchain: props.accept[index].blockchain,
2131
+ amount: result[0].amountOut,
2132
+ address: result[0].tokenOut
2133
+ });
2122
2134
  }
2123
-
2124
- return Token.readable({
2125
- blockchain: props.accept[index].blockchain,
2126
- amount: routes[0].amountOut,
2127
- address: routes[0].tokenOut
2128
- });
2129
2135
  })).then(resolve)["catch"](setError);
2130
2136
  })["catch"](setError);
2131
2137
  }
@@ -2674,8 +2680,6 @@ var PaymentRoutingProvider = (function (props) {
2674
2680
  recover = _useContext3.recover;
2675
2681
 
2676
2682
  var onRoutesUpdate = function onRoutesUpdate(routes) {
2677
- console.log('routes', routes);
2678
-
2679
2683
  if (routes.length == 0) {
2680
2684
  setAllRoutes([]);
2681
2685
 
@@ -4673,7 +4677,7 @@ var PaymentOverviewSkeleton = (function (props) {
4673
4677
  className: "SkeletonBackground"
4674
4678
  }))), selectedRoute == undefined && slowRouting && /*#__PURE__*/React.createElement("div", {
4675
4679
  className: "TextCenter Opacity05 PaddingTopS"
4676
- }, /*#__PURE__*/React.createElement("strong", null, "Still loading your wallet balances...")))
4680
+ }, /*#__PURE__*/React.createElement("strong", null, "Loading payment routes...")))
4677
4681
  });
4678
4682
  });
4679
4683
 
@@ -5104,13 +5108,22 @@ var SaleOverviewDialog = (function (props) {
5104
5108
  setSalePerTokenValue = _useState2[1];
5105
5109
 
5106
5110
  useEffect(function () {
5107
- if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true)) {
5108
- setSalePerTokenValue(new Currency({
5109
- amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
5111
+ if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true) && toTokenReadableAmount) {
5112
+ var UsdAmountPerToken = paymentValue.amount / parseFloat(toTokenReadableAmount);
5113
+ var readableLocalizedAmountPerToken = new Currency({
5114
+ amount: UsdAmountPerToken,
5115
+ code: paymentValue.code
5116
+ }).toString();
5117
+ var zero = new Currency({
5118
+ amount: 0,
5110
5119
  code: paymentValue.code
5111
- }).toString());
5120
+ }).toString();
5121
+
5122
+ if (readableLocalizedAmountPerToken != zero) {
5123
+ setSalePerTokenValue(readableLocalizedAmountPerToken);
5124
+ }
5112
5125
  }
5113
- }, [paymentValue]);
5126
+ }, [paymentValue, toTokenReadableAmount]);
5114
5127
 
5115
5128
  if (toToken == undefined || toTokenReadableAmount == undefined || payment == undefined || paymentValue == undefined) {
5116
5129
  return /*#__PURE__*/React.createElement(SaleOverviewSkeleton, null);
@@ -23004,7 +23017,7 @@ var SelectTokenDialog = (function (props) {
23004
23017
  className: "Tooltip"
23005
23018
  }, /*#__PURE__*/React.createElement("span", {
23006
23019
  className: "TooltipArrowUp"
23007
- }), "Paste or enter token address here!")))),
23020
+ }), "Enter token address here")))),
23008
23021
  bodyClassName: "ScrollHeight",
23009
23022
  body: /*#__PURE__*/React.createElement("div", {
23010
23023
  className: ""
@@ -49887,7 +49887,7 @@
49887
49887
  });
49888
49888
 
49889
49889
  var PoweredByStyle = (function (style) {
49890
- return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
49890
+ return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .contained .PoweredByWrapper {\n position: absolute;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
49891
49891
  });
49892
49892
 
49893
49893
  var RangeSliderStyle = (function (style) {
@@ -62165,6 +62165,10 @@
62165
62165
  }));
62166
62166
  } else {
62167
62167
  Promise.all(props.accept.map(function (configuration) {
62168
+ if (CONSTANTS$2[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
62169
+ return 1.00 / conversionRate;
62170
+ }
62171
+
62168
62172
  return route$8({
62169
62173
  blockchain: configuration.blockchain,
62170
62174
  tokenIn: CONSTANTS$2[configuration.blockchain].USD,
@@ -62173,17 +62177,19 @@
62173
62177
  fromAddress: account,
62174
62178
  toAddress: account
62175
62179
  });
62176
- })).then(function (routes) {
62177
- Promise.all(routes.map(function (routes, index) {
62178
- if (routes[0] == undefined) {
62180
+ })).then(function (results) {
62181
+ Promise.all(results.map(function (result, index) {
62182
+ if (typeof result == 'number') {
62183
+ return result;
62184
+ } else if (result[0] == undefined) {
62179
62185
  return;
62186
+ } else {
62187
+ return Token.readable({
62188
+ blockchain: props.accept[index].blockchain,
62189
+ amount: result[0].amountOut,
62190
+ address: result[0].tokenOut
62191
+ });
62180
62192
  }
62181
-
62182
- return Token.readable({
62183
- blockchain: props.accept[index].blockchain,
62184
- amount: routes[0].amountOut,
62185
- address: routes[0].tokenOut
62186
- });
62187
62193
  })).then(resolve)["catch"](setError);
62188
62194
  })["catch"](setError);
62189
62195
  }
@@ -68153,7 +68159,7 @@
68153
68159
 
68154
68160
  let transactionFeeAmount = ({ paymentRoute, fee })=> {
68155
68161
  if(typeof fee.amount == 'string' && fee.amount.match('%')) {
68156
- return BigNumber.from(paymentRoute.toAmount).div(100).mul(parseFloat(fee.amount)).toString()
68162
+ return BigNumber.from(paymentRoute.toAmount).div(1000).mul(parseFloat(fee.amount)*10).toString()
68157
68163
  } else if(typeof fee.amount == 'string') {
68158
68164
  return fee.amount
68159
68165
  } else if(typeof fee.amount == 'number') {
@@ -85504,6 +85510,10 @@
85504
85510
  }
85505
85511
 
85506
85512
  function route({ accept, from, whitelist, blacklist, event, fee, update }) {
85513
+ if(fee && fee.amount && typeof(fee.amount) == 'string' && fee.amount.match(/\.\d\d+\%/)) {
85514
+ throw('Only up to 1 decimal is supported for fee amounts!')
85515
+ }
85516
+
85507
85517
  return new Promise(async (resolveAll, rejectAll)=>{
85508
85518
 
85509
85519
  let priority = [];
@@ -85816,8 +85826,6 @@
85816
85826
  recover = _useContext3.recover;
85817
85827
 
85818
85828
  var onRoutesUpdate = function onRoutesUpdate(routes) {
85819
- console.log('routes', routes);
85820
-
85821
85829
  if (routes.length == 0) {
85822
85830
  setAllRoutes([]);
85823
85831
 
@@ -89530,7 +89538,7 @@
89530
89538
  className: "SkeletonBackground"
89531
89539
  }))), selectedRoute == undefined && slowRouting && /*#__PURE__*/react.createElement("div", {
89532
89540
  className: "TextCenter Opacity05 PaddingTopS"
89533
- }, /*#__PURE__*/react.createElement("strong", null, "Still loading your wallet balances...")))
89541
+ }, /*#__PURE__*/react.createElement("strong", null, "Loading payment routes...")))
89534
89542
  });
89535
89543
  });
89536
89544
 
@@ -89961,13 +89969,22 @@
89961
89969
  setSalePerTokenValue = _useState2[1];
89962
89970
 
89963
89971
  react.useEffect(function () {
89964
- if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true)) {
89965
- setSalePerTokenValue(new Currency({
89966
- amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
89972
+ if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true) && toTokenReadableAmount) {
89973
+ var UsdAmountPerToken = paymentValue.amount / parseFloat(toTokenReadableAmount);
89974
+ var readableLocalizedAmountPerToken = new Currency({
89975
+ amount: UsdAmountPerToken,
89976
+ code: paymentValue.code
89977
+ }).toString();
89978
+ var zero = new Currency({
89979
+ amount: 0,
89967
89980
  code: paymentValue.code
89968
- }).toString());
89981
+ }).toString();
89982
+
89983
+ if (readableLocalizedAmountPerToken != zero) {
89984
+ setSalePerTokenValue(readableLocalizedAmountPerToken);
89985
+ }
89969
89986
  }
89970
- }, [paymentValue]);
89987
+ }, [paymentValue, toTokenReadableAmount]);
89971
89988
 
89972
89989
  if (toToken == undefined || toTokenReadableAmount == undefined || payment == undefined || paymentValue == undefined) {
89973
89990
  return /*#__PURE__*/react.createElement(SaleOverviewSkeleton, null);
@@ -107861,7 +107878,7 @@
107861
107878
  className: "Tooltip"
107862
107879
  }, /*#__PURE__*/react.createElement("span", {
107863
107880
  className: "TooltipArrowUp"
107864
- }), "Paste or enter token address here!")))),
107881
+ }), "Enter token address here")))),
107865
107882
  bodyClassName: "ScrollHeight",
107866
107883
  body: /*#__PURE__*/react.createElement("div", {
107867
107884
  className: ""
package/dist/umd/index.js CHANGED
@@ -1737,7 +1737,7 @@
1737
1737
  });
1738
1738
 
1739
1739
  var PoweredByStyle = (function (style) {
1740
- return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
1740
+ return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .contained .PoweredByWrapper {\n position: absolute;\n }\n\n .PoweredByLink {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\" !important;\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
1741
1741
  });
1742
1742
 
1743
1743
  var RangeSliderStyle = (function (style) {
@@ -2102,6 +2102,10 @@
2102
2102
  }));
2103
2103
  } else {
2104
2104
  Promise.all(props.accept.map(function (configuration) {
2105
+ if (web3Constants.CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
2106
+ return 1.00 / conversionRate;
2107
+ }
2108
+
2105
2109
  return web3Exchanges.route({
2106
2110
  blockchain: configuration.blockchain,
2107
2111
  tokenIn: web3Constants.CONSTANTS[configuration.blockchain].USD,
@@ -2110,17 +2114,19 @@
2110
2114
  fromAddress: account,
2111
2115
  toAddress: account
2112
2116
  });
2113
- })).then(function (routes) {
2114
- Promise.all(routes.map(function (routes, index) {
2115
- if (routes[0] == undefined) {
2117
+ })).then(function (results) {
2118
+ Promise.all(results.map(function (result, index) {
2119
+ if (typeof result == 'number') {
2120
+ return result;
2121
+ } else if (result[0] == undefined) {
2116
2122
  return;
2123
+ } else {
2124
+ return web3Tokens.Token.readable({
2125
+ blockchain: props.accept[index].blockchain,
2126
+ amount: result[0].amountOut,
2127
+ address: result[0].tokenOut
2128
+ });
2117
2129
  }
2118
-
2119
- return web3Tokens.Token.readable({
2120
- blockchain: props.accept[index].blockchain,
2121
- amount: routes[0].amountOut,
2122
- address: routes[0].tokenOut
2123
- });
2124
2130
  })).then(resolve)["catch"](setError);
2125
2131
  })["catch"](setError);
2126
2132
  }
@@ -2669,8 +2675,6 @@
2669
2675
  recover = _useContext3.recover;
2670
2676
 
2671
2677
  var onRoutesUpdate = function onRoutesUpdate(routes) {
2672
- console.log('routes', routes);
2673
-
2674
2678
  if (routes.length == 0) {
2675
2679
  setAllRoutes([]);
2676
2680
 
@@ -4668,7 +4672,7 @@
4668
4672
  className: "SkeletonBackground"
4669
4673
  }))), selectedRoute == undefined && slowRouting && /*#__PURE__*/React__default["default"].createElement("div", {
4670
4674
  className: "TextCenter Opacity05 PaddingTopS"
4671
- }, /*#__PURE__*/React__default["default"].createElement("strong", null, "Still loading your wallet balances...")))
4675
+ }, /*#__PURE__*/React__default["default"].createElement("strong", null, "Loading payment routes...")))
4672
4676
  });
4673
4677
  });
4674
4678
 
@@ -5099,13 +5103,22 @@
5099
5103
  setSalePerTokenValue = _useState2[1];
5100
5104
 
5101
5105
  React.useEffect(function () {
5102
- if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true)) {
5103
- setSalePerTokenValue(new localCurrency.Currency({
5104
- amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
5106
+ if (paymentValue && (amountConfiguration == undefined || amountConfiguration.token != true) && toTokenReadableAmount) {
5107
+ var UsdAmountPerToken = paymentValue.amount / parseFloat(toTokenReadableAmount);
5108
+ var readableLocalizedAmountPerToken = new localCurrency.Currency({
5109
+ amount: UsdAmountPerToken,
5110
+ code: paymentValue.code
5111
+ }).toString();
5112
+ var zero = new localCurrency.Currency({
5113
+ amount: 0,
5105
5114
  code: paymentValue.code
5106
- }).toString());
5115
+ }).toString();
5116
+
5117
+ if (readableLocalizedAmountPerToken != zero) {
5118
+ setSalePerTokenValue(readableLocalizedAmountPerToken);
5119
+ }
5107
5120
  }
5108
- }, [paymentValue]);
5121
+ }, [paymentValue, toTokenReadableAmount]);
5109
5122
 
5110
5123
  if (toToken == undefined || toTokenReadableAmount == undefined || payment == undefined || paymentValue == undefined) {
5111
5124
  return /*#__PURE__*/React__default["default"].createElement(SaleOverviewSkeleton, null);
@@ -22999,7 +23012,7 @@
22999
23012
  className: "Tooltip"
23000
23013
  }, /*#__PURE__*/React__default["default"].createElement("span", {
23001
23014
  className: "TooltipArrowUp"
23002
- }), "Paste or enter token address here!")))),
23015
+ }), "Enter token address here")))),
23003
23016
  bodyClassName: "ScrollHeight",
23004
23017
  body: /*#__PURE__*/React__default["default"].createElement("div", {
23005
23018
  className: ""
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@depay/widgets",
3
3
  "moduleName": "DePayWidgets",
4
- "version": "6.28.1",
4
+ "version": "6.28.5",
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",
@@ -44,7 +44,7 @@
44
44
  "@depay/web3-client": "^8.0.0",
45
45
  "@depay/web3-constants": "^5.0.0",
46
46
  "@depay/web3-exchanges": "^8.2.1",
47
- "@depay/web3-payments": "^10.1.2",
47
+ "@depay/web3-payments": "^10.1.3",
48
48
  "@depay/web3-tokens": "^8.0.1",
49
49
  "@depay/web3-wallets": "^10.0.3",
50
50
  "decimal.js": "^10.3.1",