@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.
@@ -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({
22631
+ connectingExtension = _useState6[0],
22632
+ setConnectingExtension = _useState6[1];
22633
+ var _useState7 = React.useState(false),
22634
+ _useState8 = _slicedToArray(_useState7, 2);
22635
+ _useState8[0];
22636
+ var setConnectingApp = _useState8[1];
22637
+ var _useState9 = React.useState(),
22638
+ _useState10 = _slicedToArray(_useState9, 2),
22639
+ redirectUri = _useState10[0],
22640
+ setRedirectUri = _useState10[1];
22641
+ var _useState11 = React.useState({
22592
22642
  blockchain: undefined
22593
22643
  }),
22594
- _useState8 = _slicedToArray(_useState7, 2),
22595
- selection = _useState8[0];
22596
- _useState8[1];
22597
- var _useState9 = React.useState(false),
22598
- _useState10 = _slicedToArray(_useState9, 2),
22599
- showConnectExtensionWarning = _useState10[0],
22600
- setShowConnectExtensionWarning = _useState10[1];
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 web3WalletsEvm.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 web3WalletsEvm.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 web3WalletsEvm.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,7 @@
22770
22838
  openInApp: openInApp,
22771
22839
  connectViaRedirect: connectViaRedirect,
22772
22840
  connectExtension: connectExtension,
22841
+ connectingExtension: connectingExtension,
22773
22842
  showConnectExtensionWarning: showConnectExtensionWarning,
22774
22843
  continueWithSolanaPay: props.continueWithSolanaPay
22775
22844
  })
@@ -23170,7 +23239,7 @@
23170
23239
  });
23171
23240
 
23172
23241
  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 ");
23242
+ 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
23243
  });
23175
23244
 
23176
23245
  var ImageStyle = (function (style) {
@@ -24196,22 +24265,26 @@
24196
24265
  });
24197
24266
  };
24198
24267
  var _useContext = React.useContext(ConfigurationContext),
24199
- accept = _useContext.accept,
24200
24268
  configuredAmount = _useContext.amount;
24201
24269
  _useContext.toAmount;
24202
24270
  var recover = _useContext.recover;
24271
+ var _useContext2 = React.useContext(ConfigurationContext),
24272
+ accept = _useContext2.accept;
24273
+ if (!accept) {
24274
+ accept = props.accept;
24275
+ }
24203
24276
  React.useContext(ConfigurationContext);
24204
24277
  var _useState = React.useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24205
24278
  _useState2 = _slicedToArray(_useState, 2),
24206
24279
  amountsMissing = _useState2[0],
24207
24280
  setAmountsMissing = _useState2[1];
24208
- var _useContext2 = React.useContext(WalletContext),
24209
- account = _useContext2.account;
24210
- var _useContext3 = React.useContext(ConversionRateContext),
24211
- conversionRate = _useContext3.conversionRate,
24212
- fixedCurrencyConversionRate = _useContext3.fixedCurrencyConversionRate;
24213
- var _useContext4 = React.useContext(ErrorContext),
24214
- setError = _useContext4.setError;
24281
+ var _useContext3 = React.useContext(WalletContext),
24282
+ account = _useContext3.account;
24283
+ var _useContext4 = React.useContext(ConversionRateContext),
24284
+ conversionRate = _useContext4.conversionRate,
24285
+ fixedCurrencyConversionRate = _useContext4.fixedCurrencyConversionRate;
24286
+ var _useContext5 = React.useContext(ErrorContext),
24287
+ setError = _useContext5.setError;
24215
24288
  var _useState3 = React.useState(),
24216
24289
  _useState4 = _slicedToArray(_useState3, 2),
24217
24290
  acceptWithAmount = _useState4[0],