@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/esm/index.js
CHANGED
|
@@ -19229,7 +19229,8 @@ var PaymentProvider = (function (props) {
|
|
|
19229
19229
|
_sent = _useContext2.sent,
|
|
19230
19230
|
confirmed = _useContext2.confirmed,
|
|
19231
19231
|
failed = _useContext2.failed,
|
|
19232
|
-
recover = _useContext2.recover
|
|
19232
|
+
recover = _useContext2.recover,
|
|
19233
|
+
before = _useContext2.before;
|
|
19233
19234
|
|
|
19234
19235
|
var _useContext3 = useContext(PaymentRoutingContext),
|
|
19235
19236
|
selectedRoute = _useContext3.selectedRoute,
|
|
@@ -19307,21 +19308,36 @@ var PaymentProvider = (function (props) {
|
|
|
19307
19308
|
|
|
19308
19309
|
var pay = /*#__PURE__*/function () {
|
|
19309
19310
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
19310
|
-
var currentBlock;
|
|
19311
|
+
var stop, currentBlock;
|
|
19311
19312
|
return regenerator.wrap(function _callee$(_context) {
|
|
19312
19313
|
while (1) {
|
|
19313
19314
|
switch (_context.prev = _context.next) {
|
|
19314
19315
|
case 0:
|
|
19316
|
+
if (!before) {
|
|
19317
|
+
_context.next = 4;
|
|
19318
|
+
break;
|
|
19319
|
+
}
|
|
19320
|
+
|
|
19321
|
+
stop = before(payment.route.transaction);
|
|
19322
|
+
|
|
19323
|
+
if (!(stop === false)) {
|
|
19324
|
+
_context.next = 4;
|
|
19325
|
+
break;
|
|
19326
|
+
}
|
|
19327
|
+
|
|
19328
|
+
return _context.abrupt("return");
|
|
19329
|
+
|
|
19330
|
+
case 4:
|
|
19315
19331
|
setClosable(false);
|
|
19316
19332
|
setPaymentState('paying');
|
|
19317
19333
|
setUpdatable(false);
|
|
19318
|
-
_context.next =
|
|
19334
|
+
_context.next = 9;
|
|
19319
19335
|
return request({
|
|
19320
19336
|
blockchain: payment.route.transaction.blockchain,
|
|
19321
19337
|
method: 'latestBlockNumber'
|
|
19322
19338
|
});
|
|
19323
19339
|
|
|
19324
|
-
case
|
|
19340
|
+
case 9:
|
|
19325
19341
|
currentBlock = _context.sent;
|
|
19326
19342
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19327
19343
|
sent: function sent(transaction) {
|
|
@@ -19347,7 +19363,7 @@ var PaymentProvider = (function (props) {
|
|
|
19347
19363
|
}
|
|
19348
19364
|
});
|
|
19349
19365
|
|
|
19350
|
-
case
|
|
19366
|
+
case 11:
|
|
19351
19367
|
case "end":
|
|
19352
19368
|
return _context.stop();
|
|
19353
19369
|
}
|
|
@@ -20099,9 +20115,9 @@ var PaymentValueProvider = (function (props) {
|
|
|
20099
20115
|
|
|
20100
20116
|
Promise.all([route({
|
|
20101
20117
|
blockchain: payment.route.blockchain,
|
|
20102
|
-
tokenIn: payment.route.
|
|
20118
|
+
tokenIn: payment.route.fromToken.address,
|
|
20103
20119
|
tokenOut: CONSTANTS[payment.route.blockchain].USD,
|
|
20104
|
-
amountIn: payment.route.
|
|
20120
|
+
amountIn: payment.route.fromAmount,
|
|
20105
20121
|
fromAddress: account,
|
|
20106
20122
|
toAddress: account
|
|
20107
20123
|
}), !payment.route.directTransfer ? route({
|
|
@@ -20116,11 +20132,11 @@ var PaymentValueProvider = (function (props) {
|
|
|
20116
20132
|
address: CONSTANTS[payment.route.blockchain].USD
|
|
20117
20133
|
}).decimals()]).then(function (_ref2) {
|
|
20118
20134
|
var _ref3 = _slicedToArray(_ref2, 3),
|
|
20119
|
-
|
|
20135
|
+
fromTokenUSDExchangeRoutes = _ref3[0],
|
|
20120
20136
|
reverseRoutes = _ref3[1],
|
|
20121
20137
|
USDDecimals = _ref3[2];
|
|
20122
20138
|
|
|
20123
|
-
var
|
|
20139
|
+
var fromTokenUSDRoute = fromTokenUSDExchangeRoutes[0];
|
|
20124
20140
|
var reverseRoute = reverseRoutes[0];
|
|
20125
20141
|
|
|
20126
20142
|
if (reverseRoute) {
|
|
@@ -20135,20 +20151,20 @@ var PaymentValueProvider = (function (props) {
|
|
|
20135
20151
|
}
|
|
20136
20152
|
}
|
|
20137
20153
|
|
|
20138
|
-
var
|
|
20154
|
+
var fromTokenUSDAmount;
|
|
20139
20155
|
|
|
20140
|
-
if (payment.route.
|
|
20141
|
-
|
|
20142
|
-
} else if (
|
|
20156
|
+
if (payment.route.fromToken.address.toLowerCase() == CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
|
|
20157
|
+
fromTokenUSDAmount = payment.route.fromAmount.toString();
|
|
20158
|
+
} else if (fromTokenUSDRoute == undefined) {
|
|
20143
20159
|
setPaymentValue('');
|
|
20144
20160
|
return;
|
|
20145
20161
|
} else {
|
|
20146
|
-
|
|
20162
|
+
fromTokenUSDAmount = fromTokenUSDRoute.amountOut.toString();
|
|
20147
20163
|
}
|
|
20148
20164
|
|
|
20149
|
-
var
|
|
20165
|
+
var fromTokenUSDValue = ethers.utils.formatUnits(fromTokenUSDAmount, USDDecimals);
|
|
20150
20166
|
Currency.fromUSD({
|
|
20151
|
-
amount:
|
|
20167
|
+
amount: fromTokenUSDValue,
|
|
20152
20168
|
code: currency
|
|
20153
20169
|
}).then(setPaymentValue);
|
|
20154
20170
|
})["catch"](setError);
|
|
@@ -20751,12 +20767,12 @@ var Footer = (function () {
|
|
|
20751
20767
|
|
|
20752
20768
|
if (amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
|
|
20753
20769
|
displayedAmount = paymentValue.toString();
|
|
20754
|
-
} else if (amount && (configuredAmount == undefined || configuredAmount.token != true)) {
|
|
20770
|
+
} else if (amount && (configuredAmount == undefined || (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true)) {
|
|
20755
20771
|
displayedAmount = new Currency({
|
|
20756
20772
|
amount: amount.toFixed(2),
|
|
20757
20773
|
code: currencyCode
|
|
20758
20774
|
}).toString();
|
|
20759
|
-
} else if (paymentValue && paymentValue.toString().length) {
|
|
20775
|
+
} else if (paymentValue && paymentValue.toString().length && (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true) {
|
|
20760
20776
|
displayedAmount = paymentValue.toString();
|
|
20761
20777
|
} else {
|
|
20762
20778
|
displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
|
|
@@ -22109,12 +22125,12 @@ var preflight$1 = /*#__PURE__*/function () {
|
|
|
22109
22125
|
|
|
22110
22126
|
var Payment = /*#__PURE__*/function () {
|
|
22111
22127
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
22112
|
-
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, container, document, unmount;
|
|
22128
|
+
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;
|
|
22113
22129
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
22114
22130
|
while (1) {
|
|
22115
22131
|
switch (_context2.prev = _context2.next) {
|
|
22116
22132
|
case 0:
|
|
22117
|
-
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;
|
|
22133
|
+
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;
|
|
22118
22134
|
requireReactVersion();
|
|
22119
22135
|
_context2.prev = 2;
|
|
22120
22136
|
_context2.next = 5;
|
|
@@ -22138,6 +22154,7 @@ var Payment = /*#__PURE__*/function () {
|
|
|
22138
22154
|
}, /*#__PURE__*/React.createElement(ConfigurationProvider, {
|
|
22139
22155
|
configuration: {
|
|
22140
22156
|
type: 'payment',
|
|
22157
|
+
before: before,
|
|
22141
22158
|
amount: amount,
|
|
22142
22159
|
accept: accept,
|
|
22143
22160
|
currency: currency,
|