@depay/widgets 7.14.4 → 7.15.2

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
@@ -18884,7 +18884,7 @@ var ChangableAmountProvider = (function (props) {
18884
18884
  };
18885
18885
 
18886
18886
  var _useContext = useContext(ConfigurationContext),
18887
- amountConfiguration = _useContext.amount;
18887
+ configuredAmount = _useContext.amount;
18888
18888
  _useContext.toAmount;
18889
18889
  var recover = _useContext.recover;
18890
18890
 
@@ -18908,21 +18908,21 @@ var ChangableAmountProvider = (function (props) {
18908
18908
  acceptWithAmount = _useState4[0],
18909
18909
  setAcceptWithAmount = _useState4[1];
18910
18910
 
18911
- var _useState5 = useState(_typeof(amountConfiguration) == 'object' && amountConfiguration.fix && amountConfiguration.currency ? amountConfiguration.fix : null),
18911
+ var _useState5 = useState(_typeof(configuredAmount) == 'object' && configuredAmount.fix && configuredAmount.currency ? configuredAmount.fix : null),
18912
18912
  _useState6 = _slicedToArray(_useState5, 1),
18913
18913
  fixedAmount = _useState6[0];
18914
18914
 
18915
- var _useState7 = useState(_typeof(amountConfiguration) == 'object' && amountConfiguration.fix && amountConfiguration.currency ? amountConfiguration.currency : null),
18915
+ var _useState7 = useState(_typeof(configuredAmount) == 'object' && configuredAmount.fix && configuredAmount.currency ? configuredAmount.currency : null),
18916
18916
  _useState8 = _slicedToArray(_useState7, 1),
18917
18917
  fixedCurrency = _useState8[0];
18918
18918
 
18919
18919
  var startAmount;
18920
18920
 
18921
18921
  if (amountsMissing) {
18922
- if (_typeof(amountConfiguration) == "object" && amountConfiguration.start && amountConfiguration.start) {
18923
- startAmount = amountConfiguration.start;
18924
- } else if (_typeof(amountConfiguration) == "object" && amountConfiguration.fix) {
18925
- startAmount = amountConfiguration.fix;
18922
+ if (_typeof(configuredAmount) == "object" && configuredAmount.start && configuredAmount.start) {
18923
+ startAmount = configuredAmount.start;
18924
+ } else if (_typeof(configuredAmount) == "object" && configuredAmount.fix) {
18925
+ startAmount = configuredAmount.fix;
18926
18926
  } else {
18927
18927
  startAmount = 1;
18928
18928
  }
@@ -18956,7 +18956,7 @@ var ChangableAmountProvider = (function (props) {
18956
18956
  conversionRate = _ref.conversionRate,
18957
18957
  fixedCurrencyConversionRate = _ref.fixedCurrencyConversionRate;
18958
18958
  return new Promise(function (resolve, reject) {
18959
- if (amountConfiguration && amountConfiguration.token) {
18959
+ if (configuredAmount && configuredAmount.token) {
18960
18960
  resolve(props.accept.map(function () {
18961
18961
  return amount;
18962
18962
  }));
@@ -19051,7 +19051,7 @@ var ChangableAmountProvider = (function (props) {
19051
19051
  useEffect(function () {
19052
19052
  if (amountsMissing && maxRoute) {
19053
19053
  maxRoute.fromToken.readable(maxRoute.fromBalance).then(function (readableMaxAmount) {
19054
- if (amountConfiguration && amountConfiguration.token) {
19054
+ if (configuredAmount && configuredAmount.token) {
19055
19055
  route({
19056
19056
  blockchain: maxRoute.blockchain,
19057
19057
  tokenIn: maxRoute.fromToken.address,
@@ -20136,8 +20136,15 @@ var PaymentValueProvider = (function (props) {
20136
20136
  var _useContext3 = useContext(UpdatableContext),
20137
20137
  updatable = _useContext3.updatable;
20138
20138
 
20139
- var _useContext4 = useContext(PaymentContext),
20140
- payment = _useContext4.payment;
20139
+ var _useContext4 = useContext(ConfigurationContext),
20140
+ configuredAmount = _useContext4.amount,
20141
+ currencyCode = _useContext4.currencyCode;
20142
+
20143
+ var _useContext5 = useContext(ChangableAmountContext),
20144
+ amount = _useContext5.amount;
20145
+
20146
+ var _useContext6 = useContext(PaymentContext),
20147
+ payment = _useContext6.payment;
20141
20148
 
20142
20149
  var _useState = useState(),
20143
20150
  _useState2 = _slicedToArray(_useState, 2),
@@ -20146,16 +20153,21 @@ var PaymentValueProvider = (function (props) {
20146
20153
 
20147
20154
  var _useState3 = useState(),
20148
20155
  _useState4 = _slicedToArray(_useState3, 2),
20149
- paymentValueLoss = _useState4[0],
20150
- setPaymentValueLoss = _useState4[1];
20156
+ displayedPaymentValue = _useState4[0],
20157
+ setDisplayedPaymentValue = _useState4[1];
20151
20158
 
20152
- var _useContext5 = useContext(ConfigurationContext),
20153
- currency = _useContext5.currency;
20154
-
20155
- var _useState5 = useState(0),
20159
+ var _useState5 = useState(),
20156
20160
  _useState6 = _slicedToArray(_useState5, 2),
20157
- reloadCount = _useState6[0],
20158
- setReloadCount = _useState6[1];
20161
+ paymentValueLoss = _useState6[0],
20162
+ setPaymentValueLoss = _useState6[1];
20163
+
20164
+ var _useContext7 = useContext(ConfigurationContext),
20165
+ currency = _useContext7.currency;
20166
+
20167
+ var _useState7 = useState(0),
20168
+ _useState8 = _slicedToArray(_useState7, 2),
20169
+ reloadCount = _useState8[0],
20170
+ setReloadCount = _useState8[1];
20159
20171
 
20160
20172
  var updatePaymentValue = function updatePaymentValue(_ref) {
20161
20173
  var updatable = _ref.updatable,
@@ -20222,6 +20234,20 @@ var PaymentValueProvider = (function (props) {
20222
20234
  })["catch"](setError);
20223
20235
  };
20224
20236
 
20237
+ useEffect(function () {
20238
+ if (paymentValue && amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
20239
+ setDisplayedPaymentValue(paymentValue.toString());
20240
+ } else if (amount && (configuredAmount == undefined || (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true)) {
20241
+ setDisplayedPaymentValue(new Currency({
20242
+ amount: amount.toFixed(2),
20243
+ code: currencyCode
20244
+ }).toString());
20245
+ } else if (paymentValue && paymentValue.toString().length && (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true) {
20246
+ setDisplayedPaymentValue(paymentValue.toString());
20247
+ } else if (payment) {
20248
+ setDisplayedPaymentValue("".concat(payment.symbol, " ").concat(payment.amount));
20249
+ }
20250
+ }, [paymentValue, payment, amount, configuredAmount]);
20225
20251
  useEffect(function () {
20226
20252
  if (account && payment) {
20227
20253
  updatePaymentValue({
@@ -20244,7 +20270,8 @@ var PaymentValueProvider = (function (props) {
20244
20270
  return /*#__PURE__*/React.createElement(PaymentValueContext.Provider, {
20245
20271
  value: {
20246
20272
  paymentValue: paymentValue,
20247
- paymentValueLoss: paymentValueLoss
20273
+ paymentValueLoss: paymentValueLoss,
20274
+ displayedPaymentValue: displayedPaymentValue
20248
20275
  }
20249
20276
  }, props.children);
20250
20277
  });
@@ -20256,12 +20283,14 @@ var DonationRoutingProvider = (function (props) {
20256
20283
 
20257
20284
  var _useContext2 = useContext(ConfigurationContext),
20258
20285
  blacklist = _useContext2.blacklist,
20286
+ whitelist = _useContext2.whitelist,
20259
20287
  fee = _useContext2.fee;
20260
20288
 
20261
20289
  return /*#__PURE__*/React.createElement(DonationRoutingContext.Provider, {
20262
20290
  value: {}
20263
20291
  }, /*#__PURE__*/React.createElement(PaymentRoutingProvider, {
20264
20292
  accept: acceptWithAmount,
20293
+ whitelist: whitelist,
20265
20294
  blacklist: blacklist,
20266
20295
  setMaxRoute: setMaxRoute,
20267
20296
  fee: fee
@@ -20299,18 +20328,21 @@ var ChangeAmountDialog = (function (props) {
20299
20328
  setAmount = _useContext4.setAmount,
20300
20329
  maxAmount = _useContext4.maxAmount;
20301
20330
 
20331
+ var _useContext5 = useContext(PaymentValueContext);
20332
+ _useContext5.displayedPaymentValue;
20333
+
20302
20334
  var _useState = useState(amount),
20303
20335
  _useState2 = _slicedToArray(_useState, 2),
20304
20336
  inputAmount = _useState2[0],
20305
20337
  setInputAmount = _useState2[1];
20306
20338
 
20307
- var _useContext5 = useContext(ConfigurationContext),
20308
- currencyCode = _useContext5.currencyCode,
20309
- amountConfiguration = _useContext5.amount;
20339
+ var _useContext6 = useContext(ConfigurationContext),
20340
+ currencyCode = _useContext6.currencyCode,
20341
+ amountConfiguration = _useContext6.amount;
20310
20342
 
20311
- var _useContext6 = useContext(PaymentRoutingContext);
20312
- _useContext6.allRoutes;
20313
- var setSelectedRoute = _useContext6.setSelectedRoute;
20343
+ var _useContext7 = useContext(PaymentRoutingContext);
20344
+ _useContext7.allRoutes;
20345
+ var setSelectedRoute = _useContext7.setSelectedRoute;
20314
20346
 
20315
20347
  var min = _typeof(amountConfiguration) == "object" && amountConfiguration.min ? amountConfiguration.min : 1;
20316
20348
  var step = _typeof(amountConfiguration) == "object" && amountConfiguration.step ? amountConfiguration.step : 1;
@@ -20447,8 +20479,9 @@ var ChangePaymentDialog = (function (props) {
20447
20479
  allRoutes = _useContext2.allRoutes,
20448
20480
  setSelectedRoute = _useContext2.setSelectedRoute;
20449
20481
 
20450
- var _useContext3 = useContext(PaymentValueContext),
20451
- paymentValue = _useContext3.paymentValue;
20482
+ var _useContext3 = useContext(PaymentValueContext);
20483
+ _useContext3.paymentValue;
20484
+ var displayedPaymentValue = _useContext3.displayedPaymentValue;
20452
20485
 
20453
20486
  var _useContext4 = useContext(NavigateStackContext),
20454
20487
  navigate = _useContext4.navigate;
@@ -20533,9 +20566,9 @@ var ChangePaymentDialog = (function (props) {
20533
20566
  className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomS"
20534
20567
  }, /*#__PURE__*/React.createElement("h1", {
20535
20568
  className: "LineHeightL FontSizeL TextCenter"
20536
- }, "Change Payment"), paymentValue != undefined && /*#__PURE__*/React.createElement("div", {
20569
+ }, "Change Payment"), displayedPaymentValue != undefined && /*#__PURE__*/React.createElement("div", {
20537
20570
  className: "FontSizeL TextCenter FontWeightBold"
20538
- }, /*#__PURE__*/React.createElement("strong", null, paymentValue.toString()))),
20571
+ }, /*#__PURE__*/React.createElement("strong", null, displayedPaymentValue.toString()))),
20539
20572
  body: /*#__PURE__*/React.createElement("div", {
20540
20573
  className: "MaxHeight PaddingTopXS"
20541
20574
  }, /*#__PURE__*/React.createElement("div", {
@@ -20658,41 +20691,38 @@ var LoadingText = (function (props) {
20658
20691
  });
20659
20692
 
20660
20693
  var Footer = (function () {
20661
- var _useContext = useContext(ConfigurationContext),
20662
- currencyCode = _useContext.currencyCode,
20663
- configuredAmount = _useContext.amount;
20664
-
20665
- var _useContext2 = useContext(ChangableAmountContext),
20666
- amount = _useContext2.amount;
20667
- _useContext2.amountsMissing;
20694
+ var _useContext = useContext(ChangableAmountContext);
20695
+ _useContext.amount;
20696
+ _useContext.amountsMissing;
20668
20697
 
20669
- var _useContext3 = useContext(PaymentTrackingContext),
20670
- tracking = _useContext3.tracking,
20671
- release = _useContext3.release,
20672
- forwardTo = _useContext3.forwardTo,
20673
- trackingFailed = _useContext3.trackingFailed;
20698
+ var _useContext2 = useContext(PaymentTrackingContext),
20699
+ tracking = _useContext2.tracking,
20700
+ release = _useContext2.release,
20701
+ forwardTo = _useContext2.forwardTo,
20702
+ trackingFailed = _useContext2.trackingFailed;
20674
20703
 
20675
- var _useContext4 = useContext(PaymentContext),
20676
- payment = _useContext4.payment,
20677
- paymentState = _useContext4.paymentState,
20678
- pay = _useContext4.pay,
20679
- transaction = _useContext4.transaction,
20680
- approve = _useContext4.approve,
20681
- approvalTransaction = _useContext4.approvalTransaction;
20704
+ var _useContext3 = useContext(PaymentContext),
20705
+ payment = _useContext3.payment,
20706
+ paymentState = _useContext3.paymentState,
20707
+ pay = _useContext3.pay,
20708
+ transaction = _useContext3.transaction,
20709
+ approve = _useContext3.approve,
20710
+ approvalTransaction = _useContext3.approvalTransaction;
20682
20711
 
20683
- var _useContext5 = useContext(PaymentValueContext),
20684
- paymentValue = _useContext5.paymentValue,
20685
- paymentValueLoss = _useContext5.paymentValueLoss;
20712
+ var _useContext4 = useContext(PaymentValueContext);
20713
+ _useContext4.paymentValue;
20714
+ var displayedPaymentValue = _useContext4.displayedPaymentValue,
20715
+ paymentValueLoss = _useContext4.paymentValueLoss;
20686
20716
 
20687
- var _useContext6 = useContext(PaymentRoutingContext),
20688
- updatedRouteWithNewPrice = _useContext6.updatedRouteWithNewPrice,
20689
- updateRouteWithNewPrice = _useContext6.updateRouteWithNewPrice;
20717
+ var _useContext5 = useContext(PaymentRoutingContext),
20718
+ updatedRouteWithNewPrice = _useContext5.updatedRouteWithNewPrice,
20719
+ updateRouteWithNewPrice = _useContext5.updateRouteWithNewPrice;
20690
20720
 
20691
- var _useContext7 = useContext(NavigateStackContext);
20692
- _useContext7.navigate;
20721
+ var _useContext6 = useContext(NavigateStackContext);
20722
+ _useContext6.navigate;
20693
20723
 
20694
- var _useContext8 = useContext(ClosableContext),
20695
- close = _useContext8.close;
20724
+ var _useContext7 = useContext(ClosableContext),
20725
+ close = _useContext7.close;
20696
20726
 
20697
20727
  var trackingInfo = function trackingInfo() {
20698
20728
  if (tracking != true) {
@@ -20819,21 +20849,6 @@ var Footer = (function () {
20819
20849
  };
20820
20850
 
20821
20851
  var mainAction = function mainAction() {
20822
- var displayedAmount;
20823
-
20824
- if (amount && configuredAmount && configuredAmount.currency && configuredAmount.fix) {
20825
- displayedAmount = paymentValue.toString();
20826
- } else if (amount && (configuredAmount == undefined || (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true)) {
20827
- displayedAmount = new Currency({
20828
- amount: amount.toFixed(2),
20829
- code: currencyCode
20830
- }).toString();
20831
- } else if (paymentValue && paymentValue.toString().length && (configuredAmount === null || configuredAmount === void 0 ? void 0 : configuredAmount.token) != true) {
20832
- displayedAmount = paymentValue.toString();
20833
- } else {
20834
- displayedAmount = "".concat(payment.symbol, " ").concat(payment.amount);
20835
- }
20836
-
20837
20852
  if (updatedRouteWithNewPrice) {
20838
20853
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
20839
20854
  className: "PaddingBottomXS"
@@ -20853,7 +20868,7 @@ var Footer = (function () {
20853
20868
  }, /*#__PURE__*/React.createElement("strong", null, "Payment token would lose ", paymentValueLoss, "% of it's value!"))), /*#__PURE__*/React.createElement("button", {
20854
20869
  className: "ButtonPrimary disabled",
20855
20870
  onClick: function onClick() {}
20856
- }, "Pay ", displayedAmount));
20871
+ }, "Pay ", displayedPaymentValue));
20857
20872
  } else if ((paymentState == 'initialized' || paymentState == 'approving') && payment.route) {
20858
20873
  return /*#__PURE__*/React.createElement("button", {
20859
20874
  className: ["ButtonPrimary", payment.route.approvalRequired && !payment.route.directTransfer ? 'disabled' : ''].join(' '),
@@ -20864,7 +20879,7 @@ var Footer = (function () {
20864
20879
 
20865
20880
  pay();
20866
20881
  }
20867
- }, "Pay ", displayedAmount);
20882
+ }, "Pay ", displayedPaymentValue);
20868
20883
  } else if (paymentState == 'paying') {
20869
20884
  return /*#__PURE__*/React.createElement("a", {
20870
20885
  className: "ButtonPrimary",
@@ -20907,19 +20922,22 @@ var Footer = (function () {
20907
20922
  });
20908
20923
 
20909
20924
  var DonationOverviewDialog = (function (props) {
20910
- var _useContext = useContext(ConfigurationContext),
20911
- currencyCode = _useContext.currencyCode,
20912
- title = _useContext.title;
20925
+ var _useContext = useContext(ConfigurationContext);
20926
+ _useContext.currencyCode;
20927
+ var title = _useContext.title;
20913
20928
 
20914
- var _useContext2 = useContext(ChangableAmountContext),
20915
- amount = _useContext2.amount;
20929
+ var _useContext2 = useContext(ChangableAmountContext);
20930
+ _useContext2.amount;
20916
20931
 
20917
20932
  var _useContext3 = useContext(PaymentContext),
20918
20933
  payment = _useContext3.payment,
20919
20934
  paymentState = _useContext3.paymentState;
20920
20935
 
20921
- var _useContext4 = useContext(NavigateStackContext),
20922
- navigate = _useContext4.navigate;
20936
+ var _useContext4 = useContext(PaymentValueContext),
20937
+ displayedPaymentValue = _useContext4.displayedPaymentValue;
20938
+
20939
+ var _useContext5 = useContext(NavigateStackContext),
20940
+ navigate = _useContext5.navigate;
20923
20941
 
20924
20942
  if (payment == undefined) {
20925
20943
  return /*#__PURE__*/React.createElement(DonationOverviewSkeleton, null);
@@ -20954,10 +20972,7 @@ var DonationOverviewDialog = (function (props) {
20954
20972
  className: "CardText"
20955
20973
  }, /*#__PURE__*/React.createElement("div", {
20956
20974
  className: "TokenAmountRow"
20957
- }, new Currency({
20958
- amount: amount.toFixed(2),
20959
- code: currencyCode
20960
- }).toString())))), /*#__PURE__*/React.createElement("div", {
20975
+ }, displayedPaymentValue)))), /*#__PURE__*/React.createElement("div", {
20961
20976
  className: "CardAction"
20962
20977
  }, /*#__PURE__*/React.createElement(ChevronRight, null))), /*#__PURE__*/React.createElement("div", {
20963
20978
  className: ["Card", paymentState == 'initialized' ? '' : 'disabled'].join(' '),
@@ -21696,12 +21711,12 @@ var preflight$2 = /*#__PURE__*/function () {
21696
21711
 
21697
21712
  var Donation = /*#__PURE__*/function () {
21698
21713
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
21699
- 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;
21714
+ var amount, accept, event, sent, confirmed, validated, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, fee, closable, integration, link, container, title, document, unmount;
21700
21715
  return regenerator.wrap(function _callee2$(_context2) {
21701
21716
  while (1) {
21702
21717
  switch (_context2.prev = _context2.next) {
21703
21718
  case 0:
21704
- 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;
21719
+ 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, 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;
21705
21720
  requireReactVersion();
21706
21721
  _context2.prev = 2;
21707
21722
  _context2.next = 5;
@@ -21735,6 +21750,7 @@ var Donation = /*#__PURE__*/function () {
21735
21750
  validated: validated,
21736
21751
  failed: failed,
21737
21752
  blacklist: blacklist,
21753
+ whitelist: whitelist,
21738
21754
  providers: providers,
21739
21755
  integration: integration,
21740
21756
  link: link,