@tonconnect/ui 2.0.8 → 2.0.9-beta.0

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.mjs CHANGED
@@ -2693,6 +2693,11 @@ function isInTMA() {
2693
2693
  var _a2;
2694
2694
  return tmaPlatform !== "unknown" || !!((_a2 = getWindow$1()) == null ? void 0 : _a2.TelegramWebviewProxy);
2695
2695
  }
2696
+ function isInTelegramBrowser() {
2697
+ var _a2;
2698
+ const isTelegramWebview = !!((_a2 = getWindow$1()) == null ? void 0 : _a2.TelegramWebview);
2699
+ return (isInTMA() || isTelegramWebview) && tmaPlatform === "unknown";
2700
+ }
2696
2701
  function sendExpand() {
2697
2702
  postEvent("web_app_expand", {});
2698
2703
  }
@@ -8355,7 +8360,12 @@ function redirectToTelegram(universalLink, options) {
8355
8360
  if (!directLinkUrl.searchParams.has("startapp")) {
8356
8361
  directLinkUrl.searchParams.append("startapp", "tonconnect");
8357
8362
  }
8358
- if (isInTMA()) {
8363
+ if (isInTelegramBrowser()) {
8364
+ options.returnStrategy = "back";
8365
+ options.twaReturnUrl = void 0;
8366
+ const linkWitStrategy = addReturnStrategy(directLinkUrl.toString(), options);
8367
+ openLinkBlank(linkWitStrategy);
8368
+ } else if (isInTMA()) {
8359
8369
  if (isTmaPlatform("ios", "android", "macos")) {
8360
8370
  options.returnStrategy = "back";
8361
8371
  options.twaReturnUrl = void 0;
@@ -8470,7 +8480,19 @@ function redirectToTelegram(universalLink, options) {
8470
8480
  }
8471
8481
  function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8472
8482
  options = __spreadValues({}, options);
8473
- if (isInTMA()) {
8483
+ if (isInTelegramBrowser()) {
8484
+ if (isOS("ios", "android")) {
8485
+ if (options.returnStrategy === "back") {
8486
+ options.returnStrategy = "tg://resolve";
8487
+ }
8488
+ setOpenMethod("universal-link");
8489
+ openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
8490
+ } else {
8491
+ setOpenMethod("universal-link");
8492
+ const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
8493
+ openLinkBlank(linkWitStrategy);
8494
+ }
8495
+ } else if (isInTMA()) {
8474
8496
  if (isTmaPlatform("ios", "android")) {
8475
8497
  if (options.returnStrategy === "back") {
8476
8498
  options.returnStrategy = "tg://resolve";
@@ -10938,7 +10960,7 @@ class TonConnectUITracker {
10938
10960
  }
10939
10961
  }
10940
10962
  }
10941
- const tonConnectUiVersion = "2.0.8";
10963
+ const tonConnectUiVersion = "2.0.9-beta.0";
10942
10964
  class TonConnectUI {
10943
10965
  constructor(options) {
10944
10966
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());