@depay/widgets 7.13.0 → 7.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -19064,13 +19064,13 @@ var ChangableAmountProvider = (function (props) {
19064
19064
  }).then(function (readableMaxAmount) {
19065
19065
  var slippage = 1.01;
19066
19066
  var maxAmount = parseFloat(new Decimal(readableMaxAmount).div(slippage).mul(conversionRate).toString());
19067
- setMaxAmount(maxAmount > 10 ? Math.round(maxAmount) : round(maxAmount));
19067
+ setMaxAmount(maxAmount > 10 ? Math.round(maxAmount - 1) : round(maxAmount - 1));
19068
19068
  })["catch"](setError);
19069
19069
  })["catch"](setError);
19070
19070
  } else if (maxRoute.fromToken.address == CONSTANTS[maxRoute.blockchain].USD) {
19071
19071
  var _maxAmount = parseFloat(new Decimal(readableMaxAmount).mul(conversionRate).toString());
19072
19072
 
19073
- setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount) : _maxAmount);
19073
+ setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount - 1) : _maxAmount - 1);
19074
19074
  } else {
19075
19075
  route({
19076
19076
  blockchain: maxRoute.blockchain,
@@ -19247,7 +19247,8 @@ var PaymentProvider = (function (props) {
19247
19247
  setUpdatable = _useContext6.setUpdatable;
19248
19248
 
19249
19249
  var _useContext7 = useContext(NavigateContext),
19250
- navigate = _useContext7.navigate;
19250
+ navigate = _useContext7.navigate,
19251
+ set = _useContext7.set;
19251
19252
 
19252
19253
  var _useContext8 = useContext(WalletContext),
19253
19254
  wallet = _useContext8.wallet;
@@ -19299,7 +19300,7 @@ var PaymentProvider = (function (props) {
19299
19300
  }
19300
19301
 
19301
19302
  setClosable(true);
19302
- navigate('PaymentError');
19303
+ set(['PaymentError']);
19303
19304
  };
19304
19305
 
19305
19306
  var pay = /*#__PURE__*/function () {
@@ -20361,14 +20362,15 @@ var ChangeAmountDialog = (function (props) {
20361
20362
  className: "PaddingLeftM PaddingRightM"
20362
20363
  }, /*#__PURE__*/React.createElement("div", {
20363
20364
  className: "PaddingTopS TextCenter PaddingBottomL"
20364
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
20365
+ }, /*#__PURE__*/React.createElement("div", {
20366
+ className: "PaddingBottomM"
20367
+ }, /*#__PURE__*/React.createElement("input", {
20365
20368
  max: parseFloat(maxAmount),
20366
20369
  min: min,
20367
20370
  step: step,
20368
20371
  className: "Input FontSizeXXL TextAlignCenter",
20369
20372
  type: "number",
20370
20373
  name: "amount",
20371
- autoFocus: true,
20372
20374
  value: parseFloat(inputAmount),
20373
20375
  onChange: function onChange(event) {
20374
20376
  changeAmount(event.target.value);
@@ -20382,12 +20384,12 @@ var ChangeAmountDialog = (function (props) {
20382
20384
  }
20383
20385
  }, /*#__PURE__*/React.createElement("div", {
20384
20386
  className: "FontSizeS"
20385
- }, format(toValidStep(maxAmount)), /*#__PURE__*/React.createElement("button", {
20387
+ }, format(toValidStep(maxAmount)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
20386
20388
  className: "TextButton",
20387
20389
  onClick: function onClick() {
20388
20390
  changeAmount(toValidValue(maxAmount));
20389
20391
  }
20390
- }, "(Max)")))))),
20392
+ }, "(Max)"))))))),
20391
20393
  footer: /*#__PURE__*/React.createElement("div", {
20392
20394
  className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
20393
20395
  }, /*#__PURE__*/React.createElement("button", {
@@ -20537,12 +20539,15 @@ var ChangePaymentDialog = (function (props) {
20537
20539
  });
20538
20540
 
20539
20541
  var DonationOverviewSkeleton = (function (props) {
20542
+ var _useContext = useContext(ConfigurationContext),
20543
+ title = _useContext.title;
20544
+
20540
20545
  return /*#__PURE__*/React.createElement(Dialog$1, {
20541
20546
  header: /*#__PURE__*/React.createElement("div", {
20542
20547
  className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
20543
20548
  }, /*#__PURE__*/React.createElement("h1", {
20544
20549
  className: "LineHeightL FontSizeL"
20545
- }, "Donation")),
20550
+ }, title || 'Donation')),
20546
20551
  body: /*#__PURE__*/React.createElement("div", {
20547
20552
  className: "PaddingLeftM PaddingRightM PaddingBottomXS"
20548
20553
  }, /*#__PURE__*/React.createElement("div", {
@@ -20896,7 +20901,8 @@ var Footer = (function () {
20896
20901
 
20897
20902
  var DonationOverviewDialog = (function (props) {
20898
20903
  var _useContext = useContext(ConfigurationContext),
20899
- currencyCode = _useContext.currencyCode;
20904
+ currencyCode = _useContext.currencyCode,
20905
+ title = _useContext.title;
20900
20906
 
20901
20907
  var _useContext2 = useContext(ChangableAmountContext),
20902
20908
  amount = _useContext2.amount;
@@ -20918,7 +20924,7 @@ var DonationOverviewDialog = (function (props) {
20918
20924
  className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
20919
20925
  }, /*#__PURE__*/React.createElement("h1", {
20920
20926
  className: "LineHeightL FontSizeL"
20921
- }, "Donation")),
20927
+ }, title || 'Donation')),
20922
20928
  body: /*#__PURE__*/React.createElement("div", {
20923
20929
  className: "PaddingLeftM PaddingRightM PaddingBottomXS"
20924
20930
  }, /*#__PURE__*/React.createElement("div", {
@@ -20997,9 +21003,6 @@ var PaymentErrorDialog = (function () {
20997
21003
  var _useContext2 = useContext(PaymentContext),
20998
21004
  transaction = _useContext2.transaction;
20999
21005
 
21000
- var _useContext3 = useContext(ConfigurationContext),
21001
- recover = _useContext3.recover;
21002
-
21003
21006
  return /*#__PURE__*/React.createElement(Dialog$1, {
21004
21007
  stacked: false,
21005
21008
  header: /*#__PURE__*/React.createElement("div", {
@@ -21016,7 +21019,7 @@ var PaymentErrorDialog = (function () {
21016
21019
  className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
21017
21020
  }, "Payment Failed"), /*#__PURE__*/React.createElement("div", {
21018
21021
  className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
21019
- }, recover == undefined && /*#__PURE__*/React.createElement("strong", {
21022
+ }, /*#__PURE__*/React.createElement("strong", {
21020
21023
  className: "FontSizeM"
21021
21024
  }, "Unfortunately executing your payment failed. You can go back and try again."), transaction && /*#__PURE__*/React.createElement("div", {
21022
21025
  className: "PaddingTopS"
@@ -21029,7 +21032,7 @@ var PaymentErrorDialog = (function () {
21029
21032
  }, "View on explorer")))),
21030
21033
  footer: /*#__PURE__*/React.createElement("div", {
21031
21034
  className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
21032
- }, recover == undefined && /*#__PURE__*/React.createElement("button", {
21035
+ }, /*#__PURE__*/React.createElement("button", {
21033
21036
  className: "ButtonPrimary",
21034
21037
  onClick: function onClick() {
21035
21038
  return close();
@@ -21086,10 +21089,10 @@ var DonationStack = (function (props) {
21086
21089
  close = _useContext.close;
21087
21090
 
21088
21091
  var _useContext2 = useContext(NavigateContext),
21089
- setNavigate = _useContext2.setNavigate;
21092
+ setNavigator = _useContext2.setNavigator;
21090
21093
 
21091
21094
  return /*#__PURE__*/React.createElement(ReactDialogStack, {
21092
- setNavigate: setNavigate,
21095
+ setNavigator: setNavigator,
21093
21096
  open: open,
21094
21097
  close: close,
21095
21098
  start: "DonationOverview",
@@ -21108,20 +21111,27 @@ var DonationStack = (function (props) {
21108
21111
  var NavigateProvider = (function (props) {
21109
21112
  var navigator;
21110
21113
 
21111
- var setNavigate = function setNavigate(_navigator) {
21114
+ var setNavigator = function setNavigator(_navigator) {
21112
21115
  navigator = _navigator;
21113
21116
  };
21114
21117
 
21115
21118
  var navigate = function navigate(dialog) {
21116
21119
  if (navigator) {
21117
- navigator(dialog);
21120
+ navigator.navigate(dialog);
21121
+ }
21122
+ };
21123
+
21124
+ var set = function set(dialogs) {
21125
+ if (navigator) {
21126
+ navigator.set(dialogs);
21118
21127
  }
21119
21128
  };
21120
21129
 
21121
21130
  return /*#__PURE__*/React.createElement(NavigateContext.Provider, {
21122
21131
  value: {
21123
21132
  navigate: navigate,
21124
- setNavigate: setNavigate
21133
+ set: set,
21134
+ setNavigator: setNavigator
21125
21135
  }
21126
21136
  }, props.children);
21127
21137
  });
@@ -21179,7 +21189,7 @@ var PaymentTrackingProvider = (function (props) {
21179
21189
  setClosable = _useContext3.setClosable;
21180
21190
 
21181
21191
  var _useContext4 = useContext(NavigateContext),
21182
- navigate = _useContext4.navigate;
21192
+ set = _useContext4.set;
21183
21193
 
21184
21194
  var openSocket = function openSocket(transaction) {
21185
21195
  var socket = new WebSocket('wss://integrate.depay.fi/cable');
@@ -21208,7 +21218,7 @@ var PaymentTrackingProvider = (function (props) {
21208
21218
 
21209
21219
  if (item.message.status == 'failed') {
21210
21220
  setClosable(true);
21211
- navigate('PaymentError');
21221
+ set(['PaymentError']);
21212
21222
  }
21213
21223
 
21214
21224
  if (validated) {
@@ -21679,12 +21689,12 @@ var preflight$2 = /*#__PURE__*/function () {
21679
21689
 
21680
21690
  var Donation = /*#__PURE__*/function () {
21681
21691
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21682
- var amount, accept, event, sent, confirmed, validated, failed, error, critical, style, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, document, unmount;
21692
+ var amount, accept, event, sent, confirmed, validated, failed, error, critical, style, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, title, document, unmount;
21683
21693
  return regenerator.wrap(function _callee2$(_context2) {
21684
21694
  while (1) {
21685
21695
  switch (_context2.prev = _context2.next) {
21686
21696
  case 0:
21687
- amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, validated = _ref3.validated, 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, track = _ref3.track, fee = _ref3.fee, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, document = _ref3.document;
21697
+ amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, validated = _ref3.validated, 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, track = _ref3.track, fee = _ref3.fee, closable = _ref3.closable, integration = _ref3.integration, link = _ref3.link, container = _ref3.container, title = _ref3.title, document = _ref3.document;
21688
21698
  requireReactVersion();
21689
21699
  _context2.prev = 2;
21690
21700
  _context2.next = 5;
@@ -21720,7 +21730,8 @@ var Donation = /*#__PURE__*/function () {
21720
21730
  blacklist: blacklist,
21721
21731
  providers: providers,
21722
21732
  integration: integration,
21723
- link: link
21733
+ link: link,
21734
+ title: title
21724
21735
  }
21725
21736
  }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21726
21737
  unmount: unmount,
@@ -22126,10 +22137,10 @@ var PaymentStack = (function (props) {
22126
22137
  close = _useContext.close;
22127
22138
 
22128
22139
  var _useContext2 = useContext(NavigateContext),
22129
- setNavigate = _useContext2.setNavigate;
22140
+ setNavigator = _useContext2.setNavigator;
22130
22141
 
22131
22142
  return /*#__PURE__*/React.createElement(ReactDialogStack, {
22132
- setNavigate: setNavigate,
22143
+ setNavigator: setNavigator,
22133
22144
  open: open,
22134
22145
  close: close,
22135
22146
  start: "PaymentOverview",
@@ -22579,10 +22590,10 @@ var SaleStack = (function (props) {
22579
22590
  close = _useContext.close;
22580
22591
 
22581
22592
  var _useContext2 = useContext(NavigateContext),
22582
- setNavigate = _useContext2.setNavigate;
22593
+ setNavigator = _useContext2.setNavigator;
22583
22594
 
22584
22595
  return /*#__PURE__*/React.createElement(ReactDialogStack, {
22585
- setNavigate: setNavigate,
22596
+ setNavigator: setNavigator,
22586
22597
  open: open,
22587
22598
  close: close,
22588
22599
  start: "SaleOverview",