@tonconnect/ui 2.0.8 → 2.0.9-beta.1
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/dist/tonconnect-ui.min.js +183 -183
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +44 -22
- package/lib/index.cjs.map +1 -1
- package/lib/index.mjs +44 -22
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
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,19 +8360,20 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8355
8360
|
if (!directLinkUrl.searchParams.has("startapp")) {
|
|
8356
8361
|
directLinkUrl.searchParams.append("startapp", "tonconnect");
|
|
8357
8362
|
}
|
|
8358
|
-
if (
|
|
8359
|
-
|
|
8363
|
+
if (isInTelegramBrowser()) {
|
|
8364
|
+
options.returnStrategy = "back";
|
|
8365
|
+
const linkWitStrategy = addReturnStrategy(directLinkUrl.toString(), options.returnStrategy);
|
|
8366
|
+
openLinkBlank(linkWitStrategy);
|
|
8367
|
+
} else if (isInTMA()) {
|
|
8368
|
+
if (isTmaPlatform("ios", "android", "macos", "tdesktop", "web")) {
|
|
8360
8369
|
options.returnStrategy = "back";
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8370
|
+
const linkWitStrategy = addReturnStrategy(
|
|
8371
|
+
directLinkUrl.toString(),
|
|
8372
|
+
options.returnStrategy
|
|
8373
|
+
);
|
|
8374
|
+
sendOpenTelegramLink(linkWitStrategy);
|
|
8365
8375
|
} else if (isTmaPlatform("weba")) {
|
|
8366
8376
|
sendOpenTelegramLink(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8367
|
-
} else if (isTmaPlatform("web")) {
|
|
8368
|
-
options.returnStrategy = "back";
|
|
8369
|
-
options.twaReturnUrl = void 0;
|
|
8370
|
-
sendOpenTelegramLink(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8371
8377
|
} else {
|
|
8372
8378
|
openLinkBlank(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8373
8379
|
}
|
|
@@ -8470,7 +8476,19 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8470
8476
|
}
|
|
8471
8477
|
function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
8472
8478
|
options = __spreadValues({}, options);
|
|
8473
|
-
if (
|
|
8479
|
+
if (isInTelegramBrowser()) {
|
|
8480
|
+
if (isOS("ios", "android")) {
|
|
8481
|
+
if (options.returnStrategy === "back") {
|
|
8482
|
+
options.returnStrategy = "tg://resolve";
|
|
8483
|
+
}
|
|
8484
|
+
setOpenMethod("universal-link");
|
|
8485
|
+
openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
|
|
8486
|
+
} else {
|
|
8487
|
+
setOpenMethod("universal-link");
|
|
8488
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8489
|
+
openLinkBlank(linkWitStrategy);
|
|
8490
|
+
}
|
|
8491
|
+
} else if (isInTMA()) {
|
|
8474
8492
|
if (isTmaPlatform("ios", "android")) {
|
|
8475
8493
|
if (options.returnStrategy === "back") {
|
|
8476
8494
|
options.returnStrategy = "tg://resolve";
|
|
@@ -8706,16 +8724,20 @@ const DesktopConnectionModal = (props) => {
|
|
|
8706
8724
|
generateUniversalLink();
|
|
8707
8725
|
}
|
|
8708
8726
|
setMode("desktop");
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
})
|
|
8718
|
-
|
|
8727
|
+
if (isTelegramUrl(universalLink())) {
|
|
8728
|
+
onClickTelegram();
|
|
8729
|
+
} else {
|
|
8730
|
+
const forceRedirect = !firstClick();
|
|
8731
|
+
setFirstClick(false);
|
|
8732
|
+
redirectToWallet(universalLink(), props.wallet.deepLink, {
|
|
8733
|
+
returnStrategy: appState.returnStrategy,
|
|
8734
|
+
forceRedirect
|
|
8735
|
+
}, (method) => {
|
|
8736
|
+
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
8737
|
+
openMethod: method
|
|
8738
|
+
}));
|
|
8739
|
+
});
|
|
8740
|
+
}
|
|
8719
8741
|
};
|
|
8720
8742
|
const onClickTelegram = () => {
|
|
8721
8743
|
const forceRedirect = !firstClick();
|
|
@@ -10938,7 +10960,7 @@ class TonConnectUITracker {
|
|
|
10938
10960
|
}
|
|
10939
10961
|
}
|
|
10940
10962
|
}
|
|
10941
|
-
const tonConnectUiVersion = "2.0.
|
|
10963
|
+
const tonConnectUiVersion = "2.0.9-beta.1";
|
|
10942
10964
|
class TonConnectUI {
|
|
10943
10965
|
constructor(options) {
|
|
10944
10966
|
__publicField(this, "walletInfoStorage", new WalletInfoStorage());
|