@depay/widgets 12.0.1 → 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.
@@ -21966,7 +21966,28 @@
21966
21966
  className: "Alert"
21967
21967
  }, /*#__PURE__*/React__default["default"].createElement("span", {
21968
21968
  className: "FontWeightBold PaddingBottomXS"
21969
- }, "You wallet extension window is already asking to connect. It might be hidden."))), /*#__PURE__*/React__default["default"].createElement("button", {
21969
+ }, "You wallet extension window is already asking to connect. It might be hidden."))), props.connectingExtension && /*#__PURE__*/React__default["default"].createElement("div", {
21970
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
21971
+ style: {
21972
+ height: '50px'
21973
+ }
21974
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21975
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
21976
+ style: {
21977
+ width: "50px"
21978
+ }
21979
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21980
+ className: "Loading Icon medium",
21981
+ style: {
21982
+ position: 'relative',
21983
+ top: '4px',
21984
+ left: '1px'
21985
+ }
21986
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
21987
+ className: "PaddingLeftS LineHeightXS"
21988
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
21989
+ className: "CardText FontWeightMedium"
21990
+ }, "Connecting extension"))), !props.connectingExtension && /*#__PURE__*/React__default["default"].createElement("button", {
21970
21991
  onClick: function onClick() {
21971
21992
  return props.connectExtension(props.wallet);
21972
21993
  },
@@ -21992,7 +22013,28 @@
21992
22013
  className: "CardText FontWeightMedium"
21993
22014
  }, "Connect extension")))), connectAppIsAvailable && /*#__PURE__*/React__default["default"].createElement("div", {
21994
22015
  className: "PaddingBottomXS"
21995
- }, /*#__PURE__*/React__default["default"].createElement("button", {
22016
+ }, props.connectingApp && /*#__PURE__*/React__default["default"].createElement("div", {
22017
+ className: "Card disabled small PaddingTopS PaddingRightXS PaddingBottomS PaddingLeftXS",
22018
+ style: {
22019
+ height: '50px'
22020
+ }
22021
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22022
+ className: "PaddingTopXS PaddingRightXS PaddingLeftS TextCenter",
22023
+ style: {
22024
+ width: "50px"
22025
+ }
22026
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22027
+ className: "Loading Icon medium",
22028
+ style: {
22029
+ position: 'relative',
22030
+ top: '4px',
22031
+ left: '1px'
22032
+ }
22033
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
22034
+ className: "PaddingLeftS LineHeightXS"
22035
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
22036
+ className: "CardText FontWeightMedium"
22037
+ }, "Connecting app"))), !props.connectingApp && /*#__PURE__*/React__default["default"].createElement("button", {
21996
22038
  onClick: function onClick() {
21997
22039
  return props.connectViaRedirect(props.wallet);
21998
22040
  },
@@ -22585,20 +22627,28 @@
22585
22627
  _useState4 = _slicedToArray(_useState3, 2),
22586
22628
  platform = _useState4[0],
22587
22629
  setPlatform = _useState4[1];
22588
- var _useState5 = React.useState(),
22630
+ var _useState5 = React.useState(false),
22589
22631
  _useState6 = _slicedToArray(_useState5, 2),
22590
- redirectUri = _useState6[0],
22591
- setRedirectUri = _useState6[1];
22592
- var _useState7 = React.useState({
22632
+ connectingExtension = _useState6[0],
22633
+ setConnectingExtension = _useState6[1];
22634
+ var _useState7 = React.useState(false),
22635
+ _useState8 = _slicedToArray(_useState7, 2);
22636
+ _useState8[0];
22637
+ var setConnectingApp = _useState8[1];
22638
+ var _useState9 = React.useState(),
22639
+ _useState10 = _slicedToArray(_useState9, 2),
22640
+ redirectUri = _useState10[0],
22641
+ setRedirectUri = _useState10[1];
22642
+ var _useState11 = React.useState({
22593
22643
  blockchain: undefined
22594
22644
  }),
22595
- _useState8 = _slicedToArray(_useState7, 2),
22596
- selection = _useState8[0];
22597
- _useState8[1];
22598
- var _useState9 = React.useState(false),
22599
- _useState10 = _slicedToArray(_useState9, 2),
22600
- showConnectExtensionWarning = _useState10[0],
22601
- setShowConnectExtensionWarning = _useState10[1];
22645
+ _useState12 = _slicedToArray(_useState11, 2),
22646
+ selection = _useState12[0];
22647
+ _useState12[1];
22648
+ var _useState13 = React.useState(false),
22649
+ _useState14 = _slicedToArray(_useState13, 2),
22650
+ showConnectExtensionWarning = _useState14[0],
22651
+ setShowConnectExtensionWarning = _useState14[1];
22602
22652
  var resolve = function resolve(account, wallet) {
22603
22653
  if (account && wallet) {
22604
22654
  var walletMeta = allWallets.find(function (walletMeta) {
@@ -22616,10 +22666,18 @@
22616
22666
  };
22617
22667
  var connectExtension = function connectExtension(wallet) {
22618
22668
  setShowConnectExtensionWarning(false);
22669
+ setConnectingExtension(true);
22619
22670
  wallet = new web3WalletsSolana.wallets[wallet.extension]();
22671
+ var resetConnectingTimeout = setTimeout(function () {
22672
+ setConnectingExtension(false);
22673
+ }, 5000);
22620
22674
  wallet.connect().then(function (account) {
22621
22675
  resolve(account, wallet);
22676
+ setConnectingExtension(false);
22677
+ clearTimeout(resetConnectingTimeout);
22622
22678
  })["catch"](function (error) {
22679
+ setConnectingExtension(false);
22680
+ clearTimeout(resetConnectingTimeout);
22623
22681
  if ((error === null || error === void 0 ? void 0 : error.code) == -32002) {
22624
22682
  // Request of type 'wallet_requestPermissions' already pending...
22625
22683
  setShowConnectExtensionWarning(true);
@@ -22696,6 +22754,10 @@
22696
22754
  if (!platform) {
22697
22755
  return;
22698
22756
  }
22757
+ setConnectingApp(true);
22758
+ setTimeout(function () {
22759
+ setConnectingApp(false);
22760
+ }, 5000);
22699
22761
  if (['WalletConnectV1', 'WalletConnectV2'].includes(platform.connect)) {
22700
22762
  localStorage[atob('ZGVwYXk6d2FsbGV0czp3YzI6cHJvamVjdElk')] = atob('YjFmYzJmMDZlYTIxMDdmY2Q5OWM2OGY0MTI3MTQxYWI=');
22701
22763
  var _wallet = new web3WalletsSolana.wallets[platform.connect]();
@@ -22720,7 +22782,10 @@
22720
22782
  });
22721
22783
  }
22722
22784
  }).then(function (account) {
22785
+ setConnectingApp(false);
22723
22786
  resolve(account, _wallet);
22787
+ })["catch"](function () {
22788
+ setConnectingApp(false);
22724
22789
  });
22725
22790
  } else if (platform.connect === 'SolanaMobileWalletAdapter') {
22726
22791
  var _wallet2 = new web3WalletsSolana.wallets[platform.connect]();
@@ -22728,7 +22793,10 @@
22728
22793
  name: walletMetaData.name,
22729
22794
  logo: walletMetaData.logo
22730
22795
  }).then(function (account) {
22796
+ setConnectingApp(false);
22731
22797
  resolve(account, _wallet2);
22798
+ })["catch"](function () {
22799
+ setConnectingApp(false);
22732
22800
  });
22733
22801
  }
22734
22802
  };
@@ -22771,6 +22839,7 @@
22771
22839
  openInApp: openInApp,
22772
22840
  connectViaRedirect: connectViaRedirect,
22773
22841
  connectExtension: connectExtension,
22842
+ connectingExtension: connectingExtension,
22774
22843
  showConnectExtensionWarning: showConnectExtensionWarning,
22775
22844
  continueWithSolanaPay: props.continueWithSolanaPay
22776
22845
  })
@@ -23171,7 +23240,7 @@
23171
23240
  });
