@depay/widgets 6.12.0 → 6.14.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.
- package/README.md +42 -0
- package/dist/esm/index.bundle.js +207 -76
- package/dist/esm/index.js +144 -49
- package/dist/umd/index.bundle.js +207 -76
- package/dist/umd/index.js +144 -49
- package/package.json +3 -3
package/dist/umd/index.js
CHANGED
|
@@ -1452,6 +1452,8 @@
|
|
|
1452
1452
|
constructor(props) {
|
|
1453
1453
|
super(props);
|
|
1454
1454
|
|
|
1455
|
+
this.handler = this.onKeyDown.bind(this);
|
|
1456
|
+
|
|
1455
1457
|
this.state = {
|
|
1456
1458
|
open: true,
|
|
1457
1459
|
};
|
|
@@ -1485,22 +1487,22 @@
|
|
|
1485
1487
|
this.setState({ open: true });
|
|
1486
1488
|
}, 10);
|
|
1487
1489
|
});
|
|
1488
|
-
this.props.document.addEventListener('keydown', this.
|
|
1490
|
+
this.props.document.addEventListener('keydown', this.handler, true);
|
|
1489
1491
|
}
|
|
1490
1492
|
|
|
1491
1493
|
componentWillUnmount() {
|
|
1492
|
-
this.props.document.
|
|
1494
|
+
this.props.document.removeEventListener('keydown', this.handler, true);
|
|
1493
1495
|
}
|
|
1494
1496
|
|
|
1495
1497
|
render() {
|
|
1496
1498
|
const classNames = ['ReactDialog', this.state.open ? 'ReactDialogOpen' : ''];
|
|
1497
1499
|
const style = ReactDialogStyle({ background: this.props.background });
|
|
1498
1500
|
return (
|
|
1499
|
-
React__default["default"].createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName, lineNumber:
|
|
1500
|
-
, React__default["default"].createElement('style', {__self: this, __source: {fileName: _jsxFileName, lineNumber:
|
|
1501
|
-
, React__default["default"].createElement('div', { className: "ReactDialogRow", __self: this, __source: {fileName: _jsxFileName, lineNumber:
|
|
1502
|
-
, React__default["default"].createElement('div', { className: "ReactDialogCell", __self: this, __source: {fileName: _jsxFileName, lineNumber:
|
|
1503
|
-
, React__default["default"].createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName, lineNumber:
|
|
1501
|
+
React__default["default"].createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName, lineNumber: 56}}
|
|
1502
|
+
, React__default["default"].createElement('style', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 57}}, style)
|
|
1503
|
+
, React__default["default"].createElement('div', { className: "ReactDialogRow", __self: this, __source: {fileName: _jsxFileName, lineNumber: 58}}
|
|
1504
|
+
, React__default["default"].createElement('div', { className: "ReactDialogCell", __self: this, __source: {fileName: _jsxFileName, lineNumber: 59}}
|
|
1505
|
+
, React__default["default"].createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName, lineNumber: 60}} )
|
|
1504
1506
|
, this.props.children
|
|
1505
1507
|
)
|
|
1506
1508
|
)
|
|
@@ -1677,7 +1679,7 @@
|
|
|
1677
1679
|
});
|
|
1678
1680
|
|
|
1679
1681
|
var DialogStyle = (function (style) {
|
|
1680
|
-
return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n background: rgb(248,248,248);\n }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n
|
|
1682
|
+
return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n background: rgb(248,248,248);\n }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n }\n\n .ReactDialogCell {\n vertical-align: bottom;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n }\n\n .DialogFooter {\n padding-bottom: 20px;\n }\n\n .ReactDialogStackCell {\n vertical-align: bottom;\n }\n\n .ReactDialogAnimation {\n bottom: -100px !important;\n top: inherit !important;\n transition: opacity 0.4s ease, bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n }\n\n .DialogBody {\n background: rgb(248,248,248);\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.ScrollHeight {\n height: 30vh !important;\n max-height: 30vh !important;\n }\n\n .DialogHeader {\n background: rgb(248,248,248);\n border-top-left-radius: 0.8rem;\n border-top-right-radius: 0.8rem;\n min-height: 3.4rem;\n position: relative;\n width: 100%;\n }\n\n .DialogHeaderActionRight {\n position: absolute;\n top: 0;\n right: 0;\n height: 3rem;\n }\n\n .DialogHeaderActionLeft {\n position: absolute;\n top: 0;\n left: 0;\n height: 3rem;\n }\n\n .DialogFooter {\n background: rgb(248,248,248);\n border-bottom-left-radius: 0.8rem;\n border-bottom-right-radius: 0.8rem;\n line-height: 1.5rem;\n min-height: 2rem;\n position: relative;\n text-align: center;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n display: table;\n }\n\n ";
|
|
1681
1683
|
});
|
|
1682
1684
|
|
|
1683
1685
|
var FontStyle = (function (style) {
|
|
@@ -2014,20 +2016,22 @@
|
|
|
2014
2016
|
var ChangableAmountProvider = (function (props) {
|
|
2015
2017
|
var configurationsMissAmounts = function configurationsMissAmounts(configurations) {
|
|
2016
2018
|
return !configurations.every(function (configuration) {
|
|
2017
|
-
return typeof configuration.amount != 'undefined';
|
|
2019
|
+
return typeof configuration.amount != 'undefined' || typeof configuration.fromAmount != 'undefined';
|
|
2018
2020
|
});
|
|
2019
2021
|
};
|
|
2020
2022
|
|
|
2021
|
-
var
|
|
2023
|
+
var _useContext = React.useContext(ConfigurationContext),
|
|
2024
|
+
amountConfiguration = _useContext.amount;
|
|
2025
|
+
_useContext.toAmount;
|
|
2026
|
+
var recover = _useContext.recover;
|
|
2027
|
+
|
|
2028
|
+
var _useState = React.useState(recover == undefined ? configurationsMissAmounts(props.accept) : false),
|
|
2022
2029
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2023
2030
|
amountsMissing = _useState2[0],
|
|
2024
2031
|
setAmountsMissing = _useState2[1];
|
|
2025
2032
|
|
|
2026
|
-
var
|
|
2027
|
-
account =
|
|
2028
|
-
|
|
2029
|
-
var _useContext2 = React.useContext(ConfigurationContext),
|
|
2030
|
-
amountConfiguration = _useContext2.amount;
|
|
2033
|
+
var _useContext2 = React.useContext(WalletContext),
|
|
2034
|
+
account = _useContext2.account;
|
|
2031
2035
|
|
|
2032
2036
|
var _useContext3 = React.useContext(ConversionRateContext),
|
|
2033
2037
|
conversionRate = _useContext3.conversionRate;
|
|
@@ -2056,8 +2060,12 @@
|
|
|
2056
2060
|
setMaxAmount = _useState10[1];
|
|
2057
2061
|
|
|
2058
2062
|
React.useEffect(function () {
|
|
2063
|
+
if (recover) {
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2059
2067
|
setAmountsMissing(configurationsMissAmounts(props.accept));
|
|
2060
|
-
}, [props.accept]);
|
|
2068
|
+
}, [props.accept, recover]);
|
|
2061
2069
|
|
|
2062
2070
|
var getAmounts = function getAmounts() {
|
|
2063
2071
|
return new Promise(function (resolve, reject) {
|
|
@@ -2093,6 +2101,10 @@
|
|
|
2093
2101
|
};
|
|
2094
2102
|
|
|
2095
2103
|
React.useEffect(function () {
|
|
2104
|
+
if (recover) {
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2096
2108
|
if (amountsMissing && account && conversionRate) {
|
|
2097
2109
|
getAmounts().then(function (amounts) {
|
|
2098
2110
|
setAcceptWithAmount(props.accept.map(function (configuration, index) {
|
|
@@ -2111,7 +2123,7 @@
|
|
|
2111
2123
|
}));
|
|
2112
2124
|
})["catch"](setError);
|
|
2113
2125
|
}
|
|
2114
|
-
}, [amountsMissing, account, conversionRate, amount]);
|
|
2126
|
+
}, [amountsMissing, account, conversionRate, amount, recover]);
|
|
2115
2127
|
React.useEffect(function () {
|
|
2116
2128
|
if (amountsMissing && maxRoute) {
|
|
2117
2129
|
maxRoute.fromToken.readable(maxRoute.fromBalance).then(function (readableMaxAmount) {
|
|
@@ -2273,10 +2285,12 @@
|
|
|
2273
2285
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
2274
2286
|
_sent = _useContext2.sent,
|
|
2275
2287
|
confirmed = _useContext2.confirmed,
|
|
2276
|
-
failed = _useContext2.failed
|
|
2288
|
+
failed = _useContext2.failed,
|
|
2289
|
+
recover = _useContext2.recover;
|
|
2277
2290
|
|
|
2278
2291
|
var _useContext3 = React.useContext(PaymentRoutingContext),
|
|
2279
|
-
selectedRoute = _useContext3.selectedRoute
|
|
2292
|
+
selectedRoute = _useContext3.selectedRoute,
|
|
2293
|
+
getPaymentRoutes = _useContext3.getPaymentRoutes;
|
|
2280
2294
|
|
|
2281
2295
|
var _useContext4 = React.useContext(ClosableContext),
|
|
2282
2296
|
open = _useContext4.open,
|
|
@@ -2342,8 +2356,10 @@
|
|
|
2342
2356
|
}
|
|
2343
2357
|
|
|
2344
2358
|
setPaymentState('initialized');
|
|
2359
|
+
setPayment(null);
|
|
2345
2360
|
setClosable(true);
|
|
2346
2361
|
setUpdatable(true);
|
|
2362
|
+
getPaymentRoutes({});
|
|
2347
2363
|
navigate('PaymentError');
|
|
2348
2364
|
};
|
|
2349
2365
|
|
|
@@ -2429,6 +2445,39 @@
|
|
|
2429
2445
|
setPaymentState('confirmed');
|
|
2430
2446
|
}
|
|
2431
2447
|
}, [release]);
|
|
2448
|
+
React.useEffect(function () {
|
|
2449
|
+
if (recover) {
|
|
2450
|
+
setClosable(false);
|
|
2451
|
+
setUpdatable(false);
|
|
2452
|
+
setPaymentState('paying');
|
|
2453
|
+
setTransaction({
|
|
2454
|
+
blockchain: recover.blockchain,
|
|
2455
|
+
id: recover.transaction,
|
|
2456
|
+
url: web3Blockchains.Blockchain.findByName(recover.blockchain).explorerUrlFor({
|
|
2457
|
+
transaction: {
|
|
2458
|
+
id: recover.transaction
|
|
2459
|
+
}
|
|
2460
|
+
})
|
|
2461
|
+
});
|
|
2462
|
+
var paymentToken = new web3Tokens.Token({
|
|
2463
|
+
blockchain: recover.blockchain,
|
|
2464
|
+
address: recover.token
|
|
2465
|
+
});
|
|
2466
|
+
Promise.all([paymentToken.name(), paymentToken.symbol()]).then(function (_ref2) {
|
|
2467
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2468
|
+
name = _ref3[0],
|
|
2469
|
+
symbol = _ref3[1];
|
|
2470
|
+
|
|
2471
|
+
setPayment({
|
|
2472
|
+
blockchain: recover.blockchain,
|
|
2473
|
+
token: recover.token,
|
|
2474
|
+
name: name,
|
|
2475
|
+
symbol: symbol.toUpperCase(),
|
|
2476
|
+
amount: recover.amount
|
|
2477
|
+
});
|
|
2478
|
+
})["catch"](setError);
|
|
2479
|
+
}
|
|
2480
|
+
}, [recover]);
|
|
2432
2481
|
React.useEffect(function () {
|
|
2433
2482
|
if (foundTransaction && foundTransaction.id && foundTransaction.status) {
|
|
2434
2483
|
var newTransaction;
|
|
@@ -2453,16 +2502,16 @@
|
|
|
2453
2502
|
React.useEffect(function () {
|
|
2454
2503
|
if (selectedRoute) {
|
|
2455
2504
|
var fromToken = selectedRoute.fromToken;
|
|
2456
|
-
selectedRoute.
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
amount = _ref3[2];
|
|
2505
|
+
Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (_ref4) {
|
|
2506
|
+
var _ref5 = _slicedToArray(_ref4, 3),
|
|
2507
|
+
name = _ref5[0],
|
|
2508
|
+
symbol = _ref5[1],
|
|
2509
|
+
amount = _ref5[2];
|
|
2462
2510
|
|
|
2463
2511
|
setPayment({
|
|
2512
|
+
blockchain: selectedRoute.blockchain,
|
|
2464
2513
|
route: selectedRoute,
|
|
2465
|
-
token:
|
|
2514
|
+
token: fromToken.address,
|
|
2466
2515
|
name: name,
|
|
2467
2516
|
symbol: symbol.toUpperCase(),
|
|
2468
2517
|
amount: amount
|
|
@@ -2545,6 +2594,9 @@
|
|
|
2545
2594
|
var _useContext2 = React.useContext(UpdatableContext),
|
|
2546
2595
|
updatable = _useContext2.updatable;
|
|
2547
2596
|
|
|
2597
|
+
var _useContext3 = React.useContext(ConfigurationContext),
|
|
2598
|
+
recover = _useContext3.recover;
|
|
2599
|
+
|
|
2548
2600
|
var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
|
|
2549
2601
|
var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
|
|
2550
2602
|
var toContract = _typeof(accept.receiver) == 'object' ? accept.receiver : undefined;
|
|
@@ -2672,7 +2724,7 @@
|
|
|
2672
2724
|
};
|
|
2673
2725
|
}, [reloadCount, allRoutes, selectedRoute, updatable]);
|
|
2674
2726
|
React.useEffect(function () {
|
|
2675
|
-
if (account && props.accept) {
|
|
2727
|
+
if (account && props.accept && recover == undefined) {
|
|
2676
2728
|
setAllRoutes(undefined);
|
|
2677
2729
|
setSelectedRoute(undefined);
|
|
2678
2730
|
getPaymentRoutes({});
|
|
@@ -2685,6 +2737,7 @@
|
|
|
2685
2737
|
value: {
|
|
2686
2738
|
selectedRoute: selectedRoute,
|
|
2687
2739
|
setSelectedRoute: setSelectedRoute,
|
|
2740
|
+
getPaymentRoutes: getPaymentRoutes,
|
|
2688
2741
|
allRoutes: allRoutes,
|
|
2689
2742
|
setAllRoutes: setAllRoutes
|
|
2690
2743
|
}
|
|
@@ -3327,7 +3380,7 @@
|
|
|
3327
3380
|
};
|
|
3328
3381
|
|
|
3329
3382
|
var approvalButton = function approvalButton() {
|
|
3330
|
-
if (!payment.route.approvalRequired || payment.route.directTransfer) {
|
|
3383
|
+
if (payment.route == undefined || !payment.route.approvalRequired || payment.route.directTransfer) {
|
|
3331
3384
|
return null;
|
|
3332
3385
|
} else if (paymentState == 'initialized') {
|
|
3333
3386
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -3364,7 +3417,7 @@
|
|
|
3364
3417
|
displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
|
|
3365
3418
|
}
|
|
3366
3419
|
|
|
3367
|
-
if (paymentState == 'initialized' || paymentState == 'approving') {
|
|
3420
|
+
if ((paymentState == 'initialized' || paymentState == 'approving') && payment.route) {
|
|
3368
3421
|
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
3369
3422
|
className: ["ButtonPrimary", payment.route.approvalRequired && !payment.route.directTransfer ? 'disabled' : ''].join(' '),
|
|
3370
3423
|
onClick: function onClick() {
|
|
@@ -3513,8 +3566,11 @@
|
|
|
3513
3566
|
var _useContext2 = React.useContext(PaymentContext),
|
|
3514
3567
|
transaction = _useContext2.transaction;
|
|
3515
3568
|
|
|
3569
|
+
var _useContext3 = React.useContext(ConfigurationContext),
|
|
3570
|
+
recover = _useContext3.recover;
|
|
3571
|
+
|
|
3516
3572
|
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
3517
|
-
stacked: true,
|
|
3573
|
+
stacked: recover ? false : true,
|
|
3518
3574
|
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3519
3575
|
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
3520
3576
|
}),
|
|
@@ -3527,7 +3583,7 @@
|
|
|
3527
3583
|
className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
|
|
3528
3584
|
}, "Payment Failed"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3529
3585
|
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
3530
|
-
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
3586
|
+
}, recover == undefined && /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
3531
3587
|
className: "FontSizeM"
|
|
3532
3588
|
}, "Unfortunately executing your payment failed. You can go back and try again."), transaction && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3533
3589
|
className: "PaddingTopS"
|
|
@@ -3540,7 +3596,7 @@
|
|
|
3540
3596
|
}, "View on explorer")))),
|
|
3541
3597
|
footer: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3542
3598
|
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3543
|
-
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
3599
|
+
}, recover == undefined && /*#__PURE__*/React__default["default"].createElement("button", {
|
|
3544
3600
|
className: "ButtonPrimary",
|
|
3545
3601
|
onClick: function onClick() {
|
|
3546
3602
|
return navigate('back');
|
|
@@ -3878,9 +3934,12 @@
|
|
|
3878
3934
|
var _useContext = React.useContext(ErrorContext);
|
|
3879
3935
|
_useContext.errorCallback;
|
|
3880
3936
|
|
|
3937
|
+
var _useContext2 = React.useContext(ConfigurationContext),
|
|
3938
|
+
recover = _useContext2.recover;
|
|
3939
|
+
|
|
3881
3940
|
React.useEffect(function () {
|
|
3882
3941
|
if (polling) {
|
|
3883
|
-
var
|
|
3942
|
+
var poll = function poll() {
|
|
3884
3943
|
fetch("https://api.depay.fi/v2/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
|
|
3885
3944
|
if (response.status == 200) {
|
|
3886
3945
|
response.json().then(function (data) {
|
|
@@ -3894,7 +3953,10 @@
|
|
|
3894
3953
|
});
|
|
3895
3954
|
}
|
|
3896
3955
|
});
|
|
3897
|
-
}
|
|
3956
|
+
};
|
|
3957
|
+
|
|
3958
|
+
var pollingInterval = setInterval(poll, 5000);
|
|
3959
|
+
poll();
|
|
3898
3960
|
return function () {
|
|
3899
3961
|
clearInterval(pollingInterval);
|
|
3900
3962
|
};
|
|
@@ -3974,11 +4036,25 @@
|
|
|
3974
4036
|
|
|
3975
4037
|
var initializeTracking = function initializeTracking(transaction, afterBlock) {
|
|
3976
4038
|
setGivenTransaction(transaction);
|
|
3977
|
-
|
|
4039
|
+
|
|
4040
|
+
if (recover == undefined) {
|
|
4041
|
+
createTracking(transaction, afterBlock, 1);
|
|
4042
|
+
}
|
|
4043
|
+
|
|
3978
4044
|
openSocket(transaction);
|
|
3979
4045
|
setPolling(true);
|
|
3980
4046
|
};
|
|
3981
4047
|
|
|
4048
|
+
React.useEffect(function () {
|
|
4049
|
+
if (recover) {
|
|
4050
|
+
initializeTracking({
|
|
4051
|
+
blockchain: recover.blockchain,
|
|
4052
|
+
id: recover.transaction,
|
|
4053
|
+
from: recover.sender,
|
|
4054
|
+
nonce: recover.nonce
|
|
4055
|
+
}, recover.afterBlock);
|
|
4056
|
+
}
|
|
4057
|
+
}, [recover]);
|
|
3982
4058
|
return /*#__PURE__*/React__default["default"].createElement(TransactionTrackingContext.Provider, {
|
|
3983
4059
|
value: {
|
|
3984
4060
|
initializeTracking: initializeTracking,
|
|
@@ -3988,8 +4064,11 @@
|
|
|
3988
4064
|
});
|
|
3989
4065
|
|
|
3990
4066
|
var WalletProvider = (function (props) {
|
|
3991
|
-
var _useContext = React.useContext(
|
|
3992
|
-
_useContext.
|
|
4067
|
+
var _useContext = React.useContext(ConfigurationContext),
|
|
4068
|
+
recover = _useContext.recover;
|
|
4069
|
+
|
|
4070
|
+
var _useContext2 = React.useContext(ErrorContext);
|
|
4071
|
+
_useContext2.setError;
|
|
3993
4072
|
|
|
3994
4073
|
var _useState = React.useState(),
|
|
3995
4074
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -4018,7 +4097,7 @@
|
|
|
4018
4097
|
}
|
|
4019
4098
|
};
|
|
4020
4099
|
|
|
4021
|
-
if (walletState == 'connected') {
|
|
4100
|
+
if (walletState == 'connected' || recover != undefined) {
|
|
4022
4101
|
return /*#__PURE__*/React__default["default"].createElement(WalletContext.Provider, {
|
|
4023
4102
|
value: {
|
|
4024
4103
|
account: account,
|
|
@@ -4406,7 +4485,8 @@
|
|
|
4406
4485
|
|
|
4407
4486
|
var PaymentOverviewDialog = (function (props) {
|
|
4408
4487
|
var _useContext = React.useContext(ConfigurationContext),
|
|
4409
|
-
currencyCode = _useContext.currencyCode
|
|
4488
|
+
currencyCode = _useContext.currencyCode,
|
|
4489
|
+
recover = _useContext.recover;
|
|
4410
4490
|
|
|
4411
4491
|
var _useContext2 = React.useContext(PaymentContext),
|
|
4412
4492
|
payment = _useContext2.payment,
|
|
@@ -4422,7 +4502,7 @@
|
|
|
4422
4502
|
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
4423
4503
|
navigate = _useContext5.navigate;
|
|
4424
4504
|
|
|
4425
|
-
if (payment == undefined || paymentValue == undefined) {
|
|
4505
|
+
if (payment == undefined || recover == undefined && paymentValue == undefined) {
|
|
4426
4506
|
return /*#__PURE__*/React__default["default"].createElement(PaymentOverviewSkeleton, null);
|
|
4427
4507
|
}
|
|
4428
4508
|
|
|
@@ -4473,7 +4553,7 @@
|
|
|
4473
4553
|
className: "CardImage",
|
|
4474
4554
|
title: payment.name
|
|
4475
4555
|
}, /*#__PURE__*/React__default["default"].createElement(reactTokenImage.TokenImage, {
|
|
4476
|
-
blockchain: payment.
|
|
4556
|
+
blockchain: payment.blockchain,
|
|
4477
4557
|
address: payment.token
|
|
4478
4558
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4479
4559
|
className: "CardBody"
|
|
@@ -4525,12 +4605,21 @@
|
|
|
4525
4605
|
|
|
4526
4606
|
var preflight$1 = /*#__PURE__*/function () {
|
|
4527
4607
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
|
|
4528
|
-
var accept;
|
|
4608
|
+
var accept, recover;
|
|
4529
4609
|
return regenerator.wrap(function _callee$(_context) {
|
|
4530
4610
|
while (1) {
|
|
4531
4611
|
switch (_context.prev = _context.next) {
|
|
4532
4612
|
case 0:
|
|
4533
|
-
accept = _ref.accept;
|
|
4613
|
+
accept = _ref.accept, recover = _ref.recover;
|
|
4614
|
+
|
|
4615
|
+
if (!recover) {
|
|
4616
|
+
_context.next = 3;
|
|
4617
|
+
break;
|
|
4618
|
+
}
|
|
4619
|
+
|
|
4620
|
+
return _context.abrupt("return");
|
|
4621
|
+
|
|
4622
|
+
case 3:
|
|
4534
4623
|
accept.forEach(function (configuration) {
|
|
4535
4624
|
if (typeof configuration.blockchain === 'undefined') {
|
|
4536
4625
|
throw 'You need to set the blockchain your want to receive the payment on!';
|
|
@@ -4540,16 +4629,20 @@
|
|
|
4540
4629
|
throw 'You need to set a supported blockchain!';
|
|
4541
4630
|
}
|
|
4542
4631
|
|
|
4543
|
-
if (typeof configuration.token === 'undefined') {
|
|
4632
|
+
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
4544
4633
|
throw 'You need to set the token you want to receive as payment!';
|
|
4545
4634
|
}
|
|
4546
4635
|
|
|
4636
|
+
if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
|
|
4637
|
+
throw 'You need to set the fromToken, fromAmount and toToken!';
|
|
4638
|
+
}
|
|
4639
|
+
|
|
4547
4640
|
if (typeof configuration.receiver === 'undefined') {
|
|
4548
4641
|
throw 'You need to set the receiver address that you want to receive the payment!';
|
|
4549
4642
|
}
|
|
4550
4643
|
});
|
|
4551
4644
|
|
|
4552
|
-
case
|
|
4645
|
+
case 4:
|
|
4553
4646
|
case "end":
|
|
4554
4647
|
return _context.stop();
|
|
4555
4648
|
}
|
|
@@ -4564,16 +4657,17 @@
|
|
|
4564
4657
|
|
|
4565
4658
|
var Payment = /*#__PURE__*/function () {
|
|
4566
4659
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
4567
|
-
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, document, unmount;
|
|
4660
|
+
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, document, unmount;
|
|
4568
4661
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
4569
4662
|
while (1) {
|
|
4570
4663
|
switch (_context2.prev = _context2.next) {
|
|
4571
4664
|
case 0:
|
|
4572
|
-
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, document = _ref3.document;
|
|
4665
|
+
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, document = _ref3.document;
|
|
4573
4666
|
_context2.prev = 1;
|
|
4574
4667
|
_context2.next = 4;
|
|
4575
4668
|
return preflight$1({
|
|
4576
|
-
accept: accept
|
|
4669
|
+
accept: accept,
|
|
4670
|
+
recover: recover
|
|
4577
4671
|
});
|
|
4578
4672
|
|
|
4579
4673
|
case 4:
|
|
@@ -4600,7 +4694,8 @@
|
|
|
4600
4694
|
blacklist: blacklist,
|
|
4601
4695
|
providers: providers,
|
|
4602
4696
|
track: track,
|
|
4603
|
-
fee: fee
|
|
4697
|
+
fee: fee,
|
|
4698
|
+
recover: recover
|
|
4604
4699
|
}
|
|
4605
4700
|
}, /*#__PURE__*/React__default["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default["default"].createElement(ClosableProvider, {
|
|
4606
4701
|
unmount: unmount
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.14.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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@depay/local-currency": "^3.0.0",
|
|
37
|
-
"@depay/react-dialog-stack": "^4.1.
|
|
37
|
+
"@depay/react-dialog-stack": "^4.1.1",
|
|
38
38
|
"@depay/react-shadow-dom": "^4.0.0",
|
|
39
39
|
"@depay/react-token-image": "^3.0.0",
|
|
40
40
|
"@depay/walletconnect-v1": "^1.0.18",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@depay/web3-client": "^8.0.0",
|
|
44
44
|
"@depay/web3-constants": "^5.0.0",
|
|
45
45
|
"@depay/web3-exchanges": "^8.1.0",
|
|
46
|
-
"@depay/web3-payments": "^9.
|
|
46
|
+
"@depay/web3-payments": "^9.3.0",
|
|
47
47
|
"@depay/web3-tokens": "^8.0.0",
|
|
48
48
|
"@depay/web3-wallets": "^9.0.0",
|
|
49
49
|
"decimal.js": "^10.3.1",
|