@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.
@@ -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) {
@@ -23466,17 +23535,6 @@
23466
23535
  }, props.children);
23467
23536
  });
23468
23537
 
23469
- let crypto;
23470
- let atob$1;
23471
-
23472
- if (typeof window === 'undefined') { // running in Node.js
23473
- crypto = new (require("@peculiar/webcrypto").Crypto)();
23474
- atob$1 = require('atob');
23475
- } else {
23476
- crypto = window.crypto;
23477
- atob$1 = window.atob;
23478
- }
23479
-
23480
23538
  const string2ArrayBuffer = (str)=> {
23481
23539
  const buf = new ArrayBuffer(str.length);
23482
23540
  const bufView = new Uint8Array(buf);
@@ -23486,9 +23544,9 @@
23486
23544
  return buf
23487
23545
  };
23488
23546
 
23489
- const base64ToArrayBuffer = (b64)=> {
23547
+ const base64ToArrayBuffer = (b64, atob)=> {
23490
23548
  const safeB64 = b64.replace(/-/g, '+').replace(/_/g, '/');
23491
- const byteString = atob$1(safeB64);
23549
+ const byteString = atob(safeB64);
23492
23550
  let byteArray = new Uint8Array(byteString.length);
23493
23551
  for(let i=0; i < byteString.length; i++) {
23494
23552
  byteArray[i] = byteString.charCodeAt(i);
@@ -23496,17 +23554,24 @@
23496
23554
  return byteArray
23497
23555
  };
23498
23556
 
23499
- const verify = async ({ signature, publicKey, data, saltLength = 64 })=>{
23557
+ var internalVerify = async ({ signature, publicKey, data, saltLength = 64, crypto, atob })=>{
23500
23558
 
23501
23559
  let innerPublicKey = publicKey.replace(/^.*?-----BEGIN PUBLIC KEY-----\n/, '').replace(/-----END PUBLIC KEY-----(\n)*$/, '').replace(/(\n)*/g, '');
23502
23560
  while (innerPublicKey.length % 4) { // add proper padding
23503
23561
  innerPublicKey += '=';
23504
23562
  }
23505
- const binaryString = atob$1(innerPublicKey);
23563
+ const binaryString = atob(innerPublicKey);
23506
23564
  const binaryStringArrayBuffer = string2ArrayBuffer(binaryString);
23507
23565
  const cryptoKey = await crypto.subtle.importKey("spki", binaryStringArrayBuffer, { name: "RSA-PSS", hash: "SHA-256" }, true, ["verify"]);
23508
23566
 
23509
- return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature), string2ArrayBuffer(data))
23567
+ return await crypto.subtle.verify({ name: "RSA-PSS", saltLength }, cryptoKey, base64ToArrayBuffer(signature, atob), string2ArrayBuffer(data))
23568
+ };
23569
+
23570
+ const crypto = window.crypto;
23571
+ const atob$1 = window.atob;
23572
+
23573
+ const verify = ({ signature, publicKey, data, saltLength = 64 })=>{
23574
+ return internalVerify({ signature, publicKey, data, saltLength, crypto, atob: atob$1 })
23510
23575
  };
23511
23576
 
23512
23577
  function ownKeys$5(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; }
@@ -24200,22 +24265,26 @@
24200
24265
  });
24201
24266
  };
24202
24267
  var _useContext = React.useContext(ConfigurationContext),
24203
- accept = _useContext.accept,
24204
24268
  configuredAmount = _useContext.amount;
24205
24269
  _useContext.toAmount;
24206
24270
  var recover = _useContext.recover;
24271
+ var _useContext2 = React.useContext(ConfigurationContext),
24272
+ accept = _useContext2.accept;
24273
+ if (!accept) {
24274
+ accept = props.accept;
24275
+ }
24207
24276
  React.useContext(ConfigurationContext);
24208
24277
  var _useState = React.useState(recover == undefined ? configurationsMissAmounts(accept) : false),
24209
24278
  _useState2 = _slicedToArray(_useState, 2),
24210
24279
  amountsMissing = _useState2[0],
24211
24280
  setAmountsMissing = _useState2[1];
24212
- var _useContext2 = React.useContext(WalletContext),
24213
- account = _useContext2.account;
24214
- var _useContext3 = React.useContext(ConversionRateContext),
24215
- conversionRate = _useContext3.conversionRate,
24216
- fixedCurrencyConversionRate = _useContext3.fixedCurrencyConversionRate;
24217
- var _useContext4 = React.useContext(ErrorContext),
24218
- 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;
24219
24288
  var _useState3 = React.useState(),
24220
24289
  _useState4 = _slicedToArray(_useState3, 2),
24221
24290
  acceptWithAmount = _useState4[0],