@depay/widgets 8.1.0 → 9.0.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
@@ -243,9 +243,7 @@ function _regeneratorRuntime() {
243
243
  if (!isNaN(iterable.length)) {
244
244
  var i = -1,
245
245
  next = function next() {
246
- for (; ++i < iterable.length;) {
247
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
248
- }
246
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
249
247
  return next.value = undefined, next.done = !0, next;
250
248
  };
251
249
  return next.next = next;
@@ -291,9 +289,7 @@ function _regeneratorRuntime() {
291
289
  }), exports.keys = function (val) {
292
290
  var object = Object(val),
293
291
  keys = [];
294
- for (var key in object) {
295
- keys.push(key);
296
- }
292
+ for (var key in object) keys.push(key);
297
293
  return keys.reverse(), function next() {
298
294
  for (; keys.length;) {
299
295
  var key = keys.pop();
@@ -304,9 +300,7 @@ function _regeneratorRuntime() {
304
300
  }, exports.values = values, Context.prototype = {
305
301
  constructor: Context,
306
302
  reset: function reset(skipTempReset) {
307
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) {
308
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
309
- }
303
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
310
304
  },
311
305
  stop: function stop() {
312
306
  this.done = !0;
@@ -421,9 +415,7 @@ function _iterableToArrayLimit(arr, i) {
421
415
  if (_x = (_i = _i.call(arr)).next, 0 === i) {
422
416
  if (Object(_i) !== _i) return;
423
417
  _n = !1;
424
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
425
- ;
426
- }
418
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
427
419
  } catch (err) {
428
420
  _d = !0, _e = err;
429
421
  } finally {
@@ -439,9 +431,7 @@ function _iterableToArrayLimit(arr, i) {
439
431
 
440
432
  function _arrayLikeToArray(arr, len) {
441
433
  if (len == null || len > arr.length) len = arr.length;
442
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
443
- arr2[i] = arr[i];
444
- }
434
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
445
435
  return arr2;
446
436
  }
447
437
 
@@ -665,25 +655,23 @@ var SelectWalletDialog = (function (props) {
665
655
  _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
666
656
  var account;
667
657
  return regenerator.wrap(function _callee$(_context) {
668
- while (1) {
669
- switch (_context.prev = _context.next) {
670
- case 0:
671
- if (!wallet) {
672
- _context.next = 5;
673
- break;
674
- }
675
- _context.next = 3;
676
- return wallet.account();
677
- case 3:
678
- account = _context.sent;
679
- if (account == undefined) {
680
- navigate('ConnectingWallet');
681
- props.connect(wallet);
682
- }
683
- case 5:
684
- case "end":
685
- return _context.stop();
686
- }
658
+ while (1) switch (_context.prev = _context.next) {
659
+ case 0:
660
+ if (!wallet) {
661
+ _context.next = 5;
662
+ break;
663
+ }
664
+ _context.next = 3;
665
+ return wallet.account();
666
+ case 3:
667
+ account = _context.sent;
668
+ if (account == undefined) {
669
+ navigate('ConnectingWallet');
670
+ props.connect(wallet);
671
+ }
672
+ case 5:
673
+ case "end":
674
+ return _context.stop();
687
675
  }
688
676
  }, _callee);
689
677
  }))();
@@ -765,24 +753,22 @@ var ConnectStack = (function (props) {
765
753
  wallet.connect().then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
766
754
  var account;
767
755
  return regenerator.wrap(function _callee$(_context) {
768
- while (1) {
769
- switch (_context.prev = _context.next) {
770
- case 0:
771
- _context.next = 2;
772
- return wallet.account();
773
- case 2:
774
- account = _context.sent;
775
- if (account) {
776
- if (props.autoClose) close();
777
- if (props.resolve) props.resolve({
778
- wallet: wallet,
779
- account: account
780
- });
781
- }
782
- case 4:
783
- case "end":
784
- return _context.stop();
785
- }
756
+ while (1) switch (_context.prev = _context.next) {
757
+ case 0:
758
+ _context.next = 2;
759
+ return wallet.account();
760
+ case 2:
761
+ account = _context.sent;
762
+ if (account) {
763
+ if (props.autoClose) close();
764
+ if (props.resolve) props.resolve({
765
+ wallet: wallet,
766
+ account: account
767
+ });
768
+ }
769
+ case 4:
770
+ case "end":
771
+ return _context.stop();
786
772
  }
787
773
  }, _callee);
788
774
  })))["catch"](function (error) {
@@ -809,27 +795,25 @@ var ConnectStack = (function (props) {
809
795
  _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
810
796
  var account;
811
797
  return regenerator.wrap(function _callee2$(_context2) {
812
- while (1) {
813
- switch (_context2.prev = _context2.next) {
814
- case 0:
815
- if (!wallet) {
816
- _context2.next = 5;
817
- break;
818
- }
819
- _context2.next = 3;
820
- return wallet.account();
821
- case 3:
822
- account = _context2.sent;
823
- if (account) {
824
- if (props.resolve) props.resolve({
825
- wallet: wallet,
826
- account: account
827
- });
828
- }
829
- case 5:
830
- case "end":
831
- return _context2.stop();
832
- }
798
+ while (1) switch (_context2.prev = _context2.next) {
799
+ case 0:
800
+ if (!wallet) {
801
+ _context2.next = 5;
802
+ break;
803
+ }
804
+ _context2.next = 3;
805
+ return wallet.account();
806
+ case 3:
807
+ account = _context2.sent;
808
+ if (account) {
809
+ if (props.resolve) props.resolve({
810
+ wallet: wallet,
811
+ account: account
812
+ });
813
+ }
814
+ case 5:
815
+ case "end":
816
+ return _context2.stop();
833
817
  }
834
818
  }, _callee2);
835
819
  }))();
@@ -1416,55 +1400,53 @@ var Connect = function Connect(options) {
1416
1400
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
1417
1401
  var wallet, account;
1418
1402
  return regenerator.wrap(function _callee$(_context) {
1419
- while (1) {
1420
- switch (_context.prev = _context.next) {
1421
- case 0:
1422
- wallet = getWallets()[0];
1423
- if (!wallet) {
1424
- _context.next = 7;
1425
- break;
1426
- }
1427
- _context.next = 4;
1428
- return wallet.account();
1429
- case 4:
1430
- account = _context.sent;
1431
- if (!account) {
1432
- _context.next = 7;
1433
- break;
1434
- }
1435
- return _context.abrupt("return", resolve({
1436
- wallet: wallet,
1437
- account: account
1438
- }));
1439
- case 7:
1440
- mount({
1441
- style: style,
1442
- document: ensureDocument(document)
1443
- }, function (unmount) {
1444
- var rejectBeforeUnmount = function rejectBeforeUnmount() {
1445
- reject('USER_CLOSED_DIALOG');
1446
- unmount();
1447
- };
1448
- return function (container) {
1449
- return /*#__PURE__*/React.createElement(ErrorProvider, {
1450
- errorCallback: error,
1451
- container: container,
1452
- unmount: unmount
1453
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
1454
- unmount: rejectBeforeUnmount
1455
- }, /*#__PURE__*/React.createElement(ConnectStack, {
1456
- document: document,
1457
- container: container,
1458
- resolve: resolve,
1459
- reject: reject,
1460
- autoClose: true
1461
- }), /*#__PURE__*/React.createElement(PoweredBy, null))));
1462
- };
1463
- });
1464
- case 8:
1465
- case "end":
1466
- return _context.stop();
1467
- }
1403
+ while (1) switch (_context.prev = _context.next) {
1404
+ case 0:
1405
+ wallet = getWallets()[0];
1406
+ if (!wallet) {
1407
+ _context.next = 7;
1408
+ break;
1409
+ }
1410
+ _context.next = 4;
1411
+ return wallet.account();
1412
+ case 4:
1413
+ account = _context.sent;
1414
+ if (!account) {
1415
+ _context.next = 7;
1416
+ break;
1417
+ }
1418
+ return _context.abrupt("return", resolve({
1419
+ wallet: wallet,
1420
+ account: account
1421
+ }));
1422
+ case 7:
1423
+ mount({
1424
+ style: style,
1425
+ document: ensureDocument(document)
1426
+ }, function (unmount) {
1427
+ var rejectBeforeUnmount = function rejectBeforeUnmount() {
1428
+ reject('USER_CLOSED_DIALOG');
1429
+ unmount();
1430
+ };
1431
+ return function (container) {
1432
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
1433
+ errorCallback: error,
1434
+ container: container,
1435
+ unmount: unmount
1436
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
1437
+ unmount: rejectBeforeUnmount
1438
+ }, /*#__PURE__*/React.createElement(ConnectStack, {
1439
+ document: document,
1440
+ container: container,
1441
+ resolve: resolve,
1442
+ reject: reject,
1443
+ autoClose: true
1444
+ }), /*#__PURE__*/React.createElement(PoweredBy, null))));
1445
+ };
1446
+ });
1447
+ case 8:
1448
+ case "end":
1449
+ return _context.stop();
1468
1450
  }
1469
1451
  }, _callee);
1470
1452
  }));