23172
23241
 
23173
23242
  var IconStyle = (function (style) {
23174
- 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 ");
23175
23244
  });
23176
23245
 
23177
23246
  var ImageStyle = (function (style) {
@@ -23467,17 +23536,6 @@
23467
23536
  }, props.children);
23468
23537
  });
23469
23538
 
23470
- let crypto;
23471
- let atob$1;
23472
-
23473
- if (typeof window === 'undefined') { // running in Node.js
23474
- crypto = new (require("@peculiar/webcrypto").Crypto)();
23475
- atob$1 = require('atob');
23476
- } else {
23477
- crypto = window.crypto;
23478
- atob$1 = window.atob;
23479
- }
23480
-
23481
23539
  const string2ArrayBuffer = (str)=> {
23482
23540
  const buf = new ArrayBuffer(str.length);
23483
23541
  const bufView = new Uint8Array(buf);
@@ -23487,9 +23545,9 @@
23487
23545
  return buf
23488
23546
  };
23489
23547
 
23490
- const base64ToArrayBuffer = (b64)=> {
23548
+ const base64ToArrayBuffer = (b64, atob)=> {
23491
23549
  const safeB64 = b64.replace(/-/g, '+').replace(/_/g, '/');
23492
- const byteString = atob$1(safeB64);
23550
+ const byteString = atob(safeB64);
23493
23551
  let byteArray = new Uint8Array(byteString.length);
23494
23552
  for(let i=0; i < byteString.length; i++) {
23495
23553
  byteArray[i] = byteString.charCodeAt(i);
@@ -23497,17 +23555,24 @@
23497
23555
  return byteArray
23498
23556
  };
23499
23557
 
23500
- const verify = async ({ signature, publicKey, data, saltLength = 64 })=>{
23558
+ var internalVerify = async ({ signature, publicKey, data, saltLength = 64, crypto, atob })=>{
23501
23559
 
23502
23560
  let innerPublicKey = publicKey.replace(/^.*?-----BEGIN PUBLIC KEY-----\n/, '').replace(/-----END PUBLIC KEY-----(\n)*$/, '').replace(/(\n)*/g, '');
23503
23561
  while (innerPublicKey.length % 4) { // add proper padding
23504
23562
  innerPublicKey += '=';
23505
23563
  }
23506
- const binaryString = atob$1(innerPublicKey);
23564
+ const binaryString = atob(innerPublicKey);
23507
23565
  const binaryStringArrayBuffer = string2ArrayBuffer(binaryString);
23508
23566
  const cryptoKey = await crypto.subtle.importKey("spki", binaryStringArrayBuffer, { name: "RSA-PSS", hash: "SHA-256" }, true, ["verify"]);
23509
23567
 
23510
- return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature), string2ArrayBuffer(data))
23568
+ return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature, atob), string2ArrayBuffer(data))
23569
+ };
23570
+
23571
+ const crypto = window.crypto;
23572
+ const atob$1 = window.atob;
23573
+
23574
+ const verify = ({ signature, publicKey, data, saltLength = 64 })=>{
23575
+ return internalVerify({ signature, publicKey, data, saltLength, crypto, atob: atob$1 })
23511
23576
  };
