@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.cjs CHANGED
@@ -2698,6 +2698,11 @@ function isInTMA() {
2698
2698
  var _a2;
2699
2699
  return tmaPlatform !== "unknown" || !!((_a2 = getWindow$1()) == null ? void 0 : _a2.TelegramWebviewProxy);
2700
2700
  }
2701
+ function isInTelegramBrowser() {
2702
+ var _a2;
2703
+ const isTelegramWebview = !!((_a2 = getWindow$1()) == null ? void 0 : _a2.TelegramWebview);
2704
+ return (isInTMA() || isTelegramWebview) && tmaPlatform === "unknown";
2705
+ }
2701
2706
  function sendExpand() {
2702
2707
  postEvent("web_app_expand", {});
2703
2708
  }
@@ -8360,7 +8365,12 @@ function redirectToTelegram(universalLink, options) {
8360
8365
  if (!directLinkUrl.searchParams.has("startapp")) {
8361
8366
  directLinkUrl.searchParams.append("startapp", "tonconnect");
8362
8367
  }
8363
- if (isInTMA()) {
8368
+ if (isInTelegramBrowser()) {
8369
+ options.returnStrategy = "back";
8370
+ options.twaReturnUrl = void 0;
8371
+ const linkWitStrategy = addReturnStrategy(directLinkUrl.toString(), options);
8372
+ openLinkBlank(linkWitStrategy);
8373
+ } else if (isInTMA()) {
8364
8374
  if (isTmaPlatform("ios", "android", "macos")) {
8365
8375
  options.returnStrategy = "back";
8366
8376
  options.twaReturnUrl = void 0;
@@ -8475,7 +8485,19 @@ function redirectToTelegram(universalLink, options) {
8475
8485
  }
8476
8486
  function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
8477
8487
  options = __spreadValues({}, options);
8478
- if (isInTMA()) {
8488
+ if (isInTelegramBrowser()) {
8489
+ if (isOS("ios", "android")) {
8490
+ if (options.returnStrategy === "back") {
8491
+ options.returnStrategy = "tg://resolve";
8492
+ }
8493
+ setOpenMethod("universal-link");
8494
+ openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
8495
+ } else {
8496
+ setOpenMethod("universal-link");
8497
+ const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
8498
+ openLinkBlank(linkWitStrategy);
8499
+ }
8500
+ } else if (isInTMA()) {
8479
8501
  if (isTmaPlatform("ios", "android")) {
8480
8502
  if (options.returnStrategy === "back") {
8481
8503
  options.returnStrategy = "tg://resolve";
@@ -10943,7 +10965,7 @@ class TonConnectUITracker {
10943
10965
  }
10944
10966
  }
10945
10967
  }
10946
- const tonConnectUiVersion = "2.0.8";
10968
+ const tonConnectUiVersion = "2.0.9-beta.0";
10947
10969
  class TonConnectUI {
10948
10970
  constructor(options) {
10949
10971
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());