@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/dist/esm/index.js CHANGED
@@ -1457,6 +1457,8 @@ class Dialog extends React.Component {
1457
1457
  constructor(props) {
1458
1458
  super(props);
1459
1459
 
1460
+ this.handler = this.onKeyDown.bind(this);
1461
+
1460
1462
  this.state = {
1461
1463
  open: true,
1462
1464
  };
@@ -1490,22 +1492,22 @@ class Dialog extends React.Component {
1490
1492
  this.setState({ open: true });
1491
1493
  }, 10);
1492
1494
  });
1493
- this.props.document.addEventListener('keydown', this.onKeyDown.bind(this), false);
1495
+ this.props.document.addEventListener('keydown', this.handler, true);
1494
1496
  }
1495
1497
 
1496
1498
  componentWillUnmount() {
1497
- this.props.document.addEventListener('keydown', this.onKeyDown.bind(this), false);
1499
+ this.props.document.removeEventListener('keydown', this.handler, true);
1498
1500
  }
1499
1501
 
1500
1502
  render() {
1501
1503
  const classNames = ['ReactDialog', this.state.open ? 'ReactDialogOpen' : ''];
1502
1504
  const style = ReactDialogStyle({ background: this.props.background });
1503
1505
  return (
1504
- React.createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName, lineNumber: 54}}
1505
- , React.createElement('style', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 55}}, style)
1506
- , React.createElement('div', { className: "ReactDialogRow", __self: this, __source: {fileName: _jsxFileName, lineNumber: 56}}
1507
- , React.createElement('div', { className: "ReactDialogCell", __self: this, __source: {fileName: _jsxFileName, lineNumber: 57}}
1508
- , React.createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName, lineNumber: 58}} )
1506
+ React.createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName, lineNumber: 56}}
1507
+ , React.createElement('style', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 57}}, style)
1508
+ , React.createElement('div', { className: "ReactDialogRow", __self: this, __source: {fileName: _jsxFileName, lineNumber: 58}}
1509
+ , React.createElement('div', { className: "ReactDialogCell", __self: this, __source: {fileName: _jsxFileName, lineNumber: 59}}
1510
+ , React.createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName, lineNumber: 60}} )
1509
1511
  , this.props.children
1510
1512
  )
1511
1513
  )
@@ -1682,7 +1684,7 @@ var CardStyle = (function (style) {
1682
1684
  });
1683
1685
 
1684
1686
  var DialogStyle = (function (style) {
1685
- 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 height: 100%;\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 ";
1687
+ 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 ";
1686
1688
  });
1687
1689
 
