@depay/widgets 12.0.2 → 12.0.4

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.
@@ -21968,7 +21968,28 @@ var ConnectWalletDialog = (function (props) {
21968
21968
  className: "Alert"
21969
21969
  }, /*#__PURE__*/React.createElement("span", {
21970
21970
  className: "FontWeightBold PaddingBottomXS"
21971
- }, "You wallet extension window is already asking to connect. It might be hidden."))), /*#__PURE__*/React.createElement("button", {
21971
+ }, "You wallet extension window is already asking to connect. It might be hidden."))), props.connectingExtension && /*#__PURE__*/React.createElement("div", {
21972
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
21973
+ style: {
21974
+ height: '50px'
21975
+ }
21976
+ }, /*#__PURE__*/React.createElement("div", {
21977
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
21978
+ style: {
21979
+ width: "50px"
21980
+ }
21981
+ }, /*#__PURE__*/React.createElement("div", {
21982
+ className: "Loading Icon medium",
21983
+ style: {
21984
+ position: 'relative',
21985
+ top: '4px',
21986
+ left: '1px'
21987
+ }
21988
+ })), /*#__PURE__*/React.createElement("div", {
21989
+ className: "PaddingLeftS LineHeightXS"
21990
+ }, /*#__PURE__*/React.createElement("div", {
21991
+ className: "CardText FontWeightMedium"
21992
+ }, "Connecting extension"))), !props.connectingExtension && /*#__PURE__*/React.createElement("button", {
21972
21993
  onClick: function onClick() {
21973
21994
  return props.connectExtension(props.wallet);
21974
21995
  },
@@ -21994,7 +22015,28 @@ var ConnectWalletDialog = (function (props) {
21994
22015
  className: "CardText FontWeightMedium"
21995
22016
  }, "Connect extension")))), connectAppIsAvailable && /*#__PURE__*/React.createElement("div", {
21996
22017
  className: "PaddingBottomXS"
21997
- }, /*#__PURE__*/React.createElement("button", {
22018
+ }, props.connectingApp && /*#__PURE__*/React.createElement("div", {
22019
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
22020
+ style: {
22021
+ height: '50px'
22022
+ }
22023
+ }, /*#__PURE__*/React.createElement("div", {
22024
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
22025
+ style: {
22026
+ width: "50px"
22027
+ }
22028
+ }, /*#__PURE__*/React.createElement("div", {
22029
+ className: "Loading Icon medium",
22030
+ style: {
22031
+ position: 'relative',
22032
+ top: '4px',
22033
+ left: '1px'
22034
+ }
22035
+ })), /*#__PURE__*/React.createElement("div", {
22036
+ className: "PaddingLeftS LineHeightXS"
22037
+ }, /*#__PURE__*/React.createElement("div", {
22038
+ className: "CardText FontWeightMedium"
22039
+ }, "Connecting app"))), !props.connectingApp && /*#__PURE__*/React.createElement("button", {
21998
22040
  onClick: function onClick() {
21999
22041
  return props.connectViaRedirect(props.wallet);
22000
22042
  },
@@ -22587,20 +22629,28 @@ var ConnectStack = (function (props) {
22587
22629
  _useState4 = _slicedToArray(_useState3, 2),
22588
22630
  platform = _useState4[0],
22589
22631
  setPlatform = _useState4[1];
22590
- var _useState5 = useState(),
22632
+ var _useState5 = useState(false),
22591
22633
  _useState6 = _slicedToArray(_useState5, 2),
22592
- redirectUri = _useState6[0],
22593
- setRedirectUri = _useState6[1];
22594
- var _useState7 = useState({
22595
- blockchain: undefined
22596
- }),
22634
+ connectingExtension = _useState6[0],
22635
+ setConnectingExtension = _useState6[1];
22636
+ var _useState7 = useState(false),
22597
22637
  _useState8 = _slicedToArray(_useState7, 2),
22598
- selection = _useState8[0];
22599
- _useState8[1];
22600
- var _useState9 = useState(false),
22638
+ connectingApp = _useState8[0],
22639
+ setConnectingApp = _useState8[1];
22640
+ var _useState9 = useState(),
22601
22641
  _useState10 = _slicedToArray(_useState9, 2),
22602
- showConnectExtensionWarning = _useState10[0],
22603
- setShowConnectExtensionWarning = _useState10[1];
22642
+ redirectUri = _useState10[0],
22643
+ setRedirectUri = _useState10[1];
22644
+ var _useState11 = useState({
22645
+ blockchain: undefined
22646
+ }),
22647
+ _useState12 = _slicedToArray(_useState11, 2),
22648
+ selection = _useState12[0];
22649
+ _useState12[1];
22650
+ var _useState13 = useState(false),
22651
+ _useState14 = _slicedToArray(_useState13, 2),
22652
+ showConnectExtensionWarning = _useState14[0],
22653
+ setShowConnectExtensionWarning = _useState14[1];
22604
22654
  var resolve = function resolve(account, wallet) {
22605
22655
  if (account && wallet) {
22606
22656
  var walletMeta = allWallets.find(function (walletMeta) {
@@ -22618,10 +22668,18 @@ var ConnectStack = (function (props) {
22618
22668
  };
22619
22669
  var connectExtension = function connectExtension(wallet) {
22620
22670
  setShowConnectExtensionWarning(false);
22671
+ setConnectingExtension(true);
22621
22672
  wallet = new wallets[wallet.extension]();
22673
+ var resetConnectingTimeout = setTimeout(function () {
22674
+ setConnectingExtension(false);
22675
+ }, 5000);
22622
22676
  wallet.connect().then(function (account) {
22623
22677
  resolve(account, wallet);
22678
+ setConnectingExtension(false);
22679
+ clearTimeout(resetConnectingTimeout);
22624
22680
  })["catch"](function (error) {
22681
+ setConnectingExtension(false);
22682
+ clearTimeout(resetConnectingTimeout);
22625
22683
  if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
22626
22684
  // Request of type 'wallet_requestPermissions' already pending...
22627
22685
  setShowConnectExtensionWarning(true);
@@ -22698,6 +22756,10 @@ var ConnectStack = (function (props) {
22698
22756
  if (!platform) {
22699
22757
  return;
22700
22758
  }
22759
+ setConnectingApp(true);
22760
+ setTimeout(function () {
22761
+ setConnectingApp(false);
22762
+ }, 5000);
22701
22763
  if (['WalletConnectV1', 'WalletConnectV2'].includes(platform.connect)) {
22702
22764
  localStorage[atob('ZGVwYXk6d2FsbGV0czp3YzI6cHJvamVjdElk')] = atob('YjFmYzJmMDZlYTIxMDdmY2Q5OWM2OGY0MTI3MTQxYWI=');
22703
22765
  var _wallet = new wallets[platform.connect]();
@@ -22722,7 +22784,10 @@ var ConnectStack = (function (props) {
22722
22784
  });
22723
22785
  }
22724
22786
  }).then(function (account) {
22787
+ setConnectingApp(false);
22725
22788
  resolve(account, _wallet);
22789
+ })["catch"](function () {
22790
+ setConnectingApp(false);
22726
22791
  });
22727
22792
  } else if (platform.connect === 'SolanaMobileWalletAdapter') {
22728
22793
  var _wallet2 = new wallets[platform.connect]();
@@ -22730,7 +22795,10 @@ var ConnectStack = (function (props) {
22730
22795
  name: walletMetaData.name,
22731
22796
  logo: walletMetaData.logo
22732
22797
  }).then(function (account) {
22798
+ setConnectingApp(false);
22733
22799
  resolve(account, _wallet2);
22800
+ })["catch"](function () {
22801
+ setConnectingApp(false);
22734
22802
  });
22735
22803
  }
22736
22804
  };
@@ -22773,6 +22841,8 @@ var ConnectStack = (function (props) {
22773
22841
  openInApp: openInApp,
22774
22842
  connectViaRedirect: connectViaRedirect,
22775
22843
  connectExtension: connectExtension,
22844
+ connectingExtension: connectingExtension,
22845
+ connectingApp: connectingApp,
22776
22846
  showConnectExtensionWarning: showConnectExtensionWarning,
22777
22847
  continueWithSolanaPay: props.continueWithSolanaPay
22778
22848
  })
@@ -23173,7 +23243,7 @@ var HeightStyle = (function () {
23173
23243
  });
23174
23244
 
23175
23245
  var IconStyle = (function (style) {
23176
- return "\n\n .Icon {\n fill: ".concat(style.colors.icons, ";\n stroke: ").concat(style.colors.icons, ";\n }\n\n .QuestionMarkIcon {\n fill: transparent;\n }\n\n .ChevronLeft, .ChevronRight {\n position: relative;\n top: 1px;\n }\n\n .ChevronLeft.small, .ChevronRight.small {\n height: 12px;\n width: 12px;\n }\n\n .Checkmark {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .AlertIcon {\n height: 20px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 20px;\n fill: #e42626;\n stroke: transparent;\n }\n\n .CheckMark.small {\n height: 16px;\n width: 16px;\n }\n\n .DigitalWalletIcon {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .ButtonPrimary .Icon {\n fill : ").concat(style.colors.buttonText, ";\n stroke : ").concat(style.colors.buttonText, ";\n }\n\n .Loading {\n border: 3px solid ").concat(style.colors.primary, ";\n border-top: 3px solid rgba(0,0,0,0.1);\n border-radius: 100%;\n position: relative;\n left: -1px;\n width: 18px;\n height: 18px;\n animation: spin 1.5s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ");
23246
+ return "\n\n .Icon {\n fill: ".concat(style.colors.icons, ";\n stroke: ").concat(style.colors.icons, ";\n }\n\n .QuestionMarkIcon {\n fill: transparent;\n }\n\n .ChevronLeft, .ChevronRight {\n position: relative;\n top: 1px;\n }\n\n .ChevronLeft.small, .ChevronRight.small {\n height: 12px;\n width: 12px;\n }\n\n .Checkmark {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .AlertIcon {\n height: 20px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 20px;\n fill: #e42626;\n stroke: transparent;\n }\n\n .CheckMark.small {\n height: 16px;\n width: 16px;\n }\n\n .DigitalWalletIcon {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .ButtonPrimary .Icon {\n fill : ").concat(style.colors.buttonText, ";\n stroke : ").concat(style.colors.buttonText, ";\n }\n\n .Loading {\n animation: spin 1.5s linear infinite;\n border-radius: 100%;\n border: 3px solid ").concat(style.colors.primary, ";\n border-top: 3px solid rgba(0,0,0,0.1);\n display: inline-block;\n height: 18px;\n left: -1px;\n position: relative;\n width: 18px;\n }\n\n .Loading.medium {\n border: 4px solid ").concat(style.colors.primary, ";\n border-top: 4px solid rgba(0,0,0,0.1);\n display: inline-block;\n height: 22px;\n position: relative;\n width: 22px; \n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ");
23177
23247
  });
23178
23248
 
23179
23249
  var ImageStyle = (function (style) {
@@ -23513,8 +23583,10 @@ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t
23513
23583
  var PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtqsu0wy94cpz90W4pGsJ\nSf0bfvmsq3su+R1J4AoAYz0XoAu2MXJZM8vrQvG3op7OgB3zze8pj4joaoPU2piT\ndH7kcF4Mde6QG4qKEL3VE+J8CL3qK2dUY0Umu20x/O9O792tlv8+Q/qAVv8yPfdM\nn5Je9Wc7VI5XeIBKP2AzsCkrXuzQlR48Ac5LpViNSSLu0mz5NTBoHkW2sz1sNWc6\nUpYISJkiKTvYc8Bo4p5xD6+ZmlL4hj1Ad/+26SjYcisX2Ut4QD7YKRBP2SbItVkI\nqp9mp6c6MCKNmEUkosxAr0KVfOcrk6/fcc4tI8g+KYZ32G11Ri8Xo4fgHH06DLYP\n3QIDAQAB\n-----END PUBLIC KEY-----\n";
23514
23584
  var ConfigurationProvider = (function (props) {
23515
23585
  var _props$configuration, _props$configuration5;
23516
- var currencyCode = new Currency({
23586
+ var currencyCode = typeof props.configuration.currency === 'string' ? new Currency({
23517
23587
  code: props.configuration.currency
23588
+ }).code : new Currency({
23589
+ amount: 0
23518
23590
  }).code;
23519
23591
  var _useState = useState(!((_props$configuration = props.configuration) !== null && _props$configuration !== void 0 && _props$configuration.integration) ? _objectSpread$6(_objectSpread$6({}, props.configuration), {}, {
23520
23592
  currencyCode: currencyCode
@@ -24199,10 +24271,10 @@ var ChangableAmountProvider = (function (props) {
24199
24271
  });
24200
24272
  };
24201
24273
  var _useContext = useContext(ConfigurationContext),
24202
- accept = _useContext.accept,
24203
24274
  configuredAmount = _useContext.amount;
24204
24275
  _useContext.toAmount;
24205
- var recover = _useContext.recover;
24276
+ var recover = _useContext.recover,
24277
+ accept = _useContext.accept;
24206
24278
  useContext(ConfigurationContext);
24207
24279
  var _useState = useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24208
24280
  _useState2 = _slicedToArray(_useState, 2),
@@ -24820,9 +24892,12 @@ var InsufficientAmountOfTokensDialog = (function (props) {
24820
24892
  _useContext.navigate;
24821
24893
  var set = _useContext.set;
24822
24894
  var _useContext2 = useContext(ConfigurationContext),
24823
- accept = _useContext2.accept;
24824
- var _useContext3 = useContext(ClosableContext),
24825
- close = _useContext3.close;
24895
+ accept = _useContext2.accept,
24896
+ sell = _useContext2.sell;
24897
+ var _useContext3 = useContext(ChangableAmountContext),
24898
+ acceptWithAmount = _useContext3.acceptWithAmount;
24899
+ var _useContext4 = useContext(ClosableContext),
24900
+ close = _useContext4.close;
24826
24901
  var setRecommendation = function setRecommendation(_x) {
24827
24902
  return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(_ref) {
24828
24903
  var route, accept, nativeAvailableAsset, token, asset, _ref3, _ref4;
@@ -25033,7 +25108,7 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25033
25108
  return regenerator.wrap(function _callee6$(_context6) {
25034
25109
  while (1) switch (_context6.prev = _context6.next) {
25035
25110
  case 0:
25036
- directTransfer = accept.find(function (accept) {
25111
+ directTransfer = !sell && (acceptWithAmount || accept).find(function (accept) {
25037
25112
  return props.assets.find(function (asset) {
25038
25113
  return accept.blockchain === asset.blockchain && accept.token.toLowerCase() === asset.address.toLowerCase();
25039
25114
  });
@@ -25085,7 +25160,7 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25085
25160
  })) {
25086
25161
  return;
25087
25162
  } // consdier only major tokens for this
25088
- return accept.map(function (_x4) {
25163
+ return (acceptWithAmount || accept).map(function (_x4) {
25089
25164
  return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(accept) {
25090
25165
  return regenerator.wrap(function _callee4$(_context4) {
25091
25166
  while (1) switch (_context4.prev = _context4.next) {
@@ -25130,15 +25205,15 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25130
25205
  return regenerator.wrap(function _callee5$(_context5) {
25131
25206
  while (1) switch (_context5.prev = _context5.next) {
25132
25207
  case 0:
25133
- route = (routes || []).flat().find(function (route) {
25134
- return accept.find(function (accept) {
25208
+ route = (routes.filter(Boolean) || []).flat().find(function (route) {
25209
+ return (acceptWithAmount || accept).find(function (accept) {
25135
25210
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25136
25211
  });
25137
25212
  }) || routes.flat()[0];
25138
25213
  if (!route) {
25139
25214
  set(['NoPaymentOptionFound']);
25140
25215
  } else {
25141
- recommendedAccept = accept.find(function (accept) {
25216
+ recommendedAccept = (acceptWithAmount || accept).find(function (accept) {
25142
25217
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25143
25218
  }) || accept.find(function (accept) {
25144
25219
  return accept.blockchain === route.blockchain;
@@ -37190,6 +37265,7 @@ var Sale = function Sale(_x2) {
37190
37265
  }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
37191
37266
  configuration: {
37192
37267
  type: 'sale',
37268
+ accept: accept,
37193
37269
  tokenImage: tokenImage,
37194
37270
  amount: amount,
37195
37271
  sell: sell,
@@ -37209,9 +37285,7 @@ var Sale = function Sale(_x2) {
37209
37285
  container: container,
37210
37286
  connected: connected,
37211
37287
  unmount: unmount
37212
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
37213
- accept: accept
37214
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
37288
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, null, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
37215
37289
  document: ensureDocument(document)
37216
37290
  }, /*#__PURE__*/React.createElement(SaleRoutingProvider, {
37217
37291
  container: container,