@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.
package/dist/umd/index.js CHANGED
@@ -21965,7 +21965,28 @@
21965
21965
  className: "Alert"
21966
21966
  }, /*#__PURE__*/React__default["default"].createElement("span", {
21967
21967
  className: "FontWeightBold PaddingBottomXS"
21968
- }, "You wallet extension window is already asking to connect. It might be hidden."))), /*#__PURE__*/React__default["default"].createElement("button", {
21968
+ }, "You wallet extension window is already asking to connect. It might be hidden."))), props.connectingExtension && /*#__PURE__*/React__default["default"].createElement("div", {
21969
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
21970
+ style: {
21971
+ height: '50px'
21972
+ }
21973
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21974
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
21975
+ style: {
21976
+ width: "50px"
21977
+ }
21978
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21979
+ className: "Loading Icon medium",
21980
+ style: {
21981
+ position: 'relative',
21982
+ top: '4px',
21983
+ left: '1px'
21984
+ }
21985
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
21986
+ className: "PaddingLeftS LineHeightXS"
21987
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21988
+ className: "CardText FontWeightMedium"
21989
+ }, "Connecting extension"))), !props.connectingExtension && /*#__PURE__*/React__default["default"].createElement("button", {
21969
21990
  onClick: function onClick() {
21970
21991
  return props.connectExtension(props.wallet);
21971
21992
  },
@@ -21991,7 +22012,28 @@
21991
22012
  className: "CardText FontWeightMedium"
21992
22013
  }, "Connect extension")))), connectAppIsAvailable && /*#__PURE__*/React__default["default"].createElement("div", {
21993
22014
  className: "PaddingBottomXS"
21994
- }, /*#__PURE__*/React__default["default"].createElement("button", {
22015
+ }, props.connectingApp && /*#__PURE__*/React__default["default"].createElement("div", {
22016
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
22017
+ style: {
22018
+ height: '50px'
22019
+ }
22020
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22021
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
22022
+ style: {
22023
+ width: "50px"
22024
+ }
22025
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22026
+ className: "Loading Icon medium",
22027
+ style: {
22028
+ position: 'relative',
22029
+ top: '4px',
22030
+ left: '1px'
22031
+ }
22032
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
22033
+ className: "PaddingLeftS LineHeightXS"
22034
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22035
+ className: "CardText FontWeightMedium"
22036
+ }, "Connecting app"))), !props.connectingApp && /*#__PURE__*/React__default["default"].createElement("button", {
21995
22037
  onClick: function onClick() {
21996
22038
  return props.connectViaRedirect(props.wallet);
21997
22039
  },
@@ -22584,20 +22626,28 @@
22584
22626
  _useState4 = _slicedToArray(_useState3, 2),
22585
22627
  platform = _useState4[0],
22586
22628
  setPlatform = _useState4[1];
22587
- var _useState5 = React.useState(),
22629
+ var _useState5 = React.useState(false),
22588
22630
  _useState6 = _slicedToArray(_useState5, 2),
22589
- redirectUri = _useState6[0],
22590
- setRedirectUri = _useState6[1];
22591
- var _useState7 = React.useState({
22592
- blockchain: undefined
22593
- }),
22631
+ connectingExtension = _useState6[0],
22632
+ setConnectingExtension = _useState6[1];
22633
+ var _useState7 = React.useState(false),
22594
22634
  _useState8 = _slicedToArray(_useState7, 2),
22595
- selection = _useState8[0];
22596
- _useState8[1];
22597
- var _useState9 = React.useState(false),
22635
+ connectingApp = _useState8[0],
22636
+ setConnectingApp = _useState8[1];
22637
+ var _useState9 = React.useState(),
22598
22638
  _useState10 = _slicedToArray(_useState9, 2),
22599
- showConnectExtensionWarning = _useState10[0],
22600
- setShowConnectExtensionWarning = _useState10[1];
22639
+ redirectUri = _useState10[0],
22640
+ setRedirectUri = _useState10[1];
22641
+ var _useState11 = React.useState({
22642
+ blockchain: undefined
22643
+ }),
22644
+ _useState12 = _slicedToArray(_useState11, 2),
22645
+ selection = _useState12[0];
22646
+ _useState12[1];
22647
+ var _useState13 = React.useState(false),
22648
+ _useState14 = _slicedToArray(_useState13, 2),
22649
+ showConnectExtensionWarning = _useState14[0],
22650
+ setShowConnectExtensionWarning = _useState14[1];
22601
22651
  var resolve = function resolve(account, wallet) {
22602
22652
  if (account && wallet) {
22603
22653
  var walletMeta = allWallets.find(function (walletMeta) {
@@ -22615,10 +22665,18 @@
22615
22665
  };
22616
22666
  var connectExtension = function connectExtension(wallet) {
22617
22667
  setShowConnectExtensionWarning(false);
22668
+ setConnectingExtension(true);
22618
22669
  wallet = new web3Wallets.wallets[wallet.extension]();
22670
+ var resetConnectingTimeout = setTimeout(function () {
22671
+ setConnectingExtension(false);
22672
+ }, 5000);
22619
22673
  wallet.connect().then(function (account) {
22620
22674
  resolve(account, wallet);
22675
+ setConnectingExtension(false);
22676
+ clearTimeout(resetConnectingTimeout);
22621
22677
  })["catch"](function (error) {
22678
+ setConnectingExtension(false);
22679
+ clearTimeout(resetConnectingTimeout);
22622
22680
  if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
22623
22681
  // Request of type 'wallet_requestPermissions' already pending...
22624
22682
  setShowConnectExtensionWarning(true);
@@ -22695,6 +22753,10 @@
22695
22753
  if (!platform) {
22696
22754
  return;
22697
22755
  }
22756
+ setConnectingApp(true);
22757
+ setTimeout(function () {
22758
+ setConnectingApp(false);
22759
+ }, 5000);
22698
22760
  if (['WalletConnectV1', 'WalletConnectV2'].includes(platform.connect)) {
22699
22761
  localStorage[atob('ZGVwYXk6d2FsbGV0czp3YzI6cHJvamVjdElk')] = atob('YjFmYzJmMDZlYTIxMDdmY2Q5OWM2OGY0MTI3MTQxYWI=');
22700
22762
  var _wallet = new web3Wallets.wallets[platform.connect]();
@@ -22719,7 +22781,10 @@
22719
22781
  });
22720
22782
  }
22721
22783
  }).then(function (account) {
22784
+ setConnectingApp(false);
22722
22785
  resolve(account, _wallet);
22786
+ })["catch"](function () {
22787
+ setConnectingApp(false);
22723
22788
  });
22724
22789
  } else if (platform.connect === 'SolanaMobileWalletAdapter') {
22725
22790
  var _wallet2 = new web3Wallets.wallets[platform.connect]();
@@ -22727,7 +22792,10 @@
22727
22792
  name: walletMetaData.name,
22728
22793
  logo: walletMetaData.logo
22729
22794
  }).then(function (account) {
22795
+ setConnectingApp(false);
22730
22796
  resolve(account, _wallet2);
22797
+ })["catch"](function () {
22798
+ setConnectingApp(false);
22731
22799
  });
22732
22800
  }
22733
22801
  };
@@ -22770,6 +22838,8 @@
22770
22838
  openInApp: openInApp,
22771
22839
  connectViaRedirect: connectViaRedirect,
22772
22840
  connectExtension: connectExtension,
22841
+ connectingExtension: connectingExtension,
22842
+ connectingApp: connectingApp,
22773
22843
  showConnectExtensionWarning: showConnectExtensionWarning,
22774
22844
  continueWithSolanaPay: props.continueWithSolanaPay
22775
22845
  })
@@ -23170,7 +23240,7 @@
23170
23240
  });
23171
23241
 
23172
23242
  var IconStyle = (function (style) {
23173
- 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 ");
23243
+ 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 ");
23174
23244
  });
23175
23245
 
23176
23246
  var ImageStyle = (function (style) {
@@ -23471,8 +23541,10 @@
23471
23541
  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";
23472
23542
  var ConfigurationProvider = (function (props) {
23473
23543
  var _props$configuration, _props$configuration5;
23474
- var currencyCode = new localCurrency.Currency({
23544
+ var currencyCode = typeof props.configuration.currency === 'string' ? new localCurrency.Currency({
23475
23545
  code: props.configuration.currency
23546
+ }).code : new localCurrency.Currency({
23547
+ amount: 0
23476
23548
  }).code;
23477
23549
  var _useState = React.useState(!((_props$configuration = props.configuration) !== null && _props$configuration !== void 0 && _props$configuration.integration) ? _objectSpread$6(_objectSpread$6({}, props.configuration), {}, {
23478
23550
  currencyCode: currencyCode
@@ -24157,10 +24229,10 @@
24157
24229
  });
24158
24230
  };
24159
24231
  var _useContext = React.useContext(ConfigurationContext),
24160
- accept = _useContext.accept,
24161
24232
  configuredAmount = _useContext.amount;
24162
24233
  _useContext.toAmount;
24163
- var recover = _useContext.recover;
24234
+ var recover = _useContext.recover,
24235
+ accept = _useContext.accept;
24164
24236
  React.useContext(ConfigurationContext);
24165
24237
  var _useState = React.useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24166
24238
  _useState2 = _slicedToArray(_useState, 2),
@@ -24778,9 +24850,12 @@
24778
24850
  _useContext.navigate;
24779
24851
  var set = _useContext.set;
24780
24852
  var _useContext2 = React.useContext(ConfigurationContext),
24781
- accept = _useContext2.accept;
24782
- var _useContext3 = React.useContext(ClosableContext),
24783
- close = _useContext3.close;
24853
+ accept = _useContext2.accept,
24854
+ sell = _useContext2.sell;
24855
+ var _useContext3 = React.useContext(ChangableAmountContext),
24856
+ acceptWithAmount = _useContext3.acceptWithAmount;
24857
+ var _useContext4 = React.useContext(ClosableContext),
24858
+ close = _useContext4.close;
24784
24859
  var setRecommendation = function setRecommendation(_x) {
24785
24860
  return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3(_ref) {
24786
24861
  var route, accept, nativeAvailableAsset, token, asset, _ref3, _ref4;
@@ -24991,7 +25066,7 @@
24991
25066
  return regenerator.wrap(function _callee6$(_context6) {
24992
25067
  while (1) switch (_context6.prev = _context6.next) {
24993
25068
  case 0:
24994
- directTransfer = accept.find(function (accept) {
25069
+ directTransfer = !sell && (acceptWithAmount || accept).find(function (accept) {
24995
25070
  return props.assets.find(function (asset) {
24996
25071
  return accept.blockchain === asset.blockchain && accept.token.toLowerCase() === asset.address.toLowerCase();
24997
25072
  });
@@ -25043,7 +25118,7 @@
25043
25118
  })) {
25044
25119
  return;
25045
25120
  } // consdier only major tokens for this
25046
- return accept.map(function (_x4) {
25121
+ return (acceptWithAmount || accept).map(function (_x4) {
25047
25122
  return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(accept) {
25048
25123
  return regenerator.wrap(function _callee4$(_context4) {
25049
25124
  while (1) switch (_context4.prev = _context4.next) {
@@ -25088,15 +25163,15 @@
25088
25163
  return regenerator.wrap(function _callee5$(_context5) {
25089
25164
  while (1) switch (_context5.prev = _context5.next) {
25090
25165
  case 0:
25091
- route = (routes || []).flat().find(function (route) {
25092
- return accept.find(function (accept) {
25166
+ route = (routes.filter(Boolean) || []).flat().find(function (route) {
25167
+ return (acceptWithAmount || accept).find(function (accept) {
25093
25168
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25094
25169
  });
25095
25170
  }) || routes.flat()[0];
25096
25171
  if (!route) {
25097
25172
  set(['NoPaymentOptionFound']);
25098
25173
  } else {
25099
- recommendedAccept = accept.find(function (accept) {
25174
+ recommendedAccept = (acceptWithAmount || accept).find(function (accept) {
25100
25175
  return accept.blockchain === route.blockchain && accept.token.toLowerCase() === route.tokenOut.toLowerCase();
25101
25176
  }) || accept.find(function (accept) {
25102
25177
  return accept.blockchain === route.blockchain;
@@ -29633,6 +29708,7 @@
29633
29708
  }, /*#__PURE__*/React__default["default"].createElement(ConfigurationProvider, {
29634
29709
  configuration: {
29635
29710
  type: 'sale',
29711
+ accept: accept,
29636
29712
  tokenImage: tokenImage,
29637
29713
  amount: amount,
29638
29714
  sell: sell,
@@ -29652,9 +29728,7 @@
29652
29728
  container: container,
29653
29729
  connected: connected,
29654
29730
  unmount: unmount
29655
- }, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, {
29656
- accept: accept
29657
- }, /*#__PURE__*/React__default["default"].createElement(TransactionTrackingProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentTrackingProvider, {
29731
+ }, /*#__PURE__*/React__default["default"].createElement(NavigateProvider, null, /*#__PURE__*/React__default["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default["default"].createElement(ChangableAmountProvider, null, /*#__PURE__*/React__default["default"].createElement(TransactionTrackingProvider, null, /*#__PURE__*/React__default["default"].createElement(PaymentTrackingProvider, {
29658
29732
  document: ensureDocument(document)
29659
29733
  }, /*#__PURE__*/React__default["default"].createElement(SaleRoutingProvider, {
29660
29734
  container: container,