1688
1690
  var FontStyle = (function (style) {
@@ -2019,20 +2021,22 @@ var WalletContext = /*#__PURE__*/React.createContext();
2019
2021
  var ChangableAmountProvider = (function (props) {
2020
2022
  var configurationsMissAmounts = function configurationsMissAmounts(configurations) {
2021
2023
  return !configurations.every(function (configuration) {
2022
- return typeof configuration.amount != 'undefined';
2024
+ return typeof configuration.amount != 'undefined' || typeof configuration.fromAmount != 'undefined';
2023
2025
  });
2024
2026
  };
2025
2027
 
2026
- var _useState = useState(configurationsMissAmounts(props.accept)),
2028
+ var _useContext = useContext(ConfigurationContext),
2029
+ amountConfiguration = _useContext.amount;
2030
+ _useContext.toAmount;
2031
+ var recover = _useContext.recover;
2032
+
2033
+ var _useState = useState(recover == undefined ? configurationsMissAmounts(props.accept) : false),
2027
2034
  _useState2 = _slicedToArray(_useState, 2),
2028
2035
  amountsMissing = _useState2[0],
2029
2036
  setAmountsMissing = _useState2[1];
2030
2037
 
2031
- var _useContext = useContext(WalletContext),
2032
- account = _useContext.account;
2033
-
2034
- var _useContext2 = useContext(ConfigurationContext),
2035
- amountConfiguration = _useContext2.amount;
2038
+ var _useContext2 = useContext(WalletContext),
2039
+ account = _useContext2.account;
2036
2040
 
2037
2041
  var _useContext3 = useContext(ConversionRateContext),
2038
2042
  conversionRate = _useContext3.conversionRate;
@@ -2061,8 +2065,12 @@ var ChangableAmountProvider = (function (props) {
2061
2065
  setMaxAmount = _useState10[1];
2062
2066
 
2063
2067
  useEffect(function () {
2068
+ if (recover) {
2069
+ return;
2070
+ }
2071
+
2064
2072
  setAmountsMissing(configurationsMissAmounts(props.accept));
2065
- }, [props.accept]);
2073
+ }, [props.accept, recover]);
2066
2074
 
2067
2075
  var getAmounts = function getAmounts() {
2068
2076
  return new Promise(function (resolve, reject) {
@@ -2098,6 +2106,10 @@ var ChangableAmountProvider = (function (props) {
2098
2106
  };
2099
2107
 
2100
2108
  useEffect(function () {
2109
+ if (recover) {
2110
+ return;
2111
+ }
2112
+
2101
2113
  if (amountsMissing && account && conversionRate) {
2102
2114
  getAmounts().then(function (amounts) {
2103
2115
  setAcceptWithAmount(props.accept.map(function (configuration, index) {
@@ -2116,7 +2128,7 @@ var ChangableAmountProvider = (function (props) {
2116
2128
  }));
2117
2129
  })["catch"](setError);
2118
2130
  }
2119
- }, [amountsMissing, account, conversionRate, amount]);
2131
+ }, [amountsMissing, account, conversionRate, amount, recover]);
2120
2132
  useEffect(function () {
2121
2133
  if (amountsMissing && maxRoute) {
2122
2134
  maxRoute.fromToken.readable(maxRoute.fromBalance).then(function (readableMaxAmount) {
@@ -2278,10 +2290,12 @@ var PaymentProvider = (function (props) {
2278
2290
  var _useContext2 = useContext(ConfigurationContext),
2279
2291
  _sent = _useContext2.sent,
2280
2292
  confirmed = _useContext2.confirmed,
2281
- failed = _useContext2.failed;
2293
+ failed = _useContext2.failed,
2294
+ recover = _useContext2.recover;
2282
2295
 
2283
2296
  var _useContext3 = useContext(PaymentRoutingContext),
2284
- selectedRoute = _useContext3.selectedRoute;
2297
+ selectedRoute = _useContext3.selectedRoute,
2298
+ getPaymentRoutes = _useContext3.getPaymentRoutes;
2285
2299
 
2286
2300
  var _useContext4 = useContext(ClosableContext),
2287
2301
  open = _useContext4.open,
@@ -2347,8 +2361,10 @@ var PaymentProvider = (function (props) {
2347
2361
  }
2348
2362
 
2349
2363
  setPaymentState('initialized');
2364
+ setPayment(null);
2350
2365
  setClosable(true);
2351
2366
  setUpdatable(true);
2367
+ getPaymentRoutes({});
2352
2368
  navigate('PaymentError');
2353
2369
  };
2354
2370
 
@@ -2434,6 +2450,39 @@ var PaymentProvider = (function (props) {
2434
2450
  setPaymentState('confirmed');
2435
2451
  }
2436
2452
  }, [release]);
2453
+ useEffect(function () {
2454
+ if (recover) {
2455
+ setClosable(false);
2456
+ setUpdatable(false);
2457
+ setPaymentState('paying');
2458
+ setTransaction({
2459
+ blockchain: recover.blockchain,
2460
+ id: recover.transaction,
2461
+ url: Blockchain.findByName(recover.blockchain).explorerUrlFor({
2462
+ transaction: {
2463
+ id: recover.transaction
2464
+ }
2465
+ })
2466
+ });
2467
+ var paymentToken = new Token({
2468
+ blockchain: recover.blockchain,
2469
+ address: recover.token
2470
+ });
2471
+ Promise.all([paymentToken.name(), paymentToken.symbol()]).then(function (_ref2) {
2472
+ var _ref3 = _slicedToArray(_ref2, 2),
2473
+ name = _ref3[0],
2474
+ symbol = _ref3[1];
2475
+
2476
+ setPayment({
2477
+ blockchain: recover.blockchain,
2478
+ token: recover.token,
2479
+ name: name,
2480
+ symbol: symbol.toUpperCase(),
2481
+ amount: recover.amount
2482
+ });
2483
+ })["catch"](setError);
2484
+ }
2485
+ }, [recover]);
2437
2486
  useEffect(function () {
2438
2487
  if (foundTransaction && foundTransaction.id && foundTransaction.status) {
2439
2488
  var newTransaction;
@@ -2458,16 +2507,16 @@ var PaymentProvider = (function (props) {
2458
2507
  useEffect(function () {
2459
2508
  if (selectedRoute) {
2460
2509
  var fromToken = selectedRoute.fromToken;
2461
- selectedRoute.transaction.params;
2462
- Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (_ref2) {
2463
- var _ref3 = _slicedToArray(_ref2, 3),
2464
- name = _ref3[0],
2465
- symbol = _ref3[1],
2466
- amount = _ref3[2];
2510
+ Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (_ref4) {
2511
+ var _ref5 = _slicedToArray(_ref4, 3),
2512
+ name = _ref5[0],
2513
+ symbol = _ref5[1],
2514
+ amount = _ref5[2];
2467
2515
 
2468
2516
  setPayment({
2517
+ blockchain: selectedRoute.blockchain,
2469
2518
  route: selectedRoute,
2470
- token: selectedRoute.fromToken.address,
2519
+ token: fromToken.address,
2471
2520
  name: name,
2472
2521
  symbol: symbol.toUpperCase(),
2473
2522
  amount: amount
@@ -2550,6 +2599,9 @@ var PaymentRoutingProvider = (function (props) {
2550
2599
  var _useContext2 = useContext(UpdatableContext),
2551
2600
  updatable = _useContext2.updatable;
2552
2601
 
2602
+ var _useContext3 = useContext(ConfigurationContext),
2603
+ recover = _useContext3.recover;
2604
+
2553
2605
  var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
2554
2606
  var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
2555
2607
  var toContract = _typeof(accept.receiver) == 'object' ? accept.receiver : undefined;
@@ -2677,7 +2729,7 @@ var PaymentRoutingProvider = (function (props) {
2677
2729
  };
2678
2730
  }, [reloadCount, allRoutes, selectedRoute, updatable]);
2679
2731
  useEffect(function () {
2680
- if (account && props.accept) {
2732
+ if (account && props.accept && recover == undefined) {
2681
2733
  setAllRoutes(undefined);
2682
2734
  setSelectedRoute(undefined);
2683
2735
  getPaymentRoutes({});
@@ -2690,6 +2742,7 @@ var PaymentRoutingProvider = (function (props) {
2690
2742
  value: {
2691
2743
  selectedRoute: selectedRoute,
2692
2744
  setSelectedRoute: setSelectedRoute,
2745
+ getPaymentRoutes: getPaymentRoutes,
2693
2746
  allRoutes: allRoutes,
2694
2747
  setAllRoutes: setAllRoutes
2695
2748
  }
@@ -3332,7 +3385,7 @@ var Footer = (function () {
3332
3385
  };
3333
3386
 
3334
3387
  var approvalButton = function approvalButton() {
3335
- if (!payment.route.approvalRequired || payment.route.directTransfer) {
3388
+ if (payment.route == undefined || !payment.route.approvalRequired || payment.route.directTransfer) {
3336
3389
  return null;
3337
3390
  } else if (paymentState == 'initialized') {
3338
3391
  return /*#__PURE__*/React.createElement("div", {
@@ -3369,7 +3422,7 @@ var Footer = (function () {
3369
3422
  displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
3370
3423
  }
3371
3424
 
3372
- if (paymentState == 'initialized' || paymentState == 'approving') {
3425
+ if ((paymentState == 'initialized' || paymentState == 'approving') && payment.route) {
3373
3426
  return /*#__PURE__*/React.createElement("button", {
3374
3427
  className: ["ButtonPrimary", payment.route.approvalRequired && !payment.route.directTransfer ? 'disabled' : ''].join(' '),
3375
3428
  onClick: function onClick() {
@@ -3518,8 +3571,11 @@ var PaymentErrorDialog = (function () {
3518
3571
  var _useContext2 = useContext(PaymentContext),
3519
3572
  transaction = _useContext2.transaction;
3520
3573
 
3574
+ var _useContext3 = useContext(ConfigurationContext),
3575
+ recover = _useContext3.recover;
3576
+
3521
3577
  return /*#__PURE__*/React.createElement(Dialog$1, {
3522
- stacked: true,
3578
+ stacked: recover ? false : true,
3523
3579
  header: /*#__PURE__*/React.createElement("div", {
3524
3580
  className: "PaddingTopS PaddingLeftM PaddingRightM"
3525
3581
  }),
@@ -3532,7 +3588,7 @@ var PaymentErrorDialog = (function () {
3532
3588
  className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
3533
3589
  }, "Payment Failed"), /*#__PURE__*/React.createElement("div", {
3534
3590
  className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
3535
- }, /*#__PURE__*/React.createElement("strong", {
3591
+ }, recover == undefined && /*#__PURE__*/React.createElement("strong", {
3536
3592
  className: "FontSizeM"
3537
3593
  }, "Unfortunately executing your payment failed. You can go back and try again."), transaction && /*#__PURE__*/React.createElement("div", {
3538
3594
  className: "PaddingTopS"
@@ -3545,7 +3601,7 @@ var PaymentErrorDialog = (function () {
3545
3601
  }, "View on explorer")))),
3546
3602
  footer: /*#__PURE__*/React.createElement("div", {
3547
3603
  className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
3548
- }, /*#__PURE__*/React.createElement("button", {
3604
+ }, recover == undefined && /*#__PURE__*/React.createElement("button", {
3549
3605
  className: "ButtonPrimary",
3550
3606
  onClick: function onClick() {
3551
3607
  return navigate('back');
@@ -3883,9 +3939,12 @@ var TransactionTrackingProvider = (function (props) {
3883
3939
  var _useContext = useContext(ErrorContext);
3884
3940
  _useContext.errorCallback;
3885
3941
 
3942
+ var _useContext2 = useContext(ConfigurationContext),
3943
+ recover = _useContext2.recover;
3944
+
3886
3945
  useEffect(function () {
3887
3946
  if (polling) {
3888
- var pollingInterval = setInterval(function () {
3947
+ var poll = function poll() {
3889
3948
  fetch("https://api.depay.fi/v2/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
3890
3949
  if (response.status == 200) {
3891
3950
  response.json().then(function (data) {
@@ -3899,7 +3958,10 @@ var TransactionTrackingProvider = (function (props) {
3899
3958
  });
3900
3959
  }
3901
3960
  });
3902
- }, 5000);
3961
+ };
3962
+
3963
+ var pollingInterval = setInterval(poll, 5000);
3964
+ poll();
3903
3965
  return function () {
3904
3966
  clearInterval(pollingInterval);
3905
3967
  };
@@ -3979,11 +4041,25 @@ var TransactionTrackingProvider = (function (props) {
3979
4041
 
3980
4042
  var initializeTracking = function initializeTracking(transaction, afterBlock) {
3981
4043
  setGivenTransaction(transaction);
3982
- createTracking(transaction, afterBlock, 1);
4044
+
4045
+ if (recover == undefined) {
4046
+ createTracking(transaction, afterBlock, 1);
4047
+ }
4048
+
3983
4049
  openSocket(transaction);
3984
4050
  setPolling(true);
3985
4051
  };
3986
4052
 
4053
+ useEffect(function () {
4054
+ if (recover) {
4055
+ initializeTracking({
4056
+ blockchain: recover.blockchain,
4057
+ id: recover.transaction,
4058
+ from: recover.sender,
4059
+ nonce: recover.nonce
4060
+ }, recover.afterBlock);
4061
+ }
4062
+ }, [recover]);
3987
4063
  return /*#__PURE__*/React.createElement(TransactionTrackingContext.Provider, {
3988
4064
  value: {
3989
4065
  initializeTracking: initializeTracking,
@@ -3993,8 +4069,11 @@ var TransactionTrackingProvider = (function (props) {
3993
4069
  });
3994
4070
 
3995
4071
  var WalletProvider = (function (props) {
3996
- var _useContext = useContext(ErrorContext);
3997
- _useContext.setError;
4072
+ var _useContext = useContext(ConfigurationContext),
4073
+ recover = _useContext.recover;
4074
+
4075
+ var _useContext2 = useContext(ErrorContext);
4076
+ _useContext2.setError;
3998
4077
 
3999
4078
  var _useState = useState(),
4000
4079
  _useState2 = _slicedToArray(_useState, 2),
@@ -4023,7 +4102,7 @@ var WalletProvider = (function (props) {
4023
4102
  }
4024
4103
  };
4025
4104
 
4026
- if (walletState == 'connected') {
4105
+ if (walletState == 'connected' || recover != undefined) {
4027
4106
  return /*#__PURE__*/React.createElement(WalletContext.Provider, {
4028
4107
  value: {
4029
4108
  account: account,
@@ -4411,7 +4490,8 @@ var PaymentOverviewSkeleton = (function (props) {
4411
4490
 
4412
4491
  var PaymentOverviewDialog = (function (props) {
4413
4492
  var _useContext = useContext(ConfigurationContext),
4414
- currencyCode = _useContext.currencyCode;
4493
+ currencyCode = _useContext.currencyCode,
4494
+ recover = _useContext.recover;
4415
4495
 
4416
4496
  var _useContext2 = useContext(PaymentContext),
4417
4497
  payment = _useContext2.payment,
@@ -4427,7 +4507,7 @@ var PaymentOverviewDialog = (function (props) {
4427
4507
  var _useContext5 = useContext(NavigateStackContext),
4428
4508
  navigate = _useContext5.navigate;
4429
4509
 
4430
- if (payment == undefined || paymentValue == undefined) {
4510
+ if (payment == undefined || recover == undefined && paymentValue == undefined) {
4431
4511
  return /*#__PURE__*/React.createElement(PaymentOverviewSkeleton, null);
4432
4512
  }
4433
4513
 
@@ -4478,7 +4558,7 @@ var PaymentOverviewDialog = (function (props) {
4478
4558
  className: "CardImage",
4479
4559
  title: payment.name
4480
4560
  }, /*#__PURE__*/React.createElement(TokenImage, {
4481
- blockchain: payment.route.blockchain,
4561
+ blockchain: payment.blockchain,
4482
4562
  address: payment.token
4483
4563
  })), /*#__PURE__*/React.createElement("div", {
4484
4564
  className: "CardBody"
@@ -4530,12 +4610,21 @@ var PaymentStack = (function (props) {
4530
4610
 
4531
4611
  var preflight$1 = /*#__PURE__*/function () {
4532
4612
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
4533
- var accept;
4613
+ var accept, recover;
4534
4614
  return regenerator.wrap(function _callee$(_context) {
4535
4615
  while (1) {
4536
4616
  switch (_context.prev = _context.next) {
4537
4617
  case 0:
4538
- accept = _ref.accept;
4618
+ accept = _ref.accept, recover = _ref.recover;
4619
+
4620
+ if (!recover) {
4621
+ _context.next = 3;
4622
+ break;
4623
+ }
4624
+
4625
+ return _context.abrupt("return");
4626
+
4627
+ case 3:
4539
4628
  accept.forEach(function (configuration) {
4540
4629
  if (typeof configuration.blockchain === 'undefined') {
4541
4630
  throw 'You need to set the blockchain your want to receive the payment on!';
@@ -4545,16 +4634,20 @@ var preflight$1 = /*#__PURE__*/function () {
4545
4634
  throw 'You need to set a supported blockchain!';
4546
4635
  }
4547
4636
 
4548
- if (typeof configuration.token === 'undefined') {
4637
+ if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
4549
4638
  throw 'You need to set the token you want to receive as payment!';
4550
4639
  }
4551
4640
 
4641
+ if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
4642
+ throw 'You need to set the fromToken, fromAmount and toToken!';
4643
+ }
4644
+
4552
4645
  if (typeof configuration.receiver === 'undefined') {
4553
4646
  throw 'You need to set the receiver address that you want to receive the payment!';
4554
4647
  }
4555
4648
  });
4556
4649
 
4557
- case 2:
4650
+ case 4:
4558
4651
  case "end":
4559
4652
  return _context.stop();
4560
4653
  }
@@ -4569,16 +4662,17 @@ var preflight$1 = /*#__PURE__*/function () {
4569
4662
 
4570
4663
  var Payment = /*#__PURE__*/function () {
4571
4664
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
4572
- var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, document, unmount;
4665
+ var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, document, unmount;
4573
4666
  return regenerator.wrap(function _callee2$(_context2) {
4574
4667
  while (1) {
4575
4668
  switch (_context2.prev = _context2.next) {
4576
4669
  case 0:
4577
- 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;
4670
+ 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;
4578
4671
  _context2.prev = 1;
4579
4672
  _context2.next = 4;
4580
4673
  return preflight$1({
4581
- accept: accept
4674
+ accept: accept,
4675
+ recover: recover
4582
4676
  });
4583
4677
 
4584
4678
  case 4:
@@ -4605,7 +4699,8 @@ var Payment = /*#__PURE__*/function () {
4605
4699
  blacklist: blacklist,
4606
4700
  providers: providers,
4607
4701
  track: track,
4608
- fee: fee
4702
+ fee: fee,
4703
+ recover: recover
4609
4704
  }
4610
4705
  }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
4611
4706
  unmount: unmount