@depay/widgets 8.0.7 → 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
@@ -212,14 +212,9 @@ function _regeneratorRuntime() {
212
212
  };
213
213
  }
214
214
  function maybeInvokeDelegate(delegate, context) {
215
- var method = delegate.iterator[context.method];
216
- if (undefined === method) {
217
- if (context.delegate = null, "throw" === context.method) {
218
- if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
219
- context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
220
- }
221
- return ContinueSentinel;
222
- }
215
+ var methodName = context.method,
216
+ method = delegate.iterator[methodName];
217
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
223
218
  var record = tryCatch(method, delegate.iterator, context.arg);
224
219
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
225
220
  var info = record.arg;
@@ -248,9 +243,7 @@ function _regeneratorRuntime() {
248
243
  if (!isNaN(iterable.length)) {
249
244
  var i = -1,
250
245
  next = function next() {
251
- for (; ++i < iterable.length;) {
252
- if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
253
- }
246
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
254
247
  return next.value = undefined, next.done = !0, next;
255
248
  };
256
249
  return next.next = next;
@@ -296,9 +289,7 @@ function _regeneratorRuntime() {
296
289
  }), exports.keys = function (val) {
297
290
  var object = Object(val),
298
291
  keys = [];
299
- for (var key in object) {
300
- keys.push(key);
301
- }
292
+ for (var key in object) keys.push(key);
302
293
  return keys.reverse(), function next() {
303
294
  for (; keys.length;) {
304
295
  var key = keys.pop();
@@ -309,9 +300,7 @@ function _regeneratorRuntime() {
309
300
  }, exports.values = values, Context.prototype = {
310
301
  constructor: Context,
311
302
  reset: function reset(skipTempReset) {
312
- 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) {
313
- "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
314
- }
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);
315
304
  },
316
305
  stop: function stop() {
317
306
  this.done = !0;
@@ -413,35 +402,36 @@ function _arrayWithHoles(arr) {
413
402
  }
414
403
 
415
404
  function _iterableToArrayLimit(arr, i) {
416
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
417
- if (_i == null) return;
418
- var _arr = [];
419
- var _n = true;
420
- var _d = false;
421
- var _s, _e;
422
- try {
423
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
424
- _arr.push(_s.value);
425
- if (i && _arr.length === i) break;
426
- }
427
- } catch (err) {
428
- _d = true;
429
- _e = err;
430
- } finally {
405
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
406
+ if (null != _i) {
407
+ var _s,
408
+ _e,
409
+ _x,
410
+ _r,
411
+ _arr = [],
412
+ _n = !0,
413
+ _d = !1;
431
414
  try {
432
- if (!_n && _i["return"] != null) _i["return"]();
415
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
416
+ if (Object(_i) !== _i) return;
417
+ _n = !1;
418
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
419
+ } catch (err) {
420
+ _d = !0, _e = err;
433
421
  } finally {
434
- if (_d) throw _e;
422
+ try {
423
+ if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
424
+ } finally {
425
+ if (_d) throw _e;
426
+ }
435
427
  }
428
+ return _arr;
436
429
  }
437
- return _arr;
438
430
  }
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
  }))();
@@ -868,13 +852,29 @@ function _classCallCheck(instance, Constructor) {
868
852
  }
869
853
  }
870
854
 
855
+ function _toPrimitive(input, hint) {
856
+ if (_typeof(input) !== "object" || input === null) return input;
857
+ var prim = input[Symbol.toPrimitive];
858
+ if (prim !== undefined) {
859
+ var res = prim.call(input, hint || "default");
860
+ if (_typeof(res) !== "object") return res;
861
+ throw new TypeError("@@toPrimitive must return a primitive value.");
862
+ }
863
+ return (hint === "string" ? String : Number)(input);
864
+ }
865
+
866
+ function _toPropertyKey(arg) {
867
+ var key = _toPrimitive(arg, "string");
868
+ return _typeof(key) === "symbol" ? key : String(key);
869
+ }
870
+
871
871
  function _defineProperties(target, props) {
872
872
  for (var i = 0; i < props.length; i++) {
873
873
  var descriptor = props[i];
874
874
  descriptor.enumerable = descriptor.enumerable || false;
875
875
  descriptor.configurable = true;
876
876
  if ("value" in descriptor) descriptor.writable = true;
877
- Object.defineProperty(target, descriptor.key, descriptor);
877
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
878
878
  }
879
879
  }
880
880
  function _createClass(Constructor, protoProps, staticProps) {
@@ -1400,55 +1400,53 @@ var Connect = function Connect(options) {
1400
1400
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
1401
1401
  var wallet, account;
1402
1402
  return regenerator.wrap(function _callee$(_context) {
1403
- while (1) {
1404
- switch (_context.prev = _context.next) {
1405
- case 0:
1406
- wallet = getWallets()[0];
1407
- if (!wallet) {
1408
- _context.next = 7;
1409
- break;
1410
- }
1411
- _context.next = 4;
1412
- return wallet.account();
1413
- case 4:
1414
- account = _context.sent;
1415
- if (!account) {
1416
- _context.next = 7;
1417
- break;
1418
- }
1419
- return _context.abrupt("return", resolve({
1420
- wallet: wallet,
1421
- account: account
1422
- }));
1423
- case 7:
1424
- mount({
1425
- style: style,
1426
- document: ensureDocument(document)
1427
- }, function (unmount) {
1428
- var rejectBeforeUnmount = function rejectBeforeUnmount() {
1429
- reject('USER_CLOSED_DIALOG');
1430
- unmount();
1431
- };
1432
- return function (container) {
1433
- return /*#__PURE__*/React.createElement(ErrorProvider, {
1434
- errorCallback: error,
1435
- container: container,
1436
- unmount: unmount
1437
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
1438
- unmount: rejectBeforeUnmount
1439
- }, /*#__PURE__*/React.createElement(ConnectStack, {
1440
- document: document,
1441
- container: container,
1442
- resolve: resolve,
1443
- reject: reject,
1444
- autoClose: true
1445
- }), /*#__PURE__*/React.createElement(PoweredBy, null))));
1446
- };
1447
- });
1448
- case 8:
1449
- case "end":
1450
- return _context.stop();
1451
- }
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();
1452
1450
  }
1453
1451
  }, _callee);
1454
1452
  }));
