@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.
@@ -21967,7 +21967,28 @@ var ConnectWalletDialog = (function (props) {
21967
21967
  className: "Alert"
21968
21968
  }, /*#__PURE__*/React.createElement("span", {
21969
21969
  className: "FontWeightBold PaddingBottomXS"
21970
- }, "You wallet extension window is already asking to connect. It might be hidden."))), /*#__PURE__*/React.createElement("button", {
21970
+ }, "You wallet extension window is already asking to connect. It might be hidden."))), props.connectingExtension && /*#__PURE__*/React.createElement("div", {
21971
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
21972
+ style: {
21973
+ height: '50px'
21974
+ }
21975
+ }, /*#__PURE__*/React.createElement("div", {
21976
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
21977
+ style: {
21978
+ width: "50px"
21979
+ }
21980
+ }, /*#__PURE__*/React.createElement("div", {
21981
+ className: "Loading Icon medium",
21982
+ style: {
21983
+ position: 'relative',
21984
+ top: '4px',
21985
+ left: '1px'
21986
+ }
21987
+ })), /*#__PURE__*/React.createElement("div", {
21988
+ className: "PaddingLeftS LineHeightXS"
21989
+ }, /*#__PURE__*/React.createElement("div", {
21990
+ className: "CardText FontWeightMedium"
21991
+ }, "Connecting extension"))), !props.connectingExtension && /*#__PURE__*/React.createElement("button", {
21971
21992
  onClick: function onClick() {
21972
21993
  return props.connectExtension(props.wallet);
21973
21994
  },
@@ -21993,7 +22014,28 @@ var ConnectWalletDialog = (function (props) {
21993
22014
  className: "CardText FontWeightMedium"
21994
22015
  }, "Connect extension")))), connectAppIsAvailable && /*#__PURE__*/React.createElement("div", {
21995
22016
  className: "PaddingBottomXS"
21996
- }, /*#__PURE__*/React.createElement("button", {
22017
+ }, props.connectingApp && /*#__PURE__*/React.createElement("div", {
22018
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
22019
+ style: {
22020
+ height: '50px'
22021
+ }
22022
+ }, /*#__PURE__*/React.createElement("div", {
22023
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
22024
+ style: {
22025
+ width: "50px"
22026
+ }
22027
+ }, /*#__PURE__*/React.createElement("div", {
22028
+ className: "Loading Icon medium",
22029
+ style: {
22030
+ position: 'relative',
22031
+ top: '4px',
22032
+ left: '1px'
22033
+ }
22034
+ })), /*#__PURE__*/React.createElement("div", {
22035
+ className: "PaddingLeftS LineHeightXS"
22036
+ }, /*#__PURE__*/React.createElement("div", {
22037
+ className: "CardText FontWeightMedium"
22038
+ }, "Connecting app"))), !props.connectingApp && /*#__PURE__*/React.createElement("button", {
21997
22039
  onClick: function onClick() {
21998
22040
  return props.connectViaRedirect(props.wallet);
21999
22041
  },
@@ -22586,20 +22628,28 @@ var ConnectStack = (function (props) {
22586
22628
  _useState4 = _slicedToArray(_useState3, 2),
22587
22629
  platform = _useState4[0],
22588
22630
  setPlatform = _useState4[1];
22589
- var _useState5 = useState(),
22631
+ var _useState5 = useState(false),
22590
22632
  _useState6 = _slicedToArray(_useState5, 2),
22591
- redirectUri = _useState6[0],
22592
- setRedirectUri = _useState6[1];
22593
- var _useState7 = useState({
22594
- blockchain: undefined
22595
- }),
22633
+ connectingExtension = _useState6[0],
22634
+ setConnectingExtension = _useState6[1];
22635
+ var _useState7 = useState(false),
22596
22636
  _useState8 = _slicedToArray(_useState7, 2),
22597
- selection = _useState8[0];
22598
- _useState8[1];
22599
- var _useState9 = useState(false),
22637
+ connectingApp = _useState8[0],
22638
+ setConnectingApp = _useState8[1];
22639
+ var _useState9 = useState(),
22600
22640
  _useState10 = _slicedToArray(_useState9, 2),
22601
- showConnectExtensionWarning = _useState10[0],
22602
- setShowConnectExtensionWarning = _useState10[1];
22641
+ redirectUri = _useState10[0],
22642
+ setRedirectUri = _useState10[1];
22643
+ var _useState11 = useState({
22644
+ blockchain: undefined
22645
+ }),
22646
+ _useState12 = _slicedToArray(_useState11, 2),
22647
+ selection = _useState12[0];
22648
+ _useState12[1];
22649
+ var _useState13 = useState(false),
22650
+ _useState14 = _slicedToArray(_useState13, 2),
22651
+ showConnectExtensionWarning = _useState14[0],
22652
+ setShowConnectExtensionWarning = _useState14[1];
22603
22653
  var resolve = function resolve(account, wallet) {
22604
22654
  if (account && wallet) {
22605
22655
  var walletMeta = allWallets.find(function (walletMeta) {
@@ -22617,10 +22667,18 @@ var ConnectStack = (function (props) {
22617
22667
  };
22618
22668
  var connectExtension = function connectExtension(wallet) {
22619
22669
  setShowConnectExtensionWarning(false);
22670
+ setConnectingExtension(true);
22620
22671
  wallet = new wallets[wallet.extension]();
22672
+ var resetConnectingTimeout = setTimeout(function () {
22673
+ setConnectingExtension(false);
22674
+ }, 5000);
22621
22675
  wallet.connect().then(function (account) {
22622
22676
  resolve(account, wallet);
22677
+ setConnectingExtension(false);
22678
+ clearTimeout(resetConnectingTimeout);
22623
22679
  })["catch"](function (error) {
22680
+ setConnectingExtension(false);
22681
+ clearTimeout(resetConnectingTimeout);
22624
22682
  if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
22625
22683
  // Request of type 'wallet_requestPermissions' already pending...
22626
22684
  setShowConnectExtensionWarning(true);
@@ -22697,6 +22755,10 @@ var ConnectStack = (function (props) {
22697
22755
  if (!platform) {
22698
22756
  return;
22699
22757
  }
22758
+ setConnectingApp(true);
22759
+ setTimeout(function () {
22760
+ setConnectingApp(false);
22761
+ }, 5000);
22700
22762
  if (['WalletConnectV1', 'WalletConnectV2'].includes(platform.connect)) {
22701
22763
  localStorage[atob('ZGVwYXk6d2FsbGV0czp3YzI6cHJvamVjdElk')] = atob('YjFmYzJmMDZlYTIxMDdmY2Q5OWM2OGY0MTI3MTQxYWI=');
22702
22764
  var _wallet = new wallets[platform.connect]();
@@ -22721,7 +22783,10 @@ var ConnectStack = (function (props) {
22721
22783
  });
22722
22784
  }
22723
22785
  }).then(function (account) {
22786
+ setConnectingApp(false);
22724
22787
  resolve(account, _wallet);
22788
+ })["catch"](function () {
22789
+ setConnectingApp(false);
22725
22790
  });
22726
22791
  } else if (platform.connect === 'SolanaMobileWalletAdapter') {
22727
22792
  var _wallet2 = new wallets[platform.connect]();
@@ -22729,7 +22794,10 @@ var ConnectStack = (function (props) {
22729
22794
  name: walletMetaData.name,
22730
22795
  logo: walletMetaData.logo
22731
22796
  }).then(function (account) {
22797
+ setConnectingApp(false);
22732
22798
  resolve(account, _wallet2);
22799
+ })["catch"](function () {
22800
+ setConnectingApp(false);
22733
22801
  });
22734
22802
  }
22735
22803
  };
@@ -22772,6 +22840,8 @@ var ConnectStack = (function (props) {
22772
22840
  openInApp: openInApp,
22773
22841
  connectViaRedirect: connectViaRedirect,
22774
22842
  connectExtension: connectExtension,
22843
+ connectingExtension: connectingExtension,
22844
+ connectingApp: connectingApp,
22775
22845
  showConnectExtensionWarning: showConnectExtensionWarning,
22776
22846
  continueWithSolanaPay: props.continueWithSolanaPay
22777
22847
  })
@@ -23172,7 +23242,7 @@ var HeightStyle = (function () {
23172
23242
  });
23173
23243
 
23174
23244
  var IconStyle = (function (style) {
23175
- 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 ");
23245
+ 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 ");
23176
23246
  });
23177
23247
 
23178
23248
  var ImageStyle = (function (style) {
@@ -23512,8 +23582,10 @@ function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t
23512
23582
  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";
23513
23583
  var ConfigurationProvider = (function (props) {
23514
23584
  var _props$configuration, _props$configuration5;
23515
- var currencyCode = new Currency({
23585
+ var currencyCode = typeof props.configuration.currency === 'string' ? new Currency({
23516
23586
  code: props.configuration.currency
23587
+ }).code : new Currency({
23588
+ amount: 0
23517
23589
  }).code;
23518
23590
  var _useState = useState(!((_props$configuration = props.configuration) !== null && _props$configuration !== void 0 && _props$configuration.integration) ? _objectSpread$5(_objectSpread$5({}, props.configuration), {}, {
23519
23591
  currencyCode: currencyCode
@@ -24198,10 +24270,10 @@ var ChangableAmountProvider = (function (props) {
24198
24270
  });
24199
24271
  };
24200
24272
  var _useContext = useContext(ConfigurationContext),
24201
- accept = _useContext.accept,
24202
24273
  configuredAmount = _useContext.amount;
24203
24274
  _useContext.toAmount;
24204
- var recover = _useContext.recover;
24275
+ var recover = _useContext.recover,
24276
+ accept = _useContext.accept;
24205
24277
  useContext(ConfigurationContext);
24206
24278
  var _useState = useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24207
24279
  _useState2 = _slicedToArray(_useState, 2),
@@ -24819,9 +24891,12 @@ var InsufficientAmountOfTokensDialog = (function (props) {
24819
24891
  _useContext.navigate;
24820
24892
  var set = _useContext.set;
24821
24893
  var _useContext2 = useContext(ConfigurationContext),
24822
- accept = _useContext2.accept;
24823
- var _useContext3 = useContext(ClosableContext),
24824
- close = _useContext3.close;
24894
+ accept = _useContext2.accept,
24895
+ sell = _useContext2.sell;
24896
+ var _useContext3 = useContext(ChangableAmountContext),
24897
+ acceptWithAmount = _useContext3.acceptWithAmount;
24898
+ var _useContext4 = useContext(ClosableContext),
24899
+ close = _useContext4.close;
24825
24900
  var setRecommendation = function setRecommendation(_x) {
24826
24901
  return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(_ref) {
24827
24902
  var route, accept, nativeAvailableAsset, token, asset, _ref3, _ref4;
@@ -25032,7 +25107,7 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25032
25107
  return regenerator.wrap(function _callee6$(_context6) {
25033
25108
  while (1) switch (_context6.prev = _context6.next) {
25034
25109
  case 0:
25035
- directTransfer = accept.find(function (accept) {
25110
+ directTransfer = !sell && (acceptWithAmount || accept).find(function (accept) {
25036
25111
  return props.assets.find(function (asset) {
25037
25112
  return accept.blockchain === asset.blockchain && accept.token.toLowerCase() === asset.address.toLowerCase();
25038
25113
  });
@@ -25084,7 +25159,7 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25084
25159
  })) {
25085
25160
  return;
25086
25161
  } // consdier only major tokens for this
25087
- return accept.map(function (_x4) {
25162
+ return (acceptWithAmount || accept).map(function (_x4) {
25088
25163
  return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(accept) {
25089
25164
  return regenerator.wrap(function _callee4$(_context4) {
25090
25165
  while (1) switch (_context4.prev = _context4.next) {
@@ -25129,15 +25204,15 @@ var InsufficientAmountOfTokensDialog = (function (props) {
25129
25204
  return regenerator.wrap(function _callee5$(_context5) {
25130
25205
  while (1) switch (_context5.prev = _context5.next) {
25131
25206
  case 0:
25132
- route = (routes || []).flat().find(function (route) {
25133
- return accept.find(function (accept) {
25207
+ route = (routes.filter(Boolean) || []).flat().find(function (route) {
25208
+ return (acceptWithAmount || accept).find(function (accept) {
25134
25209
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25135
25210
  });
25136
25211
  }) || routes.flat()[0];
25137
25212
  if (!route) {
25138
25213
  set(['NoPaymentOptionFound']);
25139
25214
  } else {
25140
- recommendedAccept = accept.find(function (accept) {
25215
+ recommendedAccept = (acceptWithAmount || accept).find(function (accept) {
25141
25216
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25142
25217
  }) || accept.find(function (accept) {
25143
25218
  return accept.blockchain === route.blockchain;
@@ -28424,6 +28499,7 @@ var Sale = function Sale(_x2) {
28424
28499
  }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
28425
28500
  configuration: {
28426
28501
  type: 'sale',
28502
+ accept: accept,
28427
28503
  tokenImage: tokenImage,
28428
28504
  amount: amount,
28429
28505
  sell: sell,
@@ -28443,9 +28519,7 @@ var Sale = function Sale(_x2) {
28443
28519
  container: container,
28444
28520
  connected: connected,
28445
28521
  unmount: unmount
28446
- }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, {
28447
- accept: accept
28448
- }, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
28522
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(ConversionRateProvider, null, /*#__PURE__*/React.createElement(ChangableAmountProvider, null, /*#__PURE__*/React.createElement(TransactionTrackingProvider, null, /*#__PURE__*/React.createElement(PaymentTrackingProvider, {
28449
28523
  document: ensureDocument(document)
28450
28524
  }, /*#__PURE__*/React.createElement(SaleRoutingProvider, {
28451
28525
  container: container,