@tonconnect/ui 2.4.0-beta.1 → 2.4.0-beta.2

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/lib/index.cjs CHANGED
@@ -6315,8 +6315,12 @@ const FourWalletsItem = (props) => {
6315
6315
  const AT_WALLET_APP_NAME = "telegram-wallet";
6316
6316
  const IMG = {
6317
6317
  TON: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/ton-icon-48.png",
6318
- TG: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png"
6318
+ TG: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/tg.png",
6319
+ WALLET_CONNECT: "https://raw.githubusercontent.com/ton-connect/sdk/main/assets/walletconnect-icon-288.png"
6319
6320
  };
6321
+ function isWalletUi(wallet) {
6322
+ return !("type" in wallet) || wallet.type !== "wallet-connect";
6323
+ }
6320
6324
  const WalletLabeledItem = (props) => {
6321
6325
  const [t2] = useI18n();
6322
6326
  const walletsSecondLine = () => {
@@ -6326,12 +6330,12 @@ const WalletLabeledItem = (props) => {
6326
6330
  if ("isPreferred" in props.wallet && props.wallet.isPreferred) {
6327
6331
  return t2("walletItem.recent", {}, "Recent");
6328
6332
  }
6329
- if (sdk.isWalletInfoCurrentlyInjected(props.wallet)) {
6330
- return t2("walletItem.installed", {}, "Installed");
6331
- }
6332
6333
  if (props.wallet.name === "Tonkeeper") {
6333
6334
  return t2("walletItem.popular", {}, "Popular");
6334
6335
  }
6336
+ if (isWalletUi(props.wallet) && sdk.isWalletInfoCurrentlyInjected(props.wallet)) {
6337
+ return t2("walletItem.installed", {}, "Installed");
6338
+ }
6335
6339
  return void 0;
6336
6340
  };
6337
6341
  return memo(() => memo(() => props.wallet.appName === AT_WALLET_APP_NAME)() ? createComponent(WalletItem, {
@@ -8721,9 +8725,19 @@ const ExclamationIcon = (props) => {
8721
8725
  return _el$9;
8722
8726
  })() : null);
8723
8727
  };
8728
+ const WALLET_CONNECT_APP_NAME = "wallet_connect";
8729
+ const WALLET_CONNECT_WALLET_NAME = "WalletConnect";
8730
+ const WALLET_CONNECT_ABOUT_URL = "https://reown.com/";
8724
8731
  var _tmpl$$2 = /* @__PURE__ */ template$1(`<li>`);
8725
8732
  const AllWalletsListModal = (props) => {
8726
8733
  const maxHeight = () => isMobile() ? void 0 : 510;
8734
+ const connector = appState.connector;
8735
+ const additionalRequest = appState.connectRequestParameters;
8736
+ const connectWalletConnect = () => {
8737
+ connector.connect({
8738
+ type: "wallet-connect"
8739
+ }, (additionalRequest == null ? void 0 : additionalRequest.state) === "ready" ? additionalRequest.value : void 0);
8740
+ };
8727
8741
  const [errorSupportOpened, setErrorSupportOpened] = createSignal(null);
8728
8742
  let timeoutId = null;
8729
8743
  const onErrorClick = (wallet) => {
@@ -8763,7 +8777,7 @@ const AllWalletsListModal = (props) => {
8763
8777
  get children() {
8764
8778
  return [createComponent(WalletsUl, {
8765
8779
  get children() {
8766
- return createComponent(For, {
8780
+ return [createComponent(For, {
8767
8781
  get each() {
8768
8782
  return supportedWallets();
8769
8783
  },
@@ -8775,7 +8789,24 @@ const AllWalletsListModal = (props) => {
8775
8789
  }));
8776
8790
  return _el$;
8777
8791
  })()
8778
- });
8792
+ }), createComponent(Show, {
8793
+ get when() {
8794
+ return memo(() => !!!isInTMA())() && sdk.isWalletConnectInitialized();
8795
+ },
8796
+ get children() {
8797
+ return createComponent(WalletLabeledItemStyled, {
8798
+ get wallet() {
8799
+ return {
8800
+ type: "wallet-connect",
8801
+ name: WALLET_CONNECT_WALLET_NAME,
8802
+ appName: WALLET_CONNECT_APP_NAME,
8803
+ imageUrl: IMG.WALLET_CONNECT
8804
+ };
8805
+ },
8806
+ onClick: connectWalletConnect
8807
+ });
8808
+ }
8809
+ })];
8779
8810
  }
8780
8811
  }), createComponent(Show, {
8781
8812
  get when() {
@@ -12741,7 +12772,7 @@ class TonConnectUITracker {
12741
12772
  }
12742
12773
  }
12743
12774
  }
12744
- const tonConnectUiVersion = "2.4.0-beta.1";
12775
+ const tonConnectUiVersion = "2.4.0-beta.2";
12745
12776
  class TonConnectEnvironment {
12746
12777
  constructor() {
12747
12778
  this.userAgent = getUserAgent();
@@ -13573,8 +13604,18 @@ class TonConnectUI {
13573
13604
  if (!lastSelectedWalletInfo2) {
13574
13605
  return null;
13575
13606
  }
13576
- let fullLastSelectedWalletInfo;
13577
13607
  if (!("name" in lastSelectedWalletInfo2)) {
13608
+ if (wallet.device.appName === WALLET_CONNECT_APP_NAME) {
13609
+ return {
13610
+ type: "wallet-connect",
13611
+ name: WALLET_CONNECT_WALLET_NAME,
13612
+ appName: WALLET_CONNECT_APP_NAME,
13613
+ imageUrl: IMG.WALLET_CONNECT,
13614
+ aboutUrl: WALLET_CONNECT_ABOUT_URL,
13615
+ features: wallet.device.features,
13616
+ platforms: []
13617
+ };
13618
+ }
13578
13619
  const walletsList = applyWalletsListConfiguration(
13579
13620
  yield this.walletsList,
13580
13621
  appState.walletsListConfiguration
@@ -13585,11 +13626,9 @@ class TonConnectUI {
13585
13626
  `Cannot find WalletInfo for the '${wallet.device.appName}' wallet`
13586
13627
  );
13587
13628
  }
13588
- fullLastSelectedWalletInfo = __spreadValues(__spreadValues({}, walletInfo), lastSelectedWalletInfo2);
13589
- } else {
13590
- fullLastSelectedWalletInfo = lastSelectedWalletInfo2;
13629
+ return __spreadValues(__spreadValues({}, walletInfo), lastSelectedWalletInfo2);
13591
13630
  }
13592
- return fullLastSelectedWalletInfo;
13631
+ return lastSelectedWalletInfo2;
13593
13632
  });
13594
13633
  }
13595
13634
  updateWalletInfo(wallet) {