23512
23577
 
23513
23578
  function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -24201,22 +24266,26 @@
24201
24266
  });
24202
24267
  };
24203
24268
  var _useContext = React.useContext(ConfigurationContext),
24204
- accept = _useContext.accept,
24205
24269
  configuredAmount = _useContext.amount;
24206
24270
  _useContext.toAmount;
24207
24271
  var recover = _useContext.recover;
24272
+ var _useContext2 = React.useContext(ConfigurationContext),
24273
+ accept = _useContext2.accept;
24274
+ if (!accept) {
24275
+ accept = props.accept;
24276
+ }
24208
24277
  React.useContext(ConfigurationContext);
24209
24278
  var _useState = React.useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24210
24279
  _useState2 = _slicedToArray(_useState, 2),
24211
24280
  amountsMissing = _useState2[0],
24212
24281
  setAmountsMissing = _useState2[1];
24213
- var _useContext2 = React.useContext(WalletContext),
24214
- account = _useContext2.account;
24215
- var _useContext3 = React.useContext(ConversionRateContext),
24216
- conversionRate = _useContext3.conversionRate,
24217
- fixedCurrencyConversionRate = _useContext3.fixedCurrencyConversionRate;
24218
- var _useContext4 = React.useContext(ErrorContext),
24219
- setError = _useContext4.setError;
24282
+ var _useContext3 = React.useContext(WalletContext),
24283
+ account = _useContext3.account;
24284
+ var _useContext4 = React.useContext(ConversionRateContext),
24285
+ conversionRate = _useContext4.conversionRate,
24286
+ fixedCurrencyConversionRate = _useContext4.fixedCurrencyConversionRate;
24287
+ var _useContext5 = React.useContext(ErrorContext),
24288
+ setError = _useContext5.setError;
24220
24289
  var _useState3 = React.useState(),
24221
24290
  _useState4 = _slicedToArray(_useState3, 2),
24222
24291
  acceptWithAmount = _useState4[0],