@@ -18825,7 +18807,7 @@ var ChangableAmountProvider = (function (props) {
18825
18807
  } else {
18826
18808
  Promise.all(props.accept.map(function (configuration) {
18827
18809
  if (fixedAmount) {
18828
- if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
18810
+ if (CONSTANTS[configuration.blockchain].USD == configuration.token) {
18829
18811
  return 1.00 / fixedCurrencyConversionRate * fixedAmount;
18830
18812
  } else {
18831
18813
  return route({
@@ -18838,7 +18820,7 @@ var ChangableAmountProvider = (function (props) {
18838
18820
  });
18839
18821
  }
18840
18822
  } else {
18841
- if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
18823
+ if (CONSTANTS[configuration.blockchain].USD == configuration.token) {
18842
18824
  return 1.00 / conversionRate * amount;
18843
18825
  } else {
18844
18826
  return route({
@@ -19112,7 +19094,8 @@ var PaymentProvider = (function (props) {
19112
19094
  synchronousTracking = _useContext9.synchronousTracking,
19113
19095
  asynchronousTracking = _useContext9.asynchronousTracking,
19114
19096
  trackingInitialized = _useContext9.trackingInitialized,
19115
- initializePaymentTracking = _useContext9.initializeTracking;
19097
+ initializePaymentTracking = _useContext9.initializeTracking,
19098
+ preTrack = _useContext9.preTrack;
19116
19099
  var _useContext10 = useContext(TransactionTrackingContext),
19117
19100
  foundTransaction = _useContext10.foundTransaction,
19118
19101
  initializeTransactionTracking = _useContext10.initializeTracking;
@@ -19155,33 +19138,34 @@ var PaymentProvider = (function (props) {
19155
19138
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
19156
19139
  var stop, currentBlock;
19157
19140
  return regenerator.wrap(function _callee$(_context) {
19158
- while (1) {
19159
- switch (_context.prev = _context.next) {
19160
- case 0:
19161
- if (!before) {
19162
- _context.next = 6;
19163
- break;
19164
- }
19165
- _context.next = 3;
19166
- return before(payment.route.transaction);
19167
- case 3:
19168
- stop = _context.sent;
19169
- if (!(stop === false)) {
19170
- _context.next = 6;
19171
- break;
19172
- }
19173
- return _context.abrupt("return");
19174
- case 6:
19175
- setClosable(false);
19176
- setPaymentState('paying');
19177
- setUpdatable(false);
19178
- _context.next = 11;
19179
- return request({
19180
- blockchain: payment.route.transaction.blockchain,
19181
- method: 'latestBlockNumber'
19182
- });
19183
- case 11:
19184
- currentBlock = _context.sent;
19141
+ while (1) switch (_context.prev = _context.next) {
19142
+ case 0:
19143
+ if (!before) {
19144
+ _context.next = 6;
19145
+ break;
19146
+ }
19147
+ _context.next = 3;
19148
+ return before(payment.route.transaction);
19149
+ case 3:
19150
+ stop = _context.sent;
19151
+ if (!(stop === false)) {
19152
+ _context.next = 6;
19153
+ break;
19154
+ }
19155
+ return _context.abrupt("return");
19156
+ case 6:
19157
+ setClosable(false);
19158
+ setPaymentState('paying');
19159
+ setUpdatable(false);
19160
+ _context.next = 11;
19161
+ return request({
19162
+ blockchain: payment.route.transaction.blockchain,
19163
+ method: 'latestBlockNumber'
19164
+ });
19165
+ case 11:
19166
+ currentBlock = _context.sent;
19167
+ _context.next = 14;
19168
+ return preTrack(currentBlock, payment.route).then(function () {
19185
19169
  wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
19186
19170
  sent: function sent(transaction) {
19187
19171
  initializeTransactionTracking(transaction, currentBlock);
@@ -19199,14 +19183,20 @@ var PaymentProvider = (function (props) {
19199
19183
  setPaymentState('initialized');
19200
19184
  setClosable(true);
19201
19185
  setUpdatable(true);
19202
- if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK') {
19186
+ if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK' || (error === null || error === void 0 ? void 0 : error.code) == 'NOT_SUPPORTED') {
19203
19187
  navigate('WrongNetwork');
19204
19188
  }
19205
19189
  });
19206
- case 13:
19207
- case "end":
19208
- return _context.stop();
19209
- }
19190
+ })["catch"](function (e) {
19191
+ console.log(e);
19192
+ setPaymentState('initialized');
19193
+ setClosable(true);
19194
+ setUpdatable(true);
19195
+ navigate('PreTrackingFailed');
19196
+ });
19197
+ case 14:
19198
+ case "end":
19199
+ return _context.stop();
19210
19200
  }
19211
19201
  }, _callee);
19212
19202
  }));
@@ -19277,7 +19267,7 @@ var PaymentProvider = (function (props) {
19277
19267
  useEffect(function () {
19278
19268
  if (foundTransaction && foundTransaction.id && foundTransaction.status) {
19279
19269
  var newTransaction;
19280
- if (foundTransaction.id.toLowerCase() != transaction.id.toLowerCase()) {
19270
+ if (foundTransaction.id != transaction.id) {
19281
19271
  newTransaction = Object.assign({}, transaction, {
19282
19272
  id: foundTransaction.id,
19283
19273
  url: Blockchain.findByName(transaction.blockchain).explorerUrlFor({
@@ -19383,14 +19373,13 @@ var routePayments = (function (_ref) {
19383
19373
  account = _ref.account,
19384
19374
  whitelist = _ref.whitelist,
19385
19375
  blacklist = _ref.blacklist,
19386
- event = _ref.event,
19387
19376
  fee = _ref.fee;
19388
19377
  return route$1({
19389
19378
  accept: accept.map(prepareAcceptedPayments),
19390
19379
  from: mergeFromAccounts(accept, account),
19391
19380
  whitelist: whitelist,
19392
19381
  blacklist: blacklist,
19393
- event: event,
19382
+ event: 'ifRoutedAndNative',
19394
19383
  fee: fee
19395
19384
  });
19396
19385
  });
@@ -19427,55 +19416,51 @@ var PaymentRoutingProvider = (function (props) {
19427
19416
  var onRoutesUpdate = /*#__PURE__*/function () {
19428
19417
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(routes) {
19429
19418
  return regenerator.wrap(function _callee2$(_context2) {
19430
- while (1) {
19431
- switch (_context2.prev = _context2.next) {
19432
- case 0:
19433
- if (routes.length == 0) {
19434
- setAllRoutes([]);
19435
- if (props.setMaxRoute) {
19436
- props.setMaxRoute(null);
19437
- }
19438
- } else {
19439
- roundAmounts(routes).then( /*#__PURE__*/function () {
19440
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(roundedRoutes) {
19441
- var selectRoute, newSelectRoute;
19442
- return regenerator.wrap(function _callee$(_context) {
19443
- while (1) {
19444
- switch (_context.prev = _context.next) {
19445
- case 0:
19446
- if (typeof selectedRoute == 'undefined') {
19447
- selectRoute = roundedRoutes[0];
19448
- setSelectedRoute(selectRoute);
19449
- } else {
19450
- newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
19451
- return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
19452
- })];
19453
- if (newSelectRoute) {
19454
- if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
19455
- setUpdatedRouteWithNewPrice(newSelectRoute);
19456
- }
19457
- }
19458
- }
19459
- setAllRoutes(roundedRoutes);
19460
- if (props.setMaxRoute) {
19461
- props.setMaxRoute(findMaxRoute(roundedRoutes));
19419
+ while (1) switch (_context2.prev = _context2.next) {
19420
+ case 0:
19421
+ if (routes.length == 0) {
19422
+ setAllRoutes([]);
19423
+ if (props.setMaxRoute) {
19424
+ props.setMaxRoute(null);
19425
+ }
19426
+ } else {
19427
+ roundAmounts(routes).then( /*#__PURE__*/function () {
19428
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(roundedRoutes) {
19429
+ var selectRoute, newSelectRoute;
19430
+ return regenerator.wrap(function _callee$(_context) {
19431
+ while (1) switch (_context.prev = _context.next) {
19432
+ case 0:
19433
+ if (typeof selectedRoute == 'undefined') {
19434
+ selectRoute = roundedRoutes[0];
19435
+ setSelectedRoute(selectRoute);
19436
+ } else {
19437
+ newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
19438
+ return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
19439
+ })];
19440
+ if (newSelectRoute) {
19441
+ if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
19442
+ setUpdatedRouteWithNewPrice(newSelectRoute);
19462
19443
  }
19463
- case 3:
19464
- case "end":
19465
- return _context.stop();
19444
+ }
19466
19445
  }
19467
- }
19468
- }, _callee);
19469
- }));
19470
- return function (_x2) {
19471
- return _ref2.apply(this, arguments);
19472
- };
19473
- }());
19474
- }
19475
- case 1:
19476
- case "end":
19477
- return _context2.stop();
19478
- }
19446
+ setAllRoutes(roundedRoutes);
19447
+ if (props.setMaxRoute) {
19448
+ props.setMaxRoute(findMaxRoute(roundedRoutes));
19449
+ }
19450
+ case 3:
19451
+ case "end":
19452
+ return _context.stop();
19453
+ }
19454
+ }, _callee);
19455
+ }));
19456
+ return function (_x2) {
19457
+ return _ref2.apply(this, arguments);
19458
+ };
19459
+ }());
19460
+ }
19461
+ case 1:
19462
+ case "end":
19463
+ return _context2.stop();
19479
19464
  }
19480
19465
  }, _callee2);
19481
19466
  }));
@@ -19511,29 +19496,27 @@ var PaymentRoutingProvider = (function (props) {
19511
19496
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, amountBN) {
19512
19497
  var readableAmount, roundedAmountBN;
19513
19498
  return regenerator.wrap(function _callee3$(_context3) {
19514
- while (1) {
19515
- switch (_context3.prev = _context3.next) {
19516
- case 0:
19517
- if (!route.directTransfer) {
19518
- _context3.next = 2;
19519
- break;
19520
- }
19521
- return _context3.abrupt("return", route);
19522
- case 2:
19523
- _context3.next = 4;
19524
- return route.fromToken.readable(amountBN || route.transaction.params.amounts[0]);
19525
- case 4:
19526
- readableAmount = _context3.sent;
19527
- _context3.next = 7;
19528
- return route.fromToken.BigNumber(round(readableAmount));
19529
- case 7:
19530
- roundedAmountBN = _context3.sent;
19531
- updateRouteAmount(route, roundedAmountBN);
19532
- return _context3.abrupt("return", route);
19533
- case 10:
19534
- case "end":
19535
- return _context3.stop();
19536
- }
19499
+ while (1) switch (_context3.prev = _context3.next) {
19500
+ case 0:
19501
+ if (!route.directTransfer) {
19502
+ _context3.next = 2;
19503
+ break;
19504
+ }
19505
+ return _context3.abrupt("return", route);
19506
+ case 2:
19507
+ _context3.next = 4;
19508
+ return route.fromToken.readable(amountBN || route.transaction.params.amounts[0]);
19509
+ case 4:
19510
+ readableAmount = _context3.sent;
19511
+ _context3.next = 7;
19512
+ return route.fromToken.BigNumber(round(readableAmount));
19513
+ case 7:
19514
+ roundedAmountBN = _context3.sent;
19515
+ updateRouteAmount(route, roundedAmountBN);
19516
+ return _context3.abrupt("return", route);
19517
+ case 10:
19518
+ case "end":
19519
+ return _context3.stop();
19537
19520
  }
19538
19521
  }, _callee3);
19539
19522
  }));
@@ -19544,16 +19527,14 @@ var PaymentRoutingProvider = (function (props) {
19544
19527
  var roundAmounts = /*#__PURE__*/function () {
19545
19528
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(routes) {
19546
19529
  return regenerator.wrap(function _callee4$(_context4) {
19547
- while (1) {
19548
- switch (_context4.prev = _context4.next) {
19549
- case 0:
19550
- return _context4.abrupt("return", Promise.all(routes.map(function (route) {
19551
- return roundAmount(route);
19552
- })));
19553
- case 1:
19554
- case "end":
19555
- return _context4.stop();
19556
- }
19530
+ while (1) switch (_context4.prev = _context4.next) {
19531
+ case 0:
19532
+ return _context4.abrupt("return", Promise.all(routes.map(function (route) {
19533
+ return roundAmount(route);
19534
+ })));
19535
+ case 1:
19536
+ case "end":
19537
+ return _context4.stop();
19557
19538
  }
19558
19539
  }, _callee4);
19559
19540
  }));
@@ -19564,15 +19545,13 @@ var PaymentRoutingProvider = (function (props) {
19564
19545
  var updateRouteWithNewPrice = /*#__PURE__*/function () {
19565
19546
  var _ref6 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
19566
19547
  return regenerator.wrap(function _callee5$(_context5) {
19567
- while (1) {
19568
- switch (_context5.prev = _context5.next) {
19569
- case 0:
19570
- setSelectedRoute(_objectSpread({}, updatedRouteWithNewPrice));
19571
- setUpdatedRouteWithNewPrice(null);
19572
- case 2:
19573
- case "end":
19574
- return _context5.stop();
19575
- }
19548
+ while (1) switch (_context5.prev = _context5.next) {
19549
+ case 0:
19550
+ setSelectedRoute(_objectSpread({}, updatedRouteWithNewPrice));
19551
+ setUpdatedRouteWithNewPrice(null);
19552
+ case 2:
19553
+ case "end":
19554
+ return _context5.stop();
19576
19555
  }
19577
19556
  }, _callee5);
19578
19557
  }));
@@ -19652,6 +19631,7 @@ var PaymentValueProvider = (function (props) {
19652
19631
  if (updatable == false || (payment === null || payment === void 0 ? void 0 : payment.route) == undefined) {
19653
19632
  return;
19654
19633
  }
19634
+ setPaymentValueLoss(null);
19655
19635
  Promise.all([route({
19656
19636
  blockchain: payment.route.blockchain,
19657
19637
  tokenIn: payment.route.fromToken.address,
@@ -19687,7 +19667,7 @@ var PaymentValueProvider = (function (props) {
19687
19667
  }
19688
19668
  }
19689
19669
  var fromTokenUSDAmount;
19690
- if (payment.route.fromToken.address.toLowerCase() == CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
19670
+ if (payment.route.fromToken.address == CONSTANTS[payment.route.blockchain].USD) {
19691
19671
  fromTokenUSDAmount = payment.route.fromAmount.toString();
19692
19672
  } else if (fromTokenUSDRoute == undefined) {
19693
19673
  setPaymentValue('');
@@ -20102,6 +20082,16 @@ var DigitalWalletIcon = (function (props) {
20102
20082
  }));
20103
20083
  });
20104
20084
 
20085
+ var blockTimes = {
20086
+ // in seconds
20087
+ ethereum: 13,
20088
+ bsc: 4,
20089
+ polygon: 3
20090
+ };
20091
+ var etaForConfirmations = (function (blockchain, confirmationsRequired, confirmationsPassed) {
20092
+ return (confirmationsRequired - confirmationsPassed) * blockTimes[blockchain];
20093
+ });
20094
+
20105
20095
  var LoadingText = (function (props) {
20106
20096
  return /*#__PURE__*/React.createElement("div", {
20107
20097
  className: "LoadingText"
@@ -20123,7 +20113,9 @@ var Footer = (function () {
20123
20113
  asynchronousTracking = _useContext2.asynchronousTracking,
20124
20114
  trackingInitialized = _useContext2.trackingInitialized,
20125
20115
  release = _useContext2.release,
20126
- forwardTo = _useContext2.forwardTo;
20116
+ forwardTo = _useContext2.forwardTo,
20117
+ confirmationsRequired = _useContext2.confirmationsRequired,
20118
+ confirmationsPassed = _useContext2.confirmationsPassed;
20127
20119
  var _useContext3 = useContext(PaymentContext),
20128
20120
  payment = _useContext3.payment,
20129
20121
  paymentState = _useContext3.paymentState,
@@ -20142,6 +20134,34 @@ var Footer = (function () {
20142
20134
  _useContext6.navigate;
20143
20135
  var _useContext7 = useContext(ClosableContext),
20144
20136
  close = _useContext7.close;
20137
+ var _useState = useState(),
20138
+ _useState2 = _slicedToArray(_useState, 2),
20139
+ secondsLeft = _useState2[0],
20140
+ setSecondsLeft = _useState2[1];
20141
+ var _useState3 = useState(0),
20142
+ _useState4 = _slicedToArray(_useState3, 2),
20143
+ secondsLeftCountdown = _useState4[0],
20144
+ setSecondsLeftCountdown = _useState4[1];
20145
+ useEffect(function () {
20146
+ if (confirmationsRequired) {
20147
+ var interval = setInterval(function () {
20148
+ setSecondsLeftCountdown(secondsLeftCountdown + 1);
20149
+ }, 1000);
20150
+ return function () {
20151
+ clearInterval(interval);
20152
+ };
20153
+ }
20154
+ }, [confirmationsRequired, secondsLeftCountdown]);
20155
+ useEffect(function () {
20156
+ if (confirmationsPassed) {
20157
+ setSecondsLeft(etaForConfirmations(payment.blockchain, confirmationsRequired, confirmationsPassed) - secondsLeftCountdown);
20158
+ }
20159
+ }, [confirmationsPassed, secondsLeftCountdown]);
20160
+ useEffect(function () {
20161
+ if (confirmationsPassed) {
20162
+ setSecondsLeftCountdown(0);
20163
+ }
20164
+ }, [confirmationsPassed]);
20145
20165
  var trackingInfo = function trackingInfo() {
20146
20166
  if (synchronousTracking == false && asynchronousTracking == false || asynchronousTracking && trackingInitialized) {
20147
20167
  return null;
@@ -20192,7 +20212,9 @@ var Footer = (function () {
20192
20212
  className: "CardBodyWrapper"
20193
20213
  }, /*#__PURE__*/React.createElement("div", {
20194
20214
  className: "Opacity05"
20195
- }, "Validating payment")))));
20215
+ }, "Validating payment", confirmationsRequired && secondsLeft > 0 && /*#__PURE__*/React.createElement("span", {
20216
+ title: "".concat(confirmationsPassed, "/").concat(confirmationsRequired, " required confirmations")
20217
+ }, " ", secondsLeft, "s"))))));
20196
20218
  }
20197
20219
  };
20198
20220
  var additionalPaymentInformation = function additionalPaymentInformation() {
@@ -20243,7 +20265,7 @@ var Footer = (function () {
20243
20265
  return null;
20244
20266
  } else if (paymentState == 'initialized') {
20245
20267
  return /*#__PURE__*/React.createElement("div", {
20246
- className: "PaddingBottomS"
20268
+ className: "PaddingBottomXS"
20247
20269
  }, /*#__PURE__*/React.createElement("button", {
20248
20270
  className: "ButtonPrimary",
20249
20271
  onClick: approve,
@@ -20565,44 +20587,59 @@ var PaymentTrackingProvider = (function (props) {
20565
20587
  integration = _useContext2.integration,
20566
20588
  link = _useContext2.link,
20567
20589
  type = _useContext2.type;
20590
+ var _useContext3 = useContext(WalletContext),
20591
+ account = _useContext3.account;
20592
+ _useContext3.wallet;
20568
20593
  var _useState = useState(),
20569
20594
  _useState2 = _slicedToArray(_useState, 2),
20570
20595
  transaction = _useState2[0],
20571
20596
  setTransaction = _useState2[1];
20572
20597
  var _useState3 = useState(),
20573
20598
  _useState4 = _slicedToArray(_useState3, 2),
20574
- afterBlock = _useState4[0],
20575
- setAfterBlock = _useState4[1];
20599
+ confirmationsRequired = _useState4[0],
20600
+ setConfirmationsRequired = _useState4[1];
20576
20601
  var _useState5 = useState(),
20577
20602
  _useState6 = _slicedToArray(_useState5, 2),
20578
- paymentRoute = _useState6[0],
20579
- setPaymentRoute = _useState6[1];
20580
- var _useState7 = useState(false),
20603
+ confirmationsPassed = _useState6[0],
20604
+ setConfirmationsPassed = _useState6[1];
20605
+ var _useState7 = useState(),
20581
20606
  _useState8 = _slicedToArray(_useState7, 2),
20582
- trackingInitialized = _useState8[0],
20583
- setTrackingInitialized = _useState8[1];
20584
- var _useState9 = useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
20585
- _useState10 = _slicedToArray(_useState9, 1),
20586
- synchronousTracking = _useState10[0];
20587
- var _useState11 = useState(!!(track && track.async == true)),
20588
- _useState12 = _slicedToArray(_useState11, 1),
20589
- asynchronousTracking = _useState12[0];
20590
- var _useState13 = useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
20591
- _useState14 = _slicedToArray(_useState13, 1),
20592
- polling = _useState14[0];
20593
- var _useState15 = useState(false),
20594
- _useState16 = _slicedToArray(_useState15, 2),
20595
- release = _useState16[0],
20596
- setRelease = _useState16[1];
20597
- var _useState17 = useState(),
20598
- _useState18 = _slicedToArray(_useState17, 2),
20599
- forwardTo = _useState18[0],
20600
- setForwardTo = _useState18[1];
20601
- var _useContext3 = useContext(ClosableContext),
20602
- setClosable = _useContext3.setClosable;
20603
- var _useContext4 = useContext(NavigateContext),
20604
- navigate = _useContext4.navigate;
20605
- _useContext4.set;
20607
+ afterBlock = _useState8[0],
20608
+ setAfterBlock = _useState8[1];
20609
+ var _useState9 = useState(),
20610
+ _useState10 = _slicedToArray(_useState9, 2);
20611
+ _useState10[0];
20612
+ _useState10[1];
20613
+ var _useState11 = useState(),
20614
+ _useState12 = _slicedToArray(_useState11, 2),
20615
+ paymentRoute = _useState12[0],
20616
+ setPaymentRoute = _useState12[1];
20617
+ var _useState13 = useState(false),
20618
+ _useState14 = _slicedToArray(_useState13, 2),
20619
+ trackingInitialized = _useState14[0],
20620
+ setTrackingInitialized = _useState14[1];
20621
+ var _useState15 = useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
20622
+ _useState16 = _slicedToArray(_useState15, 1),
20623
+ synchronousTracking = _useState16[0];
20624
+ var _useState17 = useState(!!(track && track.async == true)),
20625
+ _useState18 = _slicedToArray(_useState17, 1),
20626
+ asynchronousTracking = _useState18[0];
20627
+ var _useState19 = useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
20628
+ _useState20 = _slicedToArray(_useState19, 1),
20629
+ polling = _useState20[0];
20630
+ var _useState21 = useState(false),
20631
+ _useState22 = _slicedToArray(_useState21, 2),
20632
+ release = _useState22[0],
20633
+ setRelease = _useState22[1];
20634
+ var _useState23 = useState(),
20635
+ _useState24 = _slicedToArray(_useState23, 2),
20636
+ forwardTo = _useState24[0],
20637
+ setForwardTo = _useState24[1];
20638
+ var _useContext4 = useContext(ClosableContext),
20639
+ setClosable = _useContext4.setClosable;
20640
+ var _useContext5 = useContext(NavigateContext),
20641
+ navigate = _useContext5.navigate;
20642
+ _useContext5.set;
20606
20643
  var openSocket = function openSocket(transaction) {
20607
20644
  var socket = new WebSocket('wss://integrate.depay.com/cable');
20608
20645
  socket.onopen = function (event) {
@@ -20610,14 +20647,18 @@ var PaymentTrackingProvider = (function (props) {
20610
20647
  command: 'subscribe',
20611
20648
  identifier: JSON.stringify({
20612
20649
  blockchain: transaction.blockchain,
20613
- sender: transaction.from.toLowerCase(),
20614
- nonce: transaction.nonce,
20650
+ sender: transaction.from,
20651
+ nonce: transaction.nonce.toString(),
20615
20652
  channel: 'PaymentChannel'
20616
20653
  })
20617
20654
  };
20618
20655
  socket.send(JSON.stringify(msg));
20619
20656
  };
20620
- socket.onclose = function (event) {};
20657
+ socket.onclose = function (event) {
20658
+ if (!event || event.code != 1000) {
20659
+ openSocket(transaction);
20660
+ }
20661
+ };
20621
20662
  socket.onmessage = function (event) {
20622
20663
  var item = JSON.parse(event.data);
20623
20664
  if (item.type === "ping" || !item.message) {
@@ -20630,12 +20671,15 @@ var PaymentTrackingProvider = (function (props) {
20630
20671
  setRelease(true);
20631
20672
  setClosable(!item.message.forward_to);
20632
20673
  setForwardTo(item.message.forward_to);
20633
- socket.close();
20674
+ socket.close(1000);
20634
20675
  if (!!item.message.forward_to) {
20635
20676
  setTimeout(function () {
20636
20677
  props.document.location.href = item.message.forward_to;
20637
20678
  }, 200);
20638
20679
  }
20680
+ } else if (item.message.confirmations) {
20681
+ setConfirmationsRequired(item.message.confirmations.required);
20682
+ setConfirmationsPassed(item.message.confirmations.passed);
20639
20683
  }
20640
20684
  };
20641
20685
  socket.onerror = function (error) {
@@ -20680,10 +20724,10 @@ var PaymentTrackingProvider = (function (props) {
20680
20724
  var _paymentRoute$feeAmou;
20681
20725
  callTracking({
20682
20726
  blockchain: transaction.blockchain,
20683
- transaction: transaction.id.toLowerCase(),
20684
- sender: transaction.from.toLowerCase(),
20685
- nonce: transaction.nonce,
20686
- after_block: afterBlock,
20727
+ transaction: transaction.id,
20728
+ sender: transaction.from,
20729
+ nonce: transaction.nonce.toString(),
20730
+ after_block: afterBlock.toString(),
20687
20731
  from_token: paymentRoute.fromToken.address,
20688
20732
  from_amount: paymentRoute.fromAmount.toString(),
20689
20733
  from_decimals: paymentRoute.fromDecimals,
@@ -20705,10 +20749,10 @@ var PaymentTrackingProvider = (function (props) {
20705
20749
  }
20706
20750
  var payment = {
20707
20751
  blockchain: transaction.blockchain,
20708
- transaction: transaction.id.toLowerCase(),
20709
- sender: transaction.from.toLowerCase(),
20710
- nonce: transaction.nonce,
20711
- after_block: afterBlock,
20752
+ transaction: transaction.id,
20753
+ sender: transaction.from,
20754
+ nonce: transaction.nonce.toString(),
20755
+ after_block: afterBlock.toString(),
20712
20756
  to_token: paymentRoute.toToken.address
20713
20757
  };
20714
20758
  var handlePollingResponse = function handlePollingResponse(data) {
@@ -20768,16 +20812,16 @@ var PaymentTrackingProvider = (function (props) {
20768
20812
  body: JSON.stringify({
20769
20813
  blockchain: transaction.blockchain,
20770
20814
  transaction: transaction.id,
20771
- sender: transaction.from.toLowerCase(),
20772
- nonce: transaction.nonce,
20815
+ sender: transaction.from,
20816
+ nonce: transaction.nonce.toString(),
20773
20817
  receiver: paymentRoute.toAddress,
20774
20818
  token: paymentRoute.toToken.address,
20775
20819
  amount: paymentRoute.fee ? ethers.utils.formatUnits(paymentRoute.transaction.params.amounts[1], paymentRoute.toDecimals) : ethers.utils.formatUnits(paymentRoute.toAmount, paymentRoute.toDecimals),
20776
20820
  confirmations: 1,
20777
- after_block: afterBlock,
20821
+ after_block: afterBlock.toString(),
20778
20822
  uuid: transaction.id,
20779
20823
  payload: {
20780
- sender_id: transaction.from.toLowerCase(),
20824
+ sender_id: transaction.from,
20781
20825
  sender_token_id: paymentRoute.fromToken.address,
20782
20826
  sender_amount: ethers.utils.formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
20783
20827
  integration: integration,
@@ -20812,15 +20856,95 @@ var PaymentTrackingProvider = (function (props) {
20812
20856
  setPaymentRoute(paymentRoute);
20813
20857
  openSocket(transaction);
20814
20858
  };
20859
+ var preTrack = function preTrack(afterBlock, paymentRoute) {
20860
+ if (!synchronousTracking && !asynchronousTracking) {
20861
+ return Promise.resolve();
20862
+ }
20863
+ return new Promise( /*#__PURE__*/function () {
20864
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
20865
+ var _paymentRoute$feeAmou2;
20866
+ var payment;
20867
+ return regenerator.wrap(function _callee$(_context) {
20868
+ while (1) switch (_context.prev = _context.next) {
20869
+ case 0:
20870
+ _context.t0 = paymentRoute.blockchain;
20871
+ _context.t1 = account;
20872
+ _context.next = 4;
20873
+ return request({
20874
+ blockchain: paymentRoute.blockchain,
20875
+ address: account,
20876
+ method: 'transactionCount'
20877
+ });
20878
+ case 4:
20879
+ _context.t2 = _context.sent.toString();
20880
+ _context.t3 = afterBlock.toString();
20881
+ _context.t4 = paymentRoute.fromToken.address;
20882
+ _context.t5 = paymentRoute.fromAmount.toString();
20883
+ _context.t6 = paymentRoute.fromDecimals;
20884
+ _context.t7 = paymentRoute.toToken.address;
20885
+ _context.t8 = paymentRoute.toAmount.toString();
20886
+ _context.t9 = paymentRoute.toDecimals;
20887
+ _context.t10 = paymentRoute === null || paymentRoute === void 0 ? void 0 : (_paymentRoute$feeAmou2 = paymentRoute.feeAmount) === null || _paymentRoute$feeAmou2 === void 0 ? void 0 : _paymentRoute$feeAmou2.toString();
20888
+ payment = {
20889
+ blockchain: _context.t0,
20890
+ sender: _context.t1,
20891
+ nonce: _context.t2,
20892
+ after_block: _context.t3,
20893
+ from_token: _context.t4,
20894
+ from_amount: _context.t5,
20895
+ from_decimals: _context.t6,
20896
+ to_token: _context.t7,
20897
+ to_amount: _context.t8,
20898
+ to_decimals: _context.t9,
20899
+ fee_amount: _context.t10
20900
+ };
20901
+ if (!track.endpoint) {
20902
+ _context.next = 18;
20903
+ break;
20904
+ }
20905
+ return _context.abrupt("return", fetch(track.endpoint, {
20906
+ method: 'POST',
20907
+ headers: {
20908
+ 'Content-Type': 'application/json'
20909
+ },
20910
+ body: JSON.stringify(payment)
20911
+ }).then(function (response) {
20912
+ if (response.status == 200 || response.status == 201) {
20913
+ console.log('PAYMENT PRETRACKING INITIALIZED');
20914
+ return resolve();
20915
+ } else {
20916
+ return reject('PRETRACKING REQUEST FAILED');
20917
+ }
20918
+ }));
20919
+ case 18:
20920
+ if (track.method) {
20921
+ track.method(payment).then(resolve)["catch"](reject);
20922
+ } else {
20923
+ reject('No tracking defined!');
20924
+ }
20925
+ case 19:
20926
+ case "end":
20927
+ return _context.stop();
20928
+ }
20929
+ }, _callee);
20930
+ }));
20931
+ return function (_x, _x2) {
20932
+ return _ref.apply(this, arguments);
20933
+ };
20934
+ }());
20935
+ };
20815
20936
  return /*#__PURE__*/React.createElement(PaymentTrackingContext.Provider, {
20816
20937
  value: {
20817
20938
  synchronousTracking: synchronousTracking,
20818
20939
  asynchronousTracking: asynchronousTracking,
20819
20940
  initializeTracking: initializeTracking,
20941
+ preTrack: preTrack,
20820
20942
  trackingInitialized: trackingInitialized,
20821
20943
  continueTryTracking: continueTryTracking,
20822
20944
  release: release,
20823
- forwardTo: forwardTo
20945
+ forwardTo: forwardTo,
20946
+ confirmationsRequired: confirmationsRequired,
20947
+ confirmationsPassed: confirmationsPassed
20824
20948
  }
20825
20949
  }, props.children);
20826
20950
  });
@@ -20845,7 +20969,7 @@ var TransactionTrackingProvider = (function (props) {
20845
20969
  useEffect(function () {
20846
20970
  if (polling) {
20847
20971
  var poll = function poll() {
20848
- fetch("https://public.depay.com/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from.toLowerCase(), "/").concat(givenTransaction.nonce)).then(function (response) {
20972
+ fetch("https://public.depay.com/transactions/".concat(givenTransaction.blockchain, "/").concat(givenTransaction.from, "/").concat(givenTransaction.nonce)).then(function (response) {
20849
20973
  if (response.status == 200) {
20850
20974
  response.json().then(function (data) {
20851
20975
  if (data.status != 'pending') {
@@ -20878,10 +21002,10 @@ var TransactionTrackingProvider = (function (props) {
20878
21002
  },
20879
21003
  body: JSON.stringify({
20880
21004
  id: transaction.id,
20881
- after_block: afterBlock,
21005
+ after_block: afterBlock.toString(),
20882
21006
  blockchain: transaction.blockchain,
20883
- sender: transaction.from.toLowerCase(),
20884
- nonce: transaction.nonce
21007
+ sender: transaction.from,
21008
+ nonce: transaction.nonce.toString()
20885
21009
  })
20886
21010
  }).then(function (response) {
20887
21011
  if (response.status == 200 || response.status == 201) {
@@ -20906,14 +21030,18 @@ var TransactionTrackingProvider = (function (props) {
20906
21030
  command: 'subscribe',
20907
21031
  identifier: JSON.stringify({
20908
21032
  blockchain: transaction.blockchain,
20909
- sender: transaction.from.toLowerCase(),
20910
- nonce: transaction.nonce,
21033
+ sender: transaction.from,
21034
+ nonce: transaction.nonce.toString(),
20911
21035
  channel: 'TransactionChannel'
20912
21036
  })
20913
21037
  };
20914
21038
  socket.send(JSON.stringify(msg));
20915
21039
  };
20916
- socket.onclose = function (event) {};
21040
+ socket.onclose = function (event) {
21041
+ if (!event || event.code != 1000) {
21042
+ openSocket(transaction);
21043
+ }
21044
+ };
20917
21045
  socket.onmessage = function (event) {
20918
21046
  var item = JSON.parse(event.data);
20919
21047
  if (item.type === "ping") {
@@ -20921,6 +21049,7 @@ var TransactionTrackingProvider = (function (props) {
20921
21049
  }
20922
21050
  if (item.message && item.message.status && item.message.status != 'pending') {
20923
21051
  setFoundTransaction(item.message);
21052
+ socket.close(1000);
20924
21053
  }
20925
21054
  };
20926
21055
  socket.onerror = function (error) {
@@ -21001,34 +21130,32 @@ var preflight$2 = /*#__PURE__*/function () {
21001
21130
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21002
21131
  var accept;
21003
21132
  return regenerator.wrap(function _callee$(_context) {
21004
- while (1) {
21005
- switch (_context.prev = _context.next) {
21006
- case 0:
21007
- accept = _ref.accept;
21008
- if (!(!(accept instanceof Array) || accept.length == 0)) {
21009
- _context.next = 3;
21010
- break;
21133
+ while (1) switch (_context.prev = _context.next) {
21134
+ case 0:
21135
+ accept = _ref.accept;
21136
+ if (!(!(accept instanceof Array) || accept.length == 0)) {
21137
+ _context.next = 3;
21138
+ break;
21139
+ }
21140
+ throw 'You need to set the tokens you accept as donation!';
21141
+ case 3:
21142
+ accept.forEach(function (configuration) {
21143
+ if (typeof configuration.blockchain === 'undefined') {
21144
+ throw 'You need to set the blockchain you want to receive the donation on!';
21011
21145
  }
21012
- throw 'You need to set the tokens you accept as donation!';
21013
- case 3:
21014
- accept.forEach(function (configuration) {
21015
- if (typeof configuration.blockchain === 'undefined') {
21016
- throw 'You need to set the blockchain you want to receive the donation on!';
21017
- }
21018
- if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
21019
- throw 'You need to set a supported blockchain!';
21020
- }
21021
- if (typeof configuration.token === 'undefined') {
21022
- throw 'You need to set the token you want to receive as donation!';
21023
- }
21024
- if (typeof configuration.receiver === 'undefined') {
21025
- throw 'You need to set the receiver address that you want to receive the donation!';
21026
- }
21027
- });
21028
- case 4:
21029
- case "end":
21030
- return _context.stop();
21031
- }
21146
+ if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
21147
+ throw 'You need to set a supported blockchain!';
21148
+ }
21149
+ if (typeof configuration.token === 'undefined') {
21150
+ throw 'You need to set the token you want to receive as donation!';
21151
+ }
21152
+ if (typeof configuration.receiver === 'undefined') {
21153
+ throw 'You need to set the receiver address that you want to receive the donation!';
21154
+ }
21155
+ });
21156
+ case 4:
21157
+ case "end":
21158
+ return _context.stop();
21032
21159
  }
21033
21160
  }, _callee);
21034
21161
  }));
@@ -21040,82 +21167,80 @@ var Donation = /*#__PURE__*/function () {
21040
21167
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21041
21168
  var amount, accept, event, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, title, document, unmount;
21042
21169
  return regenerator.wrap(function _callee2$(_context2) {
21043
- while (1) {
21044
- switch (_context2.prev = _context2.next) {
21045
- case 0:
21046
- amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, 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, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, title = _ref3.title, document = _ref3.document;
21047
- requireReactVersion();
21048
- _context2.prev = 2;
21049
- _context2.next = 5;
21050
- return preflight$2({
21051
- accept: accept
21052
- });
21053
- case 5:
21054
- unmount = mount({
21055
- style: style,
21056
- container: container,
21057
- document: ensureDocument(document),
21058
- closed: closed
21059
- }, function (unmount) {
21060
- return function (container) {
21061
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21062
- errorCallback: error,
21063
- container: container,
21064
- unmount: unmount
21065
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21066
- configuration: {
21067
- type: 'donation',
21068
- amount: amount,
21069
- accept: accept,
21070
- currency: currency,
21071
- event: event,
21072
- track: track,
21073
- fee: fee,
21074
- sent: sent,
21075
- succeeded: succeeded,
21076
- validated: validated,
21077
- failed: failed,
21078
- blacklist: blacklist,
21079
- whitelist: whitelist,
21080
- providers: providers,
21081
- integration: integration,
21082
- link: link,
21083
- title: title
21084
- }
21085
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21086
- unmount: unmount,
21087
- closable: closable
21088
- }, /*#__PURE__*/React.createElement(WalletProvider, {
21089
- container: container,
21090
- connected: connected,
21091
- unmount: unmount
21092
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21093
- accept: accept
21094
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21095
- document: ensureDocument(document)
21096
- }, /*#__PURE__*/React.createElement(DonationRoutingProvider, {
21097
- container: container,
21098
- document: document
21099
- }, /*#__PURE__*/React.createElement(DonationStack, {
21100
- document: document,
21101
- container: container
21102
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
21103
- };
21104
- });
21105
- return _context2.abrupt("return", {
21106
- unmount: unmount
21107
- });
21108
- case 9:
21109
- _context2.prev = 9;
21110
- _context2.t0 = _context2["catch"](2);
21111
- console.log('critical error', _context2.t0);
21112
- if (critical != undefined) {
21113
- critical(_context2.t0);
21114
- }
21115
- case 13:
21116
- case "end":
21117
- return _context2.stop();
21118
- }
21170
+ while (1) switch (_context2.prev = _context2.next) {
21171
+ case 0:
21172
+ amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, 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, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, title = _ref3.title, document = _ref3.document;
21173
+ requireReactVersion();
21174
+ _context2.prev = 2;
21175
+ _context2.next = 5;
21176
+ return preflight$2({
21177
+ accept: accept
21178
+ });
21179
+ case 5:
21180
+ unmount = mount({
21181
+ style: style,
21182
+ container: container,
21183
+ document: ensureDocument(document),
21184
+ closed: closed
21185
+ }, function (unmount) {
21186
+ return function (container) {
21187
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
21188
+ errorCallback: error,
21189
+ container: container,
21190
+ unmount: unmount
21191
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21192
+ configuration: {
21193
+ type: 'donation',
21194
+ amount: amount,
21195
+ accept: accept,
21196
+ currency: currency,
21197
+ event: event,
21198
+ track: track,
21199
+ fee: fee,
21200
+ sent: sent,
21201
+ succeeded: succeeded,
21202
+ validated: validated,
21203
+ failed: failed,
21204
+ blacklist: blacklist,
21205
+ whitelist: whitelist,
21206
+ providers: providers,
21207
+ integration: integration,
21208
+ link: link,
21209
+ title: title
21210
+ }
21211
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21212
+ unmount: unmount,
21213
+ closable: closable
21214
+ }, /*#__PURE__*/React.createElement(WalletProvider, {
21215
+ container: container,
21216
+ connected: connected,
21217
+ unmount: unmount
21218
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21219
+ accept: accept
21220
+ }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21221
+ document: ensureDocument(document)
21222
+ }, /*#__PURE__*/React.createElement(DonationRoutingProvider, {
21223
+ container: container,
21224
+ document: document
21225
+ }, /*#__PURE__*/React.createElement(DonationStack, {
21226
+ document: document,
21227
+ container: container
21228
+ }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
21229
+ };
21230
+ });
21231
+ return _context2.abrupt("return", {
21232
+ unmount: unmount
21233
+ });
21234
+ case 9:
21235
+ _context2.prev = 9;
21236
+ _context2.t0 = _context2["catch"](2);
21237
+ console.log('critical error', _context2.t0);
21238
+ if (critical != undefined) {
21239
+ critical(_context2.t0);
21240
+ }
21241
+ case 13:
21242
+ case "end":
21243
+ return _context2.stop();
21119
21244
  }
21120
21245
  }, _callee2, null, [[2, 9]]);
21121
21246
  }));
@@ -21236,46 +21361,44 @@ var Login = function Login(options) {
21236
21361
  return new Promise( /*#__PURE__*/function () {
21237
21362
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_resolve, reject) {
21238
21363
  return regenerator.wrap(function _callee$(_context) {
21239
- while (1) {
21240
- switch (_context.prev = _context.next) {
21241
- case 0:
21242
- Connect().then(function () {
21243
- mount({
21244
- style: style,
21245
- document: ensureDocument(document)
21246
- }, function (unmount) {
21247
- var userClosedDialog = function userClosedDialog() {
21248
- reject('USER_CLOSED_DIALOG');
21249
- unmount();
21250
- };
21251
- return function (container) {
21252
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21253
- errorCallback: error,
21254
- container: container,
21255
- unmount: unmount
21256
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21257
- configuration: {
21258
- message: message,
21259
- endpoint: endpoint || '/login',
21260
- recover: recover
21261
- }
21262
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21263
- unmount: userClosedDialog
21264
- }, /*#__PURE__*/React.createElement(LoginStack, {
21265
- document: document,
21266
- container: container,
21267
- resolve: function resolve(account) {
21268
- unmount();
21269
- _resolve(account);
21270
- }
21271
- }), /*#__PURE__*/React.createElement(PoweredBy, null)))));
21272
- };
21273
- });
21274
- })["catch"](reject);
21275
- case 1:
21276
- case "end":
21277
- return _context.stop();
21278
- }
21364
+ while (1) switch (_context.prev = _context.next) {
21365
+ case 0:
21366
+ Connect().then(function () {
21367
+ mount({
21368
+ style: style,
21369
+ document: ensureDocument(document)
21370
+ }, function (unmount) {
21371
+ var userClosedDialog = function userClosedDialog() {
21372
+ reject('USER_CLOSED_DIALOG');
21373
+ unmount();
21374
+ };
21375
+ return function (container) {
21376
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
21377
+ errorCallback: error,
21378
+ container: container,
21379
+ unmount: unmount
21380
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21381
+ configuration: {
21382
+ message: message,
21383
+ endpoint: endpoint || '/login',
21384
+ recover: recover
21385
+ }
21386
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21387
+ unmount: userClosedDialog
21388
+ }, /*#__PURE__*/React.createElement(LoginStack, {
21389
+ document: document,
21390
+ container: container,
21391
+ resolve: function resolve(account) {
21392
+ unmount();
21393
+ _resolve(account);
21394
+ }
21395
+ }), /*#__PURE__*/React.createElement(PoweredBy, null)))));
21396
+ };
21397
+ });
21398
+ })["catch"](reject);
21399
+ case 1:
21400
+ case "end":
21401
+ return _context.stop();
21279
21402
  }
21280
21403
  }, _callee);
21281
21404
  }));
@@ -21450,6 +21573,44 @@ var PaymentOverviewDialog = (function (props) {
21450
21573
  });
21451
21574
  });
21452
21575
 
21576
+ var PreTrackingFailedDialog = (function () {
21577
+ var _useContext = useContext(PaymentContext);
21578
+ _useContext.transaction;
21579
+ var _useContext2 = useContext(NavigateStackContext),
21580
+ navigate = _useContext2.navigate;
21581
+ var tryAgain = function tryAgain() {
21582
+ navigate('back');
21583
+ };
21584
+ return /*#__PURE__*/React.createElement(Dialog$1, {
21585
+ stacked: false,
21586
+ header: /*#__PURE__*/React.createElement("div", {
21587
+ className: "PaddingTopS PaddingLeftM PaddingRightM"
21588
+ }),
21589
+ body: /*#__PURE__*/React.createElement("div", {
21590
+ className: "TextCenter"
21591
+ }, /*#__PURE__*/React.createElement("div", {
21592
+ className: "GraphicWrapper"
21593
+ }, /*#__PURE__*/React.createElement("img", {
21594
+ className: "Graphic",
21595
+ src: ErrorGraphic
21596
+ })), /*#__PURE__*/React.createElement("h1", {
21597
+ className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
21598
+ }, "Tracking payment failed"), /*#__PURE__*/React.createElement("div", {
21599
+ className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
21600
+ }, /*#__PURE__*/React.createElement("strong", {
21601
+ className: "FontSizeM"
21602
+ }, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React.createElement("div", {
21603
+ className: "PaddingTopS"
21604
+ }, /*#__PURE__*/React.createElement("span", null, "If this keeps happening, please report it.")))),
21605
+ footer: /*#__PURE__*/React.createElement("div", {
21606
+ className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
21607
+ }, /*#__PURE__*/React.createElement("button", {
21608
+ className: "ButtonPrimary",
21609
+ onClick: tryAgain
21610
+ }, "Try again"))
21611
+ });
21612
+ });
21613
+
21453
21614
  var TrackingFailedDialog = (function () {
21454
21615
  var _useContext = useContext(PaymentTrackingContext),
21455
21616
  continueTryTracking = _useContext.continueTryTracking;
@@ -21510,7 +21671,8 @@ var PaymentStack = (function (props) {
21510
21671
  ChangePayment: /*#__PURE__*/React.createElement(ChangePaymentDialog, null),
21511
21672
  PaymentFailed: /*#__PURE__*/React.createElement(PaymentFailedDialog, null),
21512
21673
  WrongNetwork: /*#__PURE__*/React.createElement(WrongNetworkDialog, null),
21513
- TrackingFailed: /*#__PURE__*/React.createElement(TrackingFailedDialog, null)
21674
+ TrackingFailed: /*#__PURE__*/React.createElement(TrackingFailedDialog, null),
21675
+ PreTrackingFailed: /*#__PURE__*/React.createElement(PreTrackingFailedDialog, null)
21514
21676
  }
21515
21677
  });
21516
21678
  });
@@ -21519,37 +21681,35 @@ var preflight$1 = /*#__PURE__*/function () {
21519
21681
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21520
21682
  var accept, recover;
21521
21683
  return regenerator.wrap(function _callee$(_context) {
21522
- while (1) {
21523
- switch (_context.prev = _context.next) {
21524
- case 0:
21525
- accept = _ref.accept, recover = _ref.recover;
21526
- if (!recover) {
21527
- _context.next = 3;
21528
- break;
21684
+ while (1) switch (_context.prev = _context.next) {
21685
+ case 0:
21686
+ accept = _ref.accept, recover = _ref.recover;
21687
+ if (!recover) {
21688
+ _context.next = 3;
21689
+ break;
21690
+ }
21691
+ return _context.abrupt("return");
21692
+ case 3:
21693
+ accept.forEach(function (configuration) {
21694
+ if (typeof configuration.blockchain === 'undefined') {
21695
+ throw 'You need to set the blockchain your want to receive the payment on!';
21529
21696
  }
21530
- return _context.abrupt("return");
21531
- case 3:
21532
- accept.forEach(function (configuration) {
21533
- if (typeof configuration.blockchain === 'undefined') {
21534
- throw 'You need to set the blockchain your want to receive the payment on!';
21535
- }
21536
- if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
21537
- throw 'You need to set a supported blockchain!';
21538
- }
21539
- if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21540
- throw 'You need to set the token you want to receive as payment!';
21541
- }
21542
- if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21543
- throw 'You need to set the fromToken, fromAmount and toToken!';
21544
- }
21545
- if (typeof configuration.receiver === 'undefined') {
21546
- throw 'You need to set the receiver address that you want to receive the payment!';
21547
- }
21548
- });
21549
- case 4:
21550
- case "end":
21551
- return _context.stop();
21552
- }
21697
+ if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
21698
+ throw 'You need to set a supported blockchain!';
21699
+ }
21700
+ if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21701
+ throw 'You need to set the token you want to receive as payment!';
21702
+ }
21703
+ if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21704
+ throw 'You need to set the fromToken, fromAmount and toToken!';
21705
+ }
21706
+ if (typeof configuration.receiver === 'undefined') {
21707
+ throw 'You need to set the receiver address that you want to receive the payment!';
21708
+ }
21709
+ });
21710
+ case 4:
21711
+ case "end":
21712
+ return _context.stop();
21553
21713
  }
21554
21714
  }, _callee);
21555
21715
  }));
@@ -21559,93 +21719,91 @@ var preflight$1 = /*#__PURE__*/function () {
21559
21719
  }();
21560
21720
  var Payment = /*#__PURE__*/function () {
21561
21721
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21562
- var accept, amount, event, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, link, container, before, document, unmount;
21722
+ var accept, amount, sent, succeeded, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, recover, closable, integration, link, container, before, document, unmount;
21563
21723
  return regenerator.wrap(function _callee2$(_context2) {
21564
- while (1) {
21565
- switch (_context2.prev = _context2.next) {
21566
- case 0:
21567
- accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, 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, link = _ref3.link, container = _ref3.container, before = _ref3.before, document = _ref3.document;
21568
- requireReactVersion();
21569
- _context2.prev = 2;
21570
- _context2.next = 5;
21571
- return preflight$1({
21572
- accept: accept,
21573
- recover: recover
21574
- });
21575
- case 5:
21576
- unmount = mount({
21577
- style: style,
21578
- container: container,
21579
- document: ensureDocument(document),
21580
- closed: closed
21581
- }, function (unmount) {
21582
- return function (container) {
21583
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21584
- errorCallback: error,
21585
- container: container,
21586
- unmount: unmount
21587
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21588
- configuration: {
21589
- type: 'payment',
21590
- before: before,
21591
- amount: amount,
21592
- accept: accept,
21593
- currency: currency,
21594
- event: event,
21595
- sent: sent,
21596
- succeeded: succeeded,
21597
- validated: validated,
21598
- failed: failed,
21599
- whitelist: whitelist,
21600
- blacklist: blacklist,
21601
- providers: providers,
21602
- track: track,
21603
- fee: fee,
21604
- recover: recover,
21605
- integration: integration,
21606
- link: link
21607
- }
21608
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21609
- unmount: unmount,
21610
- closable: closable
21611
- }, /*#__PURE__*/React.createElement(WalletProvider, {
21612
- document: document,
21613
- container: container,
21614
- connected: connected,
21615
- unmount: unmount
21616
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21617
- accept: accept
21618
- }, /*#__PURE__*/React.createElement(PaymentAmountRoutingProvider, {
21724
+ while (1) switch (_context2.prev = _context2.next) {
21725
+ case 0:
21726
+ accept = _ref3.accept, amount = _ref3.amount, sent = _ref3.sent, succeeded = _ref3.succeeded, validated = _ref3.validated, 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, link = _ref3.link, container = _ref3.container, before = _ref3.before, document = _ref3.document;
21727
+ requireReactVersion();
21728
+ _context2.prev = 2;
21729
+ _context2.next = 5;
21730
+ return preflight$1({
21731
+ accept: accept,
21732
+ recover: recover
21733
+ });
21734
+ case 5:
21735
+ unmount = mount({
21736
+ style: style,
21737
+ container: container,
21738
+ document: ensureDocument(document),
21739
+ closed: closed
21740
+ }, function (unmount) {
21741
+ return function (container) {
21742
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
21743
+ errorCallback: error,
21744
+ container: container,
21745
+ unmount: unmount
21746
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21747
+ configuration: {
21748
+ type: 'payment',
21749
+ before: before,
21750
+ amount: amount,
21619
21751
  accept: accept,
21752
+ currency: currency,
21753
+ event: event,
21754
+ sent: sent,
21755
+ succeeded: succeeded,
21756
+ validated: validated,
21757
+ failed: failed,
21620
21758
  whitelist: whitelist,
21621
21759
  blacklist: blacklist,
21622
- event: event,
21623
- fee: fee
21624
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21625
- document: ensureDocument(document)
21626
- }, /*#__PURE__*/React.createElement(PaymentProvider, {
21627
- container: container,
21628
- document: document
21629
- }, /*#__PURE__*/React.createElement(PaymentValueProvider, null, /*#__PURE__*/React.createElement(PaymentStack, {
21630
- document: document,
21631
- container: container
21632
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))))));
21633
- };
21634
- });
21635
- return _context2.abrupt("return", {
21636
- unmount: unmount
21637
- });
21638
- case 9:
21639
- _context2.prev = 9;
21640
- _context2.t0 = _context2["catch"](2);
21641
- console.log('critical error', _context2.t0);
21642
- if (critical != undefined) {
21643
- critical(_context2.t0);
21644
- }
21645
- case 13:
21646
- case "end":
21647
- return _context2.stop();
21648
- }
21760
+ providers: providers,
21761
+ track: track,
21762
+ fee: fee,
21763
+ recover: recover,
21764
+ integration: integration,
21765
+ link: link
21766
+ }
21767
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21768
+ unmount: unmount,
21769
+ closable: closable
21770
+ }, /*#__PURE__*/React.createElement(WalletProvider, {
21771
+ document: document,
21772
+ container: container,
21773
+ connected: connected,
21774
+ unmount: unmount
21775
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21776
+ accept: accept
21777
+ }, /*#__PURE__*/React.createElement(PaymentAmountRoutingProvider, {
21778
+ accept: accept,
21779
+ whitelist: whitelist,
21780
+ blacklist: blacklist,
21781
+ event: event,
21782
+ fee: fee
21783
+ }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21784
+ document: ensureDocument(document)
21785
+ }, /*#__PURE__*/React.createElement(PaymentProvider, {
21786
+ container: container,
21787
+ document: document
21788
+ }, /*#__PURE__*/React.createElement(PaymentValueProvider, null, /*#__PURE__*/React.createElement(PaymentStack, {
21789
+ document: document,
21790
+ container: container
21791
+ }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))))));
21792
+ };
21793
+ });
21794
+ return _context2.abrupt("return", {
21795
+ unmount: unmount
21796
+ });
21797
+ case 9:
21798
+ _context2.prev = 9;
21799
+ _context2.t0 = _context2["catch"](2);
21800
+ console.log('critical error', _context2.t0);
21801
+ if (critical != undefined) {
21802
+ critical(_context2.t0);
21803
+ }
21804
+ case 13:
21805
+ case "end":
21806
+ return _context2.stop();
21649
21807
  }
21650
21808
  }, _callee2, null, [[2, 9]]);
21651
21809
  }));
@@ -21657,15 +21815,14 @@ Payment.preload = function (_ref5) {
21657
21815
  var account = _ref5.account,
21658
21816
  accept = _ref5.accept,
21659
21817
  whitelist = _ref5.whitelist,
21660
- blacklist = _ref5.blacklist,
21661
- event = _ref5.event,
21662
- fee = _ref5.fee;
21818
+ blacklist = _ref5.blacklist;
21819
+ _ref5.event;
21820
+ var fee = _ref5.fee;
21663
21821
  routePayments({
21664
21822
  account: account,
21665
21823
  accept: accept,
21666
21824
  whitelist: whitelist,
21667
21825
  blacklist: blacklist,
21668
- event: event,
21669
21826
  fee: fee
21670
21827
  });
21671
21828
  };
@@ -21931,31 +22088,29 @@ var preflight = /*#__PURE__*/function () {
21931
22088
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21932
22089
  var sell;
21933
22090
  return regenerator.wrap(function _callee$(_context) {
21934
- while (1) {
21935
- switch (_context.prev = _context.next) {
21936
- case 0:
21937
- sell = _ref.sell;
21938
- if (!(_typeof(sell) != 'object')) {
21939
- _context.next = 3;
21940
- break;
21941
- }
21942
- throw 'You need to configure at least 1 "blockchain": "token"';
21943
- case 3:
21944
- if (!(Object.keys(sell).length == 0)) {
21945
- _context.next = 5;
21946
- break;
21947
- }
21948
- throw 'You need to configure at least 1 "blockchain": "token"';
21949
- case 5:
21950
- if (!(Object.values(sell).length == 0)) {
21951
- _context.next = 7;
21952
- break;
21953
- }
21954
- throw 'You need to configure at least 1 "blockchain": "token"';
21955
- case 7:
21956
- case "end":
21957
- return _context.stop();
21958
- }
22091
+ while (1) switch (_context.prev = _context.next) {
22092
+ case 0:
22093
+ sell = _ref.sell;
22094
+ if (!(_typeof(sell) != 'object')) {
22095
+ _context.next = 3;
22096
+ break;
22097
+ }
22098
+ throw 'You need to configure at least 1 "blockchain": "token"';
22099
+ case 3:
22100
+ if (!(Object.keys(sell).length == 0)) {
22101
+ _context.next = 5;
22102
+ break;
22103
+ }
22104
+ throw 'You need to configure at least 1 "blockchain": "token"';
22105
+ case 5:
22106
+ if (!(Object.values(sell).length == 0)) {
22107
+ _context.next = 7;
22108
+ break;
22109
+ }
22110
+ throw 'You need to configure at least 1 "blockchain": "token"';
22111
+ case 7:
22112
+ case "end":
22113
+ return _context.stop();
21959
22114
  }
21960
22115
  }, _callee);
21961
22116
  }));
@@ -21967,81 +22122,79 @@ var Sale = /*#__PURE__*/function () {
21967
22122
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21968
22123
  var amount, sell, sent, succeeded, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, closable, integration, document, accept, unmount;
21969
22124
  return regenerator.wrap(function _callee2$(_context2) {
21970
- while (1) {
21971
- switch (_context2.prev = _context2.next) {
21972
- case 0:
21973
- amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, succeeded = _ref3.succeeded, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, tokenImage = _ref3.tokenImage, closable = _ref3.closable, integration = _ref3.integration, document = _ref3.document;
21974
- requireReactVersion();
21975
- _context2.prev = 2;
21976
- _context2.next = 5;
21977
- return preflight({
21978
- sell: sell
21979
- });
21980
- case 5:
21981
- accept = Object.keys(sell).map(function (key) {
21982
- return {
21983
- blockchain: key,
21984
- token: sell[key]
21985
- };
21986
- });
21987
- unmount = mount({
21988
- style: style,
21989
- document: ensureDocument(document),
21990
- closed: closed
21991
- }, function (unmount) {
21992
- return function (container) {
21993
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21994
- errorCallback: error,
21995
- container: container,
21996
- unmount: unmount
21997
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21998
- configuration: {
21999
- type: 'sale',
22000
- tokenImage: tokenImage,
22001
- amount: amount,
22002
- sell: sell,
22003
- currency: currency,
22004
- sent: sent,
22005
- succeeded: succeeded,
22006
- failed: failed,
22007
- blacklist: blacklist,
22008
- providers: providers,
22009
- integration: integration
22010
- }
22011
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
22012
- unmount: unmount,
22013
- closable: closable
22014
- }, /*#__PURE__*/React.createElement(WalletProvider, {
22015
- container: container,
22016
- connected: connected,
22017
- unmount: unmount
22018
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
22019
- accept: accept
22020
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
22021
- document: ensureDocument(document)
22022
- }, /*#__PURE__*/React.createElement(SaleRoutingProvider, {
22023
- container: container,
22024
- document: document
22025
- }, /*#__PURE__*/React.createElement(SaleStack, {
22026
- document: document,
22027
- container: container
22028
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
22029
- };
22030
- });
22031
- return _context2.abrupt("return", {
22032
- unmount: unmount
22033
- });
22034
- case 10:
22035
- _context2.prev = 10;
22036
- _context2.t0 = _context2["catch"](2);
22037
- console.log('critical error', _context2.t0);
22038
- if (critical != undefined) {
22039
- critical(_context2.t0);
22040
- }
22041
- case 14:
22042
- case "end":
22043
- return _context2.stop();
22044
- }
22125
+ while (1) switch (_context2.prev = _context2.next) {
22126
+ case 0:
22127
+ amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, succeeded = _ref3.succeeded, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, tokenImage = _ref3.tokenImage, closable = _ref3.closable, integration = _ref3.integration, document = _ref3.document;
22128
+ requireReactVersion();
22129
+ _context2.prev = 2;
22130
+ _context2.next = 5;
22131
+ return preflight({
22132
+ sell: sell
22133
+ });
22134
+ case 5:
22135
+ accept = Object.keys(sell).map(function (key) {
22136
+ return {
22137
+ blockchain: key,
22138
+ token: sell[key]
22139
+ };
22140
+ });
22141
+ unmount = mount({
22142
+ style: style,
22143
+ document: ensureDocument(document),
22144
+ closed: closed
22145
+ }, function (unmount) {
22146
+ return function (container) {
22147
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
22148
+ errorCallback: error,
22149
+ container: container,
22150
+ unmount: unmount
22151
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
22152
+ configuration: {
22153
+ type: 'sale',
22154
+ tokenImage: tokenImage,
22155
+ amount: amount,
22156
+ sell: sell,
22157
+ currency: currency,
22158
+ sent: sent,
22159
+ succeeded: succeeded,
22160
+ failed: failed,
22161
+ blacklist: blacklist,
22162
+ providers: providers,
22163
+ integration: integration
22164
+ }
22165
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
22166
+ unmount: unmount,
22167
+ closable: closable
22168
+ }, /*#__PURE__*/React.createElement(WalletProvider, {
22169
+ container: container,
22170
+ connected: connected,
22171
+ unmount: unmount
22172
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
22173
+ accept: accept
22174
+ }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
22175
+ document: ensureDocument(document)
22176
+ }, /*#__PURE__*/React.createElement(SaleRoutingProvider, {
22177
+ container: container,
22178
+ document: document
22179
+ }, /*#__PURE__*/React.createElement(SaleStack, {
22180
+ document: document,
22181
+ container: container
22182
+ }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
22183
+ };
22184
+ });
22185
+ return _context2.abrupt("return", {
22186
+ unmount: unmount
22187
+ });
22188
+ case 10:
22189
+ _context2.prev = 10;
22190
+ _context2.t0 = _context2["catch"](2);
22191
+ console.log('critical error', _context2.t0);
22192
+ if (critical != undefined) {
22193
+ critical(_context2.t0);
22194
+ }
22195
+ case 14:
22196
+ case "end":
22197
+ return _context2.stop();
22045
22198
  }
22046
22199
  }, _callee2, null, [[2, 10]]);
22047
22200
  }));
@@ -22360,7 +22513,7 @@ var SelectTokenDialog = (function (props) {
22360
22513
  };
22361
22514
  var select = function select(token) {
22362
22515
  if (blockchain.tokens.find(function (majorToken) {
22363
- return majorToken.address.toLowerCase() == (token.address || token.external_id).toLowerCase();
22516
+ return majorToken.address == (token.address || token.external_id);
22364
22517
  })) {
22365
22518
  setOpen(false);
22366
22519
  props.resolve({
@@ -22518,41 +22671,39 @@ var Select = function Select(options) {
22518
22671
  return new Promise( /*#__PURE__*/function () {
22519
22672
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
22520
22673
  return regenerator.wrap(function _callee$(_context) {
22521
- while (1) {
22522
- switch (_context.prev = _context.next) {
22523
- case 0:
22524
- mount({
22525
- style: style,
22526
- document: ensureDocument(document)
22527
- }, function (unmount) {
22528
- var userClosedDialog = function userClosedDialog() {
22529
- reject('USER_CLOSED_DIALOG');
22530
- unmount();
22531
- };
22532
- return function (container) {
22533
- return /*#__PURE__*/React.createElement(ErrorProvider, {
22534
- error: startupError,
22535
- errorCallback: error,
22536
- container: container,
22537
- unmount: unmount
22538
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
22539
- configuration: {
22540
- what: what
22541
- }
22542
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
22543
- unmount: userClosedDialog
22544
- }, /*#__PURE__*/React.createElement(SelectionProvider, null, /*#__PURE__*/React.createElement(SelectStack, {
22545
- document: document,
22546
- container: container,
22547
- unmount: unmount,
22548
- resolve: resolve
22549
- })), /*#__PURE__*/React.createElement(PoweredBy, null)))));
22550
- };
22551
- });
22552
- case 1:
22553
- case "end":
22554
- return _context.stop();
22555
- }
22674
+ while (1) switch (_context.prev = _context.next) {
22675
+ case 0:
22676
+ mount({
22677
+ style: style,
22678
+ document: ensureDocument(document)
22679
+ }, function (unmount) {
22680
+ var userClosedDialog = function userClosedDialog() {
22681
+ reject('USER_CLOSED_DIALOG');
22682
+ unmount();
22683
+ };
22684
+ return function (container) {
22685
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
22686
+ error: startupError,
22687
+ errorCallback: error,
22688
+ container: container,
22689
+ unmount: unmount
22690
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
22691
+ configuration: {
22692
+ what: what
22693
+ }
22694
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
22695
+ unmount: userClosedDialog
22696
+ }, /*#__PURE__*/React.createElement(SelectionProvider, null, /*#__PURE__*/React.createElement(SelectStack, {
22697
+ document: document,
22698
+ container: container,
22699
+ unmount: unmount,
22700
+ resolve: resolve
22701
+ })), /*#__PURE__*/React.createElement(PoweredBy, null)))));
22702
+ };
22703
+ });
22704
+ case 1:
22705
+ case "end":
22706
+ return _context.stop();
22556
22707
  }
22557
22708
  }, _callee);
22558
22709
  }));