@@ -18809,7 +18807,7 @@ var ChangableAmountProvider = (function (props) {
18809
18807
  } else {
18810
18808
  Promise.all(props.accept.map(function (configuration) {
18811
18809
  if (fixedAmount) {
18812
- if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
18810
+ if (CONSTANTS[configuration.blockchain].USD == configuration.token) {
18813
18811
  return 1.00 / fixedCurrencyConversionRate * fixedAmount;
18814
18812
  } else {
18815
18813
  return route({
@@ -18822,7 +18820,7 @@ var ChangableAmountProvider = (function (props) {
18822
18820
  });
18823
18821
  }
18824
18822
  } else {
18825
- if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
18823
+ if (CONSTANTS[configuration.blockchain].USD == configuration.token) {
18826
18824
  return 1.00 / conversionRate * amount;
18827
18825
  } else {
18828
18826
  return route({
@@ -19093,8 +19091,11 @@ var PaymentProvider = (function (props) {
19093
19091
  wallet = _useContext8.wallet;
19094
19092
  var _useContext9 = useContext(PaymentTrackingContext),
19095
19093
  release = _useContext9.release,
19096
- tracking = _useContext9.tracking,
19097
- initializePaymentTracking = _useContext9.initializeTracking;
19094
+ synchronousTracking = _useContext9.synchronousTracking,
19095
+ asynchronousTracking = _useContext9.asynchronousTracking,
19096
+ trackingInitialized = _useContext9.trackingInitialized,
19097
+ initializePaymentTracking = _useContext9.initializeTracking,
19098
+ preTrack = _useContext9.preTrack;
19098
19099
  var _useContext10 = useContext(TransactionTrackingContext),
19099
19100
  foundTransaction = _useContext10.foundTransaction,
19100
19101
  initializeTransactionTracking = _useContext10.initializeTracking;
@@ -19115,7 +19116,7 @@ var PaymentProvider = (function (props) {
19115
19116
  paymentState = _useState8[0],
19116
19117
  setPaymentState = _useState8[1];
19117
19118
  var paymentSucceeded = function paymentSucceeded(transaction) {
19118
- if (tracking != true) {
19119
+ if (synchronousTracking == false && (asynchronousTracking == false || trackingInitialized == true)) {
19119
19120
  setClosable(true);
19120
19121
  }
19121
19122
  setPaymentState('success');
@@ -19124,43 +19125,47 @@ var PaymentProvider = (function (props) {
19124
19125
  }
19125
19126
  };
19126
19127
  var paymentFailed = function paymentFailed(transaction, error) {
19128
+ if (asynchronousTracking == false || trackingInitialized == true) {
19129
+ setClosable(true);
19130
+ }
19131
+ set(['PaymentFailed']);
19132
+ setPaymentState('failed');
19127
19133
  if (failed) {
19128
19134
  failed(transaction, error);
19129
19135
  }
19130
- setClosable(true);
19131
- set(['PaymentFailed']);
19132
19136
  };
19133
19137
  var pay = /*#__PURE__*/function () {
19134
19138
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
19135
19139
  var stop, currentBlock;
19136
19140
  return regenerator.wrap(function _callee$(_context) {
19137
- while (1) {
19138
- switch (_context.prev = _context.next) {
19139
- case 0:
19140
- if (!before) {
19141
- _context.next = 6;
19142
- break;
19143
- }
19144
- _context.next = 3;
19145
- return before(payment.route.transaction);
19146
- case 3:
19147
- stop = _context.sent;
19148
- if (!(stop === false)) {
19149
- _context.next = 6;
19150
- break;
19151
- }
19152
- return _context.abrupt("return");
19153
- case 6:
19154
- setClosable(false);
19155
- setPaymentState('paying');
19156
- setUpdatable(false);
19157
- _context.next = 11;
19158
- return request({
19159
- blockchain: payment.route.transaction.blockchain,
19160
- method: 'latestBlockNumber'
19161
- });
19162
- case 11:
19163
- 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 () {
19164
19169
  wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
19165
19170
  sent: function sent(transaction) {
19166
19171
  initializeTransactionTracking(transaction, currentBlock);
@@ -19178,14 +19183,20 @@ var PaymentProvider = (function (props) {
19178
19183
  setPaymentState('initialized');
19179
19184
  setClosable(true);
19180
19185
  setUpdatable(true);
19181
- 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') {
19182
19187
  navigate('WrongNetwork');
19183
19188
  }
19184
19189
  });
19185
- case 13:
19186
- case "end":
19187
- return _context.stop();
19188
- }
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();
19189
19200
  }
19190
19201
  }, _callee);
19191
19202
  }));
@@ -19216,6 +19227,11 @@ var PaymentProvider = (function (props) {
19216
19227
  setPaymentState('success');
19217
19228
  }
19218
19229
  }, [release]);
19230
+ useEffect(function () {
19231
+ if (asynchronousTracking && trackingInitialized && (paymentState == 'success' || paymentState == 'failed')) {
19232
+ setClosable(true);
19233
+ }
19234
+ }, [trackingInitialized, paymentState]);
19219
19235
  useEffect(function () {
19220
19236
  if (recover) {
19221
19237
  setClosable(false);
@@ -19251,7 +19267,7 @@ var PaymentProvider = (function (props) {
19251
19267
  useEffect(function () {
19252
19268
  if (foundTransaction && foundTransaction.id && foundTransaction.status) {
19253
19269
  var newTransaction;
19254
- if (foundTransaction.id.toLowerCase() != transaction.id.toLowerCase()) {
19270
+ if (foundTransaction.id != transaction.id) {
19255
19271
  newTransaction = Object.assign({}, transaction, {
19256
19272
  id: foundTransaction.id,
19257
19273
  url: Blockchain.findByName(transaction.blockchain).explorerUrlFor({
@@ -19321,6 +19337,7 @@ var PaymentProvider = (function (props) {
19321
19337
  });
19322
19338
 
19323
19339
  function _defineProperty(obj, key, value) {
19340
+ key = _toPropertyKey(key);
19324
19341
  if (key in obj) {
19325
19342
  Object.defineProperty(obj, key, {
19326
19343
  value: value,
@@ -19356,14 +19373,13 @@ var routePayments = (function (_ref) {
19356
19373
  account = _ref.account,
19357
19374
  whitelist = _ref.whitelist,
19358
19375
  blacklist = _ref.blacklist,
19359
- event = _ref.event,
19360
19376
  fee = _ref.fee;
19361
19377
  return route$1({
19362
19378
  accept: accept.map(prepareAcceptedPayments),
19363
19379
  from: mergeFromAccounts(accept, account),
19364
19380
  whitelist: whitelist,
19365
19381
  blacklist: blacklist,
19366
- event: event,
19382
+ event: 'ifRoutedAndNative',
19367
19383
  fee: fee
19368
19384
  });
19369
19385
  });
@@ -19400,55 +19416,51 @@ var PaymentRoutingProvider = (function (props) {
19400
19416
  var onRoutesUpdate = /*#__PURE__*/function () {
19401
19417
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(routes) {
19402
19418
  return regenerator.wrap(function _callee2$(_context2) {
19403
- while (1) {
19404
- switch (_context2.prev = _context2.next) {
19405
- case 0:
19406
- if (routes.length == 0) {
19407
- setAllRoutes([]);
19408
- if (props.setMaxRoute) {
19409
- props.setMaxRoute(null);
19410
- }
19411
- } else {
19412
- roundAmounts(routes).then( /*#__PURE__*/function () {
19413
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(roundedRoutes) {
19414
- var selectRoute, newSelectRoute;
19415
- return regenerator.wrap(function _callee$(_context) {
19416
- while (1) {
19417
- switch (_context.prev = _context.next) {
19418
- case 0:
19419
- if (typeof selectedRoute == 'undefined') {
19420
- selectRoute = roundedRoutes[0];
19421
- setSelectedRoute(selectRoute);
19422
- } else {
19423
- newSelectRoute = roundedRoutes[roundedRoutes.findIndex(function (route) {
19424
- return route.fromToken.address == selectedRoute.fromToken.address && route.blockchain == selectedRoute.blockchain;
19425
- })];
19426
- if (newSelectRoute) {
19427
- if (selectedRoute.fromAmount != newSelectRoute.fromAmount) {
19428
- setUpdatedRouteWithNewPrice(newSelectRoute);
19429
- }
19430
- }
19431
- }
19432
- setAllRoutes(roundedRoutes);
19433
- if (props.setMaxRoute) {
19434
- 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);
19435
19443
  }
19436
- case 3:
19437
- case "end":
19438
- return _context.stop();
19444
+ }
19439
19445
  }
19440
- }
19441
- }, _callee);
19442
- }));
19443
- return function (_x2) {
19444
- return _ref2.apply(this, arguments);
19445
- };
19446
- }());
19447
- }
19448
- case 1:
19449
- case "end":
19450
- return _context2.stop();
19451
- }
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();
19452
19464
  }
19453
19465
  }, _callee2);
19454
19466
  }));
@@ -19484,29 +19496,27 @@ var PaymentRoutingProvider = (function (props) {
19484
19496
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(route, amountBN) {
19485
19497
  var readableAmount, roundedAmountBN;
19486
19498
  return regenerator.wrap(function _callee3$(_context3) {
19487
- while (1) {
19488
- switch (_context3.prev = _context3.next) {
19489
- case 0:
19490
- if (!route.directTransfer) {
19491
- _context3.next = 2;
19492
- break;
19493
- }
19494
- return _context3.abrupt("return", route);
19495
- case 2:
19496
- _context3.next = 4;
19497
- return route.fromToken.readable(amountBN || route.transaction.params.amounts[0]);
19498
- case 4:
19499
- readableAmount = _context3.sent;
19500
- _context3.next = 7;
19501
- return route.fromToken.BigNumber(round(readableAmount));
19502
- case 7:
19503
- roundedAmountBN = _context3.sent;
19504
- updateRouteAmount(route, roundedAmountBN);
19505
- return _context3.abrupt("return", route);
19506
- case 10:
19507
- case "end":
19508
- return _context3.stop();
19509
- }
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();
19510
19520
  }
19511
19521
  }, _callee3);
19512
19522
  }));
@@ -19517,16 +19527,14 @@ var PaymentRoutingProvider = (function (props) {
19517
19527
  var roundAmounts = /*#__PURE__*/function () {
19518
19528
  var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(routes) {
19519
19529
  return regenerator.wrap(function _callee4$(_context4) {
19520
- while (1) {
19521
- switch (_context4.prev = _context4.next) {
19522
- case 0:
19523
- return _context4.abrupt("return", Promise.all(routes.map(function (route) {
19524
- return roundAmount(route);
19525
- })));
19526
- case 1:
19527
- case "end":
19528
- return _context4.stop();
19529
- }
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();
19530
19538
  }
19531
19539
  }, _callee4);
19532
19540
  }));
@@ -19537,15 +19545,13 @@ var PaymentRoutingProvider = (function (props) {
19537
19545
  var updateRouteWithNewPrice = /*#__PURE__*/function () {
19538
19546
  var _ref6 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5() {
19539
19547
  return regenerator.wrap(function _callee5$(_context5) {
19540
- while (1) {
19541
- switch (_context5.prev = _context5.next) {
19542
- case 0:
19543
- setSelectedRoute(_objectSpread({}, updatedRouteWithNewPrice));
19544
- setUpdatedRouteWithNewPrice(null);
19545
- case 2:
19546
- case "end":
19547
- return _context5.stop();
19548
- }
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();
19549
19555
  }
19550
19556
  }, _callee5);
19551
19557
  }));
@@ -19625,6 +19631,7 @@ var PaymentValueProvider = (function (props) {
19625
19631
  if (updatable == false || (payment === null || payment === void 0 ? void 0 : payment.route) == undefined) {
19626
19632
  return;
19627
19633
  }
19634
+ setPaymentValueLoss(null);
19628
19635
  Promise.all([route({
19629
19636
  blockchain: payment.route.blockchain,
19630
19637
  tokenIn: payment.route.fromToken.address,
@@ -19660,7 +19667,7 @@ var PaymentValueProvider = (function (props) {
19660
19667
  }
19661
19668
  }
19662
19669
  var fromTokenUSDAmount;
19663
- if (payment.route.fromToken.address.toLowerCase() == CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
19670
+ if (payment.route.fromToken.address == CONSTANTS[payment.route.blockchain].USD) {
19664
19671
  fromTokenUSDAmount = payment.route.fromAmount.toString();
19665
19672
  } else if (fromTokenUSDRoute == undefined) {
19666
19673
  setPaymentValue('');
@@ -20075,6 +20082,16 @@ var DigitalWalletIcon = (function (props) {
20075
20082
  }));
20076
20083
  });
20077
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
+
20078
20095
  var LoadingText = (function (props) {
20079
20096
  return /*#__PURE__*/React.createElement("div", {
20080
20097
  className: "LoadingText"
@@ -20092,9 +20109,13 @@ var Footer = (function () {
20092
20109
  _useContext.amount;
20093
20110
  _useContext.amountsMissing;
20094
20111
  var _useContext2 = useContext(PaymentTrackingContext),
20095
- tracking = _useContext2.tracking,
20112
+ synchronousTracking = _useContext2.synchronousTracking,
20113
+ asynchronousTracking = _useContext2.asynchronousTracking,
20114
+ trackingInitialized = _useContext2.trackingInitialized,
20096
20115
  release = _useContext2.release,
20097
- forwardTo = _useContext2.forwardTo;
20116
+ forwardTo = _useContext2.forwardTo,
20117
+ confirmationsRequired = _useContext2.confirmationsRequired,
20118
+ confirmationsPassed = _useContext2.confirmationsPassed;
20098
20119
  var _useContext3 = useContext(PaymentContext),
20099
20120
  payment = _useContext3.payment,
20100
20121
  paymentState = _useContext3.paymentState,
@@ -20113,11 +20134,54 @@ var Footer = (function () {
20113
20134
  _useContext6.navigate;
20114
20135
  var _useContext7 = useContext(ClosableContext),
20115
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]);
20116
20165
  var trackingInfo = function trackingInfo() {
20117
- if (tracking != true) {
20166
+ if (synchronousTracking == false && asynchronousTracking == false || asynchronousTracking && trackingInitialized) {
20118
20167
  return null;
20119
- }
20120
- if (release) {
20168
+ } else if (asynchronousTracking && trackingInitialized == false) {
20169
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
20170
+ className: "Card transparent small disabled"
20171
+ }, /*#__PURE__*/React.createElement("div", {
20172
+ className: "CardImage"
20173
+ }, /*#__PURE__*/React.createElement("div", {
20174
+ className: "TextCenter"
20175
+ }, /*#__PURE__*/React.createElement("div", {
20176
+ className: "Loading Icon"
20177
+ }))), /*#__PURE__*/React.createElement("div", {
20178
+ className: "CardBody"
20179
+ }, /*#__PURE__*/React.createElement("div", {
20180
+ className: "CardBodyWrapper"
20181
+ }, /*#__PURE__*/React.createElement("div", {
20182
+ className: "Opacity05"
20183
+ }, "Initializing tracking")))));
20184
+ } else if (release) {
20121
20185
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
20122
20186
  className: "Card transparent small disabled"
20123
20187
  }, /*#__PURE__*/React.createElement("div", {
@@ -20148,7 +20212,9 @@ var Footer = (function () {
20148
20212
  className: "CardBodyWrapper"
20149
20213
  }, /*#__PURE__*/React.createElement("div", {
20150
20214
  className: "Opacity05"
20151
- }, "Validating payment")))));
20215
+ }, "Validating payment", confirmationsRequired && secondsLeft > 0 && /*#__PURE__*/React.createElement("span", {
20216
+ title: "".concat(confirmationsPassed, "/").concat(confirmationsRequired, " required confirmations")
20217
+ }, " ", secondsLeft, "s"))))));
20152
20218
  }
20153
20219
  };
20154
20220
  var additionalPaymentInformation = function additionalPaymentInformation() {
@@ -20175,7 +20241,7 @@ var Footer = (function () {
20175
20241
  className: "PaddingBottomS"
20176
20242
  }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("a", {
20177
20243
  className: "Card transparent small",
20178
- title: "Payment has been confirmed by the network",
20244
+ title: "Transaction has been confirmed by the network",
20179
20245
  href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
20180
20246
  target: "_blank",
20181
20247
  rel: "noopener noreferrer"
@@ -20191,7 +20257,7 @@ var Footer = (function () {
20191
20257
  className: "CardBodyWrapper"
20192
20258
  }, /*#__PURE__*/React.createElement("div", {
20193
20259
  className: "Opacity05"
20194
- }, "Payment confirmed"))))), trackingInfo());
20260
+ }, "Transaction confirmed"))))), trackingInfo());
20195
20261
  }
20196
20262
  };
20197
20263
  var approvalButton = function approvalButton() {
@@ -20199,7 +20265,7 @@ var Footer = (function () {
20199
20265
  return null;
20200
20266
  } else if (paymentState == 'initialized') {
20201
20267
  return /*#__PURE__*/React.createElement("div", {
20202
- className: "PaddingBottomS"
20268
+ className: "PaddingBottomXS"
20203
20269
  }, /*#__PURE__*/React.createElement("button", {
20204
20270
  className: "ButtonPrimary",
20205
20271
  onClick: approve,
@@ -20257,7 +20323,7 @@ var Footer = (function () {
20257
20323
  rel: "noopener noreferrer"
20258
20324
  }, /*#__PURE__*/React.createElement(LoadingText, null, "Paying"));
20259
20325
  } else if (paymentState == 'success') {
20260
- if (tracking == true) {
20326
+ if (synchronousTracking == true) {
20261
20327
  if (release) {
20262
20328
  if (forwardTo) {
20263
20329
  return /*#__PURE__*/React.createElement("a", {
@@ -20277,6 +20343,11 @@ var Footer = (function () {
20277
20343
  onClick: function onClick() {}
20278
20344
  }, "Continue");
20279
20345
  }
20346
+ } else if (asynchronousTracking == true && trackingInitialized == false) {
20347
+ return /*#__PURE__*/React.createElement("button", {
20348
+ className: "ButtonPrimary disabled",
20349
+ onClick: function onClick() {}
20350
+ }, "Close");
20280
20351
  } else {
20281
20352
  return /*#__PURE__*/React.createElement("button", {
20282
20353
  className: "ButtonPrimary",
@@ -20400,7 +20471,7 @@ var PaymentFailedDialog = (function () {
20400
20471
  className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
20401
20472
  }, /*#__PURE__*/React.createElement("strong", {
20402
20473
  className: "FontSizeM"
20403
- }, "Unfortunately executing your payment failed. You can go back and try again."), transaction && /*#__PURE__*/React.createElement("div", {
20474
+ }, "Unfortunately executing your payment failed, but you can try again."), transaction && /*#__PURE__*/React.createElement("div", {
20404
20475
  className: "PaddingTopS"
20405
20476
  }, /*#__PURE__*/React.createElement("a", {
20406
20477
  className: "Link",
@@ -20516,37 +20587,59 @@ var PaymentTrackingProvider = (function (props) {
20516
20587
  integration = _useContext2.integration,
20517
20588
  link = _useContext2.link,
20518
20589
  type = _useContext2.type;
20590
+ var _useContext3 = useContext(WalletContext),
20591
+ account = _useContext3.account;
20592
+ _useContext3.wallet;
20519
20593
  var _useState = useState(),
20520
20594
  _useState2 = _slicedToArray(_useState, 2),
20521
20595
  transaction = _useState2[0],
20522
20596
  setTransaction = _useState2[1];
20523
20597
  var _useState3 = useState(),
20524
20598
  _useState4 = _slicedToArray(_useState3, 2),
20525
- afterBlock = _useState4[0],
20526
- setAfterBlock = _useState4[1];
20599
+ confirmationsRequired = _useState4[0],
20600
+ setConfirmationsRequired = _useState4[1];
20527
20601
  var _useState5 = useState(),
20528
20602
  _useState6 = _slicedToArray(_useState5, 2),
20529
- paymentRoute = _useState6[0],
20530
- setPaymentRoute = _useState6[1];
20531
- var _useState7 = useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
20532
- _useState8 = _slicedToArray(_useState7, 1),
20533
- tracking = _useState8[0];
20534
- var _useState9 = useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
20535
- _useState10 = _slicedToArray(_useState9, 1),
20536
- polling = _useState10[0];
20537
- var _useState11 = useState(false),
20603
+ confirmationsPassed = _useState6[0],
20604
+ setConfirmationsPassed = _useState6[1];
20605
+ var _useState7 = useState(),
20606
+ _useState8 = _slicedToArray(_useState7, 2),
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(),
20538
20614
  _useState12 = _slicedToArray(_useState11, 2),
20539
- release = _useState12[0],
20540
- setRelease = _useState12[1];
20541
- var _useState13 = useState(),
20615
+ paymentRoute = _useState12[0],
20616
+ setPaymentRoute = _useState12[1];
20617
+ var _useState13 = useState(false),
20542
20618
  _useState14 = _slicedToArray(_useState13, 2),
20543
- forwardTo = _useState14[0],
20544
- setForwardTo = _useState14[1];
20545
- var _useContext3 = useContext(ClosableContext),
20546
- setClosable = _useContext3.setClosable;
20547
- var _useContext4 = useContext(NavigateContext),
20548
- navigate = _useContext4.navigate;
20549
- _useContext4.set;
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;
20550
20643
  var openSocket = function openSocket(transaction) {
20551
20644
  var socket = new WebSocket('wss://integrate.depay.com/cable');
20552
20645
  socket.onopen = function (event) {
@@ -20554,14 +20647,18 @@ var PaymentTrackingProvider = (function (props) {
20554
20647
  command: 'subscribe',
20555
20648
  identifier: JSON.stringify({
20556
20649
  blockchain: transaction.blockchain,
20557
- sender: transaction.from.toLowerCase(),
20558
- nonce: transaction.nonce,
20650
+ sender: transaction.from,
20651
+ nonce: transaction.nonce.toString(),
20559
20652
  channel: 'PaymentChannel'
20560
20653
  })
20561
20654
  };
20562
20655
  socket.send(JSON.stringify(msg));
20563
20656
  };
20564
- socket.onclose = function (event) {};
20657
+ socket.onclose = function (event) {
20658
+ if (!event || event.code != 1000) {
20659
+ openSocket(transaction);
20660
+ }
20661
+ };
20565
20662
  socket.onmessage = function (event) {
20566
20663
  var item = JSON.parse(event.data);
20567
20664
  if (item.type === "ping" || !item.message) {
@@ -20574,12 +20671,15 @@ var PaymentTrackingProvider = (function (props) {
20574
20671
  setRelease(true);
20575
20672
  setClosable(!item.message.forward_to);
20576
20673
  setForwardTo(item.message.forward_to);
20577
- socket.close();
20674
+ socket.close(1000);
20578
20675
  if (!!item.message.forward_to) {
20579
20676
  setTimeout(function () {
20580
20677
  props.document.location.href = item.message.forward_to;
20581
20678
  }, 200);
20582
20679
  }
20680
+ } else if (item.message.confirmations) {
20681
+ setConfirmationsRequired(item.message.confirmations.required);
20682
+ setConfirmationsPassed(item.message.confirmations.passed);
20583
20683
  }
20584
20684
  };
20585
20685
  socket.onerror = function (error) {
@@ -20624,10 +20724,10 @@ var PaymentTrackingProvider = (function (props) {
20624
20724
  var _paymentRoute$feeAmou;
20625
20725
  callTracking({
20626
20726
  blockchain: transaction.blockchain,
20627
- transaction: transaction.id.toLowerCase(),
20628
- sender: transaction.from.toLowerCase(),
20629
- nonce: transaction.nonce,
20630
- after_block: afterBlock,
20727
+ transaction: transaction.id,
20728
+ sender: transaction.from,
20729
+ nonce: transaction.nonce.toString(),
20730
+ after_block: afterBlock.toString(),
20631
20731
  from_token: paymentRoute.fromToken.address,
20632
20732
  from_amount: paymentRoute.fromAmount.toString(),
20633
20733
  from_decimals: paymentRoute.fromDecimals,
@@ -20636,6 +20736,7 @@ var PaymentTrackingProvider = (function (props) {
20636
20736
  to_decimals: paymentRoute.toDecimals,
20637
20737
  fee_amount: paymentRoute === null || paymentRoute === void 0 ? void 0 : (_paymentRoute$feeAmou = paymentRoute.feeAmount) === null || _paymentRoute$feeAmou === void 0 ? void 0 : _paymentRoute$feeAmou.toString()
20638
20738
  }).then(function (response) {
20739
+ setTrackingInitialized(true);
20639
20740
  console.log('PAYMENT TRACKING INITIALIZED');
20640
20741
  })["catch"](function (error) {
20641
20742
  console.log('PAYMENT TRACKING FAILED', error);
@@ -20648,10 +20749,10 @@ var PaymentTrackingProvider = (function (props) {
20648
20749
  }
20649
20750
  var payment = {
20650
20751
  blockchain: transaction.blockchain,
20651
- transaction: transaction.id.toLowerCase(),
20652
- sender: transaction.from.toLowerCase(),
20653
- nonce: transaction.nonce,
20654
- after_block: afterBlock,
20752
+ transaction: transaction.id,
20753
+ sender: transaction.from,
20754
+ nonce: transaction.nonce.toString(),
20755
+ after_block: afterBlock.toString(),
20655
20756
  to_token: paymentRoute.toToken.address
20656
20757
  };
20657
20758
  var handlePollingResponse = function handlePollingResponse(data) {
@@ -20692,7 +20793,7 @@ var PaymentTrackingProvider = (function (props) {
20692
20793
  if (!polling) {
20693
20794
  return;
20694
20795
  }
20695
- if (!tracking) {
20796
+ if (!synchronousTracking) {
20696
20797
  return;
20697
20798
  }
20698
20799
  var pollingInterval = setInterval(function () {
@@ -20711,16 +20812,16 @@ var PaymentTrackingProvider = (function (props) {
20711
20812
  body: JSON.stringify({
20712
20813
  blockchain: transaction.blockchain,
20713
20814
  transaction: transaction.id,
20714
- sender: transaction.from.toLowerCase(),
20715
- nonce: transaction.nonce,
20815
+ sender: transaction.from,
20816
+ nonce: transaction.nonce.toString(),
20716
20817
  receiver: paymentRoute.toAddress,
20717
20818
  token: paymentRoute.toToken.address,
20718
20819
  amount: paymentRoute.fee ? ethers.utils.formatUnits(paymentRoute.transaction.params.amounts[1], paymentRoute.toDecimals) : ethers.utils.formatUnits(paymentRoute.toAmount, paymentRoute.toDecimals),
20719
20820
  confirmations: 1,
20720
- after_block: afterBlock,
20821
+ after_block: afterBlock.toString(),
20721
20822
  uuid: transaction.id,
20722
20823
  payload: {
20723
- sender_id: transaction.from.toLowerCase(),
20824
+ sender_id: transaction.from,
20724
20825
  sender_token_id: paymentRoute.fromToken.address,
20725
20826
  sender_amount: ethers.utils.formatUnits(paymentRoute.fromAmount, paymentRoute.fromDecimals),
20726
20827
  integration: integration,
@@ -20744,10 +20845,10 @@ var PaymentTrackingProvider = (function (props) {
20744
20845
  };
20745
20846
  var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
20746
20847
  storePayment(transaction, afterBlock, paymentRoute);
20747
- if (tracking || track && track.async == true) {
20848
+ if (synchronousTracking || track && track.async == true) {
20748
20849
  startTracking(transaction, afterBlock, paymentRoute);
20749
20850
  }
20750
- if (tracking == false) {
20851
+ if (synchronousTracking == false) {
20751
20852
  return;
20752
20853
  }
20753
20854
  setTransaction(transaction);
@@ -20755,13 +20856,95 @@ var PaymentTrackingProvider = (function (props) {
20755
20856
  setPaymentRoute(paymentRoute);
20756
20857
  openSocket(transaction);
20757
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
+ };
20758
20936
  return /*#__PURE__*/React.createElement(PaymentTrackingContext.Provider, {
20759
20937
  value: {
20760
- tracking: tracking,
20938
+ synchronousTracking: synchronousTracking,
20939
+ asynchronousTracking: asynchronousTracking,
20761
20940
  initializeTracking: initializeTracking,
20941
+ preTrack: preTrack,
20942
+ trackingInitialized: trackingInitialized,
20762
20943
  continueTryTracking: continueTryTracking,
20763
20944
  release: release,
20764
- forwardTo: forwardTo
20945
+ forwardTo: forwardTo,
20946
+ confirmationsRequired: confirmationsRequired,
20947
+ confirmationsPassed: confirmationsPassed
20765
20948
  }
20766
20949
  }, props.children);
20767
20950
  });
@@ -20786,7 +20969,7 @@ var TransactionTrackingProvider = (function (props) {
20786
20969
  useEffect(function () {
20787
20970
  if (polling) {
20788
20971
  var poll = function poll() {
20789
- 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) {
20790
20973
  if (response.status == 200) {
20791
20974
  response.json().then(function (data) {
20792
20975
  if (data.status != 'pending') {
@@ -20819,10 +21002,10 @@ var TransactionTrackingProvider = (function (props) {
20819
21002
  },
20820
21003
  body: JSON.stringify({
20821
21004
  id: transaction.id,
20822
- after_block: afterBlock,
21005
+ after_block: afterBlock.toString(),
20823
21006
  blockchain: transaction.blockchain,
20824
- sender: transaction.from.toLowerCase(),
20825
- nonce: transaction.nonce
21007
+ sender: transaction.from,
21008
+ nonce: transaction.nonce.toString()
20826
21009
  })
20827
21010
  }).then(function (response) {
20828
21011
  if (response.status == 200 || response.status == 201) {
@@ -20847,14 +21030,18 @@ var TransactionTrackingProvider = (function (props) {
20847
21030
  command: 'subscribe',
20848
21031
  identifier: JSON.stringify({
20849
21032
  blockchain: transaction.blockchain,
20850
- sender: transaction.from.toLowerCase(),
20851
- nonce: transaction.nonce,
21033
+ sender: transaction.from,
21034
+ nonce: transaction.nonce.toString(),
20852
21035
  channel: 'TransactionChannel'
20853
21036
  })
20854
21037
  };
20855
21038
  socket.send(JSON.stringify(msg));
20856
21039
  };
20857
- socket.onclose = function (event) {};
21040
+ socket.onclose = function (event) {
21041
+ if (!event || event.code != 1000) {
21042
+ openSocket(transaction);
21043
+ }
21044
+ };
20858
21045
  socket.onmessage = function (event) {
20859
21046
  var item = JSON.parse(event.data);
20860
21047
  if (item.type === "ping") {
@@ -20862,6 +21049,7 @@ var TransactionTrackingProvider = (function (props) {
20862
21049
  }
20863
21050
  if (item.message && item.message.status && item.message.status != 'pending') {
20864
21051
  setFoundTransaction(item.message);
21052
+ socket.close(1000);
20865
21053
  }
20866
21054
  };
20867
21055
  socket.onerror = function (error) {
@@ -20942,34 +21130,32 @@ var preflight$2 = /*#__PURE__*/function () {
20942
21130
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
20943
21131
  var accept;
20944
21132
  return regenerator.wrap(function _callee$(_context) {
20945
- while (1) {
20946
- switch (_context.prev = _context.next) {
20947
- case 0:
20948
- accept = _ref.accept;
20949
- if (!(!(accept instanceof Array) || accept.length == 0)) {
20950
- _context.next = 3;
20951
- 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!';
20952
21145
  }
20953
- throw 'You need to set the tokens you accept as donation!';
20954
- case 3:
20955
- accept.forEach(function (configuration) {
20956
- if (typeof configuration.blockchain === 'undefined') {
20957
- throw 'You need to set the blockchain you want to receive the donation on!';
20958
- }
20959
- if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
20960
- throw 'You need to set a supported blockchain!';
20961
- }
20962
- if (typeof configuration.token === 'undefined') {
20963
- throw 'You need to set the token you want to receive as donation!';
20964
- }
20965
- if (typeof configuration.receiver === 'undefined') {
20966
- throw 'You need to set the receiver address that you want to receive the donation!';
20967
- }
20968
- });
20969
- case 4:
20970
- case "end":
20971
- return _context.stop();
20972
- }
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();
20973
21159
  }
20974
21160
  }, _callee);
20975
21161
  }));
@@ -20981,82 +21167,80 @@ var Donation = /*#__PURE__*/function () {
20981
21167
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
20982
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;
20983
21169
  return regenerator.wrap(function _callee2$(_context2) {
20984
- while (1) {
20985
- switch (_context2.prev = _context2.next) {
20986
- case 0:
20987
- 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;
20988
- requireReactVersion();
20989
- _context2.prev = 2;
20990
- _context2.next = 5;
20991
- return preflight$2({
20992
- accept: accept
20993
- });
20994
- case 5:
20995
- unmount = mount({
20996
- style: style,
20997
- container: container,
20998
- document: ensureDocument(document),
20999
- closed: closed
21000
- }, function (unmount) {
21001
- return function (container) {
21002
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21003
- errorCallback: error,
21004
- container: container,
21005
- unmount: unmount
21006
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21007
- configuration: {
21008
- type: 'donation',
21009
- amount: amount,
21010
- accept: accept,
21011
- currency: currency,
21012
- event: event,
21013
- track: track,
21014
- fee: fee,
21015
- sent: sent,
21016
- succeeded: succeeded,
21017
- validated: validated,
21018
- failed: failed,
21019
- blacklist: blacklist,
21020
- whitelist: whitelist,
21021
- providers: providers,
21022
- integration: integration,
21023
- link: link,
21024
- title: title
21025
- }
21026
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21027
- unmount: unmount,
21028
- closable: closable
21029
- }, /*#__PURE__*/React.createElement(WalletProvider, {
21030
- container: container,
21031
- connected: connected,
21032
- unmount: unmount
21033
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21034
- accept: accept
21035
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21036
- document: ensureDocument(document)
21037
- }, /*#__PURE__*/React.createElement(DonationRoutingProvider, {
21038
- container: container,
21039
- document: document
21040
- }, /*#__PURE__*/React.createElement(DonationStack, {
21041
- document: document,
21042
- container: container
21043
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
21044
- };
21045
- });
21046
- return _context2.abrupt("return", {
21047
- unmount: unmount
21048
- });
21049
- case 9:
21050
- _context2.prev = 9;
21051
- _context2.t0 = _context2["catch"](2);
21052
- console.log('critical error', _context2.t0);
21053
- if (critical != undefined) {
21054
- critical(_context2.t0);
21055
- }
21056
- case 13:
21057
- case "end":
21058
- return _context2.stop();
21059
- }
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();
21060
21244
  }
21061
21245
  }, _callee2, null, [[2, 9]]);
21062
21246
  }));
@@ -21177,46 +21361,44 @@ var Login = function Login(options) {
21177
21361
  return new Promise( /*#__PURE__*/function () {
21178
21362
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_resolve, reject) {
21179
21363
  return regenerator.wrap(function _callee$(_context) {
21180
- while (1) {
21181
- switch (_context.prev = _context.next) {
21182
- case 0:
21183
- Connect().then(function () {
21184
- mount({
21185
- style: style,
21186
- document: ensureDocument(document)
21187
- }, function (unmount) {
21188
- var userClosedDialog = function userClosedDialog() {
21189
- reject('USER_CLOSED_DIALOG');
21190
- unmount();
21191
- };
21192
- return function (container) {
21193
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21194
- errorCallback: error,
21195
- container: container,
21196
- unmount: unmount
21197
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21198
- configuration: {
21199
- message: message,
21200
- endpoint: endpoint || '/login',
21201
- recover: recover
21202
- }
21203
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21204
- unmount: userClosedDialog
21205
- }, /*#__PURE__*/React.createElement(LoginStack, {
21206
- document: document,
21207
- container: container,
21208
- resolve: function resolve(account) {
21209
- unmount();
21210
- _resolve(account);
21211
- }
21212
- }), /*#__PURE__*/React.createElement(PoweredBy, null)))));
21213
- };
21214
- });
21215
- })["catch"](reject);
21216
- case 1:
21217
- case "end":
21218
- return _context.stop();
21219
- }
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();
21220
21402
  }
21221
21403
  }, _callee);
21222
21404
  }));
@@ -21391,11 +21573,49 @@ var PaymentOverviewDialog = (function (props) {
21391
21573
  });
21392
21574
  });
21393
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
+
21394
21614
  var TrackingFailedDialog = (function () {
21395
21615
  var _useContext = useContext(PaymentTrackingContext),
21396
21616
  continueTryTracking = _useContext.continueTryTracking;
21397
- var _useContext2 = useContext(PaymentContext),
21398
- transaction = _useContext2.transaction;
21617
+ var _useContext2 = useContext(PaymentContext);
21618
+ _useContext2.transaction;
21399
21619
  var _useContext3 = useContext(NavigateStackContext),
21400
21620
  navigate = _useContext3.navigate;
21401
21621
  var tryAgain = function tryAgain() {
@@ -21422,10 +21642,7 @@ var TrackingFailedDialog = (function () {
21422
21642
  className: "FontSizeM"
21423
21643
  }, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React.createElement("div", {
21424
21644
  className: "PaddingTopS"
21425
- }, /*#__PURE__*/React.createElement("span", null, "If this keeps happening, "), /*#__PURE__*/React.createElement("a", {
21426
- className: "Link",
21427
- href: "mailto:support@depay.com?subject=Payment%20tracking%20failed&body=Tracking%20my%20payment%20failed%0A%0ATransaction:%20".concat(transaction.url)
21428
- }, "please report it"), "."))),
21645
+ }, /*#__PURE__*/React.createElement("span", null, "If this keeps happening, please report it.")))),
21429
21646
  footer: /*#__PURE__*/React.createElement("div", {
21430
21647
  className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
21431
21648
  }, /*#__PURE__*/React.createElement("button", {
@@ -21454,7 +21671,8 @@ var PaymentStack = (function (props) {
21454
21671
  ChangePayment: /*#__PURE__*/React.createElement(ChangePaymentDialog, null),
21455
21672
  PaymentFailed: /*#__PURE__*/React.createElement(PaymentFailedDialog, null),
21456
21673
  WrongNetwork: /*#__PURE__*/React.createElement(WrongNetworkDialog, null),
21457
- TrackingFailed: /*#__PURE__*/React.createElement(TrackingFailedDialog, null)
21674
+ TrackingFailed: /*#__PURE__*/React.createElement(TrackingFailedDialog, null),
21675
+ PreTrackingFailed: /*#__PURE__*/React.createElement(PreTrackingFailedDialog, null)
21458
21676
  }
21459
21677
  });
21460
21678
  });
@@ -21463,37 +21681,35 @@ var preflight$1 = /*#__PURE__*/function () {
21463
21681
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21464
21682
  var accept, recover;
21465
21683
  return regenerator.wrap(function _callee$(_context) {
21466
- while (1) {
21467
- switch (_context.prev = _context.next) {
21468
- case 0:
21469
- accept = _ref.accept, recover = _ref.recover;
21470
- if (!recover) {
21471
- _context.next = 3;
21472
- 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!';
21473
21696
  }
21474
- return _context.abrupt("return");
21475
- case 3:
21476
- accept.forEach(function (configuration) {
21477
- if (typeof configuration.blockchain === 'undefined') {
21478
- throw 'You need to set the blockchain your want to receive the payment on!';
21479
- }
21480
- if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
21481
- throw 'You need to set a supported blockchain!';
21482
- }
21483
- if (typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21484
- throw 'You need to set the token you want to receive as payment!';
21485
- }
21486
- if (typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') {
21487
- throw 'You need to set the fromToken, fromAmount and toToken!';
21488
- }
21489
- if (typeof configuration.receiver === 'undefined') {
21490
- throw 'You need to set the receiver address that you want to receive the payment!';
21491
- }
21492
- });
21493
- case 4:
21494
- case "end":
21495
- return _context.stop();
21496
- }
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();
21497
21713
  }
21498
21714
  }, _callee);
21499
21715
  }));
@@ -21503,93 +21719,91 @@ var preflight$1 = /*#__PURE__*/function () {
21503
21719
  }();
21504
21720
  var Payment = /*#__PURE__*/function () {
21505
21721
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21506
- 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;
21507
21723
  return regenerator.wrap(function _callee2$(_context2) {
21508
- while (1) {
21509
- switch (_context2.prev = _context2.next) {
21510
- case 0:
21511
- 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;
21512
- requireReactVersion();
21513
- _context2.prev = 2;
21514
- _context2.next = 5;
21515
- return preflight$1({
21516
- accept: accept,
21517
- recover: recover
21518
- });
21519
- case 5:
21520
- unmount = mount({
21521
- style: style,
21522
- container: container,
21523
- document: ensureDocument(document),
21524
- closed: closed
21525
- }, function (unmount) {
21526
- return function (container) {
21527
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21528
- errorCallback: error,
21529
- container: container,
21530
- unmount: unmount
21531
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21532
- configuration: {
21533
- type: 'payment',
21534
- before: before,
21535
- amount: amount,
21536
- accept: accept,
21537
- currency: currency,
21538
- event: event,
21539
- sent: sent,
21540
- succeeded: succeeded,
21541
- validated: validated,
21542
- failed: failed,
21543
- whitelist: whitelist,
21544
- blacklist: blacklist,
21545
- providers: providers,
21546
- track: track,
21547
- fee: fee,
21548
- recover: recover,
21549
- integration: integration,
21550
- link: link
21551
- }
21552
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21553
- unmount: unmount,
21554
- closable: closable
21555
- }, /*#__PURE__*/React.createElement(WalletProvider, {
21556
- document: document,
21557
- container: container,
21558
- connected: connected,
21559
- unmount: unmount
21560
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21561
- accept: accept
21562
- }, /*#__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,
21563
21751
  accept: accept,
21752
+ currency: currency,
21753
+ event: event,
21754
+ sent: sent,
21755
+ succeeded: succeeded,
21756
+ validated: validated,
21757
+ failed: failed,
21564
21758
  whitelist: whitelist,
21565
21759
  blacklist: blacklist,
21566
- event: event,
21567
- fee: fee
21568
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21569
- document: ensureDocument(document)
21570
- }, /*#__PURE__*/React.createElement(PaymentProvider, {
21571
- container: container,
21572
- document: document
21573
- }, /*#__PURE__*/React.createElement(PaymentValueProvider, null, /*#__PURE__*/React.createElement(PaymentStack, {
21574
- document: document,
21575
- container: container
21576
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))))));
21577
- };
21578
- });
21579
- return _context2.abrupt("return", {
21580
- unmount: unmount
21581
- });
21582
- case 9:
21583
- _context2.prev = 9;
21584
- _context2.t0 = _context2["catch"](2);
21585
- console.log('critical error', _context2.t0);
21586
- if (critical != undefined) {
21587
- critical(_context2.t0);
21588
- }
21589
- case 13:
21590
- case "end":
21591
- return _context2.stop();
21592
- }
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();
21593
21807
  }
21594
21808
  }, _callee2, null, [[2, 9]]);
21595
21809
  }));
@@ -21601,15 +21815,14 @@ Payment.preload = function (_ref5) {
21601
21815
  var account = _ref5.account,
21602
21816
  accept = _ref5.accept,
21603
21817
  whitelist = _ref5.whitelist,
21604
- blacklist = _ref5.blacklist,
21605
- event = _ref5.event,
21606
- fee = _ref5.fee;
21818
+ blacklist = _ref5.blacklist;
21819
+ _ref5.event;
21820
+ var fee = _ref5.fee;
21607
21821
  routePayments({
21608
21822
  account: account,
21609
21823
  accept: accept,
21610
21824
  whitelist: whitelist,
21611
21825
  blacklist: blacklist,
21612
- event: event,
21613
21826
  fee: fee
21614
21827
  });
21615
21828
  };
@@ -21875,31 +22088,29 @@ var preflight = /*#__PURE__*/function () {
21875
22088
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21876
22089
  var sell;
21877
22090
  return regenerator.wrap(function _callee$(_context) {
21878
- while (1) {
21879
- switch (_context.prev = _context.next) {
21880
- case 0:
21881
- sell = _ref.sell;
21882
- if (!(_typeof(sell) != 'object')) {
21883
- _context.next = 3;
21884
- break;
21885
- }
21886
- throw 'You need to configure at least 1 "blockchain": "token"';
21887
- case 3:
21888
- if (!(Object.keys(sell).length == 0)) {
21889
- _context.next = 5;
21890
- break;
21891
- }
21892
- throw 'You need to configure at least 1 "blockchain": "token"';
21893
- case 5:
21894
- if (!(Object.values(sell).length == 0)) {
21895
- _context.next = 7;
21896
- break;
21897
- }
21898
- throw 'You need to configure at least 1 "blockchain": "token"';
21899
- case 7:
21900
- case "end":
21901
- return _context.stop();
21902
- }
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();
21903
22114
  }
21904
22115
  }, _callee);
21905
22116
  }));
@@ -21911,81 +22122,79 @@ var Sale = /*#__PURE__*/function () {
21911
22122
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21912
22123
  var amount, sell, sent, succeeded, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, closable, integration, document, accept, unmount;
21913
22124
  return regenerator.wrap(function _callee2$(_context2) {
21914
- while (1) {
21915
- switch (_context2.prev = _context2.next) {
21916
- case 0:
21917
- 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;
21918
- requireReactVersion();
21919
- _context2.prev = 2;
21920
- _context2.next = 5;
21921
- return preflight({
21922
- sell: sell
21923
- });
21924
- case 5:
21925
- accept = Object.keys(sell).map(function (key) {
21926
- return {
21927
- blockchain: key,
21928
- token: sell[key]
21929
- };
21930
- });
21931
- unmount = mount({
21932
- style: style,
21933
- document: ensureDocument(document),
21934
- closed: closed
21935
- }, function (unmount) {
21936
- return function (container) {
21937
- return /*#__PURE__*/React.createElement(ErrorProvider, {
21938
- errorCallback: error,
21939
- container: container,
21940
- unmount: unmount
21941
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21942
- configuration: {
21943
- type: 'sale',
21944
- tokenImage: tokenImage,
21945
- amount: amount,
21946
- sell: sell,
21947
- currency: currency,
21948
- sent: sent,
21949
- succeeded: succeeded,
21950
- failed: failed,
21951
- blacklist: blacklist,
21952
- providers: providers,
21953
- integration: integration
21954
- }
21955
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21956
- unmount: unmount,
21957
- closable: closable
21958
- }, /*#__PURE__*/React.createElement(WalletProvider, {
21959
- container: container,
21960
- connected: connected,
21961
- unmount: unmount
21962
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
21963
- accept: accept
21964
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
21965
- document: ensureDocument(document)
21966
- }, /*#__PURE__*/React.createElement(SaleRoutingProvider, {
21967
- container: container,
21968
- document: document
21969
- }, /*#__PURE__*/React.createElement(SaleStack, {
21970
- document: document,
21971
- container: container
21972
- }), /*#__PURE__*/React.createElement(PoweredBy, null))))))))))));
21973
- };
21974
- });
21975
- return _context2.abrupt("return", {
21976
- unmount: unmount
21977
- });
21978
- case 10:
21979
- _context2.prev = 10;
21980
- _context2.t0 = _context2["catch"](2);
21981
- console.log('critical error', _context2.t0);
21982
- if (critical != undefined) {
21983
- critical(_context2.t0);
21984
- }
21985
- case 14:
21986
- case "end":
21987
- return _context2.stop();
21988
- }
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();
21989
22198
  }
21990
22199
  }, _callee2, null, [[2, 10]]);
21991
22200
  }));
@@ -22304,7 +22513,7 @@ var SelectTokenDialog = (function (props) {
22304
22513
  };
22305
22514
  var select = function select(token) {
22306
22515
  if (blockchain.tokens.find(function (majorToken) {
22307
- return majorToken.address.toLowerCase() == (token.address || token.external_id).toLowerCase();
22516
+ return majorToken.address == (token.address || token.external_id);
22308
22517
  })) {
22309
22518
  setOpen(false);
22310
22519
  props.resolve({
@@ -22462,41 +22671,39 @@ var Select = function Select(options) {
22462
22671
  return new Promise( /*#__PURE__*/function () {
22463
22672
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(resolve, reject) {
22464
22673
  return regenerator.wrap(function _callee$(_context) {
22465
- while (1) {
22466
- switch (_context.prev = _context.next) {
22467
- case 0:
22468
- mount({
22469
- style: style,
22470
- document: ensureDocument(document)
22471
- }, function (unmount) {
22472
- var userClosedDialog = function userClosedDialog() {
22473
- reject('USER_CLOSED_DIALOG');
22474
- unmount();
22475
- };
22476
- return function (container) {
22477
- return /*#__PURE__*/React.createElement(ErrorProvider, {
22478
- error: startupError,
22479
- errorCallback: error,
22480
- container: container,
22481
- unmount: unmount
22482
- }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
22483
- configuration: {
22484
- what: what
22485
- }
22486
- }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
22487
- unmount: userClosedDialog
22488
- }, /*#__PURE__*/React.createElement(SelectionProvider, null, /*#__PURE__*/React.createElement(SelectStack, {
22489
- document: document,
22490
- container: container,
22491
- unmount: unmount,
22492
- resolve: resolve
22493
- })), /*#__PURE__*/React.createElement(PoweredBy, null)))));
22494
- };
22495
- });
22496
- case 1:
22497
- case "end":
22498
- return _context.stop();
22499
- }
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();
22500
22707
  }
22501
22708
  }, _callee);
22502
22709
  }));