@depay/widgets 12.0.2 → 12.0.3

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
@@ -21969,7 +21969,28 @@ var ConnectWalletDialog = (function (props) {
21969
21969
  className: "Alert"
21970
21970
  }, /*#__PURE__*/React.createElement("span", {
21971
21971
  className: "FontWeightBold PaddingBottomXS"
21972
- }, "You wallet extension window is already asking to connect. It might be hidden."))), /*#__PURE__*/React.createElement("button", {
21972
+ }, "You wallet extension window is already asking to connect. It might be hidden."))), props.connectingExtension && /*#__PURE__*/React.createElement("div", {
21973
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
21974
+ style: {
21975
+ height: '50px'
21976
+ }
21977
+ }, /*#__PURE__*/React.createElement("div", {
21978
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
21979
+ style: {
21980
+ width: "50px"
21981
+ }
21982
+ }, /*#__PURE__*/React.createElement("div", {
21983
+ className: "Loading Icon medium",
21984
+ style: {
21985
+ position: 'relative',
21986
+ top: '4px',
21987
+ left: '1px'
21988
+ }
21989
+ })), /*#__PURE__*/React.createElement("div", {
21990
+ className: "PaddingLeftS LineHeightXS"
21991
+ }, /*#__PURE__*/React.createElement("div", {
21992
+ className: "CardText FontWeightMedium"
21993
+ }, "Connecting extension"))), !props.connectingExtension && /*#__PURE__*/React.createElement("button", {
21973
21994
  onClick: function onClick() {
21974
21995
  return props.connectExtension(props.wallet);
21975
21996
  },
@@ -21995,7 +22016,28 @@ var ConnectWalletDialog = (function (props) {
21995
22016
  className: "CardText FontWeightMedium"
21996
22017
  }, "Connect extension")))), connectAppIsAvailable && /*#__PURE__*/React.createElement("div", {
21997
22018
  className: "PaddingBottomXS"
21998
- }, /*#__PURE__*/React.createElement("button", {
22019
+ }, props.connectingApp && /*#__PURE__*/React.createElement("div", {
22020
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
22021
+ style: {
22022
+ height: '50px'
22023
+ }
22024
+ }, /*#__PURE__*/React.createElement("div", {
22025
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
22026
+ style: {
22027
+ width: "50px"
22028
+ }
22029
+ }, /*#__PURE__*/React.createElement("div", {
22030
+ className: "Loading Icon medium",
22031
+ style: {
22032
+ position: 'relative',
22033
+ top: '4px',
22034
+ left: '1px'
22035
+ }
22036
+ })), /*#__PURE__*/React.createElement("div", {
22037
+ className: "PaddingLeftS LineHeightXS"
22038
+ }, /*#__PURE__*/React.createElement("div", {
22039
+ className: "CardText FontWeightMedium"
22040
+ }, "Connecting app"))), !props.connectingApp && /*#__PURE__*/React.createElement("button", {
21999
22041
  onClick: function onClick() {
22000
22042
  return props.connectViaRedirect(props.wallet);
22001
22043
  },
@@ -22588,20 +22630,28 @@ var ConnectStack = (function (props) {
22588
22630
  _useState4 = _slicedToArray(_useState3, 2),
22589
22631
  platform = _useState4[0],
22590
22632
  setPlatform = _useState4[1];
22591
- var _useState5 = useState(),
22633
+ var _useState5 = useState(false),
22592
22634
  _useState6 = _slicedToArray(_useState5, 2),
22593
- redirectUri = _useState6[0],
22594
- setRedirectUri = _useState6[1];
22595
- var _useState7 = useState({
22635
+ connectingExtension = _useState6[0],
22636
+ setConnectingExtension = _useState6[1];
22637
+ var _useState7 = useState(false),
22638
+ _useState8 = _slicedToArray(_useState7, 2);
22639
+ _useState8[0];
22640
+ var setConnectingApp = _useState8[1];
22641
+ var _useState9 = useState(),
22642
+ _useState10 = _slicedToArray(_useState9, 2),
22643
+ redirectUri = _useState10[0],
22644
+ setRedirectUri = _useState10[1];
22645
+ var _useState11 = useState({
22596
22646
  blockchain: undefined
22597
22647
  }),
22598
- _useState8 = _slicedToArray(_useState7, 2),
22599
- selection = _useState8[0];
22600
- _useState8[1];
22601
- var _useState9 = useState(false),
22602
- _useState10 = _slicedToArray(_useState9, 2),
22603
- showConnectExtensionWarning = _useState10[0],
22604
- setShowConnectExtensionWarning = _useState10[1];
22648
+ _useState12 = _slicedToArray(_useState11, 2),
22649
+ selection = _useState12[0];
22650
+ _useState12[1];
22651
+ var _useState13 = useState(false),
22652
+ _useState14 = _slicedToArray(_useState13, 2),
22653
+ showConnectExtensionWarning = _useState14[0],
22654
+ setShowConnectExtensionWarning = _useState14[1];
22605
22655
  var resolve = function resolve(account, wallet) {
22606
22656
  if (account && wallet) {
22607
22657
  var walletMeta = allWallets.find(function (walletMeta) {
@@ -22619,10 +22669,18 @@ var ConnectStack = (function (props) {
22619
22669
  };
22620
22670
  var connectExtension = function connectExtension(wallet) {
22621
22671
  setShowConnectExtensionWarning(false);
22672
+ setConnectingExtension(true);
22622
22673
  wallet = new wallets[wallet.extension]();
22674
+ var resetConnectingTimeout = setTimeout(function () {
22675
+ setConnectingExtension(false);
22676
+ }, 5000);
22623
22677
  wallet.connect().then(function (account) {
22624
22678
  resolve(account, wallet);
22679
+ setConnectingExtension(false);
22680
+ clearTimeout(resetConnectingTimeout);
22625
22681
  })["catch"](function (error) {
22682
+ setConnectingExtension(false);
22683
+ clearTimeout(resetConnectingTimeout);
22626
22684
  if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
22627
22685
  // Request of type 'wallet_requestPermissions' already pending...
22628
22686
  setShowConnectExtensionWarning(true);
@@ -22699,6 +22757,10 @@ var ConnectStack = (function (props) {
22699
22757
  if (!platform) {
22700
22758
  return;
22701
22759
  }
22760
+ setConnectingApp(true);
22761
+ setTimeout(function () {
22762
+ setConnectingApp(false);
22763
+ }, 5000);
22702
22764
  if (['WalletConnectV1', 'WalletConnectV2'].includes(platform.connect)) {
22703
22765
  localStorage[atob('ZGVwYXk6d2FsbGV0czp3YzI6cHJvamVjdElk')] = atob('YjFmYzJmMDZlYTIxMDdmY2Q5OWM2OGY0MTI3MTQxYWI=');
22704
22766
  var _wallet = new wallets[platform.connect]();
@@ -22723,7 +22785,10 @@ var ConnectStack = (function (props) {
22723
22785
  });
22724
22786
  }
22725
22787
  }).then(function (account) {
22788
+ setConnectingApp(false);
22726
22789
  resolve(account, _wallet);
22790
+ })["catch"](function () {
22791
+ setConnectingApp(false);
22727
22792
  });
22728
22793
  } else if (platform.connect === 'SolanaMobileWalletAdapter') {
22729
22794
  var _wallet2 = new wallets[platform.connect]();
@@ -22731,7 +22796,10 @@ var ConnectStack = (function (props) {
22731
22796
  name: walletMetaData.name,
22732
22797
  logo: walletMetaData.logo
22733
22798
  }).then(function (account) {
22799
+ setConnectingApp(false);
22734
22800
  resolve(account, _wallet2);
22801
+ })["catch"](function () {
22802
+ setConnectingApp(false);
22735
22803
  });
22736
22804
  }
22737
22805
  };
@@ -22774,6 +22842,7 @@ var ConnectStack = (function (props) {
22774
22842
  openInApp: openInApp,
22775
22843
  connectViaRedirect: connectViaRedirect,
22776
22844
  connectExtension: connectExtension,
22845
+ connectingExtension: connectingExtension,
22777
22846
  showConnectExtensionWarning: showConnectExtensionWarning,
22778
22847
  continueWithSolanaPay: props.continueWithSolanaPay
22779
22848
  })
@@ -23174,7 +23243,7 @@ var HeightStyle = (function () {
23174
23243
  });
23175
23244
 
23176
23245
  var IconStyle = (function (style) {
23177
- 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 ");
23178
23247
  });
23179
23248
 
23180
23249
  var ImageStyle = (function (style) {
@@ -24161,22 +24230,26 @@ var ChangableAmountProvider = (function (props) {
24161
24230
  });
24162
24231
  };
24163
24232
  var _useContext = useContext(ConfigurationContext),
24164
- accept = _useContext.accept,
24165
24233
  configuredAmount = _useContext.amount;
24166
24234
  _useContext.toAmount;
24167
24235
  var recover = _useContext.recover;
24236
+ var _useContext2 = useContext(ConfigurationContext),
24237
+ accept = _useContext2.accept;
24238
+ if (!accept) {
24239
+ accept = props.accept;
24240
+ }
24168
24241
  useContext(ConfigurationContext);
24169
24242
  var _useState = useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24170
24243
  _useState2 = _slicedToArray(_useState, 2),
24171
24244
  amountsMissing = _useState2[0],
24172
24245
  setAmountsMissing = _useState2[1];
24173
- var _useContext2 = useContext(WalletContext),
24174
- account = _useContext2.account;
24175
- var _useContext3 = useContext(ConversionRateContext),
24176
- conversionRate = _useContext3.conversionRate,
24177
- fixedCurrencyConversionRate = _useContext3.fixedCurrencyConversionRate;
24178
- var _useContext4 = useContext(ErrorContext),
24179
- setError = _useContext4.setError;
24246
+ var _useContext3 = useContext(WalletContext),
24247
+ account = _useContext3.account;
24248
+ var _useContext4 = useContext(ConversionRateContext),
24249
+ conversionRate = _useContext4.conversionRate,
24250
+ fixedCurrencyConversionRate = _useContext4.fixedCurrencyConversionRate;
24251
+ var _useContext5 = useContext(ErrorContext),
24252
+ setError = _useContext5.setError;
24180
24253
  var _useState3 = useState(),
24181
24254
  _useState4 = _slicedToArray(_useState3, 2),
24182
24255
  acceptWithAmount = _useState4[0],