@depay/widgets 7.3.1 → 7.5.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.
- package/README.md +19 -1
- package/dist/esm/index.bundle.js +2 -2
- package/dist/esm/index.js +37 -20
- package/dist/umd/index.bundle.js +2 -2
- package/dist/umd/index.js +37 -20
- package/package.json +2 -2
package/dist/umd/index.js
CHANGED
|
@@ -19224,7 +19224,8 @@
|
|
|
19224
19224
|
_sent = _useContext2.sent,
|
|
19225
19225
|
confirmed = _useContext2.confirmed,
|
|
19226
19226
|
failed = _useContext2.failed,
|
|
19227
|
-
recover = _useContext2.recover
|
|
19227
|
+
recover = _useContext2.recover,
|
|
19228
|
+
before = _useContext2.before;
|
|
19228
19229
|
|
|
19229
19230
|
var _useContext3 = React.useContext(PaymentRoutingContext),
|
|
19230
19231
|
selectedRoute = _useContext3.selectedRoute,
|
|
@@ -19302,21 +19303,36 @@
|
|
|
19302
19303
|
|
|
19303
19304
|
var pay = /*#__PURE__*/function () {
|
|
19304
19305
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
19305
|
-
var currentBlock;
|
|
19306
|
+
var stop, currentBlock;
|
|
19306
19307
|
return regenerator.wrap(function _callee$(_context) {
|
|
19307
19308
|
while (1) {
|
|
19308
19309
|
switch (_context.prev = _context.next) {
|
|
19309
19310
|
case 0:
|
|
19311
|
+
if (!before) {
|
|
19312
|
+
_context.next = 4;
|
|
19313
|
+
break;
|
|
19314
|
+
}
|
|
19315
|
+
|
|
19316
|
+
stop = before(payment.route.transaction);
|
|
19317
|
+
|
|
19318
|
+
if (!(stop === false)) {
|
|
19319
|
+
_context.next = 4;
|
|
19320
|
+
break;
|
|
19321
|
+
}
|
|
19322
|
+
|
|
19323
|
+
return _context.abrupt("return");
|
|
19324
|
+
|
|
19325
|
+
case 4:
|
|
19310
19326
|
setClosable(false);
|
|
19311
19327
|
setPaymentState('paying');
|
|
19312
19328
|
setUpdatable(false);
|
|
19313
|
-
_context.next =
|
|
19329
|
+
_context.next = 9;
|
|
19314
19330
|
return web3Client.request({
|
|
19315
19331
|
blockchain: payment.route.transaction.blockchain,
|
|
19316
19332
|
method: 'latestBlockNumber'
|
|
19317
19333
|
});
|
|
19318
19334
|
|
|
19319
|
-
case
|
|
19335
|
+
case 9:
|
|
19320
19336
|
currentBlock = _context.sent;
|
|
19321
19337
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19322
19338
|
sent: function sent(transaction) {
|
|
@@ -19342,7 +19358,7 @@
|
|
|
19342
19358
|
}
|
|
19343
19359
|
});
|
|
19344
19360
|
|
|
19345
|
-
case
|
|
19361
|
+
case 11:
|
|
19346
19362
|
case "end":
|
|
19347
19363
|
return _context.stop();
|
|
19348
19364
|
}
|
|
@@ -20094,9 +20110,9 @@
|
|
|
20094
20110
|
|
|
20095
20111
|
Promise.all([web3Exchanges.route({
|
|
20096
20112
|
blockchain: payment.route.blockchain,
|
|
20097
|
-
tokenIn: payment.route.
|
|
20113
|
+
tokenIn: payment.route.fromToken.address,
|
|
20098
20114
|
tokenOut: web3Constants.CONSTANTS[payment.route.blockchain].USD,
|
|
20099
|
-
amountIn: payment.route.
|
|
20115
|
+
amountIn: payment.route.fromAmount,
|
|
20100
20116
|
fromAddress: account,
|
|
20101
20117
|
toAddress: account
|
|
20102
20118
|
}), !payment.route.directTransfer ? web3Exchanges.route({
|
|
@@ -20111,11 +20127,11 @@
|
|
|
20111
20127
|
address: web3Constants.CONSTANTS[payment.route.blockchain].USD
|
|
20112
20128
|
}).decimals()]).then(function (_ref2) {
|
|
20113
20129
|
var _ref3 = _slicedToArray(_ref2, 3),
|
|
20114
|
-
|
|
20130
|
+
fromTokenUSDExchangeRoutes = _ref3[0],
|
|
20115
20131
|
reverseRoutes = _ref3[1],
|
|
20116
20132
|
USDDecimals = _ref3[2];
|
|
20117
20133
|
|
|
20118
|
-
var
|
|
20134
|
+
var fromTokenUSDRoute = fromTokenUSDExchangeRoutes[0];
|
|
20119
20135
|
var reverseRoute = reverseRoutes[0];
|
|
20120
20136
|
|
|
20121
20137
|
if (reverseRoute) {
|
|
@@ -20130,20 +20146,20 @@
|
|
|
20130
20146
|
}
|
|
20131
20147
|
}
|
|
20132
20148
|
|
|
20133
|
-
var
|
|
20149
|
+
var fromTokenUSDAmount;
|
|
20134
20150
|
|
|
20135
|
-
if (payment.route.
|
|
20136
|
-
|
|
20137
|
-
} else if (
|
|
20151
|
+
if (payment.route.fromToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
|
|
20152
|
+
fromTokenUSDAmount = payment.route.fromAmount.toString();
|
|
20153
|
+
} else if (fromTokenUSDRoute == undefined) {
|
|
20138
20154
|
setPaymentValue('');
|
|
20139
20155
|
return;
|
|
20140
20156
|
} else {
|
|
20141
|
-
|
|
20157
|
+
fromTokenUSDAmount = fromTokenUSDRoute.amountOut.toString();
|
|
20142
20158
|
}
|
|
20143
20159
|
|
|
20144
|
-
var
|
|
20160
|
+
var fromTokenUSDValue = ethers.ethers.utils.formatUnits(fromTokenUSDAmount, USDDecimals);
|
|
20145
20161
|
localCurrency.Currency.fromUSD({
|
|
20146
|
-
amount:
|
|
20162
|
+
amount: fromTokenUSDValue,
|
|
20147
20163
|
code: currency
|
|
20148
20164
|
}).then(setPaymentValue);
|
|
20149
20165
|
})["catch"](setError);
|
|
@@ -20746,12 +20762,12 @@
|
|
|
20746
20762
|
|
|
20747
20763
|
if (amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
|
|
20748
20764
|
displayedAmount = paymentValue.toString();
|
|
20749
|
-
} else if (amount && (configuredAmount == undefined || configuredAmount.token != true)) {
|
|
20765
|
+
} else if (amount && (configuredAmount == undefined || (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true)) {
|
|
20750
20766
|
displayedAmount = new localCurrency.Currency({
|
|
20751
20767
|
amount: amount.toFixed(2),
|
|
20752
20768
|
code: currencyCode
|
|
20753
20769
|
}).toString();
|
|
20754
|
-
} else if (paymentValue && paymentValue.toString().length) {
|
|
20770
|
+
} else if (paymentValue && paymentValue.toString().length && (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true) {
|
|
20755
20771
|
displayedAmount = paymentValue.toString();
|
|
20756
20772
|
} else {
|
|
20757
20773
|
displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
|
|
@@ -22104,12 +22120,12 @@
|
|
|
22104
22120
|
|
|
22105
22121
|
var Payment = /*#__PURE__*/function () {
|
|
22106
22122
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
22107
|
-
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, container, document, unmount;
|
|
22123
|
+
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, container, before, document, unmount;
|
|
22108
22124
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
22109
22125
|
while (1) {
|
|
22110
22126
|
switch (_context2.prev = _context2.next) {
|
|
22111
22127
|
case 0:
|
|
22112
|
-
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, recover = _ref3.recover, closable = _ref3.closable, integration = _ref3.integration, container = _ref3.container, document = _ref3.document;
|
|
22128
|
+
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, fee = _ref3.fee, recover = _ref3.recover, closable = _ref3.closable, integration = _ref3.integration, container = _ref3.container, before = _ref3.before, document = _ref3.document;
|
|
22113
22129
|
requireReactVersion();
|
|
22114
22130
|
_context2.prev = 2;
|
|
22115
22131
|
_context2.next = 5;
|
|
@@ -22133,6 +22149,7 @@
|
|
|
22133
22149
|
}, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
|
|
22134
22150
|
configuration: {
|
|
22135
22151
|
type: 'payment',
|
|
22152
|
+
before: before,
|
|
22136
22153
|
amount: amount,
|
|
22137
22154
|
accept: accept,
|
|
22138
22155
|
currency: currency,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.5.1",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@depay/coinbase-wallet-sdk": "^1.0.5",
|
|
37
|
-
"@depay/local-currency": "^3.
|
|
37
|
+
"@depay/local-currency": "^3.5.2",
|
|
38
38
|
"@depay/react-dialog-stack": "^6.0.0",
|
|
39
39
|
"@depay/react-shadow-dom": "^5.0.2",
|
|
40
40
|
"@depay/react-token-image": "^4.1.0",
|