@tonconnect/ui 2.0.1-beta.1 → 2.0.1-beta.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.
- package/dist/tonconnect-ui.min.js +183 -183
- package/dist/tonconnect-ui.min.js.map +1 -1
- package/lib/index.cjs +273 -47
- package/lib/index.cjs.map +1 -1
- package/lib/index.mjs +273 -47
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -1754,7 +1754,32 @@ class TonConnectUIError extends sdk.TonConnectError {
|
|
|
1754
1754
|
Object.setPrototypeOf(this, TonConnectUIError.prototype);
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
+
function logDebug(...args) {
|
|
1758
|
+
{
|
|
1759
|
+
try {
|
|
1760
|
+
console.debug("[TON_CONNECT_UI]", ...args);
|
|
1761
|
+
} catch (e2) {
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
function logError(...args) {
|
|
1766
|
+
{
|
|
1767
|
+
try {
|
|
1768
|
+
console.error("[TON_CONNECT_UI]", ...args);
|
|
1769
|
+
} catch (e2) {
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
function logWarning(...args) {
|
|
1774
|
+
{
|
|
1775
|
+
try {
|
|
1776
|
+
console.warn("[TON_CONNECT_UI]", ...args);
|
|
1777
|
+
} catch (e2) {
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1757
1781
|
function openLink(href, target = "_self") {
|
|
1782
|
+
logDebug("openLink", href, target);
|
|
1758
1783
|
window.open(href, target, "noopener noreferrer");
|
|
1759
1784
|
}
|
|
1760
1785
|
function openLinkBlank(href) {
|
|
@@ -1762,7 +1787,7 @@ function openLinkBlank(href) {
|
|
|
1762
1787
|
}
|
|
1763
1788
|
function openDeeplinkWithFallback(href, fallback) {
|
|
1764
1789
|
const doFallback = () => {
|
|
1765
|
-
if (isBrowser("safari")) {
|
|
1790
|
+
if (isBrowser("safari") || isOS("android") && isBrowser("firefox")) {
|
|
1766
1791
|
return;
|
|
1767
1792
|
}
|
|
1768
1793
|
fallback();
|
|
@@ -1882,6 +1907,9 @@ function getUserAgent() {
|
|
|
1882
1907
|
case (browserName == null ? void 0 : browserName.includes("safari")):
|
|
1883
1908
|
browser = "safari";
|
|
1884
1909
|
break;
|
|
1910
|
+
case (browserName == null ? void 0 : browserName.includes("opera")):
|
|
1911
|
+
browser = "opera";
|
|
1912
|
+
break;
|
|
1885
1913
|
}
|
|
1886
1914
|
return {
|
|
1887
1915
|
os,
|
|
@@ -2631,22 +2659,6 @@ const Image = (props) => {
|
|
|
2631
2659
|
}
|
|
2632
2660
|
})];
|
|
2633
2661
|
};
|
|
2634
|
-
function logError(...args) {
|
|
2635
|
-
{
|
|
2636
|
-
try {
|
|
2637
|
-
console.error("[TON_CONNECT_UI]", ...args);
|
|
2638
|
-
} catch (e2) {
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
}
|
|
2642
|
-
function logWarning(...args) {
|
|
2643
|
-
{
|
|
2644
|
-
try {
|
|
2645
|
-
console.warn("[TON_CONNECT_UI]", ...args);
|
|
2646
|
-
} catch (e2) {
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
2662
|
let initParams = {};
|
|
2651
2663
|
try {
|
|
2652
2664
|
let locationHash = location.hash.toString();
|
|
@@ -2679,12 +2691,18 @@ function isInTMA() {
|
|
|
2679
2691
|
function sendExpand() {
|
|
2680
2692
|
postEvent("web_app_expand", {});
|
|
2681
2693
|
}
|
|
2682
|
-
function sendOpenTelegramLink(link) {
|
|
2694
|
+
function sendOpenTelegramLink(link, fallback) {
|
|
2683
2695
|
const url = new URL(link);
|
|
2684
2696
|
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
2697
|
+
if (fallback) {
|
|
2698
|
+
return fallback();
|
|
2699
|
+
}
|
|
2685
2700
|
throw new TonConnectUIError(`Url protocol is not supported: ${url}`);
|
|
2686
2701
|
}
|
|
2687
2702
|
if (url.hostname !== "t.me") {
|
|
2703
|
+
if (fallback) {
|
|
2704
|
+
return fallback();
|
|
2705
|
+
}
|
|
2688
2706
|
throw new TonConnectUIError(`Url host is not supported: ${url}`);
|
|
2689
2707
|
}
|
|
2690
2708
|
const pathFull = url.pathname + url.search;
|
|
@@ -2712,12 +2730,15 @@ function postEvent(eventType, eventData) {
|
|
|
2712
2730
|
throw new TonConnectUIError(`Can't post event to parent window: window is not defined`);
|
|
2713
2731
|
}
|
|
2714
2732
|
if (window2.TelegramWebviewProxy !== void 0) {
|
|
2733
|
+
logDebug("postEvent", eventType, eventData);
|
|
2715
2734
|
window2.TelegramWebviewProxy.postEvent(eventType, JSON.stringify(eventData));
|
|
2716
2735
|
} else if (window2.external && "notify" in window2.external) {
|
|
2736
|
+
logDebug("postEvent", eventType, eventData);
|
|
2717
2737
|
window2.external.notify(JSON.stringify({ eventType, eventData }));
|
|
2718
2738
|
} else if (isIframe()) {
|
|
2719
2739
|
const trustedTarget = "*";
|
|
2720
2740
|
const message = JSON.stringify({ eventType, eventData });
|
|
2741
|
+
logDebug("postEvent", eventType, eventData);
|
|
2721
2742
|
window2.parent.postMessage(message, trustedTarget);
|
|
2722
2743
|
} else {
|
|
2723
2744
|
throw new TonConnectUIError(`Can't post event to TMA`);
|
|
@@ -8313,9 +8334,46 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8313
8334
|
openLinkBlank(addReturnStrategy(directLinkUrl.toString(), options));
|
|
8314
8335
|
}
|
|
8315
8336
|
} else {
|
|
8316
|
-
if (isOS("ios"
|
|
8317
|
-
options.returnStrategy
|
|
8318
|
-
|
|
8337
|
+
if (isOS("ios")) {
|
|
8338
|
+
if (options.returnStrategy === "back") {
|
|
8339
|
+
options.returnStrategy = location.href;
|
|
8340
|
+
}
|
|
8341
|
+
const isChrome = isBrowser("chrome");
|
|
8342
|
+
const isFirefox = isBrowser("firefox");
|
|
8343
|
+
const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
|
|
8344
|
+
if (useDeepLink) {
|
|
8345
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8346
|
+
directLinkUrl.toString(),
|
|
8347
|
+
options.returnStrategy
|
|
8348
|
+
);
|
|
8349
|
+
const deepLink = convertToTGDeepLink(linkWithStrategy);
|
|
8350
|
+
openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
|
|
8351
|
+
} else {
|
|
8352
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8353
|
+
directLinkUrl.toString(),
|
|
8354
|
+
options.returnStrategy
|
|
8355
|
+
);
|
|
8356
|
+
openLinkBlank(linkWithStrategy);
|
|
8357
|
+
}
|
|
8358
|
+
} else if (isOS("android")) {
|
|
8359
|
+
options.returnStrategy = "none";
|
|
8360
|
+
const isChrome = isBrowser("chrome");
|
|
8361
|
+
const isFirefox = isBrowser("firefox");
|
|
8362
|
+
const useDeepLink = (isChrome || isFirefox) && !options.forceRedirect;
|
|
8363
|
+
if (useDeepLink) {
|
|
8364
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8365
|
+
directLinkUrl.toString(),
|
|
8366
|
+
options.returnStrategy
|
|
8367
|
+
);
|
|
8368
|
+
const deepLink = convertToTGDeepLink(linkWithStrategy);
|
|
8369
|
+
openDeeplinkWithFallback(deepLink, () => openLinkBlank(linkWithStrategy));
|
|
8370
|
+
} else {
|
|
8371
|
+
const linkWithStrategy = addReturnStrategy(
|
|
8372
|
+
directLinkUrl.toString(),
|
|
8373
|
+
options.returnStrategy
|
|
8374
|
+
);
|
|
8375
|
+
openLinkBlank(linkWithStrategy);
|
|
8376
|
+
}
|
|
8319
8377
|
} else if (isOS("macos", "windows", "linux")) {
|
|
8320
8378
|
options.returnStrategy = "none";
|
|
8321
8379
|
options.twaReturnUrl = void 0;
|
|
@@ -8331,6 +8389,160 @@ function redirectToTelegram(universalLink, options) {
|
|
|
8331
8389
|
}
|
|
8332
8390
|
}
|
|
8333
8391
|
}
|
|
8392
|
+
function redirectToWallet(universalLink, deepLink, options, setOpenMethod) {
|
|
8393
|
+
options = __spreadValues({}, options);
|
|
8394
|
+
if (isInTMA()) {
|
|
8395
|
+
if (isTmaPlatform("ios", "android")) {
|
|
8396
|
+
if (options.returnStrategy === "back") {
|
|
8397
|
+
options.returnStrategy = "tg://resolve";
|
|
8398
|
+
}
|
|
8399
|
+
setOpenMethod("universal-link");
|
|
8400
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8401
|
+
sendOpenTelegramLink(linkWitStrategy, () => {
|
|
8402
|
+
setOpenMethod("universal-link");
|
|
8403
|
+
openLinkBlank(linkWitStrategy);
|
|
8404
|
+
});
|
|
8405
|
+
} else if (isTmaPlatform("macos", "tdesktop")) {
|
|
8406
|
+
if (options.returnStrategy === "back") {
|
|
8407
|
+
options.returnStrategy = "tg://resolve";
|
|
8408
|
+
}
|
|
8409
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8410
|
+
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
8411
|
+
if (useDeepLink) {
|
|
8412
|
+
setOpenMethod("custom-deeplink");
|
|
8413
|
+
openDeeplinkWithFallback(toDeeplink(linkWitStrategy, deepLink), () => {
|
|
8414
|
+
setOpenMethod("universal-link");
|
|
8415
|
+
openLinkBlank(linkWitStrategy);
|
|
8416
|
+
});
|
|
8417
|
+
} else {
|
|
8418
|
+
setOpenMethod("universal-link");
|
|
8419
|
+
openLinkBlank(linkWitStrategy);
|
|
8420
|
+
}
|
|
8421
|
+
} else if (isTmaPlatform("weba")) {
|
|
8422
|
+
if (options.returnStrategy === "back") {
|
|
8423
|
+
if (isBrowser("safari")) {
|
|
8424
|
+
options.returnStrategy = location.href;
|
|
8425
|
+
} else if (isBrowser("chrome")) {
|
|
8426
|
+
options.returnStrategy = "googlechrome://";
|
|
8427
|
+
} else if (isBrowser("firefox")) {
|
|
8428
|
+
options.returnStrategy = "firefox://";
|
|
8429
|
+
} else if (isBrowser("opera")) {
|
|
8430
|
+
options.returnStrategy = "opera-http://";
|
|
8431
|
+
} else {
|
|
8432
|
+
options.returnStrategy = location.href;
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8436
|
+
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
8437
|
+
if (useDeepLink) {
|
|
8438
|
+
setOpenMethod("custom-deeplink");
|
|
8439
|
+
openDeeplinkWithFallback(toDeeplink(linkWitStrategy, deepLink), () => {
|
|
8440
|
+
setOpenMethod("universal-link");
|
|
8441
|
+
openLinkBlank(linkWitStrategy);
|
|
8442
|
+
});
|
|
8443
|
+
} else {
|
|
8444
|
+
setOpenMethod("universal-link");
|
|
8445
|
+
openLinkBlank(linkWitStrategy);
|
|
8446
|
+
}
|
|
8447
|
+
} else if (isTmaPlatform("web")) {
|
|
8448
|
+
if (options.returnStrategy === "back") {
|
|
8449
|
+
if (isBrowser("safari")) {
|
|
8450
|
+
options.returnStrategy = location.href;
|
|
8451
|
+
} else if (isBrowser("chrome")) {
|
|
8452
|
+
options.returnStrategy = "googlechrome://";
|
|
8453
|
+
} else if (isBrowser("firefox")) {
|
|
8454
|
+
options.returnStrategy = "firefox://";
|
|
8455
|
+
} else if (isBrowser("opera")) {
|
|
8456
|
+
options.returnStrategy = "opera-http://";
|
|
8457
|
+
} else {
|
|
8458
|
+
options.returnStrategy = location.href;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8462
|
+
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
8463
|
+
if (useDeepLink) {
|
|
8464
|
+
setOpenMethod("custom-deeplink");
|
|
8465
|
+
openDeeplinkWithFallback(toDeeplink(linkWitStrategy, deepLink), () => {
|
|
8466
|
+
setOpenMethod("universal-link");
|
|
8467
|
+
openLinkBlank(linkWitStrategy);
|
|
8468
|
+
});
|
|
8469
|
+
} else {
|
|
8470
|
+
setOpenMethod("universal-link");
|
|
8471
|
+
openLinkBlank(linkWitStrategy);
|
|
8472
|
+
}
|
|
8473
|
+
} else {
|
|
8474
|
+
setOpenMethod("universal-link");
|
|
8475
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8476
|
+
openLinkBlank(linkWitStrategy);
|
|
8477
|
+
}
|
|
8478
|
+
} else {
|
|
8479
|
+
if (isOS("ios")) {
|
|
8480
|
+
if (options.returnStrategy === "back") {
|
|
8481
|
+
if (isBrowser("safari")) {
|
|
8482
|
+
options.returnStrategy = location.href;
|
|
8483
|
+
} else if (isBrowser("chrome")) {
|
|
8484
|
+
options.returnStrategy = "googlechrome://";
|
|
8485
|
+
} else if (isBrowser("firefox")) {
|
|
8486
|
+
options.returnStrategy = "firefox://";
|
|
8487
|
+
} else if (isBrowser("opera")) {
|
|
8488
|
+
options.returnStrategy = "opera-http://";
|
|
8489
|
+
} else {
|
|
8490
|
+
options.returnStrategy = location.href;
|
|
8491
|
+
}
|
|
8492
|
+
}
|
|
8493
|
+
if (isBrowser("chrome")) {
|
|
8494
|
+
setOpenMethod("universal-link");
|
|
8495
|
+
openLink(addReturnStrategy(universalLink, options.returnStrategy), "_self");
|
|
8496
|
+
} else {
|
|
8497
|
+
setOpenMethod("universal-link");
|
|
8498
|
+
openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
|
|
8499
|
+
}
|
|
8500
|
+
} else if (isOS("android")) {
|
|
8501
|
+
if (options.returnStrategy === "back") {
|
|
8502
|
+
if (isBrowser("chrome")) {
|
|
8503
|
+
options.returnStrategy = "googlechrome://";
|
|
8504
|
+
} else if (isBrowser("firefox")) {
|
|
8505
|
+
options.returnStrategy = "firefox://";
|
|
8506
|
+
} else if (isBrowser("opera")) {
|
|
8507
|
+
options.returnStrategy = "opera-http://";
|
|
8508
|
+
} else {
|
|
8509
|
+
options.returnStrategy = location.href;
|
|
8510
|
+
}
|
|
8511
|
+
}
|
|
8512
|
+
setOpenMethod("universal-link");
|
|
8513
|
+
openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
|
|
8514
|
+
} else if (isOS("macos", "windows", "linux")) {
|
|
8515
|
+
if (options.returnStrategy === "back") {
|
|
8516
|
+
if (isBrowser("safari")) {
|
|
8517
|
+
options.returnStrategy = "none";
|
|
8518
|
+
} else if (isBrowser("chrome")) {
|
|
8519
|
+
options.returnStrategy = "googlechrome://";
|
|
8520
|
+
} else if (isBrowser("firefox")) {
|
|
8521
|
+
options.returnStrategy = "firefox://";
|
|
8522
|
+
} else if (isBrowser("opera")) {
|
|
8523
|
+
options.returnStrategy = "opera-http://";
|
|
8524
|
+
} else {
|
|
8525
|
+
options.returnStrategy = "none";
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
const linkWitStrategy = addReturnStrategy(universalLink, options.returnStrategy);
|
|
8529
|
+
const useDeepLink = !!deepLink && !options.forceRedirect;
|
|
8530
|
+
if (useDeepLink) {
|
|
8531
|
+
setOpenMethod("custom-deeplink");
|
|
8532
|
+
openDeeplinkWithFallback(toDeeplink(linkWitStrategy, deepLink), () => {
|
|
8533
|
+
setOpenMethod("universal-link");
|
|
8534
|
+
openLinkBlank(linkWitStrategy);
|
|
8535
|
+
});
|
|
8536
|
+
} else {
|
|
8537
|
+
setOpenMethod("universal-link");
|
|
8538
|
+
openLinkBlank(linkWitStrategy);
|
|
8539
|
+
}
|
|
8540
|
+
} else {
|
|
8541
|
+
setOpenMethod("universal-link");
|
|
8542
|
+
openLinkBlank(addReturnStrategy(universalLink, options.returnStrategy));
|
|
8543
|
+
}
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8334
8546
|
function addQueryParameter(url, key, value) {
|
|
8335
8547
|
const parsed = new URL(url);
|
|
8336
8548
|
parsed.searchParams.append(key, value);
|
|
@@ -8350,7 +8562,6 @@ function convertToTGDeepLink(directLink) {
|
|
|
8350
8562
|
const startapp = parsed.searchParams.get("startapp");
|
|
8351
8563
|
return `tg://resolve?domain=${domain}&appname=${appname}&startapp=${startapp}`;
|
|
8352
8564
|
}
|
|
8353
|
-
let openDesktopDeeplinkAttempts = 0;
|
|
8354
8565
|
const DesktopConnectionModal = (props) => {
|
|
8355
8566
|
const [mode, setMode] = createSignal("mobile");
|
|
8356
8567
|
const [connectionErrored, setConnectionErrored] = createSignal(false);
|
|
@@ -8391,25 +8602,16 @@ const DesktopConnectionModal = (props) => {
|
|
|
8391
8602
|
generateUniversalLink();
|
|
8392
8603
|
}
|
|
8393
8604
|
setMode("desktop");
|
|
8394
|
-
const
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
}));
|
|
8401
|
-
openDeeplinkWithFallback(toDeeplink(linkWithStrategy, props.wallet.deepLink), () => {
|
|
8402
|
-
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
8403
|
-
openMethod: "universal-link"
|
|
8404
|
-
}));
|
|
8405
|
-
openLinkBlank(linkWithStrategy);
|
|
8406
|
-
});
|
|
8407
|
-
} else {
|
|
8605
|
+
const forceRedirect = !firstClick();
|
|
8606
|
+
setFirstClick(false);
|
|
8607
|
+
redirectToWallet(universalLink(), props.wallet.deepLink, {
|
|
8608
|
+
returnStrategy: appState.returnStrategy,
|
|
8609
|
+
forceRedirect
|
|
8610
|
+
}, (method) => {
|
|
8408
8611
|
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
8409
|
-
openMethod:
|
|
8612
|
+
openMethod: method
|
|
8410
8613
|
}));
|
|
8411
|
-
|
|
8412
|
-
}
|
|
8614
|
+
});
|
|
8413
8615
|
};
|
|
8414
8616
|
const onClickTelegram = () => {
|
|
8415
8617
|
const forceRedirect = !firstClick();
|
|
@@ -8979,6 +9181,7 @@ const MobileConnectionQR = (props) => {
|
|
|
8979
9181
|
};
|
|
8980
9182
|
const MobileConnectionModal = (props) => {
|
|
8981
9183
|
const theme = useTheme();
|
|
9184
|
+
const [firstClick, setFirstClick] = createSignal(true);
|
|
8982
9185
|
const [showQR, setShowQR] = createSignal(false);
|
|
8983
9186
|
const [connectionErrored, setConnectionErrored] = createSignal(false);
|
|
8984
9187
|
const connector = useContext(ConnectorContext);
|
|
@@ -9007,10 +9210,16 @@ const MobileConnectionModal = (props) => {
|
|
|
9007
9210
|
return onClickTelegram();
|
|
9008
9211
|
}
|
|
9009
9212
|
setConnectionErrored(false);
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9213
|
+
const forceRedirect = !firstClick();
|
|
9214
|
+
setFirstClick(false);
|
|
9215
|
+
redirectToWallet(universalLink(), props.wallet.deepLink, {
|
|
9216
|
+
returnStrategy: appState.returnStrategy,
|
|
9217
|
+
forceRedirect
|
|
9218
|
+
}, (method) => {
|
|
9219
|
+
setLastSelectedWalletInfo(__spreadProps(__spreadValues({}, props.wallet), {
|
|
9220
|
+
openMethod: method
|
|
9221
|
+
}));
|
|
9222
|
+
});
|
|
9014
9223
|
};
|
|
9015
9224
|
const onOpenQR = () => {
|
|
9016
9225
|
setConnectionErrored(false);
|
|
@@ -9374,7 +9583,16 @@ const MobileUniversalModal = (props) => {
|
|
|
9374
9583
|
setIsCopiedShown(timeoutId);
|
|
9375
9584
|
});
|
|
9376
9585
|
const onSelectUniversal = () => {
|
|
9377
|
-
|
|
9586
|
+
const forceRedirect = !firstClick();
|
|
9587
|
+
setFirstClick(false);
|
|
9588
|
+
redirectToWallet(getUniversalLink(), void 0, {
|
|
9589
|
+
returnStrategy: appState.returnStrategy,
|
|
9590
|
+
forceRedirect
|
|
9591
|
+
}, (method) => {
|
|
9592
|
+
setLastSelectedWalletInfo({
|
|
9593
|
+
openMethod: method
|
|
9594
|
+
});
|
|
9595
|
+
});
|
|
9378
9596
|
};
|
|
9379
9597
|
const onSelectTelegram = () => {
|
|
9380
9598
|
const atWallet = props.walletsList.find((wallet) => wallet.appName === AT_WALLET_APP_NAME);
|
|
@@ -9896,19 +10114,27 @@ const ActionModal = (props) => {
|
|
|
9896
10114
|
if ((tonConnectUI == null ? void 0 : tonConnectUI.wallet) && "universalLink" in tonConnectUI.wallet && (tonConnectUI.wallet.openMethod === "universal-link" || sdk.isTelegramUrl(tonConnectUI.wallet.universalLink) && isInTMA())) {
|
|
9897
10115
|
universalLink = tonConnectUI.wallet.universalLink;
|
|
9898
10116
|
}
|
|
10117
|
+
let deepLink;
|
|
10118
|
+
if ((tonConnectUI == null ? void 0 : tonConnectUI.wallet) && "deepLink" in tonConnectUI.wallet && (tonConnectUI.wallet.openMethod === "custom-deeplink" || sdk.isTelegramUrl(tonConnectUI.wallet.deepLink) && isInTMA())) {
|
|
10119
|
+
deepLink = tonConnectUI.wallet.deepLink;
|
|
10120
|
+
}
|
|
9899
10121
|
const onOpenWallet = () => {
|
|
9900
10122
|
const currentAction = action();
|
|
9901
10123
|
const returnStrategy = "returnStrategy" in currentAction ? currentAction.returnStrategy : appState.returnStrategy;
|
|
10124
|
+
const forceRedirect = !firstClick();
|
|
10125
|
+
setFirstClick(false);
|
|
9902
10126
|
if (sdk.isTelegramUrl(universalLink)) {
|
|
9903
|
-
const forceRedirect = !firstClick();
|
|
9904
|
-
setFirstClick(false);
|
|
9905
10127
|
redirectToTelegram(universalLink, {
|
|
9906
10128
|
returnStrategy,
|
|
9907
10129
|
twaReturnUrl: "twaReturnUrl" in currentAction ? currentAction.twaReturnUrl : appState.twaReturnUrl,
|
|
9908
10130
|
forceRedirect
|
|
9909
10131
|
});
|
|
9910
10132
|
} else {
|
|
9911
|
-
|
|
10133
|
+
redirectToWallet(universalLink, deepLink, {
|
|
10134
|
+
returnStrategy,
|
|
10135
|
+
forceRedirect
|
|
10136
|
+
}, () => {
|
|
10137
|
+
});
|
|
9912
10138
|
}
|
|
9913
10139
|
};
|
|
9914
10140
|
return createComponent(ActionModalStyled, mergeProps(dataAttrs